Book a Demo

Author Topic: Generate a BPMN Diagram into an Archimate element  (Read 7672 times)

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Generate a BPMN Diagram into an Archimate element
« on: August 23, 2016, 08:41:18 pm »
Hi,

I have two C# addins that read a database and generate an Archimate Diagram and a BPMN Diagram.
Now I want to link this two generated diagrams, but I don't know how to do this programatically.
I have two options, generate the BPMN diagram into an Archimate Business Process element directly through my addin or generate the two diagrams independently and then link the BPMN one with the corresponding element of the Archimate Diagram.

I suppose the the answer will be near the "Composite Structure Diagram" option, but i don't know how to generate this kind of diagrams or how to link them to a specific element.

Any tips?

« Last Edit: August 23, 2016, 08:58:10 pm by rmartinezb »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #1 on: August 23, 2016, 09:21:36 pm »
The composite element has set t_object.NType = 8 and the composite diagram is stored in t_xref with
Name = DefaultDiagram
Type = element property
Client = guid of composite element
Supplier = guid of composite diagram

You will need SQL to create those. AFAIK there is no API for this.

q.

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #2 on: August 23, 2016, 09:45:19 pm »
Thank you very much qwerty, but I have never before worked directly with the EA database and i fear break something. Can you show me some little example of how to create this kind of diagram?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #3 on: August 23, 2016, 11:19:34 pm »
Hmm. It's a bit like giving you an unsecured weapon telling "don't pull the trigger". I would recommend to first accommodate a bit with the database before trying to go that deep.

Basically it's like
Code: [Select]
Repository.Execute("UPDATE t_object SET ntype=8 WHERE object_id=<elementId>") to set "is composite" flag. And
Code: [Select]
Repository.Execute("INSERT INTO t_xref (,,,,)") with all the fields/values from my post above. You need to create an arbitrary guid for the primary key in t_xref. AND: only try that at home first, not at work xD

q.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #4 on: August 24, 2016, 06:45:42 am »
I've created child diagrams for elements using API in javascript so I think rather than hack the database using the API from C# would be safer.
That being said you should use the method AddNew("Diagram Name","Diagram Type") from the diagrams collection of the element.
See this link for more detail
http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/collection.html

An example in javascript
Code: [Select]
...
var theElement as EA.Element;
var motivationDiagram as EA.Diagram;
...
motivationDiagram = theElement.Diagrams.AddNew( theElement.Name + " Motivation", "Motivation Diagram" );
motivationDiagram.Notes = "The diagram above shows the motivation for the workpackage " + theElement.Name;
motivationDiagram.Update();
...

Note the diagram type "Motivation Diagram" is from my custom EA MDG incase you were wondering.
Hope that helps
 :)
« Last Edit: August 24, 2016, 06:50:34 am by Sunshine »
Happy to help
:)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #5 on: August 24, 2016, 09:00:38 am »
For just adding a diagram that is ok, but it does not make it composite.

q.

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #6 on: August 24, 2016, 04:38:22 pm »
Thanks again qwerty, i'll follow your advice and I going to practice with simpler examples before trying that.

Greetings

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Generate a BPMN Diagram into an Archimate element
« Reply #7 on: August 24, 2016, 05:43:28 pm »
Since not too long ago there is an operation EA.Element.SetCompositeDiagram() that you can use instead of the hacky SQL updates.

Geert

rmartinezb

  • EA User
  • **
  • Posts: 44
  • Karma: +1/-0
    • View Profile
Re: Generate a BPMN Diagram into an Archimate element
« Reply #8 on: August 24, 2016, 06:54:43 pm »
That exactly what I need, I've done some tests and works perfectly, thanks Geert.