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