blob: 1f22c8794c1146154118f8db4789103e8bec0b3a [file] [log] [blame]
/**
*/
package org.eclipse.papyrus.bpmn.BPMNProfile.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
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.plugin.EcorePlugin;
import org.eclipse.emf.ecore.util.EObjectValidator;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.papyrus.bpmn.BPMNProfile.BPMNProfilePackage;
import org.eclipse.papyrus.bpmn.BPMNProfile.Participant;
import org.eclipse.papyrus.bpmn.BPMNProfile.PartnerEntity;
import org.eclipse.papyrus.bpmn.BPMNProfile.util.BPMNProfileValidator;
import org.eclipse.uml2.uml.InstanceSpecification;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Partner Entity</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.PartnerEntityImpl#getBase_InstanceSpecification <em>Base Instance Specification</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.PartnerEntityImpl#getParticipantRef <em>Participant Ref</em>}</li>
* </ul>
*
* @generated
*/
public class PartnerEntityImpl extends RootElementImpl implements PartnerEntity {
/**
* The cached value of the '{@link #getBase_InstanceSpecification() <em>Base Instance Specification</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_InstanceSpecification()
* @generated
* @ordered
*/
protected InstanceSpecification base_InstanceSpecification;
/**
* The cached value of the '{@link #getParticipantRef() <em>Participant Ref</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParticipantRef()
* @generated
* @ordered
*/
protected EList<Participant> participantRef;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PartnerEntityImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BPMNProfilePackage.eINSTANCE.getPartnerEntity();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InstanceSpecification getBase_InstanceSpecification() {
if (base_InstanceSpecification != null && base_InstanceSpecification.eIsProxy()) {
InternalEObject oldBase_InstanceSpecification = (InternalEObject)base_InstanceSpecification;
base_InstanceSpecification = (InstanceSpecification)eResolveProxy(oldBase_InstanceSpecification);
if (base_InstanceSpecification != oldBase_InstanceSpecification) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION, oldBase_InstanceSpecification, base_InstanceSpecification));
}
}
return base_InstanceSpecification;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InstanceSpecification basicGetBase_InstanceSpecification() {
return base_InstanceSpecification;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_InstanceSpecification(InstanceSpecification newBase_InstanceSpecification) {
InstanceSpecification oldBase_InstanceSpecification = base_InstanceSpecification;
base_InstanceSpecification = newBase_InstanceSpecification;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION, oldBase_InstanceSpecification, base_InstanceSpecification));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Participant> getParticipantRef() {
if (participantRef == null) {
participantRef = new EObjectWithInverseResolvingEList.ManyInverse<Participant>(Participant.class, this, BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF, BPMNProfilePackage.PARTICIPANT__PARTNER_ENTITY_REF);
}
return participantRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean PartnerEntityparticipantRef(DiagnosticChain diagnostics, Map<Object, Object> context) {
// TODO: implement this method
// -> specify the condition that violates the invariant
// -> verify the details of the diagnostic, including severity and message
// Ensure that you remove @generated or mark it @generated NOT
if (false) {
if (diagnostics != null) {
diagnostics.add
(new BasicDiagnostic
(Diagnostic.ERROR,
BPMNProfileValidator.DIAGNOSTIC_SOURCE,
BPMNProfileValidator.PARTNER_ENTITY__PARTNER_ENTITYPARTICIPANT_REF,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "PartnerEntityparticipantRef", EObjectValidator.getObjectLabel(this, context) }),
new Object [] { this }));
}
return false;
}
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getParticipantRef()).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 BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
return ((InternalEList<?>)getParticipantRef()).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 BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION:
if (resolve) return getBase_InstanceSpecification();
return basicGetBase_InstanceSpecification();
case BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
return getParticipantRef();
}
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 BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION:
setBase_InstanceSpecification((InstanceSpecification)newValue);
return;
case BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
getParticipantRef().clear();
getParticipantRef().addAll((Collection<? extends Participant>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION:
setBase_InstanceSpecification((InstanceSpecification)null);
return;
case BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
getParticipantRef().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BPMNProfilePackage.PARTNER_ENTITY__BASE_INSTANCE_SPECIFICATION:
return base_InstanceSpecification != null;
case BPMNProfilePackage.PARTNER_ENTITY__PARTICIPANT_REF:
return participantRef != null && !participantRef.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("unchecked")
public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
switch (operationID) {
case BPMNProfilePackage.PARTNER_ENTITY___PARTNER_ENTITYPARTICIPANT_REF__DIAGNOSTICCHAIN_MAP:
return PartnerEntityparticipantRef((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
}
return super.eInvoke(operationID, arguments);
}
} //PartnerEntityImpl