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