diff options
author | Eike Stepper | 2006-08-14 08:12:40 +0000 |
---|---|---|
committer | Eike Stepper | 2006-08-14 08:12:40 +0000 |
commit | a1975b9f21f62c98d730514e253ec6049475d1ce (patch) | |
tree | 6c01c52c8c88538e68e9f3ee59f8dd5af643c634 | |
parent | 1bd1bc5d19703aff720fa56edfb8700b7431e84d (diff) | |
download | cdo-a1975b9f21f62c98d730514e253ec6049475d1ce.tar.gz cdo-a1975b9f21f62c98d730514e253ec6049475d1ce.tar.xz cdo-a1975b9f21f62c98d730514e253ec6049475d1ce.zip |
*** empty log message ***
11 files changed, 801 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore index 586af7c08e..75145e338f 100644 --- a/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore +++ b/plugins/org.eclipse.emf.cdo.tests/model/TestModel1.ecore @@ -14,4 +14,11 @@ <eStructuralFeatures xsi:type="ecore:EAttribute" name="intFeature" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> <eStructuralFeatures xsi:type="ecore:EAttribute" name="stringFeature" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ExtendedNode" eSuperTypes="#//TreeNode"> + <eStructuralFeatures xsi:type="ecore:EReference" name="bidiSource" upperBound="-1" + eType="#//ExtendedNode" eOpposite="#//ExtendedNode/bidiTarget"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="bidiTarget" upperBound="-1" + eType="#//ExtendedNode" eOpposite="#//ExtendedNode/bidiSource"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="stringFeature2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> </ecore:EPackage> diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java index dba7114b7b..aaa61eb4c2 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/AbstractModel1Test.java @@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.resource.Resource; import org.springframework.jdbc.core.JdbcTemplate; +import testmodel1.ExtendedNode; import testmodel1.TestModel1Factory; import testmodel1.TreeNode; @@ -66,7 +67,7 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest { Resource resource = node.eResource(); assertTrue(resource instanceof CDOResource); - + CDOResource cdoResource = (CDOResource) resource; assertEquals(path, cdoResource.getPath()); } @@ -126,6 +127,19 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest return parent; } + protected ExtendedNode createExtended(String name) + { + return createExtended(name, null); + } + + protected ExtendedNode createExtended(String name, TreeNode parent) + { + ExtendedNode node = TestModel1Factory.eINSTANCE.createExtendedNode(); + node.setStringFeature(name); + node.setParent(parent); + return node; + } + protected TreeNode findChild(String name, TreeNode parent) { return findNode(name, parent.getChildren()); @@ -165,5 +179,6 @@ public abstract class AbstractModel1Test extends AbstractTopologyTest { super.wipeDatabase(jdbc); dropTable(jdbc, "TREE_NODE"); + dropTable(jdbc, "EXTENDED_NODE"); } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java index c717f55888..f105f1a222 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/model1/BasicTest.java @@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.client.impl.CDOPersistentImpl; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.resource.Resource; +import testmodel1.ExtendedNode; import testmodel1.TreeNode; @@ -341,4 +342,70 @@ public class BasicTest extends AbstractModel1Test assertResource(RESOURCE, a4); } } + + public void testUpdate() throws Exception + { + final String RESOURCE = "/test/res"; + final String ROOT = "root"; + final String NEW_NAME = "XXX"; + + { // Execution + TreeNode root = createNode(ROOT); + CDOResource resource = saveRoot(root, RESOURCE); + + root.setStringFeature(NEW_NAME); + resource.save(null); + } + + { // Verification + TreeNode root = (TreeNode) loadRoot(RESOURCE); + assertNode(NEW_NAME, root); + } + } + + public void testUpdateWithInheritance() throws Exception + { + final String RESOURCE = "/test/res"; + final String ROOT = "root"; + final String NEW_NAME = "XXX"; + + { // Execution + ExtendedNode root = createExtended(ROOT); + CDOResource resource = saveRoot(root, RESOURCE); + + root.setStringFeature(NEW_NAME); + root.setStringFeature2(NEW_NAME); + resource.save(null); + } + + { // Verification + ExtendedNode root = (ExtendedNode) loadRoot(RESOURCE); + assertNode(NEW_NAME, root); + assertEquals(NEW_NAME, root.getStringFeature2()); + } + } + + public void testAttachWithInheritance() throws Exception + { + final String RESOURCE = "/test/res"; + final String ROOT = "root"; + final boolean BOOLEAN_VALUE = true; + final int INT_VALUE = 12345; + + { // Execution + ExtendedNode root = createExtended(ROOT); + root.setBooleanFeature(BOOLEAN_VALUE); + root.setIntFeature(INT_VALUE); + root.setStringFeature2(ROOT); + saveRoot(root, RESOURCE); + } + + { // Verification + ExtendedNode root = (ExtendedNode) loadRoot(RESOURCE); + assertNode(ROOT, root); + assertEquals(BOOLEAN_VALUE, root.isBooleanFeature()); + assertEquals(INT_VALUE, root.getIntFeature()); + assertEquals(ROOT, root.getStringFeature2()); + } + } } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/ExtendedNode.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/ExtendedNode.java new file mode 100644 index 0000000000..63cee3af6e --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/ExtendedNode.java @@ -0,0 +1,95 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package testmodel1; + + +import org.eclipse.emf.common.util.EList; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Extended Node</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link testmodel1.ExtendedNode#getBidiSource <em>Bidi Source</em>}</li> + * <li>{@link testmodel1.ExtendedNode#getBidiTarget <em>Bidi Target</em>}</li> + * <li>{@link testmodel1.ExtendedNode#getStringFeature2 <em>String Feature2</em>}</li> + * </ul> + * </p> + * + * @see testmodel1.TestModel1Package#getExtendedNode() + * @model + * @generated + */ +public interface ExtendedNode extends TreeNode +{ + /** + * Returns the value of the '<em><b>Bidi Source</b></em>' reference list. + * The list contents are of type {@link testmodel1.ExtendedNode}. + * It is bidirectional and its opposite is '{@link testmodel1.ExtendedNode#getBidiTarget <em>Bidi Target</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Bidi Source</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Bidi Source</em>' reference list. + * @see testmodel1.TestModel1Package#getExtendedNode_BidiSource() + * @see testmodel1.ExtendedNode#getBidiTarget + * @model type="testmodel1.ExtendedNode" opposite="bidiTarget" + * @generated + */ + EList getBidiSource(); + + /** + * Returns the value of the '<em><b>Bidi Target</b></em>' reference list. + * The list contents are of type {@link testmodel1.ExtendedNode}. + * It is bidirectional and its opposite is '{@link testmodel1.ExtendedNode#getBidiSource <em>Bidi Source</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Bidi Target</em>' reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Bidi Target</em>' reference list. + * @see testmodel1.TestModel1Package#getExtendedNode_BidiTarget() + * @see testmodel1.ExtendedNode#getBidiSource + * @model type="testmodel1.ExtendedNode" opposite="bidiSource" + * @generated + */ + EList getBidiTarget(); + + /** + * Returns the value of the '<em><b>String Feature2</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>String Feature2</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>String Feature2</em>' attribute. + * @see #setStringFeature2(String) + * @see testmodel1.TestModel1Package#getExtendedNode_StringFeature2() + * @model + * @generated + */ + String getStringFeature2(); + + /** + * Sets the value of the '{@link testmodel1.ExtendedNode#getStringFeature2 <em>String Feature2</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>String Feature2</em>' attribute. + * @see #getStringFeature2() + * @generated + */ + void setStringFeature2(String value); + +} // ExtendedNode
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java index a2254ecfcc..b500ad635d 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Factory.java @@ -38,6 +38,15 @@ public interface TestModel1Factory extends EFactory TreeNode createTreeNode(); /** + * Returns a new object of class '<em>Extended Node</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Extended Node</em>'. + * @generated + */ + ExtendedNode createExtendedNode(); + + /** * Returns the package supported by this factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java index 35c5fee80a..f1e0b91179 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/TestModel1Package.java @@ -138,6 +138,106 @@ public interface TestModel1Package extends EPackage int TREE_NODE_FEATURE_COUNT = CDOPackage.CDO_PERSISTENT_FEATURE_COUNT + 6; /** + * The meta object id for the '{@link testmodel1.impl.ExtendedNodeImpl <em>Extended Node</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see testmodel1.impl.ExtendedNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getExtendedNode() + * @generated + */ + int EXTENDED_NODE = 1; + + /** + * The feature id for the '<em><b>Parent</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__PARENT = TREE_NODE__PARENT; + + /** + * The feature id for the '<em><b>Children</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__CHILDREN = TREE_NODE__CHILDREN; + + /** + * The feature id for the '<em><b>References</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__REFERENCES = TREE_NODE__REFERENCES; + + /** + * The feature id for the '<em><b>Boolean Feature</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__BOOLEAN_FEATURE = TREE_NODE__BOOLEAN_FEATURE; + + /** + * The feature id for the '<em><b>Int Feature</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__INT_FEATURE = TREE_NODE__INT_FEATURE; + + /** + * The feature id for the '<em><b>String Feature</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__STRING_FEATURE = TREE_NODE__STRING_FEATURE; + + /** + * The feature id for the '<em><b>Bidi Source</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__BIDI_SOURCE = TREE_NODE_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Bidi Target</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__BIDI_TARGET = TREE_NODE_FEATURE_COUNT + 1; + + /** + * The feature id for the '<em><b>String Feature2</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE__STRING_FEATURE2 = TREE_NODE_FEATURE_COUNT + 2; + + /** + * The number of structural features of the '<em>Extended Node</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EXTENDED_NODE_FEATURE_COUNT = TREE_NODE_FEATURE_COUNT + 3; + + /** * Returns the meta object for class '{@link testmodel1.TreeNode <em>Tree Node</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -214,6 +314,49 @@ public interface TestModel1Package extends EPackage EAttribute getTreeNode_StringFeature(); /** + * Returns the meta object for class '{@link testmodel1.ExtendedNode <em>Extended Node</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Extended Node</em>'. + * @see testmodel1.ExtendedNode + * @generated + */ + EClass getExtendedNode(); + + /** + * Returns the meta object for the reference list '{@link testmodel1.ExtendedNode#getBidiSource <em>Bidi Source</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Bidi Source</em>'. + * @see testmodel1.ExtendedNode#getBidiSource() + * @see #getExtendedNode() + * @generated + */ + EReference getExtendedNode_BidiSource(); + + /** + * Returns the meta object for the reference list '{@link testmodel1.ExtendedNode#getBidiTarget <em>Bidi Target</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference list '<em>Bidi Target</em>'. + * @see testmodel1.ExtendedNode#getBidiTarget() + * @see #getExtendedNode() + * @generated + */ + EReference getExtendedNode_BidiTarget(); + + /** + * Returns the meta object for the attribute '{@link testmodel1.ExtendedNode#getStringFeature2 <em>String Feature2</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>String Feature2</em>'. + * @see testmodel1.ExtendedNode#getStringFeature2() + * @see #getExtendedNode() + * @generated + */ + EAttribute getExtendedNode_StringFeature2(); + + /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -295,6 +438,40 @@ public interface TestModel1Package extends EPackage */ EAttribute TREE_NODE__STRING_FEATURE = eINSTANCE.getTreeNode_StringFeature(); + /** + * The meta object literal for the '{@link testmodel1.impl.ExtendedNodeImpl <em>Extended Node</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see testmodel1.impl.ExtendedNodeImpl + * @see testmodel1.impl.TestModel1PackageImpl#getExtendedNode() + * @generated + */ + EClass EXTENDED_NODE = eINSTANCE.getExtendedNode(); + + /** + * The meta object literal for the '<em><b>Bidi Source</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EXTENDED_NODE__BIDI_SOURCE = eINSTANCE.getExtendedNode_BidiSource(); + + /** + * The meta object literal for the '<em><b>Bidi Target</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference EXTENDED_NODE__BIDI_TARGET = eINSTANCE.getExtendedNode_BidiTarget(); + + /** + * The meta object literal for the '<em><b>String Feature2</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute EXTENDED_NODE__STRING_FEATURE2 = eINSTANCE.getExtendedNode_StringFeature2(); + } } //TestModel1Package diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/ExtendedNodeImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/ExtendedNodeImpl.java new file mode 100644 index 0000000000..8d920c5e25 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/ExtendedNodeImpl.java @@ -0,0 +1,303 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package testmodel1.impl; + + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import testmodel1.ExtendedNode; +import testmodel1.TestModel1Package; + + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Extended Node</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link testmodel1.impl.ExtendedNodeImpl#getBidiSource <em>Bidi Source</em>}</li> + * <li>{@link testmodel1.impl.ExtendedNodeImpl#getBidiTarget <em>Bidi Target</em>}</li> + * <li>{@link testmodel1.impl.ExtendedNodeImpl#getStringFeature2 <em>String Feature2</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ExtendedNodeImpl extends TreeNodeImpl implements ExtendedNode +{ + /** + * The cached value of the '{@link #getBidiSource() <em>Bidi Source</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getBidiSource() + * @generated + * @ordered + */ + protected EList bidiSource = null; + + /** + * The cached value of the '{@link #getBidiTarget() <em>Bidi Target</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getBidiTarget() + * @generated + * @ordered + */ + protected EList bidiTarget = null; + + /** + * The default value of the '{@link #getStringFeature2() <em>String Feature2</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getStringFeature2() + * @generated + * @ordered + */ + protected static final String STRING_FEATURE2_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStringFeature2() <em>String Feature2</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getStringFeature2() + * @generated + * @ordered + */ + protected String stringFeature2 = STRING_FEATURE2_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected ExtendedNodeImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected EClass eStaticClass() + { + return TestModel1Package.Literals.EXTENDED_NODE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList getBidiSource() + { + cdoLoad(); + if (bidiSource == null) + { + bidiSource = new EObjectWithInverseResolvingEList.ManyInverse(ExtendedNode.class, this, + TestModel1Package.EXTENDED_NODE__BIDI_SOURCE, + TestModel1Package.EXTENDED_NODE__BIDI_TARGET); + } + return bidiSource; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EList getBidiTarget() + { + cdoLoad(); + if (bidiTarget == null) + { + bidiTarget = new EObjectWithInverseResolvingEList.ManyInverse(ExtendedNode.class, this, + TestModel1Package.EXTENDED_NODE__BIDI_TARGET, + TestModel1Package.EXTENDED_NODE__BIDI_SOURCE); + } + return bidiTarget; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String getStringFeature2() + { + cdoLoad(); + return stringFeature2; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setStringFeature2(String newStringFeature2) + { + cdoLoad(); + String oldStringFeature2 = stringFeature2; + stringFeature2 = newStringFeature2; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, + TestModel1Package.EXTENDED_NODE__STRING_FEATURE2, oldStringFeature2, stringFeature2)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + return ((InternalEList) getBidiSource()).basicAdd(otherEnd, msgs); + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + return ((InternalEList) getBidiTarget()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, + NotificationChain msgs) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + return ((InternalEList) getBidiSource()).basicRemove(otherEnd, msgs); + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + return ((InternalEList) getBidiTarget()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + return getBidiSource(); + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + return getBidiTarget(); + case TestModel1Package.EXTENDED_NODE__STRING_FEATURE2: + return getStringFeature2(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + getBidiSource().clear(); + getBidiSource().addAll((Collection) newValue); + return; + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + getBidiTarget().clear(); + getBidiTarget().addAll((Collection) newValue); + return; + case TestModel1Package.EXTENDED_NODE__STRING_FEATURE2: + setStringFeature2((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void eUnset(int featureID) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + getBidiSource().clear(); + return; + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + getBidiTarget().clear(); + return; + case TestModel1Package.EXTENDED_NODE__STRING_FEATURE2: + setStringFeature2(STRING_FEATURE2_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case TestModel1Package.EXTENDED_NODE__BIDI_SOURCE: + return bidiSource != null && !bidiSource.isEmpty(); + case TestModel1Package.EXTENDED_NODE__BIDI_TARGET: + return bidiTarget != null && !bidiTarget.isEmpty(); + case TestModel1Package.EXTENDED_NODE__STRING_FEATURE2: + return STRING_FEATURE2_EDEFAULT == null ? stringFeature2 != null + : !STRING_FEATURE2_EDEFAULT.equals(stringFeature2); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (stringFeature2: "); + result.append(stringFeature2); + result.append(')'); + return result.toString(); + } + +} //ExtendedNodeImpl
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java index d3684d8b95..ad05d25901 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1FactoryImpl.java @@ -72,6 +72,8 @@ public class TestModel1FactoryImpl extends EFactoryImpl implements TestModel1Fac { case TestModel1Package.TREE_NODE: return createTreeNode(); + case TestModel1Package.EXTENDED_NODE: + return createExtendedNode(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); @@ -94,6 +96,17 @@ public class TestModel1FactoryImpl extends EFactoryImpl implements TestModel1Fac * <!-- end-user-doc --> * @generated */ + public ExtendedNode createExtendedNode() + { + ExtendedNodeImpl extendedNode = new ExtendedNodeImpl(); + return extendedNode; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public TestModel1Package getTestModel1Package() { return (TestModel1Package) getEPackage(); diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java index d9b692e9eb..d3d0f1a551 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/impl/TestModel1PackageImpl.java @@ -16,6 +16,7 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.impl.EPackageImpl; +import testmodel1.ExtendedNode; import testmodel1.TestModel1Factory; import testmodel1.TestModel1Package; import testmodel1.TreeNode; @@ -37,6 +38,13 @@ public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Pac private EClass treeNodeEClass = null; /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass extendedNodeEClass = null; + + /** * Creates an instance of the model <b>Package</b>, registered with * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package * package URI value. @@ -187,6 +195,46 @@ public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Pac * <!-- end-user-doc --> * @generated */ + public EClass getExtendedNode() + { + return extendedNodeEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getExtendedNode_BidiSource() + { + return (EReference) extendedNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getExtendedNode_BidiTarget() + { + return (EReference) extendedNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getExtendedNode_StringFeature2() + { + return (EAttribute) extendedNodeEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public TestModel1Factory getTestModel1Factory() { return (TestModel1Factory) getEFactoryInstance(); @@ -219,6 +267,11 @@ public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Pac createEAttribute(treeNodeEClass, TREE_NODE__BOOLEAN_FEATURE); createEAttribute(treeNodeEClass, TREE_NODE__INT_FEATURE); createEAttribute(treeNodeEClass, TREE_NODE__STRING_FEATURE); + + extendedNodeEClass = createEClass(EXTENDED_NODE); + createEReference(extendedNodeEClass, EXTENDED_NODE__BIDI_SOURCE); + createEReference(extendedNodeEClass, EXTENDED_NODE__BIDI_TARGET); + createEAttribute(extendedNodeEClass, EXTENDED_NODE__STRING_FEATURE2); } /** @@ -251,6 +304,7 @@ public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Pac // Add supertypes to classes treeNodeEClass.getESuperTypes().add(theCDOPackage.getCDOPersistent()); + extendedNodeEClass.getESuperTypes().add(this.getTreeNode()); // Initialize classes and features; add operations and parameters initEClass(treeNodeEClass, TreeNode.class, "TreeNode", !IS_ABSTRACT, !IS_INTERFACE, @@ -274,6 +328,20 @@ public class TestModel1PackageImpl extends EPackageImpl implements TestModel1Pac 0, 1, TreeNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEClass(extendedNodeEClass, ExtendedNode.class, "ExtendedNode", !IS_ABSTRACT, !IS_INTERFACE, + IS_GENERATED_INSTANCE_CLASS); + initEReference(getExtendedNode_BidiSource(), this.getExtendedNode(), this + .getExtendedNode_BidiTarget(), "bidiSource", null, 0, -1, ExtendedNode.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getExtendedNode_BidiTarget(), this.getExtendedNode(), this + .getExtendedNode_BidiSource(), "bidiTarget", null, 0, -1, ExtendedNode.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getExtendedNode_StringFeature2(), ecorePackage.getEString(), "stringFeature2", + null, 0, 1, ExtendedNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, + !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + // Create resource createResource(eNS_URI); } diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java index dd4732b893..ad551f95fb 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1AdapterFactory.java @@ -86,6 +86,11 @@ public class TestModel1AdapterFactory extends AdapterFactoryImpl return createTreeNodeAdapter(); } + public Object caseExtendedNode(ExtendedNode object) + { + return createExtendedNodeAdapter(); + } + public Object caseCDOPersistable(CDOPersistable object) { return createCDOPersistableAdapter(); @@ -131,6 +136,21 @@ public class TestModel1AdapterFactory extends AdapterFactoryImpl } /** + * Creates a new adapter for an object of class '{@link testmodel1.ExtendedNode <em>Extended Node</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see testmodel1.ExtendedNode + * @generated + */ + public Adapter createExtendedNodeAdapter() + { + return null; + } + + /** * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.client.CDOPersistable <em>Persistable</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; diff --git a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java index 6ed1b9681b..bca801c01a 100644 --- a/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java +++ b/plugins/org.eclipse.emf.cdo.tests/src/testmodel1/util/TestModel1Switch.java @@ -108,6 +108,16 @@ public class TestModel1Switch if (result == null) result = defaultCase(theEObject); return result; } + case TestModel1Package.EXTENDED_NODE: + { + ExtendedNode extendedNode = (ExtendedNode) theEObject; + Object result = caseExtendedNode(extendedNode); + if (result == null) result = caseTreeNode(extendedNode); + if (result == null) result = caseCDOPersistent(extendedNode); + if (result == null) result = caseCDOPersistable(extendedNode); + if (result == null) result = defaultCase(theEObject); + return result; + } default: return defaultCase(theEObject); } @@ -130,6 +140,22 @@ public class TestModel1Switch } /** + * Returns the result of interpretting the object as an instance of '<em>Extended Node</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpretting the object as an instance of '<em>Extended Node</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public Object caseExtendedNode(ExtendedNode object) + { + return null; + } + + /** * Returns the result of interpretting the object as an instance of '<em>Persistable</em>'. * <!-- begin-user-doc --> * This implementation returns null; |