You are on page 1of 28

partner-pub-5002 w w w .





Home Activity Diagrams Activity Diagrams Reference Activity Diagrams Examples UML Index

Activity Diagrams
Activity modeling emphasizes the sequence and conditions for coordinating lower-level behaviors, rather than which classifiers own those behaviors. These are commonly called control flow and object flow models. The actions coordinated by activity models can be initiated because other actions finish executing, because objects and data become available, or because events occur external to the flow. The following nodes and edges are typically drawn on UML activity diagrams: activity, partition, action, object, control, activity edge. You can find some activity diagram examples here:
     

Online Shopping Business Flow - Process Order Business Flow - Document Management Process Software Design - Resolve Issue Sentinel HASP SL - Manual Activation of Trial Product Single Sign-On for Google Apps

Activity is a parameterized behavior represented as coordinated flow of actions. The flow of execution is modeled as activity nodes connected by activity edges. A node can be the execution of a subordinate behavior, such as an arithmetic computation, a call to an operation, or manipulation of object contents. Activity nodes also include flow of control constructs, such as synchronization, decision, and concurrency control. Activities may form invocation hierarchies invoking other activities, ultimately resolving to individual actions. In an object-oriented model, activities are usually invoked indirectly as methods bound to operations that are directly invoked. Activity contains activity nodes which could be:


 

Object Control

Activities may contain actions of various kinds:
   

Occurrences of primitive functions, such as arithmetic functions. Invocations of behavior, such as activities. Communication actions, such as sending of signals. Manipulations of objects, such as reading or writing attributes or associations.

There are actions that invoke activities - either directly using call behavior action or indirectly with call operation action. Activity could be rendered as round-cornered rectangle with activity name in the upper left corner and nodes and edges of the activity inside the border. UML 2.4 specification examples show activity name in bold.

Online Shopping activity. Activity parameters are displayed on the border and listed below the activity name as: parameter-name: parameter-type.

Authenticate User activity with two parameters - Login Id and Password.

otherwise.and post-condition constraints. The following constraints are normative (standard) in UML 2.As a behavior activity could have pre. The keyword «singleExecution» is used for activities that execute as a single shared execution (singleton). these are shown with the keywords «precondition» and «postcondition». Activity parameters if any are displayed on the frame.Login Id and Password. respectively. Constraints could be selected according to the type of the element that the partition represents. each invocation executes in its own space. to indicate it is an activity class. UML allows behaviors to produce tokens that are activities and which can in turn be executed at the runtime. The notation for classes with the keyword «activity» can be used to show the features of a reflective activity. The kind of the frame in this case is activity or act in short form. Partitions provide a constrained view on the behaviors invoked in activities. The round-cornered activity border may be replaced with the frame notation for diagrams. Association and state machine notation can also be used as necessary.4:     classifier instance part attribute and value . Activity Partition An activity partition is activity group for actions that have some common characteristic. Partitions often correspond to organizational units or business actors in a business model. If present. Authenticate User activity frame with two parameters .

g. In this case actions in each partition should be operations or signals targeting objects that are instances of the corresponding classifier. and a name labeling the partition in a box at one end. . Any activity nodes. a partition may represent the location at which a behavior is carried out.specific values of that attribute. actions and edges placed between these lines are considered to be contained within the partition.In other words. and the subpartitions would represent specific values for that attribute. either horizontal or vertical. A partition may represent some attribute and its subpartitions . For example. Activity partition may be shown using a swimlane notation . e. Activity partitions Customer and Order Dept as horizontal swimlanes Activity partitions Customer and Order Dept as vertical swimlanes Hierarchical partitioning is represented using swimlanes for subpartitions as illustrated below.with two. partitions could represent specific classifiers. such as New York. usually parallel lines.

the partition can be labeled with the keyword «external». Dimension partitions cannot be contained by any other partition. For example. Whenever an activity in a swimlane is marked «external». In business modeling. It can have an external partition that does not represent one of the parts. however. Partition could represent an external entity to which the partitioning structure does not apply. External partitions are intentional exceptions to the rules for partition structure. an activity may have one dimension of partitions for location at which the contained behaviors are carried out. but a completely separate classifier. and another for the cost of performing them. where each swim cell is an intersection of multiple partitions.Hierarchical partitioning with subpartitions A partition may be marked as a dimension for its subpartitions to contain (group) those subpartitions along dimension. Diagrams can also be partitioned multidimensionally. . When activities are considered to occur outside the domain of a particular model. The partitions within each dimension may be grouped into an enclosing activity partition with isDimension=true. external partitions can be used to model entities outside a business. the dimension is indicated by placing its name along side the set of partitions in the dimension. this overrides the swimlane and dimension designation. Rather than being shown as a partition itself. whose name is the dimension name. a dimension may have partitions showing parts of a structured classifier. For example.

Explicitly modeled actions as part of activities are new in UML 2. Actions are notated as round-cornered rectangles. alternate text notation with qualified action name could be used instead. Buy action occurs in the external partition Customer Action Action is a named element which represents a single atomic step within activity. i.e. Note. A comma-delimited list of partition names means that the node is contained in more than one partition. A double colon within a partition name indicates that the partition is nested. call state. but may be complex in its effect. and subactivity state in UML 1. Don't use state names as action names. Name of the action is usually action verb or noun for the action with some explanation. An activity defines a behavior that can be reused in many places. The Process Order action. Some action name examples:      Fill Order Review Document Enroll in Course Checkout Show Error Page . Activity represents a behavior that is composed of individual elements that are actions.5. This action is simple for the activity containing it. and replace action state. In this case partition name is placed in parenthesis above the action name. that is not further decomposed within the activity.Buy action occurs in external partition Customer In the situations when swimlanes can't be used to show partitions.0. with the larger partitions coming earlier in the name. that call behavior action may reference (call) activity. Name or description of the action is placed inside of the rectangle.

For example. violations may be detected at compile time or runtime. If the action has no exception handler. the exception propagates to the enclosing node and so on until it is caught by one of them. An action will not begin execution until all of its input conditions are satisfied. structured activity node. They hold only at the point in the flow that they are specified. The effect may be an error that stops the execution or just a warning. If the action has an exception handler. respectively. the execution of the action is abandoned and no regular output is generated by this action. and so on. or activity). Local pre-conditions and local post-conditions are shown as notes attached to the invocation with the keywords «localPrecondition» and «localPostcondition». Local pre-conditions and local post-conditions are constraints that should hold when the execution starts and completes. respectively. . The completion of the execution of an action may enable the execution of a set of successor nodes and actions that take their inputs from the outputs of the action. How local pre. it receives the exception object as a token.Action could also be expressed in some application-dependent action language. If an exception occurs during the execution of an action. Example of action expressed with tool-dependent action language. all tokens in the nested node are terminated. An action may have sets of incoming and outgoing activity edges that specify control flow and data flow from and to other nodes. If an exception propagates out of a nested node (action.and postconditions are enforced is determined by the implementation. not globally for other invocations of the behavior at other places in the flow or on other diagrams. The data describing an exception is represented as an object of any class.

Action subclasses are listed below. Note. Object action is not defined explicitly by UML standard.g. test object identity. that I added object actions and event actions.4 specification.         object action (not explicit in UML standard) variable action invocation action raise exception action structural feature action link action event action (not explicit in UML standard) opaque action Object Action Object actions include different actions on objects. e. Object actions:          create object action destroy object action test identity action read self action value specification action start classifier behavior action read is classified object action reclassify object action read extend action Variable Action .and post-conditions shown as notes attached to Process Order action. In the UML standard all object actions are direct subclasses of action. specify value.Local pre. create and destroy object. etc. which are not defined explicitly in UML 2.

write. Variable actions overview diagram Invocation Action Invocation actions include several call actions. . signal send and broadcast actions and send object action. remove and clear actions. add.Variable actions include variable read.

Parameters could be passed by the action to the invoked behavior. the exception is transmitted back to the call behavior action to begin search for some exception handler. The reply includes values for any return. Execution of the calling action is blocked until it receives a reply. the call action completes immediately after behavior started. The result values are placed on the result pins of the call behavior action. If the execution of the invoked behavior throws an exception. Also equal should be the number of result pins and the number of parameters of the behavior of type return. out. out. or inout parameters. If the call is asynchronous. and the execution of the action is complete after that. and in-out. For synchronous calls the execution of the call behavior action waits until the execution of the invoked behavior completes. The number of argument pins and the number of parameters of the behavior of type in and in-out must be equal.Invocation actions overview diagram Call Behavior Action Call behavior action is a call action that invokes a behavior directly rather than invoking an operation that invokes the behavior. Any return or out values from the invoked behavior are not passed back. .

indicating that this invocation starts another activity. When all the prerequisites of the action execution are satisfied. send object action should be used instead. As you know. Pre. Call behavior action for Checkout behavior Note. Call activity action for User Authentication activity An alternative notation for the invoked activity is to show the contents of the invoked activity inside a large round-cornered rectangle. and transmits it to the specified target object. some subclasses of behavior are interaction. there is no official call activity action in UML specification. The rake resembles a miniature hierarchy.and post-conditions on the behavior can be shown using keywords «precondition» and «postcondition». state machine. that because it looks exactly the same way as the common action. If the node name is different than the behavior name. Edges flowing into the invocation connect to the parameter object nodes in the invoked activity.Call behavior action is shown as action with the name of the behavior that is performed by the action or description of the behavior placed inside the action's round-cornered rectangle. Send Signal Action Send signal action is an invocation action that creates a signal from its inputs. call behavior action name or some behavior name. activity. where it may cause the firing of a state machine transition or the execution of an activity. then it appears in the symbol instead. . that though UML provides this notation. Call activity action is indicated by placing a rake-style symbol within the action symbol. If input of the action is already a signal. The parameter object nodes are shown on the border of the invoked activity. The target object may be local or remote. a signal is generated from the arguments and is transmitted to the identified target object. there is no way just looking at the diagram to say whether the name is common action name. Note.

the amount of time required to transmit it. The effect of receiving a signal object is specified in Common Behaviors. add. that the name of the action corresponds to the name of signal class it sends. without waiting for any response. and the path for reaching the targets are undefined in . Target object is not specified with this notation. Send signal action is notated as convex pentagon. Any attempt to reply is simply ignored. remove. Such effects include executing activities and firing state machine transitions. clear and reduce actions. The signal instance may be copied during transmission. Send signal action receives no reply from the invoked behavior. When a transmission arrives at a target object.The sender of the signal (aka "requestor") continues execution immediately. Note. the order in which the transmissions reach the various targets. and no transmission is performed back to the sender. so identity might not be preserved. The manner of transmitting the signal. . Notify Customer send signal action creates and sends Notify Customer signal Structural Feature Action Structural feature actions include several actions working on composite structures . write. it may invoke behavior in the target Notify Customer send signal action creates and sends Notify Customer signal After order is shipped.

destroy and clear association actions.4 specification reduce action is direct subclass of action.Structural feature actions overview diagram Note. .read. create. that in UML 2. Link Action Link actions include several actions working on links . write.

4 all event actions are direct subclasses of action. In UML 2. clear association action are direct subclasses of action. Event Action Event actions include accept event action. accept call.Link actions overview diagram Note. reply and unmarshall action. . accept time event. I added event action here for clarity. that event action is not an explicit part of UML specification. read link object end qualifier action. that in UML 2.4 specification read link object end action. Note.

unless otherwise specified by an extension or profile. It cannot be used with synchronous calls (except accept call action). name of the accept event action corresponds to the name of the event this action accepts. Accept event action was introduced in UML 2.Event actions overview diagram Accept Event Action Accept event action is action that waits for a specific event to occur. Accept event action handles events detected by the object owning the executing behavior. By default. then the accept event action outputs a value describing the event. This action handles asynchronous messages. Accept Order accept event action waits for Accept Order event. the action waits for the next event. If the event does not match expected event. so that e. several actions or other behaviors might compete for an available event.0. including asynchronous calls. but it could be specified in extensions or profiles. An accept event action is notated as a concave pentagon. . In a system with concurrency. If accept event action is executed and object detected event matching one of the triggers on the action. Events are stored by the object in some queue.g. The order of detected events is not defined by the UML specification. even if the event would satisfy multiple concurrently executing actions. Only one action accepts event.

In addition. Acceptance of the Payment Confirmed signal is enabled only after the request for payment is sent. Payment Requested signal is sent. The activity then waits to receive Payment Confirmed signal. the result value contains the time at which the occurrence happened. It does not terminate after accepting an event and outputting a value. This semantic is an exception to the normal execution rules in activities. An accept event action with no incoming edges and contained by a structured node is terminated when its container is terminated. name of the accept signal action corresponds to the name of the signal this action accepts. An accept signal action is notated the same way as accept event action . Such an action is informally called a wait time action. It corresponds to send signal a concave pentagon. whichever most immediately contains the action. The accept event action is enabled upon entry to the activity containing it If an accept event action has no incoming edges. an accept event action with no incoming edges remains enabled after it accepts an event. . By default.Acceptance of the Accept Order event by Accept Order action causes an invocation of a Process Order action. Accept time event action (aka informal: wait time action) is notated with an hour glass. but continues to wait for other events. Wait Time Action If the event is a time event occurrence. Accept Signal Action Accept signal action is informal name for the accept event action whose trigger is a signal event. then the action starts when the containing activity or structured node does.

A control token is placed at the initial node when the activity starts. initial nodes are an exception to the rule that control nodes cannot hold tokens if they are blocked from moving downstream. so it is enabled as long as its containing activity or structured node is enabled. so initial nodes are not required for an activity to start execution. There are no incoming edges to this time event action. It includes:        initial node flow final node activity final node decision node merge node fork node join node Initial Node Initial node is a control node at which flow starts when the activity is invoked. It destroys all tokens that arrive at it but has no effect on other flows in the activity. Flow Final Node Flow final node is a control final node that terminates a flow. For convenience. for example. invoking the activity starts multiple flows. Control Control node is an activity node used to coordinate the flows between other nodes. Tokens in an initial node are offered to all outgoing edges. Flow final was introduced in UML 2. but not in initial nodes in structured nodes contained by the activity. . Activity initial node. Note that flows can also start at other nodes. one at each initial node.The Every Hour accept time event action generates output every hour. The notation for flow final node is small circle with X inside. In this case. by guards. Initial nodes are shown as a small solid circle. Activity may have more than one initial node.0.

0. It can be thought of as a goal notated as "bull’s eye. The notation for a decision node is a diamond-shaped symbol. other than the decision input flow (if any). Activity final node. The edges coming into and out of a decision node. and destroys all tokens in object nodes. A token reaching an activity final node terminates the activity. If it is not desired to abort all flows in the activity. The first one reached stops all flows in the activity.Flow final node.e. except in the output activity parameter nodes. we should not rely on any visual or text description order. Which of the edges is actually traversed depends on the evaluation of the guards on the outgoing edges. it stops all executing actions in the activity. Any behaviors invoked asynchronously by the activity are not affected. The order in which guards are evaluated is not defined. . In particular. must be either all object flows or all control flows. An activity may have more than one activity final node. Activity final nodes are shown as a solid circle with a hollow circle inside. Decision Node Decision node is a control node that accepts tokens on one or two incoming edges and selects one outgoing edge from one or more outgoing flows. Activity final was introduced in UML 2. Terminating the execution of synchronous invocation actions also terminates whatever behaviors they are waiting on for return. Activity Final Node Activity final node is a control final node that stops all flows in an activity." or target. use flow final instead. Each token offered by the incoming edge is offered to the outgoing edges. Decision nodes were introduced in UML to support conditionals in activities. i. Each token arriving at a decision node can traverse only one outgoing edge. Tokens are not duplicated.

. In this case each data token is passed to the behavior before guards are evaluated on the outgoing edges. a predefined guard "else" may be defined for at most one outgoing edge. it may be run many times on the same token before the token is accepted by those edges. and attached to the appropriate decision node. Decision input behaviors were introduced in UML to avoid redundant recalculations in guards. Because the behavior is used during the process of offering tokens to outgoing edges. This means the behavior cannot have side effects.Decision node with two outgoing edges with guards. Decision node with three outgoing edges and [else] guard. The behavior is invoked without input for control tokens. The modeler should arrange that each token only be chosen to traverse one outgoing edge. Decision input behavior is specified by the keyword «decisionInput» and some decision behavior or condition placed in a note symbol. For decision points. Decision node with decision input behavior. Decision can have decision input behavior specified. The output of the behavior is available to each guard.

otherwise. All edges coming into and out of a merge node must be either object flows or control flows. If there are both a decision input behavior as well as decision input flow. For example. the two flows coming out of the decision need to be merged into one before going to a join. In this case the tokens offered on the decision input flow that are made available to the guard on each outgoing edge determine whether the offer on the regular incoming edge is passed along that outgoing edge. Merge Node Merge node is a control node that brings together multiple incoming alternate flows to accept single outgoing flow. Merge node with three incoming edges and a single outgoing edge . if a decision is used after a fork. A decision input flow is specified by the keyword «decisionInputFlow» annotating that flow. The notation for a merge node is a diamond-shaped symbol with two or more edges entering it and a single activity edge leaving it. as the second argument if it is an object flow). the join will wait for both flows. There is no joining of tokens. Decision node with decision input flow. Decision nodes with the additional decision input flow offer tokens to outgoing edges only when one token is offered on each incoming edge.Decision may also have decision input flow. only one of which will arrive. Merge should not be used to synchronize concurrent flows. the token offered on the decision input flow is passed to the behavior (as the only argument if the regular incoming edge is control flow.

0 activity forks model unrestricted parallelism.The functionality of merge node and decision node can be combined by using the same node symbol. The notation for a fork node is a line segment with a single activity edge entering it. and three edges leaving it. If at least one outgoing edge accepts the token. Combined join node and fork node. duplicates of the token are made and one copy traverses each edge that accepts the token. Fork nodes are introduced to support parallelism in activities. UML 2. keep their copy in an implicit FIFO queue until it can be accepted by the target. The outgoing edges that did not accept the token due to failure of their targets to accept it. .5. as illustrated below. The functionality of join node and fork node can be combined by using the same node symbol. Fork node with a single activity edge entering it. Tokens arriving at a fork are duplicated across the outgoing edges. This case maps to a model containing a merge node with all the incoming edges shown in the diagram and one outgoing edge to a decision node that has all the outgoing edges shown in the diagram. As compared to UML 1. The rest of the outgoing edges do not receive a token. and two or more edges leaving it. Merge node and decision node combined using the same symbol Fork Node Fork node is a control node that has one incoming edge and multiple outgoing edges and is used to split incoming flow into multiple concurrent flows. This case maps to a model containing a join node with all the incoming edges shown in the diagram and one outgoing edge to a fork node that has all the outgoing edges shown in the diagram.

Join nodes are introduced to support parallelism in activities.. nor are concurrent evaluations started when new tokens are offered during an evaluation. This case maps to a model containing a join node with all the incoming edges shown in the diagram and one outgoing edge to a fork node that has all the outgoing edges shown in the diagram. The join specification is evaluated whenever a new token is offered on any incoming edge..If guards are used on edges outgoing from forks. The evaluation is not interrupted by any new tokens offered during the evaluation. then a decision node should be introduced to have the guard. If that cannot be avoided. and shunt the token to the downstream join if the guard fails. . Combined join node and fork node. The functionality of join node and fork node can be combined by using the same node symbol. and only one edge leaving it. and a single edge leaving it. The default join specification is the reserved string "and". the modelers should ensure that no downstream joins depend on the arrival of tokens passing through the guarded edge. Join nodes have a join specification which is Boolean value specification using the names of the incoming edges to specify the conditions under which the join will emit a token.. Join node with three activity edges entering it. It is equivalent to a specification that requires at least one token offered on each incoming edge. Join Node Join node is a control node that has multiple incoming edges and one outgoing edge and is used to synchronize incoming concurrent flows. Join specifications are shown in curly braces near the join node as joinSpec=. The notation for a join node is a line segment with several activity edges entering it.

Though UML 2.4 specification calls it name of the edge. The source and target of an edge must be in the same activity as the edge. Activity edge "updated" connects two nodes. Activity edge is notated by an open arrowhead line connecting two activity nodes. The guard of the activity edge is shown in square brackets that contain the guard. it is notated near the arrow. which is a small circle with a name inside. . If the edge has a name.specification evaluated at runtime to determine if the edge can be traversed. Fill Order when priority is 1 An activity edge can be notated using a connector.Join node with join specification shown in curly braces. Edges can be named. Activity edge can have a guard . Activity edge connects Fill Order and Review Order. It includes control edges and object flow edges. provided connector notation and examples suggest that connector has its own name (also called label). Activity Edge Activity Edge is an abstract class for the directed connections along which tokens or data objects flow between activity nodes. The guard must evaluate to true for every token that is offered to pass along the edge. however. edges are not required to have unique names within an activity.

that evaluates to a non-zero unlimited natural value. Object flow of Orders between Fill Order and Review Order actions Any number of tokens can pass along the edge. An unlimited weight is notated as "*". The circles and lines involved map to a single activity edge in the model. One connector must have exactly one incoming edge and the other exactly one outgoing edge. The weight of the edge may be shown in curly braces that contain the weight. It does not affect the underlying model. or individually at different times. When the minimum number of tokens are offered. which may be a constant. Connector A connects two edges between Fill Order and Review Order. each with the same type of flow. Every connector with a given label must be paired with exactly one other with the same label on the same activity diagram. Send Notification when number of Warnings reaches 6. . This is purely notational. all the tokens at the source are offered to the target all at once. The weight is a value specification. The weight attribute dictates the minimum number of tokens that must traverse the edge at the same time.Connectors are generally used to avoid drawing a long edge. object or control. Object Flow Edge Object flow edges are activity edges used to show data flow of object and data tokens between action nodes. An object flow is notated by an arrowed line. in groups at one time.

Cancel Request signal causes interruption resulting in Cancel Order.Interrupting Edge Interrupting edge is activity edge expressing interruption for regions having interruptions. or the name and type of the node in the format "name:type. An option for notating an interrupting edge is a zig zag adornment on a straight line. depending on where objects are flowing from and to. may be available at a particular point in the activity. Object nodes are notated as rectangles. Object An object node is an activity node that is part of defining object flow in an activity. A name labeling the node is placed inside the symbol. Object nodes can be used in a variety of ways. It indicates that an instance of a particular Classifier. It is rendered as a lightning-bolt. Cancel Request signal causes interruption resulting in Cancel Order. possibly in a particular state." Object flow of Orders between Fill Order and Review Order actions . where the name indicates the type of the object node.

Noticed some spelling error? Select the text with your mouse and press Ctrl + Enter. 6 Comments   o o    o Disqus Login About Disqus Like Dislike 13 people liked this. ordering.. Flag  Like ReplyReply Josh  1 month ago Thanks for sharing. which is to be written within brackets below the name of the type..neat and clear. Glad you liked it.The name can also be qualified by a state or states. and control type other than the defaults are notated in braces underneath the object node. Would you like to share? Facebook Twitter Share No thanks Sharing this page … Thanks! Close   Add New Comment Image Post as … Showing 6 comments Sort by New est first Subscribe by email Subscribe by RSS  Prad124     4 days ago Thanks !! That's quite a lot of info. Upper bounds. What do you use to connect the note symbol with the decision node? ..

Superstructure].4 and is based on OMG™ Unified Modeling Language™ (OMG UML®) make one decision following another.4 specification [UML 2.4 . Like ReplyReply blog comments powered by DISQUS This document describes UML 2.   Flag  Like ReplyReply Michael Allen     1 month ago Thanks for sharing! bookmarked as reference. Flag  1 person liked this. Like ReplyReply Lalit Singh     2 months ago Can we connect a decision node to decision node in sequnce ? Flag  Like ReplyReply KF 2 months ago in reply to Lalit Singh  yes.   Flag   Like ReplyReply Antony492    7 months ago Thanks! This helped with my coursework! Flag  1 person liked this. . it is ok to connect several decision nodes .

Images of UML elements and diagrams may be used without written permission for any . or nonprofit use provided this website is credited. You can send your comments and suggestions to web master at webmaster@uml-diagrams. Any commercial or other use requires prior written permission. educational. 2010 using UML 2.2 stencils by Pavel Hruby.All UML diagrams were created in Microsoft Visio 2007.