001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A task to be performed.
047 */
048@ResourceDef(name="Task", profile="http://hl7.org/fhir/StructureDefinition/Task")
049public class Task extends DomainResource {
050
051    public enum TaskStatus {
052        /**
053         * The task is not yet ready to be acted upon.
054         */
055        DRAFT, 
056        /**
057         * The task is ready to be acted upon and action is sought.
058         */
059        REQUESTED, 
060        /**
061         * A potential performer has claimed ownership of the task and is evaluating whether to perform it.
062         */
063        RECEIVED, 
064        /**
065         * The potential performer has agreed to execute the task but has not yet started work.
066         */
067        ACCEPTED, 
068        /**
069         * The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.
070         */
071        REJECTED, 
072        /**
073         * The task is ready to be performed, but no action has yet been taken.  Used in place of requested/received/accepted/rejected when request assignment and acceptance is a given.
074         */
075        READY, 
076        /**
077         * The task was not completed.
078         */
079        CANCELLED, 
080        /**
081         * The task has been started but is not yet complete.
082         */
083        INPROGRESS, 
084        /**
085         * The task has been started but work has been paused.
086         */
087        ONHOLD, 
088        /**
089         * The task was attempted but could not be completed due to some error.
090         */
091        FAILED, 
092        /**
093         * The task has been completed.
094         */
095        COMPLETED, 
096        /**
097         * The task should never have existed and is retained only because of the possibility it may have used.
098         */
099        ENTEREDINERROR, 
100        /**
101         * added to help the parsers with the generic types
102         */
103        NULL;
104        public static TaskStatus fromCode(String codeString) throws FHIRException {
105            if (codeString == null || "".equals(codeString))
106                return null;
107        if ("draft".equals(codeString))
108          return DRAFT;
109        if ("requested".equals(codeString))
110          return REQUESTED;
111        if ("received".equals(codeString))
112          return RECEIVED;
113        if ("accepted".equals(codeString))
114          return ACCEPTED;
115        if ("rejected".equals(codeString))
116          return REJECTED;
117        if ("ready".equals(codeString))
118          return READY;
119        if ("cancelled".equals(codeString))
120          return CANCELLED;
121        if ("in-progress".equals(codeString))
122          return INPROGRESS;
123        if ("on-hold".equals(codeString))
124          return ONHOLD;
125        if ("failed".equals(codeString))
126          return FAILED;
127        if ("completed".equals(codeString))
128          return COMPLETED;
129        if ("entered-in-error".equals(codeString))
130          return ENTEREDINERROR;
131        if (Configuration.isAcceptInvalidEnums())
132          return null;
133        else
134          throw new FHIRException("Unknown TaskStatus code '"+codeString+"'");
135        }
136        public String toCode() {
137          switch (this) {
138            case DRAFT: return "draft";
139            case REQUESTED: return "requested";
140            case RECEIVED: return "received";
141            case ACCEPTED: return "accepted";
142            case REJECTED: return "rejected";
143            case READY: return "ready";
144            case CANCELLED: return "cancelled";
145            case INPROGRESS: return "in-progress";
146            case ONHOLD: return "on-hold";
147            case FAILED: return "failed";
148            case COMPLETED: return "completed";
149            case ENTEREDINERROR: return "entered-in-error";
150            default: return "?";
151          }
152        }
153        public String getSystem() {
154          switch (this) {
155            case DRAFT: return "http://hl7.org/fhir/task-status";
156            case REQUESTED: return "http://hl7.org/fhir/task-status";
157            case RECEIVED: return "http://hl7.org/fhir/task-status";
158            case ACCEPTED: return "http://hl7.org/fhir/task-status";
159            case REJECTED: return "http://hl7.org/fhir/task-status";
160            case READY: return "http://hl7.org/fhir/task-status";
161            case CANCELLED: return "http://hl7.org/fhir/task-status";
162            case INPROGRESS: return "http://hl7.org/fhir/task-status";
163            case ONHOLD: return "http://hl7.org/fhir/task-status";
164            case FAILED: return "http://hl7.org/fhir/task-status";
165            case COMPLETED: return "http://hl7.org/fhir/task-status";
166            case ENTEREDINERROR: return "http://hl7.org/fhir/task-status";
167            default: return "?";
168          }
169        }
170        public String getDefinition() {
171          switch (this) {
172            case DRAFT: return "The task is not yet ready to be acted upon.";
173            case REQUESTED: return "The task is ready to be acted upon and action is sought.";
174            case RECEIVED: return "A potential performer has claimed ownership of the task and is evaluating whether to perform it.";
175            case ACCEPTED: return "The potential performer has agreed to execute the task but has not yet started work.";
176            case REJECTED: return "The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.";
177            case READY: return "The task is ready to be performed, but no action has yet been taken.  Used in place of requested/received/accepted/rejected when request assignment and acceptance is a given.";
178            case CANCELLED: return "The task was not completed.";
179            case INPROGRESS: return "The task has been started but is not yet complete.";
180            case ONHOLD: return "The task has been started but work has been paused.";
181            case FAILED: return "The task was attempted but could not be completed due to some error.";
182            case COMPLETED: return "The task has been completed.";
183            case ENTEREDINERROR: return "The task should never have existed and is retained only because of the possibility it may have used.";
184            default: return "?";
185          }
186        }
187        public String getDisplay() {
188          switch (this) {
189            case DRAFT: return "Draft";
190            case REQUESTED: return "Requested";
191            case RECEIVED: return "Received";
192            case ACCEPTED: return "Accepted";
193            case REJECTED: return "Rejected";
194            case READY: return "Ready";
195            case CANCELLED: return "Cancelled";
196            case INPROGRESS: return "In Progress";
197            case ONHOLD: return "On Hold";
198            case FAILED: return "Failed";
199            case COMPLETED: return "Completed";
200            case ENTEREDINERROR: return "Entered in Error";
201            default: return "?";
202          }
203        }
204    }
205
206  public static class TaskStatusEnumFactory implements EnumFactory<TaskStatus> {
207    public TaskStatus fromCode(String codeString) throws IllegalArgumentException {
208      if (codeString == null || "".equals(codeString))
209            if (codeString == null || "".equals(codeString))
210                return null;
211        if ("draft".equals(codeString))
212          return TaskStatus.DRAFT;
213        if ("requested".equals(codeString))
214          return TaskStatus.REQUESTED;
215        if ("received".equals(codeString))
216          return TaskStatus.RECEIVED;
217        if ("accepted".equals(codeString))
218          return TaskStatus.ACCEPTED;
219        if ("rejected".equals(codeString))
220          return TaskStatus.REJECTED;
221        if ("ready".equals(codeString))
222          return TaskStatus.READY;
223        if ("cancelled".equals(codeString))
224          return TaskStatus.CANCELLED;
225        if ("in-progress".equals(codeString))
226          return TaskStatus.INPROGRESS;
227        if ("on-hold".equals(codeString))
228          return TaskStatus.ONHOLD;
229        if ("failed".equals(codeString))
230          return TaskStatus.FAILED;
231        if ("completed".equals(codeString))
232          return TaskStatus.COMPLETED;
233        if ("entered-in-error".equals(codeString))
234          return TaskStatus.ENTEREDINERROR;
235        throw new IllegalArgumentException("Unknown TaskStatus code '"+codeString+"'");
236        }
237        public Enumeration<TaskStatus> fromType(Base code) throws FHIRException {
238          if (code == null)
239            return null;
240          if (code.isEmpty())
241            return new Enumeration<TaskStatus>(this);
242          String codeString = ((PrimitiveType) code).asStringValue();
243          if (codeString == null || "".equals(codeString))
244            return null;
245        if ("draft".equals(codeString))
246          return new Enumeration<TaskStatus>(this, TaskStatus.DRAFT);
247        if ("requested".equals(codeString))
248          return new Enumeration<TaskStatus>(this, TaskStatus.REQUESTED);
249        if ("received".equals(codeString))
250          return new Enumeration<TaskStatus>(this, TaskStatus.RECEIVED);
251        if ("accepted".equals(codeString))
252          return new Enumeration<TaskStatus>(this, TaskStatus.ACCEPTED);
253        if ("rejected".equals(codeString))
254          return new Enumeration<TaskStatus>(this, TaskStatus.REJECTED);
255        if ("ready".equals(codeString))
256          return new Enumeration<TaskStatus>(this, TaskStatus.READY);
257        if ("cancelled".equals(codeString))
258          return new Enumeration<TaskStatus>(this, TaskStatus.CANCELLED);
259        if ("in-progress".equals(codeString))
260          return new Enumeration<TaskStatus>(this, TaskStatus.INPROGRESS);
261        if ("on-hold".equals(codeString))
262          return new Enumeration<TaskStatus>(this, TaskStatus.ONHOLD);
263        if ("failed".equals(codeString))
264          return new Enumeration<TaskStatus>(this, TaskStatus.FAILED);
265        if ("completed".equals(codeString))
266          return new Enumeration<TaskStatus>(this, TaskStatus.COMPLETED);
267        if ("entered-in-error".equals(codeString))
268          return new Enumeration<TaskStatus>(this, TaskStatus.ENTEREDINERROR);
269        throw new FHIRException("Unknown TaskStatus code '"+codeString+"'");
270        }
271    public String toCode(TaskStatus code) {
272      if (code == TaskStatus.DRAFT)
273        return "draft";
274      if (code == TaskStatus.REQUESTED)
275        return "requested";
276      if (code == TaskStatus.RECEIVED)
277        return "received";
278      if (code == TaskStatus.ACCEPTED)
279        return "accepted";
280      if (code == TaskStatus.REJECTED)
281        return "rejected";
282      if (code == TaskStatus.READY)
283        return "ready";
284      if (code == TaskStatus.CANCELLED)
285        return "cancelled";
286      if (code == TaskStatus.INPROGRESS)
287        return "in-progress";
288      if (code == TaskStatus.ONHOLD)
289        return "on-hold";
290      if (code == TaskStatus.FAILED)
291        return "failed";
292      if (code == TaskStatus.COMPLETED)
293        return "completed";
294      if (code == TaskStatus.ENTEREDINERROR)
295        return "entered-in-error";
296      return "?";
297      }
298    public String toSystem(TaskStatus code) {
299      return code.getSystem();
300      }
301    }
302
303    public enum TaskIntent {
304        /**
305         * The intent is not known.  When dealing with Task, it's not always known (or relevant) how the task was initiated - i.e. whether it was proposed, planned, ordered or just done spontaneously.
306         */
307        UNKNOWN, 
308        /**
309         * null
310         */
311        PROPOSAL, 
312        /**
313         * null
314         */
315        PLAN, 
316        /**
317         * null
318         */
319        ORDER, 
320        /**
321         * null
322         */
323        ORIGINALORDER, 
324        /**
325         * null
326         */
327        REFLEXORDER, 
328        /**
329         * null
330         */
331        FILLERORDER, 
332        /**
333         * null
334         */
335        INSTANCEORDER, 
336        /**
337         * null
338         */
339        OPTION, 
340        /**
341         * added to help the parsers with the generic types
342         */
343        NULL;
344        public static TaskIntent fromCode(String codeString) throws FHIRException {
345            if (codeString == null || "".equals(codeString))
346                return null;
347        if ("unknown".equals(codeString))
348          return UNKNOWN;
349        if ("proposal".equals(codeString))
350          return PROPOSAL;
351        if ("plan".equals(codeString))
352          return PLAN;
353        if ("order".equals(codeString))
354          return ORDER;
355        if ("original-order".equals(codeString))
356          return ORIGINALORDER;
357        if ("reflex-order".equals(codeString))
358          return REFLEXORDER;
359        if ("filler-order".equals(codeString))
360          return FILLERORDER;
361        if ("instance-order".equals(codeString))
362          return INSTANCEORDER;
363        if ("option".equals(codeString))
364          return OPTION;
365        if (Configuration.isAcceptInvalidEnums())
366          return null;
367        else
368          throw new FHIRException("Unknown TaskIntent code '"+codeString+"'");
369        }
370        public String toCode() {
371          switch (this) {
372            case UNKNOWN: return "unknown";
373            case PROPOSAL: return "proposal";
374            case PLAN: return "plan";
375            case ORDER: return "order";
376            case ORIGINALORDER: return "original-order";
377            case REFLEXORDER: return "reflex-order";
378            case FILLERORDER: return "filler-order";
379            case INSTANCEORDER: return "instance-order";
380            case OPTION: return "option";
381            default: return "?";
382          }
383        }
384        public String getSystem() {
385          switch (this) {
386            case UNKNOWN: return "http://hl7.org/fhir/task-intent";
387            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
388            case PLAN: return "http://hl7.org/fhir/request-intent";
389            case ORDER: return "http://hl7.org/fhir/request-intent";
390            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
391            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
392            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
393            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
394            case OPTION: return "http://hl7.org/fhir/request-intent";
395            default: return "?";
396          }
397        }
398        public String getDefinition() {
399          switch (this) {
400            case UNKNOWN: return "The intent is not known.  When dealing with Task, it's not always known (or relevant) how the task was initiated - i.e. whether it was proposed, planned, ordered or just done spontaneously.";
401            case PROPOSAL: return "";
402            case PLAN: return "";
403            case ORDER: return "";
404            case ORIGINALORDER: return "";
405            case REFLEXORDER: return "";
406            case FILLERORDER: return "";
407            case INSTANCEORDER: return "";
408            case OPTION: return "";
409            default: return "?";
410          }
411        }
412        public String getDisplay() {
413          switch (this) {
414            case UNKNOWN: return "Unknown";
415            case PROPOSAL: return "proposal";
416            case PLAN: return "plan";
417            case ORDER: return "order";
418            case ORIGINALORDER: return "original-order";
419            case REFLEXORDER: return "reflex-order";
420            case FILLERORDER: return "filler-order";
421            case INSTANCEORDER: return "instance-order";
422            case OPTION: return "option";
423            default: return "?";
424          }
425        }
426    }
427
428  public static class TaskIntentEnumFactory implements EnumFactory<TaskIntent> {
429    public TaskIntent fromCode(String codeString) throws IllegalArgumentException {
430      if (codeString == null || "".equals(codeString))
431            if (codeString == null || "".equals(codeString))
432                return null;
433        if ("unknown".equals(codeString))
434          return TaskIntent.UNKNOWN;
435        if ("proposal".equals(codeString))
436          return TaskIntent.PROPOSAL;
437        if ("plan".equals(codeString))
438          return TaskIntent.PLAN;
439        if ("order".equals(codeString))
440          return TaskIntent.ORDER;
441        if ("original-order".equals(codeString))
442          return TaskIntent.ORIGINALORDER;
443        if ("reflex-order".equals(codeString))
444          return TaskIntent.REFLEXORDER;
445        if ("filler-order".equals(codeString))
446          return TaskIntent.FILLERORDER;
447        if ("instance-order".equals(codeString))
448          return TaskIntent.INSTANCEORDER;
449        if ("option".equals(codeString))
450          return TaskIntent.OPTION;
451        throw new IllegalArgumentException("Unknown TaskIntent code '"+codeString+"'");
452        }
453        public Enumeration<TaskIntent> fromType(Base code) throws FHIRException {
454          if (code == null)
455            return null;
456          if (code.isEmpty())
457            return new Enumeration<TaskIntent>(this);
458          String codeString = ((PrimitiveType) code).asStringValue();
459          if (codeString == null || "".equals(codeString))
460            return null;
461        if ("unknown".equals(codeString))
462          return new Enumeration<TaskIntent>(this, TaskIntent.UNKNOWN);
463        if ("proposal".equals(codeString))
464          return new Enumeration<TaskIntent>(this, TaskIntent.PROPOSAL);
465        if ("plan".equals(codeString))
466          return new Enumeration<TaskIntent>(this, TaskIntent.PLAN);
467        if ("order".equals(codeString))
468          return new Enumeration<TaskIntent>(this, TaskIntent.ORDER);
469        if ("original-order".equals(codeString))
470          return new Enumeration<TaskIntent>(this, TaskIntent.ORIGINALORDER);
471        if ("reflex-order".equals(codeString))
472          return new Enumeration<TaskIntent>(this, TaskIntent.REFLEXORDER);
473        if ("filler-order".equals(codeString))
474          return new Enumeration<TaskIntent>(this, TaskIntent.FILLERORDER);
475        if ("instance-order".equals(codeString))
476          return new Enumeration<TaskIntent>(this, TaskIntent.INSTANCEORDER);
477        if ("option".equals(codeString))
478          return new Enumeration<TaskIntent>(this, TaskIntent.OPTION);
479        throw new FHIRException("Unknown TaskIntent code '"+codeString+"'");
480        }
481    public String toCode(TaskIntent code) {
482      if (code == TaskIntent.UNKNOWN)
483        return "unknown";
484      if (code == TaskIntent.PROPOSAL)
485        return "proposal";
486      if (code == TaskIntent.PLAN)
487        return "plan";
488      if (code == TaskIntent.ORDER)
489        return "order";
490      if (code == TaskIntent.ORIGINALORDER)
491        return "original-order";
492      if (code == TaskIntent.REFLEXORDER)
493        return "reflex-order";
494      if (code == TaskIntent.FILLERORDER)
495        return "filler-order";
496      if (code == TaskIntent.INSTANCEORDER)
497        return "instance-order";
498      if (code == TaskIntent.OPTION)
499        return "option";
500      return "?";
501      }
502    public String toSystem(TaskIntent code) {
503      return code.getSystem();
504      }
505    }
506
507    public enum TaskPriority {
508        /**
509         * The request has normal priority.
510         */
511        ROUTINE, 
512        /**
513         * The request should be actioned promptly - higher priority than routine.
514         */
515        URGENT, 
516        /**
517         * The request should be actioned as soon as possible - higher priority than urgent.
518         */
519        ASAP, 
520        /**
521         * The request should be actioned immediately - highest possible priority.  E.g. an emergency.
522         */
523        STAT, 
524        /**
525         * added to help the parsers with the generic types
526         */
527        NULL;
528        public static TaskPriority fromCode(String codeString) throws FHIRException {
529            if (codeString == null || "".equals(codeString))
530                return null;
531        if ("routine".equals(codeString))
532          return ROUTINE;
533        if ("urgent".equals(codeString))
534          return URGENT;
535        if ("asap".equals(codeString))
536          return ASAP;
537        if ("stat".equals(codeString))
538          return STAT;
539        if (Configuration.isAcceptInvalidEnums())
540          return null;
541        else
542          throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
543        }
544        public String toCode() {
545          switch (this) {
546            case ROUTINE: return "routine";
547            case URGENT: return "urgent";
548            case ASAP: return "asap";
549            case STAT: return "stat";
550            default: return "?";
551          }
552        }
553        public String getSystem() {
554          switch (this) {
555            case ROUTINE: return "http://hl7.org/fhir/request-priority";
556            case URGENT: return "http://hl7.org/fhir/request-priority";
557            case ASAP: return "http://hl7.org/fhir/request-priority";
558            case STAT: return "http://hl7.org/fhir/request-priority";
559            default: return "?";
560          }
561        }
562        public String getDefinition() {
563          switch (this) {
564            case ROUTINE: return "The request has normal priority.";
565            case URGENT: return "The request should be actioned promptly - higher priority than routine.";
566            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent.";
567            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
568            default: return "?";
569          }
570        }
571        public String getDisplay() {
572          switch (this) {
573            case ROUTINE: return "Routine";
574            case URGENT: return "Urgent";
575            case ASAP: return "ASAP";
576            case STAT: return "STAT";
577            default: return "?";
578          }
579        }
580    }
581
582  public static class TaskPriorityEnumFactory implements EnumFactory<TaskPriority> {
583    public TaskPriority fromCode(String codeString) throws IllegalArgumentException {
584      if (codeString == null || "".equals(codeString))
585            if (codeString == null || "".equals(codeString))
586                return null;
587        if ("routine".equals(codeString))
588          return TaskPriority.ROUTINE;
589        if ("urgent".equals(codeString))
590          return TaskPriority.URGENT;
591        if ("asap".equals(codeString))
592          return TaskPriority.ASAP;
593        if ("stat".equals(codeString))
594          return TaskPriority.STAT;
595        throw new IllegalArgumentException("Unknown TaskPriority code '"+codeString+"'");
596        }
597        public Enumeration<TaskPriority> fromType(Base code) throws FHIRException {
598          if (code == null)
599            return null;
600          if (code.isEmpty())
601            return new Enumeration<TaskPriority>(this);
602          String codeString = ((PrimitiveType) code).asStringValue();
603          if (codeString == null || "".equals(codeString))
604            return null;
605        if ("routine".equals(codeString))
606          return new Enumeration<TaskPriority>(this, TaskPriority.ROUTINE);
607        if ("urgent".equals(codeString))
608          return new Enumeration<TaskPriority>(this, TaskPriority.URGENT);
609        if ("asap".equals(codeString))
610          return new Enumeration<TaskPriority>(this, TaskPriority.ASAP);
611        if ("stat".equals(codeString))
612          return new Enumeration<TaskPriority>(this, TaskPriority.STAT);
613        throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
614        }
615    public String toCode(TaskPriority code) {
616      if (code == TaskPriority.ROUTINE)
617        return "routine";
618      if (code == TaskPriority.URGENT)
619        return "urgent";
620      if (code == TaskPriority.ASAP)
621        return "asap";
622      if (code == TaskPriority.STAT)
623        return "stat";
624      return "?";
625      }
626    public String toSystem(TaskPriority code) {
627      return code.getSystem();
628      }
629    }
630
631    @Block()
632    public static class TaskRestrictionComponent extends BackboneElement implements IBaseBackboneElement {
633        /**
634         * Indicates the number of times the requested action should occur.
635         */
636        @Child(name = "repetitions", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
637        @Description(shortDefinition="How many times to repeat", formalDefinition="Indicates the number of times the requested action should occur." )
638        protected PositiveIntType repetitions;
639
640        /**
641         * Over what time-period is fulfillment sought.
642         */
643        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
644        @Description(shortDefinition="When fulfillment sought", formalDefinition="Over what time-period is fulfillment sought." )
645        protected Period period;
646
647        /**
648         * For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?
649         */
650        @Child(name = "recipient", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Group.class, Organization.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
651        @Description(shortDefinition="For whom is fulfillment sought?", formalDefinition="For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?" )
652        protected List<Reference> recipient;
653        /**
654         * The actual objects that are the target of the reference (For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?)
655         */
656        protected List<Resource> recipientTarget;
657
658
659        private static final long serialVersionUID = 1503908360L;
660
661    /**
662     * Constructor
663     */
664      public TaskRestrictionComponent() {
665        super();
666      }
667
668        /**
669         * @return {@link #repetitions} (Indicates the number of times the requested action should occur.). This is the underlying object with id, value and extensions. The accessor "getRepetitions" gives direct access to the value
670         */
671        public PositiveIntType getRepetitionsElement() { 
672          if (this.repetitions == null)
673            if (Configuration.errorOnAutoCreate())
674              throw new Error("Attempt to auto-create TaskRestrictionComponent.repetitions");
675            else if (Configuration.doAutoCreate())
676              this.repetitions = new PositiveIntType(); // bb
677          return this.repetitions;
678        }
679
680        public boolean hasRepetitionsElement() { 
681          return this.repetitions != null && !this.repetitions.isEmpty();
682        }
683
684        public boolean hasRepetitions() { 
685          return this.repetitions != null && !this.repetitions.isEmpty();
686        }
687
688        /**
689         * @param value {@link #repetitions} (Indicates the number of times the requested action should occur.). This is the underlying object with id, value and extensions. The accessor "getRepetitions" gives direct access to the value
690         */
691        public TaskRestrictionComponent setRepetitionsElement(PositiveIntType value) { 
692          this.repetitions = value;
693          return this;
694        }
695
696        /**
697         * @return Indicates the number of times the requested action should occur.
698         */
699        public int getRepetitions() { 
700          return this.repetitions == null || this.repetitions.isEmpty() ? 0 : this.repetitions.getValue();
701        }
702
703        /**
704         * @param value Indicates the number of times the requested action should occur.
705         */
706        public TaskRestrictionComponent setRepetitions(int value) { 
707            if (this.repetitions == null)
708              this.repetitions = new PositiveIntType();
709            this.repetitions.setValue(value);
710          return this;
711        }
712
713        /**
714         * @return {@link #period} (Over what time-period is fulfillment sought.)
715         */
716        public Period getPeriod() { 
717          if (this.period == null)
718            if (Configuration.errorOnAutoCreate())
719              throw new Error("Attempt to auto-create TaskRestrictionComponent.period");
720            else if (Configuration.doAutoCreate())
721              this.period = new Period(); // cc
722          return this.period;
723        }
724
725        public boolean hasPeriod() { 
726          return this.period != null && !this.period.isEmpty();
727        }
728
729        /**
730         * @param value {@link #period} (Over what time-period is fulfillment sought.)
731         */
732        public TaskRestrictionComponent setPeriod(Period value) { 
733          this.period = value;
734          return this;
735        }
736
737        /**
738         * @return {@link #recipient} (For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?)
739         */
740        public List<Reference> getRecipient() { 
741          if (this.recipient == null)
742            this.recipient = new ArrayList<Reference>();
743          return this.recipient;
744        }
745
746        /**
747         * @return Returns a reference to <code>this</code> for easy method chaining
748         */
749        public TaskRestrictionComponent setRecipient(List<Reference> theRecipient) { 
750          this.recipient = theRecipient;
751          return this;
752        }
753
754        public boolean hasRecipient() { 
755          if (this.recipient == null)
756            return false;
757          for (Reference item : this.recipient)
758            if (!item.isEmpty())
759              return true;
760          return false;
761        }
762
763        public Reference addRecipient() { //3
764          Reference t = new Reference();
765          if (this.recipient == null)
766            this.recipient = new ArrayList<Reference>();
767          this.recipient.add(t);
768          return t;
769        }
770
771        public TaskRestrictionComponent addRecipient(Reference t) { //3
772          if (t == null)
773            return this;
774          if (this.recipient == null)
775            this.recipient = new ArrayList<Reference>();
776          this.recipient.add(t);
777          return this;
778        }
779
780        /**
781         * @return The first repetition of repeating field {@link #recipient}, creating it if it does not already exist
782         */
783        public Reference getRecipientFirstRep() { 
784          if (getRecipient().isEmpty()) {
785            addRecipient();
786          }
787          return getRecipient().get(0);
788        }
789
790        /**
791         * @deprecated Use Reference#setResource(IBaseResource) instead
792         */
793        @Deprecated
794        public List<Resource> getRecipientTarget() { 
795          if (this.recipientTarget == null)
796            this.recipientTarget = new ArrayList<Resource>();
797          return this.recipientTarget;
798        }
799
800        protected void listChildren(List<Property> children) {
801          super.listChildren(children);
802          children.add(new Property("repetitions", "positiveInt", "Indicates the number of times the requested action should occur.", 0, 1, repetitions));
803          children.add(new Property("period", "Period", "Over what time-period is fulfillment sought.", 0, 1, period));
804          children.add(new Property("recipient", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Group|Organization)", "For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?", 0, java.lang.Integer.MAX_VALUE, recipient));
805        }
806
807        @Override
808        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
809          switch (_hash) {
810          case 984367650: /*repetitions*/  return new Property("repetitions", "positiveInt", "Indicates the number of times the requested action should occur.", 0, 1, repetitions);
811          case -991726143: /*period*/  return new Property("period", "Period", "Over what time-period is fulfillment sought.", 0, 1, period);
812          case 820081177: /*recipient*/  return new Property("recipient", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Group|Organization)", "For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?", 0, java.lang.Integer.MAX_VALUE, recipient);
813          default: return super.getNamedProperty(_hash, _name, _checkValid);
814          }
815
816        }
817
818      @Override
819      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
820        switch (hash) {
821        case 984367650: /*repetitions*/ return this.repetitions == null ? new Base[0] : new Base[] {this.repetitions}; // PositiveIntType
822        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
823        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : this.recipient.toArray(new Base[this.recipient.size()]); // Reference
824        default: return super.getProperty(hash, name, checkValid);
825        }
826
827      }
828
829      @Override
830      public Base setProperty(int hash, String name, Base value) throws FHIRException {
831        switch (hash) {
832        case 984367650: // repetitions
833          this.repetitions = castToPositiveInt(value); // PositiveIntType
834          return value;
835        case -991726143: // period
836          this.period = castToPeriod(value); // Period
837          return value;
838        case 820081177: // recipient
839          this.getRecipient().add(castToReference(value)); // Reference
840          return value;
841        default: return super.setProperty(hash, name, value);
842        }
843
844      }
845
846      @Override
847      public Base setProperty(String name, Base value) throws FHIRException {
848        if (name.equals("repetitions")) {
849          this.repetitions = castToPositiveInt(value); // PositiveIntType
850        } else if (name.equals("period")) {
851          this.period = castToPeriod(value); // Period
852        } else if (name.equals("recipient")) {
853          this.getRecipient().add(castToReference(value));
854        } else
855          return super.setProperty(name, value);
856        return value;
857      }
858
859      @Override
860      public Base makeProperty(int hash, String name) throws FHIRException {
861        switch (hash) {
862        case 984367650:  return getRepetitionsElement();
863        case -991726143:  return getPeriod(); 
864        case 820081177:  return addRecipient(); 
865        default: return super.makeProperty(hash, name);
866        }
867
868      }
869
870      @Override
871      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
872        switch (hash) {
873        case 984367650: /*repetitions*/ return new String[] {"positiveInt"};
874        case -991726143: /*period*/ return new String[] {"Period"};
875        case 820081177: /*recipient*/ return new String[] {"Reference"};
876        default: return super.getTypesForProperty(hash, name);
877        }
878
879      }
880
881      @Override
882      public Base addChild(String name) throws FHIRException {
883        if (name.equals("repetitions")) {
884          throw new FHIRException("Cannot call addChild on a primitive type Task.repetitions");
885        }
886        else if (name.equals("period")) {
887          this.period = new Period();
888          return this.period;
889        }
890        else if (name.equals("recipient")) {
891          return addRecipient();
892        }
893        else
894          return super.addChild(name);
895      }
896
897      public TaskRestrictionComponent copy() {
898        TaskRestrictionComponent dst = new TaskRestrictionComponent();
899        copyValues(dst);
900        dst.repetitions = repetitions == null ? null : repetitions.copy();
901        dst.period = period == null ? null : period.copy();
902        if (recipient != null) {
903          dst.recipient = new ArrayList<Reference>();
904          for (Reference i : recipient)
905            dst.recipient.add(i.copy());
906        };
907        return dst;
908      }
909
910      @Override
911      public boolean equalsDeep(Base other_) {
912        if (!super.equalsDeep(other_))
913          return false;
914        if (!(other_ instanceof TaskRestrictionComponent))
915          return false;
916        TaskRestrictionComponent o = (TaskRestrictionComponent) other_;
917        return compareDeep(repetitions, o.repetitions, true) && compareDeep(period, o.period, true) && compareDeep(recipient, o.recipient, true)
918          ;
919      }
920
921      @Override
922      public boolean equalsShallow(Base other_) {
923        if (!super.equalsShallow(other_))
924          return false;
925        if (!(other_ instanceof TaskRestrictionComponent))
926          return false;
927        TaskRestrictionComponent o = (TaskRestrictionComponent) other_;
928        return compareValues(repetitions, o.repetitions, true);
929      }
930
931      public boolean isEmpty() {
932        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(repetitions, period, recipient
933          );
934      }
935
936  public String fhirType() {
937    return "Task.restriction";
938
939  }
940
941  }
942
943    @Block()
944    public static class ParameterComponent extends BackboneElement implements IBaseBackboneElement {
945        /**
946         * A code or description indicating how the input is intended to be used as part of the task execution.
947         */
948        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
949        @Description(shortDefinition="Label for the input", formalDefinition="A code or description indicating how the input is intended to be used as part of the task execution." )
950        protected CodeableConcept type;
951
952        /**
953         * The value of the input parameter as a basic type.
954         */
955        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
956        @Description(shortDefinition="Content to use in performing the task", formalDefinition="The value of the input parameter as a basic type." )
957        protected org.hl7.fhir.r4.model.Type value;
958
959        private static final long serialVersionUID = -850267045L;
960
961    /**
962     * Constructor
963     */
964      public ParameterComponent() {
965        super();
966      }
967
968    /**
969     * Constructor
970     */
971      public ParameterComponent(CodeableConcept type, org.hl7.fhir.r4.model.Type value) {
972        super();
973        this.type = type;
974        this.value = value;
975      }
976
977        /**
978         * @return {@link #type} (A code or description indicating how the input is intended to be used as part of the task execution.)
979         */
980        public CodeableConcept getType() { 
981          if (this.type == null)
982            if (Configuration.errorOnAutoCreate())
983              throw new Error("Attempt to auto-create ParameterComponent.type");
984            else if (Configuration.doAutoCreate())
985              this.type = new CodeableConcept(); // cc
986          return this.type;
987        }
988
989        public boolean hasType() { 
990          return this.type != null && !this.type.isEmpty();
991        }
992
993        /**
994         * @param value {@link #type} (A code or description indicating how the input is intended to be used as part of the task execution.)
995         */
996        public ParameterComponent setType(CodeableConcept value) { 
997          this.type = value;
998          return this;
999        }
1000
1001        /**
1002         * @return {@link #value} (The value of the input parameter as a basic type.)
1003         */
1004        public org.hl7.fhir.r4.model.Type getValue() { 
1005          return this.value;
1006        }
1007
1008        public boolean hasValue() { 
1009          return this.value != null && !this.value.isEmpty();
1010        }
1011
1012        /**
1013         * @param value {@link #value} (The value of the input parameter as a basic type.)
1014         */
1015        public ParameterComponent setValue(org.hl7.fhir.r4.model.Type value) { 
1016          this.value = value;
1017          return this;
1018        }
1019
1020        protected void listChildren(List<Property> children) {
1021          super.listChildren(children);
1022          children.add(new Property("type", "CodeableConcept", "A code or description indicating how the input is intended to be used as part of the task execution.", 0, 1, type));
1023          children.add(new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value));
1024        }
1025
1026        @Override
1027        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1028          switch (_hash) {
1029          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code or description indicating how the input is intended to be used as part of the task execution.", 0, 1, type);
1030          case -1410166417: /*value[x]*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1031          case 111972721: /*value*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1032          case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1033          case 733421943: /*valueBoolean*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1034          case -786218365: /*valueCanonical*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1035          case -766209282: /*valueCode*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1036          case -766192449: /*valueDate*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1037          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1038          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1039          case 231604844: /*valueId*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1040          case -1668687056: /*valueInstant*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1041          case -1668204915: /*valueInteger*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1042          case -497880704: /*valueMarkdown*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1043          case -1410178407: /*valueOid*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1044          case -1249932027: /*valuePositiveInt*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1045          case -1424603934: /*valueString*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1046          case -765708322: /*valueTime*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1047          case 26529417: /*valueUnsignedInt*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1048          case -1410172357: /*valueUri*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1049          case -1410172354: /*valueUrl*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1050          case -765667124: /*valueUuid*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1051          case -478981821: /*valueAddress*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1052          case -67108992: /*valueAnnotation*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1053          case -475566732: /*valueAttachment*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1054          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1055          case -1887705029: /*valueCoding*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1056          case 944904545: /*valueContactPoint*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1057          case -2026205465: /*valueHumanName*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1058          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1059          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1060          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1061          case 2030761548: /*valueRange*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1062          case 2030767386: /*valueRatio*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1063          case 1755241690: /*valueReference*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1064          case -962229101: /*valueSampledData*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1065          case -540985785: /*valueSignature*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1066          case -1406282469: /*valueTiming*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1067          case -1858636920: /*valueDosage*/  return new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, 1, value);
1068          default: return super.getNamedProperty(_hash, _name, _checkValid);
1069          }
1070
1071        }
1072
1073      @Override
1074      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1075        switch (hash) {
1076        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1077        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.r4.model.Type
1078        default: return super.getProperty(hash, name, checkValid);
1079        }
1080
1081      }
1082
1083      @Override
1084      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1085        switch (hash) {
1086        case 3575610: // type
1087          this.type = castToCodeableConcept(value); // CodeableConcept
1088          return value;
1089        case 111972721: // value
1090          this.value = castToType(value); // org.hl7.fhir.r4.model.Type
1091          return value;
1092        default: return super.setProperty(hash, name, value);
1093        }
1094
1095      }
1096
1097      @Override
1098      public Base setProperty(String name, Base value) throws FHIRException {
1099        if (name.equals("type")) {
1100          this.type = castToCodeableConcept(value); // CodeableConcept
1101        } else if (name.equals("value[x]")) {
1102          this.value = castToType(value); // org.hl7.fhir.r4.model.Type
1103        } else
1104          return super.setProperty(name, value);
1105        return value;
1106      }
1107
1108      @Override
1109      public Base makeProperty(int hash, String name) throws FHIRException {
1110        switch (hash) {
1111        case 3575610:  return getType(); 
1112        case -1410166417:  return getValue(); 
1113        case 111972721:  return getValue(); 
1114        default: return super.makeProperty(hash, name);
1115        }
1116
1117      }
1118
1119      @Override
1120      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1121        switch (hash) {
1122        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1123        case 111972721: /*value*/ return new String[] {"*"};
1124        default: return super.getTypesForProperty(hash, name);
1125        }
1126
1127      }
1128
1129      @Override
1130      public Base addChild(String name) throws FHIRException {
1131        if (name.equals("type")) {
1132          this.type = new CodeableConcept();
1133          return this.type;
1134        }
1135        else if (name.equals("valueBase64Binary")) {
1136          this.value = new Base64BinaryType();
1137          return this.value;
1138        }
1139        else if (name.equals("valueBoolean")) {
1140          this.value = new BooleanType();
1141          return this.value;
1142        }
1143        else if (name.equals("valueCanonical")) {
1144          this.value = new CanonicalType();
1145          return this.value;
1146        }
1147        else if (name.equals("valueCode")) {
1148          this.value = new CodeType();
1149          return this.value;
1150        }
1151        else if (name.equals("valueDate")) {
1152          this.value = new DateType();
1153          return this.value;
1154        }
1155        else if (name.equals("valueDateTime")) {
1156          this.value = new DateTimeType();
1157          return this.value;
1158        }
1159        else if (name.equals("valueDecimal")) {
1160          this.value = new DecimalType();
1161          return this.value;
1162        }
1163        else if (name.equals("valueId")) {
1164          this.value = new IdType();
1165          return this.value;
1166        }
1167        else if (name.equals("valueInstant")) {
1168          this.value = new InstantType();
1169          return this.value;
1170        }
1171        else if (name.equals("valueInteger")) {
1172          this.value = new IntegerType();
1173          return this.value;
1174        }
1175        else if (name.equals("valueMarkdown")) {
1176          this.value = new MarkdownType();
1177          return this.value;
1178        }
1179        else if (name.equals("valueOid")) {
1180          this.value = new OidType();
1181          return this.value;
1182        }
1183        else if (name.equals("valuePositiveInt")) {
1184          this.value = new PositiveIntType();
1185          return this.value;
1186        }
1187        else if (name.equals("valueString")) {
1188          this.value = new StringType();
1189          return this.value;
1190        }
1191        else if (name.equals("valueTime")) {
1192          this.value = new TimeType();
1193          return this.value;
1194        }
1195        else if (name.equals("valueUnsignedInt")) {
1196          this.value = new UnsignedIntType();
1197          return this.value;
1198        }
1199        else if (name.equals("valueUri")) {
1200          this.value = new UriType();
1201          return this.value;
1202        }
1203        else if (name.equals("valueUrl")) {
1204          this.value = new UrlType();
1205          return this.value;
1206        }
1207        else if (name.equals("valueUuid")) {
1208          this.value = new UuidType();
1209          return this.value;
1210        }
1211        else if (name.equals("valueAddress")) {
1212          this.value = new Address();
1213          return this.value;
1214        }
1215        else if (name.equals("valueAge")) {
1216          this.value = new Age();
1217          return this.value;
1218        }
1219        else if (name.equals("valueAnnotation")) {
1220          this.value = new Annotation();
1221          return this.value;
1222        }
1223        else if (name.equals("valueAttachment")) {
1224          this.value = new Attachment();
1225          return this.value;
1226        }
1227        else if (name.equals("valueCodeableConcept")) {
1228          this.value = new CodeableConcept();
1229          return this.value;
1230        }
1231        else if (name.equals("valueCoding")) {
1232          this.value = new Coding();
1233          return this.value;
1234        }
1235        else if (name.equals("valueContactPoint")) {
1236          this.value = new ContactPoint();
1237          return this.value;
1238        }
1239        else if (name.equals("valueCount")) {
1240          this.value = new Count();
1241          return this.value;
1242        }
1243        else if (name.equals("valueDistance")) {
1244          this.value = new Distance();
1245          return this.value;
1246        }
1247        else if (name.equals("valueDuration")) {
1248          this.value = new Duration();
1249          return this.value;
1250        }
1251        else if (name.equals("valueHumanName")) {
1252          this.value = new HumanName();
1253          return this.value;
1254        }
1255        else if (name.equals("valueIdentifier")) {
1256          this.value = new Identifier();
1257          return this.value;
1258        }
1259        else if (name.equals("valueMoney")) {
1260          this.value = new Money();
1261          return this.value;
1262        }
1263        else if (name.equals("valuePeriod")) {
1264          this.value = new Period();
1265          return this.value;
1266        }
1267        else if (name.equals("valueQuantity")) {
1268          this.value = new Quantity();
1269          return this.value;
1270        }
1271        else if (name.equals("valueRange")) {
1272          this.value = new Range();
1273          return this.value;
1274        }
1275        else if (name.equals("valueRatio")) {
1276          this.value = new Ratio();
1277          return this.value;
1278        }
1279        else if (name.equals("valueReference")) {
1280          this.value = new Reference();
1281          return this.value;
1282        }
1283        else if (name.equals("valueSampledData")) {
1284          this.value = new SampledData();
1285          return this.value;
1286        }
1287        else if (name.equals("valueSignature")) {
1288          this.value = new Signature();
1289          return this.value;
1290        }
1291        else if (name.equals("valueTiming")) {
1292          this.value = new Timing();
1293          return this.value;
1294        }
1295        else if (name.equals("valueContactDetail")) {
1296          this.value = new ContactDetail();
1297          return this.value;
1298        }
1299        else if (name.equals("valueContributor")) {
1300          this.value = new Contributor();
1301          return this.value;
1302        }
1303        else if (name.equals("valueDataRequirement")) {
1304          this.value = new DataRequirement();
1305          return this.value;
1306        }
1307        else if (name.equals("valueExpression")) {
1308          this.value = new Expression();
1309          return this.value;
1310        }
1311        else if (name.equals("valueParameterDefinition")) {
1312          this.value = new ParameterDefinition();
1313          return this.value;
1314        }
1315        else if (name.equals("valueRelatedArtifact")) {
1316          this.value = new RelatedArtifact();
1317          return this.value;
1318        }
1319        else if (name.equals("valueTriggerDefinition")) {
1320          this.value = new TriggerDefinition();
1321          return this.value;
1322        }
1323        else if (name.equals("valueUsageContext")) {
1324          this.value = new UsageContext();
1325          return this.value;
1326        }
1327        else if (name.equals("valueDosage")) {
1328          this.value = new Dosage();
1329          return this.value;
1330        }
1331        else
1332          return super.addChild(name);
1333      }
1334
1335      public ParameterComponent copy() {
1336        ParameterComponent dst = new ParameterComponent();
1337        copyValues(dst);
1338        dst.type = type == null ? null : type.copy();
1339        dst.value = value == null ? null : value.copy();
1340        return dst;
1341      }
1342
1343      @Override
1344      public boolean equalsDeep(Base other_) {
1345        if (!super.equalsDeep(other_))
1346          return false;
1347        if (!(other_ instanceof ParameterComponent))
1348          return false;
1349        ParameterComponent o = (ParameterComponent) other_;
1350        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
1351      }
1352
1353      @Override
1354      public boolean equalsShallow(Base other_) {
1355        if (!super.equalsShallow(other_))
1356          return false;
1357        if (!(other_ instanceof ParameterComponent))
1358          return false;
1359        ParameterComponent o = (ParameterComponent) other_;
1360        return true;
1361      }
1362
1363      public boolean isEmpty() {
1364        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
1365      }
1366
1367  public String fhirType() {
1368    return "Task.input";
1369
1370  }
1371
1372  }
1373
1374    @Block()
1375    public static class TaskOutputComponent extends BackboneElement implements IBaseBackboneElement {
1376        /**
1377         * The name of the Output parameter.
1378         */
1379        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1380        @Description(shortDefinition="Label for output", formalDefinition="The name of the Output parameter." )
1381        protected CodeableConcept type;
1382
1383        /**
1384         * The value of the Output parameter as a basic type.
1385         */
1386        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
1387        @Description(shortDefinition="Result of output", formalDefinition="The value of the Output parameter as a basic type." )
1388        protected org.hl7.fhir.r4.model.Type value;
1389
1390        private static final long serialVersionUID = -850267045L;
1391
1392    /**
1393     * Constructor
1394     */
1395      public TaskOutputComponent() {
1396        super();
1397      }
1398
1399    /**
1400     * Constructor
1401     */
1402      public TaskOutputComponent(CodeableConcept type, org.hl7.fhir.r4.model.Type value) {
1403        super();
1404        this.type = type;
1405        this.value = value;
1406      }
1407
1408        /**
1409         * @return {@link #type} (The name of the Output parameter.)
1410         */
1411        public CodeableConcept getType() { 
1412          if (this.type == null)
1413            if (Configuration.errorOnAutoCreate())
1414              throw new Error("Attempt to auto-create TaskOutputComponent.type");
1415            else if (Configuration.doAutoCreate())
1416              this.type = new CodeableConcept(); // cc
1417          return this.type;
1418        }
1419
1420        public boolean hasType() { 
1421          return this.type != null && !this.type.isEmpty();
1422        }
1423
1424        /**
1425         * @param value {@link #type} (The name of the Output parameter.)
1426         */
1427        public TaskOutputComponent setType(CodeableConcept value) { 
1428          this.type = value;
1429          return this;
1430        }
1431
1432        /**
1433         * @return {@link #value} (The value of the Output parameter as a basic type.)
1434         */
1435        public org.hl7.fhir.r4.model.Type getValue() { 
1436          return this.value;
1437        }
1438
1439        public boolean hasValue() { 
1440          return this.value != null && !this.value.isEmpty();
1441        }
1442
1443        /**
1444         * @param value {@link #value} (The value of the Output parameter as a basic type.)
1445         */
1446        public TaskOutputComponent setValue(org.hl7.fhir.r4.model.Type value) { 
1447          this.value = value;
1448          return this;
1449        }
1450
1451        protected void listChildren(List<Property> children) {
1452          super.listChildren(children);
1453          children.add(new Property("type", "CodeableConcept", "The name of the Output parameter.", 0, 1, type));
1454          children.add(new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value));
1455        }
1456
1457        @Override
1458        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1459          switch (_hash) {
1460          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The name of the Output parameter.", 0, 1, type);
1461          case -1410166417: /*value[x]*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1462          case 111972721: /*value*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1463          case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1464          case 733421943: /*valueBoolean*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1465          case -786218365: /*valueCanonical*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1466          case -766209282: /*valueCode*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1467          case -766192449: /*valueDate*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1468          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1469          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1470          case 231604844: /*valueId*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1471          case -1668687056: /*valueInstant*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1472          case -1668204915: /*valueInteger*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1473          case -497880704: /*valueMarkdown*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1474          case -1410178407: /*valueOid*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1475          case -1249932027: /*valuePositiveInt*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1476          case -1424603934: /*valueString*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1477          case -765708322: /*valueTime*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1478          case 26529417: /*valueUnsignedInt*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1479          case -1410172357: /*valueUri*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1480          case -1410172354: /*valueUrl*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1481          case -765667124: /*valueUuid*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1482          case -478981821: /*valueAddress*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1483          case -67108992: /*valueAnnotation*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1484          case -475566732: /*valueAttachment*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1485          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1486          case -1887705029: /*valueCoding*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1487          case 944904545: /*valueContactPoint*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1488          case -2026205465: /*valueHumanName*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1489          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1490          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1491          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1492          case 2030761548: /*valueRange*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1493          case 2030767386: /*valueRatio*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1494          case 1755241690: /*valueReference*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1495          case -962229101: /*valueSampledData*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1496          case -540985785: /*valueSignature*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1497          case -1406282469: /*valueTiming*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1498          case -1858636920: /*valueDosage*/  return new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, 1, value);
1499          default: return super.getNamedProperty(_hash, _name, _checkValid);
1500          }
1501
1502        }
1503
1504      @Override
1505      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1506        switch (hash) {
1507        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1508        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.r4.model.Type
1509        default: return super.getProperty(hash, name, checkValid);
1510        }
1511
1512      }
1513
1514      @Override
1515      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1516        switch (hash) {
1517        case 3575610: // type
1518          this.type = castToCodeableConcept(value); // CodeableConcept
1519          return value;
1520        case 111972721: // value
1521          this.value = castToType(value); // org.hl7.fhir.r4.model.Type
1522          return value;
1523        default: return super.setProperty(hash, name, value);
1524        }
1525
1526      }
1527
1528      @Override
1529      public Base setProperty(String name, Base value) throws FHIRException {
1530        if (name.equals("type")) {
1531          this.type = castToCodeableConcept(value); // CodeableConcept
1532        } else if (name.equals("value[x]")) {
1533          this.value = castToType(value); // org.hl7.fhir.r4.model.Type
1534        } else
1535          return super.setProperty(name, value);
1536        return value;
1537      }
1538
1539      @Override
1540      public Base makeProperty(int hash, String name) throws FHIRException {
1541        switch (hash) {
1542        case 3575610:  return getType(); 
1543        case -1410166417:  return getValue(); 
1544        case 111972721:  return getValue(); 
1545        default: return super.makeProperty(hash, name);
1546        }
1547
1548      }
1549
1550      @Override
1551      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1552        switch (hash) {
1553        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1554        case 111972721: /*value*/ return new String[] {"*"};
1555        default: return super.getTypesForProperty(hash, name);
1556        }
1557
1558      }
1559
1560      @Override
1561      public Base addChild(String name) throws FHIRException {
1562        if (name.equals("type")) {
1563          this.type = new CodeableConcept();
1564          return this.type;
1565        }
1566        else if (name.equals("valueBase64Binary")) {
1567          this.value = new Base64BinaryType();
1568          return this.value;
1569        }
1570        else if (name.equals("valueBoolean")) {
1571          this.value = new BooleanType();
1572          return this.value;
1573        }
1574        else if (name.equals("valueCanonical")) {
1575          this.value = new CanonicalType();
1576          return this.value;
1577        }
1578        else if (name.equals("valueCode")) {
1579          this.value = new CodeType();
1580          return this.value;
1581        }
1582        else if (name.equals("valueDate")) {
1583          this.value = new DateType();
1584          return this.value;
1585        }
1586        else if (name.equals("valueDateTime")) {
1587          this.value = new DateTimeType();
1588          return this.value;
1589        }
1590        else if (name.equals("valueDecimal")) {
1591          this.value = new DecimalType();
1592          return this.value;
1593        }
1594        else if (name.equals("valueId")) {
1595          this.value = new IdType();
1596          return this.value;
1597        }
1598        else if (name.equals("valueInstant")) {
1599          this.value = new InstantType();
1600          return this.value;
1601        }
1602        else if (name.equals("valueInteger")) {
1603          this.value = new IntegerType();
1604          return this.value;
1605        }
1606        else if (name.equals("valueMarkdown")) {
1607          this.value = new MarkdownType();
1608          return this.value;
1609        }
1610        else if (name.equals("valueOid")) {
1611          this.value = new OidType();
1612          return this.value;
1613        }
1614        else if (name.equals("valuePositiveInt")) {
1615          this.value = new PositiveIntType();
1616          return this.value;
1617        }
1618        else if (name.equals("valueString")) {
1619          this.value = new StringType();
1620          return this.value;
1621        }
1622        else if (name.equals("valueTime")) {
1623          this.value = new TimeType();
1624          return this.value;
1625        }
1626        else if (name.equals("valueUnsignedInt")) {
1627          this.value = new UnsignedIntType();
1628          return this.value;
1629        }
1630        else if (name.equals("valueUri")) {
1631          this.value = new UriType();
1632          return this.value;
1633        }
1634        else if (name.equals("valueUrl")) {
1635          this.value = new UrlType();
1636          return this.value;
1637        }
1638        else if (name.equals("valueUuid")) {
1639          this.value = new UuidType();
1640          return this.value;
1641        }
1642        else if (name.equals("valueAddress")) {
1643          this.value = new Address();
1644          return this.value;
1645        }
1646        else if (name.equals("valueAge")) {
1647          this.value = new Age();
1648          return this.value;
1649        }
1650        else if (name.equals("valueAnnotation")) {
1651          this.value = new Annotation();
1652          return this.value;
1653        }
1654        else if (name.equals("valueAttachment")) {
1655          this.value = new Attachment();
1656          return this.value;
1657        }
1658        else if (name.equals("valueCodeableConcept")) {
1659          this.value = new CodeableConcept();
1660          return this.value;
1661        }
1662        else if (name.equals("valueCoding")) {
1663          this.value = new Coding();
1664          return this.value;
1665        }
1666        else if (name.equals("valueContactPoint")) {
1667          this.value = new ContactPoint();
1668          return this.value;
1669        }
1670        else if (name.equals("valueCount")) {
1671          this.value = new Count();
1672          return this.value;
1673        }
1674        else if (name.equals("valueDistance")) {
1675          this.value = new Distance();
1676          return this.value;
1677        }
1678        else if (name.equals("valueDuration")) {
1679          this.value = new Duration();
1680          return this.value;
1681        }
1682        else if (name.equals("valueHumanName")) {
1683          this.value = new HumanName();
1684          return this.value;
1685        }
1686        else if (name.equals("valueIdentifier")) {
1687          this.value = new Identifier();
1688          return this.value;
1689        }
1690        else if (name.equals("valueMoney")) {
1691          this.value = new Money();
1692          return this.value;
1693        }
1694        else if (name.equals("valuePeriod")) {
1695          this.value = new Period();
1696          return this.value;
1697        }
1698        else if (name.equals("valueQuantity")) {
1699          this.value = new Quantity();
1700          return this.value;
1701        }
1702        else if (name.equals("valueRange")) {
1703          this.value = new Range();
1704          return this.value;
1705        }
1706        else if (name.equals("valueRatio")) {
1707          this.value = new Ratio();
1708          return this.value;
1709        }
1710        else if (name.equals("valueReference")) {
1711          this.value = new Reference();
1712          return this.value;
1713        }
1714        else if (name.equals("valueSampledData")) {
1715          this.value = new SampledData();
1716          return this.value;
1717        }
1718        else if (name.equals("valueSignature")) {
1719          this.value = new Signature();
1720          return this.value;
1721        }
1722        else if (name.equals("valueTiming")) {
1723          this.value = new Timing();
1724          return this.value;
1725        }
1726        else if (name.equals("valueContactDetail")) {
1727          this.value = new ContactDetail();
1728          return this.value;
1729        }
1730        else if (name.equals("valueContributor")) {
1731          this.value = new Contributor();
1732          return this.value;
1733        }
1734        else if (name.equals("valueDataRequirement")) {
1735          this.value = new DataRequirement();
1736          return this.value;
1737        }
1738        else if (name.equals("valueExpression")) {
1739          this.value = new Expression();
1740          return this.value;
1741        }
1742        else if (name.equals("valueParameterDefinition")) {
1743          this.value = new ParameterDefinition();
1744          return this.value;
1745        }
1746        else if (name.equals("valueRelatedArtifact")) {
1747          this.value = new RelatedArtifact();
1748          return this.value;
1749        }
1750        else if (name.equals("valueTriggerDefinition")) {
1751          this.value = new TriggerDefinition();
1752          return this.value;
1753        }
1754        else if (name.equals("valueUsageContext")) {
1755          this.value = new UsageContext();
1756          return this.value;
1757        }
1758        else if (name.equals("valueDosage")) {
1759          this.value = new Dosage();
1760          return this.value;
1761        }
1762        else
1763          return super.addChild(name);
1764      }
1765
1766      public TaskOutputComponent copy() {
1767        TaskOutputComponent dst = new TaskOutputComponent();
1768        copyValues(dst);
1769        dst.type = type == null ? null : type.copy();
1770        dst.value = value == null ? null : value.copy();
1771        return dst;
1772      }
1773
1774      @Override
1775      public boolean equalsDeep(Base other_) {
1776        if (!super.equalsDeep(other_))
1777          return false;
1778        if (!(other_ instanceof TaskOutputComponent))
1779          return false;
1780        TaskOutputComponent o = (TaskOutputComponent) other_;
1781        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
1782      }
1783
1784      @Override
1785      public boolean equalsShallow(Base other_) {
1786        if (!super.equalsShallow(other_))
1787          return false;
1788        if (!(other_ instanceof TaskOutputComponent))
1789          return false;
1790        TaskOutputComponent o = (TaskOutputComponent) other_;
1791        return true;
1792      }
1793
1794      public boolean isEmpty() {
1795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
1796      }
1797
1798  public String fhirType() {
1799    return "Task.output";
1800
1801  }
1802
1803  }
1804
1805    /**
1806     * The business identifier for this task.
1807     */
1808    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1809    @Description(shortDefinition="Task Instance Identifier", formalDefinition="The business identifier for this task." )
1810    protected List<Identifier> identifier;
1811
1812    /**
1813     * The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
1814     */
1815    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1816    @Description(shortDefinition="Formal definition of task", formalDefinition="The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task." )
1817    protected CanonicalType instantiatesCanonical;
1818
1819    /**
1820     * The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
1821     */
1822    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1823    @Description(shortDefinition="Formal definition of task", formalDefinition="The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task." )
1824    protected UriType instantiatesUri;
1825
1826    /**
1827     * BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a "request" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient.
1828     */
1829    @Child(name = "basedOn", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1830    @Description(shortDefinition="Request fulfilled by this task", formalDefinition="BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a \"request\" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the \"request\" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient." )
1831    protected List<Reference> basedOn;
1832    /**
1833     * The actual objects that are the target of the reference (BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a "request" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient.)
1834     */
1835    protected List<Resource> basedOnTarget;
1836
1837
1838    /**
1839     * An identifier that links together multiple tasks and other requests that were created in the same context.
1840     */
1841    @Child(name = "groupIdentifier", type = {Identifier.class}, order=4, min=0, max=1, modifier=false, summary=true)
1842    @Description(shortDefinition="Requisition or grouper id", formalDefinition="An identifier that links together multiple tasks and other requests that were created in the same context." )
1843    protected Identifier groupIdentifier;
1844
1845    /**
1846     * Task that this particular task is part of.
1847     */
1848    @Child(name = "partOf", type = {Task.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1849    @Description(shortDefinition="Composite task", formalDefinition="Task that this particular task is part of." )
1850    protected List<Reference> partOf;
1851    /**
1852     * The actual objects that are the target of the reference (Task that this particular task is part of.)
1853     */
1854    protected List<Task> partOfTarget;
1855
1856
1857    /**
1858     * The current status of the task.
1859     */
1860    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
1861    @Description(shortDefinition="draft | requested | received | accepted | +", formalDefinition="The current status of the task." )
1862    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-status")
1863    protected Enumeration<TaskStatus> status;
1864
1865    /**
1866     * An explanation as to why this task is held, failed, was refused, etc.
1867     */
1868    @Child(name = "statusReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
1869    @Description(shortDefinition="Reason for current status", formalDefinition="An explanation as to why this task is held, failed, was refused, etc." )
1870    protected CodeableConcept statusReason;
1871
1872    /**
1873     * Contains business-specific nuances of the business state.
1874     */
1875    @Child(name = "businessStatus", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
1876    @Description(shortDefinition="E.g. \"Specimen collected\", \"IV prepped\"", formalDefinition="Contains business-specific nuances of the business state." )
1877    protected CodeableConcept businessStatus;
1878
1879    /**
1880     * Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.
1881     */
1882    @Child(name = "intent", type = {CodeType.class}, order=9, min=1, max=1, modifier=false, summary=true)
1883    @Description(shortDefinition="unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Indicates the \"level\" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc." )
1884    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-intent")
1885    protected Enumeration<TaskIntent> intent;
1886
1887    /**
1888     * Indicates how quickly the Task should be addressed with respect to other requests.
1889     */
1890    @Child(name = "priority", type = {CodeType.class}, order=10, min=0, max=1, modifier=false, summary=false)
1891    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the Task should be addressed with respect to other requests." )
1892    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
1893    protected Enumeration<TaskPriority> priority;
1894
1895    /**
1896     * A name or code (or both) briefly describing what the task involves.
1897     */
1898    @Child(name = "code", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=true)
1899    @Description(shortDefinition="Task Type", formalDefinition="A name or code (or both) briefly describing what the task involves." )
1900    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-code")
1901    protected CodeableConcept code;
1902
1903    /**
1904     * A free-text description of what is to be performed.
1905     */
1906    @Child(name = "description", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1907    @Description(shortDefinition="Human-readable explanation of task", formalDefinition="A free-text description of what is to be performed." )
1908    protected StringType description;
1909
1910    /**
1911     * The request being actioned or the resource being manipulated by this task.
1912     */
1913    @Child(name = "focus", type = {Reference.class}, order=13, min=0, max=1, modifier=false, summary=true)
1914    @Description(shortDefinition="What task is acting on", formalDefinition="The request being actioned or the resource being manipulated by this task." )
1915    protected Reference focus;
1916
1917    /**
1918     * The actual object that is the target of the reference (The request being actioned or the resource being manipulated by this task.)
1919     */
1920    protected Resource focusTarget;
1921
1922    /**
1923     * The entity who benefits from the performance of the service specified in the task (e.g., the patient).
1924     */
1925    @Child(name = "for", type = {Reference.class}, order=14, min=0, max=1, modifier=false, summary=true)
1926    @Description(shortDefinition="Beneficiary of the Task", formalDefinition="The entity who benefits from the performance of the service specified in the task (e.g., the patient)." )
1927    protected Reference for_;
1928
1929    /**
1930     * The actual object that is the target of the reference (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
1931     */
1932    protected Resource for_Target;
1933
1934    /**
1935     * The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.
1936     */
1937    @Child(name = "encounter", type = {Encounter.class}, order=15, min=0, max=1, modifier=false, summary=true)
1938    @Description(shortDefinition="Healthcare event during which this task originated", formalDefinition="The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created." )
1939    protected Reference encounter;
1940
1941    /**
1942     * The actual object that is the target of the reference (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
1943     */
1944    protected Encounter encounterTarget;
1945
1946    /**
1947     * Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).
1948     */
1949    @Child(name = "executionPeriod", type = {Period.class}, order=16, min=0, max=1, modifier=false, summary=true)
1950    @Description(shortDefinition="Start and end time of execution", formalDefinition="Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end)." )
1951    protected Period executionPeriod;
1952
1953    /**
1954     * The date and time this task was created.
1955     */
1956    @Child(name = "authoredOn", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1957    @Description(shortDefinition="Task Creation Date", formalDefinition="The date and time this task was created." )
1958    protected DateTimeType authoredOn;
1959
1960    /**
1961     * The date and time of last modification to this task.
1962     */
1963    @Child(name = "lastModified", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1964    @Description(shortDefinition="Task Last Modified Date", formalDefinition="The date and time of last modification to this task." )
1965    protected DateTimeType lastModified;
1966
1967    /**
1968     * The creator of the task.
1969     */
1970    @Child(name = "requester", type = {Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=19, min=0, max=1, modifier=false, summary=true)
1971    @Description(shortDefinition="Who is asking for task to be done", formalDefinition="The creator of the task." )
1972    protected Reference requester;
1973
1974    /**
1975     * The actual object that is the target of the reference (The creator of the task.)
1976     */
1977    protected Resource requesterTarget;
1978
1979    /**
1980     * The kind of participant that should perform the task.
1981     */
1982    @Child(name = "performerType", type = {CodeableConcept.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1983    @Description(shortDefinition="Requested performer", formalDefinition="The kind of participant that should perform the task." )
1984    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/performer-role")
1985    protected List<CodeableConcept> performerType;
1986
1987    /**
1988     * Individual organization or Device currently responsible for task execution.
1989     */
1990    @Child(name = "owner", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, HealthcareService.class, Patient.class, Device.class, RelatedPerson.class}, order=21, min=0, max=1, modifier=false, summary=true)
1991    @Description(shortDefinition="Responsible individual", formalDefinition="Individual organization or Device currently responsible for task execution." )
1992    protected Reference owner;
1993
1994    /**
1995     * The actual object that is the target of the reference (Individual organization or Device currently responsible for task execution.)
1996     */
1997    protected Resource ownerTarget;
1998
1999    /**
2000     * Principal physical location where the this task is performed.
2001     */
2002    @Child(name = "location", type = {Location.class}, order=22, min=0, max=1, modifier=false, summary=true)
2003    @Description(shortDefinition="Where task occurs", formalDefinition="Principal physical location where the this task is performed." )
2004    protected Reference location;
2005
2006    /**
2007     * The actual object that is the target of the reference (Principal physical location where the this task is performed.)
2008     */
2009    protected Location locationTarget;
2010
2011    /**
2012     * A description or code indicating why this task needs to be performed.
2013     */
2014    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=23, min=0, max=1, modifier=false, summary=false)
2015    @Description(shortDefinition="Why task is needed", formalDefinition="A description or code indicating why this task needs to be performed." )
2016    protected CodeableConcept reasonCode;
2017
2018    /**
2019     * A resource reference indicating why this task needs to be performed.
2020     */
2021    @Child(name = "reasonReference", type = {Reference.class}, order=24, min=0, max=1, modifier=false, summary=false)
2022    @Description(shortDefinition="Why task is needed", formalDefinition="A resource reference indicating why this task needs to be performed." )
2023    protected Reference reasonReference;
2024
2025    /**
2026     * The actual object that is the target of the reference (A resource reference indicating why this task needs to be performed.)
2027     */
2028    protected Resource reasonReferenceTarget;
2029
2030    /**
2031     * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.
2032     */
2033    @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2034    @Description(shortDefinition="Associated insurance coverage", formalDefinition="Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task." )
2035    protected List<Reference> insurance;
2036    /**
2037     * The actual objects that are the target of the reference (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.)
2038     */
2039    protected List<Resource> insuranceTarget;
2040
2041
2042    /**
2043     * Free-text information captured about the task as it progresses.
2044     */
2045    @Child(name = "note", type = {Annotation.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2046    @Description(shortDefinition="Comments made about the task", formalDefinition="Free-text information captured about the task as it progresses." )
2047    protected List<Annotation> note;
2048
2049    /**
2050     * Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.
2051     */
2052    @Child(name = "relevantHistory", type = {Provenance.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2053    @Description(shortDefinition="Key events in history of the Task", formalDefinition="Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task." )
2054    protected List<Reference> relevantHistory;
2055    /**
2056     * The actual objects that are the target of the reference (Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.)
2057     */
2058    protected List<Provenance> relevantHistoryTarget;
2059
2060
2061    /**
2062     * If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.
2063     */
2064    @Child(name = "restriction", type = {}, order=28, min=0, max=1, modifier=false, summary=false)
2065    @Description(shortDefinition="Constraints on fulfillment tasks", formalDefinition="If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned." )
2066    protected TaskRestrictionComponent restriction;
2067
2068    /**
2069     * Additional information that may be needed in the execution of the task.
2070     */
2071    @Child(name = "input", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2072    @Description(shortDefinition="Information used to perform task", formalDefinition="Additional information that may be needed in the execution of the task." )
2073    protected List<ParameterComponent> input;
2074
2075    /**
2076     * Outputs produced by the Task.
2077     */
2078    @Child(name = "output", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2079    @Description(shortDefinition="Information produced as part of task", formalDefinition="Outputs produced by the Task." )
2080    protected List<TaskOutputComponent> output;
2081
2082    private static final long serialVersionUID = -765029272L;
2083
2084  /**
2085   * Constructor
2086   */
2087    public Task() {
2088      super();
2089    }
2090
2091  /**
2092   * Constructor
2093   */
2094    public Task(Enumeration<TaskStatus> status, Enumeration<TaskIntent> intent) {
2095      super();
2096      this.status = status;
2097      this.intent = intent;
2098    }
2099
2100    /**
2101     * @return {@link #identifier} (The business identifier for this task.)
2102     */
2103    public List<Identifier> getIdentifier() { 
2104      if (this.identifier == null)
2105        this.identifier = new ArrayList<Identifier>();
2106      return this.identifier;
2107    }
2108
2109    /**
2110     * @return Returns a reference to <code>this</code> for easy method chaining
2111     */
2112    public Task setIdentifier(List<Identifier> theIdentifier) { 
2113      this.identifier = theIdentifier;
2114      return this;
2115    }
2116
2117    public boolean hasIdentifier() { 
2118      if (this.identifier == null)
2119        return false;
2120      for (Identifier item : this.identifier)
2121        if (!item.isEmpty())
2122          return true;
2123      return false;
2124    }
2125
2126    public Identifier addIdentifier() { //3
2127      Identifier t = new Identifier();
2128      if (this.identifier == null)
2129        this.identifier = new ArrayList<Identifier>();
2130      this.identifier.add(t);
2131      return t;
2132    }
2133
2134    public Task addIdentifier(Identifier t) { //3
2135      if (t == null)
2136        return this;
2137      if (this.identifier == null)
2138        this.identifier = new ArrayList<Identifier>();
2139      this.identifier.add(t);
2140      return this;
2141    }
2142
2143    /**
2144     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2145     */
2146    public Identifier getIdentifierFirstRep() { 
2147      if (getIdentifier().isEmpty()) {
2148        addIdentifier();
2149      }
2150      return getIdentifier().get(0);
2151    }
2152
2153    /**
2154     * @return {@link #instantiatesCanonical} (The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesCanonical" gives direct access to the value
2155     */
2156    public CanonicalType getInstantiatesCanonicalElement() { 
2157      if (this.instantiatesCanonical == null)
2158        if (Configuration.errorOnAutoCreate())
2159          throw new Error("Attempt to auto-create Task.instantiatesCanonical");
2160        else if (Configuration.doAutoCreate())
2161          this.instantiatesCanonical = new CanonicalType(); // bb
2162      return this.instantiatesCanonical;
2163    }
2164
2165    public boolean hasInstantiatesCanonicalElement() { 
2166      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
2167    }
2168
2169    public boolean hasInstantiatesCanonical() { 
2170      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
2171    }
2172
2173    /**
2174     * @param value {@link #instantiatesCanonical} (The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesCanonical" gives direct access to the value
2175     */
2176    public Task setInstantiatesCanonicalElement(CanonicalType value) { 
2177      this.instantiatesCanonical = value;
2178      return this;
2179    }
2180
2181    /**
2182     * @return The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
2183     */
2184    public String getInstantiatesCanonical() { 
2185      return this.instantiatesCanonical == null ? null : this.instantiatesCanonical.getValue();
2186    }
2187
2188    /**
2189     * @param value The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
2190     */
2191    public Task setInstantiatesCanonical(String value) { 
2192      if (Utilities.noString(value))
2193        this.instantiatesCanonical = null;
2194      else {
2195        if (this.instantiatesCanonical == null)
2196          this.instantiatesCanonical = new CanonicalType();
2197        this.instantiatesCanonical.setValue(value);
2198      }
2199      return this;
2200    }
2201
2202    /**
2203     * @return {@link #instantiatesUri} (The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
2204     */
2205    public UriType getInstantiatesUriElement() { 
2206      if (this.instantiatesUri == null)
2207        if (Configuration.errorOnAutoCreate())
2208          throw new Error("Attempt to auto-create Task.instantiatesUri");
2209        else if (Configuration.doAutoCreate())
2210          this.instantiatesUri = new UriType(); // bb
2211      return this.instantiatesUri;
2212    }
2213
2214    public boolean hasInstantiatesUriElement() { 
2215      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
2216    }
2217
2218    public boolean hasInstantiatesUri() { 
2219      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
2220    }
2221
2222    /**
2223     * @param value {@link #instantiatesUri} (The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.). This is the underlying object with id, value and extensions. The accessor "getInstantiatesUri" gives direct access to the value
2224     */
2225    public Task setInstantiatesUriElement(UriType value) { 
2226      this.instantiatesUri = value;
2227      return this;
2228    }
2229
2230    /**
2231     * @return The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
2232     */
2233    public String getInstantiatesUri() { 
2234      return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
2235    }
2236
2237    /**
2238     * @param value The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.
2239     */
2240    public Task setInstantiatesUri(String value) { 
2241      if (Utilities.noString(value))
2242        this.instantiatesUri = null;
2243      else {
2244        if (this.instantiatesUri == null)
2245          this.instantiatesUri = new UriType();
2246        this.instantiatesUri.setValue(value);
2247      }
2248      return this;
2249    }
2250
2251    /**
2252     * @return {@link #basedOn} (BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a "request" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient.)
2253     */
2254    public List<Reference> getBasedOn() { 
2255      if (this.basedOn == null)
2256        this.basedOn = new ArrayList<Reference>();
2257      return this.basedOn;
2258    }
2259
2260    /**
2261     * @return Returns a reference to <code>this</code> for easy method chaining
2262     */
2263    public Task setBasedOn(List<Reference> theBasedOn) { 
2264      this.basedOn = theBasedOn;
2265      return this;
2266    }
2267
2268    public boolean hasBasedOn() { 
2269      if (this.basedOn == null)
2270        return false;
2271      for (Reference item : this.basedOn)
2272        if (!item.isEmpty())
2273          return true;
2274      return false;
2275    }
2276
2277    public Reference addBasedOn() { //3
2278      Reference t = new Reference();
2279      if (this.basedOn == null)
2280        this.basedOn = new ArrayList<Reference>();
2281      this.basedOn.add(t);
2282      return t;
2283    }
2284
2285    public Task addBasedOn(Reference t) { //3
2286      if (t == null)
2287        return this;
2288      if (this.basedOn == null)
2289        this.basedOn = new ArrayList<Reference>();
2290      this.basedOn.add(t);
2291      return this;
2292    }
2293
2294    /**
2295     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
2296     */
2297    public Reference getBasedOnFirstRep() { 
2298      if (getBasedOn().isEmpty()) {
2299        addBasedOn();
2300      }
2301      return getBasedOn().get(0);
2302    }
2303
2304    /**
2305     * @deprecated Use Reference#setResource(IBaseResource) instead
2306     */
2307    @Deprecated
2308    public List<Resource> getBasedOnTarget() { 
2309      if (this.basedOnTarget == null)
2310        this.basedOnTarget = new ArrayList<Resource>();
2311      return this.basedOnTarget;
2312    }
2313
2314    /**
2315     * @return {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2316     */
2317    public Identifier getGroupIdentifier() { 
2318      if (this.groupIdentifier == null)
2319        if (Configuration.errorOnAutoCreate())
2320          throw new Error("Attempt to auto-create Task.groupIdentifier");
2321        else if (Configuration.doAutoCreate())
2322          this.groupIdentifier = new Identifier(); // cc
2323      return this.groupIdentifier;
2324    }
2325
2326    public boolean hasGroupIdentifier() { 
2327      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
2328    }
2329
2330    /**
2331     * @param value {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2332     */
2333    public Task setGroupIdentifier(Identifier value) { 
2334      this.groupIdentifier = value;
2335      return this;
2336    }
2337
2338    /**
2339     * @return {@link #partOf} (Task that this particular task is part of.)
2340     */
2341    public List<Reference> getPartOf() { 
2342      if (this.partOf == null)
2343        this.partOf = new ArrayList<Reference>();
2344      return this.partOf;
2345    }
2346
2347    /**
2348     * @return Returns a reference to <code>this</code> for easy method chaining
2349     */
2350    public Task setPartOf(List<Reference> thePartOf) { 
2351      this.partOf = thePartOf;
2352      return this;
2353    }
2354
2355    public boolean hasPartOf() { 
2356      if (this.partOf == null)
2357        return false;
2358      for (Reference item : this.partOf)
2359        if (!item.isEmpty())
2360          return true;
2361      return false;
2362    }
2363
2364    public Reference addPartOf() { //3
2365      Reference t = new Reference();
2366      if (this.partOf == null)
2367        this.partOf = new ArrayList<Reference>();
2368      this.partOf.add(t);
2369      return t;
2370    }
2371
2372    public Task addPartOf(Reference t) { //3
2373      if (t == null)
2374        return this;
2375      if (this.partOf == null)
2376        this.partOf = new ArrayList<Reference>();
2377      this.partOf.add(t);
2378      return this;
2379    }
2380
2381    /**
2382     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
2383     */
2384    public Reference getPartOfFirstRep() { 
2385      if (getPartOf().isEmpty()) {
2386        addPartOf();
2387      }
2388      return getPartOf().get(0);
2389    }
2390
2391    /**
2392     * @deprecated Use Reference#setResource(IBaseResource) instead
2393     */
2394    @Deprecated
2395    public List<Task> getPartOfTarget() { 
2396      if (this.partOfTarget == null)
2397        this.partOfTarget = new ArrayList<Task>();
2398      return this.partOfTarget;
2399    }
2400
2401    /**
2402     * @deprecated Use Reference#setResource(IBaseResource) instead
2403     */
2404    @Deprecated
2405    public Task addPartOfTarget() { 
2406      Task r = new Task();
2407      if (this.partOfTarget == null)
2408        this.partOfTarget = new ArrayList<Task>();
2409      this.partOfTarget.add(r);
2410      return r;
2411    }
2412
2413    /**
2414     * @return {@link #status} (The current status of the task.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2415     */
2416    public Enumeration<TaskStatus> getStatusElement() { 
2417      if (this.status == null)
2418        if (Configuration.errorOnAutoCreate())
2419          throw new Error("Attempt to auto-create Task.status");
2420        else if (Configuration.doAutoCreate())
2421          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory()); // bb
2422      return this.status;
2423    }
2424
2425    public boolean hasStatusElement() { 
2426      return this.status != null && !this.status.isEmpty();
2427    }
2428
2429    public boolean hasStatus() { 
2430      return this.status != null && !this.status.isEmpty();
2431    }
2432
2433    /**
2434     * @param value {@link #status} (The current status of the task.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2435     */
2436    public Task setStatusElement(Enumeration<TaskStatus> value) { 
2437      this.status = value;
2438      return this;
2439    }
2440
2441    /**
2442     * @return The current status of the task.
2443     */
2444    public TaskStatus getStatus() { 
2445      return this.status == null ? null : this.status.getValue();
2446    }
2447
2448    /**
2449     * @param value The current status of the task.
2450     */
2451    public Task setStatus(TaskStatus value) { 
2452        if (this.status == null)
2453          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory());
2454        this.status.setValue(value);
2455      return this;
2456    }
2457
2458    /**
2459     * @return {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2460     */
2461    public CodeableConcept getStatusReason() { 
2462      if (this.statusReason == null)
2463        if (Configuration.errorOnAutoCreate())
2464          throw new Error("Attempt to auto-create Task.statusReason");
2465        else if (Configuration.doAutoCreate())
2466          this.statusReason = new CodeableConcept(); // cc
2467      return this.statusReason;
2468    }
2469
2470    public boolean hasStatusReason() { 
2471      return this.statusReason != null && !this.statusReason.isEmpty();
2472    }
2473
2474    /**
2475     * @param value {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2476     */
2477    public Task setStatusReason(CodeableConcept value) { 
2478      this.statusReason = value;
2479      return this;
2480    }
2481
2482    /**
2483     * @return {@link #businessStatus} (Contains business-specific nuances of the business state.)
2484     */
2485    public CodeableConcept getBusinessStatus() { 
2486      if (this.businessStatus == null)
2487        if (Configuration.errorOnAutoCreate())
2488          throw new Error("Attempt to auto-create Task.businessStatus");
2489        else if (Configuration.doAutoCreate())
2490          this.businessStatus = new CodeableConcept(); // cc
2491      return this.businessStatus;
2492    }
2493
2494    public boolean hasBusinessStatus() { 
2495      return this.businessStatus != null && !this.businessStatus.isEmpty();
2496    }
2497
2498    /**
2499     * @param value {@link #businessStatus} (Contains business-specific nuances of the business state.)
2500     */
2501    public Task setBusinessStatus(CodeableConcept value) { 
2502      this.businessStatus = value;
2503      return this;
2504    }
2505
2506    /**
2507     * @return {@link #intent} (Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2508     */
2509    public Enumeration<TaskIntent> getIntentElement() { 
2510      if (this.intent == null)
2511        if (Configuration.errorOnAutoCreate())
2512          throw new Error("Attempt to auto-create Task.intent");
2513        else if (Configuration.doAutoCreate())
2514          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory()); // bb
2515      return this.intent;
2516    }
2517
2518    public boolean hasIntentElement() { 
2519      return this.intent != null && !this.intent.isEmpty();
2520    }
2521
2522    public boolean hasIntent() { 
2523      return this.intent != null && !this.intent.isEmpty();
2524    }
2525
2526    /**
2527     * @param value {@link #intent} (Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
2528     */
2529    public Task setIntentElement(Enumeration<TaskIntent> value) { 
2530      this.intent = value;
2531      return this;
2532    }
2533
2534    /**
2535     * @return Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.
2536     */
2537    public TaskIntent getIntent() { 
2538      return this.intent == null ? null : this.intent.getValue();
2539    }
2540
2541    /**
2542     * @param value Indicates the "level" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.
2543     */
2544    public Task setIntent(TaskIntent value) { 
2545        if (this.intent == null)
2546          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory());
2547        this.intent.setValue(value);
2548      return this;
2549    }
2550
2551    /**
2552     * @return {@link #priority} (Indicates how quickly the Task should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2553     */
2554    public Enumeration<TaskPriority> getPriorityElement() { 
2555      if (this.priority == null)
2556        if (Configuration.errorOnAutoCreate())
2557          throw new Error("Attempt to auto-create Task.priority");
2558        else if (Configuration.doAutoCreate())
2559          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory()); // bb
2560      return this.priority;
2561    }
2562
2563    public boolean hasPriorityElement() { 
2564      return this.priority != null && !this.priority.isEmpty();
2565    }
2566
2567    public boolean hasPriority() { 
2568      return this.priority != null && !this.priority.isEmpty();
2569    }
2570
2571    /**
2572     * @param value {@link #priority} (Indicates how quickly the Task should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2573     */
2574    public Task setPriorityElement(Enumeration<TaskPriority> value) { 
2575      this.priority = value;
2576      return this;
2577    }
2578
2579    /**
2580     * @return Indicates how quickly the Task should be addressed with respect to other requests.
2581     */
2582    public TaskPriority getPriority() { 
2583      return this.priority == null ? null : this.priority.getValue();
2584    }
2585
2586    /**
2587     * @param value Indicates how quickly the Task should be addressed with respect to other requests.
2588     */
2589    public Task setPriority(TaskPriority value) { 
2590      if (value == null)
2591        this.priority = null;
2592      else {
2593        if (this.priority == null)
2594          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory());
2595        this.priority.setValue(value);
2596      }
2597      return this;
2598    }
2599
2600    /**
2601     * @return {@link #code} (A name or code (or both) briefly describing what the task involves.)
2602     */
2603    public CodeableConcept getCode() { 
2604      if (this.code == null)
2605        if (Configuration.errorOnAutoCreate())
2606          throw new Error("Attempt to auto-create Task.code");
2607        else if (Configuration.doAutoCreate())
2608          this.code = new CodeableConcept(); // cc
2609      return this.code;
2610    }
2611
2612    public boolean hasCode() { 
2613      return this.code != null && !this.code.isEmpty();
2614    }
2615
2616    /**
2617     * @param value {@link #code} (A name or code (or both) briefly describing what the task involves.)
2618     */
2619    public Task setCode(CodeableConcept value) { 
2620      this.code = value;
2621      return this;
2622    }
2623
2624    /**
2625     * @return {@link #description} (A free-text description of what is to be performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2626     */
2627    public StringType getDescriptionElement() { 
2628      if (this.description == null)
2629        if (Configuration.errorOnAutoCreate())
2630          throw new Error("Attempt to auto-create Task.description");
2631        else if (Configuration.doAutoCreate())
2632          this.description = new StringType(); // bb
2633      return this.description;
2634    }
2635
2636    public boolean hasDescriptionElement() { 
2637      return this.description != null && !this.description.isEmpty();
2638    }
2639
2640    public boolean hasDescription() { 
2641      return this.description != null && !this.description.isEmpty();
2642    }
2643
2644    /**
2645     * @param value {@link #description} (A free-text description of what is to be performed.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2646     */
2647    public Task setDescriptionElement(StringType value) { 
2648      this.description = value;
2649      return this;
2650    }
2651
2652    /**
2653     * @return A free-text description of what is to be performed.
2654     */
2655    public String getDescription() { 
2656      return this.description == null ? null : this.description.getValue();
2657    }
2658
2659    /**
2660     * @param value A free-text description of what is to be performed.
2661     */
2662    public Task setDescription(String value) { 
2663      if (Utilities.noString(value))
2664        this.description = null;
2665      else {
2666        if (this.description == null)
2667          this.description = new StringType();
2668        this.description.setValue(value);
2669      }
2670      return this;
2671    }
2672
2673    /**
2674     * @return {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2675     */
2676    public Reference getFocus() { 
2677      if (this.focus == null)
2678        if (Configuration.errorOnAutoCreate())
2679          throw new Error("Attempt to auto-create Task.focus");
2680        else if (Configuration.doAutoCreate())
2681          this.focus = new Reference(); // cc
2682      return this.focus;
2683    }
2684
2685    public boolean hasFocus() { 
2686      return this.focus != null && !this.focus.isEmpty();
2687    }
2688
2689    /**
2690     * @param value {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2691     */
2692    public Task setFocus(Reference value) { 
2693      this.focus = value;
2694      return this;
2695    }
2696
2697    /**
2698     * @return {@link #focus} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The request being actioned or the resource being manipulated by this task.)
2699     */
2700    public Resource getFocusTarget() { 
2701      return this.focusTarget;
2702    }
2703
2704    /**
2705     * @param value {@link #focus} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The request being actioned or the resource being manipulated by this task.)
2706     */
2707    public Task setFocusTarget(Resource value) { 
2708      this.focusTarget = value;
2709      return this;
2710    }
2711
2712    /**
2713     * @return {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2714     */
2715    public Reference getFor() { 
2716      if (this.for_ == null)
2717        if (Configuration.errorOnAutoCreate())
2718          throw new Error("Attempt to auto-create Task.for_");
2719        else if (Configuration.doAutoCreate())
2720          this.for_ = new Reference(); // cc
2721      return this.for_;
2722    }
2723
2724    public boolean hasFor() { 
2725      return this.for_ != null && !this.for_.isEmpty();
2726    }
2727
2728    /**
2729     * @param value {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2730     */
2731    public Task setFor(Reference value) { 
2732      this.for_ = value;
2733      return this;
2734    }
2735
2736    /**
2737     * @return {@link #for_} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2738     */
2739    public Resource getForTarget() { 
2740      return this.for_Target;
2741    }
2742
2743    /**
2744     * @param value {@link #for_} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2745     */
2746    public Task setForTarget(Resource value) { 
2747      this.for_Target = value;
2748      return this;
2749    }
2750
2751    /**
2752     * @return {@link #encounter} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2753     */
2754    public Reference getEncounter() { 
2755      if (this.encounter == null)
2756        if (Configuration.errorOnAutoCreate())
2757          throw new Error("Attempt to auto-create Task.encounter");
2758        else if (Configuration.doAutoCreate())
2759          this.encounter = new Reference(); // cc
2760      return this.encounter;
2761    }
2762
2763    public boolean hasEncounter() { 
2764      return this.encounter != null && !this.encounter.isEmpty();
2765    }
2766
2767    /**
2768     * @param value {@link #encounter} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2769     */
2770    public Task setEncounter(Reference value) { 
2771      this.encounter = value;
2772      return this;
2773    }
2774
2775    /**
2776     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2777     */
2778    public Encounter getEncounterTarget() { 
2779      if (this.encounterTarget == null)
2780        if (Configuration.errorOnAutoCreate())
2781          throw new Error("Attempt to auto-create Task.encounter");
2782        else if (Configuration.doAutoCreate())
2783          this.encounterTarget = new Encounter(); // aa
2784      return this.encounterTarget;
2785    }
2786
2787    /**
2788     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2789     */
2790    public Task setEncounterTarget(Encounter value) { 
2791      this.encounterTarget = value;
2792      return this;
2793    }
2794
2795    /**
2796     * @return {@link #executionPeriod} (Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).)
2797     */
2798    public Period getExecutionPeriod() { 
2799      if (this.executionPeriod == null)
2800        if (Configuration.errorOnAutoCreate())
2801          throw new Error("Attempt to auto-create Task.executionPeriod");
2802        else if (Configuration.doAutoCreate())
2803          this.executionPeriod = new Period(); // cc
2804      return this.executionPeriod;
2805    }
2806
2807    public boolean hasExecutionPeriod() { 
2808      return this.executionPeriod != null && !this.executionPeriod.isEmpty();
2809    }
2810
2811    /**
2812     * @param value {@link #executionPeriod} (Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).)
2813     */
2814    public Task setExecutionPeriod(Period value) { 
2815      this.executionPeriod = value;
2816      return this;
2817    }
2818
2819    /**
2820     * @return {@link #authoredOn} (The date and time this task was created.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
2821     */
2822    public DateTimeType getAuthoredOnElement() { 
2823      if (this.authoredOn == null)
2824        if (Configuration.errorOnAutoCreate())
2825          throw new Error("Attempt to auto-create Task.authoredOn");
2826        else if (Configuration.doAutoCreate())
2827          this.authoredOn = new DateTimeType(); // bb
2828      return this.authoredOn;
2829    }
2830
2831    public boolean hasAuthoredOnElement() { 
2832      return this.authoredOn != null && !this.authoredOn.isEmpty();
2833    }
2834
2835    public boolean hasAuthoredOn() { 
2836      return this.authoredOn != null && !this.authoredOn.isEmpty();
2837    }
2838
2839    /**
2840     * @param value {@link #authoredOn} (The date and time this task was created.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
2841     */
2842    public Task setAuthoredOnElement(DateTimeType value) { 
2843      this.authoredOn = value;
2844      return this;
2845    }
2846
2847    /**
2848     * @return The date and time this task was created.
2849     */
2850    public Date getAuthoredOn() { 
2851      return this.authoredOn == null ? null : this.authoredOn.getValue();
2852    }
2853
2854    /**
2855     * @param value The date and time this task was created.
2856     */
2857    public Task setAuthoredOn(Date value) { 
2858      if (value == null)
2859        this.authoredOn = null;
2860      else {
2861        if (this.authoredOn == null)
2862          this.authoredOn = new DateTimeType();
2863        this.authoredOn.setValue(value);
2864      }
2865      return this;
2866    }
2867
2868    /**
2869     * @return {@link #lastModified} (The date and time of last modification to this task.). This is the underlying object with id, value and extensions. The accessor "getLastModified" gives direct access to the value
2870     */
2871    public DateTimeType getLastModifiedElement() { 
2872      if (this.lastModified == null)
2873        if (Configuration.errorOnAutoCreate())
2874          throw new Error("Attempt to auto-create Task.lastModified");
2875        else if (Configuration.doAutoCreate())
2876          this.lastModified = new DateTimeType(); // bb
2877      return this.lastModified;
2878    }
2879
2880    public boolean hasLastModifiedElement() { 
2881      return this.lastModified != null && !this.lastModified.isEmpty();
2882    }
2883
2884    public boolean hasLastModified() { 
2885      return this.lastModified != null && !this.lastModified.isEmpty();
2886    }
2887
2888    /**
2889     * @param value {@link #lastModified} (The date and time of last modification to this task.). This is the underlying object with id, value and extensions. The accessor "getLastModified" gives direct access to the value
2890     */
2891    public Task setLastModifiedElement(DateTimeType value) { 
2892      this.lastModified = value;
2893      return this;
2894    }
2895
2896    /**
2897     * @return The date and time of last modification to this task.
2898     */
2899    public Date getLastModified() { 
2900      return this.lastModified == null ? null : this.lastModified.getValue();
2901    }
2902
2903    /**
2904     * @param value The date and time of last modification to this task.
2905     */
2906    public Task setLastModified(Date value) { 
2907      if (value == null)
2908        this.lastModified = null;
2909      else {
2910        if (this.lastModified == null)
2911          this.lastModified = new DateTimeType();
2912        this.lastModified.setValue(value);
2913      }
2914      return this;
2915    }
2916
2917    /**
2918     * @return {@link #requester} (The creator of the task.)
2919     */
2920    public Reference getRequester() { 
2921      if (this.requester == null)
2922        if (Configuration.errorOnAutoCreate())
2923          throw new Error("Attempt to auto-create Task.requester");
2924        else if (Configuration.doAutoCreate())
2925          this.requester = new Reference(); // cc
2926      return this.requester;
2927    }
2928
2929    public boolean hasRequester() { 
2930      return this.requester != null && !this.requester.isEmpty();
2931    }
2932
2933    /**
2934     * @param value {@link #requester} (The creator of the task.)
2935     */
2936    public Task setRequester(Reference value) { 
2937      this.requester = value;
2938      return this;
2939    }
2940
2941    /**
2942     * @return {@link #requester} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The creator of the task.)
2943     */
2944    public Resource getRequesterTarget() { 
2945      return this.requesterTarget;
2946    }
2947
2948    /**
2949     * @param value {@link #requester} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The creator of the task.)
2950     */
2951    public Task setRequesterTarget(Resource value) { 
2952      this.requesterTarget = value;
2953      return this;
2954    }
2955
2956    /**
2957     * @return {@link #performerType} (The kind of participant that should perform the task.)
2958     */
2959    public List<CodeableConcept> getPerformerType() { 
2960      if (this.performerType == null)
2961        this.performerType = new ArrayList<CodeableConcept>();
2962      return this.performerType;
2963    }
2964
2965    /**
2966     * @return Returns a reference to <code>this</code> for easy method chaining
2967     */
2968    public Task setPerformerType(List<CodeableConcept> thePerformerType) { 
2969      this.performerType = thePerformerType;
2970      return this;
2971    }
2972
2973    public boolean hasPerformerType() { 
2974      if (this.performerType == null)
2975        return false;
2976      for (CodeableConcept item : this.performerType)
2977        if (!item.isEmpty())
2978          return true;
2979      return false;
2980    }
2981
2982    public CodeableConcept addPerformerType() { //3
2983      CodeableConcept t = new CodeableConcept();
2984      if (this.performerType == null)
2985        this.performerType = new ArrayList<CodeableConcept>();
2986      this.performerType.add(t);
2987      return t;
2988    }
2989
2990    public Task addPerformerType(CodeableConcept t) { //3
2991      if (t == null)
2992        return this;
2993      if (this.performerType == null)
2994        this.performerType = new ArrayList<CodeableConcept>();
2995      this.performerType.add(t);
2996      return this;
2997    }
2998
2999    /**
3000     * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist
3001     */
3002    public CodeableConcept getPerformerTypeFirstRep() { 
3003      if (getPerformerType().isEmpty()) {
3004        addPerformerType();
3005      }
3006      return getPerformerType().get(0);
3007    }
3008
3009    /**
3010     * @return {@link #owner} (Individual organization or Device currently responsible for task execution.)
3011     */
3012    public Reference getOwner() { 
3013      if (this.owner == null)
3014        if (Configuration.errorOnAutoCreate())
3015          throw new Error("Attempt to auto-create Task.owner");
3016        else if (Configuration.doAutoCreate())
3017          this.owner = new Reference(); // cc
3018      return this.owner;
3019    }
3020
3021    public boolean hasOwner() { 
3022      return this.owner != null && !this.owner.isEmpty();
3023    }
3024
3025    /**
3026     * @param value {@link #owner} (Individual organization or Device currently responsible for task execution.)
3027     */
3028    public Task setOwner(Reference value) { 
3029      this.owner = value;
3030      return this;
3031    }
3032
3033    /**
3034     * @return {@link #owner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Individual organization or Device currently responsible for task execution.)
3035     */
3036    public Resource getOwnerTarget() { 
3037      return this.ownerTarget;
3038    }
3039
3040    /**
3041     * @param value {@link #owner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Individual organization or Device currently responsible for task execution.)
3042     */
3043    public Task setOwnerTarget(Resource value) { 
3044      this.ownerTarget = value;
3045      return this;
3046    }
3047
3048    /**
3049     * @return {@link #location} (Principal physical location where the this task is performed.)
3050     */
3051    public Reference getLocation() { 
3052      if (this.location == null)
3053        if (Configuration.errorOnAutoCreate())
3054          throw new Error("Attempt to auto-create Task.location");
3055        else if (Configuration.doAutoCreate())
3056          this.location = new Reference(); // cc
3057      return this.location;
3058    }
3059
3060    public boolean hasLocation() { 
3061      return this.location != null && !this.location.isEmpty();
3062    }
3063
3064    /**
3065     * @param value {@link #location} (Principal physical location where the this task is performed.)
3066     */
3067    public Task setLocation(Reference value) { 
3068      this.location = value;
3069      return this;
3070    }
3071
3072    /**
3073     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Principal physical location where the this task is performed.)
3074     */
3075    public Location getLocationTarget() { 
3076      if (this.locationTarget == null)
3077        if (Configuration.errorOnAutoCreate())
3078          throw new Error("Attempt to auto-create Task.location");
3079        else if (Configuration.doAutoCreate())
3080          this.locationTarget = new Location(); // aa
3081      return this.locationTarget;
3082    }
3083
3084    /**
3085     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Principal physical location where the this task is performed.)
3086     */
3087    public Task setLocationTarget(Location value) { 
3088      this.locationTarget = value;
3089      return this;
3090    }
3091
3092    /**
3093     * @return {@link #reasonCode} (A description or code indicating why this task needs to be performed.)
3094     */
3095    public CodeableConcept getReasonCode() { 
3096      if (this.reasonCode == null)
3097        if (Configuration.errorOnAutoCreate())
3098          throw new Error("Attempt to auto-create Task.reasonCode");
3099        else if (Configuration.doAutoCreate())
3100          this.reasonCode = new CodeableConcept(); // cc
3101      return this.reasonCode;
3102    }
3103
3104    public boolean hasReasonCode() { 
3105      return this.reasonCode != null && !this.reasonCode.isEmpty();
3106    }
3107
3108    /**
3109     * @param value {@link #reasonCode} (A description or code indicating why this task needs to be performed.)
3110     */
3111    public Task setReasonCode(CodeableConcept value) { 
3112      this.reasonCode = value;
3113      return this;
3114    }
3115
3116    /**
3117     * @return {@link #reasonReference} (A resource reference indicating why this task needs to be performed.)
3118     */
3119    public Reference getReasonReference() { 
3120      if (this.reasonReference == null)
3121        if (Configuration.errorOnAutoCreate())
3122          throw new Error("Attempt to auto-create Task.reasonReference");
3123        else if (Configuration.doAutoCreate())
3124          this.reasonReference = new Reference(); // cc
3125      return this.reasonReference;
3126    }
3127
3128    public boolean hasReasonReference() { 
3129      return this.reasonReference != null && !this.reasonReference.isEmpty();
3130    }
3131
3132    /**
3133     * @param value {@link #reasonReference} (A resource reference indicating why this task needs to be performed.)
3134     */
3135    public Task setReasonReference(Reference value) { 
3136      this.reasonReference = value;
3137      return this;
3138    }
3139
3140    /**
3141     * @return {@link #reasonReference} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A resource reference indicating why this task needs to be performed.)
3142     */
3143    public Resource getReasonReferenceTarget() { 
3144      return this.reasonReferenceTarget;
3145    }
3146
3147    /**
3148     * @param value {@link #reasonReference} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A resource reference indicating why this task needs to be performed.)
3149     */
3150    public Task setReasonReferenceTarget(Resource value) { 
3151      this.reasonReferenceTarget = value;
3152      return this;
3153    }
3154
3155    /**
3156     * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.)
3157     */
3158    public List<Reference> getInsurance() { 
3159      if (this.insurance == null)
3160        this.insurance = new ArrayList<Reference>();
3161      return this.insurance;
3162    }
3163
3164    /**
3165     * @return Returns a reference to <code>this</code> for easy method chaining
3166     */
3167    public Task setInsurance(List<Reference> theInsurance) { 
3168      this.insurance = theInsurance;
3169      return this;
3170    }
3171
3172    public boolean hasInsurance() { 
3173      if (this.insurance == null)
3174        return false;
3175      for (Reference item : this.insurance)
3176        if (!item.isEmpty())
3177          return true;
3178      return false;
3179    }
3180
3181    public Reference addInsurance() { //3
3182      Reference t = new Reference();
3183      if (this.insurance == null)
3184        this.insurance = new ArrayList<Reference>();
3185      this.insurance.add(t);
3186      return t;
3187    }
3188
3189    public Task addInsurance(Reference t) { //3
3190      if (t == null)
3191        return this;
3192      if (this.insurance == null)
3193        this.insurance = new ArrayList<Reference>();
3194      this.insurance.add(t);
3195      return this;
3196    }
3197
3198    /**
3199     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
3200     */
3201    public Reference getInsuranceFirstRep() { 
3202      if (getInsurance().isEmpty()) {
3203        addInsurance();
3204      }
3205      return getInsurance().get(0);
3206    }
3207
3208    /**
3209     * @deprecated Use Reference#setResource(IBaseResource) instead
3210     */
3211    @Deprecated
3212    public List<Resource> getInsuranceTarget() { 
3213      if (this.insuranceTarget == null)
3214        this.insuranceTarget = new ArrayList<Resource>();
3215      return this.insuranceTarget;
3216    }
3217
3218    /**
3219     * @return {@link #note} (Free-text information captured about the task as it progresses.)
3220     */
3221    public List<Annotation> getNote() { 
3222      if (this.note == null)
3223        this.note = new ArrayList<Annotation>();
3224      return this.note;
3225    }
3226
3227    /**
3228     * @return Returns a reference to <code>this</code> for easy method chaining
3229     */
3230    public Task setNote(List<Annotation> theNote) { 
3231      this.note = theNote;
3232      return this;
3233    }
3234
3235    public boolean hasNote() { 
3236      if (this.note == null)
3237        return false;
3238      for (Annotation item : this.note)
3239        if (!item.isEmpty())
3240          return true;
3241      return false;
3242    }
3243
3244    public Annotation addNote() { //3
3245      Annotation t = new Annotation();
3246      if (this.note == null)
3247        this.note = new ArrayList<Annotation>();
3248      this.note.add(t);
3249      return t;
3250    }
3251
3252    public Task addNote(Annotation t) { //3
3253      if (t == null)
3254        return this;
3255      if (this.note == null)
3256        this.note = new ArrayList<Annotation>();
3257      this.note.add(t);
3258      return this;
3259    }
3260
3261    /**
3262     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3263     */
3264    public Annotation getNoteFirstRep() { 
3265      if (getNote().isEmpty()) {
3266        addNote();
3267      }
3268      return getNote().get(0);
3269    }
3270
3271    /**
3272     * @return {@link #relevantHistory} (Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.)
3273     */
3274    public List<Reference> getRelevantHistory() { 
3275      if (this.relevantHistory == null)
3276        this.relevantHistory = new ArrayList<Reference>();
3277      return this.relevantHistory;
3278    }
3279
3280    /**
3281     * @return Returns a reference to <code>this</code> for easy method chaining
3282     */
3283    public Task setRelevantHistory(List<Reference> theRelevantHistory) { 
3284      this.relevantHistory = theRelevantHistory;
3285      return this;
3286    }
3287
3288    public boolean hasRelevantHistory() { 
3289      if (this.relevantHistory == null)
3290        return false;
3291      for (Reference item : this.relevantHistory)
3292        if (!item.isEmpty())
3293          return true;
3294      return false;
3295    }
3296
3297    public Reference addRelevantHistory() { //3
3298      Reference t = new Reference();
3299      if (this.relevantHistory == null)
3300        this.relevantHistory = new ArrayList<Reference>();
3301      this.relevantHistory.add(t);
3302      return t;
3303    }
3304
3305    public Task addRelevantHistory(Reference t) { //3
3306      if (t == null)
3307        return this;
3308      if (this.relevantHistory == null)
3309        this.relevantHistory = new ArrayList<Reference>();
3310      this.relevantHistory.add(t);
3311      return this;
3312    }
3313
3314    /**
3315     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
3316     */
3317    public Reference getRelevantHistoryFirstRep() { 
3318      if (getRelevantHistory().isEmpty()) {
3319        addRelevantHistory();
3320      }
3321      return getRelevantHistory().get(0);
3322    }
3323
3324    /**
3325     * @deprecated Use Reference#setResource(IBaseResource) instead
3326     */
3327    @Deprecated
3328    public List<Provenance> getRelevantHistoryTarget() { 
3329      if (this.relevantHistoryTarget == null)
3330        this.relevantHistoryTarget = new ArrayList<Provenance>();
3331      return this.relevantHistoryTarget;
3332    }
3333
3334    /**
3335     * @deprecated Use Reference#setResource(IBaseResource) instead
3336     */
3337    @Deprecated
3338    public Provenance addRelevantHistoryTarget() { 
3339      Provenance r = new Provenance();
3340      if (this.relevantHistoryTarget == null)
3341        this.relevantHistoryTarget = new ArrayList<Provenance>();
3342      this.relevantHistoryTarget.add(r);
3343      return r;
3344    }
3345
3346    /**
3347     * @return {@link #restriction} (If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.)
3348     */
3349    public TaskRestrictionComponent getRestriction() { 
3350      if (this.restriction == null)
3351        if (Configuration.errorOnAutoCreate())
3352          throw new Error("Attempt to auto-create Task.restriction");
3353        else if (Configuration.doAutoCreate())
3354          this.restriction = new TaskRestrictionComponent(); // cc
3355      return this.restriction;
3356    }
3357
3358    public boolean hasRestriction() { 
3359      return this.restriction != null && !this.restriction.isEmpty();
3360    }
3361
3362    /**
3363     * @param value {@link #restriction} (If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.)
3364     */
3365    public Task setRestriction(TaskRestrictionComponent value) { 
3366      this.restriction = value;
3367      return this;
3368    }
3369
3370    /**
3371     * @return {@link #input} (Additional information that may be needed in the execution of the task.)
3372     */
3373    public List<ParameterComponent> getInput() { 
3374      if (this.input == null)
3375        this.input = new ArrayList<ParameterComponent>();
3376      return this.input;
3377    }
3378
3379    /**
3380     * @return Returns a reference to <code>this</code> for easy method chaining
3381     */
3382    public Task setInput(List<ParameterComponent> theInput) { 
3383      this.input = theInput;
3384      return this;
3385    }
3386
3387    public boolean hasInput() { 
3388      if (this.input == null)
3389        return false;
3390      for (ParameterComponent item : this.input)
3391        if (!item.isEmpty())
3392          return true;
3393      return false;
3394    }
3395
3396    public ParameterComponent addInput() { //3
3397      ParameterComponent t = new ParameterComponent();
3398      if (this.input == null)
3399        this.input = new ArrayList<ParameterComponent>();
3400      this.input.add(t);
3401      return t;
3402    }
3403
3404    public Task addInput(ParameterComponent t) { //3
3405      if (t == null)
3406        return this;
3407      if (this.input == null)
3408        this.input = new ArrayList<ParameterComponent>();
3409      this.input.add(t);
3410      return this;
3411    }
3412
3413    /**
3414     * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
3415     */
3416    public ParameterComponent getInputFirstRep() { 
3417      if (getInput().isEmpty()) {
3418        addInput();
3419      }
3420      return getInput().get(0);
3421    }
3422
3423    /**
3424     * @return {@link #output} (Outputs produced by the Task.)
3425     */
3426    public List<TaskOutputComponent> getOutput() { 
3427      if (this.output == null)
3428        this.output = new ArrayList<TaskOutputComponent>();
3429      return this.output;
3430    }
3431
3432    /**
3433     * @return Returns a reference to <code>this</code> for easy method chaining
3434     */
3435    public Task setOutput(List<TaskOutputComponent> theOutput) { 
3436      this.output = theOutput;
3437      return this;
3438    }
3439
3440    public boolean hasOutput() { 
3441      if (this.output == null)
3442        return false;
3443      for (TaskOutputComponent item : this.output)
3444        if (!item.isEmpty())
3445          return true;
3446      return false;
3447    }
3448
3449    public TaskOutputComponent addOutput() { //3
3450      TaskOutputComponent t = new TaskOutputComponent();
3451      if (this.output == null)
3452        this.output = new ArrayList<TaskOutputComponent>();
3453      this.output.add(t);
3454      return t;
3455    }
3456
3457    public Task addOutput(TaskOutputComponent t) { //3
3458      if (t == null)
3459        return this;
3460      if (this.output == null)
3461        this.output = new ArrayList<TaskOutputComponent>();
3462      this.output.add(t);
3463      return this;
3464    }
3465
3466    /**
3467     * @return The first repetition of repeating field {@link #output}, creating it if it does not already exist
3468     */
3469    public TaskOutputComponent getOutputFirstRep() { 
3470      if (getOutput().isEmpty()) {
3471        addOutput();
3472      }
3473      return getOutput().get(0);
3474    }
3475
3476      protected void listChildren(List<Property> children) {
3477        super.listChildren(children);
3478        children.add(new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier));
3479        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition)", "The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.", 0, 1, instantiatesCanonical));
3480        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.", 0, 1, instantiatesUri));
3481        children.add(new Property("basedOn", "Reference(Any)", "BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a \"request\" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the \"request\" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient.", 0, java.lang.Integer.MAX_VALUE, basedOn));
3482        children.add(new Property("groupIdentifier", "Identifier", "An identifier that links together multiple tasks and other requests that were created in the same context.", 0, 1, groupIdentifier));
3483        children.add(new Property("partOf", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, partOf));
3484        children.add(new Property("status", "code", "The current status of the task.", 0, 1, status));
3485        children.add(new Property("statusReason", "CodeableConcept", "An explanation as to why this task is held, failed, was refused, etc.", 0, 1, statusReason));
3486        children.add(new Property("businessStatus", "CodeableConcept", "Contains business-specific nuances of the business state.", 0, 1, businessStatus));
3487        children.add(new Property("intent", "code", "Indicates the \"level\" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.", 0, 1, intent));
3488        children.add(new Property("priority", "code", "Indicates how quickly the Task should be addressed with respect to other requests.", 0, 1, priority));
3489        children.add(new Property("code", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, 1, code));
3490        children.add(new Property("description", "string", "A free-text description of what is to be performed.", 0, 1, description));
3491        children.add(new Property("focus", "Reference(Any)", "The request being actioned or the resource being manipulated by this task.", 0, 1, focus));
3492        children.add(new Property("for", "Reference(Any)", "The entity who benefits from the performance of the service specified in the task (e.g., the patient).", 0, 1, for_));
3493        children.add(new Property("encounter", "Reference(Encounter)", "The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.", 0, 1, encounter));
3494        children.add(new Property("executionPeriod", "Period", "Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).", 0, 1, executionPeriod));
3495        children.add(new Property("authoredOn", "dateTime", "The date and time this task was created.", 0, 1, authoredOn));
3496        children.add(new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, 1, lastModified));
3497        children.add(new Property("requester", "Reference(Device|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The creator of the task.", 0, 1, requester));
3498        children.add(new Property("performerType", "CodeableConcept", "The kind of participant that should perform the task.", 0, java.lang.Integer.MAX_VALUE, performerType));
3499        children.add(new Property("owner", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)", "Individual organization or Device currently responsible for task execution.", 0, 1, owner));
3500        children.add(new Property("location", "Reference(Location)", "Principal physical location where the this task is performed.", 0, 1, location));
3501        children.add(new Property("reasonCode", "CodeableConcept", "A description or code indicating why this task needs to be performed.", 0, 1, reasonCode));
3502        children.add(new Property("reasonReference", "Reference(Any)", "A resource reference indicating why this task needs to be performed.", 0, 1, reasonReference));
3503        children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.", 0, java.lang.Integer.MAX_VALUE, insurance));
3504        children.add(new Property("note", "Annotation", "Free-text information captured about the task as it progresses.", 0, java.lang.Integer.MAX_VALUE, note));
3505        children.add(new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.", 0, java.lang.Integer.MAX_VALUE, relevantHistory));
3506        children.add(new Property("restriction", "", "If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.", 0, 1, restriction));
3507        children.add(new Property("input", "", "Additional information that may be needed in the execution of the task.", 0, java.lang.Integer.MAX_VALUE, input));
3508        children.add(new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output));
3509      }
3510
3511      @Override
3512      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3513        switch (_hash) {
3514        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier);
3515        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition)", "The URL pointing to a *FHIR*-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.", 0, 1, instantiatesCanonical);
3516        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an *externally* maintained  protocol, guideline, orderset or other definition that is adhered to in whole or in part by this Task.", 0, 1, instantiatesUri);
3517        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(Any)", "BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a \"request\" resource such as a ServiceRequest, MedicationRequest, ServiceRequest, CarePlan, etc. which is distinct from the \"request\" resource the task is seeking to fulfill.  This latter resource is referenced by FocusOn.  For example, based on a ServiceRequest (= BasedOn), a task is created to fulfill a procedureRequest ( = FocusOn ) to collect a specimen from a patient.", 0, java.lang.Integer.MAX_VALUE, basedOn);
3518        case -445338488: /*groupIdentifier*/  return new Property("groupIdentifier", "Identifier", "An identifier that links together multiple tasks and other requests that were created in the same context.", 0, 1, groupIdentifier);
3519        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, partOf);
3520        case -892481550: /*status*/  return new Property("status", "code", "The current status of the task.", 0, 1, status);
3521        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "An explanation as to why this task is held, failed, was refused, etc.", 0, 1, statusReason);
3522        case 2008591314: /*businessStatus*/  return new Property("businessStatus", "CodeableConcept", "Contains business-specific nuances of the business state.", 0, 1, businessStatus);
3523        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the \"level\" of actionability associated with the Task, i.e. i+R[9]Cs this a proposed task, a planned task, an actionable task, etc.", 0, 1, intent);
3524        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the Task should be addressed with respect to other requests.", 0, 1, priority);
3525        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, 1, code);
3526        case -1724546052: /*description*/  return new Property("description", "string", "A free-text description of what is to be performed.", 0, 1, description);
3527        case 97604824: /*focus*/  return new Property("focus", "Reference(Any)", "The request being actioned or the resource being manipulated by this task.", 0, 1, focus);
3528        case 101577: /*for*/  return new Property("for", "Reference(Any)", "The entity who benefits from the performance of the service specified in the task (e.g., the patient).", 0, 1, for_);
3529        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.", 0, 1, encounter);
3530        case 1218624249: /*executionPeriod*/  return new Property("executionPeriod", "Period", "Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).", 0, 1, executionPeriod);
3531        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "The date and time this task was created.", 0, 1, authoredOn);
3532        case 1959003007: /*lastModified*/  return new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, 1, lastModified);
3533        case 693933948: /*requester*/  return new Property("requester", "Reference(Device|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The creator of the task.", 0, 1, requester);
3534        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "The kind of participant that should perform the task.", 0, java.lang.Integer.MAX_VALUE, performerType);
3535        case 106164915: /*owner*/  return new Property("owner", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|HealthcareService|Patient|Device|RelatedPerson)", "Individual organization or Device currently responsible for task execution.", 0, 1, owner);
3536        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Principal physical location where the this task is performed.", 0, 1, location);
3537        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "A description or code indicating why this task needs to be performed.", 0, 1, reasonCode);
3538        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Any)", "A resource reference indicating why this task needs to be performed.", 0, 1, reasonReference);
3539        case 73049818: /*insurance*/  return new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.", 0, java.lang.Integer.MAX_VALUE, insurance);
3540        case 3387378: /*note*/  return new Property("note", "Annotation", "Free-text information captured about the task as it progresses.", 0, java.lang.Integer.MAX_VALUE, note);
3541        case 1538891575: /*relevantHistory*/  return new Property("relevantHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.", 0, java.lang.Integer.MAX_VALUE, relevantHistory);
3542        case -1561062452: /*restriction*/  return new Property("restriction", "", "If the Task.focus is a request resource and the task is seeking fulfillment (i.e. is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.", 0, 1, restriction);
3543        case 100358090: /*input*/  return new Property("input", "", "Additional information that may be needed in the execution of the task.", 0, java.lang.Integer.MAX_VALUE, input);
3544        case -1005512447: /*output*/  return new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output);
3545        default: return super.getNamedProperty(_hash, _name, _checkValid);
3546        }
3547
3548      }
3549
3550      @Override
3551      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3552        switch (hash) {
3553        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3554        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : new Base[] {this.instantiatesCanonical}; // CanonicalType
3555        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : new Base[] {this.instantiatesUri}; // UriType
3556        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3557        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
3558        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
3559        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<TaskStatus>
3560        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
3561        case 2008591314: /*businessStatus*/ return this.businessStatus == null ? new Base[0] : new Base[] {this.businessStatus}; // CodeableConcept
3562        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<TaskIntent>
3563        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<TaskPriority>
3564        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3565        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3566        case 97604824: /*focus*/ return this.focus == null ? new Base[0] : new Base[] {this.focus}; // Reference
3567        case 101577: /*for*/ return this.for_ == null ? new Base[0] : new Base[] {this.for_}; // Reference
3568        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3569        case 1218624249: /*executionPeriod*/ return this.executionPeriod == null ? new Base[0] : new Base[] {this.executionPeriod}; // Period
3570        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
3571        case 1959003007: /*lastModified*/ return this.lastModified == null ? new Base[0] : new Base[] {this.lastModified}; // DateTimeType
3572        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference
3573        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
3574        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
3575        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3576        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : new Base[] {this.reasonCode}; // CodeableConcept
3577        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : new Base[] {this.reasonReference}; // Reference
3578        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
3579        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3580        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
3581        case -1561062452: /*restriction*/ return this.restriction == null ? new Base[0] : new Base[] {this.restriction}; // TaskRestrictionComponent
3582        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // ParameterComponent
3583        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // TaskOutputComponent
3584        default: return super.getProperty(hash, name, checkValid);
3585        }
3586
3587      }
3588
3589      @Override
3590      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3591        switch (hash) {
3592        case -1618432855: // identifier
3593          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3594          return value;
3595        case 8911915: // instantiatesCanonical
3596          this.instantiatesCanonical = castToCanonical(value); // CanonicalType
3597          return value;
3598        case -1926393373: // instantiatesUri
3599          this.instantiatesUri = castToUri(value); // UriType
3600          return value;
3601        case -332612366: // basedOn
3602          this.getBasedOn().add(castToReference(value)); // Reference
3603          return value;
3604        case -445338488: // groupIdentifier
3605          this.groupIdentifier = castToIdentifier(value); // Identifier
3606          return value;
3607        case -995410646: // partOf
3608          this.getPartOf().add(castToReference(value)); // Reference
3609          return value;
3610        case -892481550: // status
3611          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3612          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3613          return value;
3614        case 2051346646: // statusReason
3615          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3616          return value;
3617        case 2008591314: // businessStatus
3618          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3619          return value;
3620        case -1183762788: // intent
3621          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3622          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3623          return value;
3624        case -1165461084: // priority
3625          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3626          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3627          return value;
3628        case 3059181: // code
3629          this.code = castToCodeableConcept(value); // CodeableConcept
3630          return value;
3631        case -1724546052: // description
3632          this.description = castToString(value); // StringType
3633          return value;
3634        case 97604824: // focus
3635          this.focus = castToReference(value); // Reference
3636          return value;
3637        case 101577: // for
3638          this.for_ = castToReference(value); // Reference
3639          return value;
3640        case 1524132147: // encounter
3641          this.encounter = castToReference(value); // Reference
3642          return value;
3643        case 1218624249: // executionPeriod
3644          this.executionPeriod = castToPeriod(value); // Period
3645          return value;
3646        case -1500852503: // authoredOn
3647          this.authoredOn = castToDateTime(value); // DateTimeType
3648          return value;
3649        case 1959003007: // lastModified
3650          this.lastModified = castToDateTime(value); // DateTimeType
3651          return value;
3652        case 693933948: // requester
3653          this.requester = castToReference(value); // Reference
3654          return value;
3655        case -901444568: // performerType
3656          this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
3657          return value;
3658        case 106164915: // owner
3659          this.owner = castToReference(value); // Reference
3660          return value;
3661        case 1901043637: // location
3662          this.location = castToReference(value); // Reference
3663          return value;
3664        case 722137681: // reasonCode
3665          this.reasonCode = castToCodeableConcept(value); // CodeableConcept
3666          return value;
3667        case -1146218137: // reasonReference
3668          this.reasonReference = castToReference(value); // Reference
3669          return value;
3670        case 73049818: // insurance
3671          this.getInsurance().add(castToReference(value)); // Reference
3672          return value;
3673        case 3387378: // note
3674          this.getNote().add(castToAnnotation(value)); // Annotation
3675          return value;
3676        case 1538891575: // relevantHistory
3677          this.getRelevantHistory().add(castToReference(value)); // Reference
3678          return value;
3679        case -1561062452: // restriction
3680          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3681          return value;
3682        case 100358090: // input
3683          this.getInput().add((ParameterComponent) value); // ParameterComponent
3684          return value;
3685        case -1005512447: // output
3686          this.getOutput().add((TaskOutputComponent) value); // TaskOutputComponent
3687          return value;
3688        default: return super.setProperty(hash, name, value);
3689        }
3690
3691      }
3692
3693      @Override
3694      public Base setProperty(String name, Base value) throws FHIRException {
3695        if (name.equals("identifier")) {
3696          this.getIdentifier().add(castToIdentifier(value));
3697        } else if (name.equals("instantiatesCanonical")) {
3698          this.instantiatesCanonical = castToCanonical(value); // CanonicalType
3699        } else if (name.equals("instantiatesUri")) {
3700          this.instantiatesUri = castToUri(value); // UriType
3701        } else if (name.equals("basedOn")) {
3702          this.getBasedOn().add(castToReference(value));
3703        } else if (name.equals("groupIdentifier")) {
3704          this.groupIdentifier = castToIdentifier(value); // Identifier
3705        } else if (name.equals("partOf")) {
3706          this.getPartOf().add(castToReference(value));
3707        } else if (name.equals("status")) {
3708          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3709          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3710        } else if (name.equals("statusReason")) {
3711          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3712        } else if (name.equals("businessStatus")) {
3713          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3714        } else if (name.equals("intent")) {
3715          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3716          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3717        } else if (name.equals("priority")) {
3718          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3719          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3720        } else if (name.equals("code")) {
3721          this.code = castToCodeableConcept(value); // CodeableConcept
3722        } else if (name.equals("description")) {
3723          this.description = castToString(value); // StringType
3724        } else if (name.equals("focus")) {
3725          this.focus = castToReference(value); // Reference
3726        } else if (name.equals("for")) {
3727          this.for_ = castToReference(value); // Reference
3728        } else if (name.equals("encounter")) {
3729          this.encounter = castToReference(value); // Reference
3730        } else if (name.equals("executionPeriod")) {
3731          this.executionPeriod = castToPeriod(value); // Period
3732        } else if (name.equals("authoredOn")) {
3733          this.authoredOn = castToDateTime(value); // DateTimeType
3734        } else if (name.equals("lastModified")) {
3735          this.lastModified = castToDateTime(value); // DateTimeType
3736        } else if (name.equals("requester")) {
3737          this.requester = castToReference(value); // Reference
3738        } else if (name.equals("performerType")) {
3739          this.getPerformerType().add(castToCodeableConcept(value));
3740        } else if (name.equals("owner")) {
3741          this.owner = castToReference(value); // Reference
3742        } else if (name.equals("location")) {
3743          this.location = castToReference(value); // Reference
3744        } else if (name.equals("reasonCode")) {
3745          this.reasonCode = castToCodeableConcept(value); // CodeableConcept
3746        } else if (name.equals("reasonReference")) {
3747          this.reasonReference = castToReference(value); // Reference
3748        } else if (name.equals("insurance")) {
3749          this.getInsurance().add(castToReference(value));
3750        } else if (name.equals("note")) {
3751          this.getNote().add(castToAnnotation(value));
3752        } else if (name.equals("relevantHistory")) {
3753          this.getRelevantHistory().add(castToReference(value));
3754        } else if (name.equals("restriction")) {
3755          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3756        } else if (name.equals("input")) {
3757          this.getInput().add((ParameterComponent) value);
3758        } else if (name.equals("output")) {
3759          this.getOutput().add((TaskOutputComponent) value);
3760        } else
3761          return super.setProperty(name, value);
3762        return value;
3763      }
3764
3765      @Override
3766      public Base makeProperty(int hash, String name) throws FHIRException {
3767        switch (hash) {
3768        case -1618432855:  return addIdentifier(); 
3769        case 8911915:  return getInstantiatesCanonicalElement();
3770        case -1926393373:  return getInstantiatesUriElement();
3771        case -332612366:  return addBasedOn(); 
3772        case -445338488:  return getGroupIdentifier(); 
3773        case -995410646:  return addPartOf(); 
3774        case -892481550:  return getStatusElement();
3775        case 2051346646:  return getStatusReason(); 
3776        case 2008591314:  return getBusinessStatus(); 
3777        case -1183762788:  return getIntentElement();
3778        case -1165461084:  return getPriorityElement();
3779        case 3059181:  return getCode(); 
3780        case -1724546052:  return getDescriptionElement();
3781        case 97604824:  return getFocus(); 
3782        case 101577:  return getFor(); 
3783        case 1524132147:  return getEncounter(); 
3784        case 1218624249:  return getExecutionPeriod(); 
3785        case -1500852503:  return getAuthoredOnElement();
3786        case 1959003007:  return getLastModifiedElement();
3787        case 693933948:  return getRequester(); 
3788        case -901444568:  return addPerformerType(); 
3789        case 106164915:  return getOwner(); 
3790        case 1901043637:  return getLocation(); 
3791        case 722137681:  return getReasonCode(); 
3792        case -1146218137:  return getReasonReference(); 
3793        case 73049818:  return addInsurance(); 
3794        case 3387378:  return addNote(); 
3795        case 1538891575:  return addRelevantHistory(); 
3796        case -1561062452:  return getRestriction(); 
3797        case 100358090:  return addInput(); 
3798        case -1005512447:  return addOutput(); 
3799        default: return super.makeProperty(hash, name);
3800        }
3801
3802      }
3803
3804      @Override
3805      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3806        switch (hash) {
3807        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3808        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3809        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3810        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3811        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
3812        case -995410646: /*partOf*/ return new String[] {"Reference"};
3813        case -892481550: /*status*/ return new String[] {"code"};
3814        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3815        case 2008591314: /*businessStatus*/ return new String[] {"CodeableConcept"};
3816        case -1183762788: /*intent*/ return new String[] {"code"};
3817        case -1165461084: /*priority*/ return new String[] {"code"};
3818        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3819        case -1724546052: /*description*/ return new String[] {"string"};
3820        case 97604824: /*focus*/ return new String[] {"Reference"};
3821        case 101577: /*for*/ return new String[] {"Reference"};
3822        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3823        case 1218624249: /*executionPeriod*/ return new String[] {"Period"};
3824        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
3825        case 1959003007: /*lastModified*/ return new String[] {"dateTime"};
3826        case 693933948: /*requester*/ return new String[] {"Reference"};
3827        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
3828        case 106164915: /*owner*/ return new String[] {"Reference"};
3829        case 1901043637: /*location*/ return new String[] {"Reference"};
3830        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
3831        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
3832        case 73049818: /*insurance*/ return new String[] {"Reference"};
3833        case 3387378: /*note*/ return new String[] {"Annotation"};
3834        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
3835        case -1561062452: /*restriction*/ return new String[] {};
3836        case 100358090: /*input*/ return new String[] {};
3837        case -1005512447: /*output*/ return new String[] {};
3838        default: return super.getTypesForProperty(hash, name);
3839        }
3840
3841      }
3842
3843      @Override
3844      public Base addChild(String name) throws FHIRException {
3845        if (name.equals("identifier")) {
3846          return addIdentifier();
3847        }
3848        else if (name.equals("instantiatesCanonical")) {
3849          throw new FHIRException("Cannot call addChild on a primitive type Task.instantiatesCanonical");
3850        }
3851        else if (name.equals("instantiatesUri")) {
3852          throw new FHIRException("Cannot call addChild on a primitive type Task.instantiatesUri");
3853        }
3854        else if (name.equals("basedOn")) {
3855          return addBasedOn();
3856        }
3857        else if (name.equals("groupIdentifier")) {
3858          this.groupIdentifier = new Identifier();
3859          return this.groupIdentifier;
3860        }
3861        else if (name.equals("partOf")) {
3862          return addPartOf();
3863        }
3864        else if (name.equals("status")) {
3865          throw new FHIRException("Cannot call addChild on a primitive type Task.status");
3866        }
3867        else if (name.equals("statusReason")) {
3868          this.statusReason = new CodeableConcept();
3869          return this.statusReason;
3870        }
3871        else if (name.equals("businessStatus")) {
3872          this.businessStatus = new CodeableConcept();
3873          return this.businessStatus;
3874        }
3875        else if (name.equals("intent")) {
3876          throw new FHIRException("Cannot call addChild on a primitive type Task.intent");
3877        }
3878        else if (name.equals("priority")) {
3879          throw new FHIRException("Cannot call addChild on a primitive type Task.priority");
3880        }
3881        else if (name.equals("code")) {
3882          this.code = new CodeableConcept();
3883          return this.code;
3884        }
3885        else if (name.equals("description")) {
3886          throw new FHIRException("Cannot call addChild on a primitive type Task.description");
3887        }
3888        else if (name.equals("focus")) {
3889          this.focus = new Reference();
3890          return this.focus;
3891        }
3892        else if (name.equals("for")) {
3893          this.for_ = new Reference();
3894          return this.for_;
3895        }
3896        else if (name.equals("encounter")) {
3897          this.encounter = new Reference();
3898          return this.encounter;
3899        }
3900        else if (name.equals("executionPeriod")) {
3901          this.executionPeriod = new Period();
3902          return this.executionPeriod;
3903        }
3904        else if (name.equals("authoredOn")) {
3905          throw new FHIRException("Cannot call addChild on a primitive type Task.authoredOn");
3906        }
3907        else if (name.equals("lastModified")) {
3908          throw new FHIRException("Cannot call addChild on a primitive type Task.lastModified");
3909        }
3910        else if (name.equals("requester")) {
3911          this.requester = new Reference();
3912          return this.requester;
3913        }
3914        else if (name.equals("performerType")) {
3915          return addPerformerType();
3916        }
3917        else if (name.equals("owner")) {
3918          this.owner = new Reference();
3919          return this.owner;
3920        }
3921        else if (name.equals("location")) {
3922          this.location = new Reference();
3923          return this.location;
3924        }
3925        else if (name.equals("reasonCode")) {
3926          this.reasonCode = new CodeableConcept();
3927          return this.reasonCode;
3928        }
3929        else if (name.equals("reasonReference")) {
3930          this.reasonReference = new Reference();
3931          return this.reasonReference;
3932        }
3933        else if (name.equals("insurance")) {
3934          return addInsurance();
3935        }
3936        else if (name.equals("note")) {
3937          return addNote();
3938        }
3939        else if (name.equals("relevantHistory")) {
3940          return addRelevantHistory();
3941        }
3942        else if (name.equals("restriction")) {
3943          this.restriction = new TaskRestrictionComponent();
3944          return this.restriction;
3945        }
3946        else if (name.equals("input")) {
3947          return addInput();
3948        }
3949        else if (name.equals("output")) {
3950          return addOutput();
3951        }
3952        else
3953          return super.addChild(name);
3954      }
3955
3956  public String fhirType() {
3957    return "Task";
3958
3959  }
3960
3961      public Task copy() {
3962        Task dst = new Task();
3963        copyValues(dst);
3964        if (identifier != null) {
3965          dst.identifier = new ArrayList<Identifier>();
3966          for (Identifier i : identifier)
3967            dst.identifier.add(i.copy());
3968        };
3969        dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
3970        dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
3971        if (basedOn != null) {
3972          dst.basedOn = new ArrayList<Reference>();
3973          for (Reference i : basedOn)
3974            dst.basedOn.add(i.copy());
3975        };
3976        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
3977        if (partOf != null) {
3978          dst.partOf = new ArrayList<Reference>();
3979          for (Reference i : partOf)
3980            dst.partOf.add(i.copy());
3981        };
3982        dst.status = status == null ? null : status.copy();
3983        dst.statusReason = statusReason == null ? null : statusReason.copy();
3984        dst.businessStatus = businessStatus == null ? null : businessStatus.copy();
3985        dst.intent = intent == null ? null : intent.copy();
3986        dst.priority = priority == null ? null : priority.copy();
3987        dst.code = code == null ? null : code.copy();
3988        dst.description = description == null ? null : description.copy();
3989        dst.focus = focus == null ? null : focus.copy();
3990        dst.for_ = for_ == null ? null : for_.copy();
3991        dst.encounter = encounter == null ? null : encounter.copy();
3992        dst.executionPeriod = executionPeriod == null ? null : executionPeriod.copy();
3993        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
3994        dst.lastModified = lastModified == null ? null : lastModified.copy();
3995        dst.requester = requester == null ? null : requester.copy();
3996        if (performerType != null) {
3997          dst.performerType = new ArrayList<CodeableConcept>();
3998          for (CodeableConcept i : performerType)
3999            dst.performerType.add(i.copy());
4000        };
4001        dst.owner = owner == null ? null : owner.copy();
4002        dst.location = location == null ? null : location.copy();
4003        dst.reasonCode = reasonCode == null ? null : reasonCode.copy();
4004        dst.reasonReference = reasonReference == null ? null : reasonReference.copy();
4005        if (insurance != null) {
4006          dst.insurance = new ArrayList<Reference>();
4007          for (Reference i : insurance)
4008            dst.insurance.add(i.copy());
4009        };
4010        if (note != null) {
4011          dst.note = new ArrayList<Annotation>();
4012          for (Annotation i : note)
4013            dst.note.add(i.copy());
4014        };
4015        if (relevantHistory != null) {
4016          dst.relevantHistory = new ArrayList<Reference>();
4017          for (Reference i : relevantHistory)
4018            dst.relevantHistory.add(i.copy());
4019        };
4020        dst.restriction = restriction == null ? null : restriction.copy();
4021        if (input != null) {
4022          dst.input = new ArrayList<ParameterComponent>();
4023          for (ParameterComponent i : input)
4024            dst.input.add(i.copy());
4025        };
4026        if (output != null) {
4027          dst.output = new ArrayList<TaskOutputComponent>();
4028          for (TaskOutputComponent i : output)
4029            dst.output.add(i.copy());
4030        };
4031        return dst;
4032      }
4033
4034      protected Task typedCopy() {
4035        return copy();
4036      }
4037
4038      @Override
4039      public boolean equalsDeep(Base other_) {
4040        if (!super.equalsDeep(other_))
4041          return false;
4042        if (!(other_ instanceof Task))
4043          return false;
4044        Task o = (Task) other_;
4045        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4046           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
4047           && compareDeep(groupIdentifier, o.groupIdentifier, true) && compareDeep(partOf, o.partOf, true)
4048           && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(businessStatus, o.businessStatus, true)
4049           && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
4050           && compareDeep(description, o.description, true) && compareDeep(focus, o.focus, true) && compareDeep(for_, o.for_, true)
4051           && compareDeep(encounter, o.encounter, true) && compareDeep(executionPeriod, o.executionPeriod, true)
4052           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(lastModified, o.lastModified, true)
4053           && compareDeep(requester, o.requester, true) && compareDeep(performerType, o.performerType, true)
4054           && compareDeep(owner, o.owner, true) && compareDeep(location, o.location, true) && compareDeep(reasonCode, o.reasonCode, true)
4055           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(insurance, o.insurance, true)
4056           && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true) && compareDeep(restriction, o.restriction, true)
4057           && compareDeep(input, o.input, true) && compareDeep(output, o.output, true);
4058      }
4059
4060      @Override
4061      public boolean equalsShallow(Base other_) {
4062        if (!super.equalsShallow(other_))
4063          return false;
4064        if (!(other_ instanceof Task))
4065          return false;
4066        Task o = (Task) other_;
4067        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
4068           && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) && compareValues(description, o.description, true)
4069           && compareValues(authoredOn, o.authoredOn, true) && compareValues(lastModified, o.lastModified, true)
4070          ;
4071      }
4072
4073      public boolean isEmpty() {
4074        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4075          , instantiatesUri, basedOn, groupIdentifier, partOf, status, statusReason, businessStatus
4076          , intent, priority, code, description, focus, for_, encounter, executionPeriod
4077          , authoredOn, lastModified, requester, performerType, owner, location, reasonCode
4078          , reasonReference, insurance, note, relevantHistory, restriction, input, output
4079          );
4080      }
4081
4082  @Override
4083  public ResourceType getResourceType() {
4084    return ResourceType.Task;
4085   }
4086
4087 /**
4088   * Search parameter: <b>owner</b>
4089   * <p>
4090   * Description: <b>Search by task owner</b><br>
4091   * Type: <b>reference</b><br>
4092   * Path: <b>Task.owner</b><br>
4093   * </p>
4094   */
4095  @SearchParamDefinition(name="owner", path="Task.owner", description="Search by task owner", type="reference", target={CareTeam.class, Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
4096  public static final String SP_OWNER = "owner";
4097 /**
4098   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
4099   * <p>
4100   * Description: <b>Search by task owner</b><br>
4101   * Type: <b>reference</b><br>
4102   * Path: <b>Task.owner</b><br>
4103   * </p>
4104   */
4105  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
4106
4107/**
4108   * Constant for fluent queries to be used to add include statements. Specifies
4109   * the path value of "<b>Task:owner</b>".
4110   */
4111  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Task:owner").toLocked();
4112
4113 /**
4114   * Search parameter: <b>requester</b>
4115   * <p>
4116   * Description: <b>Search by task requester</b><br>
4117   * Type: <b>reference</b><br>
4118   * Path: <b>Task.requester</b><br>
4119   * </p>
4120   */
4121  @SearchParamDefinition(name="requester", path="Task.requester", description="Search by task requester", type="reference", target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
4122  public static final String SP_REQUESTER = "requester";
4123 /**
4124   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
4125   * <p>
4126   * Description: <b>Search by task requester</b><br>
4127   * Type: <b>reference</b><br>
4128   * Path: <b>Task.requester</b><br>
4129   * </p>
4130   */
4131  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
4132
4133/**
4134   * Constant for fluent queries to be used to add include statements. Specifies
4135   * the path value of "<b>Task:requester</b>".
4136   */
4137  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("Task:requester").toLocked();
4138
4139 /**
4140   * Search parameter: <b>identifier</b>
4141   * <p>
4142   * Description: <b>Search for a task instance by its business identifier</b><br>
4143   * Type: <b>token</b><br>
4144   * Path: <b>Task.identifier</b><br>
4145   * </p>
4146   */
4147  @SearchParamDefinition(name="identifier", path="Task.identifier", description="Search for a task instance by its business identifier", type="token" )
4148  public static final String SP_IDENTIFIER = "identifier";
4149 /**
4150   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4151   * <p>
4152   * Description: <b>Search for a task instance by its business identifier</b><br>
4153   * Type: <b>token</b><br>
4154   * Path: <b>Task.identifier</b><br>
4155   * </p>
4156   */
4157  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4158
4159 /**
4160   * Search parameter: <b>business-status</b>
4161   * <p>
4162   * Description: <b>Search by business status</b><br>
4163   * Type: <b>token</b><br>
4164   * Path: <b>Task.businessStatus</b><br>
4165   * </p>
4166   */
4167  @SearchParamDefinition(name="business-status", path="Task.businessStatus", description="Search by business status", type="token" )
4168  public static final String SP_BUSINESS_STATUS = "business-status";
4169 /**
4170   * <b>Fluent Client</b> search parameter constant for <b>business-status</b>
4171   * <p>
4172   * Description: <b>Search by business status</b><br>
4173   * Type: <b>token</b><br>
4174   * Path: <b>Task.businessStatus</b><br>
4175   * </p>
4176   */
4177  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BUSINESS_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BUSINESS_STATUS);
4178
4179 /**
4180   * Search parameter: <b>period</b>
4181   * <p>
4182   * Description: <b>Search by period Task is/was underway</b><br>
4183   * Type: <b>date</b><br>
4184   * Path: <b>Task.executionPeriod</b><br>
4185   * </p>
4186   */
4187  @SearchParamDefinition(name="period", path="Task.executionPeriod", description="Search by period Task is/was underway", type="date" )
4188  public static final String SP_PERIOD = "period";
4189 /**
4190   * <b>Fluent Client</b> search parameter constant for <b>period</b>
4191   * <p>
4192   * Description: <b>Search by period Task is/was underway</b><br>
4193   * Type: <b>date</b><br>
4194   * Path: <b>Task.executionPeriod</b><br>
4195   * </p>
4196   */
4197  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
4198
4199 /**
4200   * Search parameter: <b>code</b>
4201   * <p>
4202   * Description: <b>Search by task code</b><br>
4203   * Type: <b>token</b><br>
4204   * Path: <b>Task.code</b><br>
4205   * </p>
4206   */
4207  @SearchParamDefinition(name="code", path="Task.code", description="Search by task code", type="token" )
4208  public static final String SP_CODE = "code";
4209 /**
4210   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4211   * <p>
4212   * Description: <b>Search by task code</b><br>
4213   * Type: <b>token</b><br>
4214   * Path: <b>Task.code</b><br>
4215   * </p>
4216   */
4217  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4218
4219 /**
4220   * Search parameter: <b>performer</b>
4221   * <p>
4222   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
4223   * Type: <b>token</b><br>
4224   * Path: <b>Task.performerType</b><br>
4225   * </p>
4226   */
4227  @SearchParamDefinition(name="performer", path="Task.performerType", description="Search by recommended type of performer (e.g., Requester, Performer, Scheduler).", type="token" )
4228  public static final String SP_PERFORMER = "performer";
4229 /**
4230   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
4231   * <p>
4232   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
4233   * Type: <b>token</b><br>
4234   * Path: <b>Task.performerType</b><br>
4235   * </p>
4236   */
4237  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PERFORMER);
4238
4239 /**
4240   * Search parameter: <b>subject</b>
4241   * <p>
4242   * Description: <b>Search by subject</b><br>
4243   * Type: <b>reference</b><br>
4244   * Path: <b>Task.for</b><br>
4245   * </p>
4246   */
4247  @SearchParamDefinition(name="subject", path="Task.for", description="Search by subject", type="reference" )
4248  public static final String SP_SUBJECT = "subject";
4249 /**
4250   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4251   * <p>
4252   * Description: <b>Search by subject</b><br>
4253   * Type: <b>reference</b><br>
4254   * Path: <b>Task.for</b><br>
4255   * </p>
4256   */
4257  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4258
4259/**
4260   * Constant for fluent queries to be used to add include statements. Specifies
4261   * the path value of "<b>Task:subject</b>".
4262   */
4263  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Task:subject").toLocked();
4264
4265 /**
4266   * Search parameter: <b>focus</b>
4267   * <p>
4268   * Description: <b>Search by task focus</b><br>
4269   * Type: <b>reference</b><br>
4270   * Path: <b>Task.focus</b><br>
4271   * </p>
4272   */
4273  @SearchParamDefinition(name="focus", path="Task.focus", description="Search by task focus", type="reference" )
4274  public static final String SP_FOCUS = "focus";
4275 /**
4276   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
4277   * <p>
4278   * Description: <b>Search by task focus</b><br>
4279   * Type: <b>reference</b><br>
4280   * Path: <b>Task.focus</b><br>
4281   * </p>
4282   */
4283  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOCUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FOCUS);
4284
4285/**
4286   * Constant for fluent queries to be used to add include statements. Specifies
4287   * the path value of "<b>Task:focus</b>".
4288   */
4289  public static final ca.uhn.fhir.model.api.Include INCLUDE_FOCUS = new ca.uhn.fhir.model.api.Include("Task:focus").toLocked();
4290
4291 /**
4292   * Search parameter: <b>part-of</b>
4293   * <p>
4294   * Description: <b>Search by task this task is part of</b><br>
4295   * Type: <b>reference</b><br>
4296   * Path: <b>Task.partOf</b><br>
4297   * </p>
4298   */
4299  @SearchParamDefinition(name="part-of", path="Task.partOf", description="Search by task this task is part of", type="reference", target={Task.class } )
4300  public static final String SP_PART_OF = "part-of";
4301 /**
4302   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
4303   * <p>
4304   * Description: <b>Search by task this task is part of</b><br>
4305   * Type: <b>reference</b><br>
4306   * Path: <b>Task.partOf</b><br>
4307   * </p>
4308   */
4309  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
4310
4311/**
4312   * Constant for fluent queries to be used to add include statements. Specifies
4313   * the path value of "<b>Task:part-of</b>".
4314   */
4315  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Task:part-of").toLocked();
4316
4317 /**
4318   * Search parameter: <b>encounter</b>
4319   * <p>
4320   * Description: <b>Search by encounter</b><br>
4321   * Type: <b>reference</b><br>
4322   * Path: <b>Task.encounter</b><br>
4323   * </p>
4324   */
4325  @SearchParamDefinition(name="encounter", path="Task.encounter", description="Search by encounter", type="reference", target={Encounter.class } )
4326  public static final String SP_ENCOUNTER = "encounter";
4327 /**
4328   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4329   * <p>
4330   * Description: <b>Search by encounter</b><br>
4331   * Type: <b>reference</b><br>
4332   * Path: <b>Task.encounter</b><br>
4333   * </p>
4334   */
4335  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4336
4337/**
4338   * Constant for fluent queries to be used to add include statements. Specifies
4339   * the path value of "<b>Task:encounter</b>".
4340   */
4341  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Task:encounter").toLocked();
4342
4343 /**
4344   * Search parameter: <b>priority</b>
4345   * <p>
4346   * Description: <b>Search by task priority</b><br>
4347   * Type: <b>token</b><br>
4348   * Path: <b>Task.priority</b><br>
4349   * </p>
4350   */
4351  @SearchParamDefinition(name="priority", path="Task.priority", description="Search by task priority", type="token" )
4352  public static final String SP_PRIORITY = "priority";
4353 /**
4354   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
4355   * <p>
4356   * Description: <b>Search by task priority</b><br>
4357   * Type: <b>token</b><br>
4358   * Path: <b>Task.priority</b><br>
4359   * </p>
4360   */
4361  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
4362
4363 /**
4364   * Search parameter: <b>authored-on</b>
4365   * <p>
4366   * Description: <b>Search by creation date</b><br>
4367   * Type: <b>date</b><br>
4368   * Path: <b>Task.authoredOn</b><br>
4369   * </p>
4370   */
4371  @SearchParamDefinition(name="authored-on", path="Task.authoredOn", description="Search by creation date", type="date" )
4372  public static final String SP_AUTHORED_ON = "authored-on";
4373 /**
4374   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
4375   * <p>
4376   * Description: <b>Search by creation date</b><br>
4377   * Type: <b>date</b><br>
4378   * Path: <b>Task.authoredOn</b><br>
4379   * </p>
4380   */
4381  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED_ON);
4382
4383 /**
4384   * Search parameter: <b>intent</b>
4385   * <p>
4386   * Description: <b>Search by task intent</b><br>
4387   * Type: <b>token</b><br>
4388   * Path: <b>Task.intent</b><br>
4389   * </p>
4390   */
4391  @SearchParamDefinition(name="intent", path="Task.intent", description="Search by task intent", type="token" )
4392  public static final String SP_INTENT = "intent";
4393 /**
4394   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
4395   * <p>
4396   * Description: <b>Search by task intent</b><br>
4397   * Type: <b>token</b><br>
4398   * Path: <b>Task.intent</b><br>
4399   * </p>
4400   */
4401  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4402
4403 /**
4404   * Search parameter: <b>group-identifier</b>
4405   * <p>
4406   * Description: <b>Search by group identifier</b><br>
4407   * Type: <b>token</b><br>
4408   * Path: <b>Task.groupIdentifier</b><br>
4409   * </p>
4410   */
4411  @SearchParamDefinition(name="group-identifier", path="Task.groupIdentifier", description="Search by group identifier", type="token" )
4412  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
4413 /**
4414   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
4415   * <p>
4416   * Description: <b>Search by group identifier</b><br>
4417   * Type: <b>token</b><br>
4418   * Path: <b>Task.groupIdentifier</b><br>
4419   * </p>
4420   */
4421  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
4422
4423 /**
4424   * Search parameter: <b>based-on</b>
4425   * <p>
4426   * Description: <b>Search by requests this task is based on</b><br>
4427   * Type: <b>reference</b><br>
4428   * Path: <b>Task.basedOn</b><br>
4429   * </p>
4430   */
4431  @SearchParamDefinition(name="based-on", path="Task.basedOn", description="Search by requests this task is based on", type="reference" )
4432  public static final String SP_BASED_ON = "based-on";
4433 /**
4434   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
4435   * <p>
4436   * Description: <b>Search by requests this task is based on</b><br>
4437   * Type: <b>reference</b><br>
4438   * Path: <b>Task.basedOn</b><br>
4439   * </p>
4440   */
4441  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
4442
4443/**
4444   * Constant for fluent queries to be used to add include statements. Specifies
4445   * the path value of "<b>Task:based-on</b>".
4446   */
4447  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Task:based-on").toLocked();
4448
4449 /**
4450   * Search parameter: <b>patient</b>
4451   * <p>
4452   * Description: <b>Search by patient</b><br>
4453   * Type: <b>reference</b><br>
4454   * Path: <b>Task.for</b><br>
4455   * </p>
4456   */
4457  @SearchParamDefinition(name="patient", path="Task.for.where(resolve() is Patient)", description="Search by patient", type="reference", target={Patient.class } )
4458  public static final String SP_PATIENT = "patient";
4459 /**
4460   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4461   * <p>
4462   * Description: <b>Search by patient</b><br>
4463   * Type: <b>reference</b><br>
4464   * Path: <b>Task.for</b><br>
4465   * </p>
4466   */
4467  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4468
4469/**
4470   * Constant for fluent queries to be used to add include statements. Specifies
4471   * the path value of "<b>Task:patient</b>".
4472   */
4473  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Task:patient").toLocked();
4474
4475 /**
4476   * Search parameter: <b>modified</b>
4477   * <p>
4478   * Description: <b>Search by last modification date</b><br>
4479   * Type: <b>date</b><br>
4480   * Path: <b>Task.lastModified</b><br>
4481   * </p>
4482   */
4483  @SearchParamDefinition(name="modified", path="Task.lastModified", description="Search by last modification date", type="date" )
4484  public static final String SP_MODIFIED = "modified";
4485 /**
4486   * <b>Fluent Client</b> search parameter constant for <b>modified</b>
4487   * <p>
4488   * Description: <b>Search by last modification date</b><br>
4489   * Type: <b>date</b><br>
4490   * Path: <b>Task.lastModified</b><br>
4491   * </p>
4492   */
4493  public static final ca.uhn.fhir.rest.gclient.DateClientParam MODIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_MODIFIED);
4494
4495 /**
4496   * Search parameter: <b>status</b>
4497   * <p>
4498   * Description: <b>Search by task status</b><br>
4499   * Type: <b>token</b><br>
4500   * Path: <b>Task.status</b><br>
4501   * </p>
4502   */
4503  @SearchParamDefinition(name="status", path="Task.status", description="Search by task status", type="token" )
4504  public static final String SP_STATUS = "status";
4505 /**
4506   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4507   * <p>
4508   * Description: <b>Search by task status</b><br>
4509   * Type: <b>token</b><br>
4510   * Path: <b>Task.status</b><br>
4511   * </p>
4512   */
4513  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4514
4515
4516}
4517