org.omg.bpmn.bpmn2.impl.ResourceRoleImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.omg.bpmn.model Show documentation
Show all versions of org.omg.bpmn.model Show documentation
Ecore and generated code for org.omg.bpmn2
The newest version!
/*
* Copyright (c) 2012 - 2024 Data In Motion and others.
* All rights reserved.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mark Hoffmann - initial API and implementation
*/
package org.omg.bpmn.bpmn2.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.omg.bpmn.bpmn2.Bpmn2Package;
import org.omg.bpmn.bpmn2.Resource;
import org.omg.bpmn.bpmn2.ResourceAssignmentExpression;
import org.omg.bpmn.bpmn2.ResourceParameterBinding;
import org.omg.bpmn.bpmn2.ResourceRole;
/**
*
* An implementation of the model object 'Resource Role'.
*
*
* The following features are implemented:
*
*
* - {@link org.omg.bpmn.bpmn2.impl.ResourceRoleImpl#getResourceRef Resource Ref}
* - {@link org.omg.bpmn.bpmn2.impl.ResourceRoleImpl#getResourceParameterBindings Resource Parameter Bindings}
* - {@link org.omg.bpmn.bpmn2.impl.ResourceRoleImpl#getResourceAssignmentExpression Resource Assignment Expression}
* - {@link org.omg.bpmn.bpmn2.impl.ResourceRoleImpl#getName Name}
*
*
* @generated
*/
public class ResourceRoleImpl extends BaseElementImpl implements ResourceRole {
/**
* The cached value of the '{@link #getResourceRef() Resource Ref}' reference.
*
*
* @see #getResourceRef()
* @generated
* @ordered
*/
protected Resource resourceRef;
/**
* The cached value of the '{@link #getResourceParameterBindings() Resource Parameter Bindings}' containment reference list.
*
*
* @see #getResourceParameterBindings()
* @generated
* @ordered
*/
protected EList resourceParameterBindings;
/**
* The cached value of the '{@link #getResourceAssignmentExpression() Resource Assignment Expression}' containment reference.
*
*
* @see #getResourceAssignmentExpression()
* @generated
* @ordered
*/
protected ResourceAssignmentExpression resourceAssignmentExpression;
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
*
*
* @generated
*/
protected ResourceRoleImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return Bpmn2Package.eINSTANCE.getResourceRole();
}
/**
*
*
* @generated
*/
@Override
public Resource getResourceRef() {
if (resourceRef != null && resourceRef.eIsProxy()) {
InternalEObject oldResourceRef = (InternalEObject)resourceRef;
resourceRef = (Resource)eResolveProxy(oldResourceRef);
if (resourceRef != oldResourceRef) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF, oldResourceRef, resourceRef));
}
}
return resourceRef;
}
/**
*
*
* @generated
*/
public Resource basicGetResourceRef() {
return resourceRef;
}
/**
*
*
* @generated
*/
@Override
public void setResourceRef(Resource newResourceRef) {
Resource oldResourceRef = resourceRef;
resourceRef = newResourceRef;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF, oldResourceRef, resourceRef));
}
/**
*
*
* @generated
*/
@Override
public EList getResourceParameterBindings() {
if (resourceParameterBindings == null) {
resourceParameterBindings = new EObjectContainmentEList(ResourceParameterBinding.class, this, Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS);
}
return resourceParameterBindings;
}
/**
*
*
* @generated
*/
@Override
public ResourceAssignmentExpression getResourceAssignmentExpression() {
return resourceAssignmentExpression;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetResourceAssignmentExpression(ResourceAssignmentExpression newResourceAssignmentExpression, NotificationChain msgs) {
ResourceAssignmentExpression oldResourceAssignmentExpression = resourceAssignmentExpression;
resourceAssignmentExpression = newResourceAssignmentExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION, oldResourceAssignmentExpression, newResourceAssignmentExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setResourceAssignmentExpression(ResourceAssignmentExpression newResourceAssignmentExpression) {
if (newResourceAssignmentExpression != resourceAssignmentExpression) {
NotificationChain msgs = null;
if (resourceAssignmentExpression != null)
msgs = ((InternalEObject)resourceAssignmentExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION, null, msgs);
if (newResourceAssignmentExpression != null)
msgs = ((InternalEObject)newResourceAssignmentExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION, null, msgs);
msgs = basicSetResourceAssignmentExpression(newResourceAssignmentExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION, newResourceAssignmentExpression, newResourceAssignmentExpression));
}
/**
*
*
* @generated
*/
@Override
public String getName() {
return name;
}
/**
*
*
* @generated
*/
@Override
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, Bpmn2Package.RESOURCE_ROLE__NAME, oldName, name));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS:
return ((InternalEList>)getResourceParameterBindings()).basicRemove(otherEnd, msgs);
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION:
return basicSetResourceAssignmentExpression(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF:
if (resolve) return getResourceRef();
return basicGetResourceRef();
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS:
return getResourceParameterBindings();
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION:
return getResourceAssignmentExpression();
case Bpmn2Package.RESOURCE_ROLE__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF:
setResourceRef((Resource)newValue);
return;
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS:
getResourceParameterBindings().clear();
getResourceParameterBindings().addAll((Collection extends ResourceParameterBinding>)newValue);
return;
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION:
setResourceAssignmentExpression((ResourceAssignmentExpression)newValue);
return;
case Bpmn2Package.RESOURCE_ROLE__NAME:
setName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF:
setResourceRef((Resource)null);
return;
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS:
getResourceParameterBindings().clear();
return;
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION:
setResourceAssignmentExpression((ResourceAssignmentExpression)null);
return;
case Bpmn2Package.RESOURCE_ROLE__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_REF:
return resourceRef != null;
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_PARAMETER_BINDINGS:
return resourceParameterBindings != null && !resourceParameterBindings.isEmpty();
case Bpmn2Package.RESOURCE_ROLE__RESOURCE_ASSIGNMENT_EXPRESSION:
return resourceAssignmentExpression != null;
case Bpmn2Package.RESOURCE_ROLE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //ResourceRoleImpl