blob: b05900b2732cf55ad7278d41d9fcca1f48e55f01 [file] [log] [blame]
/**
*/
package org.hl7.fhir.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.InternalEList;
import org.hl7.fhir.CodeableConcept;
import org.hl7.fhir.DateTime;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.Identifier;
import org.hl7.fhir.Order;
import org.hl7.fhir.OrderWhen;
import org.hl7.fhir.Reference;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Order</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getIdentifier <em>Identifier</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getDate <em>Date</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getSubject <em>Subject</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getSource <em>Source</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getTarget <em>Target</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getReasonCodeableConcept <em>Reason Codeable Concept</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getReasonReference <em>Reason Reference</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getWhen <em>When</em>}</li>
* <li>{@link org.hl7.fhir.impl.OrderImpl#getDetail <em>Detail</em>}</li>
* </ul>
*
* @generated
*/
public class OrderImpl extends DomainResourceImpl implements Order {
/**
* The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIdentifier()
* @generated
* @ordered
*/
protected EList<Identifier> identifier;
/**
* The cached value of the '{@link #getDate() <em>Date</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDate()
* @generated
* @ordered
*/
protected DateTime date;
/**
* The cached value of the '{@link #getSubject() <em>Subject</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSubject()
* @generated
* @ordered
*/
protected Reference subject;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected Reference source;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected Reference target;
/**
* The cached value of the '{@link #getReasonCodeableConcept() <em>Reason Codeable Concept</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReasonCodeableConcept()
* @generated
* @ordered
*/
protected CodeableConcept reasonCodeableConcept;
/**
* The cached value of the '{@link #getReasonReference() <em>Reason Reference</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReasonReference()
* @generated
* @ordered
*/
protected Reference reasonReference;
/**
* The cached value of the '{@link #getWhen() <em>When</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWhen()
* @generated
* @ordered
*/
protected OrderWhen when;
/**
* The cached value of the '{@link #getDetail() <em>Detail</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDetail()
* @generated
* @ordered
*/
protected EList<Reference> detail;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OrderImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getOrder();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Identifier> getIdentifier() {
if (identifier == null) {
identifier = new EObjectContainmentEList<Identifier>(Identifier.class, this, FhirPackage.ORDER__IDENTIFIER);
}
return identifier;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DateTime getDate() {
return date;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDate(DateTime newDate, NotificationChain msgs) {
DateTime oldDate = date;
date = newDate;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__DATE, oldDate, newDate);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDate(DateTime newDate) {
if (newDate != date) {
NotificationChain msgs = null;
if (date != null)
msgs = ((InternalEObject)date).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__DATE, null, msgs);
if (newDate != null)
msgs = ((InternalEObject)newDate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__DATE, null, msgs);
msgs = basicSetDate(newDate, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__DATE, newDate, newDate));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getSubject() {
return subject;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSubject(Reference newSubject, NotificationChain msgs) {
Reference oldSubject = subject;
subject = newSubject;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__SUBJECT, oldSubject, newSubject);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSubject(Reference newSubject) {
if (newSubject != subject) {
NotificationChain msgs = null;
if (subject != null)
msgs = ((InternalEObject)subject).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__SUBJECT, null, msgs);
if (newSubject != null)
msgs = ((InternalEObject)newSubject).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__SUBJECT, null, msgs);
msgs = basicSetSubject(newSubject, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__SUBJECT, newSubject, newSubject));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(Reference newSource, NotificationChain msgs) {
Reference oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__SOURCE, oldSource, newSource);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(Reference newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__SOURCE, null, msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__SOURCE, null, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__SOURCE, newSource, newSource));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTarget(Reference newTarget, NotificationChain msgs) {
Reference oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(Reference newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__TARGET, newTarget, newTarget));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CodeableConcept getReasonCodeableConcept() {
return reasonCodeableConcept;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetReasonCodeableConcept(CodeableConcept newReasonCodeableConcept, NotificationChain msgs) {
CodeableConcept oldReasonCodeableConcept = reasonCodeableConcept;
reasonCodeableConcept = newReasonCodeableConcept;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__REASON_CODEABLE_CONCEPT, oldReasonCodeableConcept, newReasonCodeableConcept);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReasonCodeableConcept(CodeableConcept newReasonCodeableConcept) {
if (newReasonCodeableConcept != reasonCodeableConcept) {
NotificationChain msgs = null;
if (reasonCodeableConcept != null)
msgs = ((InternalEObject)reasonCodeableConcept).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__REASON_CODEABLE_CONCEPT, null, msgs);
if (newReasonCodeableConcept != null)
msgs = ((InternalEObject)newReasonCodeableConcept).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__REASON_CODEABLE_CONCEPT, null, msgs);
msgs = basicSetReasonCodeableConcept(newReasonCodeableConcept, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__REASON_CODEABLE_CONCEPT, newReasonCodeableConcept, newReasonCodeableConcept));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Reference getReasonReference() {
return reasonReference;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetReasonReference(Reference newReasonReference, NotificationChain msgs) {
Reference oldReasonReference = reasonReference;
reasonReference = newReasonReference;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__REASON_REFERENCE, oldReasonReference, newReasonReference);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReasonReference(Reference newReasonReference) {
if (newReasonReference != reasonReference) {
NotificationChain msgs = null;
if (reasonReference != null)
msgs = ((InternalEObject)reasonReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__REASON_REFERENCE, null, msgs);
if (newReasonReference != null)
msgs = ((InternalEObject)newReasonReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__REASON_REFERENCE, null, msgs);
msgs = basicSetReasonReference(newReasonReference, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__REASON_REFERENCE, newReasonReference, newReasonReference));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OrderWhen getWhen() {
return when;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetWhen(OrderWhen newWhen, NotificationChain msgs) {
OrderWhen oldWhen = when;
when = newWhen;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__WHEN, oldWhen, newWhen);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setWhen(OrderWhen newWhen) {
if (newWhen != when) {
NotificationChain msgs = null;
if (when != null)
msgs = ((InternalEObject)when).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__WHEN, null, msgs);
if (newWhen != null)
msgs = ((InternalEObject)newWhen).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.ORDER__WHEN, null, msgs);
msgs = basicSetWhen(newWhen, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.ORDER__WHEN, newWhen, newWhen));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Reference> getDetail() {
if (detail == null) {
detail = new EObjectContainmentEList<Reference>(Reference.class, this, FhirPackage.ORDER__DETAIL);
}
return detail;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.ORDER__IDENTIFIER:
return ((InternalEList<?>)getIdentifier()).basicRemove(otherEnd, msgs);
case FhirPackage.ORDER__DATE:
return basicSetDate(null, msgs);
case FhirPackage.ORDER__SUBJECT:
return basicSetSubject(null, msgs);
case FhirPackage.ORDER__SOURCE:
return basicSetSource(null, msgs);
case FhirPackage.ORDER__TARGET:
return basicSetTarget(null, msgs);
case FhirPackage.ORDER__REASON_CODEABLE_CONCEPT:
return basicSetReasonCodeableConcept(null, msgs);
case FhirPackage.ORDER__REASON_REFERENCE:
return basicSetReasonReference(null, msgs);
case FhirPackage.ORDER__WHEN:
return basicSetWhen(null, msgs);
case FhirPackage.ORDER__DETAIL:
return ((InternalEList<?>)getDetail()).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 FhirPackage.ORDER__IDENTIFIER:
return getIdentifier();
case FhirPackage.ORDER__DATE:
return getDate();
case FhirPackage.ORDER__SUBJECT:
return getSubject();
case FhirPackage.ORDER__SOURCE:
return getSource();
case FhirPackage.ORDER__TARGET:
return getTarget();
case FhirPackage.ORDER__REASON_CODEABLE_CONCEPT:
return getReasonCodeableConcept();
case FhirPackage.ORDER__REASON_REFERENCE:
return getReasonReference();
case FhirPackage.ORDER__WHEN:
return getWhen();
case FhirPackage.ORDER__DETAIL:
return getDetail();
}
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 FhirPackage.ORDER__IDENTIFIER:
getIdentifier().clear();
getIdentifier().addAll((Collection<? extends Identifier>)newValue);
return;
case FhirPackage.ORDER__DATE:
setDate((DateTime)newValue);
return;
case FhirPackage.ORDER__SUBJECT:
setSubject((Reference)newValue);
return;
case FhirPackage.ORDER__SOURCE:
setSource((Reference)newValue);
return;
case FhirPackage.ORDER__TARGET:
setTarget((Reference)newValue);
return;
case FhirPackage.ORDER__REASON_CODEABLE_CONCEPT:
setReasonCodeableConcept((CodeableConcept)newValue);
return;
case FhirPackage.ORDER__REASON_REFERENCE:
setReasonReference((Reference)newValue);
return;
case FhirPackage.ORDER__WHEN:
setWhen((OrderWhen)newValue);
return;
case FhirPackage.ORDER__DETAIL:
getDetail().clear();
getDetail().addAll((Collection<? extends Reference>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.ORDER__IDENTIFIER:
getIdentifier().clear();
return;
case FhirPackage.ORDER__DATE:
setDate((DateTime)null);
return;
case FhirPackage.ORDER__SUBJECT:
setSubject((Reference)null);
return;
case FhirPackage.ORDER__SOURCE:
setSource((Reference)null);
return;
case FhirPackage.ORDER__TARGET:
setTarget((Reference)null);
return;
case FhirPackage.ORDER__REASON_CODEABLE_CONCEPT:
setReasonCodeableConcept((CodeableConcept)null);
return;
case FhirPackage.ORDER__REASON_REFERENCE:
setReasonReference((Reference)null);
return;
case FhirPackage.ORDER__WHEN:
setWhen((OrderWhen)null);
return;
case FhirPackage.ORDER__DETAIL:
getDetail().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.ORDER__IDENTIFIER:
return identifier != null && !identifier.isEmpty();
case FhirPackage.ORDER__DATE:
return date != null;
case FhirPackage.ORDER__SUBJECT:
return subject != null;
case FhirPackage.ORDER__SOURCE:
return source != null;
case FhirPackage.ORDER__TARGET:
return target != null;
case FhirPackage.ORDER__REASON_CODEABLE_CONCEPT:
return reasonCodeableConcept != null;
case FhirPackage.ORDER__REASON_REFERENCE:
return reasonReference != null;
case FhirPackage.ORDER__WHEN:
return when != null;
case FhirPackage.ORDER__DETAIL:
return detail != null && !detail.isEmpty();
}
return super.eIsSet(featureID);
}
} //OrderImpl