001package org.hl7.fhir.convertors.conv10_30.resources10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Reference10_30;
005import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Address10_30;
006import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Attachment10_30;
007import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.CodeableConcept10_30;
008import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.ContactPoint10_30;
009import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.HumanName10_30;
010import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Identifier10_30;
011import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Period10_30;
012import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Boolean10_30;
013import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.Date10_30;
014import org.hl7.fhir.exceptions.FHIRException;
015
016public class Practitioner10_30 {
017
018  public static org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.dstu2.model.Practitioner src) throws FHIRException {
019    if (src == null || src.isEmpty())
020      return null;
021    org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner();
022    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
023    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
024      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
025    if (src.hasActiveElement())
026      tgt.setActiveElement(Boolean10_30.convertBoolean(src.getActiveElement()));
027    if (src.hasName())
028      tgt.addName(HumanName10_30.convertHumanName(src.getName()));
029    for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
030      tgt.addTelecom(ContactPoint10_30.convertContactPoint(t));
031    for (org.hl7.fhir.dstu2.model.Address t : src.getAddress()) tgt.addAddress(Address10_30.convertAddress(t));
032    if (src.hasGender())
033      tgt.setGenderElement(Enumerations10_30.convertAdministrativeGender(src.getGenderElement()));
034    if (src.hasBirthDateElement())
035      tgt.setBirthDateElement(Date10_30.convertDate(src.getBirthDateElement()));
036    for (org.hl7.fhir.dstu2.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_30.convertAttachment(t));
037    for (org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
038      tgt.addQualification(convertPractitionerQualificationComponent(t));
039    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCommunication())
040      tgt.addCommunication(CodeableConcept10_30.convertCodeableConcept(t));
041    return tgt;
042  }
043
044  public static org.hl7.fhir.dstu2.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException {
045    if (src == null || src.isEmpty())
046      return null;
047    org.hl7.fhir.dstu2.model.Practitioner tgt = new org.hl7.fhir.dstu2.model.Practitioner();
048    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
049    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
050      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
051    if (src.hasActiveElement())
052      tgt.setActiveElement(Boolean10_30.convertBoolean(src.getActiveElement()));
053    for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) tgt.setName(HumanName10_30.convertHumanName(t));
054    for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
055      tgt.addTelecom(ContactPoint10_30.convertContactPoint(t));
056    for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) tgt.addAddress(Address10_30.convertAddress(t));
057    if (src.hasGender())
058      tgt.setGenderElement(Enumerations10_30.convertAdministrativeGender(src.getGenderElement()));
059    if (src.hasBirthDateElement())
060      tgt.setBirthDateElement(Date10_30.convertDate(src.getBirthDateElement()));
061    for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment10_30.convertAttachment(t));
062    for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
063      tgt.addQualification(convertPractitionerQualificationComponent(t));
064    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication())
065      tgt.addCommunication(CodeableConcept10_30.convertCodeableConcept(t));
066    return tgt;
067  }
068
069  public static org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
070    if (src == null || src.isEmpty())
071      return null;
072    org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent();
073    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
074    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
075      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
076    if (src.hasCode())
077      tgt.setCode(CodeableConcept10_30.convertCodeableConcept(src.getCode()));
078    if (src.hasPeriod())
079      tgt.setPeriod(Period10_30.convertPeriod(src.getPeriod()));
080    if (src.hasIssuer())
081      tgt.setIssuer(Reference10_30.convertReference(src.getIssuer()));
082    return tgt;
083  }
084
085  public static org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu2.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
086    if (src == null || src.isEmpty())
087      return null;
088    org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent();
089    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
090    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
091      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
092    if (src.hasCode())
093      tgt.setCode(CodeableConcept10_30.convertCodeableConcept(src.getCode()));
094    if (src.hasPeriod())
095      tgt.setPeriod(Period10_30.convertPeriod(src.getPeriod()));
096    if (src.hasIssuer())
097      tgt.setIssuer(Reference10_30.convertReference(src.getIssuer()));
098    return tgt;
099  }
100}