How does Action Pin work in simulation of an Activity Diagram in Enterprise Architect?

462 Views Asked by At

I am going through the tutorial for Model simulation of Enterprise Architect. In the Dynamic Simulations, under section of CreateObject, it says that the Output action pin stores the created object and can be passed via an object flow to another action. The attributes of the created object can be then accessed in the destination action. See EA Help and

enter image description here

Breakpoint 1: A CreateObject Action creates an Object ´cb´ and the local variable enter image description here

Breakpoint 2: The created object passed to Action3 via an object flow in action pins, the control is passed with control flow. enter image description here

However, as you can see that the object cb is nowhere to be seen in Action3. I would really appreciate if someone can help me in this and explain how it works.

1

There are 1 best solutions below

0
On

So, I tried a lot of things to do this. And I somehow figured out a way to do part of it. So here is the answer.

Pre-Requisite: A class with a few attributes and operation. Along with the behavior of the operation to be performed. Like in the below example, following is the behavior defined for add operation.

this.x=x;
this.y=y;
return x+y;

Steps:

  1. Create a CreateObject Action Element (Toolbar (space) > Action > Create Object).
  2. In element properties (docked) set the Classifier. (Properties > Element tab > CreateObjectAction section > Classifier > {Class, Actor, Activity}).
  3. The CreateObject has a 'result' ActionPin. Drag the ActionPin to the diagram from the browser on the CreateObjectAction Element.
  4. Assign the ActionPin(result) of type as the classifier object from Element Properties of ActionPin.
  5. Add an object flow to a new action or the destination action, on which the object is being passed.
  6. Follow step 4 for the new action pin generated.
  7. Add the control flow from the create object to a destination action(might be same or different than the action of Step 5).
  8. Drag the Class to the activity diagram and create it's instance with a unique name. (IT'S STRANGE THAT WE NEED TO DO THIS, BUT IT DOESN'T WORK WITHOUT THIS)
  9. Finally after completion of diagram. We can perform simulation. The newly created object can be seen in the Local window as UID.
  10. This is the created object which can be used to access the operation and the attributes of instance. In order to do this, copy this name and use it in the effect field of action.
this.result = DFB9AEAD91_990D_4cec_AE54_93A8A3BC684F.add(7,7);
  1. The output then can be seen in the local window. Local Window Output

NOTE: The object "cb" is still nowhere to be seen. However, an object is definitely created with a unique id as shown in the above code snippet. A part of the question still remains unanswered is the role of action pins.