Book a Demo

Author Topic: Linked element feature  (Read 4325 times)

bd4

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Linked element feature
« on: October 27, 2015, 08:02:48 pm »
Has anybody had any success in reporting out the associations that can be created using the 'linked element feature'?

We've been using the feature to map some logical attributes to an ancient physical model but unless we can report on it, it seems wasted effort.

The help is not encouraging and looks as if the finer level of granularity can not be extracted although under the covers EA must be maintaining it to draw the line:

‘This is entirely a visual aid, to indicate which features are significant in the relationship. In code generation or transformation, the link is interpreted as a normal source-element to target-element relationship.’

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Linked element feature
« Reply #1 on: October 27, 2015, 09:07:57 pm »
Yes, in the (open source) EA Navigator I use those links to navigate from feature to feature.

The relevant code can be found at https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/ConnectorWrapper.cs

Code: [Select]
   private UML.UMLItem getLinkedFeature(bool start)
    {
          string styleEx = this.wrappedConnector.StyleEx;
          string key;
          UML.UMLItem linkedFeature = null;
          
               if (start)
               {
                key = "LFSP=";
               }else
               {
                     key = "LFEP=";
               }
               int guidStart = styleEx.IndexOf(key) + key.Length ;
               if (guidStart >= key.Length)
          {
                string featureGUID = styleEx.Substring(guidStart,this.WrappedConnector.ConnectorGUID.Length);
                linkedFeature = this.model.getItemFromGUID(featureGUID);
          }
          return linkedFeature;
    }

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Linked element feature
« Reply #2 on: October 27, 2015, 09:28:06 pm »
Hello,


"Link to element feature" is an EA feature that has no basis in UML, where connectors can only go between elements. So its implementation is by necessity a bit of a hack.

You can't find the linked features in regular RTF templates, but you can create a script that finds them and then use that script in a template fragment.

The information is stored in Connector.StyleEx, which is a string of key=value pairs. The keys to look for are LFEP and LFSP, whose values correspond to the GUIDs of the linked features.

Note that there is nothing to signify what type of feature the connector is linked to, so you'll simply have to find out by trying Repository.GetAttributeByGuid(), Repository.GetMethodByGuid() etc.

Cheers,


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

bd4

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Linked element feature
« Reply #3 on: October 30, 2015, 02:27:16 am »
Thanks Geert and Uffe I'll give that code a try.