| /******************************************************************************* |
| * 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.Code; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Coding; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Uri; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.impl.BackboneElementImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.ProvenanceAgent; |
| import org.eclipse.mdht.uml.fhir.core.resource.ProvenanceEntity; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Provenance Entity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ProvenanceEntityImpl#getRole <em>Role</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ProvenanceEntityImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ProvenanceEntityImpl#getReference <em>Reference</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ProvenanceEntityImpl#getDisplay <em>Display</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ProvenanceEntityImpl#getAgent <em>Agent</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ProvenanceEntityImpl extends BackboneElementImpl implements ProvenanceEntity { |
| /** |
| * The cached value of the '{@link #getRole() <em>Role</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRole() |
| * @generated |
| * @ordered |
| */ |
| protected Code role; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected Coding type; |
| |
| /** |
| * The cached value of the '{@link #getReference() <em>Reference</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getReference() |
| * @generated |
| * @ordered |
| */ |
| protected Uri reference; |
| |
| /** |
| * The cached value of the '{@link #getDisplay() <em>Display</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDisplay() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.String display; |
| |
| /** |
| * The cached value of the '{@link #getAgent() <em>Agent</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAgent() |
| * @generated |
| * @ordered |
| */ |
| protected ProvenanceAgent agent; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ProvenanceEntityImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getProvenanceEntity(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code getRole() { |
| if (role != null && role.eIsProxy()) { |
| InternalEObject oldRole = (InternalEObject)role; |
| role = (Code)eResolveProxy(oldRole); |
| if (role != oldRole) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.PROVENANCE_ENTITY__ROLE, oldRole, role)); |
| } |
| } |
| return role; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code basicGetRole() { |
| return role; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setRole(Code newRole) { |
| Code oldRole = role; |
| role = newRole; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__ROLE, oldRole, role)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Coding getType() { |
| if (type != null && type.eIsProxy()) { |
| InternalEObject oldType = (InternalEObject)type; |
| type = (Coding)eResolveProxy(oldType); |
| if (type != oldType) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.PROVENANCE_ENTITY__TYPE, oldType, type)); |
| } |
| } |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Coding basicGetType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(Coding newType) { |
| Coding oldType = type; |
| type = newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Uri getReference() { |
| if (reference != null && reference.eIsProxy()) { |
| InternalEObject oldReference = (InternalEObject)reference; |
| reference = (Uri)eResolveProxy(oldReference); |
| if (reference != oldReference) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE, oldReference, reference)); |
| } |
| } |
| return reference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Uri basicGetReference() { |
| return reference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReference(Uri newReference) { |
| Uri oldReference = reference; |
| reference = newReference; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE, oldReference, reference)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String getDisplay() { |
| if (display != null && display.eIsProxy()) { |
| InternalEObject oldDisplay = (InternalEObject)display; |
| display = (org.eclipse.mdht.uml.fhir.core.datatype.String)eResolveProxy(oldDisplay); |
| if (display != oldDisplay) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY, oldDisplay, display)); |
| } |
| } |
| return display; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String basicGetDisplay() { |
| return display; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDisplay(org.eclipse.mdht.uml.fhir.core.datatype.String newDisplay) { |
| org.eclipse.mdht.uml.fhir.core.datatype.String oldDisplay = display; |
| display = newDisplay; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY, oldDisplay, display)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ProvenanceAgent getAgent() { |
| return agent; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAgent(ProvenanceAgent newAgent, NotificationChain msgs) { |
| ProvenanceAgent oldAgent = agent; |
| agent = newAgent; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__AGENT, oldAgent, newAgent); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAgent(ProvenanceAgent newAgent) { |
| if (newAgent != agent) { |
| NotificationChain msgs = null; |
| if (agent != null) |
| msgs = ((InternalEObject)agent).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.PROVENANCE_ENTITY__AGENT, null, msgs); |
| if (newAgent != null) |
| msgs = ((InternalEObject)newAgent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirResourcePackage.PROVENANCE_ENTITY__AGENT, null, msgs); |
| msgs = basicSetAgent(newAgent, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.PROVENANCE_ENTITY__AGENT, newAgent, newAgent)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirResourcePackage.PROVENANCE_ENTITY__AGENT: |
| return basicSetAgent(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.PROVENANCE_ENTITY__ROLE: |
| if (resolve) return getRole(); |
| return basicGetRole(); |
| case FhirResourcePackage.PROVENANCE_ENTITY__TYPE: |
| if (resolve) return getType(); |
| return basicGetType(); |
| case FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE: |
| if (resolve) return getReference(); |
| return basicGetReference(); |
| case FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY: |
| if (resolve) return getDisplay(); |
| return basicGetDisplay(); |
| case FhirResourcePackage.PROVENANCE_ENTITY__AGENT: |
| return getAgent(); |
| } |
| 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.PROVENANCE_ENTITY__ROLE: |
| setRole((Code)newValue); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__TYPE: |
| setType((Coding)newValue); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE: |
| setReference((Uri)newValue); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY: |
| setDisplay((org.eclipse.mdht.uml.fhir.core.datatype.String)newValue); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__AGENT: |
| setAgent((ProvenanceAgent)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.PROVENANCE_ENTITY__ROLE: |
| setRole((Code)null); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__TYPE: |
| setType((Coding)null); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE: |
| setReference((Uri)null); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY: |
| setDisplay((org.eclipse.mdht.uml.fhir.core.datatype.String)null); |
| return; |
| case FhirResourcePackage.PROVENANCE_ENTITY__AGENT: |
| setAgent((ProvenanceAgent)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.PROVENANCE_ENTITY__ROLE: |
| return role != null; |
| case FhirResourcePackage.PROVENANCE_ENTITY__TYPE: |
| return type != null; |
| case FhirResourcePackage.PROVENANCE_ENTITY__REFERENCE: |
| return reference != null; |
| case FhirResourcePackage.PROVENANCE_ENTITY__DISPLAY: |
| return display != null; |
| case FhirResourcePackage.PROVENANCE_ENTITY__AGENT: |
| return agent != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ProvenanceEntityImpl |