001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
010import org.hl7.fhir.exceptions.FHIRException;
011import org.hl7.fhir.r5.model.CodeableReference;
012
013/*
014  Copyright (c) 2011+, HL7, Inc.
015  All rights reserved.
016  
017  Redistribution and use in source and binary forms, with or without modification, 
018  are permitted provided that the following conditions are met:
019  
020   * Redistributions of source code must retain the above copyright notice, this 
021     list of conditions and the following disclaimer.
022   * Redistributions in binary form must reproduce the above copyright notice, 
023     this list of conditions and the following disclaimer in the documentation 
024     and/or other materials provided with the distribution.
025   * Neither the name of HL7 nor the names of its contributors may be used to 
026     endorse or promote products derived from this software without specific 
027     prior written permission.
028  
029  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
030  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
031  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
032  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
033  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
034  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
035  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
036  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
037  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
038  POSSIBILITY OF SUCH DAMAGE.
039  
040*/
041// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
042public class Schedule43_50 {
043
044  public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.r4b.model.Schedule src) throws FHIRException {
045    if (src == null)
046      return null;
047    org.hl7.fhir.r5.model.Schedule tgt = new org.hl7.fhir.r5.model.Schedule();
048    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
049    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
050      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
051    if (src.hasActive())
052      tgt.setActiveElement(Boolean43_50.convertBoolean(src.getActiveElement()));
053    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getServiceCategory())
054      tgt.addServiceCategory(CodeableConcept43_50.convertCodeableConcept(t));
055    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getServiceType())
056      tgt.addServiceType(new CodeableReference().setConcept(CodeableConcept43_50.convertCodeableConcept(t)));
057    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getSpecialty())
058      tgt.addSpecialty(CodeableConcept43_50.convertCodeableConcept(t));
059    for (org.hl7.fhir.r4b.model.Reference t : src.getActor()) tgt.addActor(Reference43_50.convertReference(t));
060    if (src.hasPlanningHorizon())
061      tgt.setPlanningHorizon(Period43_50.convertPeriod(src.getPlanningHorizon()));
062    if (src.hasComment())
063      tgt.setCommentElement(String43_50.convertStringToMarkdown(src.getCommentElement()));
064    return tgt;
065  }
066
067  public static org.hl7.fhir.r4b.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException {
068    if (src == null)
069      return null;
070    org.hl7.fhir.r4b.model.Schedule tgt = new org.hl7.fhir.r4b.model.Schedule();
071    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
072    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
073      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
074    if (src.hasActive())
075      tgt.setActiveElement(Boolean43_50.convertBoolean(src.getActiveElement()));
076    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory())
077      tgt.addServiceCategory(CodeableConcept43_50.convertCodeableConcept(t));
078    for (CodeableReference t : src.getServiceType())
079      if (t.hasConcept())
080        tgt.addServiceType(CodeableConcept43_50.convertCodeableConcept(t.getConcept()));
081    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty())
082      tgt.addSpecialty(CodeableConcept43_50.convertCodeableConcept(t));
083    for (org.hl7.fhir.r5.model.Reference t : src.getActor()) tgt.addActor(Reference43_50.convertReference(t));
084    if (src.hasPlanningHorizon())
085      tgt.setPlanningHorizon(Period43_50.convertPeriod(src.getPlanningHorizon()));
086    if (src.hasComment())
087      tgt.setCommentElement(String43_50.convertString(src.getCommentElement()));
088    return tgt;
089  }
090}