
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.Instant10_30; 008import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.String10_30; 009import org.hl7.fhir.dstu3.model.AppointmentResponse; 010import org.hl7.fhir.dstu3.model.Enumeration; 011import org.hl7.fhir.exceptions.FHIRException; 012 013public class AppointmentResponse10_30 { 014 015 public static org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { 016 if (src == null || src.isEmpty()) 017 return null; 018 org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse(); 019 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt); 020 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 021 tgt.addIdentifier(Identifier10_30.convertIdentifier(t)); 022 if (src.hasAppointment()) 023 tgt.setAppointment(Reference10_30.convertReference(src.getAppointment())); 024 if (src.hasStartElement()) 025 tgt.setStartElement(Instant10_30.convertInstant(src.getStartElement())); 026 if (src.hasEndElement()) 027 tgt.setEndElement(Instant10_30.convertInstant(src.getEndElement())); 028 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) 029 tgt.addParticipantType(CodeableConcept10_30.convertCodeableConcept(t)); 030 if (src.hasActor()) 031 tgt.setActor(Reference10_30.convertReference(src.getActor())); 032 if (src.hasParticipantStatus()) 033 tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); 034 if (src.hasCommentElement()) 035 tgt.setCommentElement(String10_30.convertString(src.getCommentElement())); 036 return tgt; 037 } 038 039 public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException { 040 if (src == null || src.isEmpty()) 041 return null; 042 org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); 043 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt); 044 for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) 045 tgt.addIdentifier(Identifier10_30.convertIdentifier(t)); 046 if (src.hasAppointment()) 047 tgt.setAppointment(Reference10_30.convertReference(src.getAppointment())); 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 for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) 053 tgt.addParticipantType(CodeableConcept10_30.convertCodeableConcept(t)); 054 if (src.hasActor()) 055 tgt.setActor(Reference10_30.convertReference(src.getActor())); 056 if (src.hasParticipantStatus()) 057 tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); 058 if (src.hasCommentElement()) 059 tgt.setCommentElement(String10_30.convertString(src.getCommentElement())); 060 return tgt; 061 } 062 063 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException { 064 if (src == null || src.isEmpty()) 065 return null; 066 Enumeration<AppointmentResponse.ParticipantStatus> tgt = new Enumeration<>(new AppointmentResponse.ParticipantStatusEnumFactory()); 067 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 068 if (src.getValue() == null) { 069 tgt.setValue(null); 070 } else { 071 switch (src.getValue()) { 072 case ACCEPTED: 073 tgt.setValue(AppointmentResponse.ParticipantStatus.ACCEPTED); 074 break; 075 case DECLINED: 076 tgt.setValue(AppointmentResponse.ParticipantStatus.DECLINED); 077 break; 078 case TENTATIVE: 079 tgt.setValue(AppointmentResponse.ParticipantStatus.TENTATIVE); 080 break; 081 case INPROCESS: 082 tgt.setValue(AppointmentResponse.ParticipantStatus.ACCEPTED); 083 break; 084 case COMPLETED: 085 tgt.setValue(AppointmentResponse.ParticipantStatus.ACCEPTED); 086 break; 087 case NEEDSACTION: 088 tgt.setValue(AppointmentResponse.ParticipantStatus.NEEDSACTION); 089 break; 090 default: 091 tgt.setValue(AppointmentResponse.ParticipantStatus.NULL); 092 break; 093 } 094 } 095 return tgt; 096 } 097 098 static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException { 099 if (src == null || src.isEmpty()) 100 return null; 101 org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatusEnumFactory()); 102 ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt); 103 if (src.getValue() == null) { 104 tgt.setValue(null); 105 } else { 106 switch (src.getValue()) { 107 case ACCEPTED: 108 tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED); 109 break; 110 case DECLINED: 111 tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED); 112 break; 113 case TENTATIVE: 114 tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE); 115 break; 116 case NEEDSACTION: 117 tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION); 118 break; 119 default: 120 tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL); 121 break; 122 } 123 } 124 return tgt; 125 } 126}