Author Topic: Stereotyped ActivityParameter: customize the Direction and Type  (Read 3953 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1377
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Hi,

I've defined a stereotype for ActivityParameters within a custom MDG, to be created on Activities.
I'm trying to integrate custom rules for 2 of its properties available under the "Parameter" tab:
- Type is by default set to Integer. I'd like to change its default value to None
I found that Type is set in t_object.Classifier_guid either with the guid of the selected element, starting with INT for Integer, BOOL for boolean, or empty for NONE. Is there a way to change it in the MDG? This would prevent a custom script to run once elements have been created.

- The Direction is a drop down list with in, out, inout, return ; I'd like to change the colour using a Shapescript. This is stored in the t_xref table (CustomProperties->direction), yet a simple script shows that it's not considered as a tagged value. The only workaround is to add a new Direction tagged value, unless there's something to access this property via the ShapeScript?

Thanks


Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #1 on: May 17, 2022, 01:39:10 am »
Have you tried HasProperty?

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1377
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #2 on: May 17, 2022, 07:17:02 pm »
It worked, thanks.

Note: I used HasProperty('direction','in')

Guillaume
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1145
  • Karma: +30/-8
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #3 on: May 17, 2022, 08:45:07 pm »
Interesting, this means that you need to use a ShapeScript to change the colour, it cannot be done using a legend because the direction property is not one of the ActionPin properties exposed by Sparx EA.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1377
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #4 on: May 18, 2022, 12:27:25 am »
In this instance, yes Direction is not a tagged value so I cannot use the legend. Note that I'm using Activity Parameters here (not action pins).
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #5 on: June 20, 2022, 11:59:06 pm »
It worked, thanks.

Note: I used HasProperty('direction','in')

Guillaume

I am facing the same issue. Could you please give a hint how you solved this at your side?
Additn a property to the MDG does not  affect the configuration in Properties--> Parameters--> Direction


Did you manage to adjust the direction of the action pins as well? this would solve all our problems here...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #6 on: June 21, 2022, 12:13:20 am »
You have to evaluate the in/out and also a 2nd property to tell where the pin is attached saying top/bottom/left/right (again offline but it's somewhere in the help).

Then you have to write a lengthy if-clause to make render the triangle. Lots of copy/paste since you do not have any control structures in shapescript.

q.

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #7 on: June 21, 2022, 12:32:30 am »
ok, thanks. then it seems to better write a python script to evaluate the direction after creation I suppose...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #8 on: June 21, 2022, 02:00:32 am »
Well, not really. If you move it around on the diagram I don't think you get notice of that (at least I remember no according event being triggered). Also, there is noting to help rendering from outside. That's all done inside EA's rendering code. If you want the arrows you are doomed to write the shape script for it. It's not *that* complicated. Only some "why has it to be this way?" when coding....

q.

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #9 on: June 21, 2022, 02:51:10 am »
I am just struggling in setting the direction of an activity parameter with the shape script to e.g. inout or in general to execute commands of EA Object model that I would like to execute in a script. Is there any reference that could be taken as a base?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13410
  • Karma: +568/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #10 on: June 21, 2022, 03:55:17 am »
I am just struggling in setting the direction of an activity parameter with the shape script to e.g. inout or in general to execute commands of EA Object model that I would like to execute in a script. Is there any reference that could be taken as a base?
You can't set things in a shapescript. You can only tell EA how to render an element on a diagram based on the available info.

If you are looking for documentation on how to change your object, see https://sparxsystems.com/enterprise_architect_user_guide/16.0/add-ins___scripting/reference.html

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #11 on: June 21, 2022, 08:21:22 am »
You set the direction in the tagged values where you have a Direction with in/out as value. When that is changed you can query that in the shapescript and render the triangle as shortly sketched above.

q.

vrieg

  • EA User
  • **
  • Posts: 51
  • Karma: +0/-0
    • View Profile
Re: Stereotyped ActivityParameter: customize the Direction and Type
« Reply #12 on: June 22, 2022, 02:05:22 am »
I got direction and type of activityparameters working. thanks :).
Indeed sql helped to understand the relations required tagged values and metaclasses.

However: Is there a way to copy the direction of activity parameters to the action pins when instantiating the actions using MDG.
I know that action pins and activity parameters are related via the classifier relation. Therefore I assumed this might be possible and help in reducing complexity of activity diagram modeling.