UML model

Scope

This target writes the selected application schemas to an Enterprise Architect model file, more specifically to a new “class view” package (with name following the pattern “ShapeChangeOutput-“ + <timestamp>) added to the first model package found in that file. The capability is mainly useful for generating a physical model of schemas that have been processed using one or more transformations.

Stereotype mappings

(Since v2.6.0)

You should use stereotype mappings to ensure that the model elements written to the UML model are assigned to the correct UML Profile / MDG.

Without such a mapping, EA may automatically map the stereotype written by ShapeChange to a stereotype from an arbitrary UML Profile / MDG. The mapping is based on equality (ignoring case) of the unqualified stereotype name. The mapping performed by EA can lead to undesired results. For example, the stereotype ‘featuretype’ (which is one of the stereotypes that are well-known to ShapeChange) could be mapped to the stereotype ‘FeatureType’ of the GML MDG, resulting in an element with qualified stereotype ‘GML::FeatureType’. If, instead, you wanted to ensure that it is mapped to stereotype ‘featureType’ from your UML Profile / MDG, you should add a map entry to the configuration.

NOTE: You also need to ensure that your UML Profile / MDG is available and active in the EA environment in which you execute ShapeChange. To do so, import the MDG with EA – to a template EAP which is used to write the model (see target parameter eapTemplate) and/or use ‘Import To User’, i.e. install the MDG locally.

For further details on configuring these mappings, see the Map Entries section, and especially the information about param stereotype.

Configuration

Overview

The Enterprise Architect UML model target in ShapeChange is configured using the standard <Target> element.

The following is a sample <Target> definition:

<Target class="de.interactive_instruments.ShapeChange.Target.EA.UmlModel" mode="enabled" inputs="Profile">
  <targetParameter name="modelFilename" value="output/Profile.eap"/>
</Target>

As for all targets, the “inputs” attribute may be used to specify that a model that is the result of a transformation is used as input model for this target.

Parameters

documentationNoValue

(since v2.0.2)

Required / Optional: optional

Type: String

Default Value: none

Explanation: If a descriptor is used in the documentation template, but has no value, this parameter will be used. See here for more information about descriptors.

documentationTemplate

(since v2.0.2)

Required / Optional: optional

Type: String

Default Value: [[definition]]

Explanation: The template for the documentation that is placed in the notes field in the EA model. The patterns “[[descriptor]]” will be replaced by the value of the descriptor, or the value of documentationNoValue, if the descriptor has no value for the model element. See here for more information about descriptors.

eapTemplate

(since v2.6.0)

Required / Optional: optional

Type: String

Default Value: none

Explanation: Path to the EAP template file (can be local or an online resource).

If the output file (location and name are defined by the parameters outputDirectory and modelFilename) does not exist, the default behavior of this target is to create a new EA repository.

However, if writing the model requires a specific UML Profile / MDG to be available, this would fail if it is not configured in the EA environment where ShapeChange is executed. In that situation, you would want the UML Profile / MDG loaded into the EA repository to which the model is written. Such a repository can be provided as a template, and configured to be used by ShapeChange via the parameter eapTemplate.

Applies to Rule(s): none – general behaviour

modelFilename

Required / Optional: optional

Type: String

Default Value: ShapeChangeExport.eap

Explanation: The Enterprise architect EAP file to which the application schema(s) are written.

omitOutputPackageDateTime

(since v2.5.0)

Required / Optional: optional

Type: Boolean

Default Value: false

Explanation: Can be used to prevent the addition of the timestamp to the new class view package that is added to the model by ShapeChange.

outputDirectory

Required / Optional: optional

Type: String

Default Value: none

Explanation: The path to the folder in which the resulting UML model will be created.

Map Entries

<mapEntries> contain individual <MapEntry> elements, which for this target contain information for mapping specific stereotypes.

Example:

<mapEntries>
 <MapEntry type="application schema" rule="*" targetType="ShapeChange::applicationSchema"
 param="stereotype"/>
 <MapEntry type="featuretype" rule="*" targetType="ShapeChange::featureType" param="stereotype"/>
 <MapEntry type="type" rule="*" targetType="ShapeChange::type" param="stereotype"/>
 <MapEntry type="datatype" rule="*" targetType="ShapeChange::dataType" param="stereotype"/>
 <MapEntry type="union" rule="*" targetType="ShapeChange::union" param="stereotype"/>
 <MapEntry type="codelist" rule="*" targetType="ShapeChange::codeList" param="stereotype"/>
 <MapEntry type="enumeration" rule="*" targetType="ShapeChange::enumeration" param="stereotype"/>
 <MapEntry type="property" rule="*" targetType="ShapeChange::property" param="stereotype"/>
 <MapEntry type="enum" rule="*" targetType="ShapeChange::enum" param="stereotype"/>
</mapEntries>

A <MapEntry> element contains the attributes described in the following sections.

type

Required / Optional: Required

Explanation: Typically the UML type/class name to be mapped, however:

  • The target currently does not perform a mapping of the UML type/class name.
  • Since v2.6.0, the target can map the name of a stereotype. The ‘type’ of a stereotype mapping (indicated by attribute ‘param’ having the value ‘stereotype’) must be one of the stereotypes that are well-known to ShapeChange.

rule

Required / Optional: Required

Explanation: The encoding rule to which this mapping applies. May be “*” to indicate that the mapping applies to all encoding rules.

targetType

Required / Optional: Required

Explanation: Mapping target for the model element identified by attribute ‘type’. If the map entry is a stereotype mapping (indicated by attribute ‘param’ having the value ‘stereotype’), the target typically is a qualified name of a stereotype, following the pattern {YourProfile}::{targetStereotype}.

param

Required / Optional: Optional

Explanation: Defines one or more parameters for the mapping.

Each parameter has a name. A list of parameters is separated by commas. Each parameter can also have characteristics defined for it, providing even further information for the conversion. Characteristics for a parameter are provided within curly braces. A characteristic is either provided by identifier only, or by a key-value pair, with the key being the identifier of the characteristic.

Example(s):

  • stereotype

Supported parameters, their interpretation as well as characteristics are described in the following sections.

Parameter: stereotype

(since v2.6.0)

Explanation: Identifies the map entry as a stereotype mapping.

Characteristics: none

Top