Book a Demo

Author Topic: EA 7.1 Java API, problem with connector type UC  (Read 3210 times)

doddy

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
EA 7.1 Java API, problem with connector type UC
« on: December 23, 2010, 03:37:30 am »
Hello,
I would like to create a conector type 'UseCase' between two classes. I'm getting weird exception:

Code: [Select]
Repository r = new Repository();
r.OpenFile("c:/tmp/sample.eap");
Package model = (Package) r.GetModels().GetAt((short) 0);
Element e1 = model.GetElements().AddNew("cos1", "Class");
Element e2 = model.GetElements().AddNew("cos2", "Class");
model.Update();
Connector addNew = e1.GetConnectors().AddNew("something", "UseCase");
addNew.SetSupplierID(e2.GetElementID());
addNew.Update();
e1.Refresh();
Program creates element classes 'cos1' and 'cos2' but connector type 'UseCase' won't work (i.e. types: Dependency, Association works).
Exception in thread "main" java.lang.Exception: I
        at org.sparx.Connector.comUpdate(Native Method)
        at org.sparx.Connector.Update(Connector.java:538)
        at sample.package.Test.main(Test.java:30) <-- line addNew.Update();

I've tryied 'UseCaseLink' but dependency type was 'Dependency' not 'UseCase'

Anyone had such problem?
« Last Edit: December 23, 2010, 03:38:49 am by doddy »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA 7.1 Java API, problem with connector type U
« Reply #1 on: January 03, 2011, 07:21:58 pm »
"UseCase" should work (according to the 7.5.850 documentation)
Have you tried it with a more recent version of EA?

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA 7.1 Java API, problem with connector type U
« Reply #2 on: January 03, 2011, 07:23:38 pm »
And you might try to update() e1 and e2 before updating the connector.

Geert

doddy

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: EA 7.1 Java API, problem with connector type U
« Reply #3 on: January 03, 2011, 09:00:29 pm »
Quote
"UseCase" should work (according to the 7.5.850 documentation)
Have you tried it with a more recent version of EA?

Geert

Thank you for solution. It worked with 7.5.850 but it didn't want to with EA 8.
Update elements didn't work, so i switched API version.