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.Identifier40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.*;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
007import org.hl7.fhir.exceptions.FHIRException;
008
009/*
010  Copyright (c) 2011+, HL7, Inc.
011  All rights reserved.
012  
013  Redistribution and use in source and binary forms, with or without modification, 
014  are permitted provided that the following conditions are met:
015  
016   * Redistributions of source code must retain the above copyright notice, this 
017     list of conditions and the following disclaimer.
018   * Redistributions in binary form must reproduce the above copyright notice, 
019     this list of conditions and the following disclaimer in the documentation 
020     and/or other materials provided with the distribution.
021   * Neither the name of HL7 nor the names of its contributors may be used to 
022     endorse or promote products derived from this software without specific 
023     prior written permission.
024  
025  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
026  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
027  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
028  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
029  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
030  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
031  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
032  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
033  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
034  POSSIBILITY OF SUCH DAMAGE.
035  
036*/
037// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
038public class TestReport40_50 {
039
040  public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.r4.model.TestReport src) throws FHIRException {
041    if (src == null)
042      return null;
043    org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport();
044    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
045    if (src.hasIdentifier())
046      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
047    if (src.hasName())
048      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
049    if (src.hasStatus())
050      tgt.setStatusElement(convertTestReportStatus(src.getStatusElement()));
051    if (src.hasTestScript())
052      tgt.setTestScript(Reference40_50.convertReference(src.getTestScript()));
053    if (src.hasResult())
054      tgt.setResultElement(convertTestReportResult(src.getResultElement()));
055    if (src.hasScore())
056      tgt.setScoreElement(Decimal40_50.convertDecimal(src.getScoreElement()));
057    if (src.hasTester())
058      tgt.setTesterElement(String40_50.convertString(src.getTesterElement()));
059    if (src.hasIssued())
060      tgt.setIssuedElement(DateTime40_50.convertDateTime(src.getIssuedElement()));
061    for (org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent t : src.getParticipant())
062      tgt.addParticipant(convertTestReportParticipantComponent(t));
063    if (src.hasSetup())
064      tgt.setSetup(convertTestReportSetupComponent(src.getSetup()));
065    for (org.hl7.fhir.r4.model.TestReport.TestReportTestComponent t : src.getTest())
066      tgt.addTest(convertTestReportTestComponent(t));
067    if (src.hasTeardown())
068      tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown()));
069    return tgt;
070  }
071
072  public static org.hl7.fhir.r4.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException {
073    if (src == null)
074      return null;
075    org.hl7.fhir.r4.model.TestReport tgt = new org.hl7.fhir.r4.model.TestReport();
076    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
077    if (src.hasIdentifier())
078      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
079    if (src.hasName())
080      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
081    if (src.hasStatus())
082      tgt.setStatusElement(convertTestReportStatus(src.getStatusElement()));
083    if (src.hasTestScript())
084      tgt.setTestScript(Reference40_50.convertReference(src.getTestScript()));
085    if (src.hasResult())
086      tgt.setResultElement(convertTestReportResult(src.getResultElement()));
087    if (src.hasScore())
088      tgt.setScoreElement(Decimal40_50.convertDecimal(src.getScoreElement()));
089    if (src.hasTester())
090      tgt.setTesterElement(String40_50.convertString(src.getTesterElement()));
091    if (src.hasIssued())
092      tgt.setIssuedElement(DateTime40_50.convertDateTime(src.getIssuedElement()));
093    for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant())
094      tgt.addParticipant(convertTestReportParticipantComponent(t));
095    if (src.hasSetup())
096      tgt.setSetup(convertTestReportSetupComponent(src.getSetup()));
097    for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest())
098      tgt.addTest(convertTestReportTestComponent(t));
099    if (src.hasTeardown())
100      tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown()));
101    return tgt;
102  }
103
104  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportStatus> convertTestReportStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportStatus> src) throws FHIRException {
105    if (src == null || src.isEmpty())
106      return null;
107    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.TestReport.TestReportStatusEnumFactory());
108    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
109    switch (src.getValue()) {
110      case COMPLETED:
111        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED);
112        break;
113      case INPROGRESS:
114        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS);
115        break;
116      case WAITING:
117        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING);
118        break;
119      case STOPPED:
120        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED);
121        break;
122      case ENTEREDINERROR:
123        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR);
124        break;
125      default:
126        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL);
127        break;
128    }
129    return tgt;
130  }
131
132  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportStatus> convertTestReportStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportStatus> src) throws FHIRException {
133    if (src == null || src.isEmpty())
134      return null;
135    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestReport.TestReportStatusEnumFactory());
136    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
137    switch (src.getValue()) {
138      case COMPLETED:
139        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.COMPLETED);
140        break;
141      case INPROGRESS:
142        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.INPROGRESS);
143        break;
144      case WAITING:
145        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.WAITING);
146        break;
147      case STOPPED:
148        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.STOPPED);
149        break;
150      case ENTEREDINERROR:
151        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.ENTEREDINERROR);
152        break;
153      default:
154        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.NULL);
155        break;
156    }
157    return tgt;
158  }
159
160  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportResult> convertTestReportResult(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportResult> src) throws FHIRException {
161    if (src == null || src.isEmpty())
162      return null;
163    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportResult> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.TestReport.TestReportResultEnumFactory());
164    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
165    switch (src.getValue()) {
166      case PASS:
167        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS);
168        break;
169      case FAIL:
170        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL);
171        break;
172      case PENDING:
173        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING);
174        break;
175      default:
176        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL);
177        break;
178    }
179    return tgt;
180  }
181
182  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportResult> convertTestReportResult(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportResult> src) throws FHIRException {
183    if (src == null || src.isEmpty())
184      return null;
185    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportResult> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestReport.TestReportResultEnumFactory());
186    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
187    switch (src.getValue()) {
188      case PASS:
189        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.PASS);
190        break;
191      case FAIL:
192        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.FAIL);
193        break;
194      case PENDING:
195        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.PENDING);
196        break;
197      default:
198        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.NULL);
199        break;
200    }
201    return tgt;
202  }
203
204  public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent src) throws FHIRException {
205    if (src == null)
206      return null;
207    org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent();
208    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
209    if (src.hasType())
210      tgt.setTypeElement(convertTestReportParticipantType(src.getTypeElement()));
211    if (src.hasUri())
212      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
213    if (src.hasDisplay())
214      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
215    return tgt;
216  }
217
218  public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException {
219    if (src == null)
220      return null;
221    org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent();
222    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
223    if (src.hasType())
224      tgt.setTypeElement(convertTestReportParticipantType(src.getTypeElement()));
225    if (src.hasUri())
226      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
227    if (src.hasDisplay())
228      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
229    return tgt;
230  }
231
232  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportParticipantType> convertTestReportParticipantType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportParticipantType> src) throws FHIRException {
233    if (src == null || src.isEmpty())
234      return null;
235    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportParticipantType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.TestReport.TestReportParticipantTypeEnumFactory());
236    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
237    switch (src.getValue()) {
238      case TESTENGINE:
239        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE);
240        break;
241      case CLIENT:
242        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT);
243        break;
244      case SERVER:
245        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER);
246        break;
247      default:
248        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL);
249        break;
250    }
251    return tgt;
252  }
253
254  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportParticipantType> convertTestReportParticipantType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportParticipantType> src) throws FHIRException {
255    if (src == null || src.isEmpty())
256      return null;
257    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportParticipantType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestReport.TestReportParticipantTypeEnumFactory());
258    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
259    switch (src.getValue()) {
260      case TESTENGINE:
261        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.TESTENGINE);
262        break;
263      case CLIENT:
264        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.CLIENT);
265        break;
266      case SERVER:
267        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.SERVER);
268        break;
269      default:
270        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.NULL);
271        break;
272    }
273    return tgt;
274  }
275
276  public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent src) throws FHIRException {
277    if (src == null)
278      return null;
279    org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent();
280    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
281    for (org.hl7.fhir.r4.model.TestReport.SetupActionComponent t : src.getAction())
282      tgt.addAction(convertSetupActionComponent(t));
283    return tgt;
284  }
285
286  public static org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException {
287    if (src == null)
288      return null;
289    org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent();
290    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
291    for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction())
292      tgt.addAction(convertSetupActionComponent(t));
293    return tgt;
294  }
295
296  public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestReport.SetupActionComponent src) throws FHIRException {
297    if (src == null)
298      return null;
299    org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent();
300    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
301    if (src.hasOperation())
302      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
303    if (src.hasAssert())
304      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
305    return tgt;
306  }
307
308  public static org.hl7.fhir.r4.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException {
309    if (src == null)
310      return null;
311    org.hl7.fhir.r4.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionComponent();
312    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
313    if (src.hasOperation())
314      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
315    if (src.hasAssert())
316      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
317    return tgt;
318  }
319
320  public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent src) throws FHIRException {
321    if (src == null)
322      return null;
323    org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent();
324    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
325    if (src.hasResult())
326      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
327    if (src.hasMessage())
328      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
329    if (src.hasDetail())
330      tgt.setDetailElement(Uri40_50.convertUri(src.getDetailElement()));
331    return tgt;
332  }
333
334  public static org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException {
335    if (src == null)
336      return null;
337    org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent();
338    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
339    if (src.hasResult())
340      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
341    if (src.hasMessage())
342      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
343    if (src.hasDetail())
344      tgt.setDetailElement(Uri40_50.convertUri(src.getDetailElement()));
345    return tgt;
346  }
347
348  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportActionResult> convertTestReportActionResult(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportActionResult> src) throws FHIRException {
349    if (src == null || src.isEmpty())
350      return null;
351    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportActionResult> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.TestReport.TestReportActionResultEnumFactory());
352    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
353    switch (src.getValue()) {
354      case PASS:
355        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS);
356        break;
357      case SKIP:
358        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP);
359        break;
360      case FAIL:
361        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL);
362        break;
363      case WARNING:
364        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING);
365        break;
366      case ERROR:
367        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR);
368        break;
369      default:
370        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL);
371        break;
372    }
373    return tgt;
374  }
375
376  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportActionResult> convertTestReportActionResult(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestReport.TestReportActionResult> src) throws FHIRException {
377    if (src == null || src.isEmpty())
378      return null;
379    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestReport.TestReportActionResult> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestReport.TestReportActionResultEnumFactory());
380    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
381    switch (src.getValue()) {
382      case PASS:
383        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.PASS);
384        break;
385      case SKIP:
386        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.SKIP);
387        break;
388      case FAIL:
389        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.FAIL);
390        break;
391      case WARNING:
392        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.WARNING);
393        break;
394      case ERROR:
395        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.ERROR);
396        break;
397      default:
398        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.NULL);
399        break;
400    }
401    return tgt;
402  }
403
404  public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent src) throws FHIRException {
405    if (src == null)
406      return null;
407    org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent();
408    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
409    if (src.hasResult())
410      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
411    if (src.hasMessage())
412      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
413    if (src.hasDetail())
414      tgt.setDetailElement(String40_50.convertString(src.getDetailElement()));
415    return tgt;
416  }
417
418  public static org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException {
419    if (src == null)
420      return null;
421    org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent();
422    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
423    if (src.hasResult())
424      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
425    if (src.hasMessage())
426      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
427    if (src.hasDetail())
428      tgt.setDetailElement(String40_50.convertString(src.getDetailElement()));
429    return tgt;
430  }
431
432  public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r4.model.TestReport.TestReportTestComponent src) throws FHIRException {
433    if (src == null)
434      return null;
435    org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent();
436    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
437    if (src.hasName())
438      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
439    if (src.hasDescription())
440      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
441    for (org.hl7.fhir.r4.model.TestReport.TestActionComponent t : src.getAction())
442      tgt.addAction(convertTestActionComponent(t));
443    return tgt;
444  }
445
446  public static org.hl7.fhir.r4.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException {
447    if (src == null)
448      return null;
449    org.hl7.fhir.r4.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTestComponent();
450    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
451    if (src.hasName())
452      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
453    if (src.hasDescription())
454      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
455    for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction())
456      tgt.addAction(convertTestActionComponent(t));
457    return tgt;
458  }
459
460  public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestReport.TestActionComponent src) throws FHIRException {
461    if (src == null)
462      return null;
463    org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent();
464    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
465    if (src.hasOperation())
466      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
467    if (src.hasAssert())
468      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
469    return tgt;
470  }
471
472  public static org.hl7.fhir.r4.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException {
473    if (src == null)
474      return null;
475    org.hl7.fhir.r4.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestActionComponent();
476    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
477    if (src.hasOperation())
478      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
479    if (src.hasAssert())
480      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
481    return tgt;
482  }
483
484  public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent src) throws FHIRException {
485    if (src == null)
486      return null;
487    org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent();
488    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
489    for (org.hl7.fhir.r4.model.TestReport.TeardownActionComponent t : src.getAction())
490      tgt.addAction(convertTeardownActionComponent(t));
491    return tgt;
492  }
493
494  public static org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException {
495    if (src == null)
496      return null;
497    org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent();
498    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
499    for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction())
500      tgt.addAction(convertTeardownActionComponent(t));
501    return tgt;
502  }
503
504  public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestReport.TeardownActionComponent src) throws FHIRException {
505    if (src == null)
506      return null;
507    org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent();
508    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
509    if (src.hasOperation())
510      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
511    return tgt;
512  }
513
514  public static org.hl7.fhir.r4.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException {
515    if (src == null)
516      return null;
517    org.hl7.fhir.r4.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TeardownActionComponent();
518    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
519    if (src.hasOperation())
520      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
521    return tgt;
522  }
523}