blob: e63e65795cdad3e37fa3a388f92bf61b711595c5 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2016 David Carlson and others.
* 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:
* David Carlson (Clinical Cloud Solutions, LLC) - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.mdht.uml.fhir.core.resource.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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.mdht.uml.fhir.core.datatype.Identifier;
import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage;
import org.eclipse.mdht.uml.fhir.core.resource.ImmunizationRecommendation;
import org.eclipse.mdht.uml.fhir.core.resource.ImmunizationRecommendationRecommendation;
import org.eclipse.mdht.uml.fhir.core.resource.Patient;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Immunization Recommendation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ImmunizationRecommendationImpl#getIdentifiers <em>Identifier</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ImmunizationRecommendationImpl#getPatient <em>Patient</em>}</li>
* <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ImmunizationRecommendationImpl#getRecommendations <em>Recommendation</em>}</li>
* </ul>
*
* @generated
*/
public class ImmunizationRecommendationImpl extends DomainResourceImpl implements ImmunizationRecommendation {
/**
* The cached value of the '{@link #getIdentifiers() <em>Identifier</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIdentifiers()
* @generated
* @ordered
*/
protected EList<Identifier> identifiers;
/**
* The cached value of the '{@link #getPatient() <em>Patient</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPatient()
* @generated
* @ordered
*/
protected Patient patient;
/**
* The cached value of the '{@link #getRecommendations() <em>Recommendation</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRecommendations()
* @generated
* @ordered
*/
protected EList<ImmunizationRecommendationRecommendation> recommendations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ImmunizationRecommendationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirResourcePackage.eINSTANCE.getImmunizationRecommendation();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Identifier> getIdentifiers() {
if (identifiers == null) {
identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__IDENTIFIER);
}
return identifiers;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Patient getPatient() {
if (patient != null && patient.eIsProxy()) {
InternalEObject oldPatient = (InternalEObject)patient;
patient = (Patient)eResolveProxy(oldPatient);
if (patient != oldPatient) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT, oldPatient, patient));
}
}
return patient;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Patient basicGetPatient() {
return patient;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPatient(Patient newPatient) {
Patient oldPatient = patient;
patient = newPatient;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT, oldPatient, patient));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<ImmunizationRecommendationRecommendation> getRecommendations() {
if (recommendations == null) {
recommendations = new EObjectContainmentEList<ImmunizationRecommendationRecommendation>(ImmunizationRecommendationRecommendation.class, this, FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION);
}
return recommendations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION:
return ((InternalEList<?>)getRecommendations()).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 FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__IDENTIFIER:
return getIdentifiers();
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT:
if (resolve) return getPatient();
return basicGetPatient();
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION:
return getRecommendations();
}
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 FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__IDENTIFIER:
getIdentifiers().clear();
getIdentifiers().addAll((Collection<? extends Identifier>)newValue);
return;
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT:
setPatient((Patient)newValue);
return;
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION:
getRecommendations().clear();
getRecommendations().addAll((Collection<? extends ImmunizationRecommendationRecommendation>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__IDENTIFIER:
getIdentifiers().clear();
return;
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT:
setPatient((Patient)null);
return;
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION:
getRecommendations().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__IDENTIFIER:
return identifiers != null && !identifiers.isEmpty();
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__PATIENT:
return patient != null;
case FhirResourcePackage.IMMUNIZATION_RECOMMENDATION__RECOMMENDATION:
return recommendations != null && !recommendations.isEmpty();
}
return super.eIsSet(featureID);
}
} //ImmunizationRecommendationImpl