Book a Demo

Author Topic: How to update information flow connectors  (Read 4151 times)

anderst

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
How to update information flow connectors
« on: October 08, 2009, 03:03:29 am »
 I'm would like to create a script that updates the type of information that flows for all information flow connectors in a diagram.

The script would look like this:

var diagram as EA.Diagram;
diagram = Repository.GetTreeSelectedObject();
      
for ( var i = 0 ; i < diagram.DiagramLinks.Count ; i++ )
{
    var link as EA.DiagramLink;
    var c as EA.Connector;

    link = diagram.DiagramLinks.GetAt(i);
    c = Repository.GetConnectorByID(link.ConnectorID);
            
    if (c.Type == "InformationFlow")
    {                  
        // code to update information item conveyed goes here                  
        c.Update();
    }
}

The question i have is how to update information item conveyed?
 I cant find anything on the connector or the link, where is this stored?            


Repository.ReloadDiagram(diagram.DiagramID);
« Last Edit: October 08, 2009, 06:50:50 pm by anderst »

David OD

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: How to update information flow connectors
« Reply #1 on: July 14, 2010, 05:33:36 pm »
Bump.  

I also need to be able to find this data, as I am trying to generate documentation based upon these Information Flows.  How do we locate the class that is linked to the Information Flow connector?
Regards
David

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to update information flow connectors
« Reply #2 on: July 14, 2010, 05:36:22 pm »
Have you looked in the database?
There might be some kind of id in one of the pdata columns that points to the informationItem element.

Geert

David OD

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
SOLVED: How to update information flow connectors
« Reply #3 on: July 16, 2010, 11:34:23 am »
Thanks Geert.

After much playing around I discovered a way of obtaining the information by doing a SQL query against the database.  The data is held in the table t_xref, but doesn't appear to have been surfaced anywhere in the API that I can see.  

The following code may assist others:

Code: [Select]
'-------------------------------------------------------------
' Get class linked to information flow
'-------------------------------------------------------------
Public Function getConveyedClasses(connectorGUID As String) As String
    Dim sqlText As String
    
    If connectorGUID = "" Then
        getConveyedClasses = ""
        Exit Function
    End If
    
    sqlText = sqlText & "Select Description "
    sqlText = sqlText & "FROM t_xref "
    sqlText = sqlText & "WHERE client = " & connectorGUID
    sqlText = sqlText & " AND type = 'connector property' "
    sqlText = sqlText & " AND behavior = 'conveyed' "
    
    getConveyedClasses = SQLQuery(sqlText)
End Function

Note that when given the GUID of the connector, this returns an XML string with the GUID of the class being conveyed by the flow.

I called this function as follows:

Code: [Select]
If conn.Type = "InformationFlow" Then
   sqlData = EAR_Connection.getConveyedClasses(conn.connectorGUID)
   startGUID = InStr(sqlData, "{")
   endGUID = InStr(sqlData, "}")
   elementGUID = Mid(sqlData, startGUID, endGUID - startGUID + 1)
   workText = EAR_Connection.getElementNameByGUID(elementGUID)
End If

This does what I need it to do, but could no doubt be improved/expanded depending upon other's needs.

I hope it helps.
« Last Edit: July 16, 2010, 11:35:17 am by david.odriscoll »
Regards
David