/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.foundation.businessinformation.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.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import orgomg.cwm.foundation.businessinformation.BusinessinformationPackage;
import orgomg.cwm.foundation.businessinformation.ResponsibleParty;
import orgomg.cwm.objectmodel.core.CorePackage;
import orgomg.cwm.objectmodel.core.ModelElement;
import orgomg.cwm.objectmodel.core.impl.NamespaceImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Responsible Party</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.ResponsiblePartyImpl#getResponsibility <em>Responsibility</em>}</li>
* <li>{@link orgomg.cwm.foundation.businessinformation.impl.ResponsiblePartyImpl#getModelElement <em>Model Element</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ResponsiblePartyImpl extends NamespaceImpl implements ResponsibleParty {
/**
* The default value of the '{@link #getResponsibility() <em>Responsibility</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResponsibility()
* @generated
* @ordered
*/
protected static final String RESPONSIBILITY_EDEFAULT = null;
/**
* The cached value of the '{@link #getResponsibility() <em>Responsibility</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResponsibility()
* @generated
* @ordered
*/
protected String responsibility = RESPONSIBILITY_EDEFAULT;
/**
* The cached value of the '{@link #getModelElement() <em>Model Element</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModelElement()
* @generated
* @ordered
*/
protected EList<ModelElement> modelElement;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ResponsiblePartyImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BusinessinformationPackage.Literals.RESPONSIBLE_PARTY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getResponsibility() {
return responsibility;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setResponsibility(String newResponsibility) {
String oldResponsibility = responsibility;
responsibility = newResponsibility;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessinformationPackage.RESPONSIBLE_PARTY__RESPONSIBILITY, oldResponsibility, responsibility));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ModelElement> getModelElement() {
if (modelElement == null) {
modelElement = new EObjectWithInverseResolvingEList.ManyInverse<ModelElement>(ModelElement.class, this, BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT, CorePackage.MODEL_ELEMENT__RESPONSIBLE_PARTY);
}
return modelElement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getModelElement()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
return ((InternalEList<?>)getModelElement()).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 BusinessinformationPackage.RESPONSIBLE_PARTY__RESPONSIBILITY:
return getResponsibility();
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
return getModelElement();
}
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 BusinessinformationPackage.RESPONSIBLE_PARTY__RESPONSIBILITY:
setResponsibility((String)newValue);
return;
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
getModelElement().clear();
getModelElement().addAll((Collection<? extends ModelElement>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BusinessinformationPackage.RESPONSIBLE_PARTY__RESPONSIBILITY:
setResponsibility(RESPONSIBILITY_EDEFAULT);
return;
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
getModelElement().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BusinessinformationPackage.RESPONSIBLE_PARTY__RESPONSIBILITY:
return RESPONSIBILITY_EDEFAULT == null ? responsibility != null : !RESPONSIBILITY_EDEFAULT.equals(responsibility);
case BusinessinformationPackage.RESPONSIBLE_PARTY__MODEL_ELEMENT:
return modelElement != null && !modelElement.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(" (responsibility: ");
result.append(responsibility);
result.append(')');
return result.toString();
}
} //ResponsiblePartyImpl