Book a Demo

Author Topic: profile defined connector created via add-in  (Read 4560 times)

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
profile defined connector created via add-in
« on: February 26, 2013, 06:24:44 pm »
Hi

I have a problem applying a profile defined connector via the add-in

This is the profile snippet

Code: [Select]
<Stereotype name="BusinessEventTransition" metatype="BusinessEventTransition" notes="" cx="90" cy="70" bgcolor="-1" fontcolor="-1" bordercolor="-1" borderwidth="-1" hideicon="0">
      <AppliesTo>
             <Apply type="StateFlow">
                  <Property name="direction" value="Source -&gt; Destination"/>
                  <Property name="kind" value=""/>
            </Apply>
      </AppliesTo>
</Stereotype>

this is the add-in code :
Code: [Select]
EA.Connector newStateFlow = Initial.Connectors.AddNew("", "BIMProfile::BusinessEventTransition");
However the connector created hash metatype="Dependency" and type = "dependency"

what am I doing wrong ?


BTW I've got this technique working on an EA.Element of type 'State'

As always big thanks




Reg.

Danny

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: profile defined connector created via add-in
« Reply #1 on: February 26, 2013, 08:41:20 pm »
I don´t know the cause of this but some time ago i had a similar problem. Luckily i found a workaround so it didn´t bother me that much, maybe this will help you too:

Change the line into:

Code: [Select]
     
EA.Connector newStateFlow = Initial.Connectors.AddNew("", "StateFlow");       
newStateFlow.Stereotype = "BusinessEventTransition";
newStateFlow.Update();

Be carefull  not to prefix ¨BIMProfile::¨ because that way EA seems unable to match your stereotype to your profile and this will result in a new UML type ¨BIMProfile::BusinessEventTransition¨ in your project (?!)

best regards,

Paulus
« Last Edit: February 26, 2013, 08:42:13 pm by pmaessen »

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: profile defined connector created via add-in
« Reply #2 on: February 26, 2013, 08:52:13 pm »
Thanks Paulus, but that is exactly what I'm doing now  8-)

Problem is, my profile provider wants me to use the profile.
(So that later, if he adds to the profile it gets reflected automatically)

so my problem remains  :(
Reg.

Danny

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: profile defined connector created via add-in
« Reply #3 on: February 26, 2013, 10:16:08 pm »
There´s one more Connector attribute you could use so i thought to give it a try, and, lo-and-behold: this attribute accepts the prefix!  :-? :D

So the following code will correctlty create the connector in BIMProfile (you can check this using the model search):

Code: [Select]
EA.Connector newStateFlow = Initial.Connectors.AddNew("", "StateFlow");       
newStateFlow.[highlight]StereotypeEx[/highlight] = "BIMProfile::BusinessEventTransition";
nwStateFlow.SupplierID = ....
(... any additional changes ...)
newStateFlow.Update();

Odd behaviour though...
« Last Edit: February 26, 2013, 11:48:51 pm by pmaessen »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: profile defined connector created via add-in
« Reply #4 on: February 26, 2013, 11:34:37 pm »
In your example you missed setting theSupplierId.

q.

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: profile defined connector created via add-in
« Reply #5 on: February 26, 2013, 11:47:38 pm »
.... you're absolutely right => included this.