Attribute Creator
Introduction
Supports adding new attributes to classes of selected schemas.
The new attributes as well as the classes to which they shall be added are defined via the configuration.
NOTE: adding new associations / association roles as well as overwriting existing attributes is not supported by this transformer.
Configuration
The following sections specifiy the configuration options for this transformation.
Class
The class for this transformer implementation is de.interactive_instruments.ShapeChange.Transformation.Adding.AttributeCreator
Parameters
At the moment no specific parameters are defined for this transformation.
Rules
At the moment no specific rules are defined for this transformation.
Map Entries
At the moment no map entries are defined for this transformation.
Advanced Process Configuration
The <advancedProcessConfigurations> element inside of the <Transformer> element is used to define new attributes. An <AttributeDefinition> element is added for each new attribute. Class selection information inside of such a definition allows the attribute to be added to multiple classes within selected schemas.
An <AttributeDefinition> is structured as follows (the exact XML Schema definition is available in the ShapeChangeConfiguration.xsd):
Element Name | Subelement / -attribute |
Required / Optional | Type | Default Value | Explanation |
classSelection | PackageSelector | Required | (complex) | – | Classes to which new attributes will be added must be owned by the packages identified by this selector. Selection occurs as follows:
|
ClassSelector | Required | (complex) | – | Classes to which new attributes will be added are selected as follows:
|
|
descriptors | – | Optional | (complex) | – | Descriptors to be assigned to the new attribute.
Example: <descriptors> <Descriptor name="definition"> <descriptorValues> <DescriptorValue>This is a ...</DescriptorValue> <DescriptorValue lang="de">Dies ist ein ...</DescriptorValue> </descriptorValues> </Descriptor> <Descriptor name="alias"> <descriptorValues> <DescriptorValue>My feature type alias</DescriptorValue> </descriptorValues> </Descriptor> </descriptors> |
initialValue | – | Optional | String | – | An initial value for the new attribute. |
isDerived | – | Optional | Boolean | false | True, if the new attribute shall be a derived property. |
isOrdered | – | Optional | Boolean | false | True, if the new attribute shall be ordered. |
isReadOnly | – | Optional | Boolean | false | True, if the new attribute shall be read only. |
name | – | Required | String | – | The name of the new attribute.NOTE: If the name equals one of the properties that already exist for a selected class, then the new attribute will not be added to that class (overwriting existing properties is not allowed). The new attribute may, however, restrict a property with the same name from a supertype of the selected class. |
multiplicity | – | Optional | String | 1 | The multiplicity of the new attribute (must be compliant to usual UML notation). |
stereotypes | Stereotype | Optional | String | – | Stereotype(s) to be assigned to the new attribute. |
taggedValues | TaggedValue | Optional | (complex) | – | Tagged value(s) to be assigned to the new attribute.NOTE: some tagged values have specific meaning
|
type | – | Required | String | – | Name of the class that shall be used as the type of the new attribute.NOTE: If the type does not exist within the model, the new attribute is created with unknown category of value. For derivation of target representations this may still be ok, if the target defines a mapping for the type. |
Sample Configuration
<Transformer class="de.interactive_instruments.ShapeChange.Transformation.Adding.AttributeCreator" id="trf"> <advancedProcessConfigurations> <AttributeDefinition> <classSelection> <PackageSelector schemaNameRegex="Test Schema[1-2]"/> <ClassSelector stereotypeRegex="featuretype"/> </classSelection> <descriptors> <Descriptor name="alias"> <descriptorValues> <DescriptorValue>Alias</DescriptorValue> </descriptorValues> </Descriptor> </descriptors> <name>GMLID</name> <taggedValues> <TaggedValue name="sequenceNumber" value="0"/> </taggedValues> <type>CharacterString</type> </AttributeDefinition> </advancedProcessConfigurations> </Transformer>