blob: 2df14bf8d3257fe79da0ad6d03e08b73704a9995 [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 v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Based on ideas from Xtext, Xtend, Xcore
*
* Contributors:
* Joerg Riegel - Initial implementation
*
*/
package org.eclipse.osbp.xtext.datamartdsl.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.eclipse.osbp.xtext.datamartdsl.DatamartDSLPackage;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition;
import org.eclipse.osbp.xtext.datamartdsl.DatamartRole;
import org.eclipse.osbp.xtext.datamartdsl.DatamartSource;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Datamart Definition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartDefinitionImpl#isDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartDefinitionImpl#getDescriptionValue <em>Description Value</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartDefinitionImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.datamartdsl.impl.DatamartDefinitionImpl#getRoles <em>Roles</em>}</li>
* </ul>
*
* @generated
*/
public class DatamartDefinitionImpl extends DatamartBaseImpl implements DatamartDefinition {
/**
* The default value of the '{@link #isDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDescription()
* @generated
* @ordered
*/
protected static final boolean DESCRIPTION_EDEFAULT = false;
/**
* The cached value of the '{@link #isDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isDescription()
* @generated
* @ordered
*/
protected boolean description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getDescriptionValue() <em>Description Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptionValue()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_VALUE_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescriptionValue() <em>Description Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescriptionValue()
* @generated
* @ordered
*/
protected String descriptionValue = DESCRIPTION_VALUE_EDEFAULT;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected DatamartSource source;
/**
* The cached value of the '{@link #getRoles() <em>Roles</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRoles()
* @generated
* @ordered
*/
protected EList<DatamartRole> roles;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DatamartDefinitionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return DatamartDSLPackage.Literals.DATAMART_DEFINITION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescription(boolean newDescription) {
boolean oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getDescriptionValue() {
return descriptionValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDescriptionValue(String newDescriptionValue) {
String oldDescriptionValue = descriptionValue;
descriptionValue = newDescriptionValue;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION_VALUE, oldDescriptionValue, descriptionValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DatamartSource getSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(DatamartSource newSource, NotificationChain msgs) {
DatamartSource oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_DEFINITION__SOURCE, oldSource, newSource);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(DatamartSource newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_DEFINITION__SOURCE, null, msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DatamartDSLPackage.DATAMART_DEFINITION__SOURCE, null, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DatamartDSLPackage.DATAMART_DEFINITION__SOURCE, newSource, newSource));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<DatamartRole> getRoles() {
if (roles == null) {
roles = new EObjectContainmentEList<DatamartRole>(DatamartRole.class, this, DatamartDSLPackage.DATAMART_DEFINITION__ROLES);
}
return roles;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_DEFINITION__SOURCE:
return basicSetSource(null, msgs);
case DatamartDSLPackage.DATAMART_DEFINITION__ROLES:
return ((InternalEList<?>)getRoles()).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 DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION:
return isDescription();
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION_VALUE:
return getDescriptionValue();
case DatamartDSLPackage.DATAMART_DEFINITION__SOURCE:
return getSource();
case DatamartDSLPackage.DATAMART_DEFINITION__ROLES:
return getRoles();
}
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 DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION:
setDescription((Boolean)newValue);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION_VALUE:
setDescriptionValue((String)newValue);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__SOURCE:
setSource((DatamartSource)newValue);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__ROLES:
getRoles().clear();
getRoles().addAll((Collection<? extends DatamartRole>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION_VALUE:
setDescriptionValue(DESCRIPTION_VALUE_EDEFAULT);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__SOURCE:
setSource((DatamartSource)null);
return;
case DatamartDSLPackage.DATAMART_DEFINITION__ROLES:
getRoles().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION:
return description != DESCRIPTION_EDEFAULT;
case DatamartDSLPackage.DATAMART_DEFINITION__DESCRIPTION_VALUE:
return DESCRIPTION_VALUE_EDEFAULT == null ? descriptionValue != null : !DESCRIPTION_VALUE_EDEFAULT.equals(descriptionValue);
case DatamartDSLPackage.DATAMART_DEFINITION__SOURCE:
return source != null;
case DatamartDSLPackage.DATAMART_DEFINITION__ROLES:
return roles != null && !roles.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(" (description: ");
result.append(description);
result.append(", descriptionValue: ");
result.append(descriptionValue);
result.append(')');
return result.toString();
}
} //DatamartDefinitionImpl