Book a Demo

Author Topic: Change BPMN 2.0 element Types from C# Addin  (Read 4714 times)

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Change BPMN 2.0 element Types from C# Addin
« on: July 18, 2016, 09:18:20 pm »
Hi,
I'm trying to create BPMN elements, but I'm not able of add the subtype of the element.
I can create the basic elements, for example:
Code: [Select]
EA.Element theElement = elements.AddNew(elementName, "BPMN2.0::Gateway" );But i don't know how to specify that this Gateway is a Parallel Gateway.

I read this document ( http://www.sparxsystems.com.au/enterprise_architect_user_guide/12.1/business_engineering/change_element_appearance.html ) and I tried to use tagged values for this purpose, but I must be doing something wrong.
Here is a part of my code:

Code: [Select]

                    EA.Element theElement = elements.AddNew(elementList[j][1], "BPMN2.0::" + elementList[j][2]);

                    if (elementList[j][2].Equals("Gateway"))
                    {
                        EA.TaggedValue taggedValue = (EA.TaggedValue)theElement.TaggedValues.AddNew("gatewayType", elementList[j][3]);
                        taggedValue.ElementID = theElement.ElementID;

                        taggedValue.Update();
                        theElement.TaggedValues.Refresh();

                    }
(The elementList[j][3] variable contains the string "Parallel", "Exclusive" or "Inclusive")
Below this i do the corresponding Update().
« Last Edit: July 18, 2016, 09:20:52 pm by rmartinezb »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change BPMN 2.0 element Types from C# Addin
« Reply #1 on: July 18, 2016, 10:01:48 pm »
You must not add a new TV. It is already created when assigning the BPMN stereotype. Rather assign the sub-type once the element is created. (This all being said without having tested it.)

q.

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: Change BPMN 2.0 element Types from C# Addin
« Reply #2 on: July 18, 2016, 10:49:45 pm »
Thank you very much querty, now I can create the correct elements. :D