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.Duration43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Period43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.DataRequirement43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.Expression43_50;
011import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.RelatedArtifact43_50;
012import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.TriggerDefinition43_50;
013import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
014import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
015import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
016import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Date43_50;
017import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
018import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Id43_50;
019import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
020import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
021import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
022import org.hl7.fhir.exceptions.FHIRException;
023import org.hl7.fhir.r5.model.DataRequirement;
024import org.hl7.fhir.r5.model.Enumeration;
025import org.hl7.fhir.r5.model.Enumerations;
026import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionInputComponent;
027import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionOutputComponent;
028
029/*
030  Copyright (c) 2011+, HL7, Inc.
031  All rights reserved.
032  
033  Redistribution and use in source and binary forms, with or without modification, 
034  are permitted provided that the following conditions are met:
035  
036   * Redistributions of source code must retain the above copyright notice, this 
037     list of conditions and the following disclaimer.
038   * Redistributions in binary form must reproduce the above copyright notice, 
039     this list of conditions and the following disclaimer in the documentation 
040     and/or other materials provided with the distribution.
041   * Neither the name of HL7 nor the names of its contributors may be used to 
042     endorse or promote products derived from this software without specific 
043     prior written permission.
044  
045  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
046  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
047  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
048  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
049  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
050  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
051  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
052  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
053  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
054  POSSIBILITY OF SUCH DAMAGE.
055  
056*/
057// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
058public class PlanDefinition43_50 {
059
060  public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r4b.model.PlanDefinition src) throws FHIRException {
061    if (src == null)
062      return null;
063    org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition();
064    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
065    if (src.hasUrl())
066      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
067    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
068      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
069    if (src.hasVersion())
070      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
071    if (src.hasName())
072      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
073    if (src.hasTitle())
074      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
075    if (src.hasSubtitle())
076      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
077    if (src.hasType())
078      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
079    if (src.hasStatus())
080      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
081    if (src.hasExperimental())
082      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
083    if (src.hasSubject())
084      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
085    if (src.hasDate())
086      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
087    if (src.hasPublisher())
088      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
089    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getContact())
090      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
091    if (src.hasDescription())
092      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
093    for (org.hl7.fhir.r4b.model.UsageContext t : src.getUseContext())
094      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
095    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getJurisdiction())
096      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
097    if (src.hasPurpose())
098      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
099    if (src.hasUsage())
100      tgt.setUsageElement(String43_50.convertStringToMarkdown(src.getUsageElement()));
101    if (src.hasCopyright())
102      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
103    if (src.hasApprovalDate())
104      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
105    if (src.hasLastReviewDate())
106      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
107    if (src.hasEffectivePeriod())
108      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
109    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getTopic())
110      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
111    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getAuthor())
112      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
113    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEditor())
114      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
115    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getReviewer())
116      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
117    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEndorser())
118      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
119    for (org.hl7.fhir.r4b.model.RelatedArtifact t : src.getRelatedArtifact())
120      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
121    for (org.hl7.fhir.r4b.model.CanonicalType t : src.getLibrary())
122      tgt.getLibrary().add(Canonical43_50.convertCanonical(t));
123    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal())
124      tgt.addGoal(convertPlanDefinitionGoalComponent(t));
125    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
126      tgt.addAction(convertPlanDefinitionActionComponent(t));
127    return tgt;
128  }
129
130  public static org.hl7.fhir.r4b.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException {
131    if (src == null)
132      return null;
133    org.hl7.fhir.r4b.model.PlanDefinition tgt = new org.hl7.fhir.r4b.model.PlanDefinition();
134    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
135    if (src.hasUrl())
136      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
137    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
138      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
139    if (src.hasVersion())
140      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
141    if (src.hasName())
142      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
143    if (src.hasTitle())
144      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
145    if (src.hasSubtitle())
146      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
147    if (src.hasType())
148      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
149    if (src.hasStatus())
150      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
151    if (src.hasExperimental())
152      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
153    if (src.hasSubject())
154      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
155    if (src.hasDate())
156      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
157    if (src.hasPublisher())
158      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
159    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
160      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
161    if (src.hasDescription())
162      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
163    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
164      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
165    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
166      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
167    if (src.hasPurpose())
168      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
169    if (src.hasUsage())
170      tgt.setUsageElement(String43_50.convertString(src.getUsageElement()));
171    if (src.hasCopyright())
172      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
173    if (src.hasApprovalDate())
174      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
175    if (src.hasLastReviewDate())
176      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
177    if (src.hasEffectivePeriod())
178      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
179    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic())
180      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
181    for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor())
182      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
183    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor())
184      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
185    for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer())
186      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
187    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser())
188      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
189    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact())
190      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
191    for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary())
192      tgt.getLibrary().add(Canonical43_50.convertCanonical(t));
193    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal())
194      tgt.addGoal(convertPlanDefinitionGoalComponent(t));
195    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
196      tgt.addAction(convertPlanDefinitionActionComponent(t));
197    return tgt;
198  }
199
200  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException {
201    if (src == null)
202      return null;
203    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent();
204    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
205    if (src.hasCategory())
206      tgt.setCategory(CodeableConcept43_50.convertCodeableConcept(src.getCategory()));
207    if (src.hasDescription())
208      tgt.setDescription(CodeableConcept43_50.convertCodeableConcept(src.getDescription()));
209    if (src.hasPriority())
210      tgt.setPriority(CodeableConcept43_50.convertCodeableConcept(src.getPriority()));
211    if (src.hasStart())
212      tgt.setStart(CodeableConcept43_50.convertCodeableConcept(src.getStart()));
213    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getAddresses())
214      tgt.addAddresses(CodeableConcept43_50.convertCodeableConcept(t));
215    for (org.hl7.fhir.r4b.model.RelatedArtifact t : src.getDocumentation())
216      tgt.addDocumentation(RelatedArtifact43_50.convertRelatedArtifact(t));
217    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget())
218      tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t));
219    return tgt;
220  }
221
222  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException {
223    if (src == null)
224      return null;
225    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalComponent();
226    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
227    if (src.hasCategory())
228      tgt.setCategory(CodeableConcept43_50.convertCodeableConcept(src.getCategory()));
229    if (src.hasDescription())
230      tgt.setDescription(CodeableConcept43_50.convertCodeableConcept(src.getDescription()));
231    if (src.hasPriority())
232      tgt.setPriority(CodeableConcept43_50.convertCodeableConcept(src.getPriority()));
233    if (src.hasStart())
234      tgt.setStart(CodeableConcept43_50.convertCodeableConcept(src.getStart()));
235    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses())
236      tgt.addAddresses(CodeableConcept43_50.convertCodeableConcept(t));
237    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation())
238      tgt.addDocumentation(RelatedArtifact43_50.convertRelatedArtifact(t));
239    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget())
240      tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t));
241    return tgt;
242  }
243
244  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException {
245    if (src == null)
246      return null;
247    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent();
248    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
249    if (src.hasMeasure())
250      tgt.setMeasure(CodeableConcept43_50.convertCodeableConcept(src.getMeasure()));
251    if (src.hasDetail())
252      tgt.setDetail(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDetail()));
253    if (src.hasDue())
254      tgt.setDue(Duration43_50.convertDuration(src.getDue()));
255    return tgt;
256  }
257
258  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException {
259    if (src == null)
260      return null;
261    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionGoalTargetComponent();
262    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
263    if (src.hasMeasure())
264      tgt.setMeasure(CodeableConcept43_50.convertCodeableConcept(src.getMeasure()));
265    if (src.hasDetail())
266      tgt.setDetail(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDetail()));
267    if (src.hasDue())
268      tgt.setDue(Duration43_50.convertDuration(src.getDue()));
269    return tgt;
270  }
271
272  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
273    if (src == null)
274      return null;
275    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent();
276    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
277    if (src.hasPrefix())
278      tgt.setPrefixElement(String43_50.convertString(src.getPrefixElement()));
279    if (src.hasTitle())
280      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
281    if (src.hasDescription())
282      tgt.setDescriptionElement(String43_50.convertStringToMarkdown(src.getDescriptionElement()));
283    if (src.hasTextEquivalent())
284      tgt.setTextEquivalentElement(String43_50.convertStringToMarkdown(src.getTextEquivalentElement()));
285    if (src.hasPriority())
286      tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
287    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCode())
288      tgt.setCode(CodeableConcept43_50.convertCodeableConcept(t));
289    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getReason())
290      tgt.addReason(CodeableConcept43_50.convertCodeableConcept(t));
291    for (org.hl7.fhir.r4b.model.RelatedArtifact t : src.getDocumentation())
292      tgt.addDocumentation(RelatedArtifact43_50.convertRelatedArtifact(t));
293    for (org.hl7.fhir.r4b.model.IdType t : src.getGoalId()) tgt.getGoalId().add(Id43_50.convertId(t));
294    if (src.hasSubject())
295      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
296    for (org.hl7.fhir.r4b.model.TriggerDefinition t : src.getTrigger())
297      tgt.addTrigger(TriggerDefinition43_50.convertTriggerDefinition(t));
298    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition())
299      tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
300    for (org.hl7.fhir.r4b.model.DataRequirement t : src.getInput())
301      tgt.addInput(wrapInput(DataRequirement43_50.convertDataRequirement(t)));
302    for (org.hl7.fhir.r4b.model.DataRequirement t : src.getOutput())
303      tgt.addOutput(wrapOutput(DataRequirement43_50.convertDataRequirement(t)));
304    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction())
305      tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
306    if (src.hasTiming())
307      tgt.setTiming(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTiming()));
308    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant())
309      tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t));
310    if (src.hasType())
311      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
312    if (src.hasGroupingBehavior())
313      tgt.setGroupingBehaviorElement(convertActionGroupingBehavior(src.getGroupingBehaviorElement()));
314    if (src.hasSelectionBehavior())
315      tgt.setSelectionBehaviorElement(convertActionSelectionBehavior(src.getSelectionBehaviorElement()));
316    if (src.hasRequiredBehavior())
317      tgt.setRequiredBehaviorElement(convertActionRequiredBehavior(src.getRequiredBehaviorElement()));
318    if (src.hasPrecheckBehavior())
319      tgt.setPrecheckBehaviorElement(convertActionPrecheckBehavior(src.getPrecheckBehaviorElement()));
320    if (src.hasCardinalityBehavior())
321      tgt.setCardinalityBehaviorElement(convertActionCardinalityBehavior(src.getCardinalityBehaviorElement()));
322    if (src.hasDefinition())
323      tgt.setDefinition(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDefinition()));
324    if (src.hasTransform())
325      tgt.setTransformElement(Canonical43_50.convertCanonical(src.getTransformElement()));
326    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue())
327      tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t));
328    for (org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
329      tgt.addAction(convertPlanDefinitionActionComponent(t));
330    return tgt;
331  }
332
333  private static PlanDefinitionActionOutputComponent wrapOutput(DataRequirement dr) {
334    return new PlanDefinitionActionOutputComponent().setRequirement(dr);
335  }
336
337  private static PlanDefinitionActionInputComponent wrapInput(DataRequirement dr) {
338    return new PlanDefinitionActionInputComponent().setRequirement(dr);
339  }
340
341  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
342    if (src == null)
343      return null;
344    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionComponent();
345    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
346    if (src.hasPrefix())
347      tgt.setPrefixElement(String43_50.convertString(src.getPrefixElement()));
348    if (src.hasTitle())
349      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
350    if (src.hasDescription())
351      tgt.setDescriptionElement(String43_50.convertString(src.getDescriptionElement()));
352    if (src.hasTextEquivalent())
353      tgt.setTextEquivalentElement(String43_50.convertString(src.getTextEquivalentElement()));
354    if (src.hasPriority())
355      tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
356    if (src.hasCode()) tgt.addCode(CodeableConcept43_50.convertCodeableConcept(src.getCode()));
357    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason())
358      tgt.addReason(CodeableConcept43_50.convertCodeableConcept(t));
359    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation())
360      tgt.addDocumentation(RelatedArtifact43_50.convertRelatedArtifact(t));
361    for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) tgt.getGoalId().add(Id43_50.convertId(t));
362    if (src.hasSubject())
363      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
364    for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger())
365      tgt.addTrigger(TriggerDefinition43_50.convertTriggerDefinition(t));
366    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition())
367      tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
368    for (PlanDefinitionActionInputComponent t : src.getInput())
369      tgt.addInput(DataRequirement43_50.convertDataRequirement(t.getRequirement()));
370    for (PlanDefinitionActionOutputComponent t : src.getOutput())
371      tgt.addOutput(DataRequirement43_50.convertDataRequirement(t.getRequirement()));
372    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction())
373      tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
374    if (src.hasTiming())
375      tgt.setTiming(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTiming()));
376    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant())
377      tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t));
378    if (src.hasType())
379      tgt.setType(CodeableConcept43_50.convertCodeableConcept(src.getType()));
380    if (src.hasGroupingBehavior())
381      tgt.setGroupingBehaviorElement(convertActionGroupingBehavior(src.getGroupingBehaviorElement()));
382    if (src.hasSelectionBehavior())
383      tgt.setSelectionBehaviorElement(convertActionSelectionBehavior(src.getSelectionBehaviorElement()));
384    if (src.hasRequiredBehavior())
385      tgt.setRequiredBehaviorElement(convertActionRequiredBehavior(src.getRequiredBehaviorElement()));
386    if (src.hasPrecheckBehavior())
387      tgt.setPrecheckBehaviorElement(convertActionPrecheckBehavior(src.getPrecheckBehaviorElement()));
388    if (src.hasCardinalityBehavior())
389      tgt.setCardinalityBehaviorElement(convertActionCardinalityBehavior(src.getCardinalityBehaviorElement()));
390    if (src.hasDefinition())
391      tgt.setDefinition(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getDefinition()));
392    if (src.hasTransform())
393      tgt.setTransformElement(Canonical43_50.convertCanonical(src.getTransformElement()));
394    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue())
395      tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t));
396    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
397      tgt.addAction(convertPlanDefinitionActionComponent(t));
398    return tgt;
399  }
400
401  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> convertRequestPriority(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> src) throws FHIRException {
402      if (src == null || src.isEmpty())
403          return null;
404      Enumeration<Enumerations.RequestPriority> tgt = new Enumeration<>(new Enumerations.RequestPriorityEnumFactory());
405      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
406      if (src.getValue() == null) {
407          tgt.setValue(null);
408      } else {
409          switch (src.getValue()) {
410              case ROUTINE:
411                  tgt.setValue(Enumerations.RequestPriority.ROUTINE);
412                  break;
413              case URGENT:
414                  tgt.setValue(Enumerations.RequestPriority.URGENT);
415                  break;
416              case ASAP:
417                  tgt.setValue(Enumerations.RequestPriority.ASAP);
418                  break;
419              case STAT:
420                  tgt.setValue(Enumerations.RequestPriority.STAT);
421                  break;
422              default:
423                  tgt.setValue(Enumerations.RequestPriority.NULL);
424                  break;
425          }
426      }
427      return tgt;
428  }
429
430  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> convertRequestPriority(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> src) throws FHIRException {
431      if (src == null || src.isEmpty())
432          return null;
433      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestPriority> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.RequestPriorityEnumFactory());
434      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
435      if (src.getValue() == null) {
436          tgt.setValue(null);
437      } else {
438          switch (src.getValue()) {
439              case ROUTINE:
440                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ROUTINE);
441                  break;
442              case URGENT:
443                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.URGENT);
444                  break;
445              case ASAP:
446                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ASAP);
447                  break;
448              case STAT:
449                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.STAT);
450                  break;
451              default:
452                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.NULL);
453                  break;
454          }
455      }
456      return tgt;
457  }
458
459  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior> convertActionGroupingBehavior(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior> src) throws FHIRException {
460      if (src == null || src.isEmpty())
461          return null;
462      Enumeration<Enumerations.ActionGroupingBehavior> tgt = new Enumeration<>(new Enumerations.ActionGroupingBehaviorEnumFactory());
463      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
464      if (src.getValue() == null) {
465          tgt.setValue(null);
466      } else {
467          switch (src.getValue()) {
468              case VISUALGROUP:
469                  tgt.setValue(Enumerations.ActionGroupingBehavior.VISUALGROUP);
470                  break;
471              case LOGICALGROUP:
472                  tgt.setValue(Enumerations.ActionGroupingBehavior.LOGICALGROUP);
473                  break;
474              case SENTENCEGROUP:
475                  tgt.setValue(Enumerations.ActionGroupingBehavior.SENTENCEGROUP);
476                  break;
477              default:
478                  tgt.setValue(Enumerations.ActionGroupingBehavior.NULL);
479                  break;
480          }
481      }
482      return tgt;
483  }
484
485  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior> convertActionGroupingBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior> src) throws FHIRException {
486      if (src == null || src.isEmpty())
487          return null;
488      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehaviorEnumFactory());
489      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
490      if (src.getValue() == null) {
491          tgt.setValue(null);
492      } else {
493          switch (src.getValue()) {
494              case VISUALGROUP:
495                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior.VISUALGROUP);
496                  break;
497              case LOGICALGROUP:
498                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior.LOGICALGROUP);
499                  break;
500              case SENTENCEGROUP:
501                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior.SENTENCEGROUP);
502                  break;
503              default:
504                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionGroupingBehavior.NULL);
505                  break;
506          }
507      }
508      return tgt;
509  }
510
511  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior> convertActionSelectionBehavior(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior> src) throws FHIRException {
512      if (src == null || src.isEmpty())
513          return null;
514      Enumeration<Enumerations.ActionSelectionBehavior> tgt = new Enumeration<>(new Enumerations.ActionSelectionBehaviorEnumFactory());
515      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
516      if (src.getValue() == null) {
517          tgt.setValue(null);
518      } else {
519          switch (src.getValue()) {
520              case ANY:
521                  tgt.setValue(Enumerations.ActionSelectionBehavior.ANY);
522                  break;
523              case ALL:
524                  tgt.setValue(Enumerations.ActionSelectionBehavior.ALL);
525                  break;
526              case ALLORNONE:
527                  tgt.setValue(Enumerations.ActionSelectionBehavior.ALLORNONE);
528                  break;
529              case EXACTLYONE:
530                  tgt.setValue(Enumerations.ActionSelectionBehavior.EXACTLYONE);
531                  break;
532              case ATMOSTONE:
533                  tgt.setValue(Enumerations.ActionSelectionBehavior.ATMOSTONE);
534                  break;
535              case ONEORMORE:
536                  tgt.setValue(Enumerations.ActionSelectionBehavior.ONEORMORE);
537                  break;
538              default:
539                  tgt.setValue(Enumerations.ActionSelectionBehavior.NULL);
540                  break;
541          }
542      }
543      return tgt;
544  }
545
546  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior> convertActionSelectionBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior> src) throws FHIRException {
547      if (src == null || src.isEmpty())
548          return null;
549      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehaviorEnumFactory());
550      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
551      if (src.getValue() == null) {
552          tgt.setValue(null);
553      } else {
554          switch (src.getValue()) {
555              case ANY:
556                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.ANY);
557                  break;
558              case ALL:
559                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.ALL);
560                  break;
561              case ALLORNONE:
562                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.ALLORNONE);
563                  break;
564              case EXACTLYONE:
565                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.EXACTLYONE);
566                  break;
567              case ATMOSTONE:
568                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.ATMOSTONE);
569                  break;
570              case ONEORMORE:
571                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.ONEORMORE);
572                  break;
573              default:
574                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionSelectionBehavior.NULL);
575                  break;
576          }
577      }
578      return tgt;
579  }
580
581  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior> src) throws FHIRException {
582      if (src == null || src.isEmpty())
583          return null;
584      Enumeration<Enumerations.ActionRequiredBehavior> tgt = new Enumeration<>(new Enumerations.ActionRequiredBehaviorEnumFactory());
585      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
586      if (src.getValue() == null) {
587          tgt.setValue(null);
588      } else {
589          switch (src.getValue()) {
590              case MUST:
591                  tgt.setValue(Enumerations.ActionRequiredBehavior.MUST);
592                  break;
593              case COULD:
594                  tgt.setValue(Enumerations.ActionRequiredBehavior.COULD);
595                  break;
596              case MUSTUNLESSDOCUMENTED:
597                  tgt.setValue(Enumerations.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
598                  break;
599              default:
600                  tgt.setValue(Enumerations.ActionRequiredBehavior.NULL);
601                  break;
602          }
603      }
604      return tgt;
605  }
606
607  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior> src) throws FHIRException {
608      if (src == null || src.isEmpty())
609          return null;
610      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehaviorEnumFactory());
611      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
612      if (src.getValue() == null) {
613          tgt.setValue(null);
614      } else {
615          switch (src.getValue()) {
616              case MUST:
617                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior.MUST);
618                  break;
619              case COULD:
620                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior.COULD);
621                  break;
622              case MUSTUNLESSDOCUMENTED:
623                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
624                  break;
625              default:
626                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRequiredBehavior.NULL);
627                  break;
628          }
629      }
630      return tgt;
631  }
632
633  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior> convertActionPrecheckBehavior(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior> src) throws FHIRException {
634      if (src == null || src.isEmpty())
635          return null;
636      Enumeration<Enumerations.ActionPrecheckBehavior> tgt = new Enumeration<>(new Enumerations.ActionPrecheckBehaviorEnumFactory());
637      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
638      if (src.getValue() == null) {
639          tgt.setValue(null);
640      } else {
641          switch (src.getValue()) {
642              case YES:
643                  tgt.setValue(Enumerations.ActionPrecheckBehavior.YES);
644                  break;
645              case NO:
646                  tgt.setValue(Enumerations.ActionPrecheckBehavior.NO);
647                  break;
648              default:
649                  tgt.setValue(Enumerations.ActionPrecheckBehavior.NULL);
650                  break;
651          }
652      }
653      return tgt;
654  }
655
656  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior> convertActionPrecheckBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior> src) throws FHIRException {
657      if (src == null || src.isEmpty())
658          return null;
659      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehaviorEnumFactory());
660      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
661      if (src.getValue() == null) {
662          tgt.setValue(null);
663      } else {
664          switch (src.getValue()) {
665              case YES:
666                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior.YES);
667                  break;
668              case NO:
669                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior.NO);
670                  break;
671              default:
672                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionPrecheckBehavior.NULL);
673                  break;
674          }
675      }
676      return tgt;
677  }
678
679  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior> convertActionCardinalityBehavior(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior> src) throws FHIRException {
680      if (src == null || src.isEmpty())
681          return null;
682      Enumeration<Enumerations.ActionCardinalityBehavior> tgt = new Enumeration<>(new Enumerations.ActionCardinalityBehaviorEnumFactory());
683      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
684      if (src.getValue() == null) {
685          tgt.setValue(null);
686      } else {
687          switch (src.getValue()) {
688              case SINGLE:
689                  tgt.setValue(Enumerations.ActionCardinalityBehavior.SINGLE);
690                  break;
691              case MULTIPLE:
692                  tgt.setValue(Enumerations.ActionCardinalityBehavior.MULTIPLE);
693                  break;
694              default:
695                  tgt.setValue(Enumerations.ActionCardinalityBehavior.NULL);
696                  break;
697          }
698      }
699      return tgt;
700  }
701
702  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior> convertActionCardinalityBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior> src) throws FHIRException {
703      if (src == null || src.isEmpty())
704          return null;
705      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehaviorEnumFactory());
706      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
707      if (src.getValue() == null) {
708          tgt.setValue(null);
709      } else {
710          switch (src.getValue()) {
711              case SINGLE:
712                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior.SINGLE);
713                  break;
714              case MULTIPLE:
715                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior.MULTIPLE);
716                  break;
717              default:
718                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionCardinalityBehavior.NULL);
719                  break;
720          }
721      }
722      return tgt;
723  }
724
725  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException {
726    if (src == null)
727      return null;
728    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent();
729    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
730    if (src.hasKind())
731      tgt.setKindElement(convertActionConditionKind(src.getKindElement()));
732    if (src.hasExpression())
733      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
734    return tgt;
735  }
736
737  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException {
738    if (src == null)
739      return null;
740    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionConditionComponent();
741    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
742    if (src.hasKind())
743      tgt.setKindElement(convertActionConditionKind(src.getKindElement()));
744    if (src.hasExpression())
745      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
746    return tgt;
747  }
748
749  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind> src) throws FHIRException {
750      if (src == null || src.isEmpty())
751          return null;
752      Enumeration<Enumerations.ActionConditionKind> tgt = new Enumeration<>(new Enumerations.ActionConditionKindEnumFactory());
753      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
754      if (src.getValue() == null) {
755          tgt.setValue(null);
756      } else {
757          switch (src.getValue()) {
758              case APPLICABILITY:
759                  tgt.setValue(Enumerations.ActionConditionKind.APPLICABILITY);
760                  break;
761              case START:
762                  tgt.setValue(Enumerations.ActionConditionKind.START);
763                  break;
764              case STOP:
765                  tgt.setValue(Enumerations.ActionConditionKind.STOP);
766                  break;
767              default:
768                  tgt.setValue(Enumerations.ActionConditionKind.NULL);
769                  break;
770          }
771      }
772      return tgt;
773  }
774
775  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> src) throws FHIRException {
776      if (src == null || src.isEmpty())
777          return null;
778      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionConditionKindEnumFactory());
779      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
780      if (src.getValue() == null) {
781          tgt.setValue(null);
782      } else {
783          switch (src.getValue()) {
784              case APPLICABILITY:
785                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind.APPLICABILITY);
786                  break;
787              case START:
788                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind.START);
789                  break;
790              case STOP:
791                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind.STOP);
792                  break;
793              default:
794                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionConditionKind.NULL);
795                  break;
796          }
797      }
798      return tgt;
799  }
800
801  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException {
802    if (src == null)
803      return null;
804    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
805    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
806    if (src.hasActionId())
807      tgt.setTargetIdElement(Id43_50.convertId(src.getActionIdElement()));
808    if (src.hasRelationship())
809      tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
810    if (src.hasOffset())
811      tgt.setOffset(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOffset()));
812    return tgt;
813  }
814
815  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException {
816    if (src == null)
817      return null;
818    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
819    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
820    if (src.hasTargetId())
821      tgt.setActionIdElement(Id43_50.convertId(src.getTargetIdElement()));
822    if (src.hasRelationship())
823      tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
824    if (src.hasOffset())
825      tgt.setOffset(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getOffset()));
826    return tgt;
827  }
828
829  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType> convertActionRelationshipType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType> src) throws FHIRException {
830      if (src == null || src.isEmpty())
831          return null;
832      Enumeration<Enumerations.ActionRelationshipType> tgt = new Enumeration<>(new Enumerations.ActionRelationshipTypeEnumFactory());
833      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
834      if (src.getValue() == null) {
835          tgt.setValue(null);
836      } else {
837          switch (src.getValue()) {
838              case BEFORESTART:
839                  tgt.setValue(Enumerations.ActionRelationshipType.BEFORESTART);
840                  break;
841              case BEFORE:
842                  tgt.setValue(Enumerations.ActionRelationshipType.BEFORE);
843                  break;
844              case BEFOREEND:
845                  tgt.setValue(Enumerations.ActionRelationshipType.BEFOREEND);
846                  break;
847              case CONCURRENTWITHSTART:
848                  tgt.setValue(Enumerations.ActionRelationshipType.CONCURRENTWITHSTART);
849                  break;
850              case CONCURRENT:
851                  tgt.setValue(Enumerations.ActionRelationshipType.CONCURRENT);
852                  break;
853              case CONCURRENTWITHEND:
854                  tgt.setValue(Enumerations.ActionRelationshipType.CONCURRENTWITHEND);
855                  break;
856              case AFTERSTART:
857                  tgt.setValue(Enumerations.ActionRelationshipType.AFTERSTART);
858                  break;
859              case AFTER:
860                  tgt.setValue(Enumerations.ActionRelationshipType.AFTER);
861                  break;
862              case AFTEREND:
863                  tgt.setValue(Enumerations.ActionRelationshipType.AFTEREND);
864                  break;
865              default:
866                  tgt.setValue(Enumerations.ActionRelationshipType.NULL);
867                  break;
868          }
869      }
870      return tgt;
871  }
872
873  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType> convertActionRelationshipType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType> src) throws FHIRException {
874      if (src == null || src.isEmpty())
875          return null;
876      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipTypeEnumFactory());
877      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
878      if (src.getValue() == null) {
879          tgt.setValue(null);
880      } else {
881          switch (src.getValue()) {
882              case BEFORESTART:
883                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.BEFORESTART);
884                  break;
885              case BEFORE:
886                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.BEFORE);
887                  break;
888              case BEFOREEND:
889                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.BEFOREEND);
890                  break;
891              case CONCURRENTWITHSTART:
892                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.CONCURRENTWITHSTART);
893                  break;
894              case CONCURRENT:
895                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.CONCURRENT);
896                  break;
897              case CONCURRENTWITHEND:
898                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.CONCURRENTWITHEND);
899                  break;
900              case AFTERSTART:
901                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.AFTERSTART);
902                  break;
903              case AFTER:
904                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.AFTER);
905                  break;
906              case AFTEREND:
907                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.AFTEREND);
908                  break;
909              default:
910                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionRelationshipType.NULL);
911                  break;
912          }
913      }
914      return tgt;
915  }
916
917  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException {
918    if (src == null)
919      return null;
920    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent();
921    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
922    if (src.hasType())
923      tgt.setTypeElement(convertActionParticipantType(src.getTypeElement()));
924    if (src.hasRole())
925      tgt.setRole(CodeableConcept43_50.convertCodeableConcept(src.getRole()));
926    return tgt;
927  }
928
929  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException {
930    if (src == null)
931      return null;
932    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionParticipantComponent();
933    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
934    if (src.hasType())
935      tgt.setTypeElement(convertActionParticipantType(src.getTypeElement()));
936    if (src.hasRole())
937      tgt.setRole(CodeableConcept43_50.convertCodeableConcept(src.getRole()));
938    return tgt;
939  }
940
941  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> convertActionParticipantType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType> src) throws FHIRException {
942      if (src == null || src.isEmpty())
943          return null;
944      Enumeration<Enumerations.ActionParticipantType> tgt = new Enumeration<>(new Enumerations.ActionParticipantTypeEnumFactory());
945      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
946      if (src.getValue() == null) {
947          tgt.setValue(null);
948      } else {
949          switch (src.getValue()) {
950              case PATIENT:
951                  tgt.setValue(Enumerations.ActionParticipantType.PATIENT);
952                  break;
953              case PRACTITIONER:
954                  tgt.setValue(Enumerations.ActionParticipantType.PRACTITIONER);
955                  break;
956              case RELATEDPERSON:
957                  tgt.setValue(Enumerations.ActionParticipantType.RELATEDPERSON);
958                  break;
959              case DEVICE:
960                  tgt.setValue(Enumerations.ActionParticipantType.DEVICE);
961                  break;
962              default:
963                  tgt.setValue(Enumerations.ActionParticipantType.NULL);
964                  break;
965          }
966      }
967      return tgt;
968  }
969
970  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType> convertActionParticipantType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> src) throws FHIRException {
971      if (src == null || src.isEmpty())
972          return null;
973      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionParticipantTypeEnumFactory());
974      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
975      if (src.getValue() == null) {
976          tgt.setValue(null);
977      } else {
978          switch (src.getValue()) {
979              case PATIENT:
980                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.PATIENT);
981                  break;
982              case PRACTITIONER:
983                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.PRACTITIONER);
984                  break;
985              case RELATEDPERSON:
986                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.RELATEDPERSON);
987                  break;
988              case DEVICE:
989                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.DEVICE);
990                  break;
991              default:
992                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.NULL);
993                  break;
994          }
995      }
996      return tgt;
997  }
998
999  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException {
1000    if (src == null)
1001      return null;
1002    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent();
1003    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
1004    if (src.hasPath())
1005      tgt.setPathElement(String43_50.convertString(src.getPathElement()));
1006    if (src.hasExpression())
1007      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
1008    return tgt;
1009  }
1010
1011  public static org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException {
1012    if (src == null)
1013      return null;
1014    org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r4b.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent();
1015    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
1016    if (src.hasPath())
1017      tgt.setPathElement(String43_50.convertString(src.getPathElement()));
1018    if (src.hasExpression())
1019      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
1020    return tgt;
1021  }
1022}