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