Book a Demo

Author Topic: Create a shared or composite aggregation  (Read 3122 times)

Kai H.

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
  • Where is my mind?
    • View Profile
Create a shared or composite aggregation
« on: March 25, 2011, 11:14:30 pm »
This is not a question, but an answer from the EA support. I post it here to share it with you.

The folowing code creates a composite aggregation with the black diamond :

Code: [Select]
EA.Connector CompositeConnector = (EA.Connector)destElement.Connectors.AddNew("", "Aggregation");
CompositeConnector.SupplierEnd.Aggregation = 2;
CompositeConnector.ClientID = Composite.ElementID;
CompositeConnector.SupplierID = destElement.ElementID;
CompositeConnector.Update();

to have the white diamond (shared),
Code: [Select]
CompositeConnector.SupplierEnd.Aggregation = 2;has to be replaced by:
Code: [Select]
CompositeConnector.SupplierEnd.Aggregation = 1;or by zero for none.

Kai
« Last Edit: March 25, 2011, 11:15:26 pm by kai.hoefig »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Create a shared or composite aggregation
« Reply #1 on: April 01, 2011, 11:15:17 pm »
FWIW...

Keep in mind that setting the value to zero can leave you open to a side effect. You are left with an aggregation connector that has where the type is invisible to both EA and the user. This can have consequences later if EA treats the connector as an aggregation, but a user thinks it is just a 'plain' link.

An example case is iterating through the model looking for connectors by type. A user may think the 'plain' connector is an association, but EA cannot find it by enumerating "association" type connectors. This can be frustrating for users of an automation tool.

It is possible - even easy! - to set up this situation through automation, much more difficult - perhaps impossible - through the UI. It can be difficult to debug.

David
No, you can't have it!