| /******************************************************************************* |
| * 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.EObjectResolvingEList; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.Base; |
| import org.eclipse.mdht.uml.fhir.core.datatype.DateTime; |
| 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.Order; |
| import org.eclipse.mdht.uml.fhir.core.resource.OrderWhen; |
| import org.eclipse.mdht.uml.fhir.core.resource.Resource; |
| |
| /** |
| * <!-- 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.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getIdentifiers <em>Identifier</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getDate <em>Date</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getSubject <em>Subject</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getSource <em>Source</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getTarget <em>Target</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getReasonx <em>Reasonx</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getWhen <em>When</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrderImpl#getDetails <em>Detail</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class OrderImpl extends DomainResourceImpl implements Order { |
| /** |
| * 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 #getDate() <em>Date</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDate() |
| * @generated |
| * @ordered |
| */ |
| protected DateTime date; |
| |
| /** |
| * The cached value of the '{@link #getSubject() <em>Subject</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSubject() |
| * @generated |
| * @ordered |
| */ |
| protected Resource subject; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected Resource source; |
| |
| /** |
| * The cached value of the '{@link #getTarget() <em>Target</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTarget() |
| * @generated |
| * @ordered |
| */ |
| protected Resource target; |
| |
| /** |
| * The cached value of the '{@link #getReasonx() <em>Reasonx</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getReasonx() |
| * @generated |
| * @ordered |
| */ |
| protected Base reasonx; |
| |
| /** |
| * 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 #getDetails() <em>Detail</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDetails() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Resource> details; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected OrderImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getOrder(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Identifier> getIdentifiers() { |
| if (identifiers == null) { |
| identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.ORDER__IDENTIFIER); |
| } |
| return identifiers; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DateTime getDate() { |
| if (date != null && date.eIsProxy()) { |
| InternalEObject oldDate = (InternalEObject)date; |
| date = (DateTime)eResolveProxy(oldDate); |
| if (date != oldDate) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORDER__DATE, oldDate, date)); |
| } |
| } |
| return date; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DateTime basicGetDate() { |
| return date; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDate(DateTime newDate) { |
| DateTime oldDate = date; |
| date = newDate; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__DATE, oldDate, date)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getSubject() { |
| if (subject != null && subject.eIsProxy()) { |
| InternalEObject oldSubject = (InternalEObject)subject; |
| subject = (Resource)eResolveProxy(oldSubject); |
| if (subject != oldSubject) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORDER__SUBJECT, oldSubject, subject)); |
| } |
| } |
| return subject; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetSubject() { |
| return subject; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSubject(Resource newSubject) { |
| Resource oldSubject = subject; |
| subject = newSubject; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__SUBJECT, oldSubject, subject)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getSource() { |
| if (source != null && source.eIsProxy()) { |
| InternalEObject oldSource = (InternalEObject)source; |
| source = (Resource)eResolveProxy(oldSource); |
| if (source != oldSource) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORDER__SOURCE, oldSource, source)); |
| } |
| } |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSource(Resource newSource) { |
| Resource oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__SOURCE, oldSource, source)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getTarget() { |
| if (target != null && target.eIsProxy()) { |
| InternalEObject oldTarget = (InternalEObject)target; |
| target = (Resource)eResolveProxy(oldTarget); |
| if (target != oldTarget) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORDER__TARGET, oldTarget, target)); |
| } |
| } |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetTarget() { |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTarget(Resource newTarget) { |
| Resource oldTarget = target; |
| target = newTarget; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__TARGET, oldTarget, target)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Base getReasonx() { |
| if (reasonx != null && reasonx.eIsProxy()) { |
| InternalEObject oldReasonx = (InternalEObject)reasonx; |
| reasonx = (Base)eResolveProxy(oldReasonx); |
| if (reasonx != oldReasonx) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORDER__REASONX, oldReasonx, reasonx)); |
| } |
| } |
| return reasonx; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Base basicGetReasonx() { |
| return reasonx; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReasonx(Base newReasonx) { |
| Base oldReasonx = reasonx; |
| reasonx = newReasonx; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__REASONX, oldReasonx, reasonx)); |
| } |
| |
| /** |
| * <!-- 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, FhirResourcePackage.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 - FhirResourcePackage.ORDER__WHEN, null, msgs); |
| if (newWhen != null) |
| msgs = ((InternalEObject)newWhen).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.ORDER__WHEN, null, msgs); |
| msgs = basicSetWhen(newWhen, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORDER__WHEN, newWhen, newWhen)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Resource> getDetails() { |
| if (details == null) { |
| details = new EObjectResolvingEList<Resource>(Resource.class, this, FhirResourcePackage.ORDER__DETAIL); |
| } |
| return details; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirResourcePackage.ORDER__WHEN: |
| return basicSetWhen(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 FhirResourcePackage.ORDER__IDENTIFIER: |
| return getIdentifiers(); |
| case FhirResourcePackage.ORDER__DATE: |
| if (resolve) return getDate(); |
| return basicGetDate(); |
| case FhirResourcePackage.ORDER__SUBJECT: |
| if (resolve) return getSubject(); |
| return basicGetSubject(); |
| case FhirResourcePackage.ORDER__SOURCE: |
| if (resolve) return getSource(); |
| return basicGetSource(); |
| case FhirResourcePackage.ORDER__TARGET: |
| if (resolve) return getTarget(); |
| return basicGetTarget(); |
| case FhirResourcePackage.ORDER__REASONX: |
| if (resolve) return getReasonx(); |
| return basicGetReasonx(); |
| case FhirResourcePackage.ORDER__WHEN: |
| return getWhen(); |
| case FhirResourcePackage.ORDER__DETAIL: |
| return getDetails(); |
| } |
| 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.ORDER__IDENTIFIER: |
| getIdentifiers().clear(); |
| getIdentifiers().addAll((Collection<? extends Identifier>)newValue); |
| return; |
| case FhirResourcePackage.ORDER__DATE: |
| setDate((DateTime)newValue); |
| return; |
| case FhirResourcePackage.ORDER__SUBJECT: |
| setSubject((Resource)newValue); |
| return; |
| case FhirResourcePackage.ORDER__SOURCE: |
| setSource((Resource)newValue); |
| return; |
| case FhirResourcePackage.ORDER__TARGET: |
| setTarget((Resource)newValue); |
| return; |
| case FhirResourcePackage.ORDER__REASONX: |
| setReasonx((Base)newValue); |
| return; |
| case FhirResourcePackage.ORDER__WHEN: |
| setWhen((OrderWhen)newValue); |
| return; |
| case FhirResourcePackage.ORDER__DETAIL: |
| getDetails().clear(); |
| getDetails().addAll((Collection<? extends Resource>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ORDER__IDENTIFIER: |
| getIdentifiers().clear(); |
| return; |
| case FhirResourcePackage.ORDER__DATE: |
| setDate((DateTime)null); |
| return; |
| case FhirResourcePackage.ORDER__SUBJECT: |
| setSubject((Resource)null); |
| return; |
| case FhirResourcePackage.ORDER__SOURCE: |
| setSource((Resource)null); |
| return; |
| case FhirResourcePackage.ORDER__TARGET: |
| setTarget((Resource)null); |
| return; |
| case FhirResourcePackage.ORDER__REASONX: |
| setReasonx((Base)null); |
| return; |
| case FhirResourcePackage.ORDER__WHEN: |
| setWhen((OrderWhen)null); |
| return; |
| case FhirResourcePackage.ORDER__DETAIL: |
| getDetails().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ORDER__IDENTIFIER: |
| return identifiers != null && !identifiers.isEmpty(); |
| case FhirResourcePackage.ORDER__DATE: |
| return date != null; |
| case FhirResourcePackage.ORDER__SUBJECT: |
| return subject != null; |
| case FhirResourcePackage.ORDER__SOURCE: |
| return source != null; |
| case FhirResourcePackage.ORDER__TARGET: |
| return target != null; |
| case FhirResourcePackage.ORDER__REASONX: |
| return reasonx != null; |
| case FhirResourcePackage.ORDER__WHEN: |
| return when != null; |
| case FhirResourcePackage.ORDER__DETAIL: |
| return details != null && !details.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //OrderImpl |