summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-04-19 23:03:45 (EDT)
committerCaspar De Groot2011-04-19 23:03:45 (EDT)
commit26b1130a7ddb6c42076ba8e09a5be8cf8ed5d92d (patch)
tree79663d8d64537659b6a4a8550320a38cb7b514a1
parent5f43070587ad5be784224fb7fb4ca27950b2cd17 (diff)
downloadcdo-26b1130a7ddb6c42076ba8e09a5be8cf8ed5d92d.zip
cdo-26b1130a7ddb6c42076ba8e09a5be8cf8ed5d92d.tar.gz
cdo-26b1130a7ddb6c42076ba8e09a5be8cf8ed5d92d.tar.bz2
[Bug 341875] Unsetting container ref not working correctly for NEW objects if resolveProxies=true
https://bugs.eclipse.org/bugs/show_bug.cgi?id=341875
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341875_Test.java22
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/object/CDOLegacyWrapper.java47
2 files changed, 39 insertions, 30 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341875_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341875_Test.java
index 26ac1b1..f757ed1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341875_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_341875_Test.java
@@ -29,6 +29,24 @@ public class Bugzilla_341875_Test extends AbstractCDOTest
{
private final model4Factory factory = getModel4Factory();
+ private EReference ref_elToPar = getModel4Package().getSingleContainedElement_Parent();
+
+ private EReference ref_parToEl = getModel4Package().getRefSingleContained_Element();
+
+ @Override
+ protected void doSetUp() throws Exception
+ {
+ ref_parToEl.setResolveProxies(true);
+ super.doSetUp();
+ }
+
+ @Override
+ protected void doTearDown() throws Exception
+ {
+ ref_parToEl.setResolveProxies(false);
+ super.doTearDown();
+ }
+
public void test()
{
SingleContainedElement element = factory.createSingleContainedElement();
@@ -44,10 +62,6 @@ public class Bugzilla_341875_Test extends AbstractCDOTest
assertEquals(CDOState.NEW, CDOUtil.getCDOObject(parent).cdoState());
assertEquals(CDOState.NEW, CDOUtil.getCDOObject(element).cdoState());
- EReference ref_elToPar = getModel4Package().getSingleContainedElement_Parent();
- EReference ref_parToEl = getModel4Package().getRefSingleContained_Element();
- ref_parToEl.setResolveProxies(true);
-
element.eUnset(ref_elToPar);
assertNull(parent.eGet(ref_parToEl));
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 663f356..3a6d975 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
@@ -195,13 +195,6 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
EClass eClass = revision.getEClass();
- CDOStore store = view.getStore();
- InternalEObject eContainer = store.getContainer(this);
- if (eContainer != null && eContainmentFeature().isResolveProxies())
- {
- adjustOppositeReference(this, eContainer, eContainmentFeature());
- }
-
// This loop adjusts the opposite wrapper objects to support dangling references. See Bugzilla_251263_Test
for (EStructuralFeature feature : CDOModelUtil.getAllPersistentFeatures(eClass))
{
@@ -959,25 +952,27 @@ public abstract class CDOLegacyWrapper extends CDOObjectWrapper
return wrapperRegistry.get().containsKey(wrapper.cdoID());
}
- private void adjustOppositeReference(InternalCDOObject cdoObject, EObject oppositeObject, EReference oppositeReference)
- {
- if (oppositeObject != null)
- {
- InternalCDOObject oppositeCDOObject = (InternalCDOObject)CDOUtil.getCDOObject(oppositeObject);
-
- if (!FSMUtil.isTransient(oppositeCDOObject) && !EMFUtil.isPersistent(oppositeReference))
- {
- adjustPersistentOppositeReference(cdoObject, oppositeObject, oppositeReference);
- }
- else
- {
- if (oppositeReference.isResolveProxies())
- {
- adjustTransientOppositeReference(instance, (InternalEObject)oppositeObject, oppositeReference);
- }
- }
- }
- }
+ // TODO: Remove this method if it is ensured that ist is not needed anymore
+ // private void adjustOppositeReference(InternalCDOObject cdoObject, EObject oppositeObject, EReference
+ // oppositeReference)
+ // {
+ // if (oppositeObject != null)
+ // {
+ // InternalCDOObject oppositeCDOObject = (InternalCDOObject)CDOUtil.getCDOObject(oppositeObject);
+ //
+ // if (!FSMUtil.isTransient(oppositeCDOObject) && !EMFUtil.isPersistent(oppositeReference))
+ // {
+ // adjustPersistentOppositeReference(cdoObject, oppositeObject, oppositeReference);
+ // }
+ // else
+ // {
+ // if (oppositeReference.isResolveProxies())
+ // {
+ // adjustTransientOppositeReference(instance, (InternalEObject)oppositeObject, oppositeReference);
+ // }
+ // }
+ // }
+ // }
private void adjustPersistentOppositeReference(InternalCDOObject cdoObject, EObject oppositeObject,
EReference oppositeReference)