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