blob: f4fcf6177403ce630126130456addbd943bae8ad [file] [log] [blame]
/**
*/
package org.eclipse.papyrus.bpmn.BPMNProfile.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
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.papyrus.bpmn.BPMNProfile.AdHocOrdering;
import org.eclipse.papyrus.bpmn.BPMNProfile.AdHocSubProcess;
import org.eclipse.papyrus.bpmn.BPMNProfile.BPMNExpression;
import org.eclipse.papyrus.bpmn.BPMNProfile.BPMNProfilePackage;
import org.eclipse.papyrus.bpmn.BPMNProfile.util.BPMNProfileValidator;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Ad Hoc Sub Process</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.AdHocSubProcessImpl#getCompletionCondition <em>Completion Condition</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.AdHocSubProcessImpl#getOrdering <em>Ordering</em>}</li>
* <li>{@link org.eclipse.papyrus.bpmn.BPMNProfile.impl.AdHocSubProcessImpl#isCancelRemainingInstances <em>Cancel Remaining Instances</em>}</li>
* </ul>
*
* @generated
*/
public class AdHocSubProcessImpl extends SubProcessImpl implements AdHocSubProcess {
/**
* The cached value of the '{@link #getCompletionCondition() <em>Completion Condition</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCompletionCondition()
* @generated
* @ordered
*/
protected BPMNExpression completionCondition;
/**
* The default value of the '{@link #getOrdering() <em>Ordering</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrdering()
* @generated
* @ordered
*/
protected static final AdHocOrdering ORDERING_EDEFAULT = AdHocOrdering.PARALLEL;
/**
* The cached value of the '{@link #getOrdering() <em>Ordering</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOrdering()
* @generated
* @ordered
*/
protected AdHocOrdering ordering = ORDERING_EDEFAULT;
/**
* The default value of the '{@link #isCancelRemainingInstances() <em>Cancel Remaining Instances</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isCancelRemainingInstances()
* @generated
* @ordered
*/
protected static final boolean CANCEL_REMAINING_INSTANCES_EDEFAULT = true;
/**
* The cached value of the '{@link #isCancelRemainingInstances() <em>Cancel Remaining Instances</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isCancelRemainingInstances()
* @generated
* @ordered
*/
protected boolean cancelRemainingInstances = CANCEL_REMAINING_INSTANCES_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AdHocSubProcessImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BPMNProfilePackage.eINSTANCE.getAdHocSubProcess();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BPMNExpression getCompletionCondition() {
if (completionCondition != null && completionCondition.eIsProxy()) {
InternalEObject oldCompletionCondition = (InternalEObject)completionCondition;
completionCondition = (BPMNExpression)eResolveProxy(oldCompletionCondition);
if (completionCondition != oldCompletionCondition) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION, oldCompletionCondition, completionCondition));
}
}
return completionCondition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BPMNExpression basicGetCompletionCondition() {
return completionCondition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCompletionCondition(BPMNExpression newCompletionCondition) {
BPMNExpression oldCompletionCondition = completionCondition;
completionCondition = newCompletionCondition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION, oldCompletionCondition, completionCondition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AdHocOrdering getOrdering() {
return ordering;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOrdering(AdHocOrdering newOrdering) {
AdHocOrdering oldOrdering = ordering;
ordering = newOrdering == null ? ORDERING_EDEFAULT : newOrdering;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.AD_HOC_SUB_PROCESS__ORDERING, oldOrdering, ordering));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isCancelRemainingInstances() {
return cancelRemainingInstances;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCancelRemainingInstances(boolean newCancelRemainingInstances) {
boolean oldCancelRemainingInstances = cancelRemainingInstances;
cancelRemainingInstances = newCancelRemainingInstances;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BPMNProfilePackage.AD_HOC_SUB_PROCESS__CANCEL_REMAINING_INSTANCES, oldCancelRemainingInstances, cancelRemainingInstances));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean AdHocSubProcesscancelRemainingInstances(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.AD_HOC_SUB_PROCESS__AD_HOC_SUB_PROCESSCANCEL_REMAINING_INSTANCES,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "AdHocSubProcesscancelRemainingInstances", EObjectValidator.getObjectLabel(this, context) }),
new Object [] { this }));
}
return false;
}
return true;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION:
if (resolve) return getCompletionCondition();
return basicGetCompletionCondition();
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__ORDERING:
return getOrdering();
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__CANCEL_REMAINING_INSTANCES:
return isCancelRemainingInstances();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION:
setCompletionCondition((BPMNExpression)newValue);
return;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__ORDERING:
setOrdering((AdHocOrdering)newValue);
return;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__CANCEL_REMAINING_INSTANCES:
setCancelRemainingInstances((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION:
setCompletionCondition((BPMNExpression)null);
return;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__ORDERING:
setOrdering(ORDERING_EDEFAULT);
return;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__CANCEL_REMAINING_INSTANCES:
setCancelRemainingInstances(CANCEL_REMAINING_INSTANCES_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__COMPLETION_CONDITION:
return completionCondition != null;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__ORDERING:
return ordering != ORDERING_EDEFAULT;
case BPMNProfilePackage.AD_HOC_SUB_PROCESS__CANCEL_REMAINING_INSTANCES:
return cancelRemainingInstances != CANCEL_REMAINING_INSTANCES_EDEFAULT;
}
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.AD_HOC_SUB_PROCESS___AD_HOC_SUB_PROCESSCANCEL_REMAINING_INSTANCES__DIAGNOSTICCHAIN_MAP:
return AdHocSubProcesscancelRemainingInstances((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
}
return super.eInvoke(operationID, arguments);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (ordering: ");
result.append(ordering);
result.append(", cancelRemainingInstances: ");
result.append(cancelRemainingInstances);
result.append(')');
return result.toString();
}
} //AdHocSubProcessImpl