Book a Demo

Author Topic: VBS script: Activity  (Read 5639 times)

Jheim

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
VBS script: Activity
« on: May 02, 2017, 07:14:36 pm »
Hello together,

at the moment i am working on a VBS script to automate the creation of activity diagrams from classes.
In order to do this i create activites for every method and attribute
E.g. if a method takes two Integers parA and parB, i create two ActivityParameters.
This is my project structure after my script created the elements: http://imgur.com/tmAodft

My problem is, that i need to get the datatype of the parameters of a method or the type of the return parameter and set them in the new created ActivityParameter.

In the property menu of the created activityparameter there is an option to set the type (e.g. Integer, Boolean, ...): http://imgur.com/GbRiC5M

Is there a way to get the parameter type from the original method and access this option via the VBS-API? I'm afraid i could not find anything regarding this topic in the official API-Documentation.

I hope you understand my problem.
I do appreciate any help on this topic.

Thanks in advance,

Jonas


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: VBS script: Activity
« Reply #1 on: May 02, 2017, 08:01:18 pm »
The database has set A Classifier_GUID which obviously is not related to any classifier (since in my case I selected REAL). Now, it seems like EAUI strikes again. This value also does not appear in the API. My advice: contact Sparx support and ask what to do.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: VBS script: Activity
« Reply #2 on: May 03, 2017, 10:52:22 am »
Yes, it has used the Classifier_Guid to set the type of the parameter.

The types specified by OMG as part of UML are all represented by specific guids. It's not hard to work out which these are.
{EABOOL00-B653-4f3c-A010-30205D67F5F5},
{EAINT000-B653-4f3c-A010-30205D67F5F5},
{EAREAL00-4339-434b-BC17-A5E1FDC63F6C},
{EASTRING-B653-4f3c-A010-30205D67F5F5},
{EAUNAT00-B653-4f3c-A010-30205D67F5F5},

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: VBS script: Activity
« Reply #3 on: May 03, 2017, 06:19:39 pm »
But it does not appear in the API, does it? Or is that just again an issue with the Perl interpreter API?

q.

Jheim

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: VBS script: Activity
« Reply #4 on: May 03, 2017, 10:00:51 pm »
Thanks for your replies.

So, as far as i understand this, there is no native functionality to set the Type of an ActivityParameter via the API, but via the SQL-Interpreter?

I know that the EA Object Model Reference lists the corresponding tables (e.g. "t_operation" for "Method class") and i can query the Attributes listed in the Object Model Reference with SQL, but these are the same Attributes as i can access via the API.
Is there any further information about those tables (e.g. columns), that are not documented in the Object Model Reference?

Thanks again for your help.

Jonas

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VBS script: Activity
« Reply #5 on: May 03, 2017, 11:27:48 pm »
Jonas,

If you are using "primitive" types then you can use EA.Parameter.Type and use the name of the primitive ("Integer", "Boolean", ...)
If you are using elements defined in your model you also need to fill in the EA.Parameter.Type, but also fill in the EA.Parameter.ClassifierID with the ElementID of the element you are using as type of the parameter.

More info on the database can be found in Thomas Kilian's "Inside Enterprise Architect" book.

Geert

Jheim

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: VBS script: Activity
« Reply #6 on: May 04, 2017, 12:25:01 am »
Thanks for your reply, Geert.

I already tried to set the EA.Parameter.Type with "Integer", etc.
But this does not set the Type, which i can change in the properties dialogue of the ActivityParameter (please see picture), that is what i'd like to achieve/automate.


Also, the ClassifierID is always 0 for me; independent of the EA.Parameter.Type. Is this a normal behaviour?



Jonas