| /** |
| */ |
| package org.hl7.fhir.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.InternalEList; |
| |
| import org.hl7.fhir.Address; |
| import org.hl7.fhir.Code; |
| import org.hl7.fhir.CodeableConcept; |
| import org.hl7.fhir.ContactPoint; |
| import org.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.HumanName; |
| import org.hl7.fhir.PatientContact; |
| import org.hl7.fhir.Period; |
| import org.hl7.fhir.Reference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Patient Contact</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getRelationship <em>Relationship</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getTelecom <em>Telecom</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getAddress <em>Address</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getGender <em>Gender</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getOrganization <em>Organization</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PatientContactImpl#getPeriod <em>Period</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PatientContactImpl extends BackboneElementImpl implements PatientContact { |
| /** |
| * The cached value of the '{@link #getRelationship() <em>Relationship</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRelationship() |
| * @generated |
| * @ordered |
| */ |
| protected EList<CodeableConcept> relationship; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected HumanName name; |
| |
| /** |
| * The cached value of the '{@link #getTelecom() <em>Telecom</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTelecom() |
| * @generated |
| * @ordered |
| */ |
| protected EList<ContactPoint> telecom; |
| |
| /** |
| * The cached value of the '{@link #getAddress() <em>Address</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAddress() |
| * @generated |
| * @ordered |
| */ |
| protected Address address; |
| |
| /** |
| * The cached value of the '{@link #getGender() <em>Gender</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getGender() |
| * @generated |
| * @ordered |
| */ |
| protected Code gender; |
| |
| /** |
| * The cached value of the '{@link #getOrganization() <em>Organization</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOrganization() |
| * @generated |
| * @ordered |
| */ |
| protected Reference organization; |
| |
| /** |
| * The cached value of the '{@link #getPeriod() <em>Period</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPeriod() |
| * @generated |
| * @ordered |
| */ |
| protected Period period; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PatientContactImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getPatientContact(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<CodeableConcept> getRelationship() { |
| if (relationship == null) { |
| relationship = new EObjectContainmentEList<CodeableConcept>(CodeableConcept.class, this, FhirPackage.PATIENT_CONTACT__RELATIONSHIP); |
| } |
| return relationship; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public HumanName getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetName(HumanName newName, NotificationChain msgs) { |
| HumanName oldName = name; |
| name = newName; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__NAME, oldName, newName); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(HumanName newName) { |
| if (newName != name) { |
| NotificationChain msgs = null; |
| if (name != null) |
| msgs = ((InternalEObject)name).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__NAME, null, msgs); |
| if (newName != null) |
| msgs = ((InternalEObject)newName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__NAME, null, msgs); |
| msgs = basicSetName(newName, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__NAME, newName, newName)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ContactPoint> getTelecom() { |
| if (telecom == null) { |
| telecom = new EObjectContainmentEList<ContactPoint>(ContactPoint.class, this, FhirPackage.PATIENT_CONTACT__TELECOM); |
| } |
| return telecom; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Address getAddress() { |
| return address; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetAddress(Address newAddress, NotificationChain msgs) { |
| Address oldAddress = address; |
| address = newAddress; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__ADDRESS, oldAddress, newAddress); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setAddress(Address newAddress) { |
| if (newAddress != address) { |
| NotificationChain msgs = null; |
| if (address != null) |
| msgs = ((InternalEObject)address).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__ADDRESS, null, msgs); |
| if (newAddress != null) |
| msgs = ((InternalEObject)newAddress).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__ADDRESS, null, msgs); |
| msgs = basicSetAddress(newAddress, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__ADDRESS, newAddress, newAddress)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Code getGender() { |
| return gender; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetGender(Code newGender, NotificationChain msgs) { |
| Code oldGender = gender; |
| gender = newGender; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__GENDER, oldGender, newGender); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setGender(Code newGender) { |
| if (newGender != gender) { |
| NotificationChain msgs = null; |
| if (gender != null) |
| msgs = ((InternalEObject)gender).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__GENDER, null, msgs); |
| if (newGender != null) |
| msgs = ((InternalEObject)newGender).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__GENDER, null, msgs); |
| msgs = basicSetGender(newGender, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__GENDER, newGender, newGender)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Reference getOrganization() { |
| return organization; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOrganization(Reference newOrganization, NotificationChain msgs) { |
| Reference oldOrganization = organization; |
| organization = newOrganization; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__ORGANIZATION, oldOrganization, newOrganization); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOrganization(Reference newOrganization) { |
| if (newOrganization != organization) { |
| NotificationChain msgs = null; |
| if (organization != null) |
| msgs = ((InternalEObject)organization).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__ORGANIZATION, null, msgs); |
| if (newOrganization != null) |
| msgs = ((InternalEObject)newOrganization).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__ORGANIZATION, null, msgs); |
| msgs = basicSetOrganization(newOrganization, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__ORGANIZATION, newOrganization, newOrganization)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Period getPeriod() { |
| return period; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetPeriod(Period newPeriod, NotificationChain msgs) { |
| Period oldPeriod = period; |
| period = newPeriod; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__PERIOD, oldPeriod, newPeriod); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPeriod(Period newPeriod) { |
| if (newPeriod != period) { |
| NotificationChain msgs = null; |
| if (period != null) |
| msgs = ((InternalEObject)period).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__PERIOD, null, msgs); |
| if (newPeriod != null) |
| msgs = ((InternalEObject)newPeriod).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PATIENT_CONTACT__PERIOD, null, msgs); |
| msgs = basicSetPeriod(newPeriod, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PATIENT_CONTACT__PERIOD, newPeriod, newPeriod)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.PATIENT_CONTACT__RELATIONSHIP: |
| return ((InternalEList<?>)getRelationship()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PATIENT_CONTACT__NAME: |
| return basicSetName(null, msgs); |
| case FhirPackage.PATIENT_CONTACT__TELECOM: |
| return ((InternalEList<?>)getTelecom()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PATIENT_CONTACT__ADDRESS: |
| return basicSetAddress(null, msgs); |
| case FhirPackage.PATIENT_CONTACT__GENDER: |
| return basicSetGender(null, msgs); |
| case FhirPackage.PATIENT_CONTACT__ORGANIZATION: |
| return basicSetOrganization(null, msgs); |
| case FhirPackage.PATIENT_CONTACT__PERIOD: |
| return basicSetPeriod(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 FhirPackage.PATIENT_CONTACT__RELATIONSHIP: |
| return getRelationship(); |
| case FhirPackage.PATIENT_CONTACT__NAME: |
| return getName(); |
| case FhirPackage.PATIENT_CONTACT__TELECOM: |
| return getTelecom(); |
| case FhirPackage.PATIENT_CONTACT__ADDRESS: |
| return getAddress(); |
| case FhirPackage.PATIENT_CONTACT__GENDER: |
| return getGender(); |
| case FhirPackage.PATIENT_CONTACT__ORGANIZATION: |
| return getOrganization(); |
| case FhirPackage.PATIENT_CONTACT__PERIOD: |
| return getPeriod(); |
| } |
| 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 FhirPackage.PATIENT_CONTACT__RELATIONSHIP: |
| getRelationship().clear(); |
| getRelationship().addAll((Collection<? extends CodeableConcept>)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__NAME: |
| setName((HumanName)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__TELECOM: |
| getTelecom().clear(); |
| getTelecom().addAll((Collection<? extends ContactPoint>)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__ADDRESS: |
| setAddress((Address)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__GENDER: |
| setGender((Code)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__ORGANIZATION: |
| setOrganization((Reference)newValue); |
| return; |
| case FhirPackage.PATIENT_CONTACT__PERIOD: |
| setPeriod((Period)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.PATIENT_CONTACT__RELATIONSHIP: |
| getRelationship().clear(); |
| return; |
| case FhirPackage.PATIENT_CONTACT__NAME: |
| setName((HumanName)null); |
| return; |
| case FhirPackage.PATIENT_CONTACT__TELECOM: |
| getTelecom().clear(); |
| return; |
| case FhirPackage.PATIENT_CONTACT__ADDRESS: |
| setAddress((Address)null); |
| return; |
| case FhirPackage.PATIENT_CONTACT__GENDER: |
| setGender((Code)null); |
| return; |
| case FhirPackage.PATIENT_CONTACT__ORGANIZATION: |
| setOrganization((Reference)null); |
| return; |
| case FhirPackage.PATIENT_CONTACT__PERIOD: |
| setPeriod((Period)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.PATIENT_CONTACT__RELATIONSHIP: |
| return relationship != null && !relationship.isEmpty(); |
| case FhirPackage.PATIENT_CONTACT__NAME: |
| return name != null; |
| case FhirPackage.PATIENT_CONTACT__TELECOM: |
| return telecom != null && !telecom.isEmpty(); |
| case FhirPackage.PATIENT_CONTACT__ADDRESS: |
| return address != null; |
| case FhirPackage.PATIENT_CONTACT__GENDER: |
| return gender != null; |
| case FhirPackage.PATIENT_CONTACT__ORGANIZATION: |
| return organization != null; |
| case FhirPackage.PATIENT_CONTACT__PERIOD: |
| return period != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //PatientContactImpl |