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