| /** |
| * 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.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.DataSubject; |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Pdp4engCommonGDPRPackage; |
| import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Personal Data</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataImpl#getRelatedTo <em>Related To</em>}</li> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataImpl#getResponsible <em>Responsible</em>}</li> |
| * <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataImpl#getProcessedBy <em>Processed By</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PersonalDataImpl extends DataImpl implements PersonalData { |
| /** |
| * The cached value of the '{@link #getRelatedTo() <em>Related To</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getRelatedTo() |
| * @generated |
| * @ordered |
| */ |
| protected EList<DataSubject> relatedTo; |
| |
| /** |
| * The cached value of the '{@link #getResponsible() <em>Responsible</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getResponsible() |
| * @generated |
| * @ordered |
| */ |
| protected Controller responsible; |
| |
| /** |
| * The cached value of the '{@link #getProcessedBy() <em>Processed By</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getProcessedBy() |
| * @generated |
| * @ordered |
| */ |
| protected EList<org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process> processedBy; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected PersonalDataImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return Pdp4engCommonGDPRPackage.Literals.PERSONAL_DATA; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EList<DataSubject> getRelatedTo() { |
| if (relatedTo == null) { |
| relatedTo = new EObjectWithInverseResolvingEList.ManyInverse<>(DataSubject.class, this, Pdp4engCommonGDPRPackage.PERSONAL_DATA__RELATED_TO, Pdp4engCommonGDPRPackage.DATA_SUBJECT__PERSONAL_DATA); |
| } |
| return relatedTo; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public Controller getResponsible() { |
| if (responsible != null && responsible.eIsProxy()) { |
| InternalEObject oldResponsible = (InternalEObject) responsible; |
| responsible = (Controller) eResolveProxy(oldResponsible); |
| if (responsible != oldResponsible) { |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE, oldResponsible, responsible)); |
| } |
| } |
| } |
| return responsible; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Controller basicGetResponsible() { |
| return responsible; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetResponsible(Controller newResponsible, NotificationChain msgs) { |
| Controller oldResponsible = responsible; |
| responsible = newResponsible; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE, oldResponsible, newResponsible); |
| if (msgs == null) { |
| msgs = notification; |
| } else { |
| msgs.add(notification); |
| } |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void setResponsible(Controller newResponsible) { |
| if (newResponsible != responsible) { |
| NotificationChain msgs = null; |
| if (responsible != null) { |
| msgs = ((InternalEObject) responsible).eInverseRemove(this, Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA, Controller.class, msgs); |
| } |
| if (newResponsible != null) { |
| msgs = ((InternalEObject) newResponsible).eInverseAdd(this, Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA, Controller.class, msgs); |
| } |
| msgs = basicSetResponsible(newResponsible, msgs); |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| } else if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE, newResponsible, newResponsible)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EList<org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process> getProcessedBy() { |
| if (processedBy == null) { |
| processedBy = new EObjectWithInverseResolvingEList.ManyInverse<>(org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process.class, this, |
| Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY, Pdp4engCommonGDPRPackage.PROCESS__PERSONALDATA); |
| } |
| return processedBy; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RELATED_TO: |
| return ((InternalEList<InternalEObject>) (InternalEList<?>) getRelatedTo()).basicAdd(otherEnd, msgs); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| if (responsible != null) { |
| msgs = ((InternalEObject) responsible).eInverseRemove(this, Pdp4engCommonGDPRPackage.CONTROLLER__PERSONAL_DATA, Controller.class, msgs); |
| } |
| return basicSetResponsible((Controller) otherEnd, msgs); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| return ((InternalEList<InternalEObject>) (InternalEList<?>) getProcessedBy()).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.PERSONAL_DATA__RELATED_TO: |
| return ((InternalEList<?>) getRelatedTo()).basicRemove(otherEnd, msgs); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| return basicSetResponsible(null, msgs); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| return ((InternalEList<?>) getProcessedBy()).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.PERSONAL_DATA__RELATED_TO: |
| return getRelatedTo(); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| if (resolve) { |
| return getResponsible(); |
| } |
| return basicGetResponsible(); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| return getProcessedBy(); |
| } |
| 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.PERSONAL_DATA__RELATED_TO: |
| getRelatedTo().clear(); |
| getRelatedTo().addAll((Collection<? extends DataSubject>) newValue); |
| return; |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| setResponsible((Controller) newValue); |
| return; |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| getProcessedBy().clear(); |
| getProcessedBy().addAll((Collection<? extends org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RELATED_TO: |
| getRelatedTo().clear(); |
| return; |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| setResponsible((Controller) null); |
| return; |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| getProcessedBy().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RELATED_TO: |
| return relatedTo != null && !relatedTo.isEmpty(); |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__RESPONSIBLE: |
| return responsible != null; |
| case Pdp4engCommonGDPRPackage.PERSONAL_DATA__PROCESSED_BY: |
| return processedBy != null && !processedBy.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // PersonalDataImpl |