diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java | 189 |
1 files changed, 186 insertions, 3 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java index 6571012254..46e4400189 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/model/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. + * Copyright (c) 2007, 2013 Oracle. 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. @@ -10,13 +10,20 @@ package org.eclipse.jpt.jpa.core.resource.orm; 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.EStructuralFeature; import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.jpt.jpa.core.resource.orm.v2_1.OrmV2_1Package; +import org.eclipse.jpt.jpa.core.resource.orm.v2_1.JPA2_1; +import org.eclipse.jpt.jpa.core.resource.orm.v2_1.XmlForeignKey_2_1; +import org.eclipse.jpt.jpa.core.resource.orm.v2_1.XmlIndex_2_1; +import org.eclipse.jpt.jpa.core.resource.orm.v2_1.XmlSecondaryTable_2_1; import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; import org.eclipse.wst.common.internal.emf.resource.Translator; @@ -42,9 +49,27 @@ import org.eclipse.wst.common.internal.emf.resource.Translator; * @model kind="class" * @generated */ -public class XmlSecondaryTable extends AbstractXmlTable +public class XmlSecondaryTable extends AbstractXmlTable implements XmlSecondaryTable_2_1 { /** + * The cached value of the '{@link #getPrimaryKeyForeignKey() <em>Primary Key Foreign Key</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getPrimaryKeyForeignKey() + * @generated + * @ordered + */ + protected XmlForeignKey_2_1 primaryKeyForeignKey; + /** + * The cached value of the '{@link #getIndexes() <em>Indexes</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getIndexes() + * @generated + * @ordered + */ + protected EList<XmlIndex_2_1> indexes; + /** * The cached value of the '{@link #getPrimaryKeyJoinColumns() <em>Primary Key Join Columns</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -76,6 +101,89 @@ public class XmlSecondaryTable extends AbstractXmlTable } /** + * Returns the value of the '<em><b>Primary Key Foreign Key</b></em>' containment reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Primary Key Foreign Key</em>' containment reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Primary Key Foreign Key</em>' containment reference. + * @see #setPrimaryKeyForeignKey(XmlForeignKey_2_1) + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable_2_1_PrimaryKeyForeignKey() + * @model containment="true" + * @generated + */ + public XmlForeignKey_2_1 getPrimaryKeyForeignKey() + { + return primaryKeyForeignKey; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public NotificationChain basicSetPrimaryKeyForeignKey(XmlForeignKey_2_1 newPrimaryKeyForeignKey, NotificationChain msgs) + { + XmlForeignKey_2_1 oldPrimaryKeyForeignKey = primaryKeyForeignKey; + primaryKeyForeignKey = newPrimaryKeyForeignKey; + if (eNotificationRequired()) + { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY, oldPrimaryKeyForeignKey, newPrimaryKeyForeignKey); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable#getPrimaryKeyForeignKey <em>Primary Key Foreign Key</em>}' containment reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Primary Key Foreign Key</em>' containment reference. + * @see #getPrimaryKeyForeignKey() + * @generated + */ + public void setPrimaryKeyForeignKey(XmlForeignKey_2_1 newPrimaryKeyForeignKey) + { + if (newPrimaryKeyForeignKey != primaryKeyForeignKey) + { + NotificationChain msgs = null; + if (primaryKeyForeignKey != null) + msgs = ((InternalEObject)primaryKeyForeignKey).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY, null, msgs); + if (newPrimaryKeyForeignKey != null) + msgs = ((InternalEObject)newPrimaryKeyForeignKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY, null, msgs); + msgs = basicSetPrimaryKeyForeignKey(newPrimaryKeyForeignKey, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY, newPrimaryKeyForeignKey, newPrimaryKeyForeignKey)); + } + + /** + * Returns the value of the '<em><b>Indexes</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.v2_1.XmlIndex_2_1}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Indexes</em>' containment reference list isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Indexes</em>' containment reference list. + * @see org.eclipse.jpt.jpa.core.resource.orm.OrmPackage#getXmlSecondaryTable_2_1_Indexes() + * @model containment="true" + * @generated + */ + public EList<XmlIndex_2_1> getIndexes() + { + if (indexes == null) + { + indexes = new EObjectContainmentEList<XmlIndex_2_1>(XmlIndex_2_1.class, this, OrmPackage.XML_SECONDARY_TABLE__INDEXES); + } + return indexes; + } + + /** * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn}. * <!-- begin-user-doc --> @@ -108,6 +216,10 @@ public class XmlSecondaryTable extends AbstractXmlTable { switch (featureID) { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: + return basicSetPrimaryKeyForeignKey(null, msgs); + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: + return ((InternalEList<?>)getIndexes()).basicRemove(otherEnd, msgs); case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS: return ((InternalEList<?>)getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs); } @@ -124,6 +236,10 @@ public class XmlSecondaryTable extends AbstractXmlTable { switch (featureID) { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: + return getPrimaryKeyForeignKey(); + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: + return getIndexes(); case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS: return getPrimaryKeyJoinColumns(); } @@ -141,6 +257,13 @@ public class XmlSecondaryTable extends AbstractXmlTable { switch (featureID) { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: + setPrimaryKeyForeignKey((XmlForeignKey_2_1)newValue); + return; + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: + getIndexes().clear(); + getIndexes().addAll((Collection<? extends XmlIndex_2_1>)newValue); + return; case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS: getPrimaryKeyJoinColumns().clear(); getPrimaryKeyJoinColumns().addAll((Collection<? extends XmlPrimaryKeyJoinColumn>)newValue); @@ -159,6 +282,12 @@ public class XmlSecondaryTable extends AbstractXmlTable { switch (featureID) { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: + setPrimaryKeyForeignKey((XmlForeignKey_2_1)null); + return; + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: + getIndexes().clear(); + return; case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS: getPrimaryKeyJoinColumns().clear(); return; @@ -176,12 +305,56 @@ public class XmlSecondaryTable extends AbstractXmlTable { switch (featureID) { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: + return primaryKeyForeignKey != null; + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: + return indexes != null && !indexes.isEmpty(); case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS: return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty(); } return super.eIsSet(featureID); } + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) + { + if (baseClass == XmlSecondaryTable_2_1.class) + { + switch (derivedFeatureID) + { + case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY: return OrmV2_1Package.XML_SECONDARY_TABLE_21__PRIMARY_KEY_FOREIGN_KEY; + case OrmPackage.XML_SECONDARY_TABLE__INDEXES: return OrmV2_1Package.XML_SECONDARY_TABLE_21__INDEXES; + default: return -1; + } + } + return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) + { + if (baseClass == XmlSecondaryTable_2_1.class) + { + switch (baseFeatureID) + { + case OrmV2_1Package.XML_SECONDARY_TABLE_21__PRIMARY_KEY_FOREIGN_KEY: return OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_FOREIGN_KEY; + case OrmV2_1Package.XML_SECONDARY_TABLE_21__INDEXES: return OrmPackage.XML_SECONDARY_TABLE__INDEXES; + default: return -1; + } + } + return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); + } + // ********** translators ********** public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { @@ -194,7 +367,9 @@ public class XmlSecondaryTable extends AbstractXmlTable buildCatalogTranslator(), buildSchemaTranslator(), buildPrimaryKeyJoinColumnsTranslator(), - buildUniqueConstraintTranslator() + buildPrimaryKeyForeignKeyTranslator(), + buildUniqueConstraintTranslator(), + buildIndexesTranslator() }; } @@ -202,4 +377,12 @@ public class XmlSecondaryTable extends AbstractXmlTable return XmlPrimaryKeyJoinColumn.buildTranslator(JPA.PRIMARY_KEY_JOIN_COLUMN, OrmPackage.eINSTANCE.getXmlSecondaryTable_PrimaryKeyJoinColumns()); } + protected static Translator buildPrimaryKeyForeignKeyTranslator() { + return XmlForeignKey.buildTranslator(JPA2_1.PRIMARY_KEY_FOREIGN_KEY, OrmV2_1Package.eINSTANCE.getXmlSecondaryTable_2_1_PrimaryKeyForeignKey()); + } + + protected static Translator buildIndexesTranslator() { + return XmlIndex.buildTranslator(JPA2_1.INDEX, OrmV2_1Package.eINSTANCE.getXmlSecondaryTable_2_1_Indexes()); + } + } // XmlSecondaryTableImpl |