blob: 35f139e0e37bd25904ec9a68061e9a39880009a8 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 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.core.internal.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.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.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Join Table</b></em>'.
* <!-- end-user-doc -->
*
*
* @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTableImpl()
* @model kind="class"
* @generated
*/
public class JoinTableImpl extends JpaEObject implements JoinTable
{
/**
* 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 #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUniqueConstraints()
* @generated
* @ordered
*/
protected EList<UniqueConstraint> uniqueConstraints;
/**
* The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getJoinColumns()
* @generated
* @ordered
*/
protected EList<JoinColumn> joinColumns;
/**
* The cached value of the '{@link #getInverseJoinColumns() <em>Inverse Join Columns</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getInverseJoinColumns()
* @generated
* @ordered
*/
protected EList<JoinColumn> inverseJoinColumns;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected JoinTableImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return OrmPackage.Literals.JOIN_TABLE_IMPL;
}
/**
* 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.core.internal.resource.orm.OrmPackage#getAbstractTable_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.core.internal.resource.orm.JoinTableImpl#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, OrmPackage.JOIN_TABLE_IMPL__NAME, oldName, name));
}
/**
* 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.core.internal.resource.orm.OrmPackage#getAbstractTable_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.core.internal.resource.orm.JoinTableImpl#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, OrmPackage.JOIN_TABLE_IMPL__CATALOG, oldCatalog, catalog));
}
/**
* 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.core.internal.resource.orm.OrmPackage#getAbstractTable_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.core.internal.resource.orm.JoinTableImpl#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, OrmPackage.JOIN_TABLE_IMPL__SCHEMA, oldSchema, schema));
}
/**
* Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Unique Constraints</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>Unique Constraints</em>' containment reference list.
* @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_UniqueConstraints()
* @model containment="true"
* @generated
*/
public EList<UniqueConstraint> getUniqueConstraints()
{
if (uniqueConstraints == null)
{
uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS);
}
return uniqueConstraints;
}
/**
* Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Join Columns</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>Join Columns</em>' containment reference list.
* @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_JoinColumns()
* @model containment="true"
* @generated
*/
public EList<JoinColumn> getJoinColumns()
{
if (joinColumns == null)
{
joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS);
}
return joinColumns;
}
/**
* Returns the value of the '<em><b>Inverse Join Columns</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inverse Join Columns</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>Inverse Join Columns</em>' containment reference list.
* @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_InverseJoinColumns()
* @model containment="true"
* @generated
*/
public EList<JoinColumn> getInverseJoinColumns()
{
if (inverseJoinColumns == null)
{
inverseJoinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS);
}
return inverseJoinColumns;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, msgs);
case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
return ((InternalEList<?>)getInverseJoinColumns()).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 OrmPackage.JOIN_TABLE_IMPL__NAME:
return getName();
case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
return getCatalog();
case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
return getSchema();
case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
return getUniqueConstraints();
case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
return getJoinColumns();
case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
return getInverseJoinColumns();
}
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 OrmPackage.JOIN_TABLE_IMPL__NAME:
setName((String)newValue);
return;
case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
setCatalog((String)newValue);
return;
case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
setSchema((String)newValue);
return;
case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
getUniqueConstraints().clear();
getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue);
return;
case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
getJoinColumns().clear();
getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
return;
case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
getInverseJoinColumns().clear();
getInverseJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case OrmPackage.JOIN_TABLE_IMPL__NAME:
setName(NAME_EDEFAULT);
return;
case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
setCatalog(CATALOG_EDEFAULT);
return;
case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
setSchema(SCHEMA_EDEFAULT);
return;
case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
getUniqueConstraints().clear();
return;
case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
getJoinColumns().clear();
return;
case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
getInverseJoinColumns().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case OrmPackage.JOIN_TABLE_IMPL__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
return uniqueConstraints != null && !uniqueConstraints.isEmpty();
case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
return joinColumns != null && !joinColumns.isEmpty();
case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
return inverseJoinColumns != null && !inverseJoinColumns.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();
}
} // JoinTable