diff options
author | Martin Fluegge | 2011-11-26 10:19:50 +0000 |
---|---|---|
committer | Martin Fluegge | 2011-11-26 10:19:50 +0000 |
commit | e3aadde7d7a43135f96730b0f1538f9ee80c4222 (patch) | |
tree | 63a37df585a2a362915a6ebb9689a3b6bcf4950e /plugins/org.eclipse.emf.cdo | |
parent | 48043d13578fe346047829cb64fc20e4a7a6827b (diff) | |
download | cdo-e3aadde7d7a43135f96730b0f1538f9ee80c4222.tar.gz cdo-e3aadde7d7a43135f96730b0f1538f9ee80c4222.tar.xz cdo-e3aadde7d7a43135f96730b0f1538f9ee80c4222.zip |
[352204] [Legacy] Failing event PREPARE in state CLEAN : state machine
issue with legacy mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352204
Diffstat (limited to 'plugins/org.eclipse.emf.cdo')
2 files changed, 34 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java index 9ce6023f2a..3d8e63c43c 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/eresource/impl/CDOResourceImpl.java @@ -1291,6 +1291,12 @@ public class CDOResourceImpl extends CDOResourceLeafImpl implements CDOResource, if (!FSMUtil.isTransient(this)) { InternalCDOObject cdoObject = FSMUtil.adapt(object, cdoView()); + + if (CDOUtil.isLegacyObject(cdoObject) && cdoObject.cdoState() == CDOState.CLEAN) + { + return; + } + attached(cdoObject, cdoView().toTransaction()); } } diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java index 1d165714eb..5d6cdd2489 100644 --- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java +++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java @@ -384,6 +384,7 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper registerWrapper(this); counter.increment(); view.registerObject(this); + revisionToInstanceContainer(); for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(revision.getEClass())) @@ -422,8 +423,13 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper protected void revisionToInstanceContainer() { Object containerID = revision.getContainerID(); + EObject oldContainer = instance.eContainer(); InternalEObject container = getEObjectFromPotentialID(view, null, containerID); - setInstanceContainer(container, revision.getContainingFeatureID()); + + if (oldContainer != container) + { + setInstanceContainer(container, revision.getContainingFeatureID()); + } } /** @@ -541,7 +547,27 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper { if (object != CDORevisionData.NIL) { - instance.eSet(feature, object); + EReference reference = (EReference)feature; + if (reference.isContainment()) + { + if (object != null) + { + // Calling eSet it not the optimal approach, but currently there is no other way to set the value here. + // To avoid attaching already processed (clean) objects a check was introduced to + // CDOResourceImpl.attached(EObject). + // If we find a way to avoid the call of eSet and if we are able to only set the feature value directly + // this check can be removed from CDOResourceImpl. See also Bug 352204. + instance.eSet(feature, object); + } + else + { + instance.eSet(feature, null); + } + } + else + { + instance.eSet(feature, object); + } } else { |