Book a Demo

Author Topic: Element Feature Connector  (Read 3763 times)

Drops

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Element Feature Connector
« on: June 11, 2013, 07:41:31 pm »
How do I connect a connector to an element feature withe the automation interface? Connector.SupplierID seems to support element only.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Element Feature Connector
« Reply #1 on: June 11, 2013, 07:53:18 pm »
From my Inside book:
Quote
9.16 Connector StyleEx Property
...
Association -
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> = R if <dir> == S or L if <dir> == E
<pos> is obviously redundant...
There can be one LFSP, one LFEP or both be present in one StyleEx property

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Element Feature Connector
« Reply #2 on: June 11, 2013, 08:33:44 pm »
I've recently added support for linked features in the EA Navigator (version 2.4, not yet released).
Heres the code inConnectorWrappers.cs that deals with that:

Code: [Select]
/// returns the related elements.
    /// In EA the Connectoris a binary relationship. So only two Elements will
    /// ever be returned.
    /// If there is a linked feature then the linked feature will be returned instead of the EA.Element.
    public List<UML.Classes.Kernel.Element> relatedElements {
      get
      {
        List<UML.Classes.Kernel.Element> returnedElements =  new List<UML.Classes.Kernel.Element>();
        
        //add client element
        //check first if there is a linked feature
        UML.Classes.Kernel.Element linkedClientFeature = this.getLinkedFeature(true) as UML.Classes.Kernel.Element;
        if (linkedClientFeature != null)
        {
              returnedElements.Add(linkedClientFeature);
        }
        else
        {
              returnedElements.Add(this.model.getElementWrapperByID(this.wrappedConnector.ClientID));
        }
        //add supplier element
        //check first if there is a linked feature
        UML.Classes.Kernel.Element linkedSupplierFeature = this.getLinkedFeature(false) as UML.Classes.Kernel.Element;
                if (linkedSupplierFeature != null)
        {
              returnedElements.Add(linkedSupplierFeature);
        }
        else
        {
              returnedElements.Add(this.model.getElementWrapperByID(this.wrappedConnector.SupplierID));
        }
        return returnedElements;
      }
      set { throw new NotImplementedException(); }
    }
    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