Prev Next

Write Transformations

Enterprise Architect provides a facility to create your own transformations; this can be useful to automate the process of generating more specific models from more general ones, reusing the transformation and preventing errors from being introduced as they might if the models were created by hand. The existing templates will provide a useful guide and reference to assist you when creating new templates.

Transformation templates are based on the Code Generation Template Framework, and an understanding of the way these templates work is critical to be able to adjust existing transformation templates or to create new ones. Therefore it is suggested that you read and understand the topics discussing Code Generation Templates prior to using the Transformation Template language.

Access

Ribbon

Design > Tools > Transform > Transform Templates

Keyboard Shortcuts

Ctrl+Alt+H

Factors concerning Transformation Templates

Factor

Detail

See also

Default Transformation Templates

Enterprise Architect provides a set of default transformation templates that you can use 'as is' or customize to your requirements.

Default Transformation Templates

General Syntax for the Intermediary Language

Transformations in Enterprise Architect generate an intermediary code form of the model being created in the transformation. You can review and edit this code.

Intermediary Language

Intermediary Language Debugging

You can also debug transformation scripts by checking the intermediary code generated from the Transform script.

Intermediary Language Debugging

Editing transformation templates and code

When writing transformations, you use the facilities of the common Code Editor.

Editing Source Code

Code Template Framework

You use the Code Template Framework to perform forward engineering of UML models. The Transformation Template Framework is derived from this.

Code Template Framework Tool Code Template Framework

Syntax for Creating Objects

To generate objects or elements in a transformation, you apply a specific syntax in the template script.

Objects

Syntax for Creating Connectors

To generate connectors (relationships) in a transformation, you also apply a specific syntax in the template script.

Connectors Transform Connectors

Transforming Duplicate Information

In many transformations there is a substantial amount of information to be copied. Rather than place this information in the template, you can use macros to read it from its source.

Copy Information

Transforming Template Parameter Substitutions

In a transformation template, if you are transforming Template Binding connector binding parameter substitutions, you can use the Template Parameter substitution macros.

Transform Template Parameter Substitution

Converting Types

You can apply various methods for converting data types to different target platform types.

Convert Types

Converting Names

You can apply various methods for converting names of elements to different target platform naming conventions.

Convert Names

Cross References

During a transformation, you can perform cross verification of transformed elements.

Cross References

Notes

  • Further hints and tips can be gleaned from a close study of the Transformation Templates provided with Enterprise Architect
  • The Transformation Template editor applies the facilities of the common Code Editor

Learn more