1. 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. |
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.Transformation.Adding.AttributeCreator
2.5. 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:
|
||
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. |
===
2.6. Sample Configuration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<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>