Book a Demo

Author Topic: How to create MDG elements via API?  (Read 5375 times)

Shaun Yandle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
How to create MDG elements via API?
« on: February 13, 2013, 07:47:50 am »
Using EA v10 b1004. Trying to create BPMN2 elements via Java batch application to provide an import from external data/relationship sources.

I can do this via UI, but unable to figure out what/how to get the same result via API. UML Activity is close but not sufficient.

Already doing the base work of obtaining the Collection<Elements>.AddNew(name,type?)
No stereotypes show when manually created.

Any advice is appreciated!
--Shaun

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to create MDG elements via API?
« Reply #1 on: February 13, 2013, 10:05:28 am »
You need to supply the MDG identifier. E.g.
Code: [Select]
AddNew ("name", "BPMN2.0::Activity")
q.

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: How to create MDG elements via API?
« Reply #2 on: February 13, 2013, 07:40:02 pm »
I've got this working with elements - but not with packages

When I create a package, referring to the [profile]::[type] I get no stereotype in the created package.

This profile is not created by me (and I haven't done that - yet), can it be a missing thingy in the profile ?

gr
« Last Edit: February 13, 2013, 07:40:16 pm by dannyf »
Reg.

Danny

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to create MDG elements via API?
« Reply #3 on: February 13, 2013, 11:13:17 pm »
No idea. Either you wait a day for a Sparxian to reply or contact their support.

Is it a certain package out of the BPMN2 profile from Sparx?

q.
« Last Edit: February 13, 2013, 11:14:39 pm by qwerty »

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: How to create MDG elements via API?
« Reply #4 on: February 13, 2013, 11:26:59 pm »
No - it's a home made profile by one of my colleagues.

Problem is we're both beginners in EA MDG/automatisation
Great product but ....  ;)
Reg.

Danny

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to create MDG elements via API?
« Reply #5 on: February 14, 2013, 12:09:50 am »
But you can create the package manually using that profile?

q.

Shaun Yandle

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: How to create MDG elements via API?
« Reply #6 on: February 21, 2013, 08:02:33 am »
Took me a bit of more trial-and-error, but discovered that you have to use the stereotype defined in the MDG xml (and that shows in Project Browser).  So more of [MDG-ID]::[MDG-Stereotype]. For example, use BPMN2.0::StartEvent

Basically, do not set the stereotype field (I have a utility routine that does the createElement(name, type, stereotype) ).

Thanks!
--Shaun

Danny F

  • EA User
  • **
  • Posts: 60
  • Karma: +0/-0
    • View Profile
Re: How to create MDG elements via API?
« Reply #7 on: February 21, 2013, 05:12:17 pm »
Yep use [profile::type]  BUT it doesn't seem to work for a package
Works for EA.Element, not for EA.Package
- in my case anyway

Querty asked if the package can be created thru the MDG ?
I don't know - it is not in the toolbox.
The MDG package is there only to be used by the add-in; the user doesn't manually create such packages

Reg.

Danny

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to create MDG elements via API?
« Reply #8 on: February 21, 2013, 10:53:19 pm »
Quote
Querty asked if the package can be created thru the MDG ?
I don't know - it is not in the toolbox.
The MDG package is there only to be used by the add-in; the user doesn't manually create such packages

For testing purpose you should put it into a toolbox so you'll be sure it is created correctly. If it doesn't create manually the API won't do it anyway.

Probably you should think of having the package in a toolbox permanently for maintenance purpose.

q.