001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.VersionConvertorConstants;
004import org.hl7.fhir.convertors.context.ConversionContext40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Code40_50;
013import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
014import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Id40_50;
015import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Integer40_50;
016import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
017import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
018import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
019import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
020import org.hl7.fhir.exceptions.FHIRException;
021import org.hl7.fhir.r5.model.CanonicalType;
022import org.hl7.fhir.r5.model.Enumeration;
023import org.hl7.fhir.r5.model.TestScript;
024import org.hl7.fhir.r5.model.TestScript.TestScriptScopeComponent;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
055public class TestScript40_50 {
056
057  public static org.hl7.fhir.r5.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException {
058    if (src == null)
059      return null;
060    org.hl7.fhir.r5.model.TestScript tgt = new org.hl7.fhir.r5.model.TestScript();
061    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
062    for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(VersionConvertorConstants.EXT_TESTSCRIPT_SCOPE)) {
063      // the advisor will get this ignored.
064      TestScriptScopeComponent scope = tgt.addScope();
065      scope.setArtifact(ext.getExtensionString("artifact"));
066      org.hl7.fhir.r4.model.Extension se = ext.getExtensionByUrl("conformance");
067      if (se != null) {
068        scope.setConformance(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) se.getValue()));
069      }
070      se = ext.getExtensionByUrl("phase");
071      if (se != null) {
072        scope.setPhase(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) se.getValue()));
073      }
074    }
075    if (src.hasUrl())
076      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
077    if (src.hasIdentifier())
078      tgt.addIdentifier(Identifier40_50.convertIdentifier(src.getIdentifier()));
079    if (src.hasVersion())
080      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
081    if (src.hasName())
082      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
083    if (src.hasTitle())
084      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
085    if (src.hasStatus())
086      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
087    if (src.hasExperimental())
088      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
089    if (src.hasDate())
090      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
091    if (src.hasPublisher())
092      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
093    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
094      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
095    if (src.hasDescription())
096      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
097    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
098      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
099    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
100      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
101    if (src.hasPurpose())
102      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
103    if (src.hasCopyright())
104      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
105    for (org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent t : src.getOrigin())
106      tgt.addOrigin(convertTestScriptOriginComponent(t));
107    for (org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent t : src.getDestination())
108      tgt.addDestination(convertTestScriptDestinationComponent(t));
109    if (src.hasMetadata())
110      tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
111    for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
112      tgt.addFixture(convertTestScriptFixtureComponent(t));
113    for (org.hl7.fhir.r4.model.Reference t : src.getProfile()) tgt.getProfile().add(Reference40_50.convertReferenceToCanonical(t));
114    for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable())
115      tgt.addVariable(convertTestScriptVariableComponent(t));
116    if (src.hasSetup())
117      tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
118    for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest())
119      tgt.addTest(convertTestScriptTestComponent(t));
120    if (src.hasTeardown())
121      tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
122    return tgt;
123  }
124
125  public static org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.r5.model.TestScript src) throws FHIRException {
126    if (src == null)
127      return null;
128    org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript();
129    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
130    if (src.hasUrl())
131      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
132    if (src.hasIdentifier())
133      tgt.setIdentifier(Identifier40_50.convertIdentifier(src.getIdentifierFirstRep()));
134    if (src.hasVersion())
135      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
136    if (src.hasName())
137      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
138    if (src.hasTitle())
139      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
140    if (src.hasStatus())
141      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
142    if (src.hasExperimental())
143      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
144    if (src.hasDate())
145      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
146    if (src.hasPublisher())
147      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
148    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
149      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
150    if (src.hasDescription())
151      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
152    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
153      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
154    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
155      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
156    if (src.hasPurpose())
157      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
158    if (src.hasCopyright())
159      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
160    for (org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent t : src.getOrigin())
161      tgt.addOrigin(convertTestScriptOriginComponent(t));
162    for (org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent t : src.getDestination())
163      tgt.addDestination(convertTestScriptDestinationComponent(t));
164    if (src.hasMetadata())
165      tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
166    for (org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
167      tgt.addFixture(convertTestScriptFixtureComponent(t));
168    for (CanonicalType t : src.getProfile()) tgt.addProfile(Reference40_50.convertCanonicalToReference(t));
169    for (org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent t : src.getVariable())
170      tgt.addVariable(convertTestScriptVariableComponent(t));
171    if (src.hasSetup())
172      tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
173    for (org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent t : src.getTest())
174      tgt.addTest(convertTestScriptTestComponent(t));
175    if (src.hasTeardown())
176      tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
177    for (TestScriptScopeComponent scope : src.getScope()) {
178      org.hl7.fhir.r4.model.Extension ext = tgt.addExtension();
179      ext.setUrl(VersionConvertorConstants.EXT_TESTSCRIPT_SCOPE);
180      if (scope.hasArtifact()) {
181        org.hl7.fhir.r4.model.Extension se = ext.addExtension();
182        se.setUrl("artifact");
183        se.setValue(Canonical40_50.convertCanonical(scope.getArtifactElement()));
184      }
185      if (scope.hasConformance()) {
186        org.hl7.fhir.r4.model.Extension se = ext.addExtension();
187        se.setUrl("conformance");
188        se.setValue(CodeableConcept40_50.convertCodeableConcept(scope.getConformance()));
189      }
190      if (scope.hasPhase()) {
191        org.hl7.fhir.r4.model.Extension se = ext.addExtension();
192        se.setUrl("phase");
193        se.setValue(CodeableConcept40_50.convertCodeableConcept(scope.getPhase()));
194      }      
195    }
196    return tgt;
197  }
198
199  public static org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent src) throws FHIRException {
200    if (src == null)
201      return null;
202    org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent();
203    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
204    if (src.hasIndex())
205      tgt.setIndexElement(Integer40_50.convertInteger(src.getIndexElement()));
206    if (src.hasProfile())
207      tgt.setProfile(Coding40_50.convertCoding(src.getProfile()));
208    return tgt;
209  }
210
211  public static org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.r5.model.TestScript.TestScriptOriginComponent src) throws FHIRException {
212    if (src == null)
213      return null;
214    org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptOriginComponent();
215    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
216    if (src.hasIndex())
217      tgt.setIndexElement(Integer40_50.convertInteger(src.getIndexElement()));
218    if (src.hasProfile())
219      tgt.setProfile(Coding40_50.convertCoding(src.getProfile()));
220    return tgt;
221  }
222
223  public static org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent src) throws FHIRException {
224    if (src == null)
225      return null;
226    org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent();
227    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
228    if (src.hasIndex())
229      tgt.setIndexElement(Integer40_50.convertInteger(src.getIndexElement()));
230    if (src.hasProfile())
231      tgt.setProfile(Coding40_50.convertCoding(src.getProfile()));
232    return tgt;
233  }
234
235  public static org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.r5.model.TestScript.TestScriptDestinationComponent src) throws FHIRException {
236    if (src == null)
237      return null;
238    org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptDestinationComponent();
239    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
240    if (src.hasIndex())
241      tgt.setIndexElement(Integer40_50.convertInteger(src.getIndexElement()));
242    if (src.hasProfile())
243      tgt.setProfile(Coding40_50.convertCoding(src.getProfile()));
244    return tgt;
245  }
246
247  public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
248    if (src == null)
249      return null;
250    org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent();
251    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
252    for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
253      tgt.addLink(convertTestScriptMetadataLinkComponent(t));
254    for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
255      tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
256    return tgt;
257  }
258
259  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
260    if (src == null)
261      return null;
262    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent();
263    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
264    for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
265      tgt.addLink(convertTestScriptMetadataLinkComponent(t));
266    for (org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
267      tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
268    return tgt;
269  }
270
271  public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
272    if (src == null)
273      return null;
274    org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent();
275    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
276    if (src.hasUrl())
277      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
278    if (src.hasDescription())
279      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
280    return tgt;
281  }
282
283  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
284    if (src == null)
285      return null;
286    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent();
287    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
288    if (src.hasUrl())
289      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
290    if (src.hasDescription())
291      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
292    return tgt;
293  }
294
295  public static org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
296    if (src == null)
297      return null;
298    org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent();
299    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
300    if (src.hasRequired())
301      tgt.setRequiredElement(Boolean40_50.convertBoolean(src.getRequiredElement()));
302    if (src.hasValidated())
303      tgt.setValidatedElement(Boolean40_50.convertBoolean(src.getValidatedElement()));
304    if (src.hasDescription())
305      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
306    for (org.hl7.fhir.r4.model.IntegerType t : src.getOrigin()) tgt.getOrigin().add(Integer40_50.convertInteger(t));
307    if (src.hasDestination())
308      tgt.setDestinationElement(Integer40_50.convertInteger(src.getDestinationElement()));
309    for (org.hl7.fhir.r4.model.UriType t : src.getLink()) tgt.getLink().add(Uri40_50.convertUri(t));
310    if (src.hasCapabilities())
311      tgt.setCapabilitiesElement(Canonical40_50.convertCanonical(src.getCapabilitiesElement()));
312    return tgt;
313  }
314
315  public static org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r5.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
316    if (src == null)
317      return null;
318    org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent();
319    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
320    if (src.hasRequired())
321      tgt.setRequiredElement(Boolean40_50.convertBoolean(src.getRequiredElement()));
322    if (src.hasValidated())
323      tgt.setValidatedElement(Boolean40_50.convertBoolean(src.getValidatedElement()));
324    if (src.hasDescription())
325      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
326    for (org.hl7.fhir.r5.model.IntegerType t : src.getOrigin()) tgt.getOrigin().add(Integer40_50.convertInteger(t));
327    if (src.hasDestination())
328      tgt.setDestinationElement(Integer40_50.convertInteger(src.getDestinationElement()));
329    for (org.hl7.fhir.r5.model.UriType t : src.getLink()) tgt.getLink().add(Uri40_50.convertUri(t));
330    if (src.hasCapabilities())
331      tgt.setCapabilitiesElement(Canonical40_50.convertCanonical(src.getCapabilitiesElement()));
332    return tgt;
333  }
334
335  public static org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
336    if (src == null)
337      return null;
338    org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent();
339    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
340    if (src.hasAutocreate())
341      tgt.setAutocreateElement(Boolean40_50.convertBoolean(src.getAutocreateElement()));
342    if (src.hasAutodelete())
343      tgt.setAutodeleteElement(Boolean40_50.convertBoolean(src.getAutodeleteElement()));
344    if (src.hasResource())
345      tgt.setResource(Reference40_50.convertReference(src.getResource()));
346    return tgt;
347  }
348
349  public static org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r5.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
350    if (src == null)
351      return null;
352    org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent();
353    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
354    if (src.hasAutocreate())
355      tgt.setAutocreateElement(Boolean40_50.convertBoolean(src.getAutocreateElement()));
356    if (src.hasAutodelete())
357      tgt.setAutodeleteElement(Boolean40_50.convertBoolean(src.getAutodeleteElement()));
358    if (src.hasResource())
359      tgt.setResource(Reference40_50.convertReference(src.getResource()));
360    return tgt;
361  }
362
363  public static org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
364    if (src == null)
365      return null;
366    org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent();
367    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
368    if (src.hasName())
369      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
370    if (src.hasDefaultValue())
371      tgt.setDefaultValueElement(String40_50.convertString(src.getDefaultValueElement()));
372    if (src.hasDescription())
373      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
374    if (src.hasExpression())
375      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
376    if (src.hasHeaderField())
377      tgt.setHeaderFieldElement(String40_50.convertString(src.getHeaderFieldElement()));
378    if (src.hasHint())
379      tgt.setHintElement(String40_50.convertString(src.getHintElement()));
380    if (src.hasPath())
381      tgt.setPathElement(String40_50.convertString(src.getPathElement()));
382    if (src.hasSourceId())
383      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
384    return tgt;
385  }
386
387  public static org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r5.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
388    if (src == null)
389      return null;
390    org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent();
391    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
392    if (src.hasName())
393      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
394    if (src.hasDefaultValue())
395      tgt.setDefaultValueElement(String40_50.convertString(src.getDefaultValueElement()));
396    if (src.hasDescription())
397      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
398    if (src.hasExpression())
399      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
400    if (src.hasHeaderField())
401      tgt.setHeaderFieldElement(String40_50.convertString(src.getHeaderFieldElement()));
402    if (src.hasHint())
403      tgt.setHintElement(String40_50.convertString(src.getHintElement()));
404    if (src.hasPath())
405      tgt.setPathElement(String40_50.convertString(src.getPathElement()));
406    if (src.hasSourceId())
407      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
408    return tgt;
409  }
410
411  public static org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
412    if (src == null)
413      return null;
414    org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent();
415    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
416    for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction())
417      tgt.addAction(convertSetupActionComponent(t));
418    return tgt;
419  }
420
421  public static org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r5.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
422    if (src == null)
423      return null;
424    org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent();
425    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
426    for (org.hl7.fhir.r5.model.TestScript.SetupActionComponent t : src.getAction())
427      tgt.addAction(convertSetupActionComponent(t));
428    return tgt;
429  }
430
431  public static org.hl7.fhir.r5.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException {
432    if (src == null)
433      return null;
434    org.hl7.fhir.r5.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionComponent();
435    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
436    if (src.hasOperation())
437      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
438    if (src.hasAssert())
439      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
440    return tgt;
441  }
442
443  public static org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.r5.model.TestScript.SetupActionComponent src) throws FHIRException {
444    if (src == null)
445      return null;
446    org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent();
447    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
448    if (src.hasOperation())
449      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
450    if (src.hasAssert())
451      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
452    return tgt;
453  }
454
455  public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException {
456    if (src == null)
457      return null;
458    org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent();
459    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
460    if (src.hasType())
461      tgt.setType(Coding40_50.convertCoding(src.getType()));
462    if (src.hasResource())
463      tgt.setResource(src.getResource());
464    if (src.hasLabel())
465      tgt.setLabelElement(String40_50.convertString(src.getLabelElement()));
466    if (src.hasDescription())
467      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
468    if (src.hasAccept())
469      tgt.setAcceptElement(Code40_50.convertCode(src.getAcceptElement()));
470    if (src.hasContentType())
471      tgt.setContentTypeElement(Code40_50.convertCode(src.getContentTypeElement()));
472    if (src.hasDestination())
473      tgt.setDestinationElement(Integer40_50.convertInteger(src.getDestinationElement()));
474    if (src.hasEncodeRequestUrl())
475      tgt.setEncodeRequestUrlElement(Boolean40_50.convertBoolean(src.getEncodeRequestUrlElement()));
476    if (src.hasMethod())
477      tgt.setMethodElement(convertTestScriptRequestMethodCode(src.getMethodElement()));
478    if (src.hasOrigin())
479      tgt.setOriginElement(Integer40_50.convertInteger(src.getOriginElement()));
480    if (src.hasParams())
481      tgt.setParamsElement(String40_50.convertString(src.getParamsElement()));
482    for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
483      tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
484    if (src.hasRequestId())
485      tgt.setRequestIdElement(Id40_50.convertId(src.getRequestIdElement()));
486    if (src.hasResponseId())
487      tgt.setResponseIdElement(Id40_50.convertId(src.getResponseIdElement()));
488    if (src.hasSourceId())
489      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
490    if (src.hasTargetId())
491      tgt.setTargetIdElement(Id40_50.convertId(src.getTargetIdElement()));
492    if (src.hasUrl())
493      tgt.setUrlElement(String40_50.convertString(src.getUrlElement()));
494    return tgt;
495  }
496
497  public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationComponent src) throws FHIRException {
498    if (src == null)
499      return null;
500    org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent();
501    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
502    if (src.hasType())
503      tgt.setType(Coding40_50.convertCoding(src.getType()));
504    if (src.hasResource())
505      tgt.setResource(src.getResource());
506    if (src.hasLabel())
507      tgt.setLabelElement(String40_50.convertString(src.getLabelElement()));
508    if (src.hasDescription())
509      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
510    if (src.hasAccept())
511      tgt.setAcceptElement(Code40_50.convertCode(src.getAcceptElement()));
512    if (src.hasContentType())
513      tgt.setContentTypeElement(Code40_50.convertCode(src.getContentTypeElement()));
514    if (src.hasDestination())
515      tgt.setDestinationElement(Integer40_50.convertInteger(src.getDestinationElement()));
516    if (src.hasEncodeRequestUrl())
517      tgt.setEncodeRequestUrlElement(Boolean40_50.convertBoolean(src.getEncodeRequestUrlElement()));
518    if (src.hasMethod())
519      tgt.setMethodElement(convertTestScriptRequestMethodCode(src.getMethodElement()));
520    if (src.hasOrigin())
521      tgt.setOriginElement(Integer40_50.convertInteger(src.getOriginElement()));
522    if (src.hasParams())
523      tgt.setParamsElement(String40_50.convertString(src.getParamsElement()));
524    for (org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
525      tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
526    if (src.hasRequestId())
527      tgt.setRequestIdElement(Id40_50.convertId(src.getRequestIdElement()));
528    if (src.hasResponseId())
529      tgt.setResponseIdElement(Id40_50.convertId(src.getResponseIdElement()));
530    if (src.hasSourceId())
531      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
532    if (src.hasTargetId())
533      tgt.setTargetIdElement(Id40_50.convertId(src.getTargetIdElement()));
534    if (src.hasUrl())
535      tgt.setUrlElement(String40_50.convertString(src.getUrlElement()));
536    return tgt;
537  }
538
539  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode> convertTestScriptRequestMethodCode(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode> src) throws FHIRException {
540      if (src == null || src.isEmpty())
541          return null;
542      Enumeration<TestScript.TestScriptRequestMethodCode> tgt = new Enumeration<>(new TestScript.TestScriptRequestMethodCodeEnumFactory());
543      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
544      if (src.getValue() == null) {
545          tgt.setValue(null);
546      } else {
547          switch (src.getValue()) {
548              case DELETE:
549                  tgt.setValue(TestScript.TestScriptRequestMethodCode.DELETE);
550                  break;
551              case GET:
552                  tgt.setValue(TestScript.TestScriptRequestMethodCode.GET);
553                  break;
554              case OPTIONS:
555                  tgt.setValue(TestScript.TestScriptRequestMethodCode.OPTIONS);
556                  break;
557              case PATCH:
558                  tgt.setValue(TestScript.TestScriptRequestMethodCode.PATCH);
559                  break;
560              case POST:
561                  tgt.setValue(TestScript.TestScriptRequestMethodCode.POST);
562                  break;
563              case PUT:
564                  tgt.setValue(TestScript.TestScriptRequestMethodCode.PUT);
565                  break;
566              case HEAD:
567                  tgt.setValue(TestScript.TestScriptRequestMethodCode.HEAD);
568                  break;
569              default:
570                  tgt.setValue(TestScript.TestScriptRequestMethodCode.NULL);
571                  break;
572          }
573      }
574      return tgt;
575  }
576
577  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode> convertTestScriptRequestMethodCode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.TestScriptRequestMethodCode> src) throws FHIRException {
578      if (src == null || src.isEmpty())
579          return null;
580      org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCodeEnumFactory());
581      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
582      if (src.getValue() == null) {
583          tgt.setValue(null);
584      } else {
585          switch (src.getValue()) {
586              case DELETE:
587                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.DELETE);
588                  break;
589              case GET:
590                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.GET);
591                  break;
592              case OPTIONS:
593                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.OPTIONS);
594                  break;
595              case PATCH:
596                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PATCH);
597                  break;
598              case POST:
599                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.POST);
600                  break;
601              case PUT:
602                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.PUT);
603                  break;
604              case HEAD:
605                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.HEAD);
606                  break;
607              default:
608                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.TestScriptRequestMethodCode.NULL);
609                  break;
610          }
611      }
612      return tgt;
613  }
614
615  public static org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException {
616    if (src == null)
617      return null;
618    org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent();
619    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
620    if (src.hasField())
621      tgt.setFieldElement(String40_50.convertString(src.getFieldElement()));
622    if (src.hasValue())
623      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
624    return tgt;
625  }
626
627  public static org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r5.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException {
628    if (src == null)
629      return null;
630    org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent();
631    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
632    if (src.hasField())
633      tgt.setFieldElement(String40_50.convertString(src.getFieldElement()));
634    if (src.hasValue())
635      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
636    return tgt;
637  }
638
639  public static org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException {
640    if (src == null)
641      return null;
642    org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent();
643    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
644    if (src.hasLabel())
645      tgt.setLabelElement(String40_50.convertString(src.getLabelElement()));
646    if (src.hasDescription())
647      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
648    if (src.hasDirection())
649      tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement()));
650    if (src.hasCompareToSourceId())
651      tgt.setCompareToSourceIdElement(String40_50.convertString(src.getCompareToSourceIdElement()));
652    if (src.hasCompareToSourceExpression())
653      tgt.setCompareToSourceExpressionElement(String40_50.convertString(src.getCompareToSourceExpressionElement()));
654    if (src.hasCompareToSourcePath())
655      tgt.setCompareToSourcePathElement(String40_50.convertString(src.getCompareToSourcePathElement()));
656    if (src.hasContentType())
657      tgt.setContentTypeElement(Code40_50.convertCode(src.getContentTypeElement()));
658    if (src.hasExpression())
659      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
660    if (src.hasHeaderField())
661      tgt.setHeaderFieldElement(String40_50.convertString(src.getHeaderFieldElement()));
662    if (src.hasMinimumId())
663      tgt.setMinimumIdElement(String40_50.convertString(src.getMinimumIdElement()));
664    if (src.hasNavigationLinks())
665      tgt.setNavigationLinksElement(Boolean40_50.convertBoolean(src.getNavigationLinksElement()));
666    if (src.hasOperator())
667      tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement()));
668    if (src.hasPath())
669      tgt.setPathElement(String40_50.convertString(src.getPathElement()));
670    if (src.hasRequestMethod())
671      tgt.setRequestMethodElement(convertTestScriptRequestMethodCode(src.getRequestMethodElement()));
672    if (src.hasRequestURL())
673      tgt.setRequestURLElement(String40_50.convertString(src.getRequestURLElement()));
674    if (src.hasResource())
675      tgt.setResource(src.getResource());
676    if (src.hasResponse())
677      tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement()));
678    if (src.hasResponseCode())
679      tgt.setResponseCodeElement(String40_50.convertString(src.getResponseCodeElement()));
680    if (src.hasSourceId())
681      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
682    if (src.hasValidateProfileId())
683      tgt.setValidateProfileIdElement(Id40_50.convertId(src.getValidateProfileIdElement()));
684    if (src.hasValue())
685      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
686    if (src.hasWarningOnly())
687      tgt.setWarningOnlyElement(Boolean40_50.convertBoolean(src.getWarningOnlyElement()));
688    return tgt;
689  }
690
691  public static org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r5.model.TestScript.SetupActionAssertComponent src) throws FHIRException {
692    if (src == null)
693      return null;
694    org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent();
695    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
696    if (src.hasLabel())
697      tgt.setLabelElement(String40_50.convertString(src.getLabelElement()));
698    if (src.hasDescription())
699      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
700    if (src.hasDirection())
701      tgt.setDirectionElement(convertAssertionDirectionType(src.getDirectionElement()));
702    if (src.hasCompareToSourceId())
703      tgt.setCompareToSourceIdElement(String40_50.convertString(src.getCompareToSourceIdElement()));
704    if (src.hasCompareToSourceExpression())
705      tgt.setCompareToSourceExpressionElement(String40_50.convertString(src.getCompareToSourceExpressionElement()));
706    if (src.hasCompareToSourcePath())
707      tgt.setCompareToSourcePathElement(String40_50.convertString(src.getCompareToSourcePathElement()));
708    if (src.hasContentType())
709      tgt.setContentTypeElement(Code40_50.convertCode(src.getContentTypeElement()));
710    if (src.hasExpression())
711      tgt.setExpressionElement(String40_50.convertString(src.getExpressionElement()));
712    if (src.hasHeaderField())
713      tgt.setHeaderFieldElement(String40_50.convertString(src.getHeaderFieldElement()));
714    if (src.hasMinimumId())
715      tgt.setMinimumIdElement(String40_50.convertString(src.getMinimumIdElement()));
716    if (src.hasNavigationLinks())
717      tgt.setNavigationLinksElement(Boolean40_50.convertBoolean(src.getNavigationLinksElement()));
718    if (src.hasOperator())
719      tgt.setOperatorElement(convertAssertionOperatorType(src.getOperatorElement()));
720    if (src.hasPath())
721      tgt.setPathElement(String40_50.convertString(src.getPathElement()));
722    if (src.hasRequestMethod())
723      tgt.setRequestMethodElement(convertTestScriptRequestMethodCode(src.getRequestMethodElement()));
724    if (src.hasRequestURL())
725      tgt.setRequestURLElement(String40_50.convertString(src.getRequestURLElement()));
726    if (src.hasResource())
727      tgt.setResource(src.getResource());
728    if (src.hasResponse())
729      tgt.setResponseElement(convertAssertionResponseTypes(src.getResponseElement()));
730    if (src.hasResponseCode())
731      tgt.setResponseCodeElement(String40_50.convertString(src.getResponseCodeElement()));
732    if (src.hasSourceId())
733      tgt.setSourceIdElement(Id40_50.convertId(src.getSourceIdElement()));
734    if (src.hasValidateProfileId())
735      tgt.setValidateProfileIdElement(Id40_50.convertId(src.getValidateProfileIdElement()));
736    if (src.hasValue())
737      tgt.setValueElement(String40_50.convertString(src.getValueElement()));
738    if (src.hasWarningOnly())
739      tgt.setWarningOnlyElement(Boolean40_50.convertBoolean(src.getWarningOnlyElement()));
740    return tgt;
741  }
742
743  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionDirectionType> convertAssertionDirectionType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionDirectionType> src) throws FHIRException {
744      if (src == null || src.isEmpty())
745          return null;
746      Enumeration<TestScript.AssertionDirectionType> tgt = new Enumeration<>(new TestScript.AssertionDirectionTypeEnumFactory());
747      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
748      if (src.getValue() == null) {
749          tgt.setValue(null);
750      } else {
751          switch (src.getValue()) {
752              case RESPONSE:
753                  tgt.setValue(TestScript.AssertionDirectionType.RESPONSE);
754                  break;
755              case REQUEST:
756                  tgt.setValue(TestScript.AssertionDirectionType.REQUEST);
757                  break;
758              default:
759                  tgt.setValue(TestScript.AssertionDirectionType.NULL);
760                  break;
761          }
762      }
763      return tgt;
764  }
765
766  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionDirectionType> convertAssertionDirectionType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionDirectionType> src) throws FHIRException {
767      if (src == null || src.isEmpty())
768          return null;
769      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());
770      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
771      if (src.getValue() == null) {
772          tgt.setValue(null);
773      } else {
774          switch (src.getValue()) {
775              case RESPONSE:
776                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE);
777                  break;
778              case REQUEST:
779                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST);
780                  break;
781              default:
782                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL);
783                  break;
784          }
785      }
786      return tgt;
787  }
788
789  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionOperatorType> convertAssertionOperatorType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionOperatorType> src) throws FHIRException {
790      if (src == null || src.isEmpty())
791          return null;
792      Enumeration<TestScript.AssertionOperatorType> tgt = new Enumeration<>(new TestScript.AssertionOperatorTypeEnumFactory());
793      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
794      if (src.getValue() == null) {
795          tgt.setValue(null);
796      } else {
797          switch (src.getValue()) {
798              case EQUALS:
799                  tgt.setValue(TestScript.AssertionOperatorType.EQUALS);
800                  break;
801              case NOTEQUALS:
802                  tgt.setValue(TestScript.AssertionOperatorType.NOTEQUALS);
803                  break;
804              case IN:
805                  tgt.setValue(TestScript.AssertionOperatorType.IN);
806                  break;
807              case NOTIN:
808                  tgt.setValue(TestScript.AssertionOperatorType.NOTIN);
809                  break;
810              case GREATERTHAN:
811                  tgt.setValue(TestScript.AssertionOperatorType.GREATERTHAN);
812                  break;
813              case LESSTHAN:
814                  tgt.setValue(TestScript.AssertionOperatorType.LESSTHAN);
815                  break;
816              case EMPTY:
817                  tgt.setValue(TestScript.AssertionOperatorType.EMPTY);
818                  break;
819              case NOTEMPTY:
820                  tgt.setValue(TestScript.AssertionOperatorType.NOTEMPTY);
821                  break;
822              case CONTAINS:
823                  tgt.setValue(TestScript.AssertionOperatorType.CONTAINS);
824                  break;
825              case NOTCONTAINS:
826                  tgt.setValue(TestScript.AssertionOperatorType.NOTCONTAINS);
827                  break;
828              case EVAL:
829                  tgt.setValue(TestScript.AssertionOperatorType.EVAL);
830                  break;
831              default:
832                  tgt.setValue(TestScript.AssertionOperatorType.NULL);
833                  break;
834          }
835      }
836      return tgt;
837  }
838
839  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionOperatorType> convertAssertionOperatorType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionOperatorType> src) throws FHIRException {
840      if (src == null || src.isEmpty())
841          return null;
842      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());
843      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
844      if (src.getValue() == null) {
845          tgt.setValue(null);
846      } else {
847          switch (src.getValue()) {
848              case EQUALS:
849                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS);
850                  break;
851              case NOTEQUALS:
852                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS);
853                  break;
854              case IN:
855                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN);
856                  break;
857              case NOTIN:
858                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN);
859                  break;
860              case GREATERTHAN:
861                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN);
862                  break;
863              case LESSTHAN:
864                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN);
865                  break;
866              case EMPTY:
867                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY);
868                  break;
869              case NOTEMPTY:
870                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY);
871                  break;
872              case CONTAINS:
873                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS);
874                  break;
875              case NOTCONTAINS:
876                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS);
877                  break;
878              case EVAL:
879                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EVAL);
880                  break;
881              default:
882                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL);
883                  break;
884          }
885      }
886      return tgt;
887  }
888
889  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes> convertAssertionResponseTypes(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes> src) throws FHIRException {
890      if (src == null || src.isEmpty())
891          return null;
892      Enumeration<TestScript.AssertionResponseTypes> tgt = new Enumeration<>(new TestScript.AssertionResponseTypesEnumFactory());
893      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
894      if (src.getValue() == null) {
895          tgt.setValue(null);
896      } else {
897          switch (src.getValue()) {
898              case OKAY:
899                  tgt.setValue(TestScript.AssertionResponseTypes.OKAY);
900                  break;
901              case CREATED:
902                  tgt.setValue(TestScript.AssertionResponseTypes.CREATED);
903                  break;
904              case NOCONTENT:
905                  tgt.setValue(TestScript.AssertionResponseTypes.NOCONTENT);
906                  break;
907              case NOTMODIFIED:
908                  tgt.setValue(TestScript.AssertionResponseTypes.NOTMODIFIED);
909                  break;
910              case BAD:
911                  tgt.setValue(TestScript.AssertionResponseTypes.BADREQUEST);
912                  break;
913              case FORBIDDEN:
914                  tgt.setValue(TestScript.AssertionResponseTypes.FORBIDDEN);
915                  break;
916              case NOTFOUND:
917                  tgt.setValue(TestScript.AssertionResponseTypes.NOTFOUND);
918                  break;
919              case METHODNOTALLOWED:
920                  tgt.setValue(TestScript.AssertionResponseTypes.METHODNOTALLOWED);
921                  break;
922              case CONFLICT:
923                  tgt.setValue(TestScript.AssertionResponseTypes.CONFLICT);
924                  break;
925              case GONE:
926                  tgt.setValue(TestScript.AssertionResponseTypes.GONE);
927                  break;
928              case PRECONDITIONFAILED:
929                  tgt.setValue(TestScript.AssertionResponseTypes.PRECONDITIONFAILED);
930                  break;
931              case UNPROCESSABLE:
932                  tgt.setValue(TestScript.AssertionResponseTypes.UNPROCESSABLECONTENT);
933                  break;
934              default:
935                  tgt.setValue(TestScript.AssertionResponseTypes.NULL);
936                  break;
937          }
938      }
939      return tgt;
940  }
941
942  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes> convertAssertionResponseTypes(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.TestScript.AssertionResponseTypes> src) throws FHIRException {
943      if (src == null || src.isEmpty())
944          return null;
945      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());
946      ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
947      if (src.getValue() == null) {
948          tgt.setValue(null);
949      } else {
950          switch (src.getValue()) {
951              case OKAY:
952                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY);
953                  break;
954              case CREATED:
955                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED);
956                  break;
957              case NOCONTENT:
958                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT);
959                  break;
960              case NOTMODIFIED:
961                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED);
962                  break;
963              case BADREQUEST:
964                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD);
965                  break;
966              case FORBIDDEN:
967                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN);
968                  break;
969              case NOTFOUND:
970                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND);
971                  break;
972              case METHODNOTALLOWED:
973                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED);
974                  break;
975              case CONFLICT:
976                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT);
977                  break;
978              case GONE:
979                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE);
980                  break;
981              case PRECONDITIONFAILED:
982                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED);
983                  break;
984              case UNPROCESSABLECONTENT:
985                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE);
986                  break;
987              default:
988                  tgt.setValue(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL);
989                  break;
990          }
991      }
992      return tgt;
993  }
994
995  public static org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException {
996    if (src == null)
997      return null;
998    org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent();
999    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1000    if (src.hasName())
1001      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
1002    if (src.hasDescription())
1003      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
1004    for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction())
1005      tgt.addAction(convertTestActionComponent(t));
1006    return tgt;
1007  }
1008
1009  public static org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTestComponent src) throws FHIRException {
1010    if (src == null)
1011      return null;
1012    org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent();
1013    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1014    if (src.hasName())
1015      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
1016    if (src.hasDescription())
1017      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
1018    for (org.hl7.fhir.r5.model.TestScript.TestActionComponent t : src.getAction())
1019      tgt.addAction(convertTestActionComponent(t));
1020    return tgt;
1021  }
1022
1023  public static org.hl7.fhir.r5.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException {
1024    if (src == null)
1025      return null;
1026    org.hl7.fhir.r5.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestActionComponent();
1027    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1028    if (src.hasOperation())
1029      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
1030    if (src.hasAssert())
1031      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
1032    return tgt;
1033  }
1034
1035  public static org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.r5.model.TestScript.TestActionComponent src) throws FHIRException {
1036    if (src == null)
1037      return null;
1038    org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent();
1039    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1040    if (src.hasOperation())
1041      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
1042    if (src.hasAssert())
1043      tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
1044    return tgt;
1045  }
1046
1047  public static org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
1048    if (src == null)
1049      return null;
1050    org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent();
1051    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1052    for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction())
1053      tgt.addAction(convertTeardownActionComponent(t));
1054    return tgt;
1055  }
1056
1057  public static org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r5.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
1058    if (src == null)
1059      return null;
1060    org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent();
1061    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1062    for (org.hl7.fhir.r5.model.TestScript.TeardownActionComponent t : src.getAction())
1063      tgt.addAction(convertTeardownActionComponent(t));
1064    return tgt;
1065  }
1066
1067  public static org.hl7.fhir.r5.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException {
1068    if (src == null)
1069      return null;
1070    org.hl7.fhir.r5.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r5.model.TestScript.TeardownActionComponent();
1071    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1072    if (src.hasOperation())
1073      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
1074    return tgt;
1075  }
1076
1077  public static org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r5.model.TestScript.TeardownActionComponent src) throws FHIRException {
1078    if (src == null)
1079      return null;
1080    org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent();
1081    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
1082    if (src.hasOperation())
1083      tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
1084    return tgt;
1085  }
1086}