Metamodel mappings are mappings between metamodel objects, which control how objects are imported or generated. Metamodel mappings are sub-objects of the PowerDesigner metamodel object on which they are defined.
To open a metamodel mapping property sheet, select the mapping from
the list at the top of the Mapping Editor Mappings pane or parent object property sheet Mapping tab and click the Properties tool.
The tabs available on a particular mapping property sheet depend on the objects being mapped. The General tab contains the following properties:
Property |
Description |
---|---|
Source object | Specifies the metamodel object being mapped to the target object. |
Target object | Specifies the metamodel object being mapped from the source object. This object is the parent of the mapping itself. |
Transformation script | [metaattribute mappings] Specifies a
script to set the value of the attribute. In the following example,
from an XML import, the notnullable attribute is imported to the Mandatory attribute and, because the
sense of the attributes is reversed, the boolean value imported is
set to the opposite of the source
value:Sub %Set%(obj, sourceValue) obj.SetAttribute "Mandatory", not sourceValue End SubIn the following example, from an object generation, the NumberID attribute is generated to the Comment attribute and a text string is prepended to make clear the origin of the value: Function %AdjustValue%(sourceValue, sourceObject, targetObject) Dim targetValue targetValue = "The original process NumberID is " +cstr(sourceValue) %AdjustValue% = targetValue End Function |
Sub %Initialize%(obj) obj.Stereotype = "SimpleType" End Sub
Sub %PostProcess%(obj) ' Copy code into name obj.Name = obj.Code End Sub