001package org.hl7.fhir.convertors.conv10_50.resources10_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext10_50; 004import org.hl7.fhir.convertors.conv10_50.datatypes10_50.Reference10_50; 005import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.CodeableConcept10_50; 006import org.hl7.fhir.convertors.conv10_50.datatypes10_50.complextypes10_50.Identifier10_50; 007import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Boolean10_50; 008import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Instant10_50; 009import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50; 010import org.hl7.fhir.exceptions.FHIRException; 011import org.hl7.fhir.r5.model.CodeableReference; 012 013public class Slot10_50 { 014 015 public static org.hl7.fhir.r5.model.Slot convertSlot(org.hl7.fhir.dstu2.model.Slot src) throws FHIRException { 016 if (src == null || src.isEmpty()) 017 return null; 018 org.hl7.fhir.r5.model.Slot tgt = new org.hl7.fhir.r5.model.Slot(); 019 ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt); 020 for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) 021 tgt.addIdentifier(Identifier10_50.convertIdentifier(t)); 022 if (src.hasType()) 023 tgt.addServiceType(new CodeableReference().setConcept(CodeableConcept10_50.convertCodeableConcept(src.getType()))); 024 if (src.hasSchedule()) 025 tgt.setSchedule(Reference10_50.convertReference(src.getSchedule())); 026 if (src.hasStartElement()) 027 tgt.setStartElement(Instant10_50.convertInstant(src.getStartElement())); 028 if (src.hasEndElement()) 029 tgt.setEndElement(Instant10_50.convertInstant(src.getEndElement())); 030 if (src.hasOverbookedElement()) 031 tgt.setOverbookedElement(Boolean10_50.convertBoolean(src.getOverbookedElement())); 032 if (src.hasCommentElement()) 033 tgt.setCommentElement(String10_50.convertString(src.getCommentElement())); 034 return tgt; 035 } 036 037 public static org.hl7.fhir.dstu2.model.Slot convertSlot(org.hl7.fhir.r5.model.Slot src) throws FHIRException { 038 if (src == null || src.isEmpty()) 039 return null; 040 org.hl7.fhir.dstu2.model.Slot tgt = new org.hl7.fhir.dstu2.model.Slot(); 041 ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyDomainResource(src, tgt); 042 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 043 tgt.addIdentifier(Identifier10_50.convertIdentifier(t)); 044 for (CodeableReference t : src.getServiceType()) 045 if (t.hasConcept()) 046 tgt.setType(CodeableConcept10_50.convertCodeableConcept(t.getConcept())); 047 if (src.hasSchedule()) 048 tgt.setSchedule(Reference10_50.convertReference(src.getSchedule())); 049 if (src.hasStartElement()) 050 tgt.setStartElement(Instant10_50.convertInstant(src.getStartElement())); 051 if (src.hasEndElement()) 052 tgt.setEndElement(Instant10_50.convertInstant(src.getEndElement())); 053 if (src.hasOverbookedElement()) 054 tgt.setOverbookedElement(Boolean10_50.convertBoolean(src.getOverbookedElement())); 055 if (src.hasCommentElement()) 056 tgt.setCommentElement(String10_50.convertString(src.getCommentElement())); 057 return tgt; 058 } 059 060 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Slot.SlotStatus> src) throws FHIRException { 061 if (src == null || src.isEmpty()) return null; 062 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()); 063 ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); 064 if (src.getValue() == null) { 065 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.NULL); 066 } else { 067 switch (src.getValue()) { 068 case BUSY: 069 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSY); 070 break; 071 case FREE: 072 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.FREE); 073 break; 074 case BUSYUNAVAILABLE: 075 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYUNAVAILABLE); 076 break; 077 case BUSYTENTATIVE: 078 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.BUSYTENTATIVE); 079 break; 080 default: 081 tgt.setValue(org.hl7.fhir.r5.model.Slot.SlotStatus.NULL); 082 break; 083 } 084 } 085 return tgt; 086 } 087 088 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Slot.SlotStatus> convertSlotStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Slot.SlotStatus> src) throws FHIRException { 089 if (src == null || src.isEmpty()) return null; 090 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.Slot.SlotStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Slot.SlotStatusEnumFactory()); 091 ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt); 092 if (src.getValue() == null) { 093 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL); 094 } else { 095 switch (src.getValue()) { 096 case BUSY: 097 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSY); 098 break; 099 case FREE: 100 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.FREE); 101 break; 102 case BUSYUNAVAILABLE: 103 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYUNAVAILABLE); 104 break; 105 case BUSYTENTATIVE: 106 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.BUSYTENTATIVE); 107 break; 108 default: 109 tgt.setValue(org.hl7.fhir.dstu2.model.Slot.SlotStatus.NULL); 110 break; 111 } 112 } 113 return tgt; 114 } 115}