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

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.

Related

Can I create a nested activity diagram in 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.

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.

How to use context properties in an Activity diagram in UML?

Considering the following class diagram:
The class System is active and its behaviour is to continuously
call filter on PressureSensorFilter passing
PressureSensor.Pressure as argument
call Display.show passing the output param of
PressureSensorFilter.filter as argument
I would like to model the behaviour of System through an ActivityDiagram.
The main challenge in doing this is accessing the property PressureSensor of System.
After reading the UML 2.5 specification, I believe that the only way to do this is to use ReadSelfAction(pag 457 UML 2.5 spec) and ReadStructuralFeatureAction (pag 466 UML 2.5 spec) as depicted by the following Activity diagram:
where
ReadSelfAction gives as output a current Instance of System.
ReadPressureSensorFe.. is a REadStructuralFeatureAction that reads the property PressureSensor of the object give at its input pin which in this case is the current Instance of System.
CallBesselFilter.filter Action and CallDisplay.show Action are two CallOperationAction(s) that call PressureSensorFilter.filter and Display.show respectively.
The issue with this is that is very convoluted and unclear.
Is there any less convoluted and more clear way to describe the behaviour of System through an Activity diagram?
The ReadSelfAction as extra action is superfluous. You can reduce the control flow like this:
The pressure is read by the filter from the Pressure class' property. The filtered output is sent to Display and looping....
You should look into SysML. It's designed to cope with exactly that kind of problems you deal with.
It all depends on what detail you would like to provide in your activity diagram. The diagram you provide is correct. By the way, its level of details could be directly used to generate code. If you would like to describe behavior more abstract, do not use actions like read structural feature etc. But in your example, it is very good and precised way of description.

activity diagram - how to show multiple objects passed between two actions?

Background
I have one action (action_a) that calls an operation(operation_x) on another action (action_b).
The parameters to operation_x are as follows:
action_b.operation_x( param_1, param_2 )
I'm trying to work out how to document the parameters being passed in UML activity diagrams.
Option 1
One option may be to use a comment?
Option 2
Another option may be to use activity parameters, but it doesn't seem right to show two flows from action_a for one operation call?
Question
How can I show multiple objects being passed?
Option 2 is close, but the edges coming out of action_a are not right, and I don't think it's legal to show the call and the details on the same diagram. Please see my other answer.

Resources