001package org.hl7.fhir.convertors.conv10_40.resources10_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_40;
004import org.hl7.fhir.convertors.conv10_40.VersionConvertor_10_40;
005import org.hl7.fhir.convertors.conv10_40.datatypes10_40.Reference10_40;
006import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.CodeableConcept10_40;
007import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Coding10_40;
008import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.ContactPoint10_40;
009import org.hl7.fhir.convertors.conv10_40.datatypes10_40.complextypes10_40.Identifier10_40;
010import org.hl7.fhir.convertors.conv10_40.datatypes10_40.primitivetypes10_40.*;
011import org.hl7.fhir.exceptions.FHIRException;
012
013public class TestScript10_40 {
014
015  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType> convertAssertionDirectionType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionDirectionType> src) throws FHIRException {
016    if (src == null || src.isEmpty())
017      return null;
018    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionTypeEnumFactory());
019    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
020    switch (src.getValue()) {
021      case RESPONSE:
022        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.RESPONSE);
023        break;
024      case REQUEST:
025        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.REQUEST);
026        break;
027      default:
028        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType.NULL);
029        break;
030    }
031    return tgt;
032  }
033
034  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionDirectionType> convertAssertionDirectionType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionDirectionType> src) throws FHIRException {
035    if (src == null || src.isEmpty())
036      return null;
037    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionDirectionType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestScript.AssertionDirectionTypeEnumFactory());
038    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
039    switch (src.getValue()) {
040      case RESPONSE:
041        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE);
042        break;
043      case REQUEST:
044        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST);
045        break;
046      default:
047        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL);
048        break;
049    }
050    return tgt;
051  }
052
053  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionOperatorType> convertAssertionOperatorType(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType> src) throws FHIRException {
054    if (src == null || src.isEmpty())
055      return null;
056    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionOperatorType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestScript.AssertionOperatorTypeEnumFactory());
057    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
058    switch (src.getValue()) {
059      case EQUALS:
060        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS);
061        break;
062      case NOTEQUALS:
063        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS);
064        break;
065      case IN:
066        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN);
067        break;
068      case NOTIN:
069        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN);
070        break;
071      case GREATERTHAN:
072        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN);
073        break;
074      case LESSTHAN:
075        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN);
076        break;
077      case EMPTY:
078        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY);
079        break;
080      case NOTEMPTY:
081        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY);
082        break;
083      case CONTAINS:
084        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS);
085        break;
086      case NOTCONTAINS:
087        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS);
088        break;
089      default:
090        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL);
091        break;
092    }
093    return tgt;
094  }
095
096  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType> convertAssertionOperatorType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionOperatorType> src) throws FHIRException {
097    if (src == null || src.isEmpty())
098      return null;
099    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorTypeEnumFactory());
100    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
101    switch (src.getValue()) {
102      case EQUALS:
103        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EQUALS);
104        break;
105      case NOTEQUALS:
106        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEQUALS);
107        break;
108      case IN:
109        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.IN);
110        break;
111      case NOTIN:
112        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTIN);
113        break;
114      case GREATERTHAN:
115        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.GREATERTHAN);
116        break;
117      case LESSTHAN:
118        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.LESSTHAN);
119        break;
120      case EMPTY:
121        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.EMPTY);
122        break;
123      case NOTEMPTY:
124        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTEMPTY);
125        break;
126      case CONTAINS:
127        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.CONTAINS);
128        break;
129      case NOTCONTAINS:
130        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NOTCONTAINS);
131        break;
132      default:
133        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionOperatorType.NULL);
134        break;
135    }
136    return tgt;
137  }
138
139  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes> convertAssertionResponseTypes(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes> src) throws FHIRException {
140    if (src == null || src.isEmpty())
141      return null;
142    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypesEnumFactory());
143    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
144    switch (src.getValue()) {
145      case OKAY:
146        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.OKAY);
147        break;
148      case CREATED:
149        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CREATED);
150        break;
151      case NOCONTENT:
152        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOCONTENT);
153        break;
154      case NOTMODIFIED:
155        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTMODIFIED);
156        break;
157      case BAD:
158        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.BAD);
159        break;
160      case FORBIDDEN:
161        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.FORBIDDEN);
162        break;
163      case NOTFOUND:
164        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NOTFOUND);
165        break;
166      case METHODNOTALLOWED:
167        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED);
168        break;
169      case CONFLICT:
170        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.CONFLICT);
171        break;
172      case GONE:
173        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.GONE);
174        break;
175      case PRECONDITIONFAILED:
176        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED);
177        break;
178      case UNPROCESSABLE:
179        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.UNPROCESSABLE);
180        break;
181      default:
182        tgt.setValue(org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes.NULL);
183        break;
184    }
185    return tgt;
186  }
187
188  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes> convertAssertionResponseTypes(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.TestScript.AssertionResponseTypes> src) throws FHIRException {
189    if (src == null || src.isEmpty())
190      return null;
191    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestScript.AssertionResponseTypesEnumFactory());
192    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
193    switch (src.getValue()) {
194      case OKAY:
195        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY);
196        break;
197      case CREATED:
198        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED);
199        break;
200      case NOCONTENT:
201        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT);
202        break;
203      case NOTMODIFIED:
204        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED);
205        break;
206      case BAD:
207        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD);
208        break;
209      case FORBIDDEN:
210        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN);
211        break;
212      case NOTFOUND:
213        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND);
214        break;
215      case METHODNOTALLOWED:
216        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED);
217        break;
218      case CONFLICT:
219        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT);
220        break;
221      case GONE:
222        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE);
223        break;
224      case PRECONDITIONFAILED:
225        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED);
226        break;
227      case UNPROCESSABLE:
228        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE);
229        break;
230      default:
231        tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL);
232        break;
233    }
234    return tgt;
235  }
236
237  static public String convertContentType(org.hl7.fhir.dstu2.model.TestScript.ContentType src) throws FHIRException {
238    if (src == null)
239      return null;
240    switch (src) {
241      case XML:
242        return "application/fhir+xml";
243      case JSON:
244        return "application/fhir+json";
245      default:
246        return null;
247    }
248  }
249
250  static public org.hl7.fhir.dstu2.model.TestScript.ContentType convertContentType(String src) throws FHIRException {
251    if (src == null)
252      return null;
253    if (src.contains("xml"))
254      return org.hl7.fhir.dstu2.model.TestScript.ContentType.XML;
255    if (src.contains("json"))
256      return org.hl7.fhir.dstu2.model.TestScript.ContentType.JSON;
257    return org.hl7.fhir.dstu2.model.TestScript.ContentType.NULL;
258  }
259
260  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException {
261    if (src == null || src.isEmpty())
262      return null;
263    org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent();
264    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
265    if (src.hasLabelElement())
266      tgt.setLabelElement(String10_40.convertString(src.getLabelElement()));
267    if (src.hasDescriptionElement())
268      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
269    if (src.hasDirection())
270      tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement()));
271    if (src.hasCompareToSourceIdElement())
272      tgt.setCompareToSourceIdElement(String10_40.convertString(src.getCompareToSourceIdElement()));
273    if (src.hasCompareToSourcePathElement())
274      tgt.setCompareToSourcePathElement(String10_40.convertString(src.getCompareToSourcePathElement()));
275    if (src.hasContentType())
276      tgt.setContentType(convertContentType(src.getContentType()));
277    if (src.hasHeaderFieldElement())
278      tgt.setHeaderFieldElement(String10_40.convertString(src.getHeaderFieldElement()));
279    if (src.hasMinimumIdElement())
280      tgt.setMinimumIdElement(String10_40.convertString(src.getMinimumIdElement()));
281    if (src.hasNavigationLinksElement())
282      tgt.setNavigationLinksElement(Boolean10_40.convertBoolean(src.getNavigationLinksElement()));
283    if (src.hasOperator())
284      tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement()));
285    if (src.hasPathElement())
286      tgt.setPathElement(String10_40.convertString(src.getPathElement()));
287    if (src.hasResourceElement())
288      tgt.setResourceElement(Code10_40.convertCode(src.getResourceElement()));
289    if (src.hasResponse())
290      tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement()));
291    if (src.hasResponseCodeElement())
292      tgt.setResponseCodeElement(String10_40.convertString(src.getResponseCodeElement()));
293    if (src.hasSourceIdElement())
294      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
295    if (src.hasValidateProfileIdElement())
296      tgt.setValidateProfileIdElement(Id10_40.convertId(src.getValidateProfileIdElement()));
297    if (src.hasValueElement())
298      tgt.setValueElement(String10_40.convertString(src.getValueElement()));
299    if (src.hasWarningOnlyElement())
300      tgt.setWarningOnlyElement(Boolean10_40.convertBoolean(src.getWarningOnlyElement()));
301    return tgt;
302  }
303
304  public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException {
305    if (src == null || src.isEmpty())
306      return null;
307    org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent();
308    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
309    if (src.hasLabelElement())
310      tgt.setLabelElement(String10_40.convertString(src.getLabelElement()));
311    if (src.hasDescriptionElement())
312      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
313    if (src.hasDirection())
314      tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement()));
315    if (src.hasCompareToSourceIdElement())
316      tgt.setCompareToSourceIdElement(String10_40.convertString(src.getCompareToSourceIdElement()));
317    if (src.hasCompareToSourcePathElement())
318      tgt.setCompareToSourcePathElement(String10_40.convertString(src.getCompareToSourcePathElement()));
319    if (src.hasContentType())
320      tgt.setContentType(convertContentType(src.getContentType()));
321    if (src.hasHeaderFieldElement())
322      tgt.setHeaderFieldElement(String10_40.convertString(src.getHeaderFieldElement()));
323    if (src.hasMinimumIdElement())
324      tgt.setMinimumIdElement(String10_40.convertString(src.getMinimumIdElement()));
325    if (src.hasNavigationLinksElement())
326      tgt.setNavigationLinksElement(Boolean10_40.convertBoolean(src.getNavigationLinksElement()));
327    if (src.hasOperator())
328      tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement()));
329    if (src.hasPathElement())
330      tgt.setPathElement(String10_40.convertString(src.getPathElement()));
331    if (src.hasResourceElement())
332      tgt.setResourceElement(Code10_40.convertCode(src.getResourceElement()));
333    if (src.hasResponse())
334      tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement()));
335    if (src.hasResponseCodeElement())
336      tgt.setResponseCodeElement(String10_40.convertString(src.getResponseCodeElement()));
337    if (src.hasSourceIdElement())
338      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
339    if (src.hasValidateProfileIdElement())
340      tgt.setValidateProfileIdElement(Id10_40.convertId(src.getValidateProfileIdElement()));
341    if (src.hasValueElement())
342      tgt.setValueElement(String10_40.convertString(src.getValueElement()));
343    if (src.hasWarningOnlyElement())
344      tgt.setWarningOnlyElement(Boolean10_40.convertBoolean(src.getWarningOnlyElement()));
345    return tgt;
346  }
347
348  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException {
349    if (src == null || src.isEmpty())
350      return null;
351    org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent();
352    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
353    if (src.hasOperation())
354      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
355    if (src.hasAssert())
356      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
357    return tgt;
358  }
359
360  public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException {
361    if (src == null || src.isEmpty())
362      return null;
363    org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent();
364    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
365    if (src.hasOperation())
366      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
367    if (src.hasAssert())
368      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
369    return tgt;
370  }
371
372  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException {
373    if (src == null || src.isEmpty())
374      return null;
375    org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent();
376    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
377    if (src.hasType())
378      tgt.setType(Coding10_40.convertCoding(src.getType()));
379    if (src.hasResourceElement())
380      tgt.setResourceElement(Code10_40.convertCode(src.getResourceElement()));
381    if (src.hasLabelElement())
382      tgt.setLabelElement(String10_40.convertString(src.getLabelElement()));
383    if (src.hasDescriptionElement())
384      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
385    if (src.hasAccept())
386      tgt.setAccept(convertContentType(src.getAccept()));
387    if (src.hasContentType())
388      tgt.setContentType(convertContentType(src.getContentType()));
389    if (src.hasDestinationElement())
390      tgt.setDestinationElement(Integer10_40.convertInteger(src.getDestinationElement()));
391    if (src.hasEncodeRequestUrlElement())
392      tgt.setEncodeRequestUrlElement(Boolean10_40.convertBoolean(src.getEncodeRequestUrlElement()));
393    if (src.hasParamsElement())
394      tgt.setParamsElement(String10_40.convertString(src.getParamsElement()));
395    for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
396      tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
397    if (src.hasResponseIdElement())
398      tgt.setResponseIdElement(Id10_40.convertId(src.getResponseIdElement()));
399    if (src.hasSourceIdElement())
400      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
401    if (src.hasTargetId())
402      tgt.setTargetId(src.getTargetId());
403    if (src.hasUrlElement())
404      tgt.setUrlElement(String10_40.convertString(src.getUrlElement()));
405    return tgt;
406  }
407
408  public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException {
409    if (src == null || src.isEmpty())
410      return null;
411    org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent();
412    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
413    if (src.hasType())
414      tgt.setType(Coding10_40.convertCoding(src.getType()));
415    if (src.hasResourceElement())
416      tgt.setResourceElement(Code10_40.convertCode(src.getResourceElement()));
417    if (src.hasLabelElement())
418      tgt.setLabelElement(String10_40.convertString(src.getLabelElement()));
419    if (src.hasDescriptionElement())
420      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
421    if (src.hasAccept())
422      tgt.setAccept(convertContentType(src.getAccept()));
423    if (src.hasContentType())
424      tgt.setContentType(convertContentType(src.getContentType()));
425    if (src.hasDestinationElement())
426      tgt.setDestinationElement(Integer10_40.convertInteger(src.getDestinationElement()));
427    if (src.hasEncodeRequestUrlElement())
428      tgt.setEncodeRequestUrlElement(Boolean10_40.convertBoolean(src.getEncodeRequestUrlElement()));
429    if (src.hasParamsElement())
430      tgt.setParamsElement(String10_40.convertString(src.getParamsElement()));
431    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
432      tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
433    if (src.hasResponseIdElement())
434      tgt.setResponseIdElement(Id10_40.convertId(src.getResponseIdElement()));
435    if (src.hasSourceIdElement())
436      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
437    if (src.hasTargetId())
438      tgt.setTargetId(src.getTargetId());
439    if (src.hasUrlElement())
440      tgt.setUrlElement(String10_40.convertString(src.getUrlElement()));
441    return tgt;
442  }
443
444  public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException {
445    if (src == null || src.isEmpty())
446      return null;
447    org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent();
448    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
449    if (src.hasFieldElement())
450      tgt.setFieldElement(String10_40.convertString(src.getFieldElement()));
451    if (src.hasValueElement())
452      tgt.setValueElement(String10_40.convertString(src.getValueElement()));
453    return tgt;
454  }
455
456  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException {
457    if (src == null || src.isEmpty())
458      return null;
459    org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent();
460    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
461    if (src.hasFieldElement())
462      tgt.setFieldElement(String10_40.convertString(src.getFieldElement()));
463    if (src.hasValueElement())
464      tgt.setValueElement(String10_40.convertString(src.getValueElement()));
465    return tgt;
466  }
467
468  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException {
469    if (src == null || src.isEmpty())
470      return null;
471    org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent();
472    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
473    if (src.hasOperation())
474      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
475    return tgt;
476  }
477
478  public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException {
479    if (src == null || src.isEmpty())
480      return null;
481    org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent();
482    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
483    if (src.hasOperation())
484      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
485    return tgt;
486  }
487
488  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException {
489    if (src == null || src.isEmpty())
490      return null;
491    org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent();
492    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
493    if (src.hasOperation())
494      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
495    if (src.hasAssert())
496      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
497    return tgt;
498  }
499
500  public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent src) throws FHIRException {
501    if (src == null || src.isEmpty())
502      return null;
503    org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent();
504    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
505    if (src.hasOperation())
506      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
507    if (src.hasAssert())
508      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
509    return tgt;
510  }
511
512  public static org.hl7.fhir.dstu2.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException {
513    if (src == null || src.isEmpty())
514      return null;
515    org.hl7.fhir.dstu2.model.TestScript tgt = new org.hl7.fhir.dstu2.model.TestScript();
516    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
517    if (src.hasUrlElement())
518      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
519    if (src.hasVersionElement())
520      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
521    if (src.hasNameElement())
522      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
523    if (src.hasStatus())
524      tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement()));
525    if (src.hasIdentifier())
526      tgt.setIdentifier(Identifier10_40.convertIdentifier(src.getIdentifier()));
527    if (src.hasExperimental())
528      tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement()));
529    if (src.hasPublisherElement())
530      tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
531    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact()) tgt.addContact(convertTestScriptContactComponent(t));
532    if (src.hasDate())
533      tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
534    if (src.hasDescription())
535      tgt.setDescription(src.getDescription());
536    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
537      if (t.hasValueCodeableConcept())
538        tgt.addUseContext(CodeableConcept10_40.convertCodeableConcept(t.getValueCodeableConcept()));
539    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
540      tgt.addUseContext(CodeableConcept10_40.convertCodeableConcept(t));
541    if (src.hasPurpose())
542      tgt.setRequirements(src.getPurpose());
543    if (src.hasCopyright())
544      tgt.setCopyright(src.getCopyright());
545    if (src.hasMetadata())
546      tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
547    for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
548      tgt.addFixture(convertTestScriptFixtureComponent(t));
549    for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) tgt.addProfile(Reference10_40.convertReference(t));
550    for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable())
551      tgt.addVariable(convertTestScriptVariableComponent(t));
552    if (src.hasSetup())
553      tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
554    for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest())
555      tgt.addTest(convertTestScriptTestComponent(t));
556    if (src.hasTeardown())
557      tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
558    return tgt;
559  }
560
561  public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.dstu2.model.TestScript src) throws FHIRException {
562    if (src == null || src.isEmpty())
563      return null;
564    org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript();
565    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyDomainResource(src, tgt);
566    if (src.hasUrlElement())
567      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
568    if (src.hasVersionElement())
569      tgt.setVersionElement(String10_40.convertString(src.getVersionElement()));
570    if (src.hasNameElement())
571      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
572    if (src.hasStatus())
573      tgt.setStatusElement(Enumerations10_40.convertConformanceResourceStatus(src.getStatusElement()));
574    if (src.hasIdentifier())
575      tgt.setIdentifier(Identifier10_40.convertIdentifier(src.getIdentifier()));
576    if (src.hasExperimental())
577      tgt.setExperimentalElement(Boolean10_40.convertBoolean(src.getExperimentalElement()));
578    if (src.hasPublisherElement())
579      tgt.setPublisherElement(String10_40.convertString(src.getPublisherElement()));
580    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent t : src.getContact())
581      tgt.addContact(convertTestScriptContactComponent(t));
582    if (src.hasDate())
583      tgt.setDateElement(DateTime10_40.convertDateTime(src.getDateElement()));
584    if (src.hasDescription())
585      tgt.setDescription(src.getDescription());
586    for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getUseContext())
587      if (VersionConvertor_10_40.isJurisdiction(t))
588        tgt.addJurisdiction(CodeableConcept10_40.convertCodeableConcept(t));
589      else
590        tgt.addUseContext(CodeableConcept10_40.convertCodeableConceptToUsageContext(t));
591    if (src.hasRequirements())
592      tgt.setPurpose(src.getRequirements());
593    if (src.hasCopyright())
594      tgt.setCopyright(src.getCopyright());
595    if (src.hasMetadata())
596      tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
597    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
598      tgt.addFixture(convertTestScriptFixtureComponent(t));
599    for (org.hl7.fhir.dstu2.model.Reference t : src.getProfile()) tgt.addProfile(Reference10_40.convertReference(t));
600    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent t : src.getVariable())
601      tgt.addVariable(convertTestScriptVariableComponent(t));
602    if (src.hasSetup())
603      tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
604    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent t : src.getTest())
605      tgt.addTest(convertTestScriptTestComponent(t));
606    if (src.hasTeardown())
607      tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
608    return tgt;
609  }
610
611  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
612    if (src == null || src.isEmpty())
613      return null;
614    org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent();
615    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
616    if (src.hasNameElement())
617      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
618    for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
619      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
620    return tgt;
621  }
622
623  public static org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptContactComponent src) throws FHIRException {
624    if (src == null || src.isEmpty())
625      return null;
626    org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
627    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
628    if (src.hasNameElement())
629      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
630    for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
631      tgt.addTelecom(ContactPoint10_40.convertContactPoint(t));
632    return tgt;
633  }
634
635  public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
636    if (src == null || src.isEmpty())
637      return null;
638    org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent();
639    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
640    if (src.hasAutocreateElement())
641      tgt.setAutocreateElement(Boolean10_40.convertBoolean(src.getAutocreateElement()));
642    if (src.hasAutodeleteElement())
643      tgt.setAutodeleteElement(Boolean10_40.convertBoolean(src.getAutodeleteElement()));
644    if (src.hasResource())
645      tgt.setResource(Reference10_40.convertReference(src.getResource()));
646    return tgt;
647  }
648
649  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
650    if (src == null || src.isEmpty())
651      return null;
652    org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptFixtureComponent();
653    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
654    if (src.hasAutocreateElement())
655      tgt.setAutocreateElement(Boolean10_40.convertBoolean(src.getAutocreateElement()));
656    if (src.hasAutodeleteElement())
657      tgt.setAutodeleteElement(Boolean10_40.convertBoolean(src.getAutodeleteElement()));
658    if (src.hasResource())
659      tgt.setResource(Reference10_40.convertReference(src.getResource()));
660    return tgt;
661  }
662
663  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
664    if (src == null || src.isEmpty())
665      return null;
666    org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent();
667    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
668    if (src.hasRequiredElement())
669      tgt.setRequiredElement(Boolean10_40.convertBoolean(src.getRequiredElement()));
670    if (src.hasValidatedElement())
671      tgt.setValidatedElement(Boolean10_40.convertBoolean(src.getValidatedElement()));
672    if (src.hasDescriptionElement())
673      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
674    if (src.hasDestinationElement())
675      tgt.setDestinationElement(Integer10_40.convertInteger(src.getDestinationElement()));
676    for (org.hl7.fhir.r4.model.UriType t : src.getLink()) tgt.addLink(t.getValue());
677    if (src.hasCapabilitiesElement())
678      tgt.setConformance(Canonical10_40.convertCanonicalToReference(src.getCapabilitiesElement()));
679    return tgt;
680  }
681
682  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
683    if (src == null || src.isEmpty())
684      return null;
685    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent();
686    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
687    if (src.hasRequiredElement())
688      tgt.setRequiredElement(Boolean10_40.convertBoolean(src.getRequiredElement()));
689    if (src.hasValidatedElement())
690      tgt.setValidatedElement(Boolean10_40.convertBoolean(src.getValidatedElement()));
691    if (src.hasDescriptionElement())
692      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
693    if (src.hasDestinationElement())
694      tgt.setDestinationElement(Integer10_40.convertInteger(src.getDestinationElement()));
695    for (org.hl7.fhir.dstu2.model.UriType t : src.getLink()) tgt.addLink(t.getValue());
696    if (src.hasConformance())
697      tgt.setCapabilitiesElement(Canonical10_40.convertReferenceToCanonical(src.getConformance()));
698    return tgt;
699  }
700
701  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
702    if (src == null || src.isEmpty())
703      return null;
704    org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent();
705    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
706    for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
707      tgt.addLink(convertTestScriptMetadataLinkComponent(t));
708    for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
709      tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
710    return tgt;
711  }
712
713  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
714    if (src == null || src.isEmpty())
715      return null;
716    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent();
717    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
718    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
719      tgt.addLink(convertTestScriptMetadataLinkComponent(t));
720    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
721      tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
722    return tgt;
723  }
724
725  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
726    if (src == null || src.isEmpty())
727      return null;
728    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent();
729    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
730    if (src.hasUrlElement())
731      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
732    if (src.hasDescriptionElement())
733      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
734    return tgt;
735  }
736
737  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
738    if (src == null || src.isEmpty())
739      return null;
740    org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptMetadataLinkComponent();
741    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
742    if (src.hasUrlElement())
743      tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
744    if (src.hasDescriptionElement())
745      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
746    return tgt;
747  }
748
749  public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
750    if (src == null || src.isEmpty())
751      return null;
752    org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent();
753    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
754    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupActionComponent t : src.getAction())
755      tgt.addAction(convertSetupActionComponent(t));
756    return tgt;
757  }
758
759  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
760    if (src == null || src.isEmpty())
761      return null;
762    org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptSetupComponent();
763    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
764    for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction())
765      tgt.addAction(convertSetupActionComponent(t));
766    return tgt;
767  }
768
769  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
770    if (src == null || src.isEmpty())
771      return null;
772    org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent();
773    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
774    for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction())
775      tgt.addAction(convertTeardownActionComponent(t));
776    return tgt;
777  }
778
779  public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
780    if (src == null || src.isEmpty())
781      return null;
782    org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent();
783    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
784    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTeardownActionComponent t : src.getAction())
785      tgt.addAction(convertTeardownActionComponent(t));
786    return tgt;
787  }
788
789  public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent src) throws FHIRException {
790    if (src == null || src.isEmpty())
791      return null;
792    org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent();
793    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
794    if (src.hasNameElement())
795      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
796    if (src.hasDescriptionElement())
797      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
798    for (org.hl7.fhir.dstu2.model.TestScript.TestScriptTestActionComponent t : src.getAction())
799      tgt.addAction(convertTestActionComponent(t));
800    return tgt;
801  }
802
803  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException {
804    if (src == null || src.isEmpty())
805      return null;
806    org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptTestComponent();
807    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
808    if (src.hasNameElement())
809      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
810    if (src.hasDescriptionElement())
811      tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
812    for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction())
813      tgt.addAction(convertTestActionComponent(t));
814    return tgt;
815  }
816
817  public static org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
818    if (src == null || src.isEmpty())
819      return null;
820    org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent();
821    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
822    if (src.hasNameElement())
823      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
824    if (src.hasHeaderFieldElement())
825      tgt.setHeaderFieldElement(String10_40.convertString(src.getHeaderFieldElement()));
826    if (src.hasPathElement())
827      tgt.setPathElement(String10_40.convertString(src.getPathElement()));
828    if (src.hasSourceIdElement())
829      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
830    return tgt;
831  }
832
833  public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
834    if (src == null || src.isEmpty())
835      return null;
836    org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent();
837    ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
838    if (src.hasNameElement())
839      tgt.setNameElement(String10_40.convertString(src.getNameElement()));
840    if (src.hasHeaderFieldElement())
841      tgt.setHeaderFieldElement(String10_40.convertString(src.getHeaderFieldElement()));
842    if (src.hasPathElement())
843      tgt.setPathElement(String10_40.convertString(src.getPathElement()));
844    if (src.hasSourceIdElement())
845      tgt.setSourceIdElement(Id10_40.convertId(src.getSourceIdElement()));
846    return tgt;
847  }
848}