/** | |
* 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.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.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.Pdp4engCommonGDPRPackage; | |
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalData; | |
import org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.PersonalDataBreach; | |
import org.eclipse.uml2.uml.NamedElement; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Personal Data Breach</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataBreachImpl#getBase_NamedElement <em>Base Named Element</em>}</li> | |
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataBreachImpl#getBreachImpact <em>Breach Impact</em>}</li> | |
* <li>{@link org.eclipse.papyrus.pdp4eng.common.profile.pdp4engCommonGDPR.impl.PersonalDataBreachImpl#getConcernedPersonalData <em>Concerned Personal Data</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class PersonalDataBreachImpl extends MinimalEObjectImpl.Container implements PersonalDataBreach { | |
/** | |
* 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 default value of the '{@link #getBreachImpact() <em>Breach Impact</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBreachImpact() | |
* @generated | |
* @ordered | |
*/ | |
protected static final String BREACH_IMPACT_EDEFAULT = null; | |
/** | |
* The cached value of the '{@link #getBreachImpact() <em>Breach Impact</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBreachImpact() | |
* @generated | |
* @ordered | |
*/ | |
protected String breachImpact = BREACH_IMPACT_EDEFAULT; | |
/** | |
* The cached value of the '{@link #getConcernedPersonalData() <em>Concerned Personal Data</em>}' reference list. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getConcernedPersonalData() | |
* @generated | |
* @ordered | |
*/ | |
protected EList<PersonalData> concernedPersonalData; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected PersonalDataBreachImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return Pdp4engCommonGDPRPackage.Literals.PERSONAL_DATA_BREACH; | |
} | |
/** | |
* <!-- 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.PERSONAL_DATA_BREACH__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.PERSONAL_DATA_BREACH__BASE_NAMED_ELEMENT, oldBase_NamedElement, base_NamedElement)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String getBreachImpact() { | |
return breachImpact; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void setBreachImpact(String newBreachImpact) { | |
String oldBreachImpact = breachImpact; | |
breachImpact = newBreachImpact; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BREACH_IMPACT, oldBreachImpact, breachImpact)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public EList<PersonalData> getConcernedPersonalData() { | |
if (concernedPersonalData == null) { | |
concernedPersonalData = new EObjectResolvingEList<PersonalData>(PersonalData.class, this, Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__CONCERNED_PERSONAL_DATA); | |
} | |
return concernedPersonalData; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BASE_NAMED_ELEMENT: | |
if (resolve) return getBase_NamedElement(); | |
return basicGetBase_NamedElement(); | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BREACH_IMPACT: | |
return getBreachImpact(); | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__CONCERNED_PERSONAL_DATA: | |
return getConcernedPersonalData(); | |
} | |
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_BREACH__BASE_NAMED_ELEMENT: | |
setBase_NamedElement((NamedElement)newValue); | |
return; | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BREACH_IMPACT: | |
setBreachImpact((String)newValue); | |
return; | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__CONCERNED_PERSONAL_DATA: | |
getConcernedPersonalData().clear(); | |
getConcernedPersonalData().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.PERSONAL_DATA_BREACH__BASE_NAMED_ELEMENT: | |
setBase_NamedElement((NamedElement)null); | |
return; | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BREACH_IMPACT: | |
setBreachImpact(BREACH_IMPACT_EDEFAULT); | |
return; | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__CONCERNED_PERSONAL_DATA: | |
getConcernedPersonalData().clear(); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BASE_NAMED_ELEMENT: | |
return base_NamedElement != null; | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__BREACH_IMPACT: | |
return BREACH_IMPACT_EDEFAULT == null ? breachImpact != null : !BREACH_IMPACT_EDEFAULT.equals(breachImpact); | |
case Pdp4engCommonGDPRPackage.PERSONAL_DATA_BREACH__CONCERNED_PERSONAL_DATA: | |
return concernedPersonalData != null && !concernedPersonalData.isEmpty(); | |
} | |
return super.eIsSet(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public String toString() { | |
if (eIsProxy()) return super.toString(); | |
StringBuilder result = new StringBuilder(super.toString()); | |
result.append(" (breachImpact: "); | |
result.append(breachImpact); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //PersonalDataBreachImpl |