001package org.hl7.fhir.convertors.conv43_50.resources43_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext43_50; 004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Annotation43_50; 005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50; 006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50; 007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.DataRequirement43_50; 008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50; 009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50; 010import org.hl7.fhir.exceptions.FHIRException; 011import org.hl7.fhir.r5.model.CodeableReference; 012 013/* 014 Copyright (c) 2011+, HL7, Inc. 015 All rights reserved. 016 017 Redistribution and use in source and binary forms, with or without modification, 018 are permitted provided that the following conditions are met: 019 020 * Redistributions of source code must retain the above copyright notice, this 021 list of conditions and the following disclaimer. 022 * Redistributions in binary form must reproduce the above copyright notice, 023 this list of conditions and the following disclaimer in the documentation 024 and/or other materials provided with the distribution. 025 * Neither the name of HL7 nor the names of its contributors may be used to 026 endorse or promote products derived from this software without specific 027 prior written permission. 028 029 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 030 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 031 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 032 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 033 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 034 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 035 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 036 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 037 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 038 POSSIBILITY OF SUCH DAMAGE. 039 040*/ 041// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 042public class GuidanceResponse43_50 { 043 044 public static org.hl7.fhir.r5.model.GuidanceResponse convertGuidanceResponse(org.hl7.fhir.r4b.model.GuidanceResponse src) throws FHIRException { 045 if (src == null) 046 return null; 047 org.hl7.fhir.r5.model.GuidanceResponse tgt = new org.hl7.fhir.r5.model.GuidanceResponse(); 048 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 049 if (src.hasRequestIdentifier()) 050 tgt.setRequestIdentifier(Identifier43_50.convertIdentifier(src.getRequestIdentifier())); 051 for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier()) 052 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 053 if (src.hasModule()) 054 tgt.setModule(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getModule())); 055 if (src.hasStatus()) 056 tgt.setStatusElement(convertGuidanceResponseStatus(src.getStatusElement())); 057 if (src.hasSubject()) 058 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 059 if (src.hasEncounter()) 060 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 061 if (src.hasOccurrenceDateTime()) 062 tgt.setOccurrenceDateTimeElement(DateTime43_50.convertDateTime(src.getOccurrenceDateTimeElement())); 063 if (src.hasPerformer()) 064 tgt.setPerformer(Reference43_50.convertReference(src.getPerformer())); 065 for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReasonCode()) 066 tgt.addReason(CodeableConcept43_50.convertCodeableConceptToCodeableReference(t)); 067 for (org.hl7.fhir.r4b.model.Reference t : src.getReasonReference()) 068 tgt.addReason(Reference43_50.convertReferenceToCodeableReference(t)); 069 for (org.hl7.fhir.r4b.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 070 for (org.hl7.fhir.r4b.model.Reference t : src.getEvaluationMessage()) 071 tgt.setEvaluationMessage(Reference43_50.convertReference(t)); 072 if (src.hasOutputParameters()) 073 tgt.setOutputParameters(Reference43_50.convertReference(src.getOutputParameters())); 074 if (src.hasResult()) 075 tgt.addResult(Reference43_50.convertReference(src.getResult())); 076 for (org.hl7.fhir.r4b.model.DataRequirement t : src.getDataRequirement()) 077 tgt.addDataRequirement(DataRequirement43_50.convertDataRequirement(t)); 078 return tgt; 079 } 080 081 public static org.hl7.fhir.r4b.model.GuidanceResponse convertGuidanceResponse(org.hl7.fhir.r5.model.GuidanceResponse src) throws FHIRException { 082 if (src == null) 083 return null; 084 org.hl7.fhir.r4b.model.GuidanceResponse tgt = new org.hl7.fhir.r4b.model.GuidanceResponse(); 085 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt); 086 if (src.hasRequestIdentifier()) 087 tgt.setRequestIdentifier(Identifier43_50.convertIdentifier(src.getRequestIdentifier())); 088 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 089 tgt.addIdentifier(Identifier43_50.convertIdentifier(t)); 090 if (src.hasModule()) 091 tgt.setModule(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getModule())); 092 if (src.hasStatus()) 093 tgt.setStatusElement(convertGuidanceResponseStatus(src.getStatusElement())); 094 if (src.hasSubject()) 095 tgt.setSubject(Reference43_50.convertReference(src.getSubject())); 096 if (src.hasEncounter()) 097 tgt.setEncounter(Reference43_50.convertReference(src.getEncounter())); 098 if (src.hasOccurrenceDateTime()) 099 tgt.setOccurrenceDateTimeElement(DateTime43_50.convertDateTime(src.getOccurrenceDateTimeElement())); 100 if (src.hasPerformer()) 101 tgt.setPerformer(Reference43_50.convertReference(src.getPerformer())); 102 for (CodeableReference t : src.getReason()) 103 if (t.hasConcept()) 104 tgt.addReasonCode(CodeableConcept43_50.convertCodeableConcept(t.getConcept())); 105 for (CodeableReference t : src.getReason()) 106 if (t.hasReference()) 107 tgt.addReasonReference(Reference43_50.convertReference(t.getReference())); 108 for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation43_50.convertAnnotation(t)); 109 if (src.hasEvaluationMessage()) 110 tgt.addEvaluationMessage(Reference43_50.convertReference(src.getEvaluationMessage())); 111 if (src.hasOutputParameters()) 112 tgt.setOutputParameters(Reference43_50.convertReference(src.getOutputParameters())); 113 if (src.hasResult()) 114 tgt.setResult(Reference43_50.convertReference(src.getResultFirstRep())); 115 for (org.hl7.fhir.r5.model.DataRequirement t : src.getDataRequirement()) 116 tgt.addDataRequirement(DataRequirement43_50.convertDataRequirement(t)); 117 return tgt; 118 } 119 120 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus> convertGuidanceResponseStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus> src) throws FHIRException { 121 if (src == null || src.isEmpty()) 122 return null; 123 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatusEnumFactory()); 124 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 125 switch (src.getValue()) { 126 case SUCCESS: 127 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.SUCCESS); 128 break; 129 case DATAREQUESTED: 130 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUESTED); 131 break; 132 case DATAREQUIRED: 133 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUIRED); 134 break; 135 case INPROGRESS: 136 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.INPROGRESS); 137 break; 138 case FAILURE: 139 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.FAILURE); 140 break; 141 case ENTEREDINERROR: 142 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.ENTEREDINERROR); 143 break; 144 default: 145 tgt.setValue(org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus.NULL); 146 break; 147 } 148 return tgt; 149 } 150 151 static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus> convertGuidanceResponseStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.GuidanceResponse.GuidanceResponseStatus> src) throws FHIRException { 152 if (src == null || src.isEmpty()) 153 return null; 154 org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatusEnumFactory()); 155 ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt); 156 switch (src.getValue()) { 157 case SUCCESS: 158 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.SUCCESS); 159 break; 160 case DATAREQUESTED: 161 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUESTED); 162 break; 163 case DATAREQUIRED: 164 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.DATAREQUIRED); 165 break; 166 case INPROGRESS: 167 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.INPROGRESS); 168 break; 169 case FAILURE: 170 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.FAILURE); 171 break; 172 case ENTEREDINERROR: 173 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.ENTEREDINERROR); 174 break; 175 default: 176 tgt.setValue(org.hl7.fhir.r4b.model.GuidanceResponse.GuidanceResponseStatus.NULL); 177 break; 178 } 179 return tgt; 180 } 181}