Book a Demo

Author Topic: Realized Information Flows  (Read 3743 times)

John Kendall

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Realized Information Flows
« on: February 15, 2013, 12:18:24 am »
Hi

I am trying to get the Collection of realized informationFlows of a Connector from within a Script in EA, however I can't find a way of doing it in the API definition of Connector.  

I have an SQL query which works fine in the Model Search, but there is not an API call to return Connectors - GetElementSet only returns elements and there is not an equivalent for Connectors.  

Any clues anyone, this is really holding me up?

Thanks

John

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Realized Information Flows
« Reply #1 on: February 15, 2013, 12:34:43 am »
Why not execute the SQL via Reopsitory.SQLQuery and parse the result?

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: Realized Information Flows
« Reply #2 on: February 20, 2013, 12:27:30 am »
https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/Model.cs has all kinds of utility functions to get things from EA based on a query.
This is the code I use for connectors:

Code: [Select]
internal List<ConnectorWrapper> getRelationsByQuery(string SQLQuery){
      // get the nodes with the name "Connector_ID"
      XmlDocument xmlrelationIDs = this.SQLQuery(SQLQuery);
      XmlNodeList relationIDNodes =
        xmlrelationIDs.SelectNodes("//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