blob: 4085c6ded746b1bd1d4c72139e3e276741b2ee49 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.datamartdsl.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 org.eclipse.osbp.xtext.datamartdsl.DatamartAttribute;
import org.eclipse.osbp.xtext.datamartdsl.DatamartAxis;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.SqlAggregationEnum;
import org.eclipse.osbp.xtext.datamartdsl.ValueScaleEnum;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Attribute</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#isAggregated <em>Aggregated</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#isScaled <em>Scaled</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#getAggregate <em>Aggregate</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#getScale <em>Scale</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#getAxis <em>Axis</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#isHasColumnWeight <em>Has Column Weight</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#getColumnWeight <em>Column Weight</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#isAliased <em>Aliased</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartAttributeImpl#getAliasName <em>Alias Name</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartAttributeImpl extends DatamartAttributeBaseImpl implements DatamartAttribute {
/**
* The default value of the '{@link #isAggregated() <em>Aggregated</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isAggregated()
* @generated
* @ordered
*/
protected static final boolean AGGREGATED_EDEFAULT = false;
/**
* The cached value of the '{@link #isAggregated() <em>Aggregated</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isAggregated()
* @generated
* @ordered
*/
protected boolean aggregated = AGGREGATED_EDEFAULT;
/**
* The default value of the '{@link #isScaled() <em>Scaled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isScaled()
* @generated
* @ordered
*/
protected static final boolean SCALED_EDEFAULT = false;
/**
* The cached value of the '{@link #isScaled() <em>Scaled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isScaled()
* @generated
* @ordered
*/
protected boolean scaled = SCALED_EDEFAULT;
/**
* The default value of the '{@link #getAggregate() <em>Aggregate</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAggregate()
* @generated
* @ordered
*/
protected static final SqlAggregationEnum AGGREGATE_EDEFAULT = SqlAggregationEnum.AVG;
/**
* The cached value of the '{@link #getAggregate() <em>Aggregate</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAggregate()
* @generated
* @ordered
*/
protected SqlAggregationEnum aggregate = AGGREGATE_EDEFAULT;
/**
* The default value of the '{@link #getScale() <em>Scale</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScale()
* @generated
* @ordered
*/
protected static final ValueScaleEnum SCALE_EDEFAULT = ValueScaleEnum.AXIS;
/**
* The cached value of the '{@link #getScale() <em>Scale</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getScale()
* @generated
* @ordered
*/
protected ValueScaleEnum scale = SCALE_EDEFAULT;
/**
* The cached value of the '{@link #getAxis() <em>Axis</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAxis()
* @generated
* @ordered
*/
protected DatamartAxis axis;
/**
* The default value of the '{@link #isHasColumnWeight() <em>Has Column Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasColumnWeight()
* @generated
* @ordered
*/
protected static final boolean HAS_COLUMN_WEIGHT_EDEFAULT = false;
/**
* The cached value of the '{@link #isHasColumnWeight() <em>Has Column Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isHasColumnWeight()
* @generated
* @ordered
*/
protected boolean hasColumnWeight = HAS_COLUMN_WEIGHT_EDEFAULT;
/**
* The default value of the '{@link #getColumnWeight() <em>Column Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnWeight()
* @generated
* @ordered
*/
protected static final int COLUMN_WEIGHT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getColumnWeight() <em>Column Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getColumnWeight()
* @generated
* @ordered
*/
protected int columnWeight = COLUMN_WEIGHT_EDEFAULT;
/**
* The default value of the '{@link #isAliased() <em>Aliased</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isAliased()
* @generated
* @ordered
*/
protected static final boolean ALIASED_EDEFAULT = false;
/**
* The cached value of the '{@link #isAliased() <em>Aliased</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isAliased()
* @generated
* @ordered
*/
protected boolean aliased = ALIASED_EDEFAULT;
/**
* The default value of the '{@link #getAliasName() <em>Alias Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAliasName()
* @generated
* @ordered
*/
protected static final String ALIAS_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getAliasName() <em>Alias Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAliasName()
* @generated
* @ordered
*/
protected String aliasName = ALIAS_NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatamartAttributeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_ATTRIBUTE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isAggregated() {
return aggregated;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAggregated(boolean newAggregated) {
boolean oldAggregated = aggregated;
aggregated = newAggregated;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATED, oldAggregated, aggregated));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isScaled() {
return scaled;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setScaled(boolean newScaled) {
boolean oldScaled = scaled;
scaled = newScaled;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALED, oldScaled, scaled));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SqlAggregationEnum getAggregate() {
return aggregate;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAggregate(SqlAggregationEnum newAggregate) {
SqlAggregationEnum oldAggregate = aggregate;
aggregate = newAggregate == null ? AGGREGATE_EDEFAULT : newAggregate;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATE, oldAggregate, aggregate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueScaleEnum getScale() {
return scale;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setScale(ValueScaleEnum newScale) {
ValueScaleEnum oldScale = scale;
scale = newScale == null ? SCALE_EDEFAULT : newScale;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALE, oldScale, scale));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartAxis getAxis() {
return axis;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAxis(DatamartAxis newAxis, NotificationChain msgs) {
DatamartAxis oldAxis = axis;
axis = newAxis;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS, oldAxis, newAxis);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAxis(DatamartAxis newAxis) {
if (newAxis != axis) {
NotificationChain msgs = null;
if (axis != null)
msgs = ((InternalEObject)axis).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS, null, msgs);
if (newAxis != null)
msgs = ((InternalEObject)newAxis).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS, null, msgs);
msgs = basicSetAxis(newAxis, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS, newAxis, newAxis));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isHasColumnWeight() {
return hasColumnWeight;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setHasColumnWeight(boolean newHasColumnWeight) {
boolean oldHasColumnWeight = hasColumnWeight;
hasColumnWeight = newHasColumnWeight;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__HAS_COLUMN_WEIGHT, oldHasColumnWeight, hasColumnWeight));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getColumnWeight() {
return columnWeight;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setColumnWeight(int newColumnWeight) {
int oldColumnWeight = columnWeight;
columnWeight = newColumnWeight;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__COLUMN_WEIGHT, oldColumnWeight, columnWeight));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isAliased() {
return aliased;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAliased(boolean newAliased) {
boolean oldAliased = aliased;
aliased = newAliased;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIASED, oldAliased, aliased));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getAliasName() {
return aliasName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAliasName(String newAliasName) {
String oldAliasName = aliasName;
aliasName = newAliasName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIAS_NAME, oldAliasName, aliasName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS:
return basicSetAxis(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 DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATED:
return isAggregated();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALED:
return isScaled();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATE:
return getAggregate();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALE:
return getScale();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS:
return getAxis();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__HAS_COLUMN_WEIGHT:
return isHasColumnWeight();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__COLUMN_WEIGHT:
return getColumnWeight();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIASED:
return isAliased();
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIAS_NAME:
return getAliasName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATED:
setAggregated((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALED:
setScaled((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATE:
setAggregate((SqlAggregationEnum)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALE:
setScale((ValueScaleEnum)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS:
setAxis((DatamartAxis)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__HAS_COLUMN_WEIGHT:
setHasColumnWeight((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__COLUMN_WEIGHT:
setColumnWeight((Integer)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIASED:
setAliased((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIAS_NAME:
setAliasName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATED:
setAggregated(AGGREGATED_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALED:
setScaled(SCALED_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATE:
setAggregate(AGGREGATE_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALE:
setScale(SCALE_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS:
setAxis((DatamartAxis)null);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__HAS_COLUMN_WEIGHT:
setHasColumnWeight(HAS_COLUMN_WEIGHT_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__COLUMN_WEIGHT:
setColumnWeight(COLUMN_WEIGHT_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIASED:
setAliased(ALIASED_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIAS_NAME:
setAliasName(ALIAS_NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATED:
return aggregated != AGGREGATED_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALED:
return scaled != SCALED_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AGGREGATE:
return aggregate != AGGREGATE_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__SCALE:
return scale != SCALE_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__AXIS:
return axis != null;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__HAS_COLUMN_WEIGHT:
return hasColumnWeight != HAS_COLUMN_WEIGHT_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__COLUMN_WEIGHT:
return columnWeight != COLUMN_WEIGHT_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIASED:
return aliased != ALIASED_EDEFAULT;
case DatamartDSLPackage.DATAMART_ATTRIBUTE__ALIAS_NAME:
return ALIAS_NAME_EDEFAULT == null ? aliasName != null : !ALIAS_NAME_EDEFAULT.equals(aliasName);
}
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(" (aggregated: ");
result.append(aggregated);
result.append(", scaled: ");
result.append(scaled);
result.append(", aggregate: ");
result.append(aggregate);
result.append(", scale: ");
result.append(scale);
result.append(", hasColumnWeight: ");
result.append(hasColumnWeight);
result.append(", columnWeight: ");
result.append(columnWeight);
result.append(", aliased: ");
result.append(aliased);
result.append(", aliasName: ");
result.append(aliasName);
result.append(')');
return result.toString();
}
} //DatamartAttributeImpl