UUID with no resource available? [message #425488] |
Thu, 27 November 2008 12:36 |
Eclipse User |
|
|
|
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02807 seconds