Importing Rational Rose properties

This topic shows you how to set up to import IBM® Rational Rose® properties. In addition, it describes how to see the imported properties in IBM Rational® Rhapsody® and how you can post-process the imported Rational Rose properties in your Rational Rhapsody model.

About this task

Importing a Rational Rose model details how to import a Rational Rose model, at which time you can also import its properties.

You must define which Rational Rose properties you want to import based on the tool, metaclass, and property name, for which you have to create an XML map file. During the importing process in Rational Rhapsody, you point to the XML map file on the Import Options window.

Designing your XML map file

Procedure

  1. Decide which XML map file you want to use. The Rational Rhapsody product includes sample XML map files that you can use to design the XML map file. The sample XML map files are located in <Rational Rhapsody installation path>/Share/etc.
    • rose_properties_import.xml is the basic map file and within it is a list of the common values for attributes and a list of the Rose tools.
    • rose_properties_import_java.xml is specifically for importing a Java Rational Rose model.
      Note: The default location and name for the XML map file is <Rational Rhapsody installation path>/Share/etc/rose_properties_import.xml. You can change this location by modifying the RoseInterface::Import::PropertiesXMLPath property to point to another path for the XML map file.
  2. Using any text editor, modify the XML map file. For each property in the XML map file, you must include its metaclass, tool, and property name for the Rational Rose model. Suppose, for example, that you have a NewClass class in your Rational Rose model, as shown in the following figure, that you want to import into Rational Rhapsody:
    Class Specification window
    Your XML map file would include the following mapping:
    XML map file

Seeing the imported Rational Rose properties in Rational Rhapsody

Procedure

  1. Continuing from the example of importing the NewClass class from Rational Rose, in the browser in Rational Rhapsody, expand the package in which the imported class resides and open the Features window for the imported class.
  2. Depending on whether the imported class was imported with the default Rational Rose settings, do the following:
    1. If the class was imported with the Rational Rose default settings for the property, select Overridden.
    2. If the class was imported with property settings other than the Rational Rose default settings, select Locally Overridden. In the case of our example of the imported NewClass class, its property settings are different from the Rational Rose default settings for a class, so you select Locally Overridden, as shown in the following figure:
      Features window - Properties tab showing locally overridden properties

What to do next

After you have imported your Rational Rose properties, you have to use the Rational Rhapsody application programming interface (API) to post-process your model. For information about how to handle properties using the Rational Rhapsody API, see this documentation.

The following code sample is an extension of the example in this topic that shows how you could retrieve the property values through the Rational Rhapsody API. This example prints a report of all classes in a package, with the value of the Model::Class::Java_Final property (the imported Rational Rose property) that is equal to True.
Public Sub PrintFinalClasses(p As IRPPackage)
'
'Routine to print names of all final classes imported from Rose
'
    Dim allClassifiers As RPCollection
    Set allClassifiers = p.nestedClassifiers
    Dim c As RPClassifier
    For Each c In allClassifiers
        isClass = c.isOfMetaClass("Class")
        If isClass Then
            On Error Resume Next
            If c.getPropertyValue("Model.Class.Java_Final") = "True" Then
                Print c.getFullPathName
            End If
        End If
    Next
End Sub

Feedback