blob: 8cc027c5a1949bc3805e73ceb60906838595888e [file] [log] [blame]
/**
* Copyright (c) 2014 Fraunhofer FOKUS
* 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
*
* Contributors:
* Max Bureck
*/
package org.eclipse.upr.bpmnprof.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.uml2.uml.Dependency;
import org.eclipse.upr.bpmnprof.AssociationDirection;
import org.eclipse.upr.bpmnprof.BPMNAssociation;
import org.eclipse.upr.bpmnprof.BaseElement;
import org.eclipse.upr.bpmnprof.BpmnprofPackage;
import org.eclipse.upr.bpmnprof.util.BpmnprofValidator;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>BPMN Association</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.upr.bpmnprof.impl.BPMNAssociationImpl#getBase_Dependency <em>Base Dependency</em>}</li>
* <li>{@link org.eclipse.upr.bpmnprof.impl.BPMNAssociationImpl#getAssociationDirection <em>Association Direction</em>}</li>
* <li>{@link org.eclipse.upr.bpmnprof.impl.BPMNAssociationImpl#getTargetRef <em>Target Ref</em>}</li>
* <li>{@link org.eclipse.upr.bpmnprof.impl.BPMNAssociationImpl#getSourceRef <em>Source Ref</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class BPMNAssociationImpl extends BPMNArtifactImpl implements BPMNAssociation {
/**
* The cached value of the '{@link #getBase_Dependency() <em>Base Dependency</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_Dependency()
* @generated
* @ordered
*/
protected Dependency base_Dependency;
/**
* The default value of the '{@link #getAssociationDirection() <em>Association Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAssociationDirection()
* @generated
* @ordered
*/
protected static final AssociationDirection ASSOCIATION_DIRECTION_EDEFAULT = AssociationDirection.NONE;
/**
* The cached value of the '{@link #getAssociationDirection() <em>Association Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAssociationDirection()
* @generated
* @ordered
*/
protected AssociationDirection associationDirection = ASSOCIATION_DIRECTION_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected BPMNAssociationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BpmnprofPackage.eINSTANCE.getBPMNAssociation();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Dependency getBase_Dependency() {
if (base_Dependency != null && base_Dependency.eIsProxy()) {
InternalEObject oldBase_Dependency = (InternalEObject)base_Dependency;
base_Dependency = (Dependency)eResolveProxy(oldBase_Dependency);
if (base_Dependency != oldBase_Dependency) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY, oldBase_Dependency, base_Dependency));
}
}
return base_Dependency;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Dependency basicGetBase_Dependency() {
return base_Dependency;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_Dependency(Dependency newBase_Dependency) {
Dependency oldBase_Dependency = base_Dependency;
base_Dependency = newBase_Dependency;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY, oldBase_Dependency, base_Dependency));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AssociationDirection getAssociationDirection() {
return associationDirection;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAssociationDirection(AssociationDirection newAssociationDirection) {
AssociationDirection oldAssociationDirection = associationDirection;
associationDirection = newAssociationDirection == null ? ASSOCIATION_DIRECTION_EDEFAULT : newAssociationDirection;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BpmnprofPackage.BPMN_ASSOCIATION__ASSOCIATION_DIRECTION, oldAssociationDirection, associationDirection));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BaseElement getTargetRef() {
BaseElement targetRef = basicGetTargetRef();
return targetRef != null && targetRef.eIsProxy() ? (BaseElement)eResolveProxy((InternalEObject)targetRef) : targetRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BaseElement basicGetTargetRef() {
// TODO: implement this method to return the 'Target Ref' reference
// -> do not perform proxy resolution
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTargetRef(BaseElement newTargetRef) {
// TODO: implement this method to set the 'Target Ref' reference
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BaseElement getSourceRef() {
BaseElement sourceRef = basicGetSourceRef();
return sourceRef != null && sourceRef.eIsProxy() ? (BaseElement)eResolveProxy((InternalEObject)sourceRef) : sourceRef;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public BaseElement basicGetSourceRef() {
// TODO: implement this method to return the 'Source Ref' reference
// -> do not perform proxy resolution
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSourceRef(BaseElement newSourceRef) {
// TODO: implement this method to set the 'Source Ref' reference
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean AssociationEnd(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,
BpmnprofValidator.DIAGNOSTIC_SOURCE,
BpmnprofValidator.BPMN_ASSOCIATION__ASSOCIATION_END,
EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "AssociationEnd", 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 BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY:
if (resolve) return getBase_Dependency();
return basicGetBase_Dependency();
case BpmnprofPackage.BPMN_ASSOCIATION__ASSOCIATION_DIRECTION:
return getAssociationDirection();
case BpmnprofPackage.BPMN_ASSOCIATION__TARGET_REF:
if (resolve) return getTargetRef();
return basicGetTargetRef();
case BpmnprofPackage.BPMN_ASSOCIATION__SOURCE_REF:
if (resolve) return getSourceRef();
return basicGetSourceRef();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY:
setBase_Dependency((Dependency)newValue);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__ASSOCIATION_DIRECTION:
setAssociationDirection((AssociationDirection)newValue);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__TARGET_REF:
setTargetRef((BaseElement)newValue);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__SOURCE_REF:
setSourceRef((BaseElement)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY:
setBase_Dependency((Dependency)null);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__ASSOCIATION_DIRECTION:
setAssociationDirection(ASSOCIATION_DIRECTION_EDEFAULT);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__TARGET_REF:
setTargetRef((BaseElement)null);
return;
case BpmnprofPackage.BPMN_ASSOCIATION__SOURCE_REF:
setSourceRef((BaseElement)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BpmnprofPackage.BPMN_ASSOCIATION__BASE_DEPENDENCY:
return base_Dependency != null;
case BpmnprofPackage.BPMN_ASSOCIATION__ASSOCIATION_DIRECTION:
return associationDirection != ASSOCIATION_DIRECTION_EDEFAULT;
case BpmnprofPackage.BPMN_ASSOCIATION__TARGET_REF:
return basicGetTargetRef() != null;
case BpmnprofPackage.BPMN_ASSOCIATION__SOURCE_REF:
return basicGetSourceRef() != null;
}
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 BpmnprofPackage.BPMN_ASSOCIATION___ASSOCIATION_END__DIAGNOSTICCHAIN_MAP:
return AssociationEnd((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(" (associationDirection: ");
result.append(associationDirection);
result.append(')');
return result.toString();
}
} //BPMNAssociationImpl