Can I create a nested activity diagram in UML? - uml

For eg: I have an activity diagram depicting the flow of an API. Now that API calls an internal/static function. So, is it possible to depict the called function activity diagram with the caller activity diagram?

There are a couple of ways to achieve nesting in EA. One would be to create an Activity for the sub-process and invoke that.
You can nest the actions in an activity and use that in the main flow as invocation (when dragging the Activity on the diagram use as "Invocation" rather than as "Link"). It then looks like
From the browser (well, it's EA) you can choose Add/Composite Structure Diagram. Here you can layout the subprocess (e.g. like)
When you double click the invocation it will open this structure diagram.
Additionally you can use this diagram and drag it onto the (enlarged) invocation so it would show its guts:
The way it's shown in uml-diagrams.org is not possible for the diagram representation in EA (or I don't know how to do that). However, you can add ObjectNodes to Activities from the browser's Add context menu. These can be use in the referenced way.

Related

How to pass variables between a nested activity diagram and its calling action in Cameo Systems Modeler?

I want to re-use code abstracted out as activity diagrams in Cameo Systems Modeler. I plan to make them functions which accept input variables and return other variables.
I am noticing that None gets passed out of the sub-diagram to its calling parent. How can I overcome this limitation?
I have already added input and output nodes to the model for the nested activity, and they appear both in the parent view and the nested view. I got a yellow/orange "warning" around the nested activity diagram which provided a clickable menu with a warning triangle symbol and options to automatically add the input(s) and output(s) to the nested activity diagram.
If I want to re-use these activity diagrams, do I have to make sure the input and output variables of the calling parent match what shows in the nested diagram? I believe I have done that and yet I cannot figure out what is wrong.
I was hoping that the variable would be passed up to the calling parent, but it is not getting passed. I have even "debugged" by setting breakpoints and watching what happens in the nested diagram, and the problem is the interface with the caller, not in the nested diagram.
I understand your question as: "How to pass objects from CallBehaviorActions to the called Activity and back?"
Actually, that should be straight forward. Just define an Activity with ActivityParameterNodes. When you drop such an Activity on the diagram of another Activity, Cameo will create a CallBehaviorAction with matching Pins. That's it.
Of course, you can also create matching Pins manually.

Simplify an activity diagram

I'm working on my graduation project which is an online quiz website. now i'm drawing the UML activity diagram but it gets too complex and i can't add more details because at the end it must be printed in the project documentation in A4 papers.
can i split the diagram into multiple diagrams?. and if i did this should i repeat the login/registration actions in the beginning of each diagram?
Use structured activities to form logical groups. You can instantiate these activities as call behavior actions where needed.
Assume you have an activity Login
(the lying 8 is an invention of Enterprise Architect to indicate an embedded diagram; not UML standard)
which looks inside like
(just very simplified).
Now you can instantiate that like
where the fork indicates the action is a call behavior.
Adding activity parameters it would even be possible to parametrize these. Just like you would do when calling a function in a programming language.

Linking activity diagram to entities to be accessed

How do we represent in an Activity Diagram, which entities are to be accessed or updated? Is this is to be done as part of an activity diagram, or to be done separately?
You specify which Classes are accessed or updated using Pins on an Action or using an ActivityParameterNode on an Activity. Those Pins look like little squares on the periphery of the Action, or rectangles on the diagram frame of an Activity, and you connect OutputPins to InputPins using ObjectFlows (which unfortunately look just like the ControlFlows that connect Actions together). Here's an example from the UML 2.5 spec:
Now, to answer what I think you are really asking. I think you want to know how to navigate to instances of Classes in your model. To do that from an Activity, you use a ReadStructuralFeatureAction to read properties from the Class instance that owns the Activity you're specifying. The values flow out of an OutputPin. Using ReadStructuralFeatureActions you can navigate anywhere your instances allow. (Note that when a Property is owned by an Association rather than a Class, you use one of the ReadLink*Actions specializations of Action.)
Please see Part 4 of Conrad Bock's excellent series, UML 2 Activity and Action Models,
Part 4: Object Nodes for a better understanding.
You can use either
a dependency (dashed line) or
an object flow (solid line) to show that an action is interacting with an object or
an information flow (stereotyped with <<flow>>). This way you can specify one or more classes which control the information that is flowing (in the example it is FileTypeObject).

How to depict nested action/activities in a UML Activity Diagram?

I would like to create an activity diagram in which one of the actions is depicted with its sub-actions.
To better clarify I would like to be able to depict something like the following diagram
The problem in my case is that SubActivity1 does not have any input parameter. I just want SubActivity1 to start its execution when OpaqueAction1 is completed.
I know that it is possible to use a CallBehaviorAction to express that an Action will result in the execution of another Activity like in the following diagram
But, in this way I cannot depict the sub-actions in the same activity diagram.
I also thought of using a StructuredActivityNode like in the following diagram
here the problem is that I am not able to show the name of the StructuredActivityNode. I do not know whether this is an issue of the tool that I am using (Papyrus) or it is a general issue.
What you always can do it to use diagram frames and place them inside an activity:
If you need to pass parameters and make use of them inside an activity you can do it this way:
The action pin on Action1 takes the parameter to process it. As you see, you can also place the contents of an Activity manually inside its frame.
An activity is completed when it has reached its last action. More explicitly you should use a flow final to show that. I omitted it in the first example since your examples lacked it. But I usually place it at the end of each (sub-)flow.

activity diagram refactoring - shall start with Initial activity?

My activity diagram would be too big and complex, so I decided to split it into many diagrams. I replaced one branch with another diagram and I linked it into the first diagram, which looks well. I designed the second diagram but I do not know, how to start it.
I think that there must be link to the first diagram. But is it enough or shall there be initial activity (circle) before it? See attached images.
On the contrary, the initial node is excessive on the second diagram. It is already included in the start activity. It is OK to say that the whole activity diagram is an activity in another activity diagram. Look at starting diagram here - a group of activities is concluded in activity frame, as a larger activity.
Also think about using Interaction overview diagram. It is just for showing structured activity diagrams.

Resources