org.openxma.dsl.dom.model.impl.UpdateStatementImpl Maven / Gradle / Ivy
/**
*
*
*
* $Id$
*/
package org.openxma.dsl.dom.model.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.openxma.dsl.dom.DomPackage;
import org.openxma.dsl.dom.model.Entity;
import org.openxma.dsl.dom.model.Expression;
import org.openxma.dsl.dom.model.PropertyAssignment;
import org.openxma.dsl.dom.model.UpdateStatement;
/**
*
* An implementation of the model object 'Update Statement'.
*
*
* The following features are implemented:
*
* - {@link org.openxma.dsl.dom.model.impl.UpdateStatementImpl#isVersioned Versioned}
* - {@link org.openxma.dsl.dom.model.impl.UpdateStatementImpl#getEntity Entity}
* - {@link org.openxma.dsl.dom.model.impl.UpdateStatementImpl#getName Name}
* - {@link org.openxma.dsl.dom.model.impl.UpdateStatementImpl#getAssignment Assignment}
* - {@link org.openxma.dsl.dom.model.impl.UpdateStatementImpl#getWhere Where}
*
*
*
* @generated
*/
public class UpdateStatementImpl extends QlStatementImpl implements UpdateStatement {
/**
* The default value of the '{@link #isVersioned() Versioned}' attribute.
*
*
* @see #isVersioned()
* @generated
* @ordered
*/
protected static final boolean VERSIONED_EDEFAULT = false;
/**
* The cached value of the '{@link #isVersioned() Versioned}' attribute.
*
*
* @see #isVersioned()
* @generated
* @ordered
*/
protected boolean versioned = VERSIONED_EDEFAULT;
/**
* The cached value of the '{@link #getEntity() Entity}' reference.
*
*
* @see #getEntity()
* @generated
* @ordered
*/
protected Entity entity;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getAssignment() Assignment}' containment reference list.
*
*
* @see #getAssignment()
* @generated
* @ordered
*/
protected EList assignment;
/**
* The cached value of the '{@link #getWhere() Where}' containment reference.
*
*
* @see #getWhere()
* @generated
* @ordered
*/
protected Expression where;
/**
*
*
* @generated
*/
protected UpdateStatementImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return DomPackage.Literals.UPDATE_STATEMENT;
}
/**
*
*
* @generated
*/
public boolean isVersioned() {
return versioned;
}
/**
*
*
* @generated
*/
public void setVersioned(boolean newVersioned) {
boolean oldVersioned = versioned;
versioned = newVersioned;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.UPDATE_STATEMENT__VERSIONED, oldVersioned, versioned));
}
/**
*
*
* @generated
*/
public Entity getEntity() {
if (entity != null && entity.eIsProxy()) {
InternalEObject oldEntity = (InternalEObject)entity;
entity = (Entity)eResolveProxy(oldEntity);
if (entity != oldEntity) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DomPackage.UPDATE_STATEMENT__ENTITY, oldEntity, entity));
}
}
return entity;
}
/**
*
*
* @generated
*/
public Entity basicGetEntity() {
return entity;
}
/**
*
*
* @generated
*/
public void setEntity(Entity newEntity) {
Entity oldEntity = entity;
entity = newEntity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.UPDATE_STATEMENT__ENTITY, oldEntity, entity));
}
/**
*
*
* @generated
*/
public String getName() {
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.UPDATE_STATEMENT__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public EList getAssignment() {
if (assignment == null) {
assignment = new EObjectContainmentEList(PropertyAssignment.class, this, DomPackage.UPDATE_STATEMENT__ASSIGNMENT);
}
return assignment;
}
/**
*
*
* @generated
*/
public Expression getWhere() {
return where;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetWhere(Expression newWhere, NotificationChain msgs) {
Expression oldWhere = where;
where = newWhere;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomPackage.UPDATE_STATEMENT__WHERE, oldWhere, newWhere);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setWhere(Expression newWhere) {
if (newWhere != where) {
NotificationChain msgs = null;
if (where != null)
msgs = ((InternalEObject)where).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomPackage.UPDATE_STATEMENT__WHERE, null, msgs);
if (newWhere != null)
msgs = ((InternalEObject)newWhere).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomPackage.UPDATE_STATEMENT__WHERE, null, msgs);
msgs = basicSetWhere(newWhere, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DomPackage.UPDATE_STATEMENT__WHERE, newWhere, newWhere));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DomPackage.UPDATE_STATEMENT__ASSIGNMENT:
return ((InternalEList>)getAssignment()).basicRemove(otherEnd, msgs);
case DomPackage.UPDATE_STATEMENT__WHERE:
return basicSetWhere(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case DomPackage.UPDATE_STATEMENT__VERSIONED:
return isVersioned();
case DomPackage.UPDATE_STATEMENT__ENTITY:
if (resolve) return getEntity();
return basicGetEntity();
case DomPackage.UPDATE_STATEMENT__NAME:
return getName();
case DomPackage.UPDATE_STATEMENT__ASSIGNMENT:
return getAssignment();
case DomPackage.UPDATE_STATEMENT__WHERE:
return getWhere();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DomPackage.UPDATE_STATEMENT__VERSIONED:
setVersioned((Boolean)newValue);
return;
case DomPackage.UPDATE_STATEMENT__ENTITY:
setEntity((Entity)newValue);
return;
case DomPackage.UPDATE_STATEMENT__NAME:
setName((String)newValue);
return;
case DomPackage.UPDATE_STATEMENT__ASSIGNMENT:
getAssignment().clear();
getAssignment().addAll((Collection extends PropertyAssignment>)newValue);
return;
case DomPackage.UPDATE_STATEMENT__WHERE:
setWhere((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DomPackage.UPDATE_STATEMENT__VERSIONED:
setVersioned(VERSIONED_EDEFAULT);
return;
case DomPackage.UPDATE_STATEMENT__ENTITY:
setEntity((Entity)null);
return;
case DomPackage.UPDATE_STATEMENT__NAME:
setName(NAME_EDEFAULT);
return;
case DomPackage.UPDATE_STATEMENT__ASSIGNMENT:
getAssignment().clear();
return;
case DomPackage.UPDATE_STATEMENT__WHERE:
setWhere((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DomPackage.UPDATE_STATEMENT__VERSIONED:
return versioned != VERSIONED_EDEFAULT;
case DomPackage.UPDATE_STATEMENT__ENTITY:
return entity != null;
case DomPackage.UPDATE_STATEMENT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case DomPackage.UPDATE_STATEMENT__ASSIGNMENT:
return assignment != null && !assignment.isEmpty();
case DomPackage.UPDATE_STATEMENT__WHERE:
return where != null;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (versioned: ");
result.append(versioned);
result.append(", name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //UpdateStatementImpl