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.Identifier40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
010import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
011import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
012import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
013import org.hl7.fhir.exceptions.FHIRException;
014import org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType;
015
016/*
017  Copyright (c) 2011+, HL7, Inc.
018  All rights reserved.
019  
020  Redistribution and use in source and binary forms, with or without modification, 
021  are permitted provided that the following conditions are met:
022  
023   * Redistributions of source code must retain the above copyright notice, this 
024     list of conditions and the following disclaimer.
025   * Redistributions in binary form must reproduce the above copyright notice, 
026     this list of conditions and the following disclaimer in the documentation 
027     and/or other materials provided with the distribution.
028   * Neither the name of HL7 nor the names of its contributors may be used to 
029     endorse or promote products derived from this software without specific 
030     prior written permission.
031  
032  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
033  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
034  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
035  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
036  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
037  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
038  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
039  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
040  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
041  POSSIBILITY OF SUCH DAMAGE.
042  
043*/
044// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
045public class ExampleScenario40_50 {
046
047  public static org.hl7.fhir.r5.model.ExampleScenario convertExampleScenario(org.hl7.fhir.r4.model.ExampleScenario src) throws FHIRException {
048    if (src == null)
049      return null;
050    org.hl7.fhir.r5.model.ExampleScenario tgt = new org.hl7.fhir.r5.model.ExampleScenario();
051    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
052    if (src.hasUrl())
053      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
054    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
055      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
056    if (src.hasVersion())
057      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
058    if (src.hasName())
059      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
060    if (src.hasStatus())
061      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
062    if (src.hasExperimental())
063      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
064    if (src.hasDate())
065      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
066    if (src.hasPublisher())
067      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
068    for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
069      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
070    for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
071      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
072    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
073      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
074    if (src.hasCopyright())
075      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
076    if (src.hasPurpose())
077      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
078    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent t : src.getActor())
079      tgt.addActor(convertExampleScenarioActorComponent(t));
080    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent t : src.getInstance())
081      tgt.addInstance(convertExampleScenarioInstanceComponent(t));
082    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess())
083      tgt.addProcess(convertExampleScenarioProcessComponent(t));
084//    for (org.hl7.fhir.r4.model.CanonicalType t : src.getWorkflow())
085//      tgt.getWorkflow().add(Canonical40_50.convertCanonical(t));
086    return tgt;
087  }
088
089  public static org.hl7.fhir.r4.model.ExampleScenario convertExampleScenario(org.hl7.fhir.r5.model.ExampleScenario src) throws FHIRException {
090    if (src == null)
091      return null;
092    org.hl7.fhir.r4.model.ExampleScenario tgt = new org.hl7.fhir.r4.model.ExampleScenario();
093    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
094    if (src.hasUrl())
095      tgt.setUrlElement(Uri40_50.convertUri(src.getUrlElement()));
096    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
097      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
098    if (src.hasVersion())
099      tgt.setVersionElement(String40_50.convertString(src.getVersionElement()));
100    if (src.hasName())
101      tgt.setNameElement(String40_50.convertString(src.getNameElement()));
102    if (src.hasStatus())
103      tgt.setStatusElement(Enumerations40_50.convertPublicationStatus(src.getStatusElement()));
104    if (src.hasExperimental())
105      tgt.setExperimentalElement(Boolean40_50.convertBoolean(src.getExperimentalElement()));
106    if (src.hasDate())
107      tgt.setDateElement(DateTime40_50.convertDateTime(src.getDateElement()));
108    if (src.hasPublisher())
109      tgt.setPublisherElement(String40_50.convertString(src.getPublisherElement()));
110    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
111      tgt.addContact(ContactDetail40_50.convertContactDetail(t));
112    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
113      tgt.addUseContext(UsageContext40_50.convertUsageContext(t));
114    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
115      tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept(t));
116    if (src.hasCopyright())
117      tgt.setCopyrightElement(MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
118    if (src.hasPurpose())
119      tgt.setPurposeElement(MarkDown40_50.convertMarkdown(src.getPurposeElement()));
120    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent t : src.getActor())
121      tgt.addActor(convertExampleScenarioActorComponent(t));
122    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent t : src.getInstance())
123      tgt.addInstance(convertExampleScenarioInstanceComponent(t));
124    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess())
125      tgt.addProcess(convertExampleScenarioProcessComponent(t));
126//    for (org.hl7.fhir.r5.model.CanonicalType t : src.getWorkflow())
127//      tgt.getWorkflow().add(Canonical40_50.convertCanonical(t));
128    return tgt;
129  }
130
131  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent convertExampleScenarioActorComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent src) throws FHIRException {
132    if (src == null)
133      return null;
134    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent();
135    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
136    if (src.hasActorId())
137      tgt.setKeyElement(String40_50.convertString(src.getActorIdElement()));
138    if (src.hasType())
139      tgt.setTypeElement(convertExampleScenarioActorType(src.getTypeElement()));
140    if (src.hasName())
141      tgt.setTitleElement(String40_50.convertString(src.getNameElement()));
142    if (src.hasDescription())
143      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
144    return tgt;
145  }
146
147  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent convertExampleScenarioActorComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioActorComponent src) throws FHIRException {
148    if (src == null)
149      return null;
150    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorComponent();
151    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
152    if (src.hasKey())
153      tgt.setActorIdElement(String40_50.convertString(src.getKeyElement()));
154    if (src.hasType())
155      tgt.setTypeElement(convertExampleScenarioActorType(src.getTypeElement()));
156    if (src.hasTitle())
157      tgt.setNameElement(String40_50.convertString(src.getTitleElement()));
158    if (src.hasDescription())
159      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
160    return tgt;
161  }
162
163  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType> convertExampleScenarioActorType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType> src) throws FHIRException {
164    if (src == null || src.isEmpty())
165      return null;
166    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorTypeEnumFactory());
167    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
168    switch (src.getValue()) {
169      case PERSON:
170        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType.PERSON);
171        break;
172      case ENTITY:
173        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType.SYSTEM);
174        break;
175      default:
176        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType.NULL);
177        break;
178    }
179    return tgt;
180  }
181
182  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType> convertExampleScenarioActorType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType> src) throws FHIRException {
183    if (src == null || src.isEmpty())
184      return null;
185    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorTypeEnumFactory());
186    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
187    switch (src.getValue()) {
188      case PERSON:
189        tgt.setValue(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.PERSON);
190        break;
191      case SYSTEM:
192        tgt.setValue(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.ENTITY);
193        break;
194      default:
195        tgt.setValue(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioActorType.NULL);
196        break;
197    }
198    return tgt;
199  }
200
201  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent convertExampleScenarioInstanceComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent src) throws FHIRException {
202    if (src == null)
203      return null;
204    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent();
205    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
206    if (src.hasResourceId())
207      tgt.setKeyElement(String40_50.convertString(src.getResourceIdElement()));
208    if (src.hasResourceType())
209      tgt.getStructureType().setCode(src.getResourceType().toCode());
210    if (src.hasName())
211      tgt.setTitleElement(String40_50.convertString(src.getNameElement()));
212    if (src.hasDescription())
213      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
214    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent t : src.getVersion())
215      tgt.addVersion(convertExampleScenarioInstanceVersionComponent(t));
216    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent t : src.getContainedInstance())
217      tgt.addContainedInstance(convertExampleScenarioInstanceContainedInstanceComponent(t));
218    return tgt;
219  }
220
221  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent convertExampleScenarioInstanceComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceComponent src) throws FHIRException {
222    if (src == null)
223      return null;
224    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceComponent();
225    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
226    if (src.hasKey())
227      tgt.setResourceIdElement(String40_50.convertString(src.getKeyElement()));
228    if (src.hasType())
229      tgt.setResourceType(FHIRResourceType.fromCode(src.getStructureType().getCode()));
230    if (src.hasTitle())
231      tgt.setNameElement(String40_50.convertString(src.getTitleElement()));
232    if (src.hasDescription())
233      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
234    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent t : src.getVersion())
235      tgt.addVersion(convertExampleScenarioInstanceVersionComponent(t));
236    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent t : src.getContainedInstance())
237      tgt.addContainedInstance(convertExampleScenarioInstanceContainedInstanceComponent(t));
238    return tgt;
239  }
240
241  public static org.hl7.fhir.r5.model.CodeType convertFHIRResourceType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType> src) throws FHIRException {
242    if (src == null)
243      return null;
244    org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.asStringValue());
245    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
246    return tgt;
247  }
248
249  public static org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType> convertFHIRResourceType(org.hl7.fhir.r5.model.CodeType src) throws FHIRException {
250    if (src == null)
251      return null;
252    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType> tgt = new org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceType>(new org.hl7.fhir.r4.model.ExampleScenario.FHIRResourceTypeEnumFactory(), src.getCode());
253    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
254    return tgt;
255  }
256
257  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent convertExampleScenarioInstanceVersionComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent src) throws FHIRException {
258    if (src == null)
259      return null;
260    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent();
261    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
262    if (src.hasVersionId())
263      tgt.setKeyElement(String40_50.convertString(src.getVersionIdElement()));
264    if (src.hasDescription())
265      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
266    return tgt;
267  }
268
269  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent convertExampleScenarioInstanceVersionComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceVersionComponent src) throws FHIRException {
270    if (src == null)
271      return null;
272    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceVersionComponent();
273    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
274    if (src.hasKey())
275      tgt.setVersionIdElement(String40_50.convertString(src.getKeyElement()));
276    if (src.hasDescription())
277      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
278    return tgt;
279  }
280
281  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent convertExampleScenarioInstanceContainedInstanceComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent src) throws FHIRException {
282    if (src == null)
283      return null;
284    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
285    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
286    if (src.hasResourceId())
287      tgt.setInstanceReferenceElement(String40_50.convertString(src.getResourceIdElement()));
288    if (src.hasVersionId())
289      tgt.setVersionReferenceElement(String40_50.convertString(src.getVersionIdElement()));
290    return tgt;
291  }
292
293  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent convertExampleScenarioInstanceContainedInstanceComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent src) throws FHIRException {
294    if (src == null)
295      return null;
296    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
297    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
298    if (src.hasInstanceReference())
299      tgt.setResourceIdElement(String40_50.convertString(src.getInstanceReferenceElement()));
300    if (src.hasVersionReference())
301      tgt.setVersionIdElement(String40_50.convertString(src.getVersionReferenceElement()));
302    return tgt;
303  }
304
305  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent convertExampleScenarioProcessComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent src) throws FHIRException {
306    if (src == null)
307      return null;
308    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent();
309    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
310    if (src.hasTitle())
311      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
312    if (src.hasDescription())
313      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
314    if (src.hasPreConditions())
315      tgt.setPreConditionsElement(MarkDown40_50.convertMarkdown(src.getPreConditionsElement()));
316    if (src.hasPostConditions())
317      tgt.setPostConditionsElement(MarkDown40_50.convertMarkdown(src.getPostConditionsElement()));
318    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep())
319      tgt.addStep(convertExampleScenarioProcessStepComponent(t));
320    return tgt;
321  }
322
323  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent convertExampleScenarioProcessComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessComponent src) throws FHIRException {
324    if (src == null)
325      return null;
326    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent();
327    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
328    if (src.hasTitle())
329      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
330    if (src.hasDescription())
331      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
332    if (src.hasPreConditions())
333      tgt.setPreConditionsElement(MarkDown40_50.convertMarkdown(src.getPreConditionsElement()));
334    if (src.hasPostConditions())
335      tgt.setPostConditionsElement(MarkDown40_50.convertMarkdown(src.getPostConditionsElement()));
336    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep())
337      tgt.addStep(convertExampleScenarioProcessStepComponent(t));
338    return tgt;
339  }
340
341  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent convertExampleScenarioProcessStepComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent src) throws FHIRException {
342    if (src == null)
343      return null;
344    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent();
345    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
346    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessComponent t : src.getProcess())
347      tgt.setProcess(convertExampleScenarioProcessComponent(t));
348    if (src.hasPause())
349      tgt.setPauseElement(Boolean40_50.convertBoolean(src.getPauseElement()));
350    if (src.hasOperation())
351      tgt.setOperation(convertExampleScenarioProcessStepOperationComponent(src.getOperation()));
352    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent t : src.getAlternative())
353      tgt.addAlternative(convertExampleScenarioProcessStepAlternativeComponent(t));
354    return tgt;
355  }
356
357  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent convertExampleScenarioProcessStepComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent src) throws FHIRException {
358    if (src == null)
359      return null;
360    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent();
361    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
362    tgt.addProcess(convertExampleScenarioProcessComponent(src.getProcess()));
363    if (src.hasPause())
364      tgt.setPauseElement(Boolean40_50.convertBoolean(src.getPauseElement()));
365    if (src.hasOperation())
366      tgt.setOperation(convertExampleScenarioProcessStepOperationComponent(src.getOperation()));
367    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent t : src.getAlternative())
368      tgt.addAlternative(convertExampleScenarioProcessStepAlternativeComponent(t));
369    return tgt;
370  }
371
372  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent convertExampleScenarioProcessStepOperationComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent src) throws FHIRException {
373    if (src == null)
374      return null;
375    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent();
376    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
377//    if (src.hasNumber())
378//      tgt.setNumberElement(String40_50.convertString(src.getNumberElement()));
379    if (src.hasType())
380      tgt.getType().setCode(src.getType());
381    if (src.hasName())
382      tgt.setTitleElement(String40_50.convertString(src.getNameElement()));
383    if (src.hasInitiator())
384      tgt.setInitiatorElement(String40_50.convertString(src.getInitiatorElement()));
385    if (src.hasReceiver())
386      tgt.setReceiverElement(String40_50.convertString(src.getReceiverElement()));
387    if (src.hasDescription())
388      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
389    if (src.hasInitiatorActive())
390      tgt.setInitiatorActiveElement(Boolean40_50.convertBoolean(src.getInitiatorActiveElement()));
391    if (src.hasReceiverActive())
392      tgt.setReceiverActiveElement(Boolean40_50.convertBoolean(src.getReceiverActiveElement()));
393    if (src.hasRequest())
394      tgt.setRequest(convertExampleScenarioInstanceContainedInstanceComponent(src.getRequest()));
395    if (src.hasResponse())
396      tgt.setResponse(convertExampleScenarioInstanceContainedInstanceComponent(src.getResponse()));
397    return tgt;
398  }
399
400  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent convertExampleScenarioProcessStepOperationComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent src) throws FHIRException {
401    if (src == null)
402      return null;
403    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepOperationComponent();
404    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
405//    if (src.hasNumber())
406//      tgt.setNumberElement(String40_50.convertString(src.getNumberElement()));
407    if (src.hasType())
408      tgt.setType(src.getType().getCode());
409    if (src.hasTitle())
410      tgt.setNameElement(String40_50.convertString(src.getTitleElement()));
411    if (src.hasInitiator())
412      tgt.setInitiatorElement(String40_50.convertString(src.getInitiatorElement()));
413    if (src.hasReceiver())
414      tgt.setReceiverElement(String40_50.convertString(src.getReceiverElement()));
415    if (src.hasDescription())
416      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
417    if (src.hasInitiatorActive())
418      tgt.setInitiatorActiveElement(Boolean40_50.convertBoolean(src.getInitiatorActiveElement()));
419    if (src.hasReceiverActive())
420      tgt.setReceiverActiveElement(Boolean40_50.convertBoolean(src.getReceiverActiveElement()));
421    if (src.hasRequest())
422      tgt.setRequest(convertExampleScenarioInstanceContainedInstanceComponent(src.getRequest()));
423    if (src.hasResponse())
424      tgt.setResponse(convertExampleScenarioInstanceContainedInstanceComponent(src.getResponse()));
425    return tgt;
426  }
427
428  public static org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent convertExampleScenarioProcessStepAlternativeComponent(org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent src) throws FHIRException {
429    if (src == null)
430      return null;
431    org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent tgt = new org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
432    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
433    if (src.hasTitle())
434      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
435    if (src.hasDescription())
436      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
437    for (org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep())
438      tgt.addStep(convertExampleScenarioProcessStepComponent(t));
439    return tgt;
440  }
441
442  public static org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent convertExampleScenarioProcessStepAlternativeComponent(org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent src) throws FHIRException {
443    if (src == null)
444      return null;
445    org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent tgt = new org.hl7.fhir.r4.model.ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
446    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyBackboneElement(src, tgt);
447    if (src.hasTitle())
448      tgt.setTitleElement(String40_50.convertString(src.getTitleElement()));
449    if (src.hasDescription())
450      tgt.setDescriptionElement(MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
451    for (org.hl7.fhir.r5.model.ExampleScenario.ExampleScenarioProcessStepComponent t : src.getStep())
452      tgt.addStep(convertExampleScenarioProcessStepComponent(t));
453    return tgt;
454  }
455}