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:

  1. Go to Tools > Composer > Manage Template XML.

    Manage Template XML

  2. Select Lifeline under Model Type.

    Select Lifeline model type

  3. Right click on Details template and select Duplicate from popup menu.

    Duplicate Details template

    Duplicate Details template

  4. Name the template as Call Messages, and choose Table as it icon.

    Name the template as Call Messages

    Name the template as Call Messages

  5. 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>
  6. Press Save button and close the Manage Template XML dialog.
  7. Now go to Tools > Composer.

    Create Doc. Composer

    Create Doc. Composer

  8. Select Build Doc from Scratch.

    Select Build Doc from Scratch

    Select Build Doc from Scratch

  9. Select a lifeline in Diagram Navigator or Model Explorer, and drag out the Call Messages template into document.

    Drag Call Messages template to document

Now the incoming and outgoing call messages of the lifeline, including the operation signature and arguments are outputted to document.

Call message of selected lifeline output to document

Call message of selected lifeline output 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

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply