/** * <copyright> Copyright (c) 2008-2009 Jonas Helming, Maximilian Koegel. 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 </copyright> * * * */ package org.eclipse.emf.emfstore.server.model.operation.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.emfstore.server.model.operation.CreateOrUpdateRoleOperation; import org.eclipse.emf.emfstore.server.model.operation.OperationPackage; import org.eclipse.emf.emfstore.server.model.operation.RoleContainer; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Create Or Update Role Operation</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.emf.emfstore.server.model.operation.impl.CreateOrUpdateRoleOperationImpl#getRole <em>Role</em>}</li> * </ul> * </p> * * @generated */ public class CreateOrUpdateRoleOperationImpl extends UserManagementOperationImpl<String> implements CreateOrUpdateRoleOperation { /** * The cached value of the '{@link #getRole() <em>Role</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRole() * @generated * @ordered */ protected RoleContainer role; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CreateOrUpdateRoleOperationImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return OperationPackage.Literals.CREATE_OR_UPDATE_ROLE_OPERATION; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RoleContainer getRole() { if (role != null && role.eIsProxy()) { InternalEObject oldRole = (InternalEObject)role; role = (RoleContainer)eResolveProxy(oldRole); if (role != oldRole) { InternalEObject newRole = (InternalEObject)role; NotificationChain msgs = oldRole.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, null, null); if (newRole.eInternalContainer() == null) { msgs = newRole.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, null, msgs); } if (msgs != null) msgs.dispatch(); if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, oldRole, role)); } } return role; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RoleContainer basicGetRole() { return role; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRole(RoleContainer newRole, NotificationChain msgs) { RoleContainer oldRole = role; role = newRole; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, oldRole, newRole); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRole(RoleContainer newRole) { if (newRole != role) { NotificationChain msgs = null; if (role != null) msgs = ((InternalEObject)role).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, null, msgs); if (newRole != null) msgs = ((InternalEObject)newRole).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, null, msgs); msgs = basicSetRole(newRole, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE, newRole, newRole)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE: return basicSetRole(null, 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 OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE: if (resolve) return getRole(); return basicGetRole(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE: setRole((RoleContainer)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE: setRole((RoleContainer)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case OperationPackage.CREATE_OR_UPDATE_ROLE_OPERATION__ROLE: return role != null; } return super.eIsSet(featureID); } } //CreateOrUpdateRoleOperationImpl