Book a Demo

Author Topic: How to make an element Composite via API  (Read 8086 times)

Gian Luca

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
How to make an element Composite via API
« on: February 26, 2010, 09:19:43 pm »
Hello to everyone,

I would like to create programmatically the Make Composite GUI operation.

I'd tried several ways with no success.

Latest tentative was (c#):

Code: [Select]
application = (Element)myPackage.Elements.AddNew("My new Element", "Component");
application.Alias = myalias;
application.Stereotype = "Applicativo";
application.Update();

// create the composite diagram inside element
composite = (Diagram)application.Diagrams.AddNew(application.Name, "CompositeStructure");
composite.Update();

application.Subtype = 8;  // Composite
application.Update();

At the end I see the CompositeDiagram as child of the element application and application marked as composite, but without the infinite symbol ! And if I double click on the element application (previouly inserted in a diagram) I see the properties windows instead of the proper Composite Diagram.

Please help me !

Thanks in advance !

Gian Luca (Torino, Italy)
« Last Edit: February 26, 2010, 09:21:18 pm by glfp »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to make an element Composite via API
« Reply #1 on: February 26, 2010, 09:35:33 pm »
Gian

Have you searched the forum for "composite". (use the top left button, not the top right input field)
I'm pretty sure your question has already been answerred before. (but I don't recall the details)

Geert

Gian Luca

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to make an element Composite via API
« Reply #2 on: February 26, 2010, 09:40:02 pm »
Quote
Gian

Have you searched the forum for "composite". (use the top left button, not the top right input field)
I'm pretty sure your question has already been answerred before. (but I don't recall the details)

Geert

 >:(

Mmm .... you are right .... I used to top right search ... sorry, I found several topic now .... i'll try this way !

Thanks !


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to make an element Composite via API
« Reply #3 on: February 26, 2010, 09:42:01 pm »
No worries, it IS the most logical thing to do (use the top right box)
Unfortunately this forum isn't really logical ;)

Geert

Gian Luca

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to make an element Composite via API
« Reply #4 on: February 26, 2010, 11:30:58 pm »
Hi,

unfortunately it seems there is no solution for this issue.

The only way (that I alrealy identified) is to change/create the correct record in  t_xref table.  :(

It's described here

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1217982429/15

you also replied .

A EA Administrator  said here (on 2008)
 
http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1217982429/10#10

that he was envolved in a isComposition attribute to define it as composite but without results.

I think is not a good idea to write directly on DB ...

What do you think about this ?

Thank you !

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to make an element Composite via API
« Reply #5 on: February 27, 2010, 12:19:21 am »
Gian,

I absolutely agree that it's a bad idea to write directly in the database.
I suggest that you file a bug report/support request.
Usually the Sparxians are happy to help you out with a specific question.

Use the link on the button of the page to report the bug.

Geert

Gian Luca

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: How to make an element Composite via API
« Reply #6 on: February 27, 2010, 12:29:27 am »
Quote
Gian,

I absolutely agree that it's a bad idea to write directly in the database.
I suggest that you file a bug report/support request.
Usually the Sparxians are happy to help you out with a specific question.

Use the link on the button of the page to report the bug.

Geert

I will ! Thanks.


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to make an element Composite via API
« Reply #7 on: January 17, 2011, 11:36:36 pm »
Any results here?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to make an element Composite via API
« Reply #8 on: January 17, 2011, 11:50:33 pm »
Should be included in V 9 according to this post: http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1294607049/1#1

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How to make an element Composite via API
« Reply #9 on: January 19, 2011, 07:46:50 am »
Thanks. Would be nice to trash my INSERT INTO t_xref which is really a PITA.

q.