(since v2.4.0)
1. Introduction
This transformation provides specific rules to process tagged values.
Note
|
Common transformer functionality supports setting of tagged values. See Setting Tagged Values for further details. |
2. Configuration
The following sections specifiy the configuration options for this transformation.
2.1. Class
The class for this transformer implementation is de.interactive_instruments.shapechange.core.transformation.taggedvalues.TaggedValueTransformer
2.2. Rules
2.2.1. rule-trf-taggedValue-createOriginalSchemaInformationTags
For all classes and properties of the schemas selected for processing, this rule sets a number of tagged values:
-
class:
-
originalSchemaName - name of the (application) schema package which owns the class
-
originalClassName - the class name
-
property:
-
originalSchemaName - name of the (application) schema package which owns the property (more specifically, the class that owns that property)
-
originalInClassName - name of the class which owns the property
-
originalPropertyName - the property name
-
originalPropertyMultiplicity - the property multiplicity
-
originalPropertyValueType - the property value type
The information is kept by subsequent transformations (like Flattener rules, which might otherwise set such tags), and can especially be useful for targets which need to encode information about the origin of transformed model elements. An example is the SqlDdl target, which can use the information to generate SQL encoding infos.
2.2.2. rule-trf-taggedValue-createPropertyValueTypeInformationTag
(since v4.0.0)
For each property of classes within the schemas selected for processing, a tagged value is added, providing information about the property value type.
The tag name is defined by transformation parameter propertyValueTypeInfoTagName.
The tag value is determined as follows:
-
If the property value type is undefined (e.g. typically for enums), then the tag value is the empty string.
-
Otherwise, if the value type could not be found in the model (which can happen, for example if the value type was set manually and contains a typo), or if the value type does not belong to the schemas selected for processing, then the tag value is the name of the value type, as defined for the property in the model.
-
Otherwise, i.e. the value type does belong to the schemas selected for processing:
-
If the value type has no subtypes, then the tag value is the value type name.
-
Otherwise, the tag value is a comma-separated list of all non-abstract subtypes in the complete subtype hierarchy, including the value type itself if it is not abstract.
-
2.2.3. rule-trf-taggedValue-inheritance
Copies the tagged values specified via configuration parameter taggedValueInheritanceGeneralList from supertypes of the whole model down to their subtypes, starting at the top of inheritance trees. If the tagged value already exists in the subtype, then by default it is retained. However, the value can also be overwritten and the two values can be merged - for further details, see configuration parameters taggedValueInheritanceOverwriteList and taggedValueInheritanceAppendList.
Note
|
Care should be taken in case that the model contains classes with multiple supertypes. |
Note
|
The implementation currently does not support tagged values with multiple values. |
2.3. Parameters
2.3.1. propertyValueTypeInfoTagName
(since v4.0.0)
Alias: none
Required / Optional: optional
Type: String (comma-separated list)
Default Value: 'propertyValueTypeName'
Explanation: Name of the tag to be added by rule-trf-taggedValue-createPropertyValueTypeInformationTag.
Applies to Rule(s): rule-trf-taggedValue-createPropertyValueTypeInformationTag
2.3.2. taggedValueInheritanceAppendList
Alias: none
Required / Optional: optional
Type: String (comma-separated list)
Default Value: none
Explanation: Comma-separated list of names of tagged values. If a subtype already has a tagged value that would be copied from a supertype under rule-trf-taggedValue-inheritance, and that tagged value is contained in the list, then the value from the tagged value of the supertype shall be appended to the value of the tagged value from the subtype, using the separator defined by configuration parameter taggedValueInheritanceAppendSeparator.
Note
|
Appending a tagged value has lower priority than overwriting (see taggedValueInheritanceOverwriteList). If a tagged value is listed for both parameters taggedValueInheritanceOverwriteList and taggedValueInheritanceAppendList then it will be ignored in the latter. |
Applies to Rule(s): rule-trf-taggedValue-inheritance
2.3.3. taggedValueInheritanceAppendSeparator
Alias: none
Required / Optional: optional
Type: String
Default Value: ", "
Explanation: Define the separator to use when a tagged value inherited from a supertype under rule-trf-taggedValue-inheritance shall be appended to the tagged value of the subtype.
Applies to Rule(s): rule-trf-taggedValue-inheritance
2.3.4. taggedValueInheritanceGeneralList
Alias: none
Required / Optional: Required
Type: String (comma-separated list)
Default Value: none
Explanation: Comma-separated list of names of tagged values for which rule-trf-taggedValue-inheritance shall be applied.
Applies to Rule(s): rule-trf-taggedValue-inheritance
2.3.5. taggedValueInheritanceOverwriteList
Alias: none
Required / Optional: Required
Type: String (comma-separated list)
Default Value: none
Explanation: Comma-separated list of names of tagged values. If a subtype already has a tagged value that would be copied from a supertype under rule-trf-taggedValue-inheritance, and that tagged value is contained in the list, then the tagged value shall be overwritten in the subtype, rather than being retained.
Note
|
Overwriting a tagged value has higher priority than appending (see taggedValueInheritanceAppendList). If a tagged value is listed for both parameters taggedValueInheritanceOverwriteList and taggedValueInheritanceAppendList then it will be ignored in the latter. |
Applies to Rule(s): rule-trf-taggedValue-inheritance
3. Sample Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<Transformer
class="de.interactive_instruments.shapechange.core.transformation.taggedvalues.TaggedValueTransformer"
input="INPUT" id="taggedValueInheritance" mode="enabled">
<parameters>
<ProcessParameter name="taggedValueInheritanceGeneralList"
value="tv1,tv2,tv3,tvIgnoredInAppendList,other1,other3"/>
<ProcessParameter name="taggedValueInheritanceOverwriteList"
value="tv2,tvIgnoredInAppendList,other1,other1,other1,other2"/>
<ProcessParameter name="taggedValueInheritanceAppendList"
value="tv3,tvIgnoredInAppendList,other3,other3,other3,other4"/>
<ProcessParameter name="taggedValueInheritanceAppendSeparator" value="|"/>
</parameters>
<rules>
<ProcessRuleSet name="taggedValueInheritance">
<rule name="rule-trf-taggedValue-inheritance"/>
</ProcessRuleSet>
</rules>
</Transformer>