To create the First End Of Association operation for coloring Associations between a Block and a Use Case
- Create an Opaque Behavior named 'First End Of Association'.
- Right-click the Opaque Behavior element and open its Specification window. Do one of the following:
Click the plus sign next to the Owned Parameter property to edit it.
If you cannot see the Owned Parameter property, make sure the Expert mode is enabled.
- On the left side menu, select Parameters > Create.
- In the Specification of Parameter window, set Name to Association, Type to Association, and Direction to in. Click Back.
- In the Opaque Behavior Specification window, click three dots next to the Body and Language property to edit it.
- In the Body and Language dialog, select Language > StructuredExpression.
Click Create operation > Script.
If you cannot see the Script operation, make sure the Expert mode is enabled.
- Set the Operation Name to ‘First End’.
- From the Language drop-down list, select Javascript Rhino.
Insert the following script as the Body:
Javascript Rhinoarg1.size() > 0 ? arg1.iterator().next() : null
- Select First End > arg1 > Reset.
- Select First End > arg1 > Metachain Navigation.
- Click Insert.
- Under Metaclass or Stereotype, select Association, and under Property, select End Type.
- Click OK.