
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.primitive43_50.Boolean43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Instant43_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; 012import org.hl7.fhir.r5.model.Enumeration; 013import org.hl7.fhir.r5.model.Slot; 014 015/* 016 Copyright (c) 2011+, HL7, Inc. 017 All rights reserved. 018 019 Redistribution and use in source and binary forms, with or without modification, 020 are permitted provided that the following conditions are met: 021 022 * Redistributions of source code must retain the above copyright notice, this 023 list of conditions and the following disclaimer. 024 * Redistributions in binary form must reproduce the above copyright notice, 025 this list of conditions and the following disclaimer in the documentation 026 and/or other materials provided with the distribution. 027 * Neither the name of HL7 nor the names of its contributors may be used to 028 endorse or promote products derived from this software without specific 029 prior written permission. 030 031 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 032 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 033 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 034 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 035 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 036 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 037 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 038 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 039 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 040 POSSIBILITY OF SUCH DAMAGE. 041 042*/ 043// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 044public class Slot43_50 { 045 046 public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.r4b.model.Slot src) throws FHIRException { 047 if (src == null) 048 return null; 049 org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); 050 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 051 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 052 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 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 if (src.hasAppointmentType()) 060 tgt.addAppointmentType(CodeableConcept43_50.convertCodeableConcept(src.getAppointmentType())); 061 if (src.hasSchedule()) 062 tgt.setSchedule(Reference43_50.convertReference(src.getSchedule())); 063 if (src.hasStatus()) 064 tgt.setStatusElement(convertSlotStatus(src.getStatusElement())); 065 if (src.hasStart()) 066 tgt.setStartElement(Instant43_50.convertInstant(src.getStartElement())); 067 if (src.hasEnd()) 068 tgt.setEndElement(Instant43_50.convertInstant(src.getEndElement())); 069 if (src.hasOverbooked()) 070 tgt.setOverbookedElement(Boolean43_50.convertBoolean(src.getOverbookedElement())); 071 if (src.hasComment()) 072 tgt.setCommentElement(String43_50.convertString(src.getCommentElement())); 073 return tgt; 074 } 075 076 public static org.hl7.fhir.r4b.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { 077 if (src == null) 078 return null; 079 org.hl7.fhir.r4b.model.Slot tgt = new org.hl7.fhir.r4b.model.Slot(); 080 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 081 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 082 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 083 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceCategory()) 084 tgt.addServiceCategory(CodeableConcept43_50.convertCodeableConcept(t)); 085 for (CodeableReference t : src.getServiceType()) 086 if (t.hasConcept()) 087 tgt.addServiceType(CodeableConcept43_50.convertCodeableConcept(t.getConcept())); 088 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) 089 tgt.addSpecialty(CodeableConcept43_50.convertCodeableConcept(t)); 090 if (src.hasAppointmentType()) 091 tgt.setAppointmentType(CodeableConcept43_50.convertCodeableConcept(src.getAppointmentTypeFirstRep())); 092 if (src.hasSchedule()) 093 tgt.setSchedule(Reference43_50.convertReference(src.getSchedule())); 094 if (src.hasStatus()) 095 tgt.setStatusElement(convertSlotStatus(src.getStatusElement())); 096 if (src.hasStart()) 097 tgt.setStartElement(Instant43_50.convertInstant(src.getStartElement())); 098 if (src.hasEnd()) 099 tgt.setEndElement(Instant43_50.convertInstant(src.getEndElement())); 100 if (src.hasOverbooked()) 101 tgt.setOverbookedElement(Boolean43_50.convertBoolean(src.getOverbookedElement())); 102 if (src.hasComment()) 103 tgt.setCommentElement(String43_50.convertString(src.getCommentElement())); 104 return tgt; 105 } 106 107 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Slot.SlotStatus> src) throws FHIRException { 108 if (src == null || src.isEmpty()) 109 return null; 110 Enumeration<Slot.SlotStatus> tgt = new Enumeration<>(new Slot.SlotStatusEnumFactory()); 111 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 112 if (src.getValue() == null) { 113 tgt.setValue(null); 114 } else { 115 switch (src.getValue()) { 116 case BUSY: 117 tgt.setValue(Slot.SlotStatus.BUSY); 118 break; 119 case FREE: 120 tgt.setValue(Slot.SlotStatus.FREE); 121 break; 122 case BUSYUNAVAILABLE: 123 tgt.setValue(Slot.SlotStatus.BUSYUNAVAILABLE); 124 break; 125 case BUSYTENTATIVE: 126 tgt.setValue(Slot.SlotStatus.BUSYTENTATIVE); 127 break; 128 case ENTEREDINERROR: 129 tgt.setValue(Slot.SlotStatus.ENTEREDINERROR); 130 break; 131 default: 132 tgt.setValue(Slot.SlotStatus.NULL); 133 break; 134 } 135 } 136 return tgt; 137 } 138 139 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> src) throws FHIRException { 140 if (src == null || src.isEmpty()) 141 return null; 142 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Slot.SlotStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Slot.SlotStatusEnumFactory()); 143 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 144 if (src.getValue() == null) { 145 tgt.setValue(null); 146 } else { 147 switch (src.getValue()) { 148 case BUSY: 149 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.BUSY); 150 break; 151 case FREE: 152 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.FREE); 153 break; 154 case BUSYUNAVAILABLE: 155 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.BUSYUNAVAILABLE); 156 break; 157 case BUSYTENTATIVE: 158 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.BUSYTENTATIVE); 159 break; 160 case ENTEREDINERROR: 161 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.ENTEREDINERROR); 162 break; 163 default: 164 tgt.setValue(org.hl7.fhir.r4b.model.Slot.SlotStatus.NULL); 165 break; 166 } 167 } 168 return tgt; 169 } 170}