Connectors

Creating connectors in a transformation can be complex, but the process has the same form as creating elements. The difference is that you must also specify each end.

Topics:

Topic

Detail

See also

Connector Types

The different connectors that can be created are as follows:

  • Aggregation
  • Assembly
  • Association
  • Collaboration
  • ControlFlow
  • Connector
  • Delegate
  • Dependency
  • Deployment
  • ForeignKey
  • Generalization
  • InformationFlow
  • Instantiation
  • Interface
  • InterruptFlow
  • Manifest
  • Nesting
  • NoteLink
  • ObjectFlow
  • Package
  • Realization
  • Sequence
  • Transition
  • UseCase
  • Uses

 

There are two different types of Class that you can use as a connector end: one created by a transformation, and one for which you already know the GUID

 

Connect to a Class Created by a Transformation

The most common connection is to connect to a Class created by a transformation; to do this you must have three items of information:

  • The original Class GUID
  • The name of the transformation
  • The name of the transformed Class

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 want a connector between them; consider this example from the EJB Entity transformation:

Dependency

{

 %TRANSFORM_REFERENCE("EJBRealizeHome",classGUID)%

 stereotype="EJBRealizeHome"

 Source

 {

   %TRANSFORM_REFERENCE("EJBEntityBean",classGUID)%

 }

 Target

 {

   %TRANSFORM_REFERENCE("EJBHomeInterface",classGUID)%

 }

}

There are three uses of the TRANSFORM_REFERENCE macro: one to identify this 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 referencing something in the current transformation - each of them then only has to identify the transform name

Of course, it is also possible to create a connector from another connector

You can create a connector template and list over all connectors connected to a Class from the Class level templates; you don't have to worry about only generating it once, because if you have created a TRANSFORM_REFERENCE for the connector then Enterprise Architect automatically synchronizes them

The following 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")%

 }

}

Cross References

Connecting to a Class for which you know the GUID

The second type of Class that you can use as a connector end is one for which you know the current GUID

To do this, specify the GUID of the target Class in either the source or target end; the following example 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:

  • ForeignKey is a special case where not just a connector is created - you must also list the columns involved in the transformation; in addition, tags specified on the connector are actually created on the foreign key operation in the source Class, and a cascade property can be added - for example, cascade="update","delete"
  • Also, the nullable property of the foreign key is set to true if either end has a multiplicity that includes zero; this can be overridden by setting nullable="1" or nullable="0" in the source section of the foreign key
  • Each connector is transformed at both end objects, therefore the connector might appear twice in the transformation; this is nothing to be concerned about, but you should check carefully that the connector is generated exactly the same way, regardless of which end is on the current Class