Book a Demo

Author Topic: BPMN 1.1 Elements  (Read 3121 times)

thea

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
BPMN 1.1 Elements
« on: March 23, 2011, 05:10:11 pm »
I tried adding an element in a package that is defaulted to BPMN 1.1 control but to no avail.  I simply copied the type format when adding a BPMN1.1 diagram (BPMN1.1::BPMN).

Here's a sample code:
Code: [Select]
EA.Element NewElement = (EA.Element)Package.Elements.AddNew(vsShape.Text, "BPMN1.1::BPMN::" + sShapeType);
NewElement.Stereotype = sShapeStereotype;

where:
sShapeType - the type of the shape
sShapeStereotype - the stereotype for the current shape to be added.

When I look at its TaggedValues, it's still defaulted to BPMN 1.0, so what I do is, delete all the current tagged values and tried to add a new one.  The problem is it's not added to the shape.  Here's my code:

Code: [Select]
for (x = 0; x < ActivityTypes.Length; x++)
{
   taggedValue = (EA.TaggedValue)Element.TaggedValues.AddNew(ActivityTypes[x].ToString(), "otTaggedValue");
   taggedValue.ElementID = Element.ElementID;
   if (ActivityTypes[x].ToString() == "ActivityType")
   {
      if (sMasterName.IndexOf("SUBPROCES EXPANDED", StringComparison.InvariantCultureIgnoreCase) >= 0 || sMasterName.IndexOf("SUB-PROCESS COLLAPSED", StringComparison.InvariantCultureIgnoreCase) >= 0 || sMasterName.IndexOf("SUB-PROCESS LOOPING", StringComparison.InvariantCultureIgnoreCase) >= 0)
     { taggedValue.Value = "Sub-process"; }
      else { taggedValue.Value = ActivityValues[x].ToString(); }
     }
     else if (ActivityTypes[x].ToString() == "LoopType")
     {
         taggedValue.Value = sSubType;
      }
      else { taggedValue.Value = ActivityValues[x].ToString(); }
       Element.TaggedValues.Refresh();                        
}

What should I put to the place of the "otTaggedValue" part? What's wrong with the code? Please help!  :'(
---------------------------------------------------------------------------------------------------------------
If your tried 10x and failed, try again.  We'll never know if we'll get it right on our next try.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: BPMN 1.1 Elements
« Reply #1 on: April 02, 2011, 12:09:33 am »
You don't seem to be calling Update() on the new tagged value. Calling Refresh() on the collection only cleans up pointers to existing members and removes pointers to deleted members. You must still call Update on any new members to actually add them to the collection. Until you Update() a new member it is only held in 'temporary' memory; it has not been added to the EA model, so the collection cannot 'see' it yet.

HTH, David
No, you can't have it!

thea

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: BPMN 1.1 Elements
« Reply #2 on: April 04, 2011, 02:33:42 pm »
Thanks David!! You're a life saver... :D Thank you so much!
---------------------------------------------------------------------------------------------------------------
If your tried 10x and failed, try again.  We'll never know if we'll get it right on our next try.