Sparx Java/,net API

1,196 views
Skip to first unread message

Shah@localhost Riddhi Shah

unread,
Feb 2, 2012, 5:02:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com
Hi,

How can I access sparx Java/.net api which can be called from any external tool by importing api. I want to develop a tool over sparx which needs to fetch requirement from sparx. How can I access Sparx SDK for the same ?

Thanks
-Riddhi Shah

[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 2, 2012, 5:37:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com

Shah@localhost Riddhi Shah

unread,
Feb 2, 2012, 6:51:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com
Hi Geert,

Thank you so much for quick reply.

I was trying to refer .jar & .dll file from C:\Program Files\Sparx Systems\EA Trial\Java API. But here I found a note that in readme.txt that "Limitations and known issues:

1. You cannot currently use this API to write plug-ins for EA. It is only suitable for accessing the automation server API.
"

Is it okay to use this jar & dll for accessing information ? I basically want to fetch information regarding Requirements through my java application.

I appreciate your help.

Thanks.

[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 1, 2012, 7:43:00 PM2/1/12
to sparx-enterprise-archite...@googlegroups.com
Yes should be ok.
You'll just have to execute your code from a separate exe iso as an add-in in EA.

Geert

[original message]

Shah@localhost Riddhi Shah

unread,
Feb 2, 2012, 10:16:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com
Thanks Geert. That was really helpful.

Is there a way in api to create requirement with tagged values ? I could not find the method for the same.

- Riddhi

[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 2, 2012, 10:19:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com
Package.Elements.AddNew()

Geert

[original message]

qwerty

unread,
Feb 2, 2012, 11:35:00 AM2/2/12
to sparx-enterprise-archite...@googlegroups.com
+ Element.TaggedValues.Addnew()

q.

[original message]

Shah@localhost Riddhi Shah

unread,
Feb 6, 2012, 9:33:00 AM2/6/12
to sparx-enterprise-archite...@googlegroups.com
Hi,

I am trying to open package and get list of elements from package. The issue I am facing is , On package get it loads package on sparx interface , and my package object is still null. I am doing following:

Repository r = new Repository();
             boolean flag = r.OpenFile("C:\\Project.eap");
           
             Package pkg = r.GetPackageByGuid("293016A6-0D38-427d-90E4-3EE5925DB438");
             org.sparx.Collection<Element> coll = pkg.GetElements();

on pkg.getElements() it gives null pointer exception.

Thanks,

Riddhi

[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 6, 2012, 10:09:00 AM2/6/12
to sparx-enterprise-archite...@googlegroups.com
That's because your GUID is not in the correct format.

Geert

[original message]

Shah@localhost Riddhi Shah

unread,
Feb 7, 2012, 8:55:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
Hi Geert,

Thank you so much for your reply. It was really helpfull.

I am still struglling with Create/Update/Get Requirements through java api. I need api to list all requirements of given package/reposirtory. Also I need apis to create/update requiorements in given package. As per previous reports, I tried to add element in following way :


Repository r = new Repository();
boolean flag = r.OpenFile("C:\\TestProject.eap");

Package pkg = r.GetPackageByGuid("{293016A6-0D38-427d-90E4-3EE5925DB438}");
org.sparx.Collection<Element> coll = pkg.GetElements();
coll.AddNew("Requirement","test");

Here, it does not give any error. But I can not see any requirement created under package ( having guid {293016A6-0D38-427d-90E4-3EE5925DB438} ).

Also, I was looking at the documentation pdf called enterprise_architect_sdk.pdf. Where there is listing of various classes/ methods. I was looking at Requirement class, but I did not get how to load requirement object.

Is it advisable to use java api or is it better to create .net project ?

Thank you so much once again.

Thanks,

Riddhi Shah

[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 7, 2012, 9:26:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
Riddhi,

- Make sure you always reload the model before checking if something has appeared in EA. The GUI tends to cache a whole lot of stuff, and it might not have notice that something new has been created in the database.
- Make sure you always call update() after each change.
- Sometimes a refresh() on a collection also is necessary sometimes after adding/removing elements from the collection.
- Make sure you call update() on the new element returned by AddNew()

Geert

PS. It should not matter if you choose Java or .Net, but for .Net there are more examples available.

[original message]

Shah@localhost Riddhi Shah

unread,
Feb 7, 2012, 9:49:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
Hi,

Thank you so much for the reply.

Even after calling following it is not showing requirements on reload of model :

Element e = coll.AddNew("Requirement","test");
             e.Update();
             e.Refresh();
             coll.Refresh();

Is mercurial api user interactive ? I notice that If we are running on trial license , it asks to continue trial license on

Repository r = new Repository();
             boolean flag = r.OpenFile("D:\Trail.eap");

Till will do not click continue, api does not respond.

Also, I want to create requirement with all the properties set like priority, status , title , description and custom tags. What is the way of doing it ?


[original message]

Shah@localhost Riddhi Shah

unread,
Feb 7, 2012, 9:52:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
* I mean to ask , Is this ( sparx ) api user interactive ?
[original message]

Bellekens@localhost Geert Bellekens

unread,
Feb 7, 2012, 9:57:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
I'm sorry, this is as far as I go.
I'm willing to get you started, but from a certain point on you will have to do it on your own.

Good luck

Geert

[original message]

Shah@localhost Riddhi Shah

unread,
Feb 7, 2012, 10:11:00 AM2/7/12
to sparx-enterprise-archite...@googlegroups.com
Thanks Geert.
[original message]
Reply all
Reply to author
Forward
0 new messages