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