Author Topic: Specifying ActivityParameter direction in profile  (Read 1369 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1274
  • Karma: +93/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Specifying ActivityParameter direction in profile
« on: October 02, 2017, 11:25:49 pm »
I'll tell you what I want, what I really really want:

I want the different directions of ActivityParameters (in, out, inout, return) to be displayed differently in diagrams.

I can create stereotypes with shape scripts which set different colours -- but how do I specify that when using my «outpar» ActivityParameter stereotype toolbox item, an 'out' ActivityParameter should be created as opposed to an 'in' one which is the default?

I realize that this is slightly incorrect use of stereotypes. But there's no way to check for the element's 'direction' in a shape script -- it doesn't have its own property for retrieval, and it's not a tagged value.


Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2549
  • Karma: +34/-2
    • View Profile
Re: Specifying ActivityParameter direction in profile
« Reply #1 on: October 03, 2017, 08:23:34 am »
But there's no way to check for the element's 'direction' in a shape script -- it doesn't have its own property for retrieval, and it's not a tagged value.

This works...
Code: [Select]
shape main
{
if(hasproperty("direction","in"))
{
setfillcolor(255,0,255);
}
drawnativeshape();
}
The Sparx Team
support@sparxsystems.com

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2549
  • Karma: +34/-2
    • View Profile
Re: Specifying ActivityParameter direction in profile
« Reply #2 on: October 03, 2017, 08:32:27 am »
I can create stereotypes with shape scripts which set different colours -- but how do I specify that when using my «outpar» ActivityParameter stereotype toolbox item, an 'out' ActivityParameter should be created as opposed to an 'in' one which is the default?

In your profile, give your "ActivityParameter" metaclass element an attribute named "direction" with initial value "out". This appears to work, but it's possible it only works for properties named "direction".
« Last Edit: October 03, 2017, 08:34:02 am by KP »
The Sparx Team
support@sparxsystems.com

Uffe

  • EA Practitioner
  • ***
  • Posts: 1274
  • Karma: +93/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Specifying ActivityParameter direction in profile
« Reply #3 on: October 03, 2017, 08:04:11 pm »
But there's no way to check for the element's 'direction' in a shape script -- it doesn't have its own property for retrieval, and it's not a tagged value.
This works...
[snip]

Ah! So it's not that the property isn't available for retrieval, it's just that it isn't documented.

I can create stereotypes with shape scripts which set different colours -- but how do I specify that when using my «outpar» ActivityParameter stereotype toolbox item, an 'out' ActivityParameter should be created as opposed to an 'in' one which is the default?
In your profile, give your "ActivityParameter" metaclass element an attribute named "direction" with initial value "out". This appears to work, but it's possible it only works for properties named "direction".

OK. But now that you showed me how to get the shape script to work I can make a single stereotype «actpar» rather than four different ones, which is better because it means a modeller can't set the direction to conflict with the stereotype.

Cheers, KP!


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 9836
  • Karma: +190/-155
  • I'm no guru at all
    • View Profile
Re: Specifying ActivityParameter direction in profile
« Reply #4 on: October 03, 2017, 08:51:26 pm »
I think I have seen it one in a shape script (from which MDG was that?). Maybe a grep for "hasproperty" through Geert's lib could give some additional enlightenment.

q.

P.S. Here's the result of such a grep. First is the first hasproperty paramenter and the second are the 2nd parameters used

BPMNexpanded   1
BPMNmarker   1
classifier   
diagram.mdgtype   BPMN2.0::Conversation
diagram.mdgtype   SOMF_dg::SOMFDesign
direction   bi-directional
direction   destination -> source
direction   source -> destination
direction   Unspecified
incomingedge   bottom
incomingedge   right
incomingedge   top
iscomposite   true
IsDrawCompositeLinkIcon   false
parentEdge   Bottom
parentEdge   Left
parentEdge   Right
parentEdge   Top
Partition   Horizontal
partition   vertical
rectanglenotation   0
rotationdirection   down
rotationdirection   left
rotationdirection   right
rotationdirection   up
ShowComposedDiagram   false
ShowComposedDiagram   true
Source.Metatype   Decision
stereotypehidden   true
type   association
type   class
type   Package

P.P.S. The help only comes up with that: http://sparxsystems.com/enterprise_architect_user_guide/12.1/building_models/query_methods.html which is more than nothing, but leaves a lot room for guessing. I'll have to update my ShapeScript book with a bit background.
« Last Edit: October 03, 2017, 10:09:55 pm by qwerty »