blob: 68ed00032a2d0e588b2e3103b62d9151b1a441ce [file] [log] [blame]
/**
* 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.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Contract;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.DataSubject;
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Pdp4engCommonGDPRPackage;
import org.eclipse.uml2.uml.NamedElement;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Contract</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ContractImpl#getBase_NamedElement <em>Base Named Element</em>}</li>
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ContractImpl#getProcess <em>Process</em>}</li>
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.ContractImpl#getDatasubject <em>Datasubject</em>}</li>
* </ul>
*
* @generated
*/
public class ContractImpl extends MinimalEObjectImpl.Container implements Contract {
/**
* 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 #getProcess() <em>Process</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getProcess()
* @generated
* @ordered
*/
protected EList<org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process> process;
/**
* The cached value of the '{@link #getDatasubject() <em>Datasubject</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getDatasubject()
* @generated
* @ordered
*/
protected DataSubject datasubject;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected ContractImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return Pdp4engCommonGDPRPackage.Literals.CONTRACT;
}
/**
* <!-- 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.CONTRACT__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.CONTRACT__BASE_NAMED_ELEMENT, oldBase_NamedElement, base_NamedElement));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process> getProcess() {
if (process == null) {
process = new EObjectWithInverseResolvingEList<>(org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process.class, this, Pdp4engCommonGDPRPackage.CONTRACT__PROCESS,
Pdp4engCommonGDPRPackage.PROCESS__PERFORM_ACONTRACT);
}
return process;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public DataSubject getDatasubject() {
if (datasubject != null && datasubject.eIsProxy()) {
InternalEObject oldDatasubject = (InternalEObject) datasubject;
datasubject = (DataSubject) eResolveProxy(oldDatasubject);
if (datasubject != oldDatasubject) {
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT, oldDatasubject, datasubject));
}
}
}
return datasubject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public DataSubject basicGetDatasubject() {
return datasubject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetDatasubject(DataSubject newDatasubject, NotificationChain msgs) {
DataSubject oldDatasubject = datasubject;
datasubject = newDatasubject;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT, oldDatasubject, newDatasubject);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setDatasubject(DataSubject newDatasubject) {
if (newDatasubject != datasubject) {
NotificationChain msgs = null;
if (datasubject != null) {
msgs = ((InternalEObject) datasubject).eInverseRemove(this, Pdp4engCommonGDPRPackage.DATA_SUBJECT__CONTRACT, DataSubject.class, msgs);
}
if (newDatasubject != null) {
msgs = ((InternalEObject) newDatasubject).eInverseAdd(this, Pdp4engCommonGDPRPackage.DATA_SUBJECT__CONTRACT, DataSubject.class, msgs);
}
msgs = basicSetDatasubject(newDatasubject, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT, newDatasubject, newDatasubject));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case Pdp4engCommonGDPRPackage.CONTRACT__PROCESS:
return ((InternalEList<InternalEObject>) (InternalEList<?>) getProcess()).basicAdd(otherEnd, msgs);
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
if (datasubject != null) {
msgs = ((InternalEObject) datasubject).eInverseRemove(this, Pdp4engCommonGDPRPackage.DATA_SUBJECT__CONTRACT, DataSubject.class, msgs);
}
return basicSetDatasubject((DataSubject) 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.CONTRACT__PROCESS:
return ((InternalEList<?>) getProcess()).basicRemove(otherEnd, msgs);
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
return basicSetDatasubject(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 Pdp4engCommonGDPRPackage.CONTRACT__BASE_NAMED_ELEMENT:
if (resolve) {
return getBase_NamedElement();
}
return basicGetBase_NamedElement();
case Pdp4engCommonGDPRPackage.CONTRACT__PROCESS:
return getProcess();
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
if (resolve) {
return getDatasubject();
}
return basicGetDatasubject();
}
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.CONTRACT__BASE_NAMED_ELEMENT:
setBase_NamedElement((NamedElement) newValue);
return;
case Pdp4engCommonGDPRPackage.CONTRACT__PROCESS:
getProcess().clear();
getProcess().addAll((Collection<? extends org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Process>) newValue);
return;
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
setDatasubject((DataSubject) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case Pdp4engCommonGDPRPackage.CONTRACT__BASE_NAMED_ELEMENT:
setBase_NamedElement((NamedElement) null);
return;
case Pdp4engCommonGDPRPackage.CONTRACT__PROCESS:
getProcess().clear();
return;
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
setDatasubject((DataSubject) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case Pdp4engCommonGDPRPackage.CONTRACT__BASE_NAMED_ELEMENT:
return base_NamedElement != null;
case Pdp4engCommonGDPRPackage.CONTRACT__PROCESS:
return process != null && !process.isEmpty();
case Pdp4engCommonGDPRPackage.CONTRACT__DATASUBJECT:
return datasubject != null;
}
return super.eIsSet(featureID);
}
} // ContractImpl