Edit Transformation Templates

A single transformation applies a number of transformation templates, each of which defines a type of object that is acted on within the transformation, and the actions that are performed on objects of that type. The system provides a range of built-in default templates, and each type of transformation uses a specific subset of these templates. Typically, the transformation type and the subset of templates are tailored to the language the model is being being transformed into. Some default templates within a set have no content; these are 'latent', and represent the potential for acting on an object that is not generally included in the transformation but is perfectly valid if you wanted to include it. For example, the Linked Class Base template in the C# transformation.

You can tailor the transformation templates in various ways:

·Adjust the code in one or more of the templates in a default set
·Add code to a 'latent' default template
·Add a new custom template, based on one of the defaults but serving a different purpose that you define
·Add a new transformation type containing - initially - a basic set of default templates
·Add (or remove) a stereotyped override for a template

A stereotyped override directs the transformation to use the modified template only if the element and/or feature are of the specified stereotyped types. If the object or feature are not of that type, the transformation applies the base template.

Access     Package | MDA Transformation Templates   (Ctrl+Alt+H)

Edit Transformation Templates



See also


Click on the drop-down arrow and select the name of the transformation.



New Transformation Type

Click on this button if you want to create a new transformation.

A prompt displays for the name of the transformation; type in the name and click on the OK button.

The Templates list shows the default set of built-in templates, from which you can develop your transformation. Your custom transformation is not saved or available for use unless you add and/or edit one or more templates in the transformation.




Lists the transformation templates for the current transformation.

Click on a template name to highlight it and display its content in the Template panel. The Modified column indicates whether you have edited the template for this transformation.


The Code Template Editor in MDG Development



Displays the contents of the currently-selected template, and provides the editor facilities for modifying the template (right-click on the code text).

Write Transformations

The Code Template Editor in MDG Development

Code Template Syntax


Stereotype Overrides

Lists the stereotyped templates, for the active base template.

The Modified column indicates whether you have modified a stereotyped template.



Add New Custom Template

Click on this button to create a custom template to add to the current transformation.

A dialog displays, prompting you to specify:

·The object type (base template type) that this new template will respond to - click on the drop-down arrow and select the name (custom template types are not included in this list)
·The name of the new template - type in the appropriate text

Click on the OK button. The new template name is added to the list of templates, and it is opened in the template editor ready for you to add its code.



Add New Stereotyped Override

Click on this button to add a new stereotype override for the currently selected template. A dialog displays, prompting you to specify the:

·Base Class (stereotyped Class type - click on the drop-down arrow and click on the type in the list) and/or
·Feature (click on the drop-down arrow and click on the stereotyped feature in the list)

Click on the OK button. The override is added to the Stereotype Overrides list.



Get Default Template

Click on this button to update the editor display with the default version of the current built-in template or to clear the content of the current custom template.

If you have saved the changed template, re-instating the default version is a change, so the Modified field still displays the word Yes.




Click on this button to save the new or edited current template. You cannot switch to another template without saving the current template, so this effectively saves the transition as well.




Click on this button to delete the current custom template or stereotype override, or the most recent changes to a built-in template (effectively returning it to the default, base content). You cannot delete a built-in template.

You are prompted to confirm the deletion.




Click on this button to display this Help topic.




·Transformation template editing is based very strongly on code generation template editing; for additional information on editing transformation templates see the Code Template Editor section and the Editing Source Code topic

Learn more

·Code Template Framework (Developing and Editing)

Learning Center topics

·(Alt+F1) | Enterprise Architect | Model Transformations | Transform | Write Transforms