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