Arguments, parameters, and return values specified on a Message in a Sequence diagram can be parsed and new Operations can be created. Parsing and mapping Message names to real model elements (operations, parameters, etc.) allows for easy transition from prototype Sequence diagrams to complete Sequence diagrams representing actual Interactions between system parts.

Message name parsing

On a Message name area on a diagram pane, you can type the name of a new Operation together with arguments, parameters, and return value. After you click on the button near the Message name, the new Operation will be created, together with its specifications.

Message syntax

The whole Message name should be written according to Message syntax rules.

Message Parsing notification message

If any Message name syntax errors are found, users are warned and given suggestions for fixing these mistakes. The Message Parsing notification message opens, showing the concrete error.

Example of Message parsing 

In the preceding example, you can see that the following appears on the Message name: 

getUserAddress(city=”Allen”, street=”700 Central Expy S”, No=”110”). After you click the Create New Operation (this message button ), the new getUserAddress Operation will be created. The following Message arguments will be created - Allen, 700 Central Expy S, and 110, together with the corresponding parameters - city, street, No.


To create a new operation from the diagram pane


  1. Create a call Message (asynchCall or synchCall) between two Lifelines.

    The Lifeline that the call Message is connected to must have a type specified.The preceding figure shows that the Address type is assigned to the second Lifeline.

  2. On the diagram pane, on the message, type the message name according to the syntax rules.

  3. After you have typed the Message name, exit the edit mode by clicking on the diagram pane.

  4. Select the Message label again. The Create New Operation according to this message button  is displayed next to the Message name.

  5. Click the Create New Operation according to this message button . A new Operation is created and represented in the message Specification window , the Signature (operation)  property cell .

    Note that a new Operation is created only after you click the Create New Operation according to this message button . If you do not click this button, the Message label will be treated as a Message name.

    If the syntax is written incorrectly, the Message Parsing window opens.

Parsing rules


The following table describes Message name samples and parsing results:

Purpose

Message name typed on the diagram pane

Action after typing on the message label

Result

Create a new Operation

login ()

Click the Create New Operation according to this message button .

The new operation is created: login ()

  1. The Operation is referenced in the Message Specification window, the Signature (operation) property cell.
  2. For the Lifeline type, the login operation is created.

After click on the Create New Operation according to this message button , a new Operation is always created. A new Operation is created even if an Operation with the
same name already exists.

Create a new Operation with an argument

 
login (“John”)
 Click the Create New Operation according to this message button .

 The new operation is created: login (unnamed1=”John”)

  1. The Operation is referenced in the Message Specification window, the Signature (operation) property cell.
  2. In the message Specification window > the Arguments property group, the following argument is created: John
  3. For the Lifeline type, the login Operation is created.
  4. The login Operation’s parameter is created and synchronized with the message argument.

   

Different kinds of arguments are supported. For the following arguments the following value specifications are created:

John - Opaque Expression

12345 - Literal Integer

True - Literal Boolean

“John” - Literal String (always when quotation-marks are used).

For more information about value specification, see Assigning value specification as property value.

Create a new Operation with a parameter and an argument

login (username=”John”)

Click the Create New Operation according to this message button .

 The new operation is created: login (username=”John”)

  1. The Operation is referenced in the Message Specification window, the Signature (operation) property cell.
  2. In the Message Specification window > the Arguments property group, the following argument is created: John
  3. For the Lifeline type, the login operation is created. 
  4. The login operation’s parameter is created and synchronized with the Message argument.

Create a new Operation with a return parameter

login () : true
Click the Create New Operation according to this message button .

The new operation is created: login () : true

  1. The Operation is listed in the Message Specification window, the Signature (operation) property cell.
  2. In the Message Specification window > the Arguments property group the following argument is created: true.
  3. For the classifier assigned to the Lifeline, the login Operation is created, together with the parameter.
  4. The login Operation’s parameter with the return direction is created. The Operation’s parameter is synchronized with the Message argument.

Create a new Operation for the Message together with a reply Message

status = login ()
Click the Create New Operation according to this message button .

The new operation is created: status = login ()

  1. The Operation is listed in the message Specification window, the Signature (operation) property cell.
  2. In the Message Specification window > the Reply message property cell, the replay Message is created. (The Replay message property cell is displayed in Expert mode only.)

3. The status argument is created in the replay Message.

Create a new argument for the Message

If this is valid, the argument is added straight from the M essage label for the already- existing O peration.

Before was:

login (username=John)

Add the
argument 1282:

login (username=John, 1284)

Exit the Message label edit mode by clicking the
diagram pane.

A new argument is created and the Message is highlighted with yellow color; that is, the validation warning appears informing you that a parameter is missing and the Message argument is not synchronized with the operation parameter.

To resolve the validation warning:

  1. Click the Message. The Message smart manipulator toolbar displays.
  2. Click the button to synchronize the Message argument with the Operation parameter.

Update the argument

Before was:

login (John)

Now change the argument to:

login (Joseph)

Exit the message label edit mode by clicking the diagram pane.

The argument is updated.


Notification message about incorrect syntax


If the Message syntax is incorrect, you will receive the following notification message at the bottom right corner of the modelin tool's window.

Example of Message Parsing notification message

In the first line of the Message Parsing notification message, you will see an incorrect message name. In the example, the incorrect Message name is getUser Address(city=). Due to the incorrect Message name, parsing cannot be executed and a new Operation cannot be created. In the second paragraph of the Message Parsing notification message, you will see the explanation of which syntax is expected. Next, you can see an example of the correct Message syntax.