Chapter 4 Managing Profiles


Defining the templates for the collaboration diagram metaclass

Once you have defined the template used to evaluate each message sequence number, you have to create a template to sort these sequence numbers (compareCbMsgSymbols ), and another template to retrieve all messages from the collaboration diagram (description ).

The template compareCbMsgSymbols is a boolean that allows verifying if a message number is greater than another message number. The syntax of this template is the following:

.bool (%Item1.Object.SequenceNumber% >= %Item2.Object.SequenceNumber%)

The returned value for this template is used with parameter compare in template description which code is the following:

Collaboration Scenario %Name%:
\n
.foreach_item(Symbols,,, %ObjectType% == CollaborationMessageSymbol, %compareCbMsgSymbols%)
   %Object.description%
.next(\n)

In this template, the first line is used to generate the title of the scenario using the name of the collaboration diagram %Name%. Then it creates a new line.

Then the macro for each item loops on each message symbol, verifies and sorts the message number, and outputs the message description using the syntax defined in previous section.

Steps To define templates for the collaboration diagram metaclass:

  1. Right-click the Profile category and select Add Metaclasses.

    The Metaclass Selection dialog box is displayed.
  2. Click the Modify Metaclass Filter tool and select Show All Metaclasses.
  3. Select CollaborationDiagram in the list of metaclasses displayed in the PdOOM tab and click OK.

    The CollaborationDiagram category is displayed under Profile.
  4. Right-click the CollaborationDiagram category and select New→Template.

    A new template is created.
  5. Type compareCbMsgSymbols in the Name box of the template
  6. (optional) Type a comment in the Comment box of the template.
  7. Type the following code in the text area:

    .bool (%Item1.Object.SequenceNumber% >= %Item2.Object.SequenceNumber%)
  8. Click Apply.
  9. Right-click the CollaborationDiagram category and select New→Template.

    A new template is created.
  10. Type description in the Name box of the template
  11. (optional) Type a comment in the Comment box of the template.
  12. Type the following code in the text area:

    Collaboration Scenario %Name%:
    \n
    .foreach_item(Symbols,,, %ObjectType% == CollaborationMessageSymbol, %compareCbMsgSymbols%)
       %Object.description%
    .next(\n)

  13. Click Apply.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.