What is differnce between getId() and getUserId() of an IUseCase object


#1

Hi guys,
can you explain me what is difference between methods getId() and getUserId() of a model element like an IUseCase object ? and also what is scope of uniqueness of them ? i mean they should be unique in scope of their Diagram,Project , or even all existing Project of vp inside work space ?


#2

Neither of those methods originate in the model element itself. getUserID() is provided through the IHasChildrenBaseModelElement interface (what a name :smiley: ) whereas getID() is provided by the IModelElement interface.

Now, this comment is only based on the Javadoc (I’ll probably follow up, I got curious as well just now) but from what I know getID() is used to get a unique identifies for the model element you’re working on (and from what I can tell it is quite unique) whereas getUserID() seems more aimed at identifying relationships between elements.

From my experience getID() should give you a unique identifier for within the scope of the project. I can’t fully comment on getUserID() until I’ve done some studies myself :wink:

Hope this can still help you a bit.


#3

Just a supplementary information on the getID() and getUserID(). The getID() is to obtain the internal ID of the model element. The internal ID is issued when the model element being create. It cannot be modified or reassign.

The getUserID() is to obtain the user specified ID from the model element. By default not all model elements will have the user specified ID. User can configure the User ID Generator to specify how the ID being generated and covering which model types under Window > Project Options > Diagramming > Model Generation. More details about how the custom ID works can be found at https://www.youtube.com/watch?v=2riEB5BHslk


#4

Thank you guys :ok_hand: