| /******************************************************************************* |
| * 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 org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.CodeableConcept; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Medication; |
| import org.eclipse.mdht.uml.fhir.core.resource.MedicationPackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.MedicationProduct; |
| import org.eclipse.mdht.uml.fhir.core.resource.Organization; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Medication</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationImpl#getCode <em>Code</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationImpl#getIsBrand <em>Is Brand</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationImpl#getManufacturer <em>Manufacturer</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationImpl#getProduct <em>Product</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.MedicationImpl#getPackage <em>Package</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MedicationImpl extends DomainResourceImpl implements Medication { |
| /** |
| * The cached value of the '{@link #getCode() <em>Code</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCode() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept code; |
| |
| /** |
| * The cached value of the '{@link #getIsBrand() <em>Is Brand</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIsBrand() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.Boolean isBrand; |
| |
| /** |
| * The cached value of the '{@link #getManufacturer() <em>Manufacturer</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getManufacturer() |
| * @generated |
| * @ordered |
| */ |
| protected Organization manufacturer; |
| |
| /** |
| * The cached value of the '{@link #getProduct() <em>Product</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProduct() |
| * @generated |
| * @ordered |
| */ |
| protected MedicationProduct product; |
| |
| /** |
| * The cached value of the '{@link #getPackage() <em>Package</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPackage() |
| * @generated |
| * @ordered |
| */ |
| protected MedicationPackage package_; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MedicationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getMedication(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getCode() { |
| if (code != null && code.eIsProxy()) { |
| InternalEObject oldCode = (InternalEObject)code; |
| code = (CodeableConcept)eResolveProxy(oldCode); |
| if (code != oldCode) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.MEDICATION__CODE, oldCode, code)); |
| } |
| } |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept basicGetCode() { |
| return code; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCode(CodeableConcept newCode) { |
| CodeableConcept oldCode = code; |
| code = newCode; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__CODE, oldCode, code)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean getIsBrand() { |
| if (isBrand != null && isBrand.eIsProxy()) { |
| InternalEObject oldIsBrand = (InternalEObject)isBrand; |
| isBrand = (org.eclipse.mdht.uml.fhir.core.datatype.Boolean)eResolveProxy(oldIsBrand); |
| if (isBrand != oldIsBrand) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.MEDICATION__IS_BRAND, oldIsBrand, isBrand)); |
| } |
| } |
| return isBrand; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean basicGetIsBrand() { |
| return isBrand; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setIsBrand(org.eclipse.mdht.uml.fhir.core.datatype.Boolean newIsBrand) { |
| org.eclipse.mdht.uml.fhir.core.datatype.Boolean oldIsBrand = isBrand; |
| isBrand = newIsBrand; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__IS_BRAND, oldIsBrand, isBrand)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Organization getManufacturer() { |
| if (manufacturer != null && manufacturer.eIsProxy()) { |
| InternalEObject oldManufacturer = (InternalEObject)manufacturer; |
| manufacturer = (Organization)eResolveProxy(oldManufacturer); |
| if (manufacturer != oldManufacturer) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.MEDICATION__MANUFACTURER, oldManufacturer, manufacturer)); |
| } |
| } |
| return manufacturer; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Organization basicGetManufacturer() { |
| return manufacturer; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setManufacturer(Organization newManufacturer) { |
| Organization oldManufacturer = manufacturer; |
| manufacturer = newManufacturer; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__MANUFACTURER, oldManufacturer, manufacturer)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MedicationProduct getProduct() { |
| return product; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetProduct(MedicationProduct newProduct, NotificationChain msgs) { |
| MedicationProduct oldProduct = product; |
| product = newProduct; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__PRODUCT, oldProduct, newProduct); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setProduct(MedicationProduct newProduct) { |
| if (newProduct != product) { |
| NotificationChain msgs = null; |
| if (product != null) |
| msgs = ((InternalEObject)product).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.MEDICATION__PRODUCT, null, msgs); |
| if (newProduct != null) |
| msgs = ((InternalEObject)newProduct).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.MEDICATION__PRODUCT, null, msgs); |
| msgs = basicSetProduct(newProduct, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__PRODUCT, newProduct, newProduct)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public MedicationPackage getPackage() { |
| return package_; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetPackage(MedicationPackage newPackage, NotificationChain msgs) { |
| MedicationPackage oldPackage = package_; |
| package_ = newPackage; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__PACKAGE, oldPackage, newPackage); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPackage(MedicationPackage newPackage) { |
| if (newPackage != package_) { |
| NotificationChain msgs = null; |
| if (package_ != null) |
| msgs = ((InternalEObject)package_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.MEDICATION__PACKAGE, null, msgs); |
| if (newPackage != null) |
| msgs = ((InternalEObject)newPackage).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.MEDICATION__PACKAGE, null, msgs); |
| msgs = basicSetPackage(newPackage, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.MEDICATION__PACKAGE, newPackage, newPackage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION__PRODUCT: |
| return basicSetProduct(null, msgs); |
| case FhirResourcePackage.MEDICATION__PACKAGE: |
| return basicSetPackage(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.MEDICATION__CODE: |
| if (resolve) return getCode(); |
| return basicGetCode(); |
| case FhirResourcePackage.MEDICATION__IS_BRAND: |
| if (resolve) return getIsBrand(); |
| return basicGetIsBrand(); |
| case FhirResourcePackage.MEDICATION__MANUFACTURER: |
| if (resolve) return getManufacturer(); |
| return basicGetManufacturer(); |
| case FhirResourcePackage.MEDICATION__PRODUCT: |
| return getProduct(); |
| case FhirResourcePackage.MEDICATION__PACKAGE: |
| return getPackage(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION__CODE: |
| setCode((CodeableConcept)newValue); |
| return; |
| case FhirResourcePackage.MEDICATION__IS_BRAND: |
| setIsBrand((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)newValue); |
| return; |
| case FhirResourcePackage.MEDICATION__MANUFACTURER: |
| setManufacturer((Organization)newValue); |
| return; |
| case FhirResourcePackage.MEDICATION__PRODUCT: |
| setProduct((MedicationProduct)newValue); |
| return; |
| case FhirResourcePackage.MEDICATION__PACKAGE: |
| setPackage((MedicationPackage)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION__CODE: |
| setCode((CodeableConcept)null); |
| return; |
| case FhirResourcePackage.MEDICATION__IS_BRAND: |
| setIsBrand((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)null); |
| return; |
| case FhirResourcePackage.MEDICATION__MANUFACTURER: |
| setManufacturer((Organization)null); |
| return; |
| case FhirResourcePackage.MEDICATION__PRODUCT: |
| setProduct((MedicationProduct)null); |
| return; |
| case FhirResourcePackage.MEDICATION__PACKAGE: |
| setPackage((MedicationPackage)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.MEDICATION__CODE: |
| return code != null; |
| case FhirResourcePackage.MEDICATION__IS_BRAND: |
| return isBrand != null; |
| case FhirResourcePackage.MEDICATION__MANUFACTURER: |
| return manufacturer != null; |
| case FhirResourcePackage.MEDICATION__PRODUCT: |
| return product != null; |
| case FhirResourcePackage.MEDICATION__PACKAGE: |
| return package_ != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //MedicationImpl |