/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.resource.relational.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import orgomg.cwm.foundation.datatypes.QueryExpression;
import orgomg.cwm.resource.relational.RelationalPackage;
import orgomg.cwm.resource.relational.View;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>View</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.resource.relational.impl.ViewImpl#isIsReadOnly <em>Is Read Only</em>}</li>
* <li>{@link orgomg.cwm.resource.relational.impl.ViewImpl#isCheckOption <em>Check Option</em>}</li>
* <li>{@link orgomg.cwm.resource.relational.impl.ViewImpl#getQueryExpression <em>Query Expression</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ViewImpl extends NamedColumnSetImpl implements View {
/**
* The default value of the '{@link #isIsReadOnly() <em>Is Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsReadOnly()
* @generated
* @ordered
*/
protected static final boolean IS_READ_ONLY_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsReadOnly() <em>Is Read Only</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsReadOnly()
* @generated
* @ordered
*/
protected boolean isReadOnly = IS_READ_ONLY_EDEFAULT;
/**
* The default value of the '{@link #isCheckOption() <em>Check Option</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isCheckOption()
* @generated
* @ordered
*/
protected static final boolean CHECK_OPTION_EDEFAULT = false;
/**
* The cached value of the '{@link #isCheckOption() <em>Check Option</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isCheckOption()
* @generated
* @ordered
*/
protected boolean checkOption = CHECK_OPTION_EDEFAULT;
/**
* The cached value of the '{@link #getQueryExpression() <em>Query Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQueryExpression()
* @generated
* @ordered
*/
protected QueryExpression queryExpression;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ViewImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return RelationalPackage.Literals.VIEW;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsReadOnly() {
return isReadOnly;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsReadOnly(boolean newIsReadOnly) {
boolean oldIsReadOnly = isReadOnly;
isReadOnly = newIsReadOnly;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.VIEW__IS_READ_ONLY, oldIsReadOnly, isReadOnly));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isCheckOption() {
return checkOption;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCheckOption(boolean newCheckOption) {
boolean oldCheckOption = checkOption;
checkOption = newCheckOption;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.VIEW__CHECK_OPTION, oldCheckOption, checkOption));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QueryExpression getQueryExpression() {
return queryExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetQueryExpression(QueryExpression newQueryExpression, NotificationChain msgs) {
QueryExpression oldQueryExpression = queryExpression;
queryExpression = newQueryExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RelationalPackage.VIEW__QUERY_EXPRESSION, oldQueryExpression, newQueryExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setQueryExpression(QueryExpression newQueryExpression) {
if (newQueryExpression != queryExpression) {
NotificationChain msgs = null;
if (queryExpression != null)
msgs = ((InternalEObject)queryExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RelationalPackage.VIEW__QUERY_EXPRESSION, null, msgs);
if (newQueryExpression != null)
msgs = ((InternalEObject)newQueryExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RelationalPackage.VIEW__QUERY_EXPRESSION, null, msgs);
msgs = basicSetQueryExpression(newQueryExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RelationalPackage.VIEW__QUERY_EXPRESSION, newQueryExpression, newQueryExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RelationalPackage.VIEW__QUERY_EXPRESSION:
return basicSetQueryExpression(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 RelationalPackage.VIEW__IS_READ_ONLY:
return isIsReadOnly();
case RelationalPackage.VIEW__CHECK_OPTION:
return isCheckOption();
case RelationalPackage.VIEW__QUERY_EXPRESSION:
return getQueryExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RelationalPackage.VIEW__IS_READ_ONLY:
setIsReadOnly((Boolean)newValue);
return;
case RelationalPackage.VIEW__CHECK_OPTION:
setCheckOption((Boolean)newValue);
return;
case RelationalPackage.VIEW__QUERY_EXPRESSION:
setQueryExpression((QueryExpression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case RelationalPackage.VIEW__IS_READ_ONLY:
setIsReadOnly(IS_READ_ONLY_EDEFAULT);
return;
case RelationalPackage.VIEW__CHECK_OPTION:
setCheckOption(CHECK_OPTION_EDEFAULT);
return;
case RelationalPackage.VIEW__QUERY_EXPRESSION:
setQueryExpression((QueryExpression)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RelationalPackage.VIEW__IS_READ_ONLY:
return isReadOnly != IS_READ_ONLY_EDEFAULT;
case RelationalPackage.VIEW__CHECK_OPTION:
return checkOption != CHECK_OPTION_EDEFAULT;
case RelationalPackage.VIEW__QUERY_EXPRESSION:
return queryExpression != null;
}
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(" (isReadOnly: ");
result.append(isReadOnly);
result.append(", checkOption: ");
result.append(checkOption);
result.append(')');
return result.toString();
}
} //ViewImpl