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