001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.*;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Date40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010/*
011  Copyright (c) 2011+, HL7, Inc.
012  All rights reserved.
013  
014  Redistribution and use in source and binary forms, with or without modification, 
015  are permitted provided that the following conditions are met:
016  
017   * Redistributions of source code must retain the above copyright notice, this 
018     list of conditions and the following disclaimer.
019   * Redistributions in binary form must reproduce the above copyright notice, 
020     this list of conditions and the following disclaimer in the documentation 
021     and/or other materials provided with the distribution.
022   * Neither the name of HL7 nor the names of its contributors may be used to 
023     endorse or promote products derived from this software without specific 
024     prior written permission.
025  
026  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
027  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
028  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
029  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
030  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
031  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
032  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
033  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
034  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
035  POSSIBILITY OF SUCH DAMAGE.
036  
037*/
038// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
039public class Practitioner40_50 {
040
041  public static org.hl7.fhir.r5.model.Practitioner convertPractitioner(org.hl7.fhir.r4.model.Practitioner src) throws FHIRException {
042    if (src == null)
043      return null;
044    org.hl7.fhir.r5.model.Practitioner tgt = new org.hl7.fhir.r5.model.Practitioner();
045    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
046    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
047      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
048    if (src.hasActive())
049      tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement()));
050    for (org.hl7.fhir.r4.model.HumanName t : src.getName()) tgt.addName(HumanName40_50.convertHumanName(t));
051    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
052      tgt.addTelecom(ContactPoint40_50.convertContactPoint(t));
053    for (org.hl7.fhir.r4.model.Address t : src.getAddress()) tgt.addAddress(Address40_50.convertAddress(t));
054    if (src.hasGender())
055      tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
056    if (src.hasBirthDate())
057      tgt.setBirthDateElement(Date40_50.convertDate(src.getBirthDateElement()));
058    for (org.hl7.fhir.r4.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment40_50.convertAttachment(t));
059    for (org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
060      tgt.addQualification(convertPractitionerQualificationComponent(t));
061    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCommunication())
062      tgt.addCommunication(CodeableConcept40_50.convertCodeableConcept(t));
063    return tgt;
064  }
065
066  public static org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.r5.model.Practitioner src) throws FHIRException {
067    if (src == null)
068      return null;
069    org.hl7.fhir.r4.model.Practitioner tgt = new org.hl7.fhir.r4.model.Practitioner();
070    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
071    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
072      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
073    if (src.hasActive())
074      tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement()));
075    for (org.hl7.fhir.r5.model.HumanName t : src.getName()) tgt.addName(HumanName40_50.convertHumanName(t));
076    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
077      tgt.addTelecom(ContactPoint40_50.convertContactPoint(t));
078    for (org.hl7.fhir.r5.model.Address t : src.getAddress()) tgt.addAddress(Address40_50.convertAddress(t));
079    if (src.hasGender())
080      tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
081    if (src.hasBirthDate())
082      tgt.setBirthDateElement(Date40_50.convertDate(src.getBirthDateElement()));
083    for (org.hl7.fhir.r5.model.Attachment t : src.getPhoto()) tgt.addPhoto(Attachment40_50.convertAttachment(t));
084    for (org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent t : src.getQualification())
085      tgt.addQualification(convertPractitionerQualificationComponent(t));
086    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunication())
087      tgt.addCommunication(CodeableConcept40_50.convertCodeableConcept(t));
088    return tgt;
089  }
090
091  public static org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
092    if (src == null)
093      return null;
094    org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent();
095    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
096    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
097      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
098    if (src.hasCode())
099      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
100    if (src.hasPeriod())
101      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
102    if (src.hasIssuer())
103      tgt.setIssuer(Reference40_50.convertReference(src.getIssuer()));
104    return tgt;
105  }
106
107  public static org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.r5.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
108    if (src == null)
109      return null;
110    org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent();
111    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
112    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
113      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
114    if (src.hasCode())
115      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
116    if (src.hasPeriod())
117      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
118    if (src.hasIssuer())
119      tgt.setIssuer(Reference40_50.convertReference(src.getIssuer()));
120    return tgt;
121  }
122}