blob: 77d8b46d4ef4a65918e93aafddc95375b7790c39 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 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.
*
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.v1_1.resource.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jpt.core.internal.resource.xml.translators.SimpleTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Xml Entity</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
* <li>{@link org.eclipse.jpt.eclipselink.core.v1_1.resource.orm.XmlEntity#getPrimaryKey <em>Primary Key</em>}</li>
* </ul>
* </p>
*
* @see org.eclipse.jpt.eclipselink.core.v1_1.resource.orm.EclipseLink1_1OrmPackage#getXmlEntity()
* @model kind="class"
* @generated
*/
public class XmlEntity extends org.eclipse.jpt.eclipselink.core.resource.orm.XmlEntity
{
/**
* The cached value of the '{@link #getPrimaryKey() <em>Primary Key</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrimaryKey()
* @generated
* @ordered
*/
protected XmlPrimaryKey primaryKey;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected XmlEntity()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EclipseLink1_1OrmPackage.Literals.XML_ENTITY;
}
/**
* Returns the value of the '<em><b>Primary Key</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Primary 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</em>' containment reference.
* @see #setPrimaryKey(XmlPrimaryKey)
* @see org.eclipse.jpt.eclipselink.core.v1_1.resource.orm.EclipseLink1_1OrmPackage#getXmlEntity_PrimaryKey()
* @model containment="true"
* @generated
*/
public XmlPrimaryKey getPrimaryKey()
{
return primaryKey;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPrimaryKey(XmlPrimaryKey newPrimaryKey, NotificationChain msgs)
{
XmlPrimaryKey oldPrimaryKey = primaryKey;
primaryKey = newPrimaryKey;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY, oldPrimaryKey, newPrimaryKey);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* Sets the value of the '{@link org.eclipse.jpt.eclipselink.core.v1_1.resource.orm.XmlEntity#getPrimaryKey <em>Primary Key</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Primary Key</em>' containment reference.
* @see #getPrimaryKey()
* @generated
*/
public void setPrimaryKey(XmlPrimaryKey newPrimaryKey)
{
if (newPrimaryKey != primaryKey)
{
NotificationChain msgs = null;
if (primaryKey != null)
msgs = ((InternalEObject)primaryKey).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY, null, msgs);
if (newPrimaryKey != null)
msgs = ((InternalEObject)newPrimaryKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY, null, msgs);
msgs = basicSetPrimaryKey(newPrimaryKey, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY, newPrimaryKey, newPrimaryKey));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY:
return basicSetPrimaryKey(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY:
return getPrimaryKey();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY:
setPrimaryKey((XmlPrimaryKey)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY:
setPrimaryKey((XmlPrimaryKey)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case EclipseLink1_1OrmPackage.XML_ENTITY__PRIMARY_KEY:
return primaryKey != null;
}
return super.eIsSet(featureID);
}
// ********** translators **********
public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) {
return new SimpleTranslator(
elementName,
structuralFeature,
EclipseLink1_1OrmPackage.eINSTANCE.getXmlEntity(),
buildTranslatorChildren());
}
private static Translator[] buildTranslatorChildren() {
return new Translator[] {
buildNameTranslator(),
buildClassTranslator(),
buildAccessTranslator(),
buildMetadataCompleteTranslator(),
buildReadOnlyTranslator(),
buildExistenceCheckingTranslator(),
buildExcludeDefaultMappingsTranslator(),
buildDescriptionTranslator(),
buildCustomizerTranslator(),
buildChangeTrackingTranslator(),
buildTableTranslator(),
buildSecondaryTableTranslator(),
buildPrimaryKeyJoinColumnTranslator(),
buildIdClassTranslator(),
buildPrimaryKeyTranslator(),
buildInheritanceTranslator(),
buildDiscriminatorValueTranslator(),
buildDiscriminatorColumnTranslator(),
buildOptimisticLockingTranslator(),
buildCacheTranslator(),
buildConverterTranslator(),
buildTypeConverterTranslator(),
buildObjectTypeConverterTranslator(),
buildStructConverterTranslator(),
buildCopyPolicyTranslator(),
buildInstantiationCoypPolicyTranslator(),
buildCloneCopyPolicyTranslator(),
buildSequenceGeneratorTranslator(),
buildTableGeneratorTranslator(),
buildNamedQueryTranslator(),
buildNamedNativeQueryTranslator(),
buildNamedStoredProcedureQueryTranslator(),
buildSqlResultSetMappingTranslator(),
buildExcludeDefaultListenersTranslator(),
buildExcludeSuperclassListenersTranslator(),
buildEntityListenersTranslator(),
buildPrePersistTranslator(),
buildPostPersistTranslator(),
buildPreRemoveTranslator(),
buildPostRemoveTranslator(),
buildPreUpdateTranslator(),
buildPostUpdateTranslator(),
buildPostLoadTranslator(),
buildPropertyTranslator(),
buildAttributeOverrideTranslator(),
buildAssociationOverrideTranslator(),
Attributes.buildTranslator()
};
}
protected static Translator buildPrimaryKeyTranslator() {
return XmlPrimaryKey.buildTranslator(EclipseLink1_1.PRIMARY_KEY, EclipseLink1_1OrmPackage.eINSTANCE.getXmlEntity_PrimaryKey());
}
} // XmlEntity