You can use Rose script language to read, set and delete properties.
Below are two sample script that outline some of these abilities when
working
with properties:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Main
'example code
' walks thru classes And prints out; class, property names And count
'Changes DDL property Codename value to "BOB"
''!!!BACKUP MODEL BEFORE RUNNING ANY DEMO CODE THAT CHANGES VALUES IN
MODEL!!!
viewport.open
viewport.clear
Dim aModel as Model
set aModel = RoseApp.CurrentModel
Dim ClasColl as ClassCollection
Dim theClass as Class
Dim PropColl as PropertyCollection
Dim theProperty As Property
Dim AttrColl As AttributeCollection
Dim theAttr As Attribute
ToolName$ = "cg"
RoseApp.CurrentModel.DefaultTool = ToolName$
set ClasColl = aModel.GetAllClasses
Print "Class count: "; ClasColl.Count
Print
For Idx = 1 to ClasColl.Count
set theClass = ClasColl.GetAt(Idx)
Print "class: "; theClass.name
Set PropColl = theClass.GetProperties
Print "Prop count: "; PropColl.Count
For PropID = 1 To PropColl.Count
Set theProperty = PropColl.GetAt (PropID)
Print "propname and value: "; theProperty.Name, theProperty.Value
'* check for particular property and set value:
If TheProperty.Name = "CodeName" Then
theProperty.Value = "BOB"
Print "propname and NEW value: "; theProperty.Name, theProperty.Value
End If
Next PropID
Print "--"
Print
Next
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This is a quick sample of creating a property and tool
Const cPropValue$ = "DoNotDeclare"
Sub Main
Dim defProps As DefaultModelProperties
Dim worked As Boolean
Dim selClasses As ClassCollection
Dim theClass As Class
Dim theProp As Property
RoseApp.WriteErrorLog "Start Add Property"
Set defProps = RoseApp.CurrentModel.DefaultProperties
'AddDefaultProperty will create the tool specified (Extra) if it
'does not alread exist
worked = defProps.AddDefaultProperty("Class", "Extra", "default", _
"Persistent", "Boolean", "True")
Set selClasses = RoseApp.CurrentModel.GetSelectedClasses()
If selClasses.Count = 0 Then
RoseApp.WriteErrorLog "No classes selected"
End If
For i = 1 To selClasses.Count
Set theClass = selClasses.GetAt(i)
RoseApp.WriteErrorLog "Class: " & theClass.name
Set theProp = theClass.FindProperty("cg", "GenerateDefaultConstructor")
theProp.Value = cPropValue$
Next i
RoseApp.WriteErrorLog "Done"
MsgBox "Done: see log for details"
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Patrick Kennedy
Rational Support
-----Original Message-----
From: Alexiev, Nikolay [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 6:53 AM
To: Rational
Subject: (ROSE) MDL Parser
I need MDL parser because I have a big model with many custom properties
but now I need to rename and remove some of them. If you have a different
idea plese share with me.
------------------------------------------------
Company: Information Services, Corp., Ministry of Finance Bulgaria
Address:
str. Paniot Volov #2
Sofia 1000
Bulgaria
Telephone: +359-2-96562041
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
* http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
* To: [EMAIL PROTECTED]
* Subject: <BLANK>
* Body: unsubscribe rose_forum
*************************************************************************
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Post or Reply to: [EMAIL PROTECTED]
* Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
* http://www.rational.com/support/usergroups/rose/rose_forum.jsp
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
* To: [EMAIL PROTECTED]
* Subject: <BLANK>
* Body: unsubscribe rose_forum
*************************************************************************