Two methods provide an identifier of an com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element. Either method can be used depending on the situation. This section explains the difference between the two:
The meaning of the returned identifiers depends on the project type.
Both methods return the same identifier, which is permanent and unique in the scope of the project. In most cases, this ID is unique among different projects, unless you create a copy of the project by copying the file or using the Save As command.
|
If a local project is added to the Teamwork Cloud (or vice versa), getLocalID() consistently returns the same identifier value. Note that several elements with the same local ID may exist in the scope of a single TWC project.
getID() returns UUID, which is unique both in the project and in the scope of the whole TWC server repository.
The Teamwork Cloud imports (clones) the contents of used projects. This means copies of the elements are created inside the project. While getLocalID() returns the same value for different copies, getID() will return a unique value for each copy (project usage).
If a project A is copied as a project A1, and a TWC project B uses both A and A1, getLocalID() returns the same value for corresponding elements of A and A1, but getID() returns different identifiers for the same elements. |
Both identifiers can be used to retrieve the element using the method com.nomagic.magicdraw.core.Project.getElementByID(java.lang.String). Be aware that if several elements exist in the project by the provided local ID, only a single one of them is returned. |