Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » UUID with no resource available?
UUID with no resource available? [message #425488] Thu, 27 November 2008 12:36 Go to next message
Eclipse UserFriend
Originally posted by: florianwendland.freenet.de

Hello,

i have a question concerning the global element identification of Ecore
elements. I know, that XMIResource had to be subclassed and the method
useUUID():true had to be implemented. Afterwards, i can access the id via
eObject.eResource().getURIFragment(eObject). So far so good.
But how to get the UUID from the element before the serialization? Image, i
creat my model programmatically, there is no resource a priori, that i can
query to get the UUID. The methods EcoreUtil.generateUUID() doesn't fit this
requirement too, because the one generated differs from the one after the
serialization.
Is it possible to access the UUID of an element without being serialized?

Thank you in advance
Florian
Re: UUID with no resource available? [message #425494 is a reply to message #425488] Thu, 27 November 2008 22:00 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Florian,

Comments below.

Marc-Florian Wendland wrote:
> Hello,
>
> i have a question concerning the global element identification of Ecore
> elements. I know, that XMIResource had to be subclassed and the method
> useUUID():true had to be implemented. Afterwards, i can access the id via
> eObject.eResource().getURIFragment(eObject). So far so good.
> But how to get the UUID from the element before the serialization?
The UUID is computed when the object is attached to the resource
directly via the Resource.getContents() indirectly when added to a
container that's in the resource.
> Image, i
> creat my model programmatically, there is no resource a priori, that i can
> query to get the UUID.
When there's no resource, there's no associated UUID.
> The methods EcoreUtil.generateUUID() doesn't fit this
> requirement too, because the one generated differs from the one after the
> serialization.
> Is it possible to access the UUID of an element without being serialized?
>
Yes, but it's not possible without there being a containing resource
because the resource maintains the extrinsic ID to EObject map and
EObject to extrinsic ID map.
> Thank you in advance
> Florian
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Some questions about EMF.genmodel properties
Next Topic:[CDO]Model update
Goto Forum:
  


Current Time: Fri Apr 26 11:54:17 GMT 2024

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

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

Back to the top