blob: 51b54b9573314492c3972ad0af62e745708cdd96 [file] [log] [blame]
/**
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
* 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:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
* generated from AuthoritarionDSL.xcore
*
*
*/
package org.eclipse.osbp.xtext.authorizationdsl.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.eclipse.osbp.xtext.authorizationdsl.AuthorizationDSLPackage;
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipAllUserTasks;
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipProcess;
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipProcessEnum;
import org.eclipse.osbp.xtext.authorizationdsl.RoleBlipUserTask;
import org.eclipse.osbp.xtext.blip.Blip;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Role Blip Process</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleBlipProcessImpl#getProcess <em>Process</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleBlipProcessImpl#getProcessStartAuthorized <em>Process Start Authorized</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleBlipProcessImpl#getAllUserTasks <em>All User Tasks</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleBlipProcessImpl#getUserTasks <em>User Tasks</em>}</li>
* </ul>
*
* @generated
*/
public class RoleBlipProcessImpl extends RoleElementImpl implements RoleBlipProcess {
/**
* The cached value of the '{@link #getProcess() <em>Process</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProcess()
* @generated
* @ordered
*/
protected Blip process;
/**
* The default value of the '{@link #getProcessStartAuthorized() <em>Process Start Authorized</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProcessStartAuthorized()
* @generated
* @ordered
*/
protected static final RoleBlipProcessEnum PROCESS_START_AUTHORIZED_EDEFAULT = RoleBlipProcessEnum.STARTABLE;
/**
* The cached value of the '{@link #getProcessStartAuthorized() <em>Process Start Authorized</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProcessStartAuthorized()
* @generated
* @ordered
*/
protected RoleBlipProcessEnum processStartAuthorized = PROCESS_START_AUTHORIZED_EDEFAULT;
/**
* The cached value of the '{@link #getAllUserTasks() <em>All User Tasks</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAllUserTasks()
* @generated
* @ordered
*/
protected RoleBlipAllUserTasks allUserTasks;
/**
* The cached value of the '{@link #getUserTasks() <em>User Tasks</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUserTasks()
* @generated
* @ordered
*/
protected EList<RoleBlipUserTask> userTasks;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RoleBlipProcessImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AuthorizationDSLPackage.Literals.ROLE_BLIP_PROCESS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Blip getProcess() {
if (process != null && process.eIsProxy()) {
InternalEObject oldProcess = (InternalEObject)process;
process = (Blip)eResolveProxy(oldProcess);
if (process != oldProcess) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS, oldProcess, process));
}
}
return process;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Blip basicGetProcess() {
return process;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProcess(Blip newProcess) {
Blip oldProcess = process;
process = newProcess;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS, oldProcess, process));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RoleBlipProcessEnum getProcessStartAuthorized() {
return processStartAuthorized;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setProcessStartAuthorized(RoleBlipProcessEnum newProcessStartAuthorized) {
RoleBlipProcessEnum oldProcessStartAuthorized = processStartAuthorized;
processStartAuthorized = newProcessStartAuthorized == null ? PROCESS_START_AUTHORIZED_EDEFAULT : newProcessStartAuthorized;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS_START_AUTHORIZED, oldProcessStartAuthorized, processStartAuthorized));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public RoleBlipAllUserTasks getAllUserTasks() {
return allUserTasks;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetAllUserTasks(RoleBlipAllUserTasks newAllUserTasks, NotificationChain msgs) {
RoleBlipAllUserTasks oldAllUserTasks = allUserTasks;
allUserTasks = newAllUserTasks;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS, oldAllUserTasks, newAllUserTasks);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setAllUserTasks(RoleBlipAllUserTasks newAllUserTasks) {
if (newAllUserTasks != allUserTasks) {
NotificationChain msgs = null;
if (allUserTasks != null)
msgs = ((InternalEObject)allUserTasks).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS, null, msgs);
if (newAllUserTasks != null)
msgs = ((InternalEObject)newAllUserTasks).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS, null, msgs);
msgs = basicSetAllUserTasks(newAllUserTasks, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS, newAllUserTasks, newAllUserTasks));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<RoleBlipUserTask> getUserTasks() {
if (userTasks == null) {
userTasks = new EObjectContainmentEList<RoleBlipUserTask>(RoleBlipUserTask.class, this, AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS);
}
return userTasks;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS:
return basicSetAllUserTasks(null, msgs);
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS:
return ((InternalEList<?>)getUserTasks()).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 AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS:
if (resolve) return getProcess();
return basicGetProcess();
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS_START_AUTHORIZED:
return getProcessStartAuthorized();
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS:
return getAllUserTasks();
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS:
return getUserTasks();
}
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 AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS:
setProcess((Blip)newValue);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS_START_AUTHORIZED:
setProcessStartAuthorized((RoleBlipProcessEnum)newValue);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS:
setAllUserTasks((RoleBlipAllUserTasks)newValue);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS:
getUserTasks().clear();
getUserTasks().addAll((Collection<? extends RoleBlipUserTask>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS:
setProcess((Blip)null);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS_START_AUTHORIZED:
setProcessStartAuthorized(PROCESS_START_AUTHORIZED_EDEFAULT);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS:
setAllUserTasks((RoleBlipAllUserTasks)null);
return;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS:
getUserTasks().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS:
return process != null;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__PROCESS_START_AUTHORIZED:
return processStartAuthorized != PROCESS_START_AUTHORIZED_EDEFAULT;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__ALL_USER_TASKS:
return allUserTasks != null;
case AuthorizationDSLPackage.ROLE_BLIP_PROCESS__USER_TASKS:
return userTasks != null && !userTasks.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(" (processStartAuthorized: ");
result.append(processStartAuthorized);
result.append(')');
return result.toString();
}
} //RoleBlipProcessImpl