001package org.hl7.fhir.convertors.conv40_50.resources40_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext40_50;
004import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Annotation40_50;
005import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
006import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
007import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Period40_50;
008import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.*;
009import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
010import org.hl7.fhir.exceptions.FHIRException;
011
012/*
013  Copyright (c) 2011+, HL7, Inc.
014  All rights reserved.
015  
016  Redistribution and use in source and binary forms, with or without modification, 
017  are permitted provided that the following conditions are met:
018  
019   * Redistributions of source code must retain the above copyright notice, this 
020     list of conditions and the following disclaimer.
021   * Redistributions in binary form must reproduce the above copyright notice, 
022     this list of conditions and the following disclaimer in the documentation 
023     and/or other materials provided with the distribution.
024   * Neither the name of HL7 nor the names of its contributors may be used to 
025     endorse or promote products derived from this software without specific 
026     prior written permission.
027  
028  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
029  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
030  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
031  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
032  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
033  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
034  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
035  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
036  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
037  POSSIBILITY OF SUCH DAMAGE.
038  
039*/
040// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
041public class Task40_50 {
042
043  public static org.hl7.fhir.r5.model.Task convertTask(org.hl7.fhir.r4.model.Task src) throws FHIRException {
044    if (src == null)
045      return null;
046    org.hl7.fhir.r5.model.Task tgt = new org.hl7.fhir.r5.model.Task();
047    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
048    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
049      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
050    if (src.hasInstantiatesCanonical())
051      tgt.setInstantiatesCanonicalElement(Canonical40_50.convertCanonical(src.getInstantiatesCanonicalElement()));
052    if (src.hasInstantiatesUri())
053      tgt.setInstantiatesUriElement(Uri40_50.convertUri(src.getInstantiatesUriElement()));
054    for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference40_50.convertReference(t));
055    if (src.hasGroupIdentifier())
056      tgt.setGroupIdentifier(Identifier40_50.convertIdentifier(src.getGroupIdentifier()));
057    for (org.hl7.fhir.r4.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference40_50.convertReference(t));
058    if (src.hasStatus())
059      tgt.setStatusElement(convertTaskStatus(src.getStatusElement()));
060    if (src.hasStatusReason())
061      tgt.setStatusReason(CodeableConcept40_50.convertCodeableConcept(src.getStatusReason()));
062    if (src.hasBusinessStatus())
063      tgt.setBusinessStatus(CodeableConcept40_50.convertCodeableConcept(src.getBusinessStatus()));
064    if (src.hasIntent())
065      tgt.setIntentElement(convertTaskIntent(src.getIntentElement()));
066    if (src.hasPriority())
067      tgt.setPriorityElement(convertTaskPriority(src.getPriorityElement()));
068    if (src.hasCode())
069      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
070    if (src.hasDescription())
071      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
072    if (src.hasFocus())
073      tgt.setFocus(Reference40_50.convertReference(src.getFocus()));
074    if (src.hasFor())
075      tgt.setFor(Reference40_50.convertReference(src.getFor()));
076    if (src.hasEncounter())
077      tgt.setEncounter(Reference40_50.convertReference(src.getEncounter()));
078    if (src.hasExecutionPeriod())
079      tgt.setExecutionPeriod(Period40_50.convertPeriod(src.getExecutionPeriod()));
080    if (src.hasAuthoredOn())
081      tgt.setAuthoredOnElement(DateTime40_50.convertDateTime(src.getAuthoredOnElement()));
082    if (src.hasLastModified())
083      tgt.setLastModifiedElement(DateTime40_50.convertDateTime(src.getLastModifiedElement()));
084    if (src.hasRequester())
085      tgt.setRequester(Reference40_50.convertReference(src.getRequester()));
086    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getPerformerType())
087      tgt.addPerformerType(CodeableConcept40_50.convertCodeableConcept(t));
088    if (src.hasOwner())
089      tgt.setOwner(Reference40_50.convertReference(src.getOwner()));
090    if (src.hasLocation())
091      tgt.setLocation(Reference40_50.convertReference(src.getLocation()));
092    if (src.hasReasonCode())
093      tgt.setReasonCode(CodeableConcept40_50.convertCodeableConcept(src.getReasonCode()));
094    if (src.hasReasonReference())
095      tgt.setReasonReference(Reference40_50.convertReference(src.getReasonReference()));
096    for (org.hl7.fhir.r4.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference40_50.convertReference(t));
097    for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
098    for (org.hl7.fhir.r4.model.Reference t : src.getRelevantHistory())
099      tgt.addRelevantHistory(Reference40_50.convertReference(t));
100    if (src.hasRestriction())
101      tgt.setRestriction(convertTaskRestrictionComponent(src.getRestriction()));
102    for (org.hl7.fhir.r4.model.Task.ParameterComponent t : src.getInput()) tgt.addInput(convertParameterComponent(t));
103    for (org.hl7.fhir.r4.model.Task.TaskOutputComponent t : src.getOutput())
104      tgt.addOutput(convertTaskOutputComponent(t));
105    return tgt;
106  }
107
108  public static org.hl7.fhir.r4.model.Task convertTask(org.hl7.fhir.r5.model.Task src) throws FHIRException {
109    if (src == null)
110      return null;
111    org.hl7.fhir.r4.model.Task tgt = new org.hl7.fhir.r4.model.Task();
112    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
113    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
114      tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
115    if (src.hasInstantiatesCanonical())
116      tgt.setInstantiatesCanonicalElement(Canonical40_50.convertCanonical(src.getInstantiatesCanonicalElement()));
117    if (src.hasInstantiatesUri())
118      tgt.setInstantiatesUriElement(Uri40_50.convertUri(src.getInstantiatesUriElement()));
119    for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(Reference40_50.convertReference(t));
120    if (src.hasGroupIdentifier())
121      tgt.setGroupIdentifier(Identifier40_50.convertIdentifier(src.getGroupIdentifier()));
122    for (org.hl7.fhir.r5.model.Reference t : src.getPartOf()) tgt.addPartOf(Reference40_50.convertReference(t));
123    if (src.hasStatus())
124      tgt.setStatusElement(convertTaskStatus(src.getStatusElement()));
125    if (src.hasStatusReason())
126      tgt.setStatusReason(CodeableConcept40_50.convertCodeableConcept(src.getStatusReason()));
127    if (src.hasBusinessStatus())
128      tgt.setBusinessStatus(CodeableConcept40_50.convertCodeableConcept(src.getBusinessStatus()));
129    if (src.hasIntent())
130      tgt.setIntentElement(convertTaskIntent(src.getIntentElement()));
131    if (src.hasPriority())
132      tgt.setPriorityElement(convertTaskPriority(src.getPriorityElement()));
133    if (src.hasCode())
134      tgt.setCode(CodeableConcept40_50.convertCodeableConcept(src.getCode()));
135    if (src.hasDescription())
136      tgt.setDescriptionElement(String40_50.convertString(src.getDescriptionElement()));
137    if (src.hasFocus())
138      tgt.setFocus(Reference40_50.convertReference(src.getFocus()));
139    if (src.hasFor())
140      tgt.setFor(Reference40_50.convertReference(src.getFor()));
141    if (src.hasEncounter())
142      tgt.setEncounter(Reference40_50.convertReference(src.getEncounter()));
143    if (src.hasExecutionPeriod())
144      tgt.setExecutionPeriod(Period40_50.convertPeriod(src.getExecutionPeriod()));
145    if (src.hasAuthoredOn())
146      tgt.setAuthoredOnElement(DateTime40_50.convertDateTime(src.getAuthoredOnElement()));
147    if (src.hasLastModified())
148      tgt.setLastModifiedElement(DateTime40_50.convertDateTime(src.getLastModifiedElement()));
149    if (src.hasRequester())
150      tgt.setRequester(Reference40_50.convertReference(src.getRequester()));
151    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPerformerType())
152      tgt.addPerformerType(CodeableConcept40_50.convertCodeableConcept(t));
153    if (src.hasOwner())
154      tgt.setOwner(Reference40_50.convertReference(src.getOwner()));
155    if (src.hasLocation())
156      tgt.setLocation(Reference40_50.convertReference(src.getLocation()));
157    if (src.hasReasonCode())
158      tgt.setReasonCode(CodeableConcept40_50.convertCodeableConcept(src.getReasonCode()));
159    if (src.hasReasonReference())
160      tgt.setReasonReference(Reference40_50.convertReference(src.getReasonReference()));
161    for (org.hl7.fhir.r5.model.Reference t : src.getInsurance()) tgt.addInsurance(Reference40_50.convertReference(t));
162    for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(Annotation40_50.convertAnnotation(t));
163    for (org.hl7.fhir.r5.model.Reference t : src.getRelevantHistory())
164      tgt.addRelevantHistory(Reference40_50.convertReference(t));
165    if (src.hasRestriction())
166      tgt.setRestriction(convertTaskRestrictionComponent(src.getRestriction()));
167    for (org.hl7.fhir.r5.model.Task.ParameterComponent t : src.getInput()) tgt.addInput(convertParameterComponent(t));
168    for (org.hl7.fhir.r5.model.Task.TaskOutputComponent t : src.getOutput())
169      tgt.addOutput(convertTaskOutputComponent(t));
170    return tgt;
171  }
172
173  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskStatus> convertTaskStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskStatus> src) throws FHIRException {
174    if (src == null || src.isEmpty())
175      return null;
176    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Task.TaskStatusEnumFactory());
177    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
178    switch (src.getValue()) {
179      case DRAFT:
180        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.DRAFT);
181        break;
182      case REQUESTED:
183        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.REQUESTED);
184        break;
185      case RECEIVED:
186        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.RECEIVED);
187        break;
188      case ACCEPTED:
189        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.ACCEPTED);
190        break;
191      case REJECTED:
192        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.REJECTED);
193        break;
194      case READY:
195        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.READY);
196        break;
197      case CANCELLED:
198        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.CANCELLED);
199        break;
200      case INPROGRESS:
201        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.INPROGRESS);
202        break;
203      case ONHOLD:
204        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.ONHOLD);
205        break;
206      case FAILED:
207        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.FAILED);
208        break;
209      case COMPLETED:
210        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.COMPLETED);
211        break;
212      case ENTEREDINERROR:
213        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.ENTEREDINERROR);
214        break;
215      default:
216        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskStatus.NULL);
217        break;
218    }
219    return tgt;
220  }
221
222  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskStatus> convertTaskStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskStatus> src) throws FHIRException {
223    if (src == null || src.isEmpty())
224      return null;
225    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Task.TaskStatusEnumFactory());
226    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
227    switch (src.getValue()) {
228      case DRAFT:
229        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.DRAFT);
230        break;
231      case REQUESTED:
232        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.REQUESTED);
233        break;
234      case RECEIVED:
235        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.RECEIVED);
236        break;
237      case ACCEPTED:
238        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.ACCEPTED);
239        break;
240      case REJECTED:
241        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.REJECTED);
242        break;
243      case READY:
244        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.READY);
245        break;
246      case CANCELLED:
247        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.CANCELLED);
248        break;
249      case INPROGRESS:
250        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.INPROGRESS);
251        break;
252      case ONHOLD:
253        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.ONHOLD);
254        break;
255      case FAILED:
256        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.FAILED);
257        break;
258      case COMPLETED:
259        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.COMPLETED);
260        break;
261      case ENTEREDINERROR:
262        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.ENTEREDINERROR);
263        break;
264      default:
265        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskStatus.NULL);
266        break;
267    }
268    return tgt;
269  }
270
271  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskIntent> convertTaskIntent(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskIntent> src) throws FHIRException {
272    if (src == null || src.isEmpty())
273      return null;
274    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskIntent> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Task.TaskIntentEnumFactory());
275    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
276    switch (src.getValue()) {
277      case UNKNOWN:
278        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.UNKNOWN);
279        break;
280      case PROPOSAL:
281        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.PROPOSAL);
282        break;
283      case PLAN:
284        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.PLAN);
285        break;
286      case ORDER:
287        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.ORDER);
288        break;
289      case ORIGINALORDER:
290        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.ORIGINALORDER);
291        break;
292      case REFLEXORDER:
293        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.REFLEXORDER);
294        break;
295      case FILLERORDER:
296        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.FILLERORDER);
297        break;
298      case INSTANCEORDER:
299        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.INSTANCEORDER);
300        break;
301      case OPTION:
302        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.OPTION);
303        break;
304      default:
305        tgt.setValue(org.hl7.fhir.r5.model.Task.TaskIntent.NULL);
306        break;
307    }
308    return tgt;
309  }
310
311  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskIntent> convertTaskIntent(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Task.TaskIntent> src) throws FHIRException {
312    if (src == null || src.isEmpty())
313      return null;
314    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskIntent> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Task.TaskIntentEnumFactory());
315    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
316    switch (src.getValue()) {
317      case UNKNOWN:
318        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.UNKNOWN);
319        break;
320      case PROPOSAL:
321        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.PROPOSAL);
322        break;
323      case PLAN:
324        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.PLAN);
325        break;
326      case ORDER:
327        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.ORDER);
328        break;
329      case ORIGINALORDER:
330        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.ORIGINALORDER);
331        break;
332      case REFLEXORDER:
333        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.REFLEXORDER);
334        break;
335      case FILLERORDER:
336        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.FILLERORDER);
337        break;
338      case INSTANCEORDER:
339        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.INSTANCEORDER);
340        break;
341      case OPTION:
342        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.OPTION);
343        break;
344      default:
345        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskIntent.NULL);
346        break;
347    }
348    return tgt;
349  }
350
351  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> convertTaskPriority(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskPriority> src) throws FHIRException {
352    if (src == null || src.isEmpty())
353      return null;
354    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestPriorityEnumFactory());
355    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
356    switch (src.getValue()) {
357      case ROUTINE:
358        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE);
359        break;
360      case URGENT:
361        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT);
362        break;
363      case ASAP:
364        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP);
365        break;
366      case STAT:
367        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT);
368        break;
369      default:
370        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL);
371        break;
372    }
373    return tgt;
374  }
375
376  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskPriority> convertTaskPriority(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.RequestPriority> src) throws FHIRException {
377    if (src == null || src.isEmpty())
378      return null;
379    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Task.TaskPriority> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Task.TaskPriorityEnumFactory());
380    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
381    switch (src.getValue()) {
382      case ROUTINE:
383        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskPriority.ROUTINE);
384        break;
385      case URGENT:
386        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskPriority.URGENT);
387        break;
388      case ASAP:
389        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskPriority.ASAP);
390        break;
391      case STAT:
392        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskPriority.STAT);
393        break;
394      default:
395        tgt.setValue(org.hl7.fhir.r4.model.Task.TaskPriority.NULL);
396        break;
397    }
398    return tgt;
399  }
400
401  public static org.hl7.fhir.r5.model.Task.TaskRestrictionComponent convertTaskRestrictionComponent(org.hl7.fhir.r4.model.Task.TaskRestrictionComponent src) throws FHIRException {
402    if (src == null)
403      return null;
404    org.hl7.fhir.r5.model.Task.TaskRestrictionComponent tgt = new org.hl7.fhir.r5.model.Task.TaskRestrictionComponent();
405    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
406    if (src.hasRepetitions())
407      tgt.setRepetitionsElement(PositiveInt40_50.convertPositiveInt(src.getRepetitionsElement()));
408    if (src.hasPeriod())
409      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
410    for (org.hl7.fhir.r4.model.Reference t : src.getRecipient()) tgt.addRecipient(Reference40_50.convertReference(t));
411    return tgt;
412  }
413
414  public static org.hl7.fhir.r4.model.Task.TaskRestrictionComponent convertTaskRestrictionComponent(org.hl7.fhir.r5.model.Task.TaskRestrictionComponent src) throws FHIRException {
415    if (src == null)
416      return null;
417    org.hl7.fhir.r4.model.Task.TaskRestrictionComponent tgt = new org.hl7.fhir.r4.model.Task.TaskRestrictionComponent();
418    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
419    if (src.hasRepetitions())
420      tgt.setRepetitionsElement(PositiveInt40_50.convertPositiveInt(src.getRepetitionsElement()));
421    if (src.hasPeriod())
422      tgt.setPeriod(Period40_50.convertPeriod(src.getPeriod()));
423    for (org.hl7.fhir.r5.model.Reference t : src.getRecipient()) tgt.addRecipient(Reference40_50.convertReference(t));
424    return tgt;
425  }
426
427  public static org.hl7.fhir.r5.model.Task.ParameterComponent convertParameterComponent(org.hl7.fhir.r4.model.Task.ParameterComponent src) throws FHIRException {
428    if (src == null)
429      return null;
430    org.hl7.fhir.r5.model.Task.ParameterComponent tgt = new org.hl7.fhir.r5.model.Task.ParameterComponent();
431    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
432    if (src.hasType())
433      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
434    if (src.hasValue())
435      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
436    return tgt;
437  }
438
439  public static org.hl7.fhir.r4.model.Task.ParameterComponent convertParameterComponent(org.hl7.fhir.r5.model.Task.ParameterComponent src) throws FHIRException {
440    if (src == null)
441      return null;
442    org.hl7.fhir.r4.model.Task.ParameterComponent tgt = new org.hl7.fhir.r4.model.Task.ParameterComponent();
443    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
444    if (src.hasType())
445      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
446    if (src.hasValue())
447      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
448    return tgt;
449  }
450
451  public static org.hl7.fhir.r5.model.Task.TaskOutputComponent convertTaskOutputComponent(org.hl7.fhir.r4.model.Task.TaskOutputComponent src) throws FHIRException {
452    if (src == null)
453      return null;
454    org.hl7.fhir.r5.model.Task.TaskOutputComponent tgt = new org.hl7.fhir.r5.model.Task.TaskOutputComponent();
455    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
456    if (src.hasType())
457      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
458    if (src.hasValue())
459      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
460    return tgt;
461  }
462
463  public static org.hl7.fhir.r4.model.Task.TaskOutputComponent convertTaskOutputComponent(org.hl7.fhir.r5.model.Task.TaskOutputComponent src) throws FHIRException {
464    if (src == null)
465      return null;
466    org.hl7.fhir.r4.model.Task.TaskOutputComponent tgt = new org.hl7.fhir.r4.model.Task.TaskOutputComponent();
467    ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
468    if (src.hasType())
469      tgt.setType(CodeableConcept40_50.convertCodeableConcept(src.getType()));
470    if (src.hasValue())
471      tgt.setValue(ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().convertType(src.getValue()));
472    return tgt;
473  }
474}