Book a Demo

Author Topic: Applying profiles to Elements via API  (Read 3653 times)

nbau2s

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Applying profiles to Elements via API
« on: September 04, 2008, 05:28:02 pm »
I would like to do the following using the API:
 - create a new element
 - set its stereotype
 - set the (values of the) tagged values that are defined by the stereotype (with the correct type!)

While I am able to create a new class and set the stereotype; the tagged values for that stereotype don't show up in Sparx EA; I first have to synchronize the tagged values and constraints (manually). Unfortunately, this does not really solve my problem, because I want to set the correct values for the tagged values. But when I create the tagged values using the API, I am not sure how to set the type of the tagged value correctly. E.g. if I have a profile that defines a tagged value "tv" of the type MyEnum, creating a tagged value "tv" for an element  with the type "MyEnum" does not result in a drop-down-box for the tagged value in Sparx, even if I synchronize the tagged values and constraints afterwards.

Any ideas what I am doing wrong?

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Applying profiles to Elements via API
« Reply #1 on: September 04, 2008, 06:17:30 pm »
There's an "undocumented feature" for calling tagged value synchronization with the api:

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1205431696/0#0

I don't know whether it sets the types correctly, but it may be worth a try.

nbau2s

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Applying profiles to Elements via API
« Reply #2 on: September 04, 2008, 07:33:02 pm »
Thank you, that worked like a charm.

nbau2s

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Applying profiles to Elements via API
« Reply #3 on: September 04, 2008, 10:11:46 pm »
Maybe it was a bit too early to declare success; while the custom-command works on new classes, it does not seem to work on new attributes. I am doing exactly the same as with the new class:
after having set the stereotype (and updating the attribute) , I call the custom command with the name of the attribute's stereotype; but the tagged values won't show up. I still have to synchronize manually that stereotype.

Any Ideas?

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Applying profiles to Elements via API
« Reply #4 on: September 04, 2008, 10:25:34 pm »
Guess we'll have to wait for Sparx to join in. Or you could send a support request. They usually answer them.