001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Dosage30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.RelatedArtifact30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
011import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Period30_50;
012import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.SimpleQuantity30_50;
013import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
014import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Date30_50;
015import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
016import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
017import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
018import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
019import org.hl7.fhir.dstu3.model.ContactDetail;
020import org.hl7.fhir.dstu3.model.Contributor.ContributorType;
021import org.hl7.fhir.exceptions.FHIRException;
022import org.hl7.fhir.r5.model.CodeableReference;
023
024public class ActivityDefinition30_50 {
025
026  public static org.hl7.fhir.r5.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.dstu3.model.ActivityDefinition src) throws FHIRException {
027    if (src == null)
028      return null;
029    org.hl7.fhir.r5.model.ActivityDefinition tgt = new org.hl7.fhir.r5.model.ActivityDefinition();
030    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
031    if (src.hasUrl())
032      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
033    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
034      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
035    if (src.hasVersion())
036      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
037    if (src.hasName())
038      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
039    if (src.hasTitle())
040      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
041    if (src.hasStatus())
042      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
043    if (src.hasExperimental())
044      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
045    if (src.hasDate())
046      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
047    if (src.hasPublisher())
048      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
049    if (src.hasDescription())
050      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
051    if (src.hasPurpose())
052      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
053    if (src.hasUsage())
054      tgt.setUsageElement(String30_50.convertStringToMarkdown(src.getUsageElement()));
055    if (src.hasApprovalDate())
056      tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
057    if (src.hasLastReviewDate())
058      tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
059    if (src.hasEffectivePeriod())
060      tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
061    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
062      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
063    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
064      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
065    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic())
066      tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
067    for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
068      if (t.getType() == ContributorType.AUTHOR)
069        for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
070      if (t.getType() == ContributorType.EDITOR)
071        for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c));
072      if (t.getType() == ContributorType.REVIEWER)
073        for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c));
074      if (t.getType() == ContributorType.ENDORSER)
075        for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c));
076    }
077    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
078      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
079    if (src.hasCopyright())
080      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
081    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact())
082      tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
083    for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary())
084      tgt.getLibrary().add(Reference30_50.convertReferenceToCanonical(t));
085    if (src.hasKind())
086      tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
087    if (src.hasCode())
088      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
089    if (src.hasTiming())
090      tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
091    if (src.hasLocation())
092      tgt.setLocation(new CodeableReference(Reference30_50.convertReference(src.getLocation())));
093    for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant())
094      tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
095    if (src.hasProduct())
096      tgt.setProduct(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getProduct()));
097    if (src.hasQuantity())
098      tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
099    for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage30_50.convertDosage(t));
100    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite())
101      tgt.addBodySite(CodeableConcept30_50.convertCodeableConcept(t));
102    if (src.hasTransform())
103      tgt.setTransformElement(Reference30_50.convertReferenceToCanonical(src.getTransform()));
104    for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue())
105      tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
106    return tgt;
107  }
108
109  public static org.hl7.fhir.dstu3.model.ActivityDefinition convertActivityDefinition(org.hl7.fhir.r5.model.ActivityDefinition src) throws FHIRException {
110    if (src == null)
111      return null;
112    org.hl7.fhir.dstu3.model.ActivityDefinition tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition();
113    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
114    if (src.hasUrl())
115      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
116    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
117      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
118    if (src.hasVersion())
119      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
120    if (src.hasName())
121      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
122    if (src.hasTitle())
123      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
124    if (src.hasStatus())
125      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
126    if (src.hasExperimental())
127      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
128    if (src.hasDate())
129      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
130    if (src.hasPublisher())
131      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
132    if (src.hasDescription())
133      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
134    if (src.hasPurpose())
135      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
136    if (src.hasUsage())
137      tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
138    if (src.hasApprovalDate())
139      tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
140    if (src.hasLastReviewDate())
141      tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
142    if (src.hasEffectivePeriod())
143      tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
144    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
145      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
146    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
147      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
148    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic())
149      tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
150    for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) {
151      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
152      c.setType(ContributorType.AUTHOR);
153      c.addContact(ContactDetail30_50.convertContactDetail(t));
154      tgt.addContributor(c);
155    }
156    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) {
157      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
158      c.setType(ContributorType.EDITOR);
159      c.addContact(ContactDetail30_50.convertContactDetail(t));
160      tgt.addContributor(c);
161    }
162    for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) {
163      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
164      c.setType(ContributorType.REVIEWER);
165      c.addContact(ContactDetail30_50.convertContactDetail(t));
166      tgt.addContributor(c);
167    }
168    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) {
169      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
170      c.setType(ContributorType.ENDORSER);
171      c.addContact(ContactDetail30_50.convertContactDetail(t));
172      tgt.addContributor(c);
173    }
174    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
175      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
176    if (src.hasCopyright())
177      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
178    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact())
179      tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
180    for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary())
181      tgt.addLibrary(Reference30_50.convertCanonicalToReference(t));
182    if (src.hasKind())
183      tgt.setKindElement(convertActivityDefinitionKind(src.getKindElement()));
184    if (src.hasCode())
185      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
186    if (src.hasTiming())
187      tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
188    if (src.getLocation().hasReference())
189      tgt.setLocation(Reference30_50.convertReference(src.getLocation().getReference()));
190    for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant())
191      tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
192    if (src.hasProduct())
193      tgt.setProduct(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getProduct()));
194    if (src.hasQuantity())
195      tgt.setQuantity(SimpleQuantity30_50.convertSimpleQuantity(src.getQuantity()));
196    for (org.hl7.fhir.r5.model.Dosage t : src.getDosage()) tgt.addDosage(Dosage30_50.convertDosage(t));
197    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getBodySite())
198      tgt.addBodySite(CodeableConcept30_50.convertCodeableConcept(t));
199    if (src.hasTransform())
200      tgt.setTransform(Reference30_50.convertCanonicalToReference(src.getTransformElement()));
201    for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent t : src.getDynamicValue())
202      tgt.addDynamicValue(convertActivityDefinitionDynamicValueComponent(t));
203    return tgt;
204  }
205
206  public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException {
207    if (src == null)
208      return null;
209    org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent();
210    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
211    if (src.hasDescription())
212      tgt.getExpression().setDescription(src.getDescription());
213    if (src.hasPath())
214      tgt.setPathElement(String30_50.convertString(src.getPathElement()));
215    if (src.hasLanguage())
216      tgt.getExpression().setLanguage(src.getLanguage());
217    if (src.hasExpression())
218      tgt.getExpression().setExpression(src.getExpression());
219    return tgt;
220  }
221
222  public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent convertActivityDefinitionDynamicValueComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent src) throws FHIRException {
223    if (src == null)
224      return null;
225    org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionDynamicValueComponent();
226    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
227    if (src.hasPath())
228      tgt.setPathElement(String30_50.convertString(src.getPathElement()));
229    if (src.getExpression().hasDescription())
230      tgt.setDescription(src.getExpression().getDescription());
231    if (src.getExpression().hasLanguage())
232      tgt.setLanguage(src.getExpression().getLanguage());
233    if (src.getExpression().hasExpression())
234      tgt.setExpression(src.getExpression().getExpression());
235    return tgt;
236  }
237
238  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes> convertActivityDefinitionKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind> src) throws FHIRException {
239    if (src == null || src.isEmpty())
240      return null;
241    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());
242    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
243    switch (src.getValue()) {
244      case APPOINTMENT:
245        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.APPOINTMENT);
246        break;
247      case APPOINTMENTRESPONSE:
248        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.APPOINTMENTRESPONSE);
249        break;
250      case CAREPLAN:
251        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.CAREPLAN);
252        break;
253      case CLAIM:
254        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.CLAIM);
255        break;
256      case COMMUNICATIONREQUEST:
257        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.COMMUNICATIONREQUEST);
258        break;
259      case DEVICEREQUEST:
260        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.DEVICEREQUEST);
261        break;
262      case ENROLLMENTREQUEST:
263        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.ENROLLMENTREQUEST);
264        break;
265      case IMMUNIZATIONRECOMMENDATION:
266        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.IMMUNIZATIONRECOMMENDATION);
267        break;
268      case MEDICATIONREQUEST:
269        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.MEDICATIONREQUEST);
270        break;
271      case NUTRITIONORDER:
272        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.NUTRITIONORDER);
273        break;
274      case PROCEDUREREQUEST:
275        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.SERVICEREQUEST);
276        break;
277      case REFERRALREQUEST:
278        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.SERVICEREQUEST);
279        break;
280      case SUPPLYREQUEST:
281        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.SUPPLYREQUEST);
282        break;
283//      case TASK:
284//        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.TASK);
285//        break;
286      case VISIONPRESCRIPTION:
287        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.VISIONPRESCRIPTION);
288        break;
289      default:
290        tgt.setValue(org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes.NULL);
291        break;
292    }
293    return tgt;
294  }
295
296  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind> convertActivityDefinitionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.ActivityDefinition.RequestResourceTypes> src) throws FHIRException {
297    if (src == null || src.isEmpty())
298      return null;
299    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKindEnumFactory());
300    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
301    switch (src.getValue()) {
302      case APPOINTMENT:
303        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENT);
304        break;
305      case APPOINTMENTRESPONSE:
306        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.APPOINTMENTRESPONSE);
307        break;
308      case CAREPLAN:
309        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CAREPLAN);
310        break;
311      case CLAIM:
312        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.CLAIM);
313        break;
314      case COMMUNICATIONREQUEST:
315        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.COMMUNICATIONREQUEST);
316        break;
317      case DEVICEREQUEST:
318        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.DEVICEREQUEST);
319        break;
320      case ENROLLMENTREQUEST:
321        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.ENROLLMENTREQUEST);
322        break;
323      case IMMUNIZATIONRECOMMENDATION:
324        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.IMMUNIZATIONRECOMMENDATION);
325        break;
326      case MEDICATIONREQUEST:
327        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.MEDICATIONREQUEST);
328        break;
329      case NUTRITIONORDER:
330        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NUTRITIONORDER);
331        break;
332      case SERVICEREQUEST:
333        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.PROCEDUREREQUEST);
334        break;
335      case SUPPLYREQUEST:
336        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.SUPPLYREQUEST);
337        break;
338//      case TASK:
339//        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.TASK);
340//        break;
341      case VISIONPRESCRIPTION:
342        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.VISIONPRESCRIPTION);
343        break;
344      default:
345        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionKind.NULL);
346        break;
347    }
348    return tgt;
349  }
350
351  public static org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException {
352    if (src == null)
353      return null;
354    org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent();
355    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
356    if (src.hasType())
357      tgt.setTypeElement(convertActivityParticipantType(src.getTypeElement()));
358    if (src.hasRole())
359      tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole()));
360    return tgt;
361  }
362
363  public static org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent convertActivityDefinitionParticipantComponent(org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent src) throws FHIRException {
364    if (src == null)
365      return null;
366    org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent();
367    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyBackboneElement(src,tgt);
368    if (src.hasType())
369      tgt.setTypeElement(convertActivityParticipantType(src.getTypeElement()));
370    if (src.hasRole())
371      tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole()));
372    return tgt;
373  }
374
375  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> convertActivityParticipantType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType> src) throws FHIRException {
376    if (src == null || src.isEmpty())
377      return null;
378    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());
379    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
380    switch (src.getValue()) {
381      case PATIENT:
382        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT);
383        break;
384      case PRACTITIONER:
385        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER);
386        break;
387      case RELATEDPERSON:
388        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON);
389        break;
390      default:
391        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL);
392        break;
393    }
394    return tgt;
395  }
396
397  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType> convertActivityParticipantType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> src) throws FHIRException {
398    if (src == null || src.isEmpty())
399      return null;
400    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantTypeEnumFactory());
401    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
402    switch (src.getValue()) {
403      case PATIENT:
404        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PATIENT);
405        break;
406      case PRACTITIONER:
407        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.PRACTITIONER);
408        break;
409      case RELATEDPERSON:
410        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.RELATEDPERSON);
411        break;
412      default:
413        tgt.setValue(org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityParticipantType.NULL);
414        break;
415    }
416    return tgt;
417  }
418}