|
|
|
|
|
Re: [CDO] Question about locking [message #1383387 is a reply to message #1376314] |
Mon, 26 May 2014 10:41 |
Laurent Le Moux Messages: 184 Registered: September 2011 |
Senior Member |
|
|
Hi Leonid,
Thanks for the tip ! I try to use setCommittables but then, saving my diagram (resource) fails with the following error message :
!ENTRY org.eclipse.graphiti.ui 0 0 2014-05-26 12:22:57.807
!MESSAGE The following resources could not be saved:
URI: cdo://EntrepriseArchitectureRepository/Application_app1_1400270224492, cause:
org.eclipse.net4j.util.transaction.TransactionException: org.eclipse.emf.cdo.util.CommitException: org.eclipse.net4j.util.transaction.TransactionException: org.eclipse.emf.cdo.util.CommitIntegrityException: The resource of new object CommitInfo@oid1[NEW] needs to be included in the commit but isn't
at org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.save(CDOResourceImpl.java:1236)
I create a CommitInfo element before the saving to store additionnal information (user Id, time stamp and an associated comment).
This element is added to the resource to be saved :
TransactionalEditingDomain ted = editor.getEditingDomain();
CDOResource r = editor.getDiagramTypeProvider().getDiagram().cdoResource();
ted.getCommandStack().execute(new AddCommand(ted, r.getContents(), commitInfo));
Then, for the saving, I make copy of the whole resource content (including the new element) :
TreeIterator<EObject> resourceWholeContent = diagramBehavior.getDiagramTypeProvider().getDiagram().cdoResource().getAllContents();
HashSet<EObject> commitables = new HashSet<EObject>();
while (resourceWholeContent.hasNext())
commitables.add(resourceWholeContent.next());
transaction.setCommittables(commitables);
Set<Resource> res = super.save(editingDomain, saveOptions, monitor);
Any idea why the 'NEW' object is apparently not considered in the same resource as the rest ?
Regards,
Laurent
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02152 seconds