IBM Support

How to create a UML-to-code transformation in RSA

Troubleshooting


Problem

This technote provides instructions on how create and run a UML to code transformation in the IBM® Rational® Software Architect (RSA).

Resolving The Problem

RSA provides the capability to generate code from a UML model. The following example shows how to generate C++ code from a sample UML model.

1. Create a UML model.




2. Select File > New > Transformation Configuration


3a. This will bring up the New Transformation Configuration menu. Enter a name for the transformation in the Name field.


3b. Expand IBM Rational Transformations to the type of transformation that you would like to perform and highlight it. Select Next.
OPTIONAL: Select Enable reverse transformation if you plan on performing transformation from code back to the model. In the Configuration file destination field, you can choose a different project to save the transformation configuration.


4a. The next menu is the New Transformation Configuration. Under Selected source, expand the Models folder and choose the model to be transformed.




4b. To select a new target, select Create New Target Container... This will bring up the project creation wizard.


4c. Give the new project a name.


4d. Select Finish or select any optional configurations


4e. After the new project is created, it will be listed in the Selected Target field. Highlight the target project. Select Finish or select Next to select and optional features.


5. (OPTIONAL) The next menu is the Properties of the C++ transformation. Here you can choose to overwrite existing files for each transformation. This menu also allows you to specify which standard operations the transformation generates.


6. (OPTIONAL) The Mapping menu allows particular elements of the model to be mapped to a model. (For more information, see technote #1259512)


7. (OPTIONAL) The Common menu contains settings for transformation specific options. This is the last menu for optional configurations. Click Finish to create the transformation configuration.


8. After the configuration is created, a .tc file will be created in the project specified in step 3b. To run the configuration, select Modeling > Transform > [Name of the transformation].tc > UML to [code]


9. The code will be generated to the target project.


[{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Transformation","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSJP3D","label":"Rational Systems Developer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"","label":""}],"Version":"7.0;7.0.0.1;7.0.0.2;7.0.0.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
10 September 2020

UID

swg21259513