Output Operation Signature of Call Message in Sequence Diagram to Doc. Composer
With the Doc. Composer user can output the details of the sequence diagram into HTML, PDF and MS Word. In this article we will create customized template to output the call message of a lifeline including the call message operation signature to document.
To output the operation signature from call message:
- Go to Tools > Composer > Manage Template XML.
- Select Lifeline under Model Type.
- Right click on Details template and select Duplicate from popup menu.
- Name the template as Call Messages, and choose Table as it icon.
- Replace the content of the template as follow.
<?xml version="1.0" encoding="UTF-8"?> <ElementBaseInitiationBlock> <!-- Basic --> <Inline template="Basic (with anchor mark)"/> <Text style="@heading+">Relationships</Text> <ParagraphBreak/> <HasRelationshipChecker> <TableBlock colWidths="40, 30, 30" tableStyle="Summaries"> <TableRow> <TableCell> <Text>Relationship</Text> </TableCell> <TableCell> <Text>From</Text> </TableCell> <TableCell> <Text>To</Text> </TableCell> </TableRow> <ForEachRelationship> <Conditions> <ModelElementPropertyConditionChecker property="actionType"> <Conditions> <ValueChecker property="modelType" value="ActionTypeCall"/> </Conditions> </ModelElementPropertyConditionChecker> </Conditions> <Sortings> <Sorting by="property" property="callOperationSignature"/> </Sortings> <TableRow> <TableCell> <Property property="callOperationSignature"/> </TableCell> <TableCell> <FromElement> <Icon/> <Property property="name"/> </FromElement> </TableCell> <TableCell> <ToElement> <Icon/> <Property property="name"/> </ToElement> </TableCell> </TableRow> </ForEachRelationship> </TableBlock> <ParagraphBreak/> </HasRelationshipChecker> </ElementBaseInitiationBlock>
- Press Save button and close the Manage Template XML dialog.
- Now go to Tools > Composer.
- Select Build Doc from Scratch.
- Select a lifeline in Diagram Navigator or Model Explorer, and drag out the Call Messages template into document.
Now the incoming and outgoing call messages of the lifeline, including the operation signature and arguments are outputted to document.
Explanation of the template
In the looping of relationships of the lifeline we define a filtering condition to only process on the Call Action.
<ForEachRelationship> <Conditions> <ModelElementPropertyConditionChecker property="actionType"> <Conditions> <ValueChecker property="modelType" value="ActionTypeCall"/> </Conditions> </ModelElementPropertyConditionChecker> </Conditions>
Next we specify the sorting of the message based on the callOperationSignature property.
<Sortings> <Sorting by="property" property="callOperationSignature"/> </Sortings>
In the template we replace the message icon and name to callOperationSignature property. This property will output the signature of the operation associated to the call message, as well as the arguments and sequence number.
<TableRow> <TableCell> <Property property="callOperationSignature"/> </TableCell>
Remarks: The callOperationSignature property is supported since v15.2 build 20190130bh.
Related Know-how |
Related Link |
Leave a Reply
Want to join the discussion?Feel free to contribute!