Book a Demo

Author Topic: Class Operation Behavior and Activity Diagram  (Read 15125 times)

jrob

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Class Operation Behavior and Activity Diagram
« on: February 25, 2014, 12:13:28 am »
I created a class diagram with an operation defined. The operation has in and out parameters defined. I create an activity diagram with input parameters and output parameters. The activity diagram has one activity element. The activity element has an initial node linked to some action elements linked to a final node.

I am having a little difficulty understanding how to link the operation behavior to the activity element. Should the activity element have the same name as the name of the class operation. Should the parameter names defined for the operation be the same as the names for the activity element inputs and outputs.

Do you have a tutorial that describes the details of how to do this?

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Class Operation Behavior and Activity Diagram
« Reply #1 on: February 25, 2014, 12:49:29 am »
Hello,

you link the operation to an activity which is specified by an activity diagram. This is done in the operation properties by:
- Behavior
- Element
- Select Activity

If you want to use parameters in the activity diagram than use the same name and type as in the operation.

I have made an addin to automate this by:
- Create Package for Behavior
- Create Activity
- Create Activity Diagram
- Place Activity and Initial Node on the activity diagram
- Add the parameters to the activity
Last and not least I have a function to update the parameters of the Activity from the operation.

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Class Operation Behavior and Activity Diagram
« Reply #2 on: February 25, 2014, 01:56:45 am »
Setting Activity in Operation's Behavior tab, also results in the following
1. The operation name (Fully qualified name) shown in the Activity element, Behavior Tab -> Specification
2. If you generate source code for the Class containing the operation, the behavior in the Activity diagram will be rendered as the operation's body (if Behavioral code generation is supported)

Max H

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
    • SafeCode Consulting
Re: Class Operation Behavior and Activity Diagram
« Reply #3 on: July 19, 2014, 06:18:52 am »
Hi Nizam,  

This does not seem to be working for me.  I have linked the Activity in one class to the Operation behavior in another -- as you said, the Specification field in the Activity is automatically updated.

When I generate source code of the operation's parent class, the GUID of the linked activity is rendered, but the actions are not.  The only way I have found to generate the source code for the Activity is to actually generate code for the class containing the Activity.   Any hints?  Am I missing a setting?  This is in EA11-Ultimate.
« Last Edit: July 19, 2014, 06:19:24 am by mhinkley »

Max H

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
    • SafeCode Consulting
Re: Class Operation Behavior and Activity Diagram
« Reply #4 on: July 19, 2014, 07:53:35 am »
It seems strange that I am able to generate correct code from the class that contains the Activity, since the Behavior CG Template contains the following, which should terminate the template before it expands the code.

[size=8]$BehSpecification = %EASL_GET("Property",$GUID,"Specification")%
...
$COMMENT = "Behavior is associated to another specification"
%if $BehSpecification != ""%
%endTemplate%[/size]


Max H

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
    • SafeCode Consulting
Re: Class Operation Behavior and Activity Diagram
« Reply #5 on: July 23, 2014, 10:56:05 pm »
After much messing around, I learned that behaviors work as specifications only when contained in the same object as the operation that they are specifying.   If contained in another object it is ALMOST as if the link does not exist....  I say almost, because the GUID is rendered, but nothing else about the behavior seems to be accessible.

This does not seem to agree with what is described by others, so I'm wondering if the templates are missing some sort of scope conversion.  The biggest problem with the way that it is acting is that behavior is lost when going from PIM to PSM.
« Last Edit: July 23, 2014, 11:51:45 pm by mhinkley »