Book a Demo

Author Topic: How Find ojects in Diagram  (Read 14475 times)

dangel

  • EA User
  • **
  • Posts: 74
  • Karma: +0/-0
    • View Profile
How Find ojects in Diagram
« on: December 16, 2014, 06:41:39 am »
How can I find all objects of Class or objects of type Use Case in a specific diagram {Diagram_abc} using API ?

Regards

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How Find ojects in Diagram
« Reply #1 on: December 16, 2014, 10:08:09 am »
Wrong thread, but anyhow:
Code: [Select]
for diaObj in Diagram. DiagramObjects {
  obj = Repository.GetElementById(diaObj.ElementD)
  if obj.type == "Object" and obj.ClassifierID = mainClass.ElementID {...}
}

q.
« Last Edit: December 16, 2014, 10:10:06 am by qwerty »

dangel

  • EA User
  • **
  • Posts: 74
  • Karma: +0/-0
    • View Profile
Re: How Find ojects in Diagram
« Reply #2 on: December 16, 2014, 10:50:56 pm »
Thank you,

Just a question, I am using SQL Query much more than API, is this good,
I am working on multiple relations and objects to analyze diagrams and its properties into C#-DataGrid,,, do you recommend me on this way ?
or move to use pure-API ?

Regards,

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: How Find ojects in Diagram
« Reply #3 on: December 16, 2014, 11:09:44 pm »
Like everything it depends. Most operations on the database are rather save since the API layer is rather thin. But when it comes to stereotypes (or a few other things I can't recall) you should stick to the API unless you know exactly what you're doing. But either way: test on sandboxes. Backup regularly.

q.

dangel

  • EA User
  • **
  • Posts: 74
  • Karma: +0/-0
    • View Profile
Re: How Find ojects in Diagram
« Reply #4 on: December 17, 2014, 08:14:37 am »
Thank you very much

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 Find ojects in Diagram
« Reply #5 on: December 17, 2014, 07:14:42 pm »
Quote
Thank you,

Just a question, I am using SQL Query much more than API, is this good,
I am working on multiple relations and objects to analyze diagrams and its properties into C#-DataGrid,,, do you recommend me on this way ?
or move to use pure-API ?

Regards,
Use the API as much as possible. But keep in mind that iterating anything in EA is very slow.
So for find things SQL is usually the best option. Once you have the ID you can instantiate the object you need using Repository.Get<xxx>ByID

Geert

dangel

  • EA User
  • **
  • Posts: 74
  • Karma: +0/-0
    • View Profile
Re: How Find ojects in Diagram
« Reply #6 on: December 30, 2014, 03:49:58 am »
Great  :)