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.*;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.*;
007import org.hl7.fhir.dstu3.model.ContactDetail;
008import org.hl7.fhir.dstu3.model.Contributor.ContributorType;
009import org.hl7.fhir.exceptions.FHIRException;
010import org.hl7.fhir.r5.model.DataRequirement;
011import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionInputComponent;
012import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionOutputComponent;
013
014public class PlanDefinition30_50 {
015
016  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior> convertActionCardinalityBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior> src) throws FHIRException {
017    if (src == null || src.isEmpty())
018      return null;
019    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehaviorEnumFactory());
020    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
021    switch (src.getValue()) {
022      case SINGLE:
023        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.SINGLE);
024        break;
025      case MULTIPLE:
026        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.MULTIPLE);
027        break;
028      default:
029        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior.NULL);
030        break;
031    }
032    return tgt;
033  }
034
035  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior> convertActionCardinalityBehavior(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionCardinalityBehavior> src) throws FHIRException {
036    if (src == null || src.isEmpty())
037      return null;
038    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehaviorEnumFactory());
039    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
040    switch (src.getValue()) {
041      case SINGLE:
042        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.SINGLE);
043        break;
044      case MULTIPLE:
045        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.MULTIPLE);
046        break;
047      default:
048        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionCardinalityBehavior.NULL);
049        break;
050    }
051    return tgt;
052  }
053
054  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind> src) throws FHIRException {
055    if (src == null || src.isEmpty())
056      return null;
057    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionConditionKindEnumFactory());
058    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
059    switch (src.getValue()) {
060      case APPLICABILITY:
061        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.APPLICABILITY);
062        break;
063      case START:
064        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.START);
065        break;
066      case STOP:
067        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.STOP);
068        break;
069      default:
070        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionConditionKind.NULL);
071        break;
072    }
073    return tgt;
074  }
075
076  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind> convertActionConditionKind(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionConditionKind> src) throws FHIRException {
077    if (src == null || src.isEmpty())
078      return null;
079    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKindEnumFactory());
080    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
081    switch (src.getValue()) {
082      case APPLICABILITY:
083        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.APPLICABILITY);
084        break;
085      case START:
086        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.START);
087        break;
088      case STOP:
089        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.STOP);
090        break;
091      default:
092        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionConditionKind.NULL);
093        break;
094    }
095    return tgt;
096  }
097
098  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior> convertActionGroupingBehavior(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior> src) throws FHIRException {
099    if (src == null || src.isEmpty())
100      return null;
101    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehaviorEnumFactory());
102    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
103    switch (src.getValue()) {
104      case VISUALGROUP:
105        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.VISUALGROUP);
106        break;
107      case LOGICALGROUP:
108        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.LOGICALGROUP);
109        break;
110      case SENTENCEGROUP:
111        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.SENTENCEGROUP);
112        break;
113      default:
114        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior.NULL);
115        break;
116    }
117    return tgt;
118  }
119
120  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior> convertActionGroupingBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionGroupingBehavior> src) throws FHIRException {
121    if (src == null || src.isEmpty())
122      return null;
123    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehaviorEnumFactory());
124    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
125    switch (src.getValue()) {
126      case VISUALGROUP:
127        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.VISUALGROUP);
128        break;
129      case LOGICALGROUP:
130        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.LOGICALGROUP);
131        break;
132      case SENTENCEGROUP:
133        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.SENTENCEGROUP);
134        break;
135      default:
136        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionGroupingBehavior.NULL);
137        break;
138    }
139    return tgt;
140  }
141
142  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> convertActionParticipantType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType> src) throws FHIRException {
143    if (src == null || src.isEmpty())
144      return null;
145    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());
146    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
147    switch (src.getValue()) {
148      case PATIENT:
149        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PATIENT);
150        break;
151      case PRACTITIONER:
152        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.PRACTITIONER);
153        break;
154      case RELATEDPERSON:
155        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.RELATEDPERSON);
156        break;
157      default:
158        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionParticipantType.NULL);
159        break;
160    }
161    return tgt;
162  }
163
164  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType> convertActionParticipantType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionParticipantType> src) throws FHIRException {
165    if (src == null || src.isEmpty())
166      return null;
167    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantTypeEnumFactory());
168    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
169    switch (src.getValue()) {
170      case PATIENT:
171        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PATIENT);
172        break;
173      case PRACTITIONER:
174        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.PRACTITIONER);
175        break;
176      case RELATEDPERSON:
177        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.RELATEDPERSON);
178        break;
179      default:
180        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionParticipantType.NULL);
181        break;
182    }
183    return tgt;
184  }
185
186  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior> convertActionPrecheckBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior> src) throws FHIRException {
187    if (src == null || src.isEmpty())
188      return null;
189    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehaviorEnumFactory());
190    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
191    switch (src.getValue()) {
192      case YES:
193        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.YES);
194        break;
195      case NO:
196        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NO);
197        break;
198      default:
199        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior.NULL);
200        break;
201    }
202    return tgt;
203  }
204
205  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior> convertActionPrecheckBehavior(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionPrecheckBehavior> src) throws FHIRException {
206    if (src == null || src.isEmpty())
207      return null;
208    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehaviorEnumFactory());
209    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
210    switch (src.getValue()) {
211      case YES:
212        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.YES);
213        break;
214      case NO:
215        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NO);
216        break;
217      default:
218        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionPrecheckBehavior.NULL);
219        break;
220    }
221    return tgt;
222  }
223
224  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType> convertActionRelationshipType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType> src) throws FHIRException {
225    if (src == null || src.isEmpty())
226      return null;
227    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionRelationshipTypeEnumFactory());
228    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
229    switch (src.getValue()) {
230      case BEFORESTART:
231        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORESTART);
232        break;
233      case BEFORE:
234        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFORE);
235        break;
236      case BEFOREEND:
237        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.BEFOREEND);
238        break;
239      case CONCURRENTWITHSTART:
240        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHSTART);
241        break;
242      case CONCURRENT:
243        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENT);
244        break;
245      case CONCURRENTWITHEND:
246        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.CONCURRENTWITHEND);
247        break;
248      case AFTERSTART:
249        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTERSTART);
250        break;
251      case AFTER:
252        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTER);
253        break;
254      case AFTEREND:
255        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.AFTEREND);
256        break;
257      default:
258        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType.NULL);
259        break;
260    }
261    return tgt;
262  }
263
264  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType> convertActionRelationshipType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRelationshipType> src) throws FHIRException {
265    if (src == null || src.isEmpty())
266      return null;
267    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipTypeEnumFactory());
268    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
269    switch (src.getValue()) {
270      case BEFORESTART:
271        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORESTART);
272        break;
273      case BEFORE:
274        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFORE);
275        break;
276      case BEFOREEND:
277        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.BEFOREEND);
278        break;
279      case CONCURRENTWITHSTART:
280        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHSTART);
281        break;
282      case CONCURRENT:
283        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENT);
284        break;
285      case CONCURRENTWITHEND:
286        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.CONCURRENTWITHEND);
287        break;
288      case AFTERSTART:
289        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTERSTART);
290        break;
291      case AFTER:
292        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTER);
293        break;
294      case AFTEREND:
295        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.AFTEREND);
296        break;
297      default:
298        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRelationshipType.NULL);
299        break;
300    }
301    return tgt;
302  }
303
304  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior> src) throws FHIRException {
305    if (src == null || src.isEmpty())
306      return null;
307    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehaviorEnumFactory());
308    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
309    switch (src.getValue()) {
310      case MUST:
311        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUST);
312        break;
313      case COULD:
314        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.COULD);
315        break;
316      case MUSTUNLESSDOCUMENTED:
317        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
318        break;
319      default:
320        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior.NULL);
321        break;
322    }
323    return tgt;
324  }
325
326  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior> convertActionRequiredBehavior(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionRequiredBehavior> src) throws FHIRException {
327    if (src == null || src.isEmpty())
328      return null;
329    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehaviorEnumFactory());
330    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
331    switch (src.getValue()) {
332      case MUST:
333        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUST);
334        break;
335      case COULD:
336        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.COULD);
337        break;
338      case MUSTUNLESSDOCUMENTED:
339        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
340        break;
341      default:
342        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionRequiredBehavior.NULL);
343        break;
344    }
345    return tgt;
346  }
347
348  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior> convertActionSelectionBehavior(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior> src) throws FHIRException {
349    if (src == null || src.isEmpty())
350      return null;
351    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehaviorEnumFactory());
352    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
353    switch (src.getValue()) {
354      case ANY:
355        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ANY);
356        break;
357      case ALL:
358        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALL);
359        break;
360      case ALLORNONE:
361        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ALLORNONE);
362        break;
363      case EXACTLYONE:
364        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.EXACTLYONE);
365        break;
366      case ATMOSTONE:
367        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ATMOSTONE);
368        break;
369      case ONEORMORE:
370        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.ONEORMORE);
371        break;
372      default:
373        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior.NULL);
374        break;
375    }
376    return tgt;
377  }
378
379  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior> convertActionSelectionBehavior(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.ActionSelectionBehavior> src) throws FHIRException {
380    if (src == null || src.isEmpty())
381      return null;
382    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehaviorEnumFactory());
383    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
384    switch (src.getValue()) {
385      case ANY:
386        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ANY);
387        break;
388      case ALL:
389        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALL);
390        break;
391      case ALLORNONE:
392        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ALLORNONE);
393        break;
394      case EXACTLYONE:
395        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.EXACTLYONE);
396        break;
397      case ATMOSTONE:
398        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ATMOSTONE);
399        break;
400      case ONEORMORE:
401        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.ONEORMORE);
402        break;
403      default:
404        tgt.setValue(org.hl7.fhir.dstu3.model.PlanDefinition.ActionSelectionBehavior.NULL);
405        break;
406    }
407    return tgt;
408  }
409
410  public static org.hl7.fhir.dstu3.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.r5.model.PlanDefinition src) throws FHIRException {
411    if (src == null)
412      return null;
413    org.hl7.fhir.dstu3.model.PlanDefinition tgt = new org.hl7.fhir.dstu3.model.PlanDefinition();
414    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
415    if (src.hasUrl())
416      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
417    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
418      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
419    if (src.hasVersion())
420      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
421    if (src.hasName())
422      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
423    if (src.hasTitle())
424      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
425    if (src.hasType())
426      tgt.setType(CodeableConcept30_50.convertCodeableConcept(src.getType()));
427    if (src.hasStatus())
428      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
429    if (src.hasExperimental())
430      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
431    if (src.hasDate())
432      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
433    if (src.hasPublisher())
434      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
435    if (src.hasDescription())
436      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
437    if (src.hasPurpose())
438      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
439    if (src.hasUsage())
440      tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
441    if (src.hasApprovalDate())
442      tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
443    if (src.hasLastReviewDate())
444      tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
445    if (src.hasEffectivePeriod())
446      tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
447    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
448      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
449    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
450      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
451    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getTopic())
452      tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
453    for (org.hl7.fhir.r5.model.ContactDetail t : src.getAuthor()) {
454      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
455      c.setType(ContributorType.AUTHOR);
456      c.addContact(ContactDetail30_50.convertContactDetail(t));
457      tgt.addContributor(c);
458    }
459    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEditor()) {
460      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
461      c.setType(ContributorType.EDITOR);
462      c.addContact(ContactDetail30_50.convertContactDetail(t));
463      tgt.addContributor(c);
464    }
465    for (org.hl7.fhir.r5.model.ContactDetail t : src.getReviewer()) {
466      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
467      c.setType(ContributorType.REVIEWER);
468      c.addContact(ContactDetail30_50.convertContactDetail(t));
469      tgt.addContributor(c);
470    }
471    for (org.hl7.fhir.r5.model.ContactDetail t : src.getEndorser()) {
472      org.hl7.fhir.dstu3.model.Contributor c = new org.hl7.fhir.dstu3.model.Contributor();
473      c.setType(ContributorType.ENDORSER);
474      c.addContact(ContactDetail30_50.convertContactDetail(t));
475      tgt.addContributor(c);
476    }
477    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
478      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
479    if (src.hasCopyright())
480      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
481    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getRelatedArtifact())
482      tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
483    for (org.hl7.fhir.r5.model.CanonicalType t : src.getLibrary())
484      tgt.addLibrary(Reference30_50.convertCanonicalToReference(t));
485    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal())
486      tgt.addGoal(convertPlanDefinitionGoalComponent(t));
487    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
488      tgt.addAction(convertPlanDefinitionActionComponent(t));
489    return tgt;
490  }
491
492  public static org.hl7.fhir.r5.model.PlanDefinition convertPlanDefinition(org.hl7.fhir.dstu3.model.PlanDefinition src) throws FHIRException {
493    if (src == null)
494      return null;
495    org.hl7.fhir.r5.model.PlanDefinition tgt = new org.hl7.fhir.r5.model.PlanDefinition();
496    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
497    if (src.hasUrl())
498      tgt.setUrlElement(Uri30_50.convertUri(src.getUrlElement()));
499    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
500      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
501    if (src.hasVersion())
502      tgt.setVersionElement(String30_50.convertString(src.getVersionElement()));
503    if (src.hasName())
504      tgt.setNameElement(String30_50.convertString(src.getNameElement()));
505    if (src.hasTitle())
506      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
507    if (src.hasType())
508      tgt.setType(CodeableConcept30_50.convertCodeableConcept(src.getType()));
509    if (src.hasStatus())
510      tgt.setStatusElement(Enumerations30_50.convertPublicationStatus(src.getStatusElement()));
511    if (src.hasExperimental())
512      tgt.setExperimentalElement(Boolean30_50.convertBoolean(src.getExperimentalElement()));
513    if (src.hasDate())
514      tgt.setDateElement(DateTime30_50.convertDateTime(src.getDateElement()));
515    if (src.hasPublisher())
516      tgt.setPublisherElement(String30_50.convertString(src.getPublisherElement()));
517    if (src.hasDescription())
518      tgt.setDescriptionElement(MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
519    if (src.hasPurpose())
520      tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
521    if (src.hasUsage())
522      tgt.setUsageElement(String30_50.convertString(src.getUsageElement()));
523    if (src.hasApprovalDate())
524      tgt.setApprovalDateElement(Date30_50.convertDate(src.getApprovalDateElement()));
525    if (src.hasLastReviewDate())
526      tgt.setLastReviewDateElement(Date30_50.convertDate(src.getLastReviewDateElement()));
527    if (src.hasEffectivePeriod())
528      tgt.setEffectivePeriod(Period30_50.convertPeriod(src.getEffectivePeriod()));
529    for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
530      tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
531    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
532      tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
533    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTopic())
534      tgt.addTopic(CodeableConcept30_50.convertCodeableConcept(t));
535    for (org.hl7.fhir.dstu3.model.Contributor t : src.getContributor()) {
536      if (t.getType() == ContributorType.AUTHOR)
537        for (ContactDetail c : t.getContact()) tgt.addAuthor(ContactDetail30_50.convertContactDetail(c));
538      if (t.getType() == ContributorType.EDITOR)
539        for (ContactDetail c : t.getContact()) tgt.addEditor(ContactDetail30_50.convertContactDetail(c));
540      if (t.getType() == ContributorType.REVIEWER)
541        for (ContactDetail c : t.getContact()) tgt.addReviewer(ContactDetail30_50.convertContactDetail(c));
542      if (t.getType() == ContributorType.ENDORSER)
543        for (ContactDetail c : t.getContact()) tgt.addEndorser(ContactDetail30_50.convertContactDetail(c));
544    }
545    for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact())
546      tgt.addContact(ContactDetail30_50.convertContactDetail(t));
547    if (src.hasCopyright())
548      tgt.setCopyrightElement(MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
549    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getRelatedArtifact())
550      tgt.addRelatedArtifact(RelatedArtifact30_50.convertRelatedArtifact(t));
551    for (org.hl7.fhir.dstu3.model.Reference t : src.getLibrary())
552      tgt.getLibrary().add(Reference30_50.convertReferenceToCanonical(t));
553    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent t : src.getGoal())
554      tgt.addGoal(convertPlanDefinitionGoalComponent(t));
555    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
556      tgt.addAction(convertPlanDefinitionActionComponent(t));
557    return tgt;
558  }
559
560  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
561    if (src == null)
562      return null;
563    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent();
564    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
565    if (src.hasLabel())
566      tgt.setPrefixElement(String30_50.convertString(src.getLabelElement()));
567    if (src.hasTitle())
568      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
569    if (src.hasDescription())
570      tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
571    if (src.hasTextEquivalent())
572      tgt.setTextEquivalentElement(String30_50.convertString(src.getTextEquivalentElement()));
573    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode())
574      tgt.setCode(CodeableConcept30_50.convertCodeableConcept(t));
575    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason())
576      tgt.addReason(CodeableConcept30_50.convertCodeableConcept(t));
577    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation())
578      tgt.addDocumentation(RelatedArtifact30_50.convertRelatedArtifact(t));
579    for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue());
580    for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition())
581      tgt.addTrigger(TriggerDefinition30_50.convertTriggerDefinition(t));
582    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition())
583      tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
584    for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput())
585      tgt.addInput(wrapInput(DataRequirement30_50.convertDataRequirement(t)));
586    for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput())
587      tgt.addOutput(wrapOutput(DataRequirement30_50.convertDataRequirement(t)));
588    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction())
589      tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
590    if (src.hasTiming())
591      tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
592    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant())
593      tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t));
594    if (src.hasType())
595      tgt.getType().addCoding(Coding30_50.convertCoding(src.getType()));
596    if (src.hasGroupingBehavior())
597      tgt.setGroupingBehaviorElement(convertActionGroupingBehavior(src.getGroupingBehaviorElement()));
598    if (src.hasSelectionBehavior())
599      tgt.setSelectionBehaviorElement(convertActionSelectionBehavior(src.getSelectionBehaviorElement()));
600    if (src.hasRequiredBehavior())
601      tgt.setRequiredBehaviorElement(convertActionRequiredBehavior(src.getRequiredBehaviorElement()));
602    if (src.hasPrecheckBehavior())
603      tgt.setPrecheckBehaviorElement(convertActionPrecheckBehavior(src.getPrecheckBehaviorElement()));
604    if (src.hasCardinalityBehavior())
605      tgt.setCardinalityBehaviorElement(convertActionCardinalityBehavior(src.getCardinalityBehaviorElement()));
606    if (src.hasDefinition())
607      tgt.setDefinition(Reference30_50.convertReferenceToCanonical(src.getDefinition()));
608    if (src.hasTransform())
609      tgt.setTransformElement(Reference30_50.convertReferenceToCanonical(src.getTransform()));
610    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue())
611      tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t));
612    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
613      tgt.addAction(convertPlanDefinitionActionComponent(t));
614    return tgt;
615  }
616
617  private static PlanDefinitionActionOutputComponent wrapOutput(DataRequirement dr) {
618    return new PlanDefinitionActionOutputComponent().setRequirement(dr);
619  }
620
621  private static PlanDefinitionActionInputComponent wrapInput(DataRequirement dr) {
622    return new PlanDefinitionActionInputComponent().setRequirement(dr);
623  }
624
625  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
626    if (src == null)
627      return null;
628    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent();
629    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
630    if (src.hasPrefix())
631      tgt.setLabelElement(String30_50.convertString(src.getPrefixElement()));
632    if (src.hasTitle())
633      tgt.setTitleElement(String30_50.convertString(src.getTitleElement()));
634    if (src.hasDescription())
635      tgt.setDescriptionElement(String30_50.convertString(src.getDescriptionElement()));
636    if (src.hasTextEquivalent())
637      tgt.setTextEquivalentElement(String30_50.convertString(src.getTextEquivalentElement()));
638    if (src.hasCode()) tgt.addCode(CodeableConcept30_50.convertCodeableConcept(src.getCode()));
639    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason())
640      tgt.addReason(CodeableConcept30_50.convertCodeableConcept(t));
641    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation())
642      tgt.addDocumentation(RelatedArtifact30_50.convertRelatedArtifact(t));
643    for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue());
644    for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger())
645      tgt.addTriggerDefinition(TriggerDefinition30_50.convertTriggerDefinition(t));
646    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition())
647      tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
648    for (PlanDefinitionActionInputComponent t : src.getInput())
649      tgt.addInput(DataRequirement30_50.convertDataRequirement(t.getRequirement()));
650    for (PlanDefinitionActionOutputComponent t : src.getOutput())
651      tgt.addOutput(DataRequirement30_50.convertDataRequirement(t.getRequirement()));
652    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction())
653      tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
654    if (src.hasTiming())
655      tgt.setTiming(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getTiming()));
656    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent t : src.getParticipant())
657      tgt.addParticipant(convertPlanDefinitionActionParticipantComponent(t));
658    if (src.hasType())
659      tgt.setType(Coding30_50.convertCoding(src.getType().getCodingFirstRep()));
660    if (src.hasGroupingBehavior())
661      tgt.setGroupingBehaviorElement(convertActionGroupingBehavior(src.getGroupingBehaviorElement()));
662    if (src.hasSelectionBehavior())
663      tgt.setSelectionBehaviorElement(convertActionSelectionBehavior(src.getSelectionBehaviorElement()));
664    if (src.hasRequiredBehavior())
665      tgt.setRequiredBehaviorElement(convertActionRequiredBehavior(src.getRequiredBehaviorElement()));
666    if (src.hasPrecheckBehavior())
667      tgt.setPrecheckBehaviorElement(convertActionPrecheckBehavior(src.getPrecheckBehaviorElement()));
668    if (src.hasCardinalityBehavior())
669      tgt.setCardinalityBehaviorElement(convertActionCardinalityBehavior(src.getCardinalityBehaviorElement()));
670    if (src.hasDefinitionCanonicalType())
671      tgt.setDefinition(Reference30_50.convertCanonicalToReference(src.getDefinitionCanonicalType()));
672    if (src.hasTransform())
673      tgt.setTransform(Reference30_50.convertCanonicalToReference(src.getTransformElement()));
674    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent t : src.getDynamicValue())
675      tgt.addDynamicValue(convertPlanDefinitionActionDynamicValueComponent(t));
676    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent t : src.getAction())
677      tgt.addAction(convertPlanDefinitionActionComponent(t));
678    return tgt;
679  }
680
681  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException {
682    if (src == null)
683      return null;
684    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent();
685    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
686    if (src.hasKind())
687      tgt.setKindElement(convertActionConditionKind(src.getKindElement()));
688    if (src.hasDescription())
689      tgt.getExpression().setDescription(src.getDescription());
690    if (src.hasLanguage())
691      tgt.getExpression().setLanguage(src.getLanguage());
692    if (src.hasExpression())
693      tgt.getExpression().setExpression(src.getExpression());
694    return tgt;
695  }
696
697  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent convertPlanDefinitionActionConditionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent src) throws FHIRException {
698    if (src == null)
699      return null;
700    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent();
701    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
702    if (src.hasKind())
703      tgt.setKindElement(convertActionConditionKind(src.getKindElement()));
704    if (src.getExpression().hasDescription())
705      tgt.setDescription(src.getExpression().getDescription());
706    if (src.getExpression().hasLanguage())
707      tgt.setLanguage(src.getExpression().getLanguage());
708    if (src.getExpression().hasExpression())
709      tgt.setExpression(src.getExpression().getExpression());
710    return tgt;
711  }
712
713  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException {
714    if (src == null)
715      return null;
716    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent();
717    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
718    if (src.getExpression().hasDescription())
719      tgt.setDescription(src.getExpression().getDescription());
720    if (src.hasPath())
721      tgt.setPathElement(String30_50.convertString(src.getPathElement()));
722    if (src.getExpression().hasLanguage())
723      tgt.setLanguage(src.getExpression().getLanguage());
724    if (src.getExpression().hasExpression())
725      tgt.setExpression(src.getExpression().getExpression());
726    return tgt;
727  }
728
729  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent convertPlanDefinitionActionDynamicValueComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent src) throws FHIRException {
730    if (src == null)
731      return null;
732    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionDynamicValueComponent();
733    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
734    if (src.hasDescription())
735      tgt.getExpression().setDescription(src.getDescription());
736    if (src.hasPath())
737      tgt.setPathElement(String30_50.convertString(src.getPathElement()));
738    if (src.hasLanguage())
739      tgt.getExpression().setLanguage(src.getLanguage());
740    if (src.hasExpression())
741      tgt.getExpression().setExpression(src.getExpression());
742    return tgt;
743  }
744
745  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException {
746    if (src == null)
747      return null;
748    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent();
749    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
750    if (src.hasType())
751      tgt.setTypeElement(convertActionParticipantType(src.getTypeElement()));
752    if (src.hasRole())
753      tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole()));
754    return tgt;
755  }
756
757  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent convertPlanDefinitionActionParticipantComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionParticipantComponent src) throws FHIRException {
758    if (src == null)
759      return null;
760    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionParticipantComponent();
761    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
762    if (src.hasType())
763      tgt.setTypeElement(convertActionParticipantType(src.getTypeElement()));
764    if (src.hasRole())
765      tgt.setRole(CodeableConcept30_50.convertCodeableConcept(src.getRole()));
766    return tgt;
767  }
768
769  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException {
770    if (src == null)
771      return null;
772    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
773    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
774    if (src.hasTargetId())
775      tgt.setActionIdElement(Id30_50.convertId(src.getTargetIdElement()));
776    if (src.hasRelationship())
777      tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
778    if (src.hasOffset())
779      tgt.setOffset(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getOffset()));
780    return tgt;
781  }
782
783  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent convertPlanDefinitionActionRelatedActionComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent src) throws FHIRException {
784    if (src == null)
785      return null;
786    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
787    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
788    if (src.hasActionId())
789      tgt.setTargetIdElement(Id30_50.convertId(src.getActionIdElement()));
790    if (src.hasRelationship())
791      tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
792    if (src.hasOffset())
793      tgt.setOffset(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getOffset()));
794    return tgt;
795  }
796
797  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException {
798    if (src == null)
799      return null;
800    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent();
801    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
802    if (src.hasCategory())
803      tgt.setCategory(CodeableConcept30_50.convertCodeableConcept(src.getCategory()));
804    if (src.hasDescription())
805      tgt.setDescription(CodeableConcept30_50.convertCodeableConcept(src.getDescription()));
806    if (src.hasPriority())
807      tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority()));
808    if (src.hasStart())
809      tgt.setStart(CodeableConcept30_50.convertCodeableConcept(src.getStart()));
810    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAddresses())
811      tgt.addAddresses(CodeableConcept30_50.convertCodeableConcept(t));
812    for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation())
813      tgt.addDocumentation(RelatedArtifact30_50.convertRelatedArtifact(t));
814    for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget())
815      tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t));
816    return tgt;
817  }
818
819  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent convertPlanDefinitionGoalComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalComponent src) throws FHIRException {
820    if (src == null)
821      return null;
822    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalComponent();
823    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
824    if (src.hasCategory())
825      tgt.setCategory(CodeableConcept30_50.convertCodeableConcept(src.getCategory()));
826    if (src.hasDescription())
827      tgt.setDescription(CodeableConcept30_50.convertCodeableConcept(src.getDescription()));
828    if (src.hasPriority())
829      tgt.setPriority(CodeableConcept30_50.convertCodeableConcept(src.getPriority()));
830    if (src.hasStart())
831      tgt.setStart(CodeableConcept30_50.convertCodeableConcept(src.getStart()));
832    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAddresses())
833      tgt.addAddresses(CodeableConcept30_50.convertCodeableConcept(t));
834    for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation())
835      tgt.addDocumentation(RelatedArtifact30_50.convertRelatedArtifact(t));
836    for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent t : src.getTarget())
837      tgt.addTarget(convertPlanDefinitionGoalTargetComponent(t));
838    return tgt;
839  }
840
841  public static org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException {
842    if (src == null)
843      return null;
844    org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent();
845    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
846    if (src.hasMeasure())
847      tgt.setMeasure(CodeableConcept30_50.convertCodeableConcept(src.getMeasure()));
848    if (src.hasDetail())
849      tgt.setDetail(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getDetail()));
850    if (src.hasDue())
851      tgt.setDue(Duration30_50.convertDuration(src.getDue()));
852    return tgt;
853  }
854
855  public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent convertPlanDefinitionGoalTargetComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionGoalTargetComponent src) throws FHIRException {
856    if (src == null)
857      return null;
858    org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionGoalTargetComponent();
859    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
860    if (src.hasMeasure())
861      tgt.setMeasure(CodeableConcept30_50.convertCodeableConcept(src.getMeasure()));
862    if (src.hasDetail())
863      tgt.setDetail(ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().convertType(src.getDetail()));
864    if (src.hasDue())
865      tgt.setDue(Duration30_50.convertDuration(src.getDue()));
866    return tgt;
867  }
868}