IDs of Model Elements

Query 1 - When I create the model elements ( Application Components ) in a ArchiMate diagram using the Open API, I want the components to have the ids that Open API code supplies rather than auto generated ids. Is there any setting where I can specify the id is to be picked up from one supplied via Open API code and only if the one supplied is null or blank then VP to auto generate it.

IArchiMateApplicationComponent appComponent = IModelElementFactory.instance().createArchiMateApplicationComponent();

appComponent.setUserID("123456789") 
appComponent.setName("Some Name")
appComponent.setDescription("Some Description")

IArchiMateApplicationComponentUIModel shapeArchiComponent = (IArchiMateApplicationComponentUIModel) diagramManager.createDiagramElement(archiMate, appComponent);
shapeArchiComponent.setSize(200, 80);
shapeArchiComponent.resetCaption();

archiMateDiagram.addDiagramElement( shapeArchiComponent );

My ids are getting picked up sometimes ( when I start with a complete new project for example ) and sometimes its giving them auto generated ids. I am adding the components in a local project, so there are no duplicates here right now.

Query 2 - Another query is how do I pick up the logged in VP user name via Open API

Query 3 - How do I programmatically give a Organic Layout to the diagram via Open API

Many thanks for the help.

Query 1:
ModelElement has 2 id properties: id and userID

  • id is not editable
  • userID is editable. You may enter your userID as your above appComponent.setUserID("123456789").

But, by default, Application Component won’t support userID.
You need to enable it via Project Options, as following:

Query 2:
It is newly supported in these few weeks, please reference to following post:

Query 3:
You may call:
DiagramManager.layout(diagram, DiagramManager.LAYOUT_ORGANIC)

I don’t see these in the version Version 16.1 (Build 20200430bi) - although they seem to have been introduced in 2019 as per the thread

ApplicationManager.instance().isLoggedIn()
ApplicationManager.instance().getLoggedInUserName() // return the name
ApplicationManager.instance().getLoggedInEmail() // return the email

about Query 2,
Please update the software to latest patch build (20190530ap or later) to get the enhancement.