Refining move and submap mapping rules in
mapping projects
You
can refine the mapping rules that you specify in a mapping declaration. This
functionality enables you to customize the behavior of a mapping rule.
You must have
a mapping model open. A
mapping model has .mapping as a file name extension. The mapping model must contain at least one mapping
declaration, and
a mapping rule must be defined in the mapping declaration.
Managing mapping templates for model-to-model transformations
You can create, edit, or remove mapping templates. You can use
mapping templates to insert frequently used code patterns when you specify
code for mapping rule conditions, extractors, input filters, or output filters.
Default templates are provided, and you can create or import other templates.
Specifying conditions for move and submap mapping rules When
you specify a condition, a mapping rule is applied to an instance of the input
element only when the Java™ code that is specified returns a Boolean
value of true. If you do not specify a condition, the mapping
rule is always applied when you run the transformation. You can specify semantic refinements
by using the Object Constraint Language (OCL) API that Eclipse provides.
Specifying mapping file information in submap mapping rules You
can specify which mapping declaration, also called a map, a submap mapping
rule invokes. A submap rule can apply a mapping declaration that exists in
a separate mapping file.
Specifying input object and output object filters in submap mapping rules The
attributes in input and output objects can be collections of other objects.
When you specify a submap mapping rule in a mapping declaration, you can create
input and output filters that are applied to the elements in the collection
of the attribute. When you run the transformation, the filter is applied to
each element in the collection. If the filter returns true for
the element, the element is transformed.
Creating objects without direct correspondences to source objects
By default, the mapping editor enables you to map from elements
in a single source container to elements in a single target container. However,
you can modify the generated transformation so that you can also create objects
in a different target container than the one being mapped to.
Specifying custom extractors in submap mapping rules The
transformation source code for a submap mapping rule invokes another transformation.
If the input attribute in a submap mapping rule represents a collection of
objects, the transformation that is specified in the submap rule is run once
for each object in the collection. You can modify this default behavior by
specifying an input filter or a custom extractor. When you run the generated
transformation code, the collection of objects that the custom extractor returns
is used instead of the collection of the input attribute.