| /******************************************************************************* |
| * Copyright (c) 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.eclipselink.core.resource.orm; |
| |
| import java.util.Collection; |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EDataTypeEList; |
| import org.eclipse.jpt.common.core.internal.utility.translators.BooleanTranslator; |
| import org.eclipse.jpt.common.core.internal.utility.translators.SimpleTranslator; |
| import org.eclipse.jpt.jpa.core.resource.xml.AbstractJpaEObject; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLink2_2; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.EclipseLinkOrmV2_2Package; |
| import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.v2_2.XmlIndex_2_2; |
| import org.eclipse.wst.common.internal.emf.resource.Translator; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>Xml Index</b></em>'. |
| * |
| * 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. |
| * <!-- end-user-doc --> |
| * |
| * |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex() |
| * @model kind="class" |
| * @generated |
| */ |
| public class XmlIndex extends AbstractJpaEObject implements XmlIndex_2_2 |
| { |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSchema() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SCHEMA_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSchema() |
| * @generated |
| * @ordered |
| */ |
| protected String schema = SCHEMA_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCatalog() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CATALOG_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCatalog() |
| * @generated |
| * @ordered |
| */ |
| protected String catalog = CATALOG_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getTable() <em>Table</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTable() |
| * @generated |
| * @ordered |
| */ |
| protected static final String TABLE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTable() <em>Table</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTable() |
| * @generated |
| * @ordered |
| */ |
| protected String table = TABLE_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getUnique() <em>Unique</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUnique() |
| * @generated |
| * @ordered |
| */ |
| protected static final Boolean UNIQUE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getUnique() <em>Unique</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUnique() |
| * @generated |
| * @ordered |
| */ |
| protected Boolean unique = UNIQUE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getColumnNames() <em>Column Names</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getColumnNames() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> columnNames; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected XmlIndex() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return EclipseLinkOrmPackage.Literals.XML_INDEX; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Name</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Name</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Name</em>' attribute. |
| * @see #setName(String) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_Name() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public String getName() |
| { |
| return name; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlIndex#getName <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Name</em>' attribute. |
| * @see #getName() |
| * @generated |
| */ |
| public void setName(String newName) |
| { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_INDEX__NAME, oldName, name)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Schema</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Schema</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Schema</em>' attribute. |
| * @see #setSchema(String) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_Schema() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public String getSchema() |
| { |
| return schema; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlIndex#getSchema <em>Schema</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Schema</em>' attribute. |
| * @see #getSchema() |
| * @generated |
| */ |
| public void setSchema(String newSchema) |
| { |
| String oldSchema = schema; |
| schema = newSchema; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_INDEX__SCHEMA, oldSchema, schema)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Catalog</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Catalog</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Catalog</em>' attribute. |
| * @see #setCatalog(String) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_Catalog() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public String getCatalog() |
| { |
| return catalog; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlIndex#getCatalog <em>Catalog</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Catalog</em>' attribute. |
| * @see #getCatalog() |
| * @generated |
| */ |
| public void setCatalog(String newCatalog) |
| { |
| String oldCatalog = catalog; |
| catalog = newCatalog; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_INDEX__CATALOG, oldCatalog, catalog)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Table</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Table</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Table</em>' attribute. |
| * @see #setTable(String) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_Table() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public String getTable() |
| { |
| return table; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlIndex#getTable <em>Table</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Table</em>' attribute. |
| * @see #getTable() |
| * @generated |
| */ |
| public void setTable(String newTable) |
| { |
| String oldTable = table; |
| table = newTable; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_INDEX__TABLE, oldTable, table)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Unique</b></em>' attribute. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Unique</em>' attribute isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Unique</em>' attribute. |
| * @see #setUnique(Boolean) |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_Unique() |
| * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject" |
| * @generated |
| */ |
| public Boolean getUnique() |
| { |
| return unique; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlIndex#getUnique <em>Unique</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>Unique</em>' attribute. |
| * @see #getUnique() |
| * @generated |
| */ |
| public void setUnique(Boolean newUnique) |
| { |
| Boolean oldUnique = unique; |
| unique = newUnique; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EclipseLinkOrmPackage.XML_INDEX__UNIQUE, oldUnique, unique)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Column Names</b></em>' attribute list. |
| * The list contents are of type {@link java.lang.String}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Column Names</em>' attribute list isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Column Names</em>' attribute list. |
| * @see org.eclipse.jpt.jpa.eclipselink.core.resource.orm.EclipseLinkOrmPackage#getXmlIndex_2_2_ColumnNames() |
| * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" |
| * @generated |
| */ |
| public EList<String> getColumnNames() |
| { |
| if (columnNames == null) |
| { |
| columnNames = new EDataTypeEList<String>(String.class, this, EclipseLinkOrmPackage.XML_INDEX__COLUMN_NAMES); |
| } |
| return columnNames; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_INDEX__NAME: |
| return getName(); |
| case EclipseLinkOrmPackage.XML_INDEX__SCHEMA: |
| return getSchema(); |
| case EclipseLinkOrmPackage.XML_INDEX__CATALOG: |
| return getCatalog(); |
| case EclipseLinkOrmPackage.XML_INDEX__TABLE: |
| return getTable(); |
| case EclipseLinkOrmPackage.XML_INDEX__UNIQUE: |
| return getUnique(); |
| case EclipseLinkOrmPackage.XML_INDEX__COLUMN_NAMES: |
| return getColumnNames(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_INDEX__NAME: |
| setName((String)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__SCHEMA: |
| setSchema((String)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__CATALOG: |
| setCatalog((String)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__TABLE: |
| setTable((String)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__UNIQUE: |
| setUnique((Boolean)newValue); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__COLUMN_NAMES: |
| getColumnNames().clear(); |
| getColumnNames().addAll((Collection<? extends String>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_INDEX__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__SCHEMA: |
| setSchema(SCHEMA_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__CATALOG: |
| setCatalog(CATALOG_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__TABLE: |
| setTable(TABLE_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__UNIQUE: |
| setUnique(UNIQUE_EDEFAULT); |
| return; |
| case EclipseLinkOrmPackage.XML_INDEX__COLUMN_NAMES: |
| getColumnNames().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case EclipseLinkOrmPackage.XML_INDEX__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case EclipseLinkOrmPackage.XML_INDEX__SCHEMA: |
| return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema); |
| case EclipseLinkOrmPackage.XML_INDEX__CATALOG: |
| return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog); |
| case EclipseLinkOrmPackage.XML_INDEX__TABLE: |
| return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table); |
| case EclipseLinkOrmPackage.XML_INDEX__UNIQUE: |
| return UNIQUE_EDEFAULT == null ? unique != null : !UNIQUE_EDEFAULT.equals(unique); |
| case EclipseLinkOrmPackage.XML_INDEX__COLUMN_NAMES: |
| return columnNames != null && !columnNames.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() |
| { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (name: "); |
| result.append(name); |
| result.append(", schema: "); |
| result.append(schema); |
| result.append(", catalog: "); |
| result.append(catalog); |
| result.append(", table: "); |
| result.append(table); |
| result.append(", unique: "); |
| result.append(unique); |
| result.append(", columnNames: "); |
| result.append(columnNames); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| |
| // ********** translators ********** |
| |
| public static Translator buildTranslator(String elementName, EStructuralFeature structuralFeature) { |
| return new SimpleTranslator( |
| elementName, |
| structuralFeature, |
| EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2(), |
| buildTranslatorChildren()); |
| } |
| |
| private static Translator[] buildTranslatorChildren() { |
| return new Translator[] { |
| buildColumnNameTranslator(), |
| buildNameTranslator(), |
| buildCatalogTranslator(), |
| buildSchemaTranslator(), |
| buildTableTranslator(), |
| buildUniqueTranslator() |
| }; |
| } |
| |
| protected static Translator buildColumnNameTranslator() { |
| return new Translator(EclipseLink2_2.INDEX__COLUMN_NAME, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_ColumnNames()); |
| } |
| protected static Translator buildNameTranslator() { |
| return new Translator(EclipseLink2_2.INDEX__NAME, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_Name(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildCatalogTranslator() { |
| return new Translator(EclipseLink2_2.INDEX__CATALOG, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_Catalog(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildSchemaTranslator() { |
| return new Translator(EclipseLink2_2.INDEX__SCHEMA, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_Schema(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildTableTranslator() { |
| return new Translator(EclipseLink2_2.INDEX__TABLE, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_Table(), Translator.DOM_ATTRIBUTE); |
| } |
| |
| protected static Translator buildUniqueTranslator() { |
| return new BooleanTranslator(EclipseLink2_2.INDEX__UNIQUE, EclipseLinkOrmV2_2Package.eINSTANCE.getXmlIndex_2_2_Unique(), Translator.DOM_ATTRIBUTE); |
| } |
| } // XmlIndex |