| /******************************************************************************* |
| * 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.impl.BackboneElementImpl; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.ContractActor; |
| 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>Contract Actor</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ContractActorImpl#getEntity <em>Entity</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.ContractActorImpl#getRoles <em>Role</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ContractActorImpl extends BackboneElementImpl implements ContractActor { |
| /** |
| * The cached value of the '{@link #getEntity() <em>Entity</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEntity() |
| * @generated |
| * @ordered |
| */ |
| protected Resource entity; |
| |
| /** |
| * The cached value of the '{@link #getRoles() <em>Role</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRoles() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CodeableConcept> roles; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ContractActorImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getContractActor(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource getEntity() { |
| if (entity != null && entity.eIsProxy()) { |
| InternalEObject oldEntity = (InternalEObject)entity; |
| entity = (Resource)eResolveProxy(oldEntity); |
| if (entity != oldEntity) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.CONTRACT_ACTOR__ENTITY, oldEntity, entity)); |
| } |
| } |
| return entity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Resource basicGetEntity() { |
| return entity; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEntity(Resource newEntity) { |
| Resource oldEntity = entity; |
| entity = newEntity; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.CONTRACT_ACTOR__ENTITY, oldEntity, entity)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<CodeableConcept> getRoles() { |
| if (roles == null) { |
| roles = new EObjectResolvingEList<CodeableConcept>(CodeableConcept.class, this, FhirResourcePackage.CONTRACT_ACTOR__ROLE); |
| } |
| return roles; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case FhirResourcePackage.CONTRACT_ACTOR__ENTITY: |
| if (resolve) return getEntity(); |
| return basicGetEntity(); |
| case FhirResourcePackage.CONTRACT_ACTOR__ROLE: |
| return getRoles(); |
| } |
| 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.CONTRACT_ACTOR__ENTITY: |
| setEntity((Resource)newValue); |
| return; |
| case FhirResourcePackage.CONTRACT_ACTOR__ROLE: |
| getRoles().clear(); |
| getRoles().addAll((Collection<? extends CodeableConcept>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.CONTRACT_ACTOR__ENTITY: |
| setEntity((Resource)null); |
| return; |
| case FhirResourcePackage.CONTRACT_ACTOR__ROLE: |
| getRoles().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.CONTRACT_ACTOR__ENTITY: |
| return entity != null; |
| case FhirResourcePackage.CONTRACT_ACTOR__ROLE: |
| return roles != null && !roles.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //ContractActorImpl |