Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFStore] Retaining ID's
[EMFStore] Retaining ID's [message #1385671] Tue, 10 June 2014 08:16 Go to next message
Eclipse UserFriend
Hi,

I have an EMF XMI resource that we have generated with manually set ID's. I wrapped all the EObjects in relevant EMFStore project and imported. This has well, but when I go to export the project, all the ID's I have set are replaced with UUID's.

Is there a way to retain all my ID's in ECP/EMFStore?

Thanks,
Mt Naj.
Re: [EMFStore] Retaining ID's [message #1385775 is a reply to message #1385671] Wed, 11 June 2014 03:39 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

yes, you can use the internal API to set the IDs of you Resource as IDs
for EMFStore. You need to cast ESLocalProject to ESLocalProjectImpl and
then call
ESLocalProjectImpl.toInternalAPI().getProject().allocateModelElementIds(Map<EObject,
ModelElementId>).
Hope this helps!

Cheers,
Maximilian

Am 10.06.2014 14:16, schrieb Mt Naj:
> Hi,
>
> I have an EMF XMI resource that we have generated with manually set
> ID's. I wrapped all the EObjects in relevant EMFStore project and
> imported. This has well, but when I go to export the project, all the
> ID's I have set are replaced with UUID's.
> Is there a way to retain all my ID's in ECP/EMFStore?
>
> Thanks,
> Mt Naj.
>


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Re: [EMFStore] Retaining ID's [message #1450831 is a reply to message #1385775] Wed, 22 October 2014 21:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

I have the exact same problem, but I'm running in the context of an ECPProject.

I used the suggested approach with:
ModelElementId mei = ModelUtil.createModelElementId("999");
eObjectToIdMapping.put(defaultRelationship, mei);

then before calling save:
final ECPProject project = ECPUtil.getECPProjectManager().getProject(baProject);
InternalProvider ecpProvider = (InternalProvider)project.getProvider();
EMFStoreProvider emfProvider = (EMFStoreProvider)ecpProvider.getAdapter(EMFStoreProvider.class);
ESLocalProject projectSpace = emfProvider.getProjectSpace((InternalProject)project);
ESLocalProjectImpl projectSpaceImpl = (ESLocalProjectImpl)projectSpace;
projectSpaceImpl.toInternalAPI().getProject().allocateModelElementIds(eObjectToIdMapping);

Followed by:
project.saveContents();

There are no errors reported but the assigned ID of 999 is replaced by a generated ID at the end.

Are there special considerations that I need to take here?

Thanks
Alain
Re: [EMFStore] Retaining ID's [message #1451213 is a reply to message #1450831] Thu, 23 October 2014 09:45 Go to previous messageGo to next message
Eclipse UserFriend
BTW I got it to work, but I have to make sure the allocateModelElementIds is called before the object is attached to the model.

This greatly impacts the design of the code that I have. Is there a better solution like providing the map and making sure it is updated before attaching objects to the model ?

Thanks
Alain
Re: [EMFStore] Retaining ID's [message #1451326 is a reply to message #1451213] Thu, 23 October 2014 13:14 Go to previous message
Eclipse UserFriend
Hi Alain,

somehow you must pass in a mapping of EObject to ID to the framework if
you wish to use your own IDs. So I see no way to avoid this, but maybe I
do not understand your question.

Cheers,
Maximilian

Am 23.10.2014 15:45, schrieb Alain Picard:
> BTW I got it to work, but I have to make sure the
> allocateModelElementIds is called before the object is attached to the
> model.
>
> This greatly impacts the design of the code that I have. Is there a
> better solution like providing the map and making sure it is updated
> before attaching objects to the model ?
>
> Thanks
> Alain


--
Maximilian Kögel

Get Professional Eclipse Support: http://eclipsesource.com/munich
Previous Topic:[EMFFORMS] Tree and Tree Master Detail View
Next Topic:[EMFForms] ViewModelContextImpl notification exception
Goto Forum:
  


Current Time: Wed Jul 09 23:55:14 EDT 2025

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

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

Back to the top