| /** |
| */ |
| 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.Attachment; |
| import org.hl7.fhir.Code; |
| import org.hl7.fhir.ContactPoint; |
| import org.hl7.fhir.Date; |
| import org.hl7.fhir.FhirPackage; |
| import org.hl7.fhir.HumanName; |
| import org.hl7.fhir.Identifier; |
| import org.hl7.fhir.Person; |
| import org.hl7.fhir.PersonLink; |
| import org.hl7.fhir.Reference; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Person</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getIdentifier <em>Identifier</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getName <em>Name</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getTelecom <em>Telecom</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getGender <em>Gender</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getBirthDate <em>Birth Date</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getAddress <em>Address</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getPhoto <em>Photo</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getManagingOrganization <em>Managing Organization</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getActive <em>Active</em>}</li> |
| * <li>{@link org.hl7.fhir.impl.PersonImpl#getLink <em>Link</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PersonImpl extends DomainResourceImpl implements Person { |
| /** |
| * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getIdentifier() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Identifier> identifier; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected EList<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 #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 #getBirthDate() <em>Birth Date</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBirthDate() |
| * @generated |
| * @ordered |
| */ |
| protected Date birthDate; |
| |
| /** |
| * The cached value of the '{@link #getAddress() <em>Address</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getAddress() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Address> address; |
| |
| /** |
| * The cached value of the '{@link #getPhoto() <em>Photo</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPhoto() |
| * @generated |
| * @ordered |
| */ |
| protected Attachment photo; |
| |
| /** |
| * The cached value of the '{@link #getManagingOrganization() <em>Managing Organization</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getManagingOrganization() |
| * @generated |
| * @ordered |
| */ |
| protected Reference managingOrganization; |
| |
| /** |
| * The cached value of the '{@link #getActive() <em>Active</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getActive() |
| * @generated |
| * @ordered |
| */ |
| protected org.hl7.fhir.Boolean active; |
| |
| /** |
| * The cached value of the '{@link #getLink() <em>Link</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLink() |
| * @generated |
| * @ordered |
| */ |
| protected EList<PersonLink> link; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PersonImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FhirPackage.eINSTANCE.getPerson(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Identifier> getIdentifier() { |
| if (identifier == null) { |
| identifier = new EObjectContainmentEList<Identifier>(Identifier.class, this, FhirPackage.PERSON__IDENTIFIER); |
| } |
| return identifier; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<HumanName> getName() { |
| if (name == null) { |
| name = new EObjectContainmentEList<HumanName>(HumanName.class, this, FhirPackage.PERSON__NAME); |
| } |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ContactPoint> getTelecom() { |
| if (telecom == null) { |
| telecom = new EObjectContainmentEList<ContactPoint>(ContactPoint.class, this, FhirPackage.PERSON__TELECOM); |
| } |
| return telecom; |
| } |
| |
| /** |
| * <!-- 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.PERSON__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.PERSON__GENDER, null, msgs); |
| if (newGender != null) |
| msgs = ((InternalEObject)newGender).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__GENDER, null, msgs); |
| msgs = basicSetGender(newGender, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__GENDER, newGender, newGender)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Date getBirthDate() { |
| return birthDate; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetBirthDate(Date newBirthDate, NotificationChain msgs) { |
| Date oldBirthDate = birthDate; |
| birthDate = newBirthDate; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__BIRTH_DATE, oldBirthDate, newBirthDate); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBirthDate(Date newBirthDate) { |
| if (newBirthDate != birthDate) { |
| NotificationChain msgs = null; |
| if (birthDate != null) |
| msgs = ((InternalEObject)birthDate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__BIRTH_DATE, null, msgs); |
| if (newBirthDate != null) |
| msgs = ((InternalEObject)newBirthDate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__BIRTH_DATE, null, msgs); |
| msgs = basicSetBirthDate(newBirthDate, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__BIRTH_DATE, newBirthDate, newBirthDate)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Address> getAddress() { |
| if (address == null) { |
| address = new EObjectContainmentEList<Address>(Address.class, this, FhirPackage.PERSON__ADDRESS); |
| } |
| return address; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Attachment getPhoto() { |
| return photo; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetPhoto(Attachment newPhoto, NotificationChain msgs) { |
| Attachment oldPhoto = photo; |
| photo = newPhoto; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__PHOTO, oldPhoto, newPhoto); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPhoto(Attachment newPhoto) { |
| if (newPhoto != photo) { |
| NotificationChain msgs = null; |
| if (photo != null) |
| msgs = ((InternalEObject)photo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__PHOTO, null, msgs); |
| if (newPhoto != null) |
| msgs = ((InternalEObject)newPhoto).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__PHOTO, null, msgs); |
| msgs = basicSetPhoto(newPhoto, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__PHOTO, newPhoto, newPhoto)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Reference getManagingOrganization() { |
| return managingOrganization; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetManagingOrganization(Reference newManagingOrganization, NotificationChain msgs) { |
| Reference oldManagingOrganization = managingOrganization; |
| managingOrganization = newManagingOrganization; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__MANAGING_ORGANIZATION, oldManagingOrganization, newManagingOrganization); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setManagingOrganization(Reference newManagingOrganization) { |
| if (newManagingOrganization != managingOrganization) { |
| NotificationChain msgs = null; |
| if (managingOrganization != null) |
| msgs = ((InternalEObject)managingOrganization).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__MANAGING_ORGANIZATION, null, msgs); |
| if (newManagingOrganization != null) |
| msgs = ((InternalEObject)newManagingOrganization).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__MANAGING_ORGANIZATION, null, msgs); |
| msgs = basicSetManagingOrganization(newManagingOrganization, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__MANAGING_ORGANIZATION, newManagingOrganization, newManagingOrganization)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.hl7.fhir.Boolean getActive() { |
| return active; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetActive(org.hl7.fhir.Boolean newActive, NotificationChain msgs) { |
| org.hl7.fhir.Boolean oldActive = active; |
| active = newActive; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__ACTIVE, oldActive, newActive); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setActive(org.hl7.fhir.Boolean newActive) { |
| if (newActive != active) { |
| NotificationChain msgs = null; |
| if (active != null) |
| msgs = ((InternalEObject)active).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__ACTIVE, null, msgs); |
| if (newActive != null) |
| msgs = ((InternalEObject)newActive).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.PERSON__ACTIVE, null, msgs); |
| msgs = basicSetActive(newActive, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.PERSON__ACTIVE, newActive, newActive)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<PersonLink> getLink() { |
| if (link == null) { |
| link = new EObjectContainmentEList<PersonLink>(PersonLink.class, this, FhirPackage.PERSON__LINK); |
| } |
| return link; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FhirPackage.PERSON__IDENTIFIER: |
| return ((InternalEList<?>)getIdentifier()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PERSON__NAME: |
| return ((InternalEList<?>)getName()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PERSON__TELECOM: |
| return ((InternalEList<?>)getTelecom()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PERSON__GENDER: |
| return basicSetGender(null, msgs); |
| case FhirPackage.PERSON__BIRTH_DATE: |
| return basicSetBirthDate(null, msgs); |
| case FhirPackage.PERSON__ADDRESS: |
| return ((InternalEList<?>)getAddress()).basicRemove(otherEnd, msgs); |
| case FhirPackage.PERSON__PHOTO: |
| return basicSetPhoto(null, msgs); |
| case FhirPackage.PERSON__MANAGING_ORGANIZATION: |
| return basicSetManagingOrganization(null, msgs); |
| case FhirPackage.PERSON__ACTIVE: |
| return basicSetActive(null, msgs); |
| case FhirPackage.PERSON__LINK: |
| return ((InternalEList<?>)getLink()).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 FhirPackage.PERSON__IDENTIFIER: |
| return getIdentifier(); |
| case FhirPackage.PERSON__NAME: |
| return getName(); |
| case FhirPackage.PERSON__TELECOM: |
| return getTelecom(); |
| case FhirPackage.PERSON__GENDER: |
| return getGender(); |
| case FhirPackage.PERSON__BIRTH_DATE: |
| return getBirthDate(); |
| case FhirPackage.PERSON__ADDRESS: |
| return getAddress(); |
| case FhirPackage.PERSON__PHOTO: |
| return getPhoto(); |
| case FhirPackage.PERSON__MANAGING_ORGANIZATION: |
| return getManagingOrganization(); |
| case FhirPackage.PERSON__ACTIVE: |
| return getActive(); |
| case FhirPackage.PERSON__LINK: |
| return getLink(); |
| } |
| 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.PERSON__IDENTIFIER: |
| getIdentifier().clear(); |
| getIdentifier().addAll((Collection<? extends Identifier>)newValue); |
| return; |
| case FhirPackage.PERSON__NAME: |
| getName().clear(); |
| getName().addAll((Collection<? extends HumanName>)newValue); |
| return; |
| case FhirPackage.PERSON__TELECOM: |
| getTelecom().clear(); |
| getTelecom().addAll((Collection<? extends ContactPoint>)newValue); |
| return; |
| case FhirPackage.PERSON__GENDER: |
| setGender((Code)newValue); |
| return; |
| case FhirPackage.PERSON__BIRTH_DATE: |
| setBirthDate((Date)newValue); |
| return; |
| case FhirPackage.PERSON__ADDRESS: |
| getAddress().clear(); |
| getAddress().addAll((Collection<? extends Address>)newValue); |
| return; |
| case FhirPackage.PERSON__PHOTO: |
| setPhoto((Attachment)newValue); |
| return; |
| case FhirPackage.PERSON__MANAGING_ORGANIZATION: |
| setManagingOrganization((Reference)newValue); |
| return; |
| case FhirPackage.PERSON__ACTIVE: |
| setActive((org.hl7.fhir.Boolean)newValue); |
| return; |
| case FhirPackage.PERSON__LINK: |
| getLink().clear(); |
| getLink().addAll((Collection<? extends PersonLink>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FhirPackage.PERSON__IDENTIFIER: |
| getIdentifier().clear(); |
| return; |
| case FhirPackage.PERSON__NAME: |
| getName().clear(); |
| return; |
| case FhirPackage.PERSON__TELECOM: |
| getTelecom().clear(); |
| return; |
| case FhirPackage.PERSON__GENDER: |
| setGender((Code)null); |
| return; |
| case FhirPackage.PERSON__BIRTH_DATE: |
| setBirthDate((Date)null); |
| return; |
| case FhirPackage.PERSON__ADDRESS: |
| getAddress().clear(); |
| return; |
| case FhirPackage.PERSON__PHOTO: |
| setPhoto((Attachment)null); |
| return; |
| case FhirPackage.PERSON__MANAGING_ORGANIZATION: |
| setManagingOrganization((Reference)null); |
| return; |
| case FhirPackage.PERSON__ACTIVE: |
| setActive((org.hl7.fhir.Boolean)null); |
| return; |
| case FhirPackage.PERSON__LINK: |
| getLink().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FhirPackage.PERSON__IDENTIFIER: |
| return identifier != null && !identifier.isEmpty(); |
| case FhirPackage.PERSON__NAME: |
| return name != null && !name.isEmpty(); |
| case FhirPackage.PERSON__TELECOM: |
| return telecom != null && !telecom.isEmpty(); |
| case FhirPackage.PERSON__GENDER: |
| return gender != null; |
| case FhirPackage.PERSON__BIRTH_DATE: |
| return birthDate != null; |
| case FhirPackage.PERSON__ADDRESS: |
| return address != null && !address.isEmpty(); |
| case FhirPackage.PERSON__PHOTO: |
| return photo != null; |
| case FhirPackage.PERSON__MANAGING_ORGANIZATION: |
| return managingOrganization != null; |
| case FhirPackage.PERSON__ACTIVE: |
| return active != null; |
| case FhirPackage.PERSON__LINK: |
| return link != null && !link.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //PersonImpl |