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.DateTime40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Decimal40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
010import org.hl7.fhir.exceptions.FHIRException;
011import org.hl7.fhir.r4.model.Reference;
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 TestReport40_50 {
043
044  public static org.hl7.fhir.r5.model.TestReport convertTestReport(org.hl7.fhir.r4.model.TestReport src) throws FHIRException {
045    if (src == null)
046      return null;
047    org.hl7.fhir.r5.model.TestReport tgt = new org.hl7.fhir.r5.model.TestReport();
048    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
049    if (src.hasIdentifier())
050      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
051    if (src.hasName())
052      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
053    if (src.hasStatus())
054      tgt.setStatusElement(convertTestReportStatus(src.getStatusElement()));
055    if (src.hasTestScript())
056      tgt.setTestScript(src.getTestScript().getReference());
057    if (src.hasResult())
058      tgt.setResultElement(convertTestReportResult(src.getResultElement()));
059    if (src.hasScore())
060      tgt.setScoreElement(Decimal40_50.convertDecimal(src.getScoreElement()));
061    if (src.hasTester())
062      tgt.setTesterElement(String40_50.convertString(src.getTesterElement()));
063    if (src.hasIssued())
064      tgt.setIssuedElement(DateTime40_50.convertDateTime(src.getIssuedElement()));
065    for (org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent t : src.getParticipant())
066      tgt.addParticipant(convertTestReportParticipantComponent(t));
067    if (src.hasSetup())
068      tgt.setSetup(convertTestReportSetupComponent(src.getSetup()));
069    for (org.hl7.fhir.r4.model.TestReport.TestReportTestComponent t : src.getTest())
070      tgt.addTest(convertTestReportTestComponent(t));
071    if (src.hasTeardown())
072      tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown()));
073    return tgt;
074  }
075
076  public static org.hl7.fhir.r4.model.TestReport convertTestReport(org.hl7.fhir.r5.model.TestReport src) throws FHIRException {
077    if (src == null)
078      return null;
079    org.hl7.fhir.r4.model.TestReport tgt = new org.hl7.fhir.r4.model.TestReport();
080    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
081    if (src.hasIdentifier())
082      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
083    if (src.hasName())
084      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
085    if (src.hasStatus())
086      tgt.setStatusElement(convertTestReportStatus(src.getStatusElement()));
087    if (src.hasTestScript())
088      tgt.setTestScript(new Reference().setReference(src.getTestScript()));
089    if (src.hasResult())
090      tgt.setResultElement(convertTestReportResult(src.getResultElement()));
091    if (src.hasScore())
092      tgt.setScoreElement(Decimal40_50.convertDecimal(src.getScoreElement()));
093    if (src.hasTester())
094      tgt.setTesterElement(String40_50.convertString(src.getTesterElement()));
095    if (src.hasIssued())
096      tgt.setIssuedElement(DateTime40_50.convertDateTime(src.getIssuedElement()));
097    for (org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent t : src.getParticipant())
098      tgt.addParticipant(convertTestReportParticipantComponent(t));
099    if (src.hasSetup())
100      tgt.setSetup(convertTestReportSetupComponent(src.getSetup()));
101    for (org.hl7.fhir.r5.model.TestReport.TestReportTestComponent t : src.getTest())
102      tgt.addTest(convertTestReportTestComponent(t));
103    if (src.hasTeardown())
104      tgt.setTeardown(convertTestReportTeardownComponent(src.getTeardown()));
105    return tgt;
106  }
107
108  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 {
109    if (src == null || src.isEmpty())
110      return null;
111    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());
112    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
113    switch (src.getValue()) {
114      case COMPLETED:
115        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.COMPLETED);
116        break;
117      case INPROGRESS:
118        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.INPROGRESS);
119        break;
120      case WAITING:
121        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.WAITING);
122        break;
123      case STOPPED:
124        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.STOPPED);
125        break;
126      case ENTEREDINERROR:
127        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.ENTEREDINERROR);
128        break;
129      default:
130        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportStatus.NULL);
131        break;
132    }
133    return tgt;
134  }
135
136  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 {
137    if (src == null || src.isEmpty())
138      return null;
139    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());
140    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
141    switch (src.getValue()) {
142      case COMPLETED:
143        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.COMPLETED);
144        break;
145      case INPROGRESS:
146        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.INPROGRESS);
147        break;
148      case WAITING:
149        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.WAITING);
150        break;
151      case STOPPED:
152        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.STOPPED);
153        break;
154      case ENTEREDINERROR:
155        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.ENTEREDINERROR);
156        break;
157      default:
158        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportStatus.NULL);
159        break;
160    }
161    return tgt;
162  }
163
164  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 {
165    if (src == null || src.isEmpty())
166      return null;
167    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());
168    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
169    switch (src.getValue()) {
170      case PASS:
171        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.PASS);
172        break;
173      case FAIL:
174        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.FAIL);
175        break;
176      case PENDING:
177        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.PENDING);
178        break;
179      default:
180        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportResult.NULL);
181        break;
182    }
183    return tgt;
184  }
185
186  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 {
187    if (src == null || src.isEmpty())
188      return null;
189    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());
190    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
191    switch (src.getValue()) {
192      case PASS:
193        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.PASS);
194        break;
195      case FAIL:
196        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.FAIL);
197        break;
198      case PENDING:
199        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.PENDING);
200        break;
201      default:
202        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportResult.NULL);
203        break;
204    }
205    return tgt;
206  }
207
208  public static org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent src) throws FHIRException {
209    if (src == null)
210      return null;
211    org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent();
212    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
213    if (src.hasType())
214      tgt.setTypeElement(convertTestReportParticipantType(src.getTypeElement()));
215    if (src.hasUri())
216      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
217    if (src.hasDisplay())
218      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
219    return tgt;
220  }
221
222  public static org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent convertTestReportParticipantComponent(org.hl7.fhir.r5.model.TestReport.TestReportParticipantComponent src) throws FHIRException {
223    if (src == null)
224      return null;
225    org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportParticipantComponent();
226    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
227    if (src.hasType())
228      tgt.setTypeElement(convertTestReportParticipantType(src.getTypeElement()));
229    if (src.hasUri())
230      tgt.setUriElement(Uri40_50.convertUri(src.getUriElement()));
231    if (src.hasDisplay())
232      tgt.setDisplayElement(String40_50.convertString(src.getDisplayElement()));
233    return tgt;
234  }
235
236  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 {
237    if (src == null || src.isEmpty())
238      return null;
239    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());
240    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
241    switch (src.getValue()) {
242      case TESTENGINE:
243        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.TESTENGINE);
244        break;
245      case CLIENT:
246        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.CLIENT);
247        break;
248      case SERVER:
249        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.SERVER);
250        break;
251      default:
252        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportParticipantType.NULL);
253        break;
254    }
255    return tgt;
256  }
257
258  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 {
259    if (src == null || src.isEmpty())
260      return null;
261    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());
262    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
263    switch (src.getValue()) {
264      case TESTENGINE:
265        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.TESTENGINE);
266        break;
267      case CLIENT:
268        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.CLIENT);
269        break;
270      case SERVER:
271        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.SERVER);
272        break;
273      default:
274        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportParticipantType.NULL);
275        break;
276    }
277    return tgt;
278  }
279
280  public static org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent src) throws FHIRException {
281    if (src == null)
282      return null;
283    org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent();
284    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
285    for (org.hl7.fhir.r4.model.TestReport.SetupActionComponent t : src.getAction())
286      tgt.addAction(convertSetupActionComponent(t));
287    return tgt;
288  }
289
290  public static org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent convertTestReportSetupComponent(org.hl7.fhir.r5.model.TestReport.TestReportSetupComponent src) throws FHIRException {
291    if (src == null)
292      return null;
293    org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportSetupComponent();
294    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
295    for (org.hl7.fhir.r5.model.TestReport.SetupActionComponent t : src.getAction())
296      tgt.addAction(convertSetupActionComponent(t));
297    return tgt;
298  }
299
300  public static org.hl7.fhir.r5.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestReport.SetupActionComponent src) throws FHIRException {
301    if (src == null)
302      return null;
303    org.hl7.fhir.r5.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionComponent();
304    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
305    if (src.hasOperation())
306      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
307    if (src.hasAssert())
308      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
309    return tgt;
310  }
311
312  public static org.hl7.fhir.r4.model.TestReport.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestReport.SetupActionComponent src) throws FHIRException {
313    if (src == null)
314      return null;
315    org.hl7.fhir.r4.model.TestReport.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionComponent();
316    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
317    if (src.hasOperation())
318      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
319    if (src.hasAssert())
320      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
321    return tgt;
322  }
323
324  public static org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent src) throws FHIRException {
325    if (src == null)
326      return null;
327    org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent();
328    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
329    if (src.hasResult())
330      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
331    if (src.hasMessage())
332      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
333    if (src.hasDetail())
334      tgt.setDetailElement(Uri40_50.convertUri(src.getDetailElement()));
335    return tgt;
336  }
337
338  public static org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestReport.SetupActionOperationComponent src) throws FHIRException {
339    if (src == null)
340      return null;
341    org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionOperationComponent();
342    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
343    if (src.hasResult())
344      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
345    if (src.hasMessage())
346      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
347    if (src.hasDetail())
348      tgt.setDetailElement(Uri40_50.convertUri(src.getDetailElement()));
349    return tgt;
350  }
351
352  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 {
353    if (src == null || src.isEmpty())
354      return null;
355    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());
356    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
357    switch (src.getValue()) {
358      case PASS:
359        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.PASS);
360        break;
361      case SKIP:
362        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.SKIP);
363        break;
364      case FAIL:
365        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.FAIL);
366        break;
367      case WARNING:
368        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.WARNING);
369        break;
370      case ERROR:
371        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.ERROR);
372        break;
373      default:
374        tgt.setValue(org.hl7.fhir.r5.model.TestReport.TestReportActionResult.NULL);
375        break;
376    }
377    return tgt;
378  }
379
380  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 {
381    if (src == null || src.isEmpty())
382      return null;
383    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());
384    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
385    switch (src.getValue()) {
386      case PASS:
387        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.PASS);
388        break;
389      case SKIP:
390        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.SKIP);
391        break;
392      case FAIL:
393        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.FAIL);
394        break;
395      case WARNING:
396        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.WARNING);
397        break;
398      case ERROR:
399        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.ERROR);
400        break;
401      default:
402        tgt.setValue(org.hl7.fhir.r4.model.TestReport.TestReportActionResult.NULL);
403        break;
404    }
405    return tgt;
406  }
407
408  public static org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent src) throws FHIRException {
409    if (src == null)
410      return null;
411    org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent();
412    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
413    if (src.hasResult())
414      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
415    if (src.hasMessage())
416      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
417    if (src.hasDetail())
418      tgt.setDetailElement(String40_50.convertString(src.getDetailElement()));
419    return tgt;
420  }
421
422  public static org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestReport.SetupActionAssertComponent src) throws FHIRException {
423    if (src == null)
424      return null;
425    org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestReport.SetupActionAssertComponent();
426    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
427    if (src.hasResult())
428      tgt.setResultElement(convertTestReportActionResult(src.getResultElement()));
429    if (src.hasMessage())
430      tgt.setMessageElement(MarkDown40_50.convertMarkdown(src.getMessageElement()));
431    if (src.hasDetail())
432      tgt.setDetailElement(String40_50.convertString(src.getDetailElement()));
433    return tgt;
434  }
435
436  public static org.hl7.fhir.r5.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r4.model.TestReport.TestReportTestComponent src) throws FHIRException {
437    if (src == null)
438      return null;
439    org.hl7.fhir.r5.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTestComponent();
440    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
441    if (src.hasName())
442      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
443    if (src.hasDescription())
444      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
445    for (org.hl7.fhir.r4.model.TestReport.TestActionComponent t : src.getAction())
446      tgt.addAction(convertTestActionComponent(t));
447    return tgt;
448  }
449
450  public static org.hl7.fhir.r4.model.TestReport.TestReportTestComponent convertTestReportTestComponent(org.hl7.fhir.r5.model.TestReport.TestReportTestComponent src) throws FHIRException {
451    if (src == null)
452      return null;
453    org.hl7.fhir.r4.model.TestReport.TestReportTestComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTestComponent();
454    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
455    if (src.hasName())
456      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
457    if (src.hasDescription())
458      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
459    for (org.hl7.fhir.r5.model.TestReport.TestActionComponent t : src.getAction())
460      tgt.addAction(convertTestActionComponent(t));
461    return tgt;
462  }
463
464  public static org.hl7.fhir.r5.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestReport.TestActionComponent src) throws FHIRException {
465    if (src == null)
466      return null;
467    org.hl7.fhir.r5.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestActionComponent();
468    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
469    if (src.hasOperation())
470      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
471    if (src.hasAssert())
472      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
473    return tgt;
474  }
475
476  public static org.hl7.fhir.r4.model.TestReport.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestReport.TestActionComponent src) throws FHIRException {
477    if (src == null)
478      return null;
479    org.hl7.fhir.r4.model.TestReport.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestActionComponent();
480    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
481    if (src.hasOperation())
482      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
483    if (src.hasAssert())
484      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
485    return tgt;
486  }
487
488  public static org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent src) throws FHIRException {
489    if (src == null)
490      return null;
491    org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent();
492    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
493    for (org.hl7.fhir.r4.model.TestReport.TeardownActionComponent t : src.getAction())
494      tgt.addAction(convertTeardownActionComponent(t));
495    return tgt;
496  }
497
498  public static org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent convertTestReportTeardownComponent(org.hl7.fhir.r5.model.TestReport.TestReportTeardownComponent src) throws FHIRException {
499    if (src == null)
500      return null;
501    org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent tgt = new org.hl7.fhir.r4.model.TestReport.TestReportTeardownComponent();
502    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
503    for (org.hl7.fhir.r5.model.TestReport.TeardownActionComponent t : src.getAction())
504      tgt.addAction(convertTeardownActionComponent(t));
505    return tgt;
506  }
507
508  public static org.hl7.fhir.r5.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestReport.TeardownActionComponent src) throws FHIRException {
509    if (src == null)
510      return null;
511    org.hl7.fhir.r5.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestReport.TeardownActionComponent();
512    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
513    if (src.hasOperation())
514      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
515    return tgt;
516  }
517
518  public static org.hl7.fhir.r4.model.TestReport.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestReport.TeardownActionComponent src) throws FHIRException {
519    if (src == null)
520      return null;
521    org.hl7.fhir.r4.model.TestReport.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestReport.TeardownActionComponent();
522    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
523    if (src.hasOperation())
524      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
525    return tgt;
526  }
527}