Book a Demo

Author Topic: Connector creation of "Composition" shows up as Aggregation  (Read 3464 times)

HerbertFalk

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Connector creation of "Composition" shows up as Aggregation
« on: August 15, 2017, 10:47:15 pm »
I am having difficulty in adding a connector that creates a solid "diamond" (e.g. composition).  If I use the string "Composition" or "Aggregation" in the following code, the diamond is always "Aggregation".  I even try to set the color to "black".  Any ideas?


            {


                    conn1 = (EA.Connector)domainElement.Connectors.AddNew("", Constants.Constants.EA_COMPSITION_VALUE);
                    conn1.Notes = comment;
                    conn1.Color = Convert.ToInt32("0xFFFFFFFF", 16);
                    conn1.ClientID = domainElement.ElementID;
                    conn1.SupplierID = rangeElement.ElementID;
                    conn1.ClientEnd.Role = domainElement.Name;
                    conn1.ClientEnd.Cardinality = "1";
                    conn1.SupplierEnd.Role =rangeElement.Name ;
                    conn1.SupplierEnd.Cardinality = multiplicity;
                    conn1.Update();

                    domainElement.Update();
                domainElement.Refresh();
                rangeElement.Update();
                rangeElement.Refresh();

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Connector creation of "Composition" shows up as Aggregation
« Reply #1 on: August 16, 2017, 12:00:28 am »
You need to use SupplierEnd (or ClientEnd). I hope you don't mind the Perl in this snippet:

Code: [Select]
my $e = $rep->GetElementByGUID("{031A0F62-A282-41c6-B2F2-C31763DB79C8}");
my $c = $e->Connectors->AddNew("test", "Aggregation");
$c->{SupplierID} = 483;
$c->Update();
my $ce = $c->SupplierEnd;
$ce->{Aggregation} = 2;
$ce->Update();

q.