/******************************************************************************* * Copyright (c) 2006, 2010 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.jpa.core.resource.persistence; 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.common.core.internal.utility.translators.BooleanTranslator; import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; import org.eclipse.jpt.common.utility.internal.CollectionTools; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Package; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0; import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnit_2_0; import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject; import org.eclipse.wst.common.internal.emf.resource.Translator; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; /** * * A representation of the model object 'Unit'. * * Provisional API: This interface is part of an interim API that is still * under development and expected to change significantly before reaching * stability. It is available at this early stage to solicit feedback from * pioneering adopters on the understanding that any code that uses this API * will almost certainly be broken (repeatedly) as the API evolves. * * *

* The following features are supported: *

*

* * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit() * @model kind="class" * @generated */ public class XmlPersistenceUnit extends AbstractJpaEObject implements XmlPersistenceUnit_2_0 { /** * changed this to null and removed the generated flag so emf won't generate over it * we don't want a default for enums, just null if the tag does not exist */ protected static final XmlPersistenceUnitCachingType_2_0 SHARED_CACHE_MODE_EDEFAULT = null; /** * The cached value of the '{@link #getSharedCacheMode() Shared Cache Mode}' attribute. * * * @see #getSharedCacheMode() * @generated * @ordered */ protected XmlPersistenceUnitCachingType_2_0 sharedCacheMode = SHARED_CACHE_MODE_EDEFAULT; /** * changed this to null and removed the generated flag so emf won't generate over it * we don't want a default for enums, just null if the tag does not exist */ protected static final XmlPersistenceUnitValidationModeType_2_0 VALIDATION_MODE_EDEFAULT = null; /** * The cached value of the '{@link #getValidationMode() Validation Mode}' attribute. * * * @see #getValidationMode() * @generated * @ordered */ protected XmlPersistenceUnitValidationModeType_2_0 validationMode = VALIDATION_MODE_EDEFAULT; /** * The default value of the '{@link #getDescription() Description}' attribute. * * * @see #getDescription() * @generated * @ordered */ protected static final String DESCRIPTION_EDEFAULT = null; /** * The cached value of the '{@link #getDescription() Description}' attribute. * * * @see #getDescription() * @generated * @ordered */ protected String description = DESCRIPTION_EDEFAULT; /** * The default value of the '{@link #getProvider() Provider}' attribute. * * * @see #getProvider() * @generated * @ordered */ protected static final String PROVIDER_EDEFAULT = null; /** * The cached value of the '{@link #getProvider() Provider}' attribute. * * * @see #getProvider() * @generated * @ordered */ protected String provider = PROVIDER_EDEFAULT; /** * The default value of the '{@link #getJtaDataSource() Jta Data Source}' attribute. * * * @see #getJtaDataSource() * @generated * @ordered */ protected static final String JTA_DATA_SOURCE_EDEFAULT = null; /** * The cached value of the '{@link #getJtaDataSource() Jta Data Source}' attribute. * * * @see #getJtaDataSource() * @generated * @ordered */ protected String jtaDataSource = JTA_DATA_SOURCE_EDEFAULT; /** * The default value of the '{@link #getNonJtaDataSource() Non Jta Data Source}' attribute. * * * @see #getNonJtaDataSource() * @generated * @ordered */ protected static final String NON_JTA_DATA_SOURCE_EDEFAULT = null; /** * The cached value of the '{@link #getNonJtaDataSource() Non Jta Data Source}' attribute. * * * @see #getNonJtaDataSource() * @generated * @ordered */ protected String nonJtaDataSource = NON_JTA_DATA_SOURCE_EDEFAULT; /** * The cached value of the '{@link #getMappingFiles() Mapping Files}' containment reference list. * * * @see #getMappingFiles() * @generated * @ordered */ protected EList mappingFiles; /** * The cached value of the '{@link #getJarFiles() Jar Files}' containment reference list. * * * @see #getJarFiles() * @generated * @ordered */ protected EList jarFiles; /** * The cached value of the '{@link #getClasses() Classes}' containment reference list. * * * @see #getClasses() * @generated * @ordered */ protected EList classes; /** * The default value of the '{@link #getExcludeUnlistedClasses() Exclude Unlisted Classes}' attribute. * * * @see #getExcludeUnlistedClasses() * @generated * @ordered */ protected static final Boolean EXCLUDE_UNLISTED_CLASSES_EDEFAULT = null; /** * The cached value of the '{@link #getExcludeUnlistedClasses() Exclude Unlisted Classes}' attribute. * * * @see #getExcludeUnlistedClasses() * @generated * @ordered */ protected Boolean excludeUnlistedClasses = EXCLUDE_UNLISTED_CLASSES_EDEFAULT; /** * The cached value of the '{@link #getProperties() Properties}' containment reference. * * * @see #getProperties() * @generated * @ordered */ protected XmlProperties properties; /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * changed this to null and removed the generated flag so emf won't generate over it * we don't want a default for enums, just null if the tag does not exist */ protected static final XmlPersistenceUnitTransactionType TRANSACTION_TYPE_EDEFAULT = null; /** * The cached value of the '{@link #getTransactionType() Transaction Type}' attribute. * * * @see #getTransactionType() * @generated * @ordered */ protected XmlPersistenceUnitTransactionType transactionType = TRANSACTION_TYPE_EDEFAULT; /** * * * @generated */ protected XmlPersistenceUnit() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return PersistencePackage.Literals.XML_PERSISTENCE_UNIT; } /** * Returns the value of the 'Shared Cache Mode' attribute. * The default value is "UNSPECIFIED". * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0}. * *

* If the meaning of the 'Shared Cache Mode' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Shared Cache Mode' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0 * @see #setSharedCacheMode(XmlPersistenceUnitCachingType_2_0) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_2_0_SharedCacheMode() * @model default="UNSPECIFIED" unique="false" * @generated */ public XmlPersistenceUnitCachingType_2_0 getSharedCacheMode() { return sharedCacheMode; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getSharedCacheMode Shared Cache Mode}' attribute. * * * @param value the new value of the 'Shared Cache Mode' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitCachingType_2_0 * @see #getSharedCacheMode() * @generated */ public void setSharedCacheMode(XmlPersistenceUnitCachingType_2_0 newSharedCacheMode) { XmlPersistenceUnitCachingType_2_0 oldSharedCacheMode = sharedCacheMode; sharedCacheMode = newSharedCacheMode == null ? SHARED_CACHE_MODE_EDEFAULT : newSharedCacheMode; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE, oldSharedCacheMode, sharedCacheMode)); } /** * Returns the value of the 'Validation Mode' attribute. * The default value is "AUTO". * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0}. * *

* If the meaning of the 'Validation Mode' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Validation Mode' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0 * @see #setValidationMode(XmlPersistenceUnitValidationModeType_2_0) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_2_0_ValidationMode() * @model default="AUTO" unique="false" * @generated */ public XmlPersistenceUnitValidationModeType_2_0 getValidationMode() { return validationMode; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getValidationMode Validation Mode}' attribute. * * * @param value the new value of the 'Validation Mode' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.v2_0.XmlPersistenceUnitValidationModeType_2_0 * @see #getValidationMode() * @generated */ public void setValidationMode(XmlPersistenceUnitValidationModeType_2_0 newValidationMode) { XmlPersistenceUnitValidationModeType_2_0 oldValidationMode = validationMode; validationMode = newValidationMode == null ? VALIDATION_MODE_EDEFAULT : newValidationMode; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE, oldValidationMode, validationMode)); } /** * Returns the value of the 'Name' attribute. * *

* If the meaning of the 'Name' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Name' attribute. * @see #setName(String) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Name() * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true" * @generated */ public String getName() { return name; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getName Name}' attribute. * * * @param value the new value of the 'Name' attribute. * @see #getName() * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__NAME, oldName, name)); } /** * Returns the value of the 'Transaction Type' attribute. * The default value is "JTA". * The literals are from the enumeration {@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType}. * *

* If the meaning of the 'Transaction Type' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Transaction Type' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType * @see #setTransactionType(XmlPersistenceUnitTransactionType) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_TransactionType() * @model default="JTA" unique="false" * @generated */ public XmlPersistenceUnitTransactionType getTransactionType() { return transactionType; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getTransactionType Transaction Type}' attribute. * * * @param value the new value of the 'Transaction Type' attribute. * @see org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType * @see #getTransactionType() * @generated */ public void setTransactionType(XmlPersistenceUnitTransactionType newTransactionType) { XmlPersistenceUnitTransactionType oldTransactionType = transactionType; transactionType = newTransactionType == null ? TRANSACTION_TYPE_EDEFAULT : newTransactionType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, transactionType)); } /** * Returns the value of the 'Description' attribute. * *

* If the meaning of the 'Description' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Description' attribute. * @see #setDescription(String) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Description() * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" * @generated */ public String getDescription() { return description; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getDescription Description}' attribute. * * * @param value the new value of the 'Description' attribute. * @see #getDescription() * @generated */ public void setDescription(String newDescription) { String oldDescription = description; description = newDescription; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION, oldDescription, description)); } /** * Returns the value of the 'Provider' attribute. * *

* If the meaning of the 'Provider' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Provider' attribute. * @see #setProvider(String) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Provider() * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" * @generated */ public String getProvider() { return provider; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getProvider Provider}' attribute. * * * @param value the new value of the 'Provider' attribute. * @see #getProvider() * @generated */ public void setProvider(String newProvider) { String oldProvider = provider; provider = newProvider; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER, oldProvider, provider)); } /** * Returns the value of the 'Jta Data Source' attribute. * *

* If the meaning of the 'Jta Data Source' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Jta Data Source' attribute. * @see #setJtaDataSource(String) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JtaDataSource() * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" * @generated */ public String getJtaDataSource() { return jtaDataSource; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getJtaDataSource Jta Data Source}' attribute. * * * @param value the new value of the 'Jta Data Source' attribute. * @see #getJtaDataSource() * @generated */ public void setJtaDataSource(String newJtaDataSource) { String oldJtaDataSource = jtaDataSource; jtaDataSource = newJtaDataSource; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE, oldJtaDataSource, jtaDataSource)); } /** * Returns the value of the 'Non Jta Data Source' attribute. * *

* If the meaning of the 'Non Jta Data Source' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Non Jta Data Source' attribute. * @see #setNonJtaDataSource(String) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_NonJtaDataSource() * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" * @generated */ public String getNonJtaDataSource() { return nonJtaDataSource; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource Non Jta Data Source}' attribute. * * * @param value the new value of the 'Non Jta Data Source' attribute. * @see #getNonJtaDataSource() * @generated */ public void setNonJtaDataSource(String newNonJtaDataSource) { String oldNonJtaDataSource = nonJtaDataSource; nonJtaDataSource = newNonJtaDataSource; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE, oldNonJtaDataSource, nonJtaDataSource)); } /** * Returns the value of the 'Mapping Files' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef}. * *

* If the meaning of the 'Mapping Files' containment reference list isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Mapping Files' containment reference list. * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_MappingFiles() * @model containment="true" * @generated */ public EList getMappingFiles() { if (mappingFiles == null) { mappingFiles = new EObjectContainmentEList(XmlMappingFileRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES); } return mappingFiles; } /** * Returns the value of the 'Jar Files' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef}. * *

* If the meaning of the 'Jar Files' attribute list isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Jar Files' containment reference list. * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JarFiles() * @model containment="true" * @generated */ public EList getJarFiles() { if (jarFiles == null) { jarFiles = new EObjectContainmentEList(XmlJarFileRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES); } return jarFiles; } /** * Returns the value of the 'Classes' containment reference list. * The list contents are of type {@link org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef}. * *

* If the meaning of the 'Classes' containment reference list isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Classes' containment reference list. * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Classes() * @model containment="true" * @generated */ public EList getClasses() { if (classes == null) { classes = new EObjectContainmentEList(XmlJavaClassRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES); } return classes; } /** * Returns the value of the 'Exclude Unlisted Classes' attribute. * *

* If the meaning of the 'Exclude Unlisted Classes' attribute isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Exclude Unlisted Classes' attribute. * @see #setExcludeUnlistedClasses(Boolean) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_ExcludeUnlistedClasses() * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" * @generated */ public Boolean getExcludeUnlistedClasses() { return excludeUnlistedClasses; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getExcludeUnlistedClasses Exclude Unlisted Classes}' attribute. * * * @param value the new value of the 'Exclude Unlisted Classes' attribute. * @see #getExcludeUnlistedClasses() * @generated */ public void setExcludeUnlistedClasses(Boolean newExcludeUnlistedClasses) { Boolean oldExcludeUnlistedClasses = excludeUnlistedClasses; excludeUnlistedClasses = newExcludeUnlistedClasses; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, excludeUnlistedClasses)); } /** * Returns the value of the 'Properties' containment reference. * *

* If the meaning of the 'XmlProperties' containment reference isn't clear, * there really should be more of a description here... *

* * @return the value of the 'Properties' containment reference. * @see #setProperties(XmlProperties) * @see org.eclipse.jpt.jpa.core.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Properties() * @model containment="true" * @generated */ public XmlProperties getProperties() { return properties; } /** * * * @generated */ public NotificationChain basicSetProperties(XmlProperties newProperties, NotificationChain msgs) { XmlProperties oldProperties = properties; properties = newProperties; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, oldProperties, newProperties); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * Sets the value of the '{@link org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit#getProperties Properties}' containment reference. * * * @param value the new value of the 'Properties' containment reference. * @see #getProperties() * @generated */ public void setProperties(XmlProperties newProperties) { if (newProperties != properties) { NotificationChain msgs = null; if (properties != null) msgs = ((InternalEObject)properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, null, msgs); if (newProperties != null) msgs = ((InternalEObject)newProperties).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, null, msgs); msgs = basicSetProperties(newProperties, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, newProperties, newProperties)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES: return ((InternalEList)getMappingFiles()).basicRemove(otherEnd, msgs); case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES: return ((InternalEList)getJarFiles()).basicRemove(otherEnd, msgs); case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES: return ((InternalEList)getClasses()).basicRemove(otherEnd, msgs); case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES: return basicSetProperties(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE: return getSharedCacheMode(); case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE: return getValidationMode(); case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION: return getDescription(); case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER: return getProvider(); case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE: return getJtaDataSource(); case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE: return getNonJtaDataSource(); case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES: return getMappingFiles(); case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES: return getJarFiles(); case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES: return getClasses(); case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES: return getExcludeUnlistedClasses(); case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES: return getProperties(); case PersistencePackage.XML_PERSISTENCE_UNIT__NAME: return getName(); case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE: return getTransactionType(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE: setSharedCacheMode((XmlPersistenceUnitCachingType_2_0)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE: setValidationMode((XmlPersistenceUnitValidationModeType_2_0)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION: setDescription((String)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER: setProvider((String)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE: setJtaDataSource((String)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE: setNonJtaDataSource((String)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES: getMappingFiles().clear(); getMappingFiles().addAll((Collection)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES: getJarFiles().clear(); getJarFiles().addAll((Collection)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES: getClasses().clear(); getClasses().addAll((Collection)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES: setExcludeUnlistedClasses((Boolean)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES: setProperties((XmlProperties)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__NAME: setName((String)newValue); return; case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE: setTransactionType((XmlPersistenceUnitTransactionType)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE: setSharedCacheMode(SHARED_CACHE_MODE_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE: setValidationMode(VALIDATION_MODE_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION: setDescription(DESCRIPTION_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER: setProvider(PROVIDER_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE: setJtaDataSource(JTA_DATA_SOURCE_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE: setNonJtaDataSource(NON_JTA_DATA_SOURCE_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES: getMappingFiles().clear(); return; case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES: getJarFiles().clear(); return; case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES: getClasses().clear(); return; case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES: setExcludeUnlistedClasses(EXCLUDE_UNLISTED_CLASSES_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES: setProperties((XmlProperties)null); return; case PersistencePackage.XML_PERSISTENCE_UNIT__NAME: setName(NAME_EDEFAULT); return; case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE: setTransactionType(TRANSACTION_TYPE_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PersistencePackage.XML_PERSISTENCE_UNIT__SHARED_CACHE_MODE: return sharedCacheMode != SHARED_CACHE_MODE_EDEFAULT; case PersistencePackage.XML_PERSISTENCE_UNIT__VALIDATION_MODE: return validationMode != VALIDATION_MODE_EDEFAULT; case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION: return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description); case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER: return PROVIDER_EDEFAULT == null ? provider != null : !PROVIDER_EDEFAULT.equals(provider); case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE: return JTA_DATA_SOURCE_EDEFAULT == null ? jtaDataSource != null : !JTA_DATA_SOURCE_EDEFAULT.equals(jtaDataSource); case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE: return NON_JTA_DATA_SOURCE_EDEFAULT == null ? nonJtaDataSource != null : !NON_JTA_DATA_SOURCE_EDEFAULT.equals(nonJtaDataSource); case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES: return mappingFiles != null && !mappingFiles.isEmpty(); case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES: return jarFiles != null && !jarFiles.isEmpty(); case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES: return classes != null && !classes.isEmpty(); case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES: return EXCLUDE_UNLISTED_CLASSES_EDEFAULT == null ? excludeUnlistedClasses != null : !EXCLUDE_UNLISTED_CLASSES_EDEFAULT.equals(excludeUnlistedClasses); case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES: return properties != null; case PersistencePackage.XML_PERSISTENCE_UNIT__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE: return transactionType != TRANSACTION_TYPE_EDEFAULT; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (sharedCacheMode: "); result.append(sharedCacheMode); result.append(", validationMode: "); result.append(validationMode); result.append(", description: "); result.append(description); result.append(", provider: "); result.append(provider); result.append(", jtaDataSource: "); result.append(jtaDataSource); result.append(", nonJtaDataSource: "); result.append(nonJtaDataSource); result.append(", excludeUnlistedClasses: "); result.append(excludeUnlistedClasses); result.append(", name: "); result.append(name); result.append(", transactionType: "); result.append(transactionType); result.append(')'); return result.toString(); } // ********** translators ********** public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { return new SimpleTranslator(elementName, structuralFeature, buildTranslatorChildren()); } private static Translator[] buildTranslatorChildren() { PersistencePackage pkg = PersistencePackage.eINSTANCE; return new Translator[] { buildNameTranslator(), buildTransactionTypeTranslator(), buildDescriptionTranslator(), buildProviderTranslator(), buildJtaDataSourceTranslator(), buildNonJtaDataSourceTranslator(), XmlMappingFileRef.buildTranslator(JPA.MAPPING_FILE, pkg.getXmlPersistenceUnit_MappingFiles()), XmlJarFileRef.buildTranslator(JPA.JAR_FILE, pkg.getXmlPersistenceUnit_JarFiles()), XmlJavaClassRef.buildTranslator(JPA.CLASS, pkg.getXmlPersistenceUnit_Classes()), buildExcludeUnlistedClassesTranslator(), buildSharedCacheModeTranslator(), buildValidationModeTranslator(), XmlProperties.buildTranslator(JPA.PROPERTIES, pkg.getXmlPersistenceUnit_Properties())}; } protected static Translator buildNameTranslator() { return new Translator( JPA.PERSISTENCE_UNIT__NAME, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Name(), Translator.DOM_ATTRIBUTE); } protected static Translator buildTransactionTypeTranslator() { return new Translator( JPA.PERSISTENCE_UNIT__TRANSACTION_TYPE, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_TransactionType(), Translator.DOM_ATTRIBUTE | Translator.UNSET_IF_NULL); } protected static Translator buildDescriptionTranslator() { return new Translator( JPA.DESCRIPTION, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Description()); } protected static Translator buildProviderTranslator() { return new Translator( JPA.PROVIDER, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_Provider()); } protected static Translator buildJtaDataSourceTranslator() { return new Translator( JPA.JTA_DATA_SOURCE, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_JtaDataSource()); } protected static Translator buildNonJtaDataSourceTranslator() { return new Translator( JPA.NON_JTA_DATA_SOURCE, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_NonJtaDataSource()); } protected static Translator buildExcludeUnlistedClassesTranslator() { return new BooleanTranslator( JPA.EXCLUDE_UNLISTED_CLASSES, PersistencePackage.eINSTANCE.getXmlPersistenceUnit_ExcludeUnlistedClasses()); } protected static Translator buildSharedCacheModeTranslator() { return new Translator( JPA2_0.PERSISTENCE_UNIT__SHARED_CACHE_MODE, PersistenceV2_0Package.eINSTANCE.getXmlPersistenceUnit_2_0_SharedCacheMode()); } protected static Translator buildValidationModeTranslator() { return new Translator( JPA2_0.PERSISTENCE_UNIT__VALIDATION_MODE, PersistenceV2_0Package.eINSTANCE.getXmlPersistenceUnit_2_0_ValidationMode()); } public int getLocationToInsertMappingFileRef() { if (getMappingFiles().size() > 0) { XmlMappingFileRef mappingFileRef = CollectionTools.last(this.getMappingFiles()); return mappingFileRef.getNodeEndOffset(); } IDOMNode elementNode = null; if (getNonJtaDataSource() != null) { elementNode = getElementNode(JPA.NON_JTA_DATA_SOURCE); } else if (getJtaDataSource() != null) { elementNode = getElementNode(JPA.JTA_DATA_SOURCE); } else if (getProvider() != null) { elementNode = getElementNode(JPA.PROVIDER); } else if (getDescription() != null) { elementNode = getElementNode(JPA.DESCRIPTION); } if (elementNode != null) { return elementNode.getLastStructuredDocumentRegion().getEnd(); } return this.node.getFirstStructuredDocumentRegion().getEnd(); } }