| /******************************************************************************* |
| * 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.notify.NotificationChain; |
| |
| 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.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.mdht.uml.fhir.core.datatype.Address; |
| import org.eclipse.mdht.uml.fhir.core.datatype.CodeableConcept; |
| import org.eclipse.mdht.uml.fhir.core.datatype.ContactPoint; |
| import org.eclipse.mdht.uml.fhir.core.datatype.Identifier; |
| |
| import org.eclipse.mdht.uml.fhir.core.resource.FhirResourcePackage; |
| import org.eclipse.mdht.uml.fhir.core.resource.Organization; |
| import org.eclipse.mdht.uml.fhir.core.resource.OrganizationContact; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Organization</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getIdentifiers <em>Identifier</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getActive <em>Active</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getType <em>Type</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getTelecoms <em>Telecom</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getAddresses <em>Address</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getPartOf <em>Part Of</em>}</li> |
| * <li>{@link org.eclipse.mdht.uml.fhir.core.resource.impl.OrganizationImpl#getContacts <em>Contact</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class OrganizationImpl extends DomainResourceImpl implements Organization { |
| /** |
| * 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 #getActive() <em>Active</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getActive() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.Boolean active; |
| |
| /** |
| * The cached value of the '{@link #getType() <em>Type</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getType() |
| * @generated |
| * @ordered |
| */ |
| protected CodeableConcept type; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.mdht.uml.fhir.core.datatype.String name; |
| |
| /** |
| * The cached value of the '{@link #getTelecoms() <em>Telecom</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTelecoms() |
| * @generated |
| * @ordered |
| */ |
| protected EList<ContactPoint> telecoms; |
| |
| /** |
| * The cached value of the '{@link #getAddresses() <em>Address</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAddresses() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Address> addresses; |
| |
| /** |
| * The cached value of the '{@link #getPartOf() <em>Part Of</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPartOf() |
| * @generated |
| * @ordered |
| */ |
| protected Organization partOf; |
| |
| /** |
| * The cached value of the '{@link #getContacts() <em>Contact</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContacts() |
| * @generated |
| * @ordered |
| */ |
| protected EList<OrganizationContact> contacts; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected OrganizationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirResourcePackage.eINSTANCE.getOrganization(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Identifier> getIdentifiers() { |
| if (identifiers == null) { |
| identifiers = new EObjectResolvingEList<Identifier>(Identifier.class, this, FhirResourcePackage.ORGANIZATION__IDENTIFIER); |
| } |
| return identifiers; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean getActive() { |
| if (active != null && active.eIsProxy()) { |
| InternalEObject oldActive = (InternalEObject)active; |
| active = (org.eclipse.mdht.uml.fhir.core.datatype.Boolean)eResolveProxy(oldActive); |
| if (active != oldActive) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORGANIZATION__ACTIVE, oldActive, active)); |
| } |
| } |
| return active; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.Boolean basicGetActive() { |
| return active; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setActive(org.eclipse.mdht.uml.fhir.core.datatype.Boolean newActive) { |
| org.eclipse.mdht.uml.fhir.core.datatype.Boolean oldActive = active; |
| active = newActive; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORGANIZATION__ACTIVE, oldActive, active)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept getType() { |
| if (type != null && type.eIsProxy()) { |
| InternalEObject oldType = (InternalEObject)type; |
| type = (CodeableConcept)eResolveProxy(oldType); |
| if (type != oldType) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORGANIZATION__TYPE, oldType, type)); |
| } |
| } |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public CodeableConcept basicGetType() { |
| return type; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setType(CodeableConcept newType) { |
| CodeableConcept oldType = type; |
| type = newType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORGANIZATION__TYPE, oldType, type)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String getName() { |
| if (name != null && name.eIsProxy()) { |
| InternalEObject oldName = (InternalEObject)name; |
| name = (org.eclipse.mdht.uml.fhir.core.datatype.String)eResolveProxy(oldName); |
| if (name != oldName) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORGANIZATION__NAME, oldName, name)); |
| } |
| } |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.mdht.uml.fhir.core.datatype.String basicGetName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(org.eclipse.mdht.uml.fhir.core.datatype.String newName) { |
| org.eclipse.mdht.uml.fhir.core.datatype.String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORGANIZATION__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ContactPoint> getTelecoms() { |
| if (telecoms == null) { |
| telecoms = new EObjectResolvingEList<ContactPoint>(ContactPoint.class, this, FhirResourcePackage.ORGANIZATION__TELECOM); |
| } |
| return telecoms; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Address> getAddresses() { |
| if (addresses == null) { |
| addresses = new EObjectResolvingEList<Address>(Address.class, this, FhirResourcePackage.ORGANIZATION__ADDRESS); |
| } |
| return addresses; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Organization getPartOf() { |
| if (partOf != null && partOf.eIsProxy()) { |
| InternalEObject oldPartOf = (InternalEObject)partOf; |
| partOf = (Organization)eResolveProxy(oldPartOf); |
| if (partOf != oldPartOf) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FhirResourcePackage.ORGANIZATION__PART_OF, oldPartOf, partOf)); |
| } |
| } |
| return partOf; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Organization basicGetPartOf() { |
| return partOf; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPartOf(Organization newPartOf) { |
| Organization oldPartOf = partOf; |
| partOf = newPartOf; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirResourcePackage.ORGANIZATION__PART_OF, oldPartOf, partOf)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<OrganizationContact> getContacts() { |
| if (contacts == null) { |
| contacts = new EObjectContainmentEList<OrganizationContact>(OrganizationContact.class, this, FhirResourcePackage.ORGANIZATION__CONTACT); |
| } |
| return contacts; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirResourcePackage.ORGANIZATION__CONTACT: |
| return ((InternalEList<?>)getContacts()).basicRemove(otherEnd, 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.ORGANIZATION__IDENTIFIER: |
| return getIdentifiers(); |
| case FhirResourcePackage.ORGANIZATION__ACTIVE: |
| if (resolve) return getActive(); |
| return basicGetActive(); |
| case FhirResourcePackage.ORGANIZATION__TYPE: |
| if (resolve) return getType(); |
| return basicGetType(); |
| case FhirResourcePackage.ORGANIZATION__NAME: |
| if (resolve) return getName(); |
| return basicGetName(); |
| case FhirResourcePackage.ORGANIZATION__TELECOM: |
| return getTelecoms(); |
| case FhirResourcePackage.ORGANIZATION__ADDRESS: |
| return getAddresses(); |
| case FhirResourcePackage.ORGANIZATION__PART_OF: |
| if (resolve) return getPartOf(); |
| return basicGetPartOf(); |
| case FhirResourcePackage.ORGANIZATION__CONTACT: |
| return getContacts(); |
| } |
| 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.ORGANIZATION__IDENTIFIER: |
| getIdentifiers().clear(); |
| getIdentifiers().addAll((Collection<? extends Identifier>)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__ACTIVE: |
| setActive((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__TYPE: |
| setType((CodeableConcept)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__NAME: |
| setName((org.eclipse.mdht.uml.fhir.core.datatype.String)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__TELECOM: |
| getTelecoms().clear(); |
| getTelecoms().addAll((Collection<? extends ContactPoint>)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__ADDRESS: |
| getAddresses().clear(); |
| getAddresses().addAll((Collection<? extends Address>)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__PART_OF: |
| setPartOf((Organization)newValue); |
| return; |
| case FhirResourcePackage.ORGANIZATION__CONTACT: |
| getContacts().clear(); |
| getContacts().addAll((Collection<? extends OrganizationContact>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ORGANIZATION__IDENTIFIER: |
| getIdentifiers().clear(); |
| return; |
| case FhirResourcePackage.ORGANIZATION__ACTIVE: |
| setActive((org.eclipse.mdht.uml.fhir.core.datatype.Boolean)null); |
| return; |
| case FhirResourcePackage.ORGANIZATION__TYPE: |
| setType((CodeableConcept)null); |
| return; |
| case FhirResourcePackage.ORGANIZATION__NAME: |
| setName((org.eclipse.mdht.uml.fhir.core.datatype.String)null); |
| return; |
| case FhirResourcePackage.ORGANIZATION__TELECOM: |
| getTelecoms().clear(); |
| return; |
| case FhirResourcePackage.ORGANIZATION__ADDRESS: |
| getAddresses().clear(); |
| return; |
| case FhirResourcePackage.ORGANIZATION__PART_OF: |
| setPartOf((Organization)null); |
| return; |
| case FhirResourcePackage.ORGANIZATION__CONTACT: |
| getContacts().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirResourcePackage.ORGANIZATION__IDENTIFIER: |
| return identifiers != null && !identifiers.isEmpty(); |
| case FhirResourcePackage.ORGANIZATION__ACTIVE: |
| return active != null; |
| case FhirResourcePackage.ORGANIZATION__TYPE: |
| return type != null; |
| case FhirResourcePackage.ORGANIZATION__NAME: |
| return name != null; |
| case FhirResourcePackage.ORGANIZATION__TELECOM: |
| return telecoms != null && !telecoms.isEmpty(); |
| case FhirResourcePackage.ORGANIZATION__ADDRESS: |
| return addresses != null && !addresses.isEmpty(); |
| case FhirResourcePackage.ORGANIZATION__PART_OF: |
| return partOf != null; |
| case FhirResourcePackage.ORGANIZATION__CONTACT: |
| return contacts != null && !contacts.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //OrganizationImpl |