Chapter10-Activity Diagram
Chapter10-Activity Diagram
• Can be used to break out the activities that occur within a use case
• Commonly shows many different activities that will be handled by lots of different symbols
• When analyzing a use case, and before methods are assigned to symbols
-1-
Note: The diagram shown above is for reference only. Use the instructions beginning on the next
page to draw your Activity diagram.
1. Right-click in the background of the state diagram. The Utilities background menu opens.
-2-
-3-
3. Click . The Diagram type dialog box closes and the Diagram Window opens with an
Activity Diagram labeled "ACD_1_STD.
Note: The diagram you just created is now the active design model. When the Activity model is
created, the Diagram Window displays a palette with icon symbols used to create activity
diagrams.
Note: When the Activity Diagram is created, the previously created diagrams also remain open.
In a specification-perspective diagram or an
implementation-perspective diagram, an
activity is a method on a class
State In an activity diagram the states are activities
Transition representing the performance of operations. The
transitions are triggered by the completion of the
operations.
A transition is a relationship between two states.
This transition indicates that control is passed from
the first state to the second state once the work of
the source state is complete.
To emphasize functional flow of control, transitions
can be labeled, and contain parameters, guard
conditions and action expressions.
Initial State A pseudo state to establish the start of the event
into an actual state.
Final State Signifies when a state transition ends.
-4-
-5-
1. From the Activity Diagram palette double-click the ACD ActionState symbol icon .
2. Position the cursor in the top center portion of the drawing area and click. An action state symbol is
placed on the design area.
3. Place four more action state symbols in the diagram. When all symbols are in place the diagram
should resemble the following graphic.
-6-
4. Deselect the action state icon by pressing the ESC key or by clicking the cursor located below
the Activity Diagram palette.
1. Double-click the top action state symbol. The Properties Editor Action State dialog box opens.
2. Enter the text "validateCardType" in the Name text box and click . The Attribute Editor
closes and the text appears in the action state symbol.
3. Click once on the second action state symbol to select it. Click once again and the State Identifier
pop-up editor opens.
4. Enter the text "requestPassword" and press Enter. The window closes and the text is entered in the
action state symbol.
5. Repeat steps 4-6 to label the remaining action state symbols as follows:
validatePassword
validateTxKind
validateAmount
-7-
2. Place the symbol by clicking approximately one inch (1") to the left of the "validate card type" state
symbol.
3. To connect the initial state symbol to the action state symbol, click the Transition symbol in the
Activity Diagram palette .
4. Click once on the right side of the initial state symbol, drag the cursor to the left side of the action
state symbol and click again. A transition link now connects the two symbols.
-8-
5. To label the transition click once on the link to select it. Click again and the Transition Identifier pop-
up editor opens.
6. Enter the text "insertCard" in the EventName text box and press Enter. The pop-up editor closes
and the link is labeled.
2. The final state will complete activities from multiple actions so we will put the symbol to the right of all
the action states. Place the symbol by clicking approximately two inches (2") to the right of the
"validatePassword" action state symbol.
-9-
1. To draw a transition link, click the Transition symbol in the Activity Diagram palette .
2. Click once on the bottom center of the action state symbol labeled "validateCardType". Drag the
cursor down to the top center of the action state labeled "requestPassword" and click again. A
transition link now connects the two symbols.
3. To label the transition click once on the link to select it. Click again and the Transition Identifier pop-
up editor opens.
4. Enter the text "ValidMagStrip" in the EventName text box and press Enter. The pop-up editor closes
and the link is labeled.
-10-
5. Since we are going to put another link on the right side of the diagram we need to reposition the
label. Place the cursor on the label "ValidMagStrip" and while holding down the mouse button, move
the label to the left side of the link. Release the mouse button when the label is in place.
2. Click the right side of the "validateCardType" symbol. Drag the cursor down to the Final State
symbol. The link is squared automatically.
3. Following the steps 1 and 2, draw the next link from the "validateAmount" symbol to the Final State
symbol.
4. To label the transition between "validateCardType" and the final state, double-click the link. The
Properties Editor for Transition dialog box opens.
-11-
7. Enter the text "ejectCard" and click . The Properties Editor dialog box closes and the
transition link is now labeled.
8. Following steps 5-7, label the second link with the following text:
Text Box Label Text
Event Name = Process
Action = processTransaction( )
Action = ejectCard
Note: After entering the first action, double-click in the next text box and enter the second action in
the activated text box.
-12-
2. While holding down the Ctrl key, click the right side of the "request password" symbol. Drag the
cursor to the right in a straight line approximately one-half inch (1/2").
4. Click and drag the cursor to the left approximately one-half inch (1/2").
5. Click, release the Ctrl key and drag the cursor down to the top of the Action State.
7. Double-click the link to open the Properties Editor for Transition dialog box. Following the procedure
used to label previous links, enter the text "InvalidSyntax" for the Event Name and
"requestPasswordAgain" for the Action.
2. Place the symbol to the right and between the "request password" and "validate password" action
state symbol.
-13-
-14-
2. Click on the upper left corner of the "validatePassword" action state. Drag to the lower left corner of
the "requestPassword" action state and click again. A transition link is drawn between the two
states.
3. Repeat steps 1 and 2 to draw the following links:
validatePassword to validateTxKind
validateTxKind to validateAmount
4. Label the links as follows:
Action State Event Name Action
validatePassword to InvalidPassword requestPasswordAg
requestPassword ain
validatePassword to RequestKind requestKind()
validateTxKind
validateTxKind to RequestAmount requestAmount()
validateAmount
-15-
-16-