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