Book a Demo

Author Topic: 2 associations betw. classes -- connectorDestRole?  (Read 3511 times)

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
2 associations betw. classes -- connectorDestRole?
« on: August 09, 2005, 02:44:54 pm »
Hi there,

I have two classes (Project and Firm), which are linked by two associations.
The reason is, that a Project can have multiple project members, but additionally up to one, not mandatory builder (its all about construction business stuff...).
The builder though can also be a regular project member at the same time.
A Firm on the other hand can be both projectmember and/or builder in multiple projects.

So I created both associations, where projectMember gets the {union} constraint and builder the {subset} constraint.
I altered the transformations, that if a destinationMulitplicity is of type  (0..*; *; 1..*), that a DataSet will be created within the destination class.

This is how I do it:

%if connectorDestMultiplicity != "0" or connectorDestMultiplicity != "1" or connectorDestMultiplicity != "0..1" %
         $attName=%connectorDestRole%+"sDS"
         $type="DataSet"
         %Property($attName,$type)%
         %Attribute__Prop_Attr($attName,$type)%
%endTemplate%


However, the DataSets often (not always?) ends up with the connectorDestRole of builder, not of projectMember.
Any way to control which connectorDestRole the template uses?
« Last Edit: August 09, 2005, 02:46:42 pm by Kaneda »
There are 10 types of people in this world. Those who understand binaries and those who don't...

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: 2 associations betw. classes -- connectorDestR
« Reply #1 on: August 09, 2005, 03:38:46 pm »
There is also connectorSourceRole. (And connectorSourceMultiplicity etc.)

Simon

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: 2 associations betw. classes -- connectorDestR
« Reply #2 on: August 10, 2005, 12:18:13 am »
Hi Simnon, thanks for the reply.

Though I have to admit, I think you misunderstood my question.:)

"builder" and "projectMember" are both roles a firm (target/destination) can have, they have nothing to do with the project (source).
The project-end of the associations (source) has no roles, as I can't think of any (and the association isn't navigable that direction anyway).
Additionally, both source associations have a multiplicity = *.

Is there maybe a way of doing sth like this( pseudo code):

if (connectors.Count > 1)
   get connector.DestRole where connecterConstraint == "union" ?

That way I could alter the template to always use the role of the union association, not any subset association.
There are 10 types of people in this world. Those who understand binaries and those who don't...

Kaneda

  • EA User
  • **
  • Posts: 38
  • Karma: +0/-0
    • View Profile
Re: 2 associations betw. classes -- connectorDestR
« Reply #3 on: August 10, 2005, 02:24:08 am »
well, my initial problem is solved ("smart" as I am, I declared the target role pf projectMember private...).

But I still wonder if sth. like my pseudo code up there is possible?
There are 10 types of people in this world. Those who understand binaries and those who don't...