001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.VersionConvertorConstants;
004import org.hl7.fhir.convertors.context.ConversionContext43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_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.general43_50.SimpleQuantity43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_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.UsageContext43_50;
013import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
014import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
015import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Date43_50;
016import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
017import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
018import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
019import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
020import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Dosage43_50;
021import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
022import org.hl7.fhir.exceptions.FHIRException;
023import org.hl7.fhir.r5.model.CodeType;
024import org.hl7.fhir.r5.model.CodeableReference;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
055public class ActivityDefinition43_50 {
056
057  public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r4b.model.ActivityDefinition src) throws FHIRException {
058    if (src == null)
059      return null;
060    org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition();
061    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
062    if (src.hasUrl())
063      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
064    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
065      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
066    if (src.hasVersion())
067      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
068    if (src.hasName())
069      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
070    if (src.hasTitle())
071      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
072    if (src.hasSubtitle())
073      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
074    if (src.hasStatus())
075      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
076    if (src.hasExperimental())
077      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
078    if (src.hasSubject())
079      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
080    if (src.hasDate())
081      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
082    if (src.hasPublisher())
083      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
084    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getContact())
085      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
086    if (src.hasDescription())
087      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
088    for (org.hl7.fhir.r4b.model.UsageContext t : src.getUseContext())
089      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
090    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getJurisdiction())
091      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
092    if (src.hasPurpose())
093      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
094    if (src.hasUsage())
095      tgt.setUsageElement(String43_50.convertStringToMarkdown(src.getUsageElement()));
096    if (src.hasCopyright())
097      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
098    if (src.hasApprovalDate())
099      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
100    if (src.hasLastReviewDate())
101      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
102    if (src.hasEffectivePeriod())
103      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
104    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getTopic())
105      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
106    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getAuthor())
107      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
108    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEditor())
109      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
110    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getReviewer())
111      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
112    for (org.hl7.fhir.r4b.model.ContactDetail t : src.getEndorser())
113      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
114    for (org.hl7.fhir.r4b.model.RelatedArtifact t : src.getRelatedArtifact())
115      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
116    for (org.hl7.fhir.r4b.model.CanonicalType t : src.getLibrary())
117      tgt.getLibrary().add(Canonical43_50.convertCanonical(t));
118    if (src.hasKind())
119      tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
120    if (src.hasProfile())
121      tgt.setProfileElement(Canonical43_50.convertCanonical(src.getProfileElement()));
122    if (src.hasCode())
123      tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode()));
124    if (src.hasIntent())
125      tgt.setIntentElement(convertRequestIntent(src.getIntentElement()));
126    if (src.hasPriority())
127      tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
128    if (src.hasDoNotPerform())
129      tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement()));
130    if (src.hasTiming())
131      tgt.setTiming(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTiming()));
132    if (src.hasLocation())
133      tgt.setLocation(new CodeableReference(Reference43_50.convertReference(src.getLocation())));
134    for (org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant())
135      tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
136    if (src.hasProduct())
137      tgt.setProduct(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getProduct()));
138    if (src.hasQuantity())
139      tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity()));
140    for (org.hl7.fhir.r4b.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage43_50.convertDosage(t));
141    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getBodySite())
142      tgt.addBodySite(CodeableConcept43_50.convertCodeableConcept(t));
143    for (org.hl7.fhir.r4b.model.Reference t : src.getSpecimenRequirement())
144      tgt.getSpecimenRequirement().add(Reference43_50.convertReferenceToCanonical(t));
145    for (org.hl7.fhir.r4b.model.Reference t : src.getObservationRequirement())
146      tgt.getObservationRequirement().add(Reference43_50.convertReferenceToCanonical(t));
147    for (org.hl7.fhir.r4b.model.Reference t : src.getObservationResultRequirement())
148      tgt.getObservationResultRequirement().add(Reference43_50.convertReferenceToCanonical(t));
149    if (src.hasTransform())
150      tgt.setTransformElement(Canonical43_50.convertCanonical(src.getTransformElement()));
151    for (org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue())
152      tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
153    return tgt;
154  }
155
156  public static org.hl7.fhir.r4b.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException {
157    if (src == null)
158      return null;
159    org.hl7.fhir.r4b.model.ActivityDefinition tgt = new org.hl7.fhir.r4b.model.ActivityDefinition();
160    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
161    if (src.hasUrl())
162      tgt.setUrlElement(Uri43_50.convertUri(src.getUrlElement()));
163    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
164      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
165    if (src.hasVersion())
166      tgt.setVersionElement(String43_50.convertString(src.getVersionElement()));
167    if (src.hasName())
168      tgt.setNameElement(String43_50.convertString(src.getNameElement()));
169    if (src.hasTitle())
170      tgt.setTitleElement(String43_50.convertString(src.getTitleElement()));
171    if (src.hasSubtitle())
172      tgt.setSubtitleElement(String43_50.convertString(src.getSubtitleElement()));
173    if (src.hasStatus())
174      tgt.setStatusElement(Enumerations43_50.convertPublicationStatus(src.getStatusElement()));
175    if (src.hasExperimental())
176      tgt.setExperimentalElement(Boolean43_50.convertBoolean(src.getExperimentalElement()));
177    if (src.hasSubject())
178      tgt.setSubject(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getSubject()));
179    if (src.hasDate())
180      tgt.setDateElement(DateTime43_50.convertDateTime(src.getDateElement()));
181    if (src.hasPublisher())
182      tgt.setPublisherElement(String43_50.convertString(src.getPublisherElement()));
183    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
184      tgt.addContact(ContactDetail43_50.convertContactDetail(t));
185    if (src.hasDescription())
186      tgt.setDescriptionElement(MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
187    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
188      tgt.addUseContext(UsageContext43_50.convertUsageContext(t));
189    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
190      tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept(t));
191    if (src.hasPurpose())
192      tgt.setPurposeElement(MarkDown43_50.convertMarkdown(src.getPurposeElement()));
193    if (src.hasUsage())
194      tgt.setUsageElement(String43_50.convertString(src.getUsageElement()));
195    if (src.hasCopyright())
196      tgt.setCopyrightElement(MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
197    if (src.hasApprovalDate())
198      tgt.setApprovalDateElement(Date43_50.convertDate(src.getApprovalDateElement()));
199    if (src.hasLastReviewDate())
200      tgt.setLastReviewDateElement(Date43_50.convertDate(src.getLastReviewDateElement()));
201    if (src.hasEffectivePeriod())
202      tgt.setEffectivePeriod(Period43_50.convertPeriod(src.getEffectivePeriod()));
203    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic())
204      tgt.addTopic(CodeableConcept43_50.convertCodeableConcept(t));
205    for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor())
206      tgt.addAuthor(ContactDetail43_50.convertContactDetail(t));
207    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor())
208      tgt.addEditor(ContactDetail43_50.convertContactDetail(t));
209    for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer())
210      tgt.addReviewer(ContactDetail43_50.convertContactDetail(t));
211    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser())
212      tgt.addEndorser(ContactDetail43_50.convertContactDetail(t));
213    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact())
214      tgt.addRelatedArtifact(RelatedArtifact43_50.convertRelatedArtifact(t));
215    for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary())
216      tgt.getLibrary().add(Canonical43_50.convertCanonical(t));
217    if (src.hasKind())
218      tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
219    if (src.hasProfile())
220      tgt.setProfileElement(Canonical43_50.convertCanonical(src.getProfileElement()));
221    if (src.hasCode())
222      tgt.setCode(CodeableConcept43_50.convertCodeableConcept(src.getCode()));
223    if (src.hasIntent())
224      tgt.setIntentElement(convertRequestIntent(src.getIntentElement()));
225    if (src.hasPriority())
226      tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
227    if (src.hasDoNotPerform())
228      tgt.setDoNotPerformElement(Boolean43_50.convertBoolean(src.getDoNotPerformElement()));
229    if (src.hasTiming())
230      tgt.setTiming(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getTiming()));
231    if (src.getLocation().hasReference())
232      tgt.setLocation(Reference43_50.convertReference(src.getLocation().getReference()));
233    for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant())
234      tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
235    if (src.hasProduct())
236      tgt.setProduct(ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().convertType(src.getProduct()));
237    if (src.hasQuantity())
238      tgt.setQuantity(SimpleQuantity43_50.convertSimpleQuantity(src.getQuantity()));
239    for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage43_50.convertDosage(t));
240    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite())
241      tgt.addBodySite(CodeableConcept43_50.convertCodeableConcept(t));
242    for (org.hl7.fhir.r5.model.CanonicalType t : src.getSpecimenRequirement())
243      tgt.addSpecimenRequirement(Reference43_50.convertReferenceToCanonical(t));
244    for (org.hl7.fhir.r5.model.CanonicalType t : src.getObservationRequirement())
245      tgt.addObservationRequirement(Reference43_50.convertReferenceToCanonical(t));
246    for (org.hl7.fhir.r5.model.CanonicalType t : src.getObservationResultRequirement())
247      tgt.addObservationResultRequirement(Reference43_50.convertReferenceToCanonical(t));
248    if (src.hasTransform())
249      tgt.setTransformElement(Canonical43_50.convertCanonical(src.getTransformElement()));
250    for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue())
251      tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
252    return tgt;
253  }
254
255  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes> convertActivityDefinitionKind(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType> src) throws FHIRException {
256    if (src == null || src.isEmpty())
257      return null;
258    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypesEnumFactory());
259    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
260    switch (src.getValue()) {
261      case APPOINTMENT:
262        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.APPOINTMENT);
263        break;
264      case APPOINTMENTRESPONSE:
265        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.APPOINTMENTRESPONSE);
266        break;
267      case CAREPLAN:
268        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.CAREPLAN);
269        break;
270      case CLAIM:
271        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.CLAIM);
272        break;
273      case COMMUNICATIONREQUEST:
274        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.COMMUNICATIONREQUEST);
275        break;
276      case DEVICEREQUEST:
277        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.DEVICEREQUEST);
278        break;
279      case ENROLLMENTREQUEST:
280        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.ENROLLMENTREQUEST);
281        break;
282      case IMMUNIZATIONRECOMMENDATION:
283        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.IMMUNIZATIONRECOMMENDATION);
284        break;
285      case MEDICATIONREQUEST:
286        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.MEDICATIONREQUEST);
287        break;
288      case NUTRITIONORDER:
289        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.NUTRITIONORDER);
290        break;
291      case SERVICEREQUEST:
292        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.SERVICEREQUEST);
293        break;
294      case SUPPLYREQUEST:
295        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.SUPPLYREQUEST);
296        break;
297      case TASK:
298        tgt.setValue(null);
299        tgt.addExtension(VersionConvertorConstants.EXT_ACTUAL_RESOURCE_NAME, new CodeType("Task"));
300        break;
301      case VISIONPRESCRIPTION:
302        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.VISIONPRESCRIPTION);
303        break;
304      default:
305        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.NULL);
306        break;
307    }
308    return tgt;
309  }
310
311  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType> convertActivityDefinitionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes> src) throws FHIRException {
312    if (src == null || src.isEmpty())
313      return null;
314    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceTypeEnumFactory());
315    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt, VersionConvertorConstants.EXT_ACTUAL_RESOURCE_NAME);
316    if (src.hasExtension(VersionConvertorConstants.EXT_ACTUAL_RESOURCE_NAME)) {
317      tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_ACTUAL_RESOURCE_NAME));
318    } else {
319      switch (src.getValue()) {
320      case APPOINTMENT:
321        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.APPOINTMENT);
322        break;
323      case APPOINTMENTRESPONSE:
324        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.APPOINTMENTRESPONSE);
325        break;
326      case CAREPLAN:
327        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.CAREPLAN);
328        break;
329      case CLAIM:
330        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.CLAIM);
331        break;
332      case COMMUNICATIONREQUEST:
333        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.COMMUNICATIONREQUEST);
334        break;
335      case DEVICEREQUEST:
336        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.DEVICEREQUEST);
337        break;
338      case ENROLLMENTREQUEST:
339        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.ENROLLMENTREQUEST);
340        break;
341      case IMMUNIZATIONRECOMMENDATION:
342        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.IMMUNIZATIONRECOMMENDATION);
343        break;
344      case MEDICATIONREQUEST:
345        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.MEDICATIONREQUEST);
346        break;
347      case NUTRITIONORDER:
348        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.NUTRITIONORDER);
349        break;
350      case SERVICEREQUEST:
351        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.SERVICEREQUEST);
352        break;
353      case SUPPLYREQUEST:
354        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.SUPPLYREQUEST);
355        break;
356      case VISIONPRESCRIPTION:
357        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.VISIONPRESCRIPTION);
358        break;
359      default:
360        tgt.setValue(org.hl7.fhir.r4b.model.ActivityDefinition.RequestResourceType.NULL);
361        break;
362      }
363    }
364    return tgt;
365  }
366
367  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> convertRequestIntent(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> src) throws FHIRException {
368    if (src == null || src.isEmpty())
369      return null;
370    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestIntentEnumFactory());
371    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
372    switch (src.getValue()) {
373      case PROPOSAL:
374        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PROPOSAL);
375        break;
376      case PLAN:
377        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PLAN);
378        break;
379      case DIRECTIVE:
380        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.DIRECTIVE);
381        break;
382      case ORDER:
383        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORDER);
384        break;
385      case ORIGINALORDER:
386        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORIGINALORDER);
387        break;
388      case REFLEXORDER:
389        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.REFLEXORDER);
390        break;
391      case FILLERORDER:
392        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.FILLERORDER);
393        break;
394      case INSTANCEORDER:
395        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.INSTANCEORDER);
396        break;
397      case OPTION:
398        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.OPTION);
399        break;
400      default:
401        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.NULL);
402        break;
403    }
404    return tgt;
405  }
406
407  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> convertRequestIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestIntent> src) throws FHIRException {
408    if (src == null || src.isEmpty())
409      return null;
410    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.RequestIntent> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.RequestIntentEnumFactory());
411    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
412    switch (src.getValue()) {
413      case PROPOSAL:
414        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.PROPOSAL);
415        break;
416      case PLAN:
417        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.PLAN);
418        break;
419      case DIRECTIVE:
420        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.DIRECTIVE);
421        break;
422      case ORDER:
423        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.ORDER);
424        break;
425      case ORIGINALORDER:
426        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.ORIGINALORDER);
427        break;
428      case REFLEXORDER:
429        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.REFLEXORDER);
430        break;
431      case FILLERORDER:
432        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.FILLERORDER);
433        break;
434      case INSTANCEORDER:
435        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.INSTANCEORDER);
436        break;
437      case OPTION:
438        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.OPTION);
439        break;
440      default:
441        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestIntent.NULL);
442        break;
443    }
444    return tgt;
445  }
446
447  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 {
448    if (src == null || src.isEmpty())
449      return null;
450    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestPriorityEnumFactory());
451    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
452    switch (src.getValue()) {
453      case ROUTINE:
454        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE);
455        break;
456      case URGENT:
457        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT);
458        break;
459      case ASAP:
460        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP);
461        break;
462      case STAT:
463        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT);
464        break;
465      default:
466        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL);
467        break;
468    }
469    return tgt;
470  }
471
472  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 {
473    if (src == null || src.isEmpty())
474      return null;
475    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());
476    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
477    switch (src.getValue()) {
478      case ROUTINE:
479        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ROUTINE);
480        break;
481      case URGENT:
482        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.URGENT);
483        break;
484      case ASAP:
485        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.ASAP);
486        break;
487      case STAT:
488        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.STAT);
489        break;
490      default:
491        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.RequestPriority.NULL);
492        break;
493    }
494    return tgt;
495  }
496
497  public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException {
498    if (src == null)
499      return null;
500    org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent();
501    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
502    if (src.hasType())
503      tgt.setTypeElement(convertActivityParticipantType(src.getTypeElement()));
504    if (src.hasRole())
505      tgt.setRole(CodeableConcept43_50.convertCodeableConcept(src.getRole()));
506    return tgt;
507  }
508
509  public static org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException {
510    if (src == null)
511      return null;
512    org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionParticipantComponent();
513    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
514    if (src.hasType())
515      tgt.setTypeElement(convertActivityParticipantType(src.getTypeElement()));
516    if (src.hasRole())
517      tgt.setRole(CodeableConcept43_50.convertCodeableConcept(src.getRole()));
518    return tgt;
519  }
520
521  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> convertActivityParticipantType(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType> src) throws FHIRException {
522    if (src == null || src.isEmpty())
523      return null;
524    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionParticipantTypeEnumFactory());
525    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
526    switch (src.getValue()) {
527      case PATIENT:
528        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT);
529        break;
530      case PRACTITIONER:
531        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER);
532        break;
533      case RELATEDPERSON:
534        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON);
535        break;
536      case DEVICE:
537        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.DEVICE);
538        break;
539      default:
540        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL);
541        break;
542    }
543    return tgt;
544  }
545
546  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType> convertActivityParticipantType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> 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.ActionParticipantType> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.ActionParticipantTypeEnumFactory());
550    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
551    switch (src.getValue()) {
552      case PATIENT:
553        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.PATIENT);
554        break;
555      case PRACTITIONER:
556        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.PRACTITIONER);
557        break;
558      case RELATEDPERSON:
559        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.RELATEDPERSON);
560        break;
561      case DEVICE:
562        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.DEVICE);
563        break;
564      default:
565        tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.ActionParticipantType.NULL);
566        break;
567    }
568    return tgt;
569  }
570
571  public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException {
572    if (src == null)
573      return null;
574    org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent();
575    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
576    if (src.hasPath())
577      tgt.setPathElement(String43_50.convertString(src.getPathElement()));
578    if (src.hasExpression())
579      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
580    return tgt;
581  }
582
583  public static org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException {
584    if (src == null)
585      return null;
586    org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r4b.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent();
587    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
588    if (src.hasPath())
589      tgt.setPathElement(String43_50.convertString(src.getPathElement()));
590    if (src.hasExpression())
591      tgt.setExpression(Expression43_50.convertExpression(src.getExpression()));
592    return tgt;
593  }
594}