Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Requirements Modeling Framework  » Setting Identifier of Elements
Setting Identifier of Elements [message #1650256] Wed, 04 March 2015 18:51 Go to next message
Arne Noyer is currently offline Arne NoyerFriend
Messages: 3
Registered: March 2015
Junior Member
Hello!

I have just upgraded to version 0.11 and observed, that the behavior of dealing with identifiers has changed. I used to manually set identifiers for SpecObjects, SpecTypes and other elements. Is this still possible?
In my observation, it results in some problems.

Consider the following code:

SpecObjectType result = ReqIF10Factory.eINSTANCE.createSpecObjectType();
result.setIdentifier("myIdentifier");

// New identifier will be assigned automatically
documentRoot.getCoreContent().getSpecTypes().add(result);
String newRandomIdentifier = result.getIdentifier();

// It's ok, the Identifier can still be set later
result.setIdentifier("myIdentifier");


When adding an element, like a SpecObjectType to a parent, it results in automatically setting a new identifier now. After observing this, i thought i will just change my code to set the identifier after adding an element to a parent.
It looked fine at first glance and the identifier attribute of the object was never changed later.
But when creating references from other elements to the object, for instance a reference from a SpecObject to the SpecObjectType above, it results in errors when persisting the model to a XMI file.

Inside the XMI file, in the example above the SpecObjectType will be persisted with the correct identifier="myIdentifier", but all the elements who have a reference to it, still use the identifier for the reference as it is automatically created. Setting the identifier does not affect this at all.
The same seems to apply to other element as well.

...
<SPEC-OBJECT-TYPE IDENTIFIER="myIdentifier" ...>
...

<SPEC-OBJECT>
  <TYPE>
     <SPEC-OBJECT-TYPE-REF> "randomIdentifier" </SPEC-OBJECT-TYPE-REF>
  </TYPE>
</SPEC-OBJECT>




The question to this topic is: Is this behavior intended or is this a bug?
Is it not possible anymore to set my own identifiers by using the setIdentifier() operations?

Thank you very much for your help in advance!

Best regards,

Arne
Re: Setting Identifier of Elements [message #1651311 is a reply to message #1650256] Thu, 05 March 2015 08:22 Go to previous messageGo to next message
Michael Jastram is currently offline Michael JastramFriend
Messages: 235
Registered: April 2010
Location: Düsseldorf, Germany
Senior Member
Hi Arne,

The short answer: This is intended behavior, we now take advantage of EMF keeping an index of all IDs, for lookups and other operations. Also, IDs are assigned when an element is added to the model. In case of duplicates, the new ID is changed (this is highly useful for multiple paste operations).

As far as the details are concerned, I am not the expert on this. Mark and Hussein know more about it. I am not sure whether they read the forum. As this is a developer question, can you please repost it to the dev list (rmf-dev@eclipse.org)?

This should get you started - good luck!

- Michael
Re: Setting Identifier of Elements [message #1651439 is a reply to message #1651311] Thu, 05 March 2015 09:52 Go to previous messageGo to next message
Arne Noyer is currently offline Arne NoyerFriend
Messages: 3
Registered: March 2015
Junior Member
Thank you very much for the information and quick reply, Michael!

As you suggested, i will continue with the discussion in the dev list.
Re: Setting Identifier of Elements [message #1651440 is a reply to message #1651311] Thu, 05 March 2015 09:52 Go to previous message
Arne Noyer is currently offline Arne NoyerFriend
Messages: 3
Registered: March 2015
Junior Member
No Message Body

[Updated on: Thu, 05 March 2015 09:53]

Report message to a moderator

Previous Topic:Changes to HTML Export
Next Topic:Xtext extension to ProR editor
Goto Forum:
  


Current Time: Tue Apr 23 09:56:04 GMT 2024

Powered by FUDForum. Page generated in 0.04452 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top