Book a Demo

Author Topic: Relationship between an Element and a Method of a Class  (Read 5873 times)

Viking

  • EA User
  • **
  • Posts: 478
  • Karma: +2/-2
    • View Profile
Relationship between an Element and a Method of a Class
« on: May 02, 2017, 08:41:44 pm »
Hi,

(1) Is there a posbility to relate an element (in my case a BPMN activity) and a method of a class?

Related to the question above but in fact a new topic is the following: I tried to drag and drop the method (a) of a class from the project browser onto a diagram. I am confused about the result:
(2) EA did not ask if it should add a link or a copy. It created a new element (b) in the project browser with the the same name but different shape and an additional element called "target" (3). And it added the new element (b) into the diagram. What does that mean?
(3) If I ask the created shape / element (b) for "insert related elements" the list is empty. So the element does not know that it is derived from the method (a) and that it should be related to it.
(4) If I change the name of the original method (a), the new element (b) adds the new name after the name of the original class and two double points, but keeps its own name.

Feedback is very welcome. Many thanks in advance, V.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Relationship between an Element and a Method of a Class
« Reply #1 on: May 02, 2017, 08:50:22 pm »
1) Yes. The manual "Link to element feature". The API does not provide that directly. So you need to investigate what EA is doing in that case (forgot the details, sorry).

2) if you drop an attribute/operation it will never be a link. Instead, depending on where you drop it, EA will create a copy.

3) Don't understand. You better open different threads for different questions. And eventually a more detailed description of the steps.

4) dito

q.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Relationship between an Element and a Method of a Class
« Reply #2 on: May 02, 2017, 09:35:49 pm »
Features, eg attributes and operations, cannot exist outside an element. This is true in the project browser and in diagrams; it is part of the UML standard.

What EA does when you drag an operation onto the empty space of a diagram, since obviously you don't want the operation all on its own in the diagram, is try to create the nearest non-feature equivalent of an operation, which is an action, specifically a 'call operation' action. These belong in activity diagrams, so read up on those for details on how actions and action pins work.

Regarding creating connectors between elements and operations, you can't. Again, this is down to UML: operations Do Not Have connectors.

What Q describes is an EA feature to make it appear as if you can draw connectors to features, which you can use if appropriate. Remember, however, that the ends of the connector, as stored in the database, are still the two elements. The fact that one end is linked to a feature is not actually syntactically valid, so it's stored in one of the undocumented additional data columns which you'll have to dig through and decode.

So there are ways and ways, but it does depend on what relationship you want to represent. My BPMN is a bit rusty, but aren't activities callable elements?


/Uffe
My theories are always correct, just apply them to the right reality.

Viking

  • EA User
  • **
  • Posts: 478
  • Karma: +2/-2
    • View Profile
Re: Relationship between an Element and a Method of a Class
« Reply #3 on: May 02, 2017, 11:49:08 pm »
1) Yes. The manual "Link to element feature". The API does not provide that directly. So you need to investigate what EA is doing in that case (forgot the details, sorry).q.
Very helpful. Thank you very much.

Viking

  • EA User
  • **
  • Posts: 478
  • Karma: +2/-2
    • View Profile
Re: Relationship between an Element and a Method of a Class
« Reply #4 on: May 02, 2017, 11:51:53 pm »
/Uffe
Thank you very much, Uffe. Very helpful.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Relationship between an Element and a Method of a Class
« Reply #5 on: May 03, 2017, 12:07:12 am »
The Link info is hidden in t_connector.styleEx.
Quote
LF<dir>P=<guid><pos>; connector is attached to attribute/operation
<dir> = S or E meaning Start (source) or End (target) <guid> = ea_guid of t_attribute or t_operation
<pos> is the edge (L or R) where the connector had been attached to in the moment when the link has been created. This is a superfluous information since the renderer will attach the link to whatever place is relevant.
There can be one LFSP, one LFEP or both be present in one StyleEx property
(from p. 56 of my Inside book).

q.