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