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.
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
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.
On the diagram pane, on the message, type the message name according to the syntax rules.
After you have typed the Message name, exit the edit mode by clicking on the diagram pane.
Select the Message label again. The Create New Operation according to this message button is displayed next to the Message name.
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 ()
|
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 | |||
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”)
|
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”)
|
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
|
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 ()
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 login (username=John, 1284) | Exit the Message label edit mode by clicking the | 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:
|
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.
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.