
001package org.hl7.fhir.convertors.conv30_50.resources30_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50; 008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Instant30_50; 009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 010import org.hl7.fhir.dstu3.model.Enumeration; 011import org.hl7.fhir.dstu3.model.Slot; 012import org.hl7.fhir.exceptions.FHIRException; 013import org.hl7.fhir.r5.model.CodeableReference; 014 015public class Slot30_50 { 016 017 public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { 018 if (src == null) 019 return null; 020 org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); 021 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 022 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 023 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 024 if (src.hasServiceCategory()) 025 tgt.addServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategory())); 026 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) 027 tgt.addServiceType(new CodeableReference().setConcept(CodeableConcept30_50.convertCodeableConcept(t))); 028 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) 029 tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t)); 030 if (src.hasAppointmentType()) 031 tgt.addAppointmentType(CodeableConcept30_50.convertCodeableConcept(src.getAppointmentType())); 032 if (src.hasSchedule()) 033 tgt.setSchedule(Reference30_50.convertReference(src.getSchedule())); 034 if (src.hasStatus()) 035 tgt.setStatusElement(convertSlotStatus(src.getStatusElement())); 036 if (src.hasStart()) 037 tgt.setStartElement(Instant30_50.convertInstant(src.getStartElement())); 038 if (src.hasEnd()) 039 tgt.setEndElement(Instant30_50.convertInstant(src.getEndElement())); 040 if (src.hasOverbooked()) 041 tgt.setOverbookedElement(Boolean30_50.convertBoolean(src.getOverbookedElement())); 042 if (src.hasComment()) 043 tgt.setCommentElement(String30_50.convertString(src.getCommentElement())); 044 return tgt; 045 } 046 047 public static org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { 048 if (src == null) 049 return null; 050 org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); 051 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 052 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 053 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 054 if (src.hasServiceCategory()) 055 tgt.setServiceCategory(CodeableConcept30_50.convertCodeableConcept(src.getServiceCategoryFirstRep())); 056 for (CodeableReference t : src.getServiceType()) 057 if (t.hasConcept()) 058 tgt.addServiceType(CodeableConcept30_50.convertCodeableConcept(t.getConcept())); 059 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialty()) 060 tgt.addSpecialty(CodeableConcept30_50.convertCodeableConcept(t)); 061 if (src.hasAppointmentType()) 062 tgt.setAppointmentType(CodeableConcept30_50.convertCodeableConcept(src.getAppointmentTypeFirstRep())); 063 if (src.hasSchedule()) 064 tgt.setSchedule(Reference30_50.convertReference(src.getSchedule())); 065 if (src.hasStatus()) 066 tgt.setStatusElement(convertSlotStatus(src.getStatusElement())); 067 if (src.hasStart()) 068 tgt.setStartElement(Instant30_50.convertInstant(src.getStartElement())); 069 if (src.hasEnd()) 070 tgt.setEndElement(Instant30_50.convertInstant(src.getEndElement())); 071 if (src.hasOverbooked()) 072 tgt.setOverbookedElement(Boolean30_50.convertBoolean(src.getOverbookedElement())); 073 if (src.hasComment()) 074 tgt.setCommentElement(String30_50.convertString(src.getCommentElement())); 075 return tgt; 076 } 077 078 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> src) throws FHIRException { 079 if (src == null || src.isEmpty()) 080 return null; 081 Enumeration<Slot.SlotStatus> tgt = new Enumeration<>(new Slot.SlotStatusEnumFactory()); 082 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 083 if (src.getValue() == null) { 084 tgt.setValue(null); 085 } else { 086 switch (src.getValue()) { 087 case BUSY: 088 tgt.setValue(Slot.SlotStatus.BUSY); 089 break; 090 case FREE: 091 tgt.setValue(Slot.SlotStatus.FREE); 092 break; 093 case BUSYUNAVAILABLE: 094 tgt.setValue(Slot.SlotStatus.BUSYUNAVAILABLE); 095 break; 096 case BUSYTENTATIVE: 097 tgt.setValue(Slot.SlotStatus.BUSYTENTATIVE); 098 break; 099 case ENTEREDINERROR: 100 tgt.setValue(Slot.SlotStatus.ENTEREDINERROR); 101 break; 102 default: 103 tgt.setValue(Slot.SlotStatus.NULL); 104 break; 105 } 106 } 107 return tgt; 108 } 109 110 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Slot.SlotStatus> src) throws FHIRException { 111 if (src == null || src.isEmpty()) 112 return null; 113 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()); 114 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt); 115 if (src.getValue() == null) { 116 tgt.setValue(null); 117 } else { 118 switch (src.getValue()) { 119 case BUSY: 120 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY); 121 break; 122 case FREE: 123 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.FREE); 124 break; 125 case BUSYUNAVAILABLE: 126 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE); 127 break; 128 case BUSYTENTATIVE: 129 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE); 130 break; 131 case ENTEREDINERROR: 132 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.ENTEREDINERROR); 133 break; 134 default: 135 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.NULL); 136 break; 137 } 138 } 139 return tgt; 140 } 141}