Book a Demo

Author Topic: Collection of Sequence Connectors using API  (Read 4776 times)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Collection of Sequence Connectors using API
« on: February 23, 2015, 11:47:15 pm »
Hello,

I would like to loop on a lifeline sequence connectors.
Using the element.Connectors property returns the element relations except sequence connectors.

Is there another way to retrieve this data, using the API? I know it is possible to query t_connectors, but would like to avoid.

Thanks


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Collection of Sequence Connectors using API
« Reply #1 on: February 24, 2015, 03:51:47 am »
You must be doing funny things. I get all connectors.

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: Collection of Sequence Connectors using API
« Reply #2 on: February 24, 2015, 06:20:59 pm »
AFAIK you can either user Element.Connectors or use Repository.GetConnectorByID or Repository.GetConnectorByGuid

The easiest way to get the connectorID/guid is to use a query like I do in Model.cs

Code: [Select]
   public List<ConnectorWrapper> getRelationsByQuery(string SQLQuery){
      // get the nodes with the name "Connector_ID"
      XmlDocument xmlrelationIDs = this.SQLQuery(SQLQuery);
      XmlNodeList relationIDNodes =
            xmlrelationIDs.SelectNodes(formatXPath("//Connector_ID"));
      List<ConnectorWrapper> relations = new List<ConnectorWrapper>();
      foreach( XmlNode relationIDNode in relationIDNodes ) {
        int relationID;
        if (int.TryParse( relationIDNode.InnerText, out relationID)) {
          ConnectorWrapper relation = this.getRelationByID(relationID);
          relations.Add(relation);
        }
      }
      return relations;
    }

Geert