| /******************************************************************************* |
| * 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.Date; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Identifier; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.Basic; |
| 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>Basic</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.BasicImpl#getIdentifiers <em>Identifier</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.BasicImpl#getCode <em>Code</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.BasicImpl#getSubject <em>Subject</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.BasicImpl#getAuthor <em>Author</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.BasicImpl#getCreated <em>Created</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class BasicImpl extends DomainResourceImpl implements Basic { |
| /** |
| * 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 #getCode() <em>Code</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCode() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept code; |
| |
| /** |
| * 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 #getAuthor() <em>Author</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAuthor() |
| * @generated |
| * @ordered |
| */ |
| protected Resource author; |
| |
| /** |
| * The cached value of the '{@link #getCreated() <em>Created</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getCreated() |
| * @generated |
| * @ordered |
| */ |
| protected Date created; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected BasicImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getBasic(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Identifier> getIdentifiers() { |
| if (identifiers == null) { |
| identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.BASIC__IDENTIFIER); |
| } |
| return identifiers; |
| } |
| |
| /** |
| * <!-- 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.BASIC__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.BASIC__CODE, oldCode, code)); |
| } |
| |
| /** |
| * <!-- 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.BASIC__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.BASIC__SUBJECT, oldSubject, subject)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getAuthor() { |
| if (author != null && author.eIsProxy()) { |
| InternalEObject oldAuthor = (InternalEObject)author; |
| author = (Resource)eResolveProxy(oldAuthor); |
| if (author != oldAuthor) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.BASIC__AUTHOR, oldAuthor, author)); |
| } |
| } |
| return author; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetAuthor() { |
| return author; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAuthor(Resource newAuthor) { |
| Resource oldAuthor = author; |
| author = newAuthor; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.BASIC__AUTHOR, oldAuthor, author)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Date getCreated() { |
| if (created != null && created.eIsProxy()) { |
| InternalEObject oldCreated = (InternalEObject)created; |
| created = (Date)eResolveProxy(oldCreated); |
| if (created != oldCreated) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.BASIC__CREATED, oldCreated, created)); |
| } |
| } |
| return created; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Date basicGetCreated() { |
| return created; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setCreated(Date newCreated) { |
| Date oldCreated = created; |
| created = newCreated; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.BASIC__CREATED, oldCreated, created)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.BASIC__IDENTIFIER: |
| return getIdentifiers(); |
| case FhirResourcePackage.BASIC__CODE: |
| if (resolve) return getCode(); |
| return basicGetCode(); |
| case FhirResourcePackage.BASIC__SUBJECT: |
| if (resolve) return getSubject(); |
| return basicGetSubject(); |
| case FhirResourcePackage.BASIC__AUTHOR: |
| if (resolve) return getAuthor(); |
| return basicGetAuthor(); |
| case FhirResourcePackage.BASIC__CREATED: |
| if (resolve) return getCreated(); |
| return basicGetCreated(); |
| } |
| 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.BASIC__IDENTIFIER: |
| getIdentifiers().clear(); |
| getIdentifiers().addAll((Collection<? extends Identifier>)newValue); |
| return; |
| case FhirResourcePackage.BASIC__CODE: |
| setCode((CodeableConcept)newValue); |
| return; |
| case FhirResourcePackage.BASIC__SUBJECT: |
| setSubject((Resource)newValue); |
| return; |
| case FhirResourcePackage.BASIC__AUTHOR: |
| setAuthor((Resource)newValue); |
| return; |
| case FhirResourcePackage.BASIC__CREATED: |
| setCreated((Date)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.BASIC__IDENTIFIER: |
| getIdentifiers().clear(); |
| return; |
| case FhirResourcePackage.BASIC__CODE: |
| setCode((CodeableConcept)null); |
| return; |
| case FhirResourcePackage.BASIC__SUBJECT: |
| setSubject((Resource)null); |
| return; |
| case FhirResourcePackage.BASIC__AUTHOR: |
| setAuthor((Resource)null); |
| return; |
| case FhirResourcePackage.BASIC__CREATED: |
| setCreated((Date)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.BASIC__IDENTIFIER: |
| return identifiers != null && !identifiers.isEmpty(); |
| case FhirResourcePackage.BASIC__CODE: |
| return code != null; |
| case FhirResourcePackage.BASIC__SUBJECT: |
| return subject != null; |
| case FhirResourcePackage.BASIC__AUTHOR: |
| return author != null; |
| case FhirResourcePackage.BASIC__CREATED: |
| return created != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //BasicImpl |