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.CodeableConcept40_50; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50; 008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_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 Schedule40_50 { 043 044 public static org.hl7.fhir.r5.model.Schedule convertSchedule(org.hl7.fhir.r4.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 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 049 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 050 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 051 if (src.hasActive()) 052 tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement())); 053 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceCategory()) 054 tgt.addServiceCategory(CodeableConcept40_50.convertCodeableConcept(t)); 055 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) 056 tgt.addServiceType(new CodeableReference().setConcept(CodeableConcept40_50.convertCodeableConcept(t))); 057 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) 058 tgt.addSpecialty(CodeableConcept40_50.convertCodeableConcept(t)); 059 for (org.hl7.fhir.r4.model.Reference t : src.getActor()) tgt.addActor(Reference40_50.convertReference(t)); 060 if (src.hasPlanningHorizon()) 061 tgt.setPlanningHorizon(Period40_50.convertPeriod(src.getPlanningHorizon())); 062 if (src.hasComment()) 063 tgt.setCommentElement(String40_50.convertStringToMarkdown(src.getCommentElement())); 064 return tgt; 065 } 066 067 public static org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.r5.model.Schedule src) throws FHIRException { 068 if (src == null) 069 return null; 070 org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule(); 071 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 072 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 073 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 074 if (src.hasActive()) 075 tgt.setActiveElement(Boolean40_50.convertBoolean(src.getActiveElement())); 076 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory()) 077 tgt.addServiceCategory(CodeableConcept40_50.convertCodeableConcept(t)); 078 for (CodeableReference t : src.getServiceType()) 079 if (t.hasConcept()) 080 tgt.addServiceType(CodeableConcept40_50.convertCodeableConcept(t.getConcept())); 081 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) 082 tgt.addSpecialty(CodeableConcept40_50.convertCodeableConcept(t)); 083 for (org.hl7.fhir.r5.model.Reference t : src.getActor()) tgt.addActor(Reference40_50.convertReference(t)); 084 if (src.hasPlanningHorizon()) 085 tgt.setPlanningHorizon(Period40_50.convertPeriod(src.getPlanningHorizon())); 086 if (src.hasComment()) 087 tgt.setCommentElement(String40_50.convertString(src.getCommentElement())); 088 return tgt; 089 } 090}