| /** |
| * Copyright (c) 2020 CEA LIST, Committer Name, 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 accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * CEA LIST - Initial API and implementation |
| * Patrick Tessier (CEA LIST) patrick.tessier@cea.fr |
| * Gabriel Pedroza (CEA LIST) gabriel.pedroza@cea.fr |
| * |
| */ |
| package org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.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.impl.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Controller; |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Pdp4engCommonGDPRPackage; |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData; |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Processor; |
| |
| import org.eclipse.uml2.uml.NamedElement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Controller</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ControllerImpl#getProcessor <em>Processor</em>}</li> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ControllerImpl#getBase_NamedElement <em>Base Named Element</em>}</li> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ControllerImpl#getPersonalData <em>Personal Data</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ControllerImpl extends MinimalEObjectImpl.Container implements Controller { |
| /** |
| * The cached value of the '{@link #getProcessor() <em>Processor</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getProcessor() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Processor> processor; |
| |
| /** |
| * The cached value of the '{@link #getBase_NamedElement() <em>Base Named Element</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getBase_NamedElement() |
| * @generated |
| * @ordered |
| */ |
| protected NamedElement base_NamedElement; |
| |
| /** |
| * The cached value of the '{@link #getPersonalData() <em>Personal Data</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getPersonalData() |
| * @generated |
| * @ordered |
| */ |
| protected EList<PersonalData> personalData; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected ControllerImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return Pdp4engCommonGDPRPackage.Literals.CONTROLLER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EList<Processor> getProcessor() { |
| if (processor == null) { |
| processor = new EObjectResolvingEList<>(Processor.class, this, Pdp4engCommonGDPRPackage.CONTROLLER__PROCESSOR); |
| } |
| return processor; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NamedElement getBase_NamedElement() { |
| if (base_NamedElement != null && base_NamedElement.eIsProxy()) { |
| InternalEObject oldBase_NamedElement = (InternalEObject) base_NamedElement; |
| base_NamedElement = (NamedElement) eResolveProxy(oldBase_NamedElement); |
| if (base_NamedElement != oldBase_NamedElement) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT, oldBase_NamedElement, base_NamedElement)); |
| } |
| } |
| } |
| return base_NamedElement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NamedElement basicGetBase_NamedElement() { |
| return base_NamedElement; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setBase_NamedElement(NamedElement newBase_NamedElement) { |
| NamedElement oldBase_NamedElement = base_NamedElement; |
| base_NamedElement = newBase_NamedElement; |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT, oldBase_NamedElement, base_NamedElement)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EList<PersonalData> getPersonalData() { |
| if (personalData == null) { |
| personalData = new EObjectWithInverseResolvingEList<>(PersonalData.class, this, Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA, Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE); |
| } |
| return personalData; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| return ((InternalEList<InternalEObject>) (InternalEList<?>) getPersonalData()).basicAdd(otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| return ((InternalEList<?>) getPersonalData()).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 Pdp4engCommonGDPRPackage.CONTROLLER__PROCESSOR: |
| return getProcessor(); |
| case Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT: |
| if (resolve) { |
| return getBase_NamedElement(); |
| } |
| return basicGetBase_NamedElement(); |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| return getPersonalData(); |
| } |
| 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 Pdp4engCommonGDPRPackage.CONTROLLER__PROCESSOR: |
| getProcessor().clear(); |
| getProcessor().addAll((Collection<? extends Processor>) newValue); |
| return; |
| case Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT: |
| setBase_NamedElement((NamedElement) newValue); |
| return; |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| getPersonalData().clear(); |
| getPersonalData().addAll((Collection<? extends PersonalData>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PROCESSOR: |
| getProcessor().clear(); |
| return; |
| case Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT: |
| setBase_NamedElement((NamedElement) null); |
| return; |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| getPersonalData().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PROCESSOR: |
| return processor != null && !processor.isEmpty(); |
| case Pdp4engCommonGDPRPackage.CONTROLLER__BASE_NAMED_ELEMENT: |
| return base_NamedElement != null; |
| case Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA: |
| return personalData != null && !personalData.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // ControllerImpl |