| /******************************************************************************* |
| * 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.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.CodeableConcept; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Period; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.impl.BackboneElementImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.CompositionEvent; |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Resource; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Composition Event</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.CompositionEventImpl#getCodes <em>Code</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.CompositionEventImpl#getPeriod <em>Period</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.CompositionEventImpl#getDetails <em>Detail</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CompositionEventImpl extends BackboneElementImpl implements CompositionEvent { |
| /** |
| * The cached value of the '{@link #getCodes() <em>Code</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCodes() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CodeableConcept> codes; |
| |
| /** |
| * The cached value of the '{@link #getPeriod() <em>Period</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPeriod() |
| * @generated |
| * @ordered |
| */ |
| protected Period period; |
| |
| /** |
| * 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 CompositionEventImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getCompositionEvent(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<CodeableConcept> getCodes() { |
| if (codes == null) { |
| codes = new EObjectResolvingEList<CodeableConcept>(CodeableConcept.class, this, FhirResourcePackage.COMPOSITION_EVENT__CODE); |
| } |
| return codes; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Period getPeriod() { |
| if (period != null && period.eIsProxy()) { |
| InternalEObject oldPeriod = (InternalEObject)period; |
| period = (Period)eResolveProxy(oldPeriod); |
| if (period != oldPeriod) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.COMPOSITION_EVENT__PERIOD, oldPeriod, period)); |
| } |
| } |
| return period; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Period basicGetPeriod() { |
| return period; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPeriod(Period newPeriod) { |
| Period oldPeriod = period; |
| period = newPeriod; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.COMPOSITION_EVENT__PERIOD, oldPeriod, period)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Resource> getDetails() { |
| if (details == null) { |
| details = new EObjectResolvingEList<Resource>(Resource.class, this, FhirResourcePackage.COMPOSITION_EVENT__DETAIL); |
| } |
| return details; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.COMPOSITION_EVENT__CODE: |
| return getCodes(); |
| case FhirResourcePackage.COMPOSITION_EVENT__PERIOD: |
| if (resolve) return getPeriod(); |
| return basicGetPeriod(); |
| case FhirResourcePackage.COMPOSITION_EVENT__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.COMPOSITION_EVENT__CODE: |
| getCodes().clear(); |
| getCodes().addAll((Collection<? extends CodeableConcept>)newValue); |
| return; |
| case FhirResourcePackage.COMPOSITION_EVENT__PERIOD: |
| setPeriod((Period)newValue); |
| return; |
| case FhirResourcePackage.COMPOSITION_EVENT__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.COMPOSITION_EVENT__CODE: |
| getCodes().clear(); |
| return; |
| case FhirResourcePackage.COMPOSITION_EVENT__PERIOD: |
| setPeriod((Period)null); |
| return; |
| case FhirResourcePackage.COMPOSITION_EVENT__DETAIL: |
| getDetails().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.COMPOSITION_EVENT__CODE: |
| return codes != null && !codes.isEmpty(); |
| case FhirResourcePackage.COMPOSITION_EVENT__PERIOD: |
| return period != null; |
| case FhirResourcePackage.COMPOSITION_EVENT__DETAIL: |
| return details != null && !details.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //CompositionEventImpl |