Prev | Next |
Transform Connectors
When you transform a connector, you can use two different types of Class as the connector ends: either a Class created by a transformation, or an existing Class for which you already know the GUID.
Connect to a Class Created by a Transformation
The most common connection is to a Class created by a transformation; to create this connection you use three items of information:
This type of connector is created using the TRANSFORM_REFERENCE function macro; when the element is in the current transformation, it can be safely omitted from the transformation. The simplest example of this is when you have created multiple Classes from a single Class in a transformation, and you want a connector between them; consider this script from the EJB Entity transformation:
Dependency
{
%TRANSFORM_REFERENCE("EJBRealizeHome",classGUID)% stereotype="EJBRealizeHome"
Source
{
%TRANSFORM_REFERENCE("EJBEntityBean",classGUID)%
}
Target
{
%TRANSFORM_REFERENCE("EJBHomeInterface",classGUID)%
}
}
In this script there are three uses of the TRANSFORM_REFERENCE macro: one to identify the connector for synchronization purposes and the other two to identify the ends; all three use the same source GUID, because they all come from the one original Class. None of the three have to specify the transformation because the two references are to something within the current transformation - each of them then only has to identify the transform name.
It is also possible to create a connector from another connector. You can create a connector template and list all connectors connected to a Class from the Class level templates; you don't have to worry about only generating the connector once, because if you have created a TRANSFORM_REFERENCE for the connector then the system automatically synchronizes them.
This script copies the source connector:
%connectorType%
{
%TRANSFORM_CURRENT()%
%TRANSFORM_REFERENCE("Connector",connectorGUID)%
Source
{
%TRANSFORM_REFERENCE("Class",connectorSourceGUID)%
%TRANSFORM_CURRENT("Source")%
}
Target
{
%TRANSFORM_REFERENCE("Class",connectorDestGUID)%
%TRANSFORM_CURRENT("Target")%
}
}
Connecting to a Class for which you know the GUID
The second type of Class that you can use as a connector end is an existing element for which you know the current GUID. To create this connection, specify the GUID of the target Class in either the source or target end; this script creates a Dependency from a Class created in a transformation, to the Class it was transformed from:
Dependency
{
%TRANSFORM_REFERENCE("SourceDependency",classGUID)%
stereotype="transformedFrom"
Source
{
%TRANSFORM_REFERENCE("Class",classGUID)%
}
Target
{
GUID=%qt%%classGUID%%qt%
}
}
Notes
Learn more