| /** |
| * 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.EDataTypeEList; |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.osbp.dsl.semantic.entity.LEntity; |
| |
| import org.eclipse.osbp.xtext.authorizationdsl.AuthorizationDSLPackage; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEntity; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEntityFeature; |
| import org.eclipse.osbp.xtext.authorizationdsl.RoleEnum; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Role Entity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleEntityImpl#getEntityAuthorized <em>Entity Authorized</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleEntityImpl#getEntityFeatures <em>Entity Features</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.authorizationdsl.impl.RoleEntityImpl#getEntityRef <em>Entity Ref</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class RoleEntityImpl extends RoleElementImpl implements RoleEntity { |
| /** |
| * The cached value of the '{@link #getEntityAuthorized() <em>Entity Authorized</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEntityAuthorized() |
| * @generated |
| * @ordered |
| */ |
| protected EList<RoleEnum> entityAuthorized; |
| |
| /** |
| * The cached value of the '{@link #getEntityFeatures() <em>Entity Features</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEntityFeatures() |
| * @generated |
| * @ordered |
| */ |
| protected EList<RoleEntityFeature> entityFeatures; |
| |
| /** |
| * The cached value of the '{@link #getEntityRef() <em>Entity Ref</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEntityRef() |
| * @generated |
| * @ordered |
| */ |
| protected LEntity entityRef; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RoleEntityImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return AuthorizationDSLPackage.Literals.ROLE_ENTITY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<RoleEnum> getEntityAuthorized() { |
| if (entityAuthorized == null) { |
| entityAuthorized = new EDataTypeEList<RoleEnum>(RoleEnum.class, this, AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_AUTHORIZED); |
| } |
| return entityAuthorized; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<RoleEntityFeature> getEntityFeatures() { |
| if (entityFeatures == null) { |
| entityFeatures = new EObjectContainmentEList<RoleEntityFeature>(RoleEntityFeature.class, this, AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES); |
| } |
| return entityFeatures; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntity getEntityRef() { |
| if (entityRef != null && entityRef.eIsProxy()) { |
| InternalEObject oldEntityRef = (InternalEObject)entityRef; |
| entityRef = (LEntity)eResolveProxy(oldEntityRef); |
| if (entityRef != oldEntityRef) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF, oldEntityRef, entityRef)); |
| } |
| } |
| return entityRef; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LEntity basicGetEntityRef() { |
| return entityRef; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEntityRef(LEntity newEntityRef) { |
| LEntity oldEntityRef = entityRef; |
| entityRef = newEntityRef; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF, oldEntityRef, entityRef)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES: |
| return ((InternalEList<?>)getEntityFeatures()).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_ENTITY__ENTITY_AUTHORIZED: |
| return getEntityAuthorized(); |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES: |
| return getEntityFeatures(); |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF: |
| if (resolve) return getEntityRef(); |
| return basicGetEntityRef(); |
| } |
| 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_ENTITY__ENTITY_AUTHORIZED: |
| getEntityAuthorized().clear(); |
| getEntityAuthorized().addAll((Collection<? extends RoleEnum>)newValue); |
| return; |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES: |
| getEntityFeatures().clear(); |
| getEntityFeatures().addAll((Collection<? extends RoleEntityFeature>)newValue); |
| return; |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF: |
| setEntityRef((LEntity)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_AUTHORIZED: |
| getEntityAuthorized().clear(); |
| return; |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES: |
| getEntityFeatures().clear(); |
| return; |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF: |
| setEntityRef((LEntity)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_AUTHORIZED: |
| return entityAuthorized != null && !entityAuthorized.isEmpty(); |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_FEATURES: |
| return entityFeatures != null && !entityFeatures.isEmpty(); |
| case AuthorizationDSLPackage.ROLE_ENTITY__ENTITY_REF: |
| return entityRef != null; |
| } |
| 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(" (entityAuthorized: "); |
| result.append(entityAuthorized); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //RoleEntityImpl |