|
|
Rhapsody Model Transformers |
Much like Model Simplifiers, Model Transformers are a step in the code generation process (and usually invisible to the user). Both Model Transformers and Model Simplifiers allow manipulation of the generated code/executable model through helpers without modifying the original user model. Model Transformers are invoked before Model Simplifiers and there may be multiple transformations, for example:

Whereas simplifiers create a ‘flattened’ version of the model containing only artifacts that are directly related to code, Model Transformers create a full copy* of the model, allowing greater flexibility in model manipulation as part of the generation process.
*Typically, this copy does not contain diagrams that are not related to code generation (for example sequence diagrams).
Model Transformers are activated through a property applied to the Component/Configuration (typically this is achieved through application of a stereotype):
CPP_CG.Configuration.TransformationSequence
The Power Pack has several Model Transformers and supplies a stereotype for each however if multiple transformations are required then the property should be locally overridden instead either directly through properties or through the application of a user-defined stereotyped. The property should contain all Model Transformers as a comma separated list, for example:

By default, the transformed model is not visible to the user. Viewing the transformed model is not necessary for the functionality to work but may be of interest to the advanced user. To view the transformed model, add an asterisk to the transformation Sequence property, for example:
transformInheritedInterfaceBlocks*

The next time code is generated (or the model executed in Rhapsody Systems Designer) the transformed model will be retained in the model browser:

If multiple transformers are used then each one may optionally be retained, for example:

Transformed models are then nested:

Rhapsody dynamically creates a Transformed Model stereotype that overrides several properties:
![]()

All Rhapsody Power Pack Model Transformers override the GeneratePackageCode property and reset it back to ‘Smart’ to ensure the code is generated correctly.