New Service Sequence Diagram
The Sequence Diagram illustrates the chronological flow of a case, detailing the interactions between participants and the information exchanged at each step.
Before creating a sequence diagram, make sure you have created a use case. After completing the diagram, proceed to Generate State Machine transitions.
CREATE A USER STORY IN A USE CASE
- From the Containment Tree: right click on the use case in the use case diagram
- Create Element > interaction
- Type the name of the interaction
- Right-click on the Interaction > Create Diagram > UML Diagram > Sequence Diagram
COMPLETE THE USER STORY
- Open the "Composite Structure Context Diagram" located in the Context_Package > Context class.
- Drag&Drop the Actor(s) and the System classes into the diagram
- Rename them respectively to "aUser" and "aMySpec", for example
- Go back to the Sequence Diagram, then drag and drop the System and Actor instances into the diagram.
We need to specify the state of our system in the Sequence Diagram, so we will create a State Machine for the System class to define its behavior.
- Right-click on the System class → Create Element → State Machine.
- Name it "MySpec_State_Machine", for example
- Create its diagram: Create Diagram → UML Diagram → State Machine Diagram.
- Finally, name your state "Active".
Go back to the Sequence Diagram. Then add a State Invariant to the lifeline representing MySpec.
- Select the Active state.
- Click OK.
From the Containment Tree, right-click on the "Interfaces_Package" package and select "Create FlowType in Browser".
- Type the name of the Flow: "request_to_say_hello"
- Add New Parameter with type: String and name: "name"
- Click on Create
- Go back to the Sequence Diagram and trace a New Message between the User lifeline and the MySpec lifeline
- Select "request_to_say_hello"
- Click OK.
- Click Connect.
- Click Message to Self and then click the MySpec lifeline.
We now need to create the activity associated with this message to self.
- From the Containment Tree: right-click on "MySpec" Class:
- Create Element → operation
- Name it "create_message"
- Right-click on "MySpec" Class: Create Element > Property.
- Double-click the Property, name it "message_to_say" and set its type to String.
- Set the default value to "INIT"
- Create an Activity by right-clicking: MySpec:Class → Create Element → Activity.
- Name it "create_message_behavior"
- Right-click on the Activity → Create Diagram → UML Diagram → Activity Diagram
- Double-click the "create_message" operation.
- Set the method by dragging and dropping the activity into the method section.
- Go to the Activity Diagram "create_message".
- Drag and drop an Initial Node and an Opaque Action
- Set the body of the Opaque Action with:
message_to_say = "Hello from " + request_to_say_hello_name_value;
- Drag and drop an Activity Final Node.
- Link all the elements with Control Flow
Go back to the Sequence Diagram, double-click the Message to self and set the Signature operation to "create_message".
- Trace a New Message between the lifeline MySpec and the User
- Click on New
- Type the name of the flow: "say"
- Add New Parameter with type String and name message
- Click on Create
- Click OK.
- Select the data value: message_to_say
- Click OK.
- Click on Connect
