Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon McDuff2008-11-09 16:00:54 -0500
committerSimon McDuff2008-11-09 16:00:54 -0500
commita2bbfece55533fa3ea41698b60923d72d9fed4f6 (patch)
treead31e90788dced9fe636b0b37780a0732f60bb92
parent5565dc604f87abcdda90faab90d40077c6d1feb9 (diff)
downloadcdo-a2bbfece55533fa3ea41698b60923d72d9fed4f6.tar.gz
cdo-a2bbfece55533fa3ea41698b60923d72d9fed4f6.tar.xz
cdo-a2bbfece55533fa3ea41698b60923d72d9fed4f6.zip
[249436] Support FeatureMap
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249436
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjustable.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjuster.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java50
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java47
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOList.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model4/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model4interfaces/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IModelConfig.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ModelConfig.java14
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java30
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java130
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java1
25 files changed, 398 insertions, 95 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
index 57e617ed65..d12d6eae02 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/CDOType.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.common.model;
import org.eclipse.emf.cdo.common.CDODataInput;
import org.eclipse.emf.cdo.common.CDODataOutput;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
import java.io.IOException;
@@ -61,6 +62,11 @@ public interface CDOType
public static final CDOType BYTE_ARRAY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.BYTE_ARRAY;
+ /**
+ * @since 2.0
+ */
+ public static final CDOType FEATURE_MAP_ENTRY = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.FEATURE_MAP_ENTRY;
+
public static final CDOType CUSTOM = org.eclipse.emf.cdo.internal.common.model.CDOTypeImpl.CUSTOM;
public String getName();
@@ -76,6 +82,11 @@ public interface CDOType
/**
* @since 2.0
*/
+ public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value);
+
+ /**
+ * @since 2.0
+ */
public Object readValue(CDODataInput in) throws IOException;
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java
new file mode 100644
index 0000000000..288fdea596
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/model/core/CDOFeatureMapEntryDataType.java
@@ -0,0 +1,23 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.model.core;
+
+/**
+ * @author Simon McDuff
+ * @noimplement This interface is not intended to be implemented by clients.
+ * @since 2.0
+ */
+public interface CDOFeatureMapEntryDataType
+{
+ public String getURI();
+
+ public Object getObject();
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjustable.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjustable.java
new file mode 100644
index 0000000000..298a4f0b2a
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjustable.java
@@ -0,0 +1,20 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.common.revision;
+
+/**
+ * @author Simon McDuff
+ * @since 2.0
+ */
+public interface CDOReferenceAdjustable
+{
+ public void adjustReferences(CDOReferenceAdjuster revisionAdjuster);
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjuster.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjuster.java
index eeae50c416..80a812f4ff 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjuster.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDOReferenceAdjuster.java
@@ -20,10 +20,10 @@ import org.eclipse.emf.cdo.common.id.CDOIDTemp;
public interface CDOReferenceAdjuster
{
/**
- * Adjust internal structure of an object (e.g: {@link CDORevision}). This is mainly use after committing a
- * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapping ID.
+ * Adjusts the internal structure of an object (e.g: {@link CDORevision}). This is mainly used after committing a
+ * transaction. {@link CDORevision} must replace {@link CDOIDTemp} for non-temporary {@link CDOID} with a mapped ID.
* Only the internal structure knows how to do these modifications. This is important to consider using different
* implementation of {@link CDOList}.
*/
- Object adjustReference(Object id);
+ public Object adjustReference(Object id);
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
index 56042f6072..320df8e5b1 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/revision/CDORevisionUtil.java
@@ -13,6 +13,8 @@ package org.eclipse.emf.cdo.common.revision;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.id.CDOIDTemp;
import org.eclipse.emf.cdo.common.model.CDOClass;
+import org.eclipse.emf.cdo.common.model.core.CDOFeatureMapEntryDataType;
+import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl;
import java.util.Map;
@@ -36,6 +38,14 @@ public final class CDORevisionUtil
return new CDORevisionImpl(cdoClass, id);
}
+ /**
+ * @since 2.0
+ */
+ public static CDOFeatureMapEntryDataType createFeatureMapEntry(String uri, Object value)
+ {
+ return new CDOFeatureMapEntryDataTypeImpl(uri, value);
+ }
+
public static CDORevision copy(CDORevision source)
{
return new CDORevisionImpl((CDORevisionImpl)source);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
index 87354c9b98..87ecc954f0 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/CDOTypeImpl.java
@@ -14,6 +14,8 @@ import org.eclipse.emf.cdo.common.CDODataInput;
import org.eclipse.emf.cdo.common.CDODataOutput;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOType;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import java.io.IOException;
import java.util.Date;
@@ -166,6 +168,12 @@ public abstract class CDOTypeImpl implements CDOType
{
return in.readCDOID();
}
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ {
+ return adjuster.adjustReference(value);
+ }
};
public static final CDOType BOOLEAN_OBJECT = new ObjectType("BOOLEAN_OBJECT", 23)
@@ -350,6 +358,38 @@ public abstract class CDOTypeImpl implements CDOType
}
};
+ public static final CDOType FEATURE_MAP_ENTRY = new CDOTypeImpl("FEATURE_MAP_ENTRY", 36, false)
+ {
+ @Override
+ public Object copyValue(Object value)
+ {
+ return value;
+ }
+
+ public void writeValue(CDODataOutput out, Object value) throws IOException
+ {
+ CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
+ out.writeString(featureMapEntry.getURI());
+ out.writeCDOID(out.getIDProvider().provideCDOID(featureMapEntry.getObject()));
+ }
+
+ public Object readValue(CDODataInput in) throws IOException
+ {
+ String uri = in.readString();
+ Object id = in.readCDOID();
+ return new CDOFeatureMapEntryDataTypeImpl(uri, id);
+ }
+
+ @Override
+ public Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ {
+ CDOFeatureMapEntryDataTypeImpl featureMapEntry = (CDOFeatureMapEntryDataTypeImpl)value;
+ featureMapEntry.adjustReferences(adjuster);
+ return value;
+ }
+
+ };
+
public static final CDOType CUSTOM = new CDOTypeImpl("CUSTOM", 999, true)
{
@SuppressWarnings("cast")
@@ -428,6 +468,16 @@ public abstract class CDOTypeImpl implements CDOType
out.writeInt(typeID);
}
+ final public Object adjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ {
+ return value == null ? null : doAdjustReferences(adjuster, value);
+ }
+
+ protected Object doAdjustReferences(CDOReferenceAdjuster adjuster, Object value)
+ {
+ return value;
+ }
+
/**
* @author Eike Stepper
*/
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java
new file mode 100644
index 0000000000..4283037764
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/model/core/CDOFeatureMapEntryDataTypeImpl.java
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.internal.common.model.core;
+
+import org.eclipse.emf.cdo.common.model.core.CDOFeatureMapEntryDataType;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjustable;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+
+/**
+ * @author Simon McDuff
+ */
+public class CDOFeatureMapEntryDataTypeImpl implements CDOFeatureMapEntryDataType, CDOReferenceAdjustable
+{
+ private String uri;
+
+ private Object object;
+
+ public CDOFeatureMapEntryDataTypeImpl(String uri, Object object)
+ {
+ this.uri = uri;
+ this.object = object;
+ }
+
+ public Object getObject()
+ {
+ return object;
+ }
+
+ public String getURI()
+ {
+ return uri;
+ }
+
+ public void adjustReferences(CDOReferenceAdjuster revisionAdjuster)
+ {
+ object = revisionAdjuster.adjustReference(object);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
index 023cf7a59f..fd9d02e66d 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDOListImpl.java
@@ -61,14 +61,14 @@ public class CDOListImpl extends MoveableArrayList<Object> implements InternalCD
return super.get(index);
}
- public void adjustReferences(CDOReferenceAdjuster revisionAdjuster)
+ public void adjustReferences(CDOReferenceAdjuster revisionAdjuster, CDOType type)
{
int size = size();
for (int i = 0; i < size; i++)
{
Object element = super.get(i);
handleAdjustReference(i, element);
- Object newID = revisionAdjuster.adjustReference(element);
+ Object newID = type.adjustReferences(revisionAdjuster, element);
if (newID != element)
{
super.set(i, newID);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
index 6ea1b6b5cb..34b367c456 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java
@@ -474,12 +474,12 @@ public class CDORevisionImpl implements InternalCDORevision
InternalCDOList list = (InternalCDOList)getValueAsList(i);
if (list != null)
{
- list.adjustReferences(revisionAdjuster);
+ list.adjustReferences(revisionAdjuster, feature.getType());
}
}
else
{
- values[i] = revisionAdjuster.adjustReference(values[i]);
+ values[i] = feature.getType().adjustReferences(revisionAdjuster, values[i]);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOList.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOList.java
index e188b0b4fc..3deeb57374 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOList.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDOList.java
@@ -23,7 +23,7 @@ public interface InternalCDOList extends CDOList
/**
* Adjusts references according to the passed adjuster and resynchronizes indexes.
*/
- public void adjustReferences(CDOReferenceAdjuster adjuster);
+ public void adjustReferences(CDOReferenceAdjuster adjuster, CDOType type);
/**
* Clones the list.
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java
index 6d345c4eca..fc8a25438c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/spi/common/InternalCDORevision.java
@@ -14,7 +14,7 @@ package org.eclipse.emf.cdo.spi.common;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.revision.CDOList;
-import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjuster;
+import org.eclipse.emf.cdo.common.revision.CDOReferenceAdjustable;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
@@ -22,7 +22,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
/**
* @author Eike Stepper
*/
-public interface InternalCDORevision extends CDORevision, CDORevisionData
+public interface InternalCDORevision extends CDORevision, CDORevisionData, CDOReferenceAdjustable
{
public static final Object UNINITIALIZED = CDORevisionUtil.UNINITIALIZED;
@@ -59,11 +59,6 @@ public interface InternalCDORevision extends CDORevision, CDORevisionData
public void unset(CDOFeature feature);
- /**
- * @since 2.0
- */
- public void adjustReferences(CDOReferenceAdjuster revisionAdjuster);
-
public Object getValue(CDOFeature feature);
public Object setValue(CDOFeature feature, Object value);
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
index a15147667a..dedf8814dd 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/tuplizer/WrappedHibernateList.java
@@ -85,13 +85,13 @@ public class WrappedHibernateList implements InternalCDOList
}
}
- public void adjustReferences(CDOReferenceAdjuster adjuster)
+ public void adjustReferences(CDOReferenceAdjuster adjuster, CDOType type)
{
int size = size();
for (int i = 0; i < size; i++)
{
Object element = get(i);
- Object newID = adjuster.adjustReference(element);
+ Object newID = type.adjustReferences(adjuster, element);
if (newID != element)
{
set(i, newID);
diff --git a/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF
index 5dbd3dba21..8086833288 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.model3/META-INF/MANIFEST.MF
@@ -5,7 +5,6 @@ Bundle-Version: 2.0.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
diff --git a/plugins/org.eclipse.emf.cdo.tests.model4/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model4/META-INF/MANIFEST.MF
index 0ac65f9de2..d85a28d2f5 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model4/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.model4/META-INF/MANIFEST.MF
@@ -14,4 +14,3 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.tests.model4interfaces;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
-Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.tests.model4interfaces/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests.model4interfaces/META-INF/MANIFEST.MF
index 2605d90066..0886a5677b 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model4interfaces/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests.model4interfaces/META-INF/MANIFEST.MF
@@ -16,4 +16,3 @@ Export-Package: org.eclipse.emf.cdo.tests.legacy.model4interfaces;version="2.0.0
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.4.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
-Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index a869f86ddd..0e40c3e272 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -25,6 +25,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.tests.model3;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.tests.model4;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.tests.model4interfaces;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.emf.cdo.tests.model5;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.junit;bundle-version="[3.8.0,4.0.0)";visibility:=reexport
Export-Package: base;version="2.0.0",
base.impl;version="2.0.0",
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
index d4f84abfdc..fbf4d509a1 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllTestsAllConfigs.java
@@ -42,6 +42,7 @@ public abstract class AllTestsAllConfigs extends ConfigTestSuite
@Override
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
{
+
// General
testClasses.add(InitialTest.class);
testClasses.add(ComplexTest.class);
@@ -74,6 +75,7 @@ public abstract class AllTestsAllConfigs extends ConfigTestSuite
testClasses.add(TransactionHandlerTest.class);
testClasses.add(RepositoryTest.class);
testClasses.add(LockingManagerTest.class);
+ testClasses.add(MultiValuedOfAttributeTest.class);
// Specific for MEMStore
testClasses.add(MEMStoreQueryTest.class);
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java
new file mode 100644
index 0000000000..bc73d95db2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/MultiValuedOfAttributeTest.java
@@ -0,0 +1,96 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2008 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Simon McDuff - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.tests;
+
+import org.eclipse.emf.cdo.CDOSession;
+import org.eclipse.emf.cdo.CDOTransaction;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.tests.model5.Doctor;
+import org.eclipse.emf.cdo.tests.model5.GenListOfString;
+import org.eclipse.emf.cdo.tests.model5.TestFeatureMap;
+
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public class MultiValuedOfAttributeTest extends AbstractCDOTest
+{
+ public void testFeatureMaps() throws Exception
+ {
+ {
+ CDOSession session = openSession(getModel5Package());
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/res1");
+
+ TestFeatureMap featureMap = getModel5Factory().createTestFeatureMap();
+
+ Doctor doctor1 = getModel5Factory().createDoctor();
+ Doctor doctor2 = getModel5Factory().createDoctor();
+ resource.getContents().add(doctor1);
+ resource.getContents().add(doctor2);
+
+ featureMap.getPeople().add(getModel5Package().getTestFeatureMap_Doctors(), doctor1);
+ featureMap.getPeople().add(getModel5Package().getTestFeatureMap_Doctors(), doctor2);
+
+ resource.getContents().add(featureMap);
+
+ assertEquals(doctor1, featureMap.getPeople().get(0).getValue());
+ List<?> listForFeatureCustomers = (List<?>)featureMap.getPeople().get(
+ getModel5Package().getTestFeatureMap_Doctors(), true);
+ assertEquals(doctor1, listForFeatureCustomers.get(0));
+ assertEquals(doctor2, listForFeatureCustomers.get(1));
+ transaction.commit();
+ System.out.println(featureMap.eContents());
+ }
+
+ clearCache(getRepository().getRevisionManager());
+
+ CDOSession session = openSession(getModel5Package());
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource("/res1");
+
+ TestFeatureMap featureMap = (TestFeatureMap)resource.getContents().get(0);
+ List<?> listForFeatureCustomers = (List<?>)featureMap.getPeople().get(
+ getModel5Package().getTestFeatureMap_Doctors(), true);
+ assertTrue(listForFeatureCustomers.get(0) instanceof Doctor);
+ assertTrue(listForFeatureCustomers.get(1) instanceof Doctor);
+ }
+
+ public void testListOfString() throws Exception
+ {
+ {
+ CDOSession session = openSession(getModel5Package());
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource("/res1");
+
+ GenListOfString listOfString = getModel5Factory().createGenListOfString();
+
+ listOfString.getElements().add("Ottawa");
+ listOfString.getElements().add("Toronto");
+ resource.getContents().add(listOfString);
+ transaction.commit();
+ }
+
+ clearCache(getRepository().getRevisionManager());
+
+ CDOSession session = openSession(getModel5Package());
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.getResource("/res1");
+
+ GenListOfString listOfString = (GenListOfString)resource.getContents().get(0);
+ assertEquals("Ottawa", listOfString.getElements().get(0));
+ assertEquals("Toronto", listOfString.getElements().get(1));
+
+ listOfString.getElements().add("Vancouver");
+ transaction.commit();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IModelConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IModelConfig.java
index f44ed6e5c2..8a1455de93 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IModelConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/IModelConfig.java
@@ -21,6 +21,8 @@ import org.eclipse.emf.cdo.tests.model3.Model3Package;
import org.eclipse.emf.cdo.tests.model4.model4Factory;
import org.eclipse.emf.cdo.tests.model4.model4Package;
import org.eclipse.emf.cdo.tests.model4interfaces.model4interfacesPackage;
+import org.eclipse.emf.cdo.tests.model5.Model5Factory;
+import org.eclipse.emf.cdo.tests.model5.Model5Package;
/**
* @author Eike Stepper
@@ -48,4 +50,8 @@ public interface IModelConfig extends IConfig
public model4Package getModel4Package();
public model4interfacesPackage getModel4InterfacesPackage();
+
+ public Model5Factory getModel5Factory();
+
+ public Model5Package getModel5Package();
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
index 9807c6d72b..4ced9fe5cc 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ConfigTest.java
@@ -31,6 +31,8 @@ import org.eclipse.emf.cdo.tests.model3.Model3Package;
import org.eclipse.emf.cdo.tests.model4.model4Factory;
import org.eclipse.emf.cdo.tests.model4.model4Package;
import org.eclipse.emf.cdo.tests.model4interfaces.model4interfacesPackage;
+import org.eclipse.emf.cdo.tests.model5.Model5Factory;
+import org.eclipse.emf.cdo.tests.model5.Model5Package;
import org.eclipse.net4j.acceptor.IAcceptor;
import org.eclipse.net4j.connector.IConnector;
@@ -410,6 +412,22 @@ public abstract class ConfigTest extends AbstractOMTest implements IConstants
return getModelConfig().getModel4InterfacesPackage();
}
+ /**
+ *@category Model
+ */
+ public Model5Factory getModel5Factory()
+ {
+ return getModelConfig().getModel5Factory();
+ }
+
+ /**
+ *@category Model
+ */
+ public Model5Package getModel5Package()
+ {
+ return getModelConfig().getModel5Package();
+ }
+
// /////////////////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////////////////
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ModelConfig.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ModelConfig.java
index 78f0f2e77c..d0eb2bbc6f 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ModelConfig.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/config/impl/ModelConfig.java
@@ -22,6 +22,8 @@ import org.eclipse.emf.cdo.tests.model3.Model3Package;
import org.eclipse.emf.cdo.tests.model4.model4Factory;
import org.eclipse.emf.cdo.tests.model4.model4Package;
import org.eclipse.emf.cdo.tests.model4interfaces.model4interfacesPackage;
+import org.eclipse.emf.cdo.tests.model5.Model5Factory;
+import org.eclipse.emf.cdo.tests.model5.Model5Package;
/**
* @author Eike Stepper
@@ -101,7 +103,6 @@ public abstract class ModelConfig extends Config implements IModelConfig
public model4Package getModel4Package()
{
-
return org.eclipse.emf.cdo.tests.model4.model4Package.eINSTANCE;
}
@@ -109,6 +110,17 @@ public abstract class ModelConfig extends Config implements IModelConfig
{
return org.eclipse.emf.cdo.tests.model4interfaces.model4interfacesPackage.eINSTANCE;
}
+
+ public Model5Factory getModel5Factory()
+ {
+ return org.eclipse.emf.cdo.tests.model5.Model5Factory.eINSTANCE;
+ }
+
+ public Model5Package getModel5Package()
+ {
+
+ return org.eclipse.emf.cdo.tests.model5.Model5Package.eINSTANCE;
+ }
}
// TODO LEGACY
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
index 61b7e3a735..5ac55f845b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectImpl.java
@@ -17,7 +17,6 @@ import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOClass;
import org.eclipse.emf.cdo.common.model.CDOFeature;
-import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
@@ -26,7 +25,6 @@ import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
-import org.eclipse.emf.internal.cdo.util.GenUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
import org.eclipse.net4j.util.ImplementationError;
@@ -44,7 +42,6 @@ import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -57,7 +54,6 @@ import org.eclipse.emf.ecore.resource.Resource.Internal;
import org.eclipse.emf.ecore.util.DelegatingFeatureMap;
import org.eclipse.emf.ecore.util.EcoreEList;
import org.eclipse.emf.ecore.util.EcoreEMap;
-import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
@@ -349,6 +345,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
setting = eFeature.getDefaultValue();
}
+ CDOStore cdoStore = cdoStore();
if (cdoFeature.isMany())
{
if (setting != null)
@@ -357,33 +354,14 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
EList<Object> list = (EList<Object>)setting;
for (Object value : list)
{
- if (cdoFeature.isReference())
- {
- value = view.convertObjectToID(value, true);
- }
-
+ value = cdoStore.convertToCDO(cdoView(), eFeature, cdoFeature, value);
revision.add(cdoFeature, index++, value);
}
}
}
else
{
- if (cdoFeature.isReference())
- {
- setting = view.convertObjectToID(setting, true);
- }
- else
- {
- if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- setting = EcoreUtil.convertToString((EDataType)eFeature.getEType(), setting);
- }
- else if (setting == null && GenUtil.isPrimitiveType(eFeature.getEType()))
- {
- setting = eFeature.getDefaultValue();
- }
- }
-
+ setting = cdoStore.convertToCDO(cdoView(), eFeature, cdoFeature, setting);
revision.set(cdoFeature, 0, setting);
}
}
@@ -400,7 +378,7 @@ public class CDOObjectImpl extends EStoreEObjectImpl implements InternalCDOObjec
}
CDOViewImpl view = cdoView();
- super.eSetDirectResource(cdoDirectResource());
+ super.eSetDirectResource((Resource.Internal)cdoStore().getResource(this));
CDOStore store = cdoStore();
eContainer = store.getContainer(this);
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
index 699451eac6..54b83f104a 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOObjectWrapper.java
@@ -10,8 +10,8 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
-import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.CDOLock;
+import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl;
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index 39d5dc2038..6265cb61b6 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -15,12 +15,15 @@
package org.eclipse.emf.internal.cdo;
import org.eclipse.emf.cdo.CDORevisionPrefetchingPolicy;
+import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOFeature;
import org.eclipse.emf.cdo.common.model.CDOType;
import org.eclipse.emf.cdo.common.revision.CDOList;
+import org.eclipse.emf.cdo.common.revision.CDORevisionUtil;
import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.internal.common.model.core.CDOFeatureMapEntryDataTypeImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOAddFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOClearFeatureDeltaImpl;
import org.eclipse.emf.cdo.internal.common.revision.delta.CDOContainerFeatureDeltaImpl;
@@ -37,6 +40,7 @@ import org.eclipse.emf.internal.cdo.util.GenUtil;
import org.eclipse.net4j.util.om.trace.ContextTracer;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
@@ -44,6 +48,8 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.InternalEObject.EStore;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import java.text.MessageFormat;
import java.util.Collection;
@@ -160,29 +166,7 @@ public final class CDOStore implements EStore
view.getFeatureAnalyzer().preTraverseFeature(cdoObject, cdoFeature, index);
InternalCDORevision revision = getRevisionForReading(cdoObject);
Object value = revision.get(cdoFeature, index);
- if (cdoFeature.isReference())
- {
- value = resolveProxy(revision, cdoFeature, index, value);
- if (cdoFeature.isMany() && value instanceof CDOID)
- {
- CDOID id = (CDOID)value;
- CDOList list = revision.getList(cdoFeature);
- CDORevisionManagerImpl revisionManager = view.getSession().getRevisionManager();
- CDORevisionPrefetchingPolicy policy = view.getRevisionPrefetchingPolicy();
-
- Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, eFeature, list, index, id);
- if (!listOfIDs.isEmpty())
- {
- revisionManager.getRevisions(listOfIDs, view.getSession().getCollectionLoadingPolicy().getInitialChunkSize());
- }
- }
-
- value = view.convertIDToObject(value);
- }
- else if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- value = EcoreUtil.createFromString((EDataType)eFeature.getEType(), (String)value);
- }
+ value = convertToEMF(view, eObject, revision, eFeature, cdoFeature, index, value);
view.getFeatureAnalyzer().postTraverseFeature(cdoObject, cdoFeature, index, value);
return value;
@@ -346,14 +330,7 @@ public final class CDOStore implements EStore
TRACER.format("set({0}, {1}, {2}, {3})", cdoObject, cdoFeature, index, value);
}
- if (cdoFeature.getType() == CDOType.CUSTOM)
- {
- value = EcoreUtil.convertToString((EDataType)eFeature.getEType(), value);
- }
- else if (value == null && GenUtil.isPrimitiveType(eFeature.getEType()))
- {
- value = eFeature.getDefaultValue();
- }
+ value = convertToCDO(getView(), eFeature, cdoFeature, value);
CDOFeatureDelta delta = new CDOSetFeatureDeltaImpl(cdoFeature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
@@ -365,12 +342,81 @@ public final class CDOStore implements EStore
}
Object oldValue = revision.set(cdoFeature, index, value);
+ oldValue = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, index, oldValue);
+
+ return oldValue;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToEMF(CDOView view, EObject eObject, InternalCDORevision revision, EStructuralFeature eFeature,
+ CDOFeature cdoFeature, int index, Object value)
+ {
if (cdoFeature.isReference())
{
- oldValue = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(oldValue);
+ if (cdoFeature.isMany() && EStore.NO_INDEX != index)
+ {
+ value = resolveProxy(revision, cdoFeature, index, value);
+ if (cdoFeature.isMany() && value instanceof CDOID)
+ {
+ CDOID id = (CDOID)value;
+ CDOList list = revision.getList(cdoFeature);
+ CDORevisionManagerImpl revisionManager = ((CDOViewImpl)view).getSession().getRevisionManager();
+ CDORevisionPrefetchingPolicy policy = view.getRevisionPrefetchingPolicy();
+
+ Collection<CDOID> listOfIDs = policy.loadAhead(revisionManager, eObject, eFeature, list, index, id);
+ if (!listOfIDs.isEmpty())
+ {
+ revisionManager.getRevisions(listOfIDs, view.getSession().getCollectionLoadingPolicy()
+ .getInitialChunkSize());
+ }
+ }
+ }
+
+ value = ((CDOViewImpl)view).convertIDToObject(value);
+ }
+ else if (cdoFeature.getType() == CDOType.CUSTOM)
+ {
+ value = EcoreUtil.createFromString((EDataType)eFeature.getEType(), (String)value);
+ }
+ else if (cdoFeature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ {
+ CDOFeatureMapEntryDataTypeImpl entry = (CDOFeatureMapEntryDataTypeImpl)value;
+ EStructuralFeature feature = (EStructuralFeature)view.getResourceSet().getEObject(URI.createURI(entry.getURI()),
+ true);
+ Object object = ((CDOViewImpl)view).convertIDToObject(entry.getObject());
+ value = FeatureMapUtil.createEntry(feature, object);
}
- return oldValue;
+ return value;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public Object convertToCDO(CDOView view, EStructuralFeature eFeature, CDOFeature cdoFeature, Object value)
+ {
+ if (cdoFeature.isReference())
+ {
+ value = ((CDOViewImpl)view).convertObjectToID(value, true);
+ }
+ else if (cdoFeature.getType() == CDOType.FEATURE_MAP_ENTRY)
+ {
+ FeatureMap.Entry entry = (FeatureMap.Entry)value;
+ String uri = EcoreUtil.getURI(entry.getEStructuralFeature()).toString();
+ value = CDORevisionUtil.createFeatureMapEntry(uri, entry.getValue());
+ }
+ else if (cdoFeature.getType() == CDOType.CUSTOM)
+ {
+ value = EcoreUtil.convertToString((EDataType)eFeature.getEType(), value);
+ }
+ else if (value == null && GenUtil.isPrimitiveType(eFeature.getEType()))
+ {
+ value = eFeature.getDefaultValue();
+ }
+
+ return value;
}
public void unset(InternalEObject eObject, EStructuralFeature eFeature)
@@ -397,10 +443,7 @@ public final class CDOStore implements EStore
TRACER.format("add({0}, {1}, {2}, {3})", cdoObject, cdoFeature, index, value);
}
- if (cdoFeature.isReference())
- {
- value = ((CDOViewImpl)cdoObject.cdoView()).convertObjectToID(value, true);
- }
+ value = convertToCDO(cdoObject.cdoView(), eFeature, cdoFeature, value);
CDOFeatureDelta delta = new CDOAddFeatureDeltaImpl(cdoFeature, index, value);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
@@ -419,11 +462,8 @@ public final class CDOStore implements EStore
CDOFeatureDelta delta = new CDORemoveFeatureDeltaImpl(cdoFeature, index);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
Object result = revision.remove(cdoFeature, index);
- if (cdoFeature.isReference())
- {
- result = resolveProxy(revision, cdoFeature, index, result);
- result = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result);
- }
+
+ result = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, index, result);
return result;
}
@@ -455,12 +495,8 @@ public final class CDOStore implements EStore
CDOFeatureDelta delta = new CDOMoveFeatureDeltaImpl(cdoFeature, target, source);
InternalCDORevision revision = getRevisionForWriting(cdoObject, delta);
Object result = revision.move(cdoFeature, target, source);
- if (cdoFeature.isReference())
- {
- result = resolveProxy(revision, cdoFeature, target, result);
- result = ((CDOViewImpl)cdoObject.cdoView()).convertIDToObject(result);
- }
+ result = convertToEMF(cdoObject.cdoView(), eObject, revision, eFeature, cdoFeature, EStore.NO_INDEX, result);
return result;
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
index 28717c37c8..9eb4715f2c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/util/ModelUtil.java
@@ -106,6 +106,7 @@ public final class ModelUtil
case EcorePackage.ELONG_OBJECT:
case EcorePackage.ESHORT:
case EcorePackage.ESHORT_OBJECT:
+ case EcorePackage.EFEATURE_MAP_ENTRY:
CDOType type = CDOModelUtil.getType(classifierID);
if (type == CDOType.OBJECT)
{

Back to the top