Author Topic: Problem with connector in EA 11  (Read 5125 times)

Vinit Agrawal

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Problem with connector in EA 11
« on: February 18, 2015, 02:06:02 am »
Hi Forum,

I am trying to write an add in in C# for Enterprise architect.  I am using the EA 11 version.
As part of C# code, I am trying to create a connector which will show the association as
Composition by first creating the connector as “Association” type, setting the client and
Supplier ID and Direction as “Source -> Destination”.

Then I am again changing the type to “Aggregation”,  setting the client end Aggregation to 2.
When I run my add in, it does not show association as “composition” and also client end
Aggregation is set as “None”. So can you please help how can I fix this.

I recently upgraded to version 11 and before that it was working fine in
version 10. I again tested same code in EA version 10 and it worked fine.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Problem with connector in EA 11
« Reply #1 on: February 18, 2015, 02:23:16 am »
So you're saying that your V10 code stopped working in V11? Can you post the relevant parts?

q.

Vinit Agrawal

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Problem with connector in EA 11
« Reply #2 on: February 18, 2015, 04:06:21 am »
Hi, I am not sure if can post the code as not allowed as per policy but in code i am doing exaclty the same as i mentioned in my problem.  Thanks.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Problem with connector in EA 11
« Reply #3 on: February 18, 2015, 04:33:23 am »
If you're not sure then ask. No code, no answer except: sounds ok what you're telling.

q.
« Last Edit: February 18, 2015, 04:33:37 am by qwerty »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13240
  • Karma: +553/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem with connector in EA 11
« Reply #4 on: February 18, 2015, 06:07:07 pm »
Wasn't "Aggregation" as a connector type deprecated?
IIRC you should use a regular "Association" now.

Geert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8061
  • Karma: +118/-20
    • View Profile
Re: Problem with connector in EA 11
« Reply #5 on: February 19, 2015, 08:51:51 am »
Quote
Wasn't "Aggregation" as a connector type deprecated?
IIRC you should use a regular "Association" now.
Well... Yes. Aggregation as a connector type technically ceased to exist in UML in v2.0. EA adopted that over 10 years ago, and since then it's been possible to set aggregation on associations. But we've never stopped people creating aggregations. They are even still on the toolbox.

MeryemAdb

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Problem with connector in EA 11
« Reply #6 on: April 09, 2015, 10:32:03 pm »
Hi,
I have the same problem.

My add-in allows editing a connector, in order to modify the role, cardinality, navigability (Navigable or Unspecified) and Aggregation (shared or none) on either side.
It worked on EA 10 but not anymore on EA 11.

Here is a simplified version of what I do (I use my own class to store the characteristics of each side of the relation, so I cleaned up the use of my classes):

Code: [Select]
relation.SupplierEnd.Aggregation = agg1 ? 1 : 0;
relation.SupplierEnd.Navigable = nav1? "Navigable" : "Unspecified";
relation.SupplierEnd.Cardinality = card1;
relation.SupplierEnd.Role = role1;
relation.SupplierEnd.Update();
relation.Update();
relation.ClientEnd.Aggregation = agg2 ? 1 : 0;
relation.ClientEnd.Navigable = nav2 ? "Navigable" : "Unspecified";
relation.ClientEnd.Cardinality = card2;
relation.ClientEnd.Role = role2;
relation.ClientEnd.Update();
relation.Update();
repository.ReloadDiagram(diagram.DiagramID);

The relation I am testing this on is an association, and if I follow what happens with a debugger, I see that the aggregation is actually modified (set to 1) at least until after I reload the diagram.

One last mystery: the modification is only effective for the SupplierEnd of the relation NO MATTER which end I update first.

At one point I tried to modify the direction of the relation so it was consistent with both navigabilities, but it did not improve things.

Any idea will be greatly appreciated.
« Last Edit: April 09, 2015, 10:36:28 pm by MeryemAdb »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Problem with connector in EA 11
« Reply #7 on: April 10, 2015, 03:42:47 am »
Have you tested it with V12?

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Problem with connector in EA 11
« Reply #8 on: April 10, 2015, 09:18:08 am »
EA prevents aggregation being set at both ends of an association: If you set the aggregation at one end, EA will automatically clear the other end (may have been a bug fix for EA 11). So try changing

Code: [Select]
relation.ClientEnd.Aggregation = agg2 ? 1 : 0;to

Code: [Select]
if (agg2 && !agg1) relation.ClientEnd.Aggregation = 1;
I think that ought to do it.
« Last Edit: April 10, 2015, 09:20:22 am by KP »
The Sparx Team
[email protected]

MeryemAdb

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Problem with connector in EA 11
« Reply #9 on: April 10, 2015, 04:58:35 pm »
Thanks for the replies.

I have not tested for version 12 but I'd rather find a solution that works for versions 10 to 12. I do not know what version my users will be using.

As for the fact that there cannot be an aggregation on both ends, my booleans agg1 and agg2 cannot be both true at the same time. But I suppose when I first change the aggregation on one end it is possible that the aggregations are temporarily non consistent. I will try to modify the code in order to change aggregations on both ends at the same time.

MeryemAdb

  • EA User
  • **
  • Posts: 23
  • Karma: +0/-0
    • View Profile
Re: Problem with connector in EA 11
« Reply #10 on: April 23, 2015, 08:11:45 pm »
It does not work either with EA 12.

I wonder if it can be due to navigability. In order to be able to modify the navigability on either end of the connector, before relaoding the diagram, I set the direction of the connector appropriately (if source is navigable and not target, I set the direction as Destination -> Source, if neither is, I set it as Unspecified and so on). but maybe it is not consistent with aggregation (on the Client end, because setting aggregation on the Supplier end works).

Edited To Add:
If in the code posted above I do not update the relation at all (but only each connector end after I modified it)  and do not set the direction, I have the same results:
 + navigability works on both side of the connector.
 + aggregation only works on the connector end I modified first (I only try to set aggregation on one side of the relation at a time)

So even if it does not change anything from a practical point of view (I still cannot modify aggregation on either sides of the relation), at least it is now somewhat logical.
« Last Edit: April 24, 2015, 01:24:49 am by MeryemAdb »