/**
* <copyright>
* </copyright>
*
* $Id$
*/
package net.opengis.cat.csw20.impl;
import java.lang.String;
import java.util.Collection;
import net.opengis.cat.csw20.Csw20Package;
import net.opengis.cat.csw20.QueryConstraintType;
import net.opengis.cat.csw20.RecordPropertyType;
import net.opengis.cat.csw20.UpdateType;
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.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Update Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link net.opengis.cat.csw20.impl.UpdateTypeImpl#getAny <em>Any</em>}</li>
* <li>{@link net.opengis.cat.csw20.impl.UpdateTypeImpl#getRecordProperty <em>Record Property</em>}</li>
* <li>{@link net.opengis.cat.csw20.impl.UpdateTypeImpl#getConstraint <em>Constraint</em>}</li>
* <li>{@link net.opengis.cat.csw20.impl.UpdateTypeImpl#getHandle <em>Handle</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class UpdateTypeImpl extends EObjectImpl implements UpdateType {
/**
* The cached value of the '{@link #getAny() <em>Any</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAny()
* @generated
* @ordered
*/
protected FeatureMap any;
/**
* The cached value of the '{@link #getRecordProperty() <em>Record Property</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRecordProperty()
* @generated
* @ordered
*/
protected EList<RecordPropertyType> recordProperty;
/**
* The cached value of the '{@link #getConstraint() <em>Constraint</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstraint()
* @generated
* @ordered
*/
protected QueryConstraintType constraint;
/**
* The default value of the '{@link #getHandle() <em>Handle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHandle()
* @generated
* @ordered
*/
protected static final String HANDLE_EDEFAULT = null;
/**
* The cached value of the '{@link #getHandle() <em>Handle</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getHandle()
* @generated
* @ordered
*/
protected String handle = HANDLE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UpdateTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return Csw20Package.Literals.UPDATE_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getAny() {
if (any == null) {
any = new BasicFeatureMap(this, Csw20Package.UPDATE_TYPE__ANY);
}
return any;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<RecordPropertyType> getRecordProperty() {
if (recordProperty == null) {
recordProperty = new EObjectContainmentEList<RecordPropertyType>(RecordPropertyType.class, this, Csw20Package.UPDATE_TYPE__RECORD_PROPERTY);
}
return recordProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QueryConstraintType getConstraint() {
return constraint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetConstraint(QueryConstraintType newConstraint, NotificationChain msgs) {
QueryConstraintType oldConstraint = constraint;
constraint = newConstraint;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Csw20Package.UPDATE_TYPE__CONSTRAINT, oldConstraint, newConstraint);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setConstraint(QueryConstraintType newConstraint) {
if (newConstraint != constraint) {
NotificationChain msgs = null;
if (constraint != null)
msgs = ((InternalEObject)constraint).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Csw20Package.UPDATE_TYPE__CONSTRAINT, null, msgs);
if (newConstraint != null)
msgs = ((InternalEObject)newConstraint).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Csw20Package.UPDATE_TYPE__CONSTRAINT, null, msgs);
msgs = basicSetConstraint(newConstraint, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Csw20Package.UPDATE_TYPE__CONSTRAINT, newConstraint, newConstraint));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getHandle() {
return handle;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHandle(String newHandle) {
String oldHandle = handle;
handle = newHandle;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Csw20Package.UPDATE_TYPE__HANDLE, oldHandle, handle));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Csw20Package.UPDATE_TYPE__ANY:
return ((InternalEList<?>)getAny()).basicRemove(otherEnd, msgs);
case Csw20Package.UPDATE_TYPE__RECORD_PROPERTY:
return ((InternalEList<?>)getRecordProperty()).basicRemove(otherEnd, msgs);
case Csw20Package.UPDATE_TYPE__CONSTRAINT:
return basicSetConstraint(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 Csw20Package.UPDATE_TYPE__ANY:
if (coreType) return getAny();
return ((FeatureMap.Internal)getAny()).getWrapper();
case Csw20Package.UPDATE_TYPE__RECORD_PROPERTY:
return getRecordProperty();
case Csw20Package.UPDATE_TYPE__CONSTRAINT:
return getConstraint();
case Csw20Package.UPDATE_TYPE__HANDLE:
return getHandle();
}
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 Csw20Package.UPDATE_TYPE__ANY:
((FeatureMap.Internal)getAny()).set(newValue);
return;
case Csw20Package.UPDATE_TYPE__RECORD_PROPERTY:
getRecordProperty().clear();
getRecordProperty().addAll((Collection<? extends RecordPropertyType>)newValue);
return;
case Csw20Package.UPDATE_TYPE__CONSTRAINT:
setConstraint((QueryConstraintType)newValue);
return;
case Csw20Package.UPDATE_TYPE__HANDLE:
setHandle((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Csw20Package.UPDATE_TYPE__ANY:
getAny().clear();
return;
case Csw20Package.UPDATE_TYPE__RECORD_PROPERTY:
getRecordProperty().clear();
return;
case Csw20Package.UPDATE_TYPE__CONSTRAINT:
setConstraint((QueryConstraintType)null);
return;
case Csw20Package.UPDATE_TYPE__HANDLE:
setHandle(HANDLE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Csw20Package.UPDATE_TYPE__ANY:
return any != null && !any.isEmpty();
case Csw20Package.UPDATE_TYPE__RECORD_PROPERTY:
return recordProperty != null && !recordProperty.isEmpty();
case Csw20Package.UPDATE_TYPE__CONSTRAINT:
return constraint != null;
case Csw20Package.UPDATE_TYPE__HANDLE:
return HANDLE_EDEFAULT == null ? handle != null : !HANDLE_EDEFAULT.equals(handle);
}
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(" (any: ");
result.append(any);
result.append(", handle: ");
result.append(handle);
result.append(')');
return result.toString();
}
} //UpdateTypeImpl