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