/** * <copyright> * </copyright> * * $Id: SecondaryTableImpl.java,v 1.7 2007/11/14 16:37:53 mtaal Exp $ */ package org.eclipse.emf.teneo.annotations.pannotation.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.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.emf.teneo.annotations.pannotation.PannotationPackage; import org.eclipse.emf.teneo.annotations.pannotation.PrimaryKeyJoinColumn; import org.eclipse.emf.teneo.annotations.pannotation.SecondaryTable; import org.eclipse.emf.teneo.annotations.pannotation.UniqueConstraint; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Secondary Table</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.SecondaryTableImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.SecondaryTableImpl#getCatalog <em>Catalog</em>}</li> * <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.SecondaryTableImpl#getSchema <em>Schema</em>}</li> * <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.SecondaryTableImpl#getPkJoinColumns <em>Pk Join Columns</em>}</li> * <li>{@link org.eclipse.emf.teneo.annotations.pannotation.impl.SecondaryTableImpl#getUniqueConstraints <em>Unique Constraints</em>}</li> * </ul> * </p> * * @generated */ public class SecondaryTableImpl extends PAnnotationImpl implements SecondaryTable { /** * 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 #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 #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 cached value of the '{@link #getPkJoinColumns() <em>Pk Join Columns</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getPkJoinColumns() * @generated * @ordered */ protected EList<PrimaryKeyJoinColumn> pkJoinColumns; /** * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getUniqueConstraints() * @generated * @ordered */ protected EList<UniqueConstraint> uniqueConstraints; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected SecondaryTableImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return PannotationPackage.Literals.SECONDARY_TABLE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.SECONDARY_TABLE__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getCatalog() { return catalog; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCatalog(String newCatalog) { String oldCatalog = catalog; catalog = newCatalog; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.SECONDARY_TABLE__CATALOG, oldCatalog, catalog)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getSchema() { return schema; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSchema(String newSchema) { String oldSchema = schema; schema = newSchema; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, PannotationPackage.SECONDARY_TABLE__SCHEMA, oldSchema, schema)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<PrimaryKeyJoinColumn> getPkJoinColumns() { if (pkJoinColumns == null) { pkJoinColumns = new EObjectContainmentEList<PrimaryKeyJoinColumn>(PrimaryKeyJoinColumn.class, this, PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS); } return pkJoinColumns; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<UniqueConstraint> getUniqueConstraints() { if (uniqueConstraints == null) { uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS); } return uniqueConstraints; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS: return ((InternalEList<?>)getPkJoinColumns()).basicRemove(otherEnd, msgs); case PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS: return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, 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 PannotationPackage.SECONDARY_TABLE__NAME: return getName(); case PannotationPackage.SECONDARY_TABLE__CATALOG: return getCatalog(); case PannotationPackage.SECONDARY_TABLE__SCHEMA: return getSchema(); case PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS: return getPkJoinColumns(); case PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS: return getUniqueConstraints(); } 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 PannotationPackage.SECONDARY_TABLE__NAME: setName((String)newValue); return; case PannotationPackage.SECONDARY_TABLE__CATALOG: setCatalog((String)newValue); return; case PannotationPackage.SECONDARY_TABLE__SCHEMA: setSchema((String)newValue); return; case PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS: getPkJoinColumns().clear(); getPkJoinColumns().addAll((Collection<? extends PrimaryKeyJoinColumn>)newValue); return; case PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS: getUniqueConstraints().clear(); getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case PannotationPackage.SECONDARY_TABLE__NAME: setName(NAME_EDEFAULT); return; case PannotationPackage.SECONDARY_TABLE__CATALOG: setCatalog(CATALOG_EDEFAULT); return; case PannotationPackage.SECONDARY_TABLE__SCHEMA: setSchema(SCHEMA_EDEFAULT); return; case PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS: getPkJoinColumns().clear(); return; case PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS: getUniqueConstraints().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case PannotationPackage.SECONDARY_TABLE__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case PannotationPackage.SECONDARY_TABLE__CATALOG: return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog); case PannotationPackage.SECONDARY_TABLE__SCHEMA: return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema); case PannotationPackage.SECONDARY_TABLE__PK_JOIN_COLUMNS: return pkJoinColumns != null && !pkJoinColumns.isEmpty(); case PannotationPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS: return uniqueConstraints != null && !uniqueConstraints.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(", catalog: "); result.append(catalog); result.append(", schema: "); result.append(schema); result.append(')'); return result.toString(); } } //SecondaryTableImpl