001package org.hl7.fhir.convertors.conv40_50.resources40_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext40_50; 004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50; 005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50; 006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Instant40_50; 007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50; 008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50; 009import org.hl7.fhir.exceptions.FHIRException; 010 011/* 012 Copyright (c) 2011+, HL7, Inc. 013 All rights reserved. 014 015 Redistribution and use in source and binary forms, with or without modification, 016 are permitted provided that the following conditions are met: 017 018 * Redistributions of source code must retain the above copyright notice, this 019 list of conditions and the following disclaimer. 020 * Redistributions in binary form must reproduce the above copyright notice, 021 this list of conditions and the following disclaimer in the documentation 022 and/or other materials provided with the distribution. 023 * Neither the name of HL7 nor the names of its contributors may be used to 024 endorse or promote products derived from this software without specific 025 prior written permission. 026 027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 028 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 029 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 030 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 031 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 032 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 033 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 034 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 035 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 036 POSSIBILITY OF SUCH DAMAGE. 037 038*/ 039// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 040public class AppointmentResponse40_50 { 041 042 public static org.hl7.fhir.r5.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException { 043 if (src == null) 044 return null; 045 org.hl7.fhir.r5.model.AppointmentResponse tgt = new org.hl7.fhir.r5.model.AppointmentResponse(); 046 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 047 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 048 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 049 if (src.hasAppointment()) 050 tgt.setAppointment(Reference40_50.convertReference(src.getAppointment())); 051 if (src.hasStart()) 052 tgt.setStartElement(Instant40_50.convertInstant(src.getStartElement())); 053 if (src.hasEnd()) 054 tgt.setEndElement(Instant40_50.convertInstant(src.getEndElement())); 055 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) 056 tgt.addParticipantType(CodeableConcept40_50.convertCodeableConcept(t)); 057 if (src.hasActor()) 058 tgt.setActor(Reference40_50.convertReference(src.getActor())); 059 if (src.hasParticipantStatus()) 060 tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); 061 if (src.hasComment()) 062 tgt.setCommentElement(String40_50.convertStringToMarkdown(src.getCommentElement())); 063 return tgt; 064 } 065 066 public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r5.model.AppointmentResponse src) throws FHIRException { 067 if (src == null) 068 return null; 069 org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse(); 070 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt); 071 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 072 tgt.addIdentifier(Identifier40_50.convertIdentifier(t)); 073 if (src.hasAppointment()) 074 tgt.setAppointment(Reference40_50.convertReference(src.getAppointment())); 075 if (src.hasStart()) 076 tgt.setStartElement(Instant40_50.convertInstant(src.getStartElement())); 077 if (src.hasEnd()) 078 tgt.setEndElement(Instant40_50.convertInstant(src.getEndElement())); 079 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getParticipantType()) 080 tgt.addParticipantType(CodeableConcept40_50.convertCodeableConcept(t)); 081 if (src.hasActor()) 082 tgt.setActor(Reference40_50.convertReference(src.getActor())); 083 if (src.hasParticipantStatus()) 084 tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement())); 085 if (src.hasComment()) 086 tgt.setCommentElement(String40_50.convertString(src.getCommentElement())); 087 return tgt; 088 } 089 090 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus> convertParticipantStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException { 091 if (src == null || src.isEmpty()) 092 return null; 093 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatusEnumFactory()); 094 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 095 switch (src.getValue()) { 096 case ACCEPTED: 097 tgt.setValue(org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus.ACCEPTED); 098 break; 099 case DECLINED: 100 tgt.setValue(org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus.DECLINED); 101 break; 102 case TENTATIVE: 103 tgt.setValue(org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus.TENTATIVE); 104 break; 105 case NEEDSACTION: 106 tgt.setValue(org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus.NEEDSACTION); 107 break; 108 default: 109 tgt.setValue(org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus.NULL); 110 break; 111 } 112 return tgt; 113 } 114 115 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.AppointmentResponse.AppointmentResponseStatus> src) throws FHIRException { 116 if (src == null || src.isEmpty()) 117 return null; 118 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatusEnumFactory()); 119 ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt); 120 switch (src.getValue()) { 121 case ACCEPTED: 122 tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED); 123 break; 124 case DECLINED: 125 tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED); 126 break; 127 case TENTATIVE: 128 tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE); 129 break; 130 case NEEDSACTION: 131 tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION); 132 break; 133 default: 134 tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL); 135 break; 136 } 137 return tgt; 138 } 139}