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