optimus-logo

Using Transformation Masks


About the transformation mask

Creating a transformation generator using Optimus involved the creation of many different transformations to address general purpose. Most of the time, only a subset of these transformations are relevant for the user according to its needs. For example, a JavaEE developer only exploit a part of a Java transformation generator.

A transformation mask enables user to choose whether or not a transformation or a set of transformations will be execute at runtime. It can be seen as a profile, by the way, a JavaEE profile if we consider the previous example.

Choosing transformation mask

We choose the preferred transformation mask through the preference window under Optimus > Transformation Mask Configuration. A drop-down menu list all the transformation mask available. Under the menu, we find a brief description of the selected mask and the list of transformations enabled/disabled by it.

m2m-pref-page

The default preferred transformation mask enables all the transformations (named Default all On mask).

Moreover, some Optimus tools provide a pop-up asking for the transformation mask before the generation execution, by-passing the preferred mask.

Creating transformation masks

There are essentially two ways to create a transformation mask. You should avoid to create transformation masks with the same name, otherwise unexpected behavior could occur.

Though an extension point

Extension point is mostly used by developer of the code generator. The associated extension point ID is net.atos.optimus.m2m.engine.masks.TransformationMasks. Three kinds of contributed transformation mask are available :

  • The implemented mask. An implementation of the mask are directly given, with respect to the interface net.atos.optimus.m2m.engine.core.masks.ITransformationMask

m2m-transfo-mask

  • The inclusive mask

    • By default, all transformations are disabled.

    • Each transformation or transformation set, added to this mask, are enabled.

  • The exclusive mask.

    • By default, all transformations are enabled.

    • Each transformation or transformation set, added to this mask, are disabled.

The example below shows some inclusive and exclusive masks contributed by the extension point mechanism :

m2m-extension-point

With the preference page

We can create a new transformation mask using the associated button in the preference page. A new mask is based on at least one other previous contributed mask. If you select only one mask, the new mask is simply a copy of the choose mask, either for the include or exclude mode. Otherwise, the new mask is the result of the merge of selected masks, according to the following rules :

  • The merge follows the order of the selection from top to bottom, it isn’t a reflexive operation.

  • An inclusive mask enables all its enabled transformations on the mask under construction.

  • An exclusive mask disables all its disabled transformations on the mask under construction.

The example below shows the creation of a mask excluding test and pipeline by merging two contributed mask :

m2m-mask-creation

After created a new mask, we can change its description and enable/disable transformations within it or delete it. Due to the requirements between the different transformations, we have the following behavior :

  • Selecting a transformation selects automatically all transformations required by this transformation.

  • Deselecting transformation deselects automatically all transformations requiring this transformation.

The change on a mask are effective only where the apply or ok button are pressed. In this case, the modified mask become the preferred mask.

Furthermore, we can’t edit or delete a contributed mask.

Additional feature

It is possible to import a mask through an XML file respecting the mask schema. The imported mask is editable.

Regarding the same schema, we can export all the mask available.