Author Topic: Getting DiagramLinks from Sequence Diagrams  (Read 3335 times)

ttk9

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Getting DiagramLinks from Sequence Diagrams
« on: October 03, 2005, 10:14:38 am »
Hi,

Im having a bit of trouble getting some data from EA using the Automation Libs.  Ive created a Tool in VB.Net that first dumps the repository creating lists of Use Case, Activity and Sequence diagrams from the EAExample.eap file

From the sequence diagrams I am trying to get hold of data such as operations and their parent classes so i ran through the DiagramLinks Collection and got hold of the connector data from each as follows

Dim link As EA.DiagramLink
Dim connectr As EA.Connector
Dim elem As EA.Element

For Each link In diag.DiagramLinks
   connectr = Repository.GetConnectorByID(link.ConnectorID)
   elem = Repository.GetElementByID(connectr.SupplierID)
   oWrite.WriteLine(elem.Name + ": " + connectr.Name)
   linkCount += 1
Next

where diag is a sequence diagram (EA.Diagram)

If the objects held within the diagram are instances (as in SE0002 setup sequence diagram) instead of links to the actual class (as in the Create contact sequence diagram) the operations are listed in the DiagramLinks collection and it is possible to get hold of where they are called from. If however its the objects in the diagram are links to the actual class there is no data held in the DiagramLinks Collection.

Does anyone know where this data is stored if the objects are set out in the diagram in this way?

Thanks

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Getting DiagramLinks from Sequence Diagrams
« Reply #1 on: October 03, 2005, 04:18:29 pm »
I haven't had time to test this, but I think for sequence lifelines you need to iterate through the Diagram.DiagramObjects collection, use Repository.GetElementByID(DiagramObject.ElementID) to get the element (which is an instance), and then use Repository.GetElementByID(Element.ClassifierID) to get the instance's classifier.

HTH  :)
The Sparx Team
[email protected]

ttk9

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Getting DiagramLinks from Sequence Diagrams
« Reply #2 on: October 04, 2005, 02:20:37 am »
<EDIT: Problem Fixed>

Managed to get hold of what i needed by getting the Elements from the DiagramObjects as above... then iterating through the connectors associated with this element checking them for
connectr.Type = "Sequence"
and
connectr.DiagramID = diag.DiagramID

This gets hold of all of the connectors i needed from the correct diagrams... even if it is 'going round the house' a bit

<END EDIT>

Problem is that when I iterate through the Diagram.DiagramObjects collection then use Repository.GetElementByID(DiagramObject.ElementID) to get the element it is returning items of type "object" so if i then use this to get the classifier and then try to get an element using this I get an error saying it cant find an element with that ID.

This is using 2 specific sequence diagrams from the EAExample.eap

The SE0002 setup sequence diagram has objects that are of type node, component etc... and links representing all of the operations.... this is fine

The CreateContact Diagram is the one i am interested in though and it returns objects of just type object in the DiagramObjects Collection.... and no links in the DiagramLinks Collection....which isnt of much use

In this diagram how are the operation calls stored? because i cant find them yet they are obviously there on screen...

Any ideas
« Last Edit: October 04, 2005, 08:11:58 am by ttk9 »