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, Sep 13, 2018 09:04-0400 for FHIR v3.5.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, 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|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|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("valueParameterDefinition")) {
1296          this.value = new ParameterDefinition();
1297          return this.value;
1298        }
1299        else if (name.equals("valueDataRequirement")) {
1300          this.value = new DataRequirement();
1301          return this.value;
1302        }
1303        else if (name.equals("valueRelatedArtifact")) {
1304          this.value = new RelatedArtifact();
1305          return this.value;
1306        }
1307        else if (name.equals("valueContactDetail")) {
1308          this.value = new ContactDetail();
1309          return this.value;
1310        }
1311        else if (name.equals("valueContributor")) {
1312          this.value = new Contributor();
1313          return this.value;
1314        }
1315        else if (name.equals("valueTriggerDefinition")) {
1316          this.value = new TriggerDefinition();
1317          return this.value;
1318        }
1319        else if (name.equals("valueExpression")) {
1320          this.value = new Expression();
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("valueParameterDefinition")) {
1727          this.value = new ParameterDefinition();
1728          return this.value;
1729        }
1730        else if (name.equals("valueDataRequirement")) {
1731          this.value = new DataRequirement();
1732          return this.value;
1733        }
1734        else if (name.equals("valueRelatedArtifact")) {
1735          this.value = new RelatedArtifact();
1736          return this.value;
1737        }
1738        else if (name.equals("valueContactDetail")) {
1739          this.value = new ContactDetail();
1740          return this.value;
1741        }
1742        else if (name.equals("valueContributor")) {
1743          this.value = new Contributor();
1744          return this.value;
1745        }
1746        else if (name.equals("valueTriggerDefinition")) {
1747          this.value = new TriggerDefinition();
1748          return this.value;
1749        }
1750        else if (name.equals("valueExpression")) {
1751          this.value = new Expression();
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    protected CodeableConcept code;
1901
1902    /**
1903     * A free-text description of what is to be performed.
1904     */
1905    @Child(name = "description", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
1906    @Description(shortDefinition="Human-readable explanation of task", formalDefinition="A free-text description of what is to be performed." )
1907    protected StringType description;
1908
1909    /**
1910     * The request being actioned or the resource being manipulated by this task.
1911     */
1912    @Child(name = "focus", type = {Reference.class}, order=13, min=0, max=1, modifier=false, summary=true)
1913    @Description(shortDefinition="What task is acting on", formalDefinition="The request being actioned or the resource being manipulated by this task." )
1914    protected Reference focus;
1915
1916    /**
1917     * The actual object that is the target of the reference (The request being actioned or the resource being manipulated by this task.)
1918     */
1919    protected Resource focusTarget;
1920
1921    /**
1922     * The entity who benefits from the performance of the service specified in the task (e.g., the patient).
1923     */
1924    @Child(name = "for", type = {Reference.class}, order=14, min=0, max=1, modifier=false, summary=true)
1925    @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)." )
1926    protected Reference for_;
1927
1928    /**
1929     * 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).)
1930     */
1931    protected Resource for_Target;
1932
1933    /**
1934     * The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.
1935     */
1936    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=15, min=0, max=1, modifier=false, summary=true)
1937    @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." )
1938    protected Reference context;
1939
1940    /**
1941     * 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.)
1942     */
1943    protected Resource contextTarget;
1944
1945    /**
1946     * 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).
1947     */
1948    @Child(name = "executionPeriod", type = {Period.class}, order=16, min=0, max=1, modifier=false, summary=true)
1949    @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)." )
1950    protected Period executionPeriod;
1951
1952    /**
1953     * The date and time this task was created.
1954     */
1955    @Child(name = "authoredOn", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1956    @Description(shortDefinition="Task Creation Date", formalDefinition="The date and time this task was created." )
1957    protected DateTimeType authoredOn;
1958
1959    /**
1960     * The date and time of last modification to this task.
1961     */
1962    @Child(name = "lastModified", type = {DateTimeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1963    @Description(shortDefinition="Task Last Modified Date", formalDefinition="The date and time of last modification to this task." )
1964    protected DateTimeType lastModified;
1965
1966    /**
1967     * The creator of the task.
1968     */
1969    @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)
1970    @Description(shortDefinition="Who is asking for task to be done", formalDefinition="The creator of the task." )
1971    protected Reference requester;
1972
1973    /**
1974     * The actual object that is the target of the reference (The creator of the task.)
1975     */
1976    protected Resource requesterTarget;
1977
1978    /**
1979     * The type of participant that can execute the task.
1980     */
1981    @Child(name = "performerType", type = {CodeableConcept.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1982    @Description(shortDefinition="requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer", formalDefinition="The type of participant that can execute the task." )
1983    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-performer-type")
1984    protected List<CodeableConcept> performerType;
1985
1986    /**
1987     * Individual organization or Device currently responsible for task execution.
1988     */
1989    @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)
1990    @Description(shortDefinition="Responsible individual", formalDefinition="Individual organization or Device currently responsible for task execution." )
1991    protected Reference owner;
1992
1993    /**
1994     * The actual object that is the target of the reference (Individual organization or Device currently responsible for task execution.)
1995     */
1996    protected Resource ownerTarget;
1997
1998    /**
1999     * The principal physical location where the this task is performed.
2000     */
2001    @Child(name = "location", type = {Location.class}, order=22, min=0, max=1, modifier=false, summary=true)
2002    @Description(shortDefinition="Where task occurs", formalDefinition="The principal physical location where the this task is performed." )
2003    protected Reference location;
2004
2005    /**
2006     * The actual object that is the target of the reference (The principal physical location where the this task is performed.)
2007     */
2008    protected Location locationTarget;
2009
2010    /**
2011     * A description or code indicating why this task needs to be performed.
2012     */
2013    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=23, min=0, max=1, modifier=false, summary=false)
2014    @Description(shortDefinition="Why task is needed", formalDefinition="A description or code indicating why this task needs to be performed." )
2015    protected CodeableConcept reasonCode;
2016
2017    /**
2018     * A resource reference indicating why this task needs to be performed.
2019     */
2020    @Child(name = "reasonReference", type = {Reference.class}, order=24, min=0, max=1, modifier=false, summary=false)
2021    @Description(shortDefinition="Why task is needed", formalDefinition="A resource reference indicating why this task needs to be performed." )
2022    protected Reference reasonReference;
2023
2024    /**
2025     * The actual object that is the target of the reference (A resource reference indicating why this task needs to be performed.)
2026     */
2027    protected Resource reasonReferenceTarget;
2028
2029    /**
2030     * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.
2031     */
2032    @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2033    @Description(shortDefinition="Associated insurance coverage", formalDefinition="Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task." )
2034    protected List<Reference> insurance;
2035    /**
2036     * 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.)
2037     */
2038    protected List<Resource> insuranceTarget;
2039
2040
2041    /**
2042     * Free-text information captured about the task as it progresses.
2043     */
2044    @Child(name = "note", type = {Annotation.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2045    @Description(shortDefinition="Comments made about the task", formalDefinition="Free-text information captured about the task as it progresses." )
2046    protected List<Annotation> note;
2047
2048    /**
2049     * 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.
2050     */
2051    @Child(name = "relevantHistory", type = {Provenance.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2052    @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." )
2053    protected List<Reference> relevantHistory;
2054    /**
2055     * 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.)
2056     */
2057    protected List<Provenance> relevantHistoryTarget;
2058
2059
2060    /**
2061     * 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.
2062     */
2063    @Child(name = "restriction", type = {}, order=28, min=0, max=1, modifier=false, summary=false)
2064    @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." )
2065    protected TaskRestrictionComponent restriction;
2066
2067    /**
2068     * Additional information that may be needed in the execution of the task.
2069     */
2070    @Child(name = "input", type = {}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2071    @Description(shortDefinition="Information used to perform task", formalDefinition="Additional information that may be needed in the execution of the task." )
2072    protected List<ParameterComponent> input;
2073
2074    /**
2075     * Outputs produced by the Task.
2076     */
2077    @Child(name = "output", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2078    @Description(shortDefinition="Information produced as part of task", formalDefinition="Outputs produced by the Task." )
2079    protected List<TaskOutputComponent> output;
2080
2081    private static final long serialVersionUID = -995373407L;
2082
2083  /**
2084   * Constructor
2085   */
2086    public Task() {
2087      super();
2088    }
2089
2090  /**
2091   * Constructor
2092   */
2093    public Task(Enumeration<TaskStatus> status, Enumeration<TaskIntent> intent) {
2094      super();
2095      this.status = status;
2096      this.intent = intent;
2097    }
2098
2099    /**
2100     * @return {@link #identifier} (The business identifier for this task.)
2101     */
2102    public List<Identifier> getIdentifier() { 
2103      if (this.identifier == null)
2104        this.identifier = new ArrayList<Identifier>();
2105      return this.identifier;
2106    }
2107
2108    /**
2109     * @return Returns a reference to <code>this</code> for easy method chaining
2110     */
2111    public Task setIdentifier(List<Identifier> theIdentifier) { 
2112      this.identifier = theIdentifier;
2113      return this;
2114    }
2115
2116    public boolean hasIdentifier() { 
2117      if (this.identifier == null)
2118        return false;
2119      for (Identifier item : this.identifier)
2120        if (!item.isEmpty())
2121          return true;
2122      return false;
2123    }
2124
2125    public Identifier addIdentifier() { //3
2126      Identifier t = new Identifier();
2127      if (this.identifier == null)
2128        this.identifier = new ArrayList<Identifier>();
2129      this.identifier.add(t);
2130      return t;
2131    }
2132
2133    public Task addIdentifier(Identifier t) { //3
2134      if (t == null)
2135        return this;
2136      if (this.identifier == null)
2137        this.identifier = new ArrayList<Identifier>();
2138      this.identifier.add(t);
2139      return this;
2140    }
2141
2142    /**
2143     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2144     */
2145    public Identifier getIdentifierFirstRep() { 
2146      if (getIdentifier().isEmpty()) {
2147        addIdentifier();
2148      }
2149      return getIdentifier().get(0);
2150    }
2151
2152    /**
2153     * @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
2154     */
2155    public CanonicalType getInstantiatesCanonicalElement() { 
2156      if (this.instantiatesCanonical == null)
2157        if (Configuration.errorOnAutoCreate())
2158          throw new Error("Attempt to auto-create Task.instantiatesCanonical");
2159        else if (Configuration.doAutoCreate())
2160          this.instantiatesCanonical = new CanonicalType(); // bb
2161      return this.instantiatesCanonical;
2162    }
2163
2164    public boolean hasInstantiatesCanonicalElement() { 
2165      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
2166    }
2167
2168    public boolean hasInstantiatesCanonical() { 
2169      return this.instantiatesCanonical != null && !this.instantiatesCanonical.isEmpty();
2170    }
2171
2172    /**
2173     * @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
2174     */
2175    public Task setInstantiatesCanonicalElement(CanonicalType value) { 
2176      this.instantiatesCanonical = value;
2177      return this;
2178    }
2179
2180    /**
2181     * @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.
2182     */
2183    public String getInstantiatesCanonical() { 
2184      return this.instantiatesCanonical == null ? null : this.instantiatesCanonical.getValue();
2185    }
2186
2187    /**
2188     * @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.
2189     */
2190    public Task setInstantiatesCanonical(String value) { 
2191      if (Utilities.noString(value))
2192        this.instantiatesCanonical = null;
2193      else {
2194        if (this.instantiatesCanonical == null)
2195          this.instantiatesCanonical = new CanonicalType();
2196        this.instantiatesCanonical.setValue(value);
2197      }
2198      return this;
2199    }
2200
2201    /**
2202     * @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
2203     */
2204    public UriType getInstantiatesUriElement() { 
2205      if (this.instantiatesUri == null)
2206        if (Configuration.errorOnAutoCreate())
2207          throw new Error("Attempt to auto-create Task.instantiatesUri");
2208        else if (Configuration.doAutoCreate())
2209          this.instantiatesUri = new UriType(); // bb
2210      return this.instantiatesUri;
2211    }
2212
2213    public boolean hasInstantiatesUriElement() { 
2214      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
2215    }
2216
2217    public boolean hasInstantiatesUri() { 
2218      return this.instantiatesUri != null && !this.instantiatesUri.isEmpty();
2219    }
2220
2221    /**
2222     * @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
2223     */
2224    public Task setInstantiatesUriElement(UriType value) { 
2225      this.instantiatesUri = value;
2226      return this;
2227    }
2228
2229    /**
2230     * @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.
2231     */
2232    public String getInstantiatesUri() { 
2233      return this.instantiatesUri == null ? null : this.instantiatesUri.getValue();
2234    }
2235
2236    /**
2237     * @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.
2238     */
2239    public Task setInstantiatesUri(String value) { 
2240      if (Utilities.noString(value))
2241        this.instantiatesUri = null;
2242      else {
2243        if (this.instantiatesUri == null)
2244          this.instantiatesUri = new UriType();
2245        this.instantiatesUri.setValue(value);
2246      }
2247      return this;
2248    }
2249
2250    /**
2251     * @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.)
2252     */
2253    public List<Reference> getBasedOn() { 
2254      if (this.basedOn == null)
2255        this.basedOn = new ArrayList<Reference>();
2256      return this.basedOn;
2257    }
2258
2259    /**
2260     * @return Returns a reference to <code>this</code> for easy method chaining
2261     */
2262    public Task setBasedOn(List<Reference> theBasedOn) { 
2263      this.basedOn = theBasedOn;
2264      return this;
2265    }
2266
2267    public boolean hasBasedOn() { 
2268      if (this.basedOn == null)
2269        return false;
2270      for (Reference item : this.basedOn)
2271        if (!item.isEmpty())
2272          return true;
2273      return false;
2274    }
2275
2276    public Reference addBasedOn() { //3
2277      Reference t = new Reference();
2278      if (this.basedOn == null)
2279        this.basedOn = new ArrayList<Reference>();
2280      this.basedOn.add(t);
2281      return t;
2282    }
2283
2284    public Task addBasedOn(Reference t) { //3
2285      if (t == null)
2286        return this;
2287      if (this.basedOn == null)
2288        this.basedOn = new ArrayList<Reference>();
2289      this.basedOn.add(t);
2290      return this;
2291    }
2292
2293    /**
2294     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
2295     */
2296    public Reference getBasedOnFirstRep() { 
2297      if (getBasedOn().isEmpty()) {
2298        addBasedOn();
2299      }
2300      return getBasedOn().get(0);
2301    }
2302
2303    /**
2304     * @deprecated Use Reference#setResource(IBaseResource) instead
2305     */
2306    @Deprecated
2307    public List<Resource> getBasedOnTarget() { 
2308      if (this.basedOnTarget == null)
2309        this.basedOnTarget = new ArrayList<Resource>();
2310      return this.basedOnTarget;
2311    }
2312
2313    /**
2314     * @return {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2315     */
2316    public Identifier getGroupIdentifier() { 
2317      if (this.groupIdentifier == null)
2318        if (Configuration.errorOnAutoCreate())
2319          throw new Error("Attempt to auto-create Task.groupIdentifier");
2320        else if (Configuration.doAutoCreate())
2321          this.groupIdentifier = new Identifier(); // cc
2322      return this.groupIdentifier;
2323    }
2324
2325    public boolean hasGroupIdentifier() { 
2326      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
2327    }
2328
2329    /**
2330     * @param value {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2331     */
2332    public Task setGroupIdentifier(Identifier value) { 
2333      this.groupIdentifier = value;
2334      return this;
2335    }
2336
2337    /**
2338     * @return {@link #partOf} (Task that this particular task is part of.)
2339     */
2340    public List<Reference> getPartOf() { 
2341      if (this.partOf == null)
2342        this.partOf = new ArrayList<Reference>();
2343      return this.partOf;
2344    }
2345
2346    /**
2347     * @return Returns a reference to <code>this</code> for easy method chaining
2348     */
2349    public Task setPartOf(List<Reference> thePartOf) { 
2350      this.partOf = thePartOf;
2351      return this;
2352    }
2353
2354    public boolean hasPartOf() { 
2355      if (this.partOf == null)
2356        return false;
2357      for (Reference item : this.partOf)
2358        if (!item.isEmpty())
2359          return true;
2360      return false;
2361    }
2362
2363    public Reference addPartOf() { //3
2364      Reference t = new Reference();
2365      if (this.partOf == null)
2366        this.partOf = new ArrayList<Reference>();
2367      this.partOf.add(t);
2368      return t;
2369    }
2370
2371    public Task addPartOf(Reference t) { //3
2372      if (t == null)
2373        return this;
2374      if (this.partOf == null)
2375        this.partOf = new ArrayList<Reference>();
2376      this.partOf.add(t);
2377      return this;
2378    }
2379
2380    /**
2381     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
2382     */
2383    public Reference getPartOfFirstRep() { 
2384      if (getPartOf().isEmpty()) {
2385        addPartOf();
2386      }
2387      return getPartOf().get(0);
2388    }
2389
2390    /**
2391     * @deprecated Use Reference#setResource(IBaseResource) instead
2392     */
2393    @Deprecated
2394    public List<Task> getPartOfTarget() { 
2395      if (this.partOfTarget == null)
2396        this.partOfTarget = new ArrayList<Task>();
2397      return this.partOfTarget;
2398    }
2399
2400    /**
2401     * @deprecated Use Reference#setResource(IBaseResource) instead
2402     */
2403    @Deprecated
2404    public Task addPartOfTarget() { 
2405      Task r = new Task();
2406      if (this.partOfTarget == null)
2407        this.partOfTarget = new ArrayList<Task>();
2408      this.partOfTarget.add(r);
2409      return r;
2410    }
2411
2412    /**
2413     * @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
2414     */
2415    public Enumeration<TaskStatus> getStatusElement() { 
2416      if (this.status == null)
2417        if (Configuration.errorOnAutoCreate())
2418          throw new Error("Attempt to auto-create Task.status");
2419        else if (Configuration.doAutoCreate())
2420          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory()); // bb
2421      return this.status;
2422    }
2423
2424    public boolean hasStatusElement() { 
2425      return this.status != null && !this.status.isEmpty();
2426    }
2427
2428    public boolean hasStatus() { 
2429      return this.status != null && !this.status.isEmpty();
2430    }
2431
2432    /**
2433     * @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
2434     */
2435    public Task setStatusElement(Enumeration<TaskStatus> value) { 
2436      this.status = value;
2437      return this;
2438    }
2439
2440    /**
2441     * @return The current status of the task.
2442     */
2443    public TaskStatus getStatus() { 
2444      return this.status == null ? null : this.status.getValue();
2445    }
2446
2447    /**
2448     * @param value The current status of the task.
2449     */
2450    public Task setStatus(TaskStatus value) { 
2451        if (this.status == null)
2452          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory());
2453        this.status.setValue(value);
2454      return this;
2455    }
2456
2457    /**
2458     * @return {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2459     */
2460    public CodeableConcept getStatusReason() { 
2461      if (this.statusReason == null)
2462        if (Configuration.errorOnAutoCreate())
2463          throw new Error("Attempt to auto-create Task.statusReason");
2464        else if (Configuration.doAutoCreate())
2465          this.statusReason = new CodeableConcept(); // cc
2466      return this.statusReason;
2467    }
2468
2469    public boolean hasStatusReason() { 
2470      return this.statusReason != null && !this.statusReason.isEmpty();
2471    }
2472
2473    /**
2474     * @param value {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2475     */
2476    public Task setStatusReason(CodeableConcept value) { 
2477      this.statusReason = value;
2478      return this;
2479    }
2480
2481    /**
2482     * @return {@link #businessStatus} (Contains business-specific nuances of the business state.)
2483     */
2484    public CodeableConcept getBusinessStatus() { 
2485      if (this.businessStatus == null)
2486        if (Configuration.errorOnAutoCreate())
2487          throw new Error("Attempt to auto-create Task.businessStatus");
2488        else if (Configuration.doAutoCreate())
2489          this.businessStatus = new CodeableConcept(); // cc
2490      return this.businessStatus;
2491    }
2492
2493    public boolean hasBusinessStatus() { 
2494      return this.businessStatus != null && !this.businessStatus.isEmpty();
2495    }
2496
2497    /**
2498     * @param value {@link #businessStatus} (Contains business-specific nuances of the business state.)
2499     */
2500    public Task setBusinessStatus(CodeableConcept value) { 
2501      this.businessStatus = value;
2502      return this;
2503    }
2504
2505    /**
2506     * @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
2507     */
2508    public Enumeration<TaskIntent> getIntentElement() { 
2509      if (this.intent == null)
2510        if (Configuration.errorOnAutoCreate())
2511          throw new Error("Attempt to auto-create Task.intent");
2512        else if (Configuration.doAutoCreate())
2513          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory()); // bb
2514      return this.intent;
2515    }
2516
2517    public boolean hasIntentElement() { 
2518      return this.intent != null && !this.intent.isEmpty();
2519    }
2520
2521    public boolean hasIntent() { 
2522      return this.intent != null && !this.intent.isEmpty();
2523    }
2524
2525    /**
2526     * @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
2527     */
2528    public Task setIntentElement(Enumeration<TaskIntent> value) { 
2529      this.intent = value;
2530      return this;
2531    }
2532
2533    /**
2534     * @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.
2535     */
2536    public TaskIntent getIntent() { 
2537      return this.intent == null ? null : this.intent.getValue();
2538    }
2539
2540    /**
2541     * @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.
2542     */
2543    public Task setIntent(TaskIntent value) { 
2544        if (this.intent == null)
2545          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory());
2546        this.intent.setValue(value);
2547      return this;
2548    }
2549
2550    /**
2551     * @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
2552     */
2553    public Enumeration<TaskPriority> getPriorityElement() { 
2554      if (this.priority == null)
2555        if (Configuration.errorOnAutoCreate())
2556          throw new Error("Attempt to auto-create Task.priority");
2557        else if (Configuration.doAutoCreate())
2558          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory()); // bb
2559      return this.priority;
2560    }
2561
2562    public boolean hasPriorityElement() { 
2563      return this.priority != null && !this.priority.isEmpty();
2564    }
2565
2566    public boolean hasPriority() { 
2567      return this.priority != null && !this.priority.isEmpty();
2568    }
2569
2570    /**
2571     * @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
2572     */
2573    public Task setPriorityElement(Enumeration<TaskPriority> value) { 
2574      this.priority = value;
2575      return this;
2576    }
2577
2578    /**
2579     * @return Indicates how quickly the Task should be addressed with respect to other requests.
2580     */
2581    public TaskPriority getPriority() { 
2582      return this.priority == null ? null : this.priority.getValue();
2583    }
2584
2585    /**
2586     * @param value Indicates how quickly the Task should be addressed with respect to other requests.
2587     */
2588    public Task setPriority(TaskPriority value) { 
2589      if (value == null)
2590        this.priority = null;
2591      else {
2592        if (this.priority == null)
2593          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory());
2594        this.priority.setValue(value);
2595      }
2596      return this;
2597    }
2598
2599    /**
2600     * @return {@link #code} (A name or code (or both) briefly describing what the task involves.)
2601     */
2602    public CodeableConcept getCode() { 
2603      if (this.code == null)
2604        if (Configuration.errorOnAutoCreate())
2605          throw new Error("Attempt to auto-create Task.code");
2606        else if (Configuration.doAutoCreate())
2607          this.code = new CodeableConcept(); // cc
2608      return this.code;
2609    }
2610
2611    public boolean hasCode() { 
2612      return this.code != null && !this.code.isEmpty();
2613    }
2614
2615    /**
2616     * @param value {@link #code} (A name or code (or both) briefly describing what the task involves.)
2617     */
2618    public Task setCode(CodeableConcept value) { 
2619      this.code = value;
2620      return this;
2621    }
2622
2623    /**
2624     * @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
2625     */
2626    public StringType getDescriptionElement() { 
2627      if (this.description == null)
2628        if (Configuration.errorOnAutoCreate())
2629          throw new Error("Attempt to auto-create Task.description");
2630        else if (Configuration.doAutoCreate())
2631          this.description = new StringType(); // bb
2632      return this.description;
2633    }
2634
2635    public boolean hasDescriptionElement() { 
2636      return this.description != null && !this.description.isEmpty();
2637    }
2638
2639    public boolean hasDescription() { 
2640      return this.description != null && !this.description.isEmpty();
2641    }
2642
2643    /**
2644     * @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
2645     */
2646    public Task setDescriptionElement(StringType value) { 
2647      this.description = value;
2648      return this;
2649    }
2650
2651    /**
2652     * @return A free-text description of what is to be performed.
2653     */
2654    public String getDescription() { 
2655      return this.description == null ? null : this.description.getValue();
2656    }
2657
2658    /**
2659     * @param value A free-text description of what is to be performed.
2660     */
2661    public Task setDescription(String value) { 
2662      if (Utilities.noString(value))
2663        this.description = null;
2664      else {
2665        if (this.description == null)
2666          this.description = new StringType();
2667        this.description.setValue(value);
2668      }
2669      return this;
2670    }
2671
2672    /**
2673     * @return {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2674     */
2675    public Reference getFocus() { 
2676      if (this.focus == null)
2677        if (Configuration.errorOnAutoCreate())
2678          throw new Error("Attempt to auto-create Task.focus");
2679        else if (Configuration.doAutoCreate())
2680          this.focus = new Reference(); // cc
2681      return this.focus;
2682    }
2683
2684    public boolean hasFocus() { 
2685      return this.focus != null && !this.focus.isEmpty();
2686    }
2687
2688    /**
2689     * @param value {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2690     */
2691    public Task setFocus(Reference value) { 
2692      this.focus = value;
2693      return this;
2694    }
2695
2696    /**
2697     * @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.)
2698     */
2699    public Resource getFocusTarget() { 
2700      return this.focusTarget;
2701    }
2702
2703    /**
2704     * @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.)
2705     */
2706    public Task setFocusTarget(Resource value) { 
2707      this.focusTarget = value;
2708      return this;
2709    }
2710
2711    /**
2712     * @return {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2713     */
2714    public Reference getFor() { 
2715      if (this.for_ == null)
2716        if (Configuration.errorOnAutoCreate())
2717          throw new Error("Attempt to auto-create Task.for_");
2718        else if (Configuration.doAutoCreate())
2719          this.for_ = new Reference(); // cc
2720      return this.for_;
2721    }
2722
2723    public boolean hasFor() { 
2724      return this.for_ != null && !this.for_.isEmpty();
2725    }
2726
2727    /**
2728     * @param value {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2729     */
2730    public Task setFor(Reference value) { 
2731      this.for_ = value;
2732      return this;
2733    }
2734
2735    /**
2736     * @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).)
2737     */
2738    public Resource getForTarget() { 
2739      return this.for_Target;
2740    }
2741
2742    /**
2743     * @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).)
2744     */
2745    public Task setForTarget(Resource value) { 
2746      this.for_Target = value;
2747      return this;
2748    }
2749
2750    /**
2751     * @return {@link #context} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2752     */
2753    public Reference getContext() { 
2754      if (this.context == null)
2755        if (Configuration.errorOnAutoCreate())
2756          throw new Error("Attempt to auto-create Task.context");
2757        else if (Configuration.doAutoCreate())
2758          this.context = new Reference(); // cc
2759      return this.context;
2760    }
2761
2762    public boolean hasContext() { 
2763      return this.context != null && !this.context.isEmpty();
2764    }
2765
2766    /**
2767     * @param value {@link #context} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2768     */
2769    public Task setContext(Reference value) { 
2770      this.context = value;
2771      return this;
2772    }
2773
2774    /**
2775     * @return {@link #context} 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.)
2776     */
2777    public Resource getContextTarget() { 
2778      return this.contextTarget;
2779    }
2780
2781    /**
2782     * @param value {@link #context} 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.)
2783     */
2784    public Task setContextTarget(Resource value) { 
2785      this.contextTarget = value;
2786      return this;
2787    }
2788
2789    /**
2790     * @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).)
2791     */
2792    public Period getExecutionPeriod() { 
2793      if (this.executionPeriod == null)
2794        if (Configuration.errorOnAutoCreate())
2795          throw new Error("Attempt to auto-create Task.executionPeriod");
2796        else if (Configuration.doAutoCreate())
2797          this.executionPeriod = new Period(); // cc
2798      return this.executionPeriod;
2799    }
2800
2801    public boolean hasExecutionPeriod() { 
2802      return this.executionPeriod != null && !this.executionPeriod.isEmpty();
2803    }
2804
2805    /**
2806     * @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).)
2807     */
2808    public Task setExecutionPeriod(Period value) { 
2809      this.executionPeriod = value;
2810      return this;
2811    }
2812
2813    /**
2814     * @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
2815     */
2816    public DateTimeType getAuthoredOnElement() { 
2817      if (this.authoredOn == null)
2818        if (Configuration.errorOnAutoCreate())
2819          throw new Error("Attempt to auto-create Task.authoredOn");
2820        else if (Configuration.doAutoCreate())
2821          this.authoredOn = new DateTimeType(); // bb
2822      return this.authoredOn;
2823    }
2824
2825    public boolean hasAuthoredOnElement() { 
2826      return this.authoredOn != null && !this.authoredOn.isEmpty();
2827    }
2828
2829    public boolean hasAuthoredOn() { 
2830      return this.authoredOn != null && !this.authoredOn.isEmpty();
2831    }
2832
2833    /**
2834     * @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
2835     */
2836    public Task setAuthoredOnElement(DateTimeType value) { 
2837      this.authoredOn = value;
2838      return this;
2839    }
2840
2841    /**
2842     * @return The date and time this task was created.
2843     */
2844    public Date getAuthoredOn() { 
2845      return this.authoredOn == null ? null : this.authoredOn.getValue();
2846    }
2847
2848    /**
2849     * @param value The date and time this task was created.
2850     */
2851    public Task setAuthoredOn(Date value) { 
2852      if (value == null)
2853        this.authoredOn = null;
2854      else {
2855        if (this.authoredOn == null)
2856          this.authoredOn = new DateTimeType();
2857        this.authoredOn.setValue(value);
2858      }
2859      return this;
2860    }
2861
2862    /**
2863     * @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
2864     */
2865    public DateTimeType getLastModifiedElement() { 
2866      if (this.lastModified == null)
2867        if (Configuration.errorOnAutoCreate())
2868          throw new Error("Attempt to auto-create Task.lastModified");
2869        else if (Configuration.doAutoCreate())
2870          this.lastModified = new DateTimeType(); // bb
2871      return this.lastModified;
2872    }
2873
2874    public boolean hasLastModifiedElement() { 
2875      return this.lastModified != null && !this.lastModified.isEmpty();
2876    }
2877
2878    public boolean hasLastModified() { 
2879      return this.lastModified != null && !this.lastModified.isEmpty();
2880    }
2881
2882    /**
2883     * @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
2884     */
2885    public Task setLastModifiedElement(DateTimeType value) { 
2886      this.lastModified = value;
2887      return this;
2888    }
2889
2890    /**
2891     * @return The date and time of last modification to this task.
2892     */
2893    public Date getLastModified() { 
2894      return this.lastModified == null ? null : this.lastModified.getValue();
2895    }
2896
2897    /**
2898     * @param value The date and time of last modification to this task.
2899     */
2900    public Task setLastModified(Date value) { 
2901      if (value == null)
2902        this.lastModified = null;
2903      else {
2904        if (this.lastModified == null)
2905          this.lastModified = new DateTimeType();
2906        this.lastModified.setValue(value);
2907      }
2908      return this;
2909    }
2910
2911    /**
2912     * @return {@link #requester} (The creator of the task.)
2913     */
2914    public Reference getRequester() { 
2915      if (this.requester == null)
2916        if (Configuration.errorOnAutoCreate())
2917          throw new Error("Attempt to auto-create Task.requester");
2918        else if (Configuration.doAutoCreate())
2919          this.requester = new Reference(); // cc
2920      return this.requester;
2921    }
2922
2923    public boolean hasRequester() { 
2924      return this.requester != null && !this.requester.isEmpty();
2925    }
2926
2927    /**
2928     * @param value {@link #requester} (The creator of the task.)
2929     */
2930    public Task setRequester(Reference value) { 
2931      this.requester = value;
2932      return this;
2933    }
2934
2935    /**
2936     * @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.)
2937     */
2938    public Resource getRequesterTarget() { 
2939      return this.requesterTarget;
2940    }
2941
2942    /**
2943     * @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.)
2944     */
2945    public Task setRequesterTarget(Resource value) { 
2946      this.requesterTarget = value;
2947      return this;
2948    }
2949
2950    /**
2951     * @return {@link #performerType} (The type of participant that can execute the task.)
2952     */
2953    public List<CodeableConcept> getPerformerType() { 
2954      if (this.performerType == null)
2955        this.performerType = new ArrayList<CodeableConcept>();
2956      return this.performerType;
2957    }
2958
2959    /**
2960     * @return Returns a reference to <code>this</code> for easy method chaining
2961     */
2962    public Task setPerformerType(List<CodeableConcept> thePerformerType) { 
2963      this.performerType = thePerformerType;
2964      return this;
2965    }
2966
2967    public boolean hasPerformerType() { 
2968      if (this.performerType == null)
2969        return false;
2970      for (CodeableConcept item : this.performerType)
2971        if (!item.isEmpty())
2972          return true;
2973      return false;
2974    }
2975
2976    public CodeableConcept addPerformerType() { //3
2977      CodeableConcept t = new CodeableConcept();
2978      if (this.performerType == null)
2979        this.performerType = new ArrayList<CodeableConcept>();
2980      this.performerType.add(t);
2981      return t;
2982    }
2983
2984    public Task addPerformerType(CodeableConcept t) { //3
2985      if (t == null)
2986        return this;
2987      if (this.performerType == null)
2988        this.performerType = new ArrayList<CodeableConcept>();
2989      this.performerType.add(t);
2990      return this;
2991    }
2992
2993    /**
2994     * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist
2995     */
2996    public CodeableConcept getPerformerTypeFirstRep() { 
2997      if (getPerformerType().isEmpty()) {
2998        addPerformerType();
2999      }
3000      return getPerformerType().get(0);
3001    }
3002
3003    /**
3004     * @return {@link #owner} (Individual organization or Device currently responsible for task execution.)
3005     */
3006    public Reference getOwner() { 
3007      if (this.owner == null)
3008        if (Configuration.errorOnAutoCreate())
3009          throw new Error("Attempt to auto-create Task.owner");
3010        else if (Configuration.doAutoCreate())
3011          this.owner = new Reference(); // cc
3012      return this.owner;
3013    }
3014
3015    public boolean hasOwner() { 
3016      return this.owner != null && !this.owner.isEmpty();
3017    }
3018
3019    /**
3020     * @param value {@link #owner} (Individual organization or Device currently responsible for task execution.)
3021     */
3022    public Task setOwner(Reference value) { 
3023      this.owner = value;
3024      return this;
3025    }
3026
3027    /**
3028     * @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.)
3029     */
3030    public Resource getOwnerTarget() { 
3031      return this.ownerTarget;
3032    }
3033
3034    /**
3035     * @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.)
3036     */
3037    public Task setOwnerTarget(Resource value) { 
3038      this.ownerTarget = value;
3039      return this;
3040    }
3041
3042    /**
3043     * @return {@link #location} (The principal physical location where the this task is performed.)
3044     */
3045    public Reference getLocation() { 
3046      if (this.location == null)
3047        if (Configuration.errorOnAutoCreate())
3048          throw new Error("Attempt to auto-create Task.location");
3049        else if (Configuration.doAutoCreate())
3050          this.location = new Reference(); // cc
3051      return this.location;
3052    }
3053
3054    public boolean hasLocation() { 
3055      return this.location != null && !this.location.isEmpty();
3056    }
3057
3058    /**
3059     * @param value {@link #location} (The principal physical location where the this task is performed.)
3060     */
3061    public Task setLocation(Reference value) { 
3062      this.location = value;
3063      return this;
3064    }
3065
3066    /**
3067     * @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. (The principal physical location where the this task is performed.)
3068     */
3069    public Location getLocationTarget() { 
3070      if (this.locationTarget == null)
3071        if (Configuration.errorOnAutoCreate())
3072          throw new Error("Attempt to auto-create Task.location");
3073        else if (Configuration.doAutoCreate())
3074          this.locationTarget = new Location(); // aa
3075      return this.locationTarget;
3076    }
3077
3078    /**
3079     * @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. (The principal physical location where the this task is performed.)
3080     */
3081    public Task setLocationTarget(Location value) { 
3082      this.locationTarget = value;
3083      return this;
3084    }
3085
3086    /**
3087     * @return {@link #reasonCode} (A description or code indicating why this task needs to be performed.)
3088     */
3089    public CodeableConcept getReasonCode() { 
3090      if (this.reasonCode == null)
3091        if (Configuration.errorOnAutoCreate())
3092          throw new Error("Attempt to auto-create Task.reasonCode");
3093        else if (Configuration.doAutoCreate())
3094          this.reasonCode = new CodeableConcept(); // cc
3095      return this.reasonCode;
3096    }
3097
3098    public boolean hasReasonCode() { 
3099      return this.reasonCode != null && !this.reasonCode.isEmpty();
3100    }
3101
3102    /**
3103     * @param value {@link #reasonCode} (A description or code indicating why this task needs to be performed.)
3104     */
3105    public Task setReasonCode(CodeableConcept value) { 
3106      this.reasonCode = value;
3107      return this;
3108    }
3109
3110    /**
3111     * @return {@link #reasonReference} (A resource reference indicating why this task needs to be performed.)
3112     */
3113    public Reference getReasonReference() { 
3114      if (this.reasonReference == null)
3115        if (Configuration.errorOnAutoCreate())
3116          throw new Error("Attempt to auto-create Task.reasonReference");
3117        else if (Configuration.doAutoCreate())
3118          this.reasonReference = new Reference(); // cc
3119      return this.reasonReference;
3120    }
3121
3122    public boolean hasReasonReference() { 
3123      return this.reasonReference != null && !this.reasonReference.isEmpty();
3124    }
3125
3126    /**
3127     * @param value {@link #reasonReference} (A resource reference indicating why this task needs to be performed.)
3128     */
3129    public Task setReasonReference(Reference value) { 
3130      this.reasonReference = value;
3131      return this;
3132    }
3133
3134    /**
3135     * @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.)
3136     */
3137    public Resource getReasonReferenceTarget() { 
3138      return this.reasonReferenceTarget;
3139    }
3140
3141    /**
3142     * @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.)
3143     */
3144    public Task setReasonReferenceTarget(Resource value) { 
3145      this.reasonReferenceTarget = value;
3146      return this;
3147    }
3148
3149    /**
3150     * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be relevant to the Task.)
3151     */
3152    public List<Reference> getInsurance() { 
3153      if (this.insurance == null)
3154        this.insurance = new ArrayList<Reference>();
3155      return this.insurance;
3156    }
3157
3158    /**
3159     * @return Returns a reference to <code>this</code> for easy method chaining
3160     */
3161    public Task setInsurance(List<Reference> theInsurance) { 
3162      this.insurance = theInsurance;
3163      return this;
3164    }
3165
3166    public boolean hasInsurance() { 
3167      if (this.insurance == null)
3168        return false;
3169      for (Reference item : this.insurance)
3170        if (!item.isEmpty())
3171          return true;
3172      return false;
3173    }
3174
3175    public Reference addInsurance() { //3
3176      Reference t = new Reference();
3177      if (this.insurance == null)
3178        this.insurance = new ArrayList<Reference>();
3179      this.insurance.add(t);
3180      return t;
3181    }
3182
3183    public Task addInsurance(Reference t) { //3
3184      if (t == null)
3185        return this;
3186      if (this.insurance == null)
3187        this.insurance = new ArrayList<Reference>();
3188      this.insurance.add(t);
3189      return this;
3190    }
3191
3192    /**
3193     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
3194     */
3195    public Reference getInsuranceFirstRep() { 
3196      if (getInsurance().isEmpty()) {
3197        addInsurance();
3198      }
3199      return getInsurance().get(0);
3200    }
3201
3202    /**
3203     * @deprecated Use Reference#setResource(IBaseResource) instead
3204     */
3205    @Deprecated
3206    public List<Resource> getInsuranceTarget() { 
3207      if (this.insuranceTarget == null)
3208        this.insuranceTarget = new ArrayList<Resource>();
3209      return this.insuranceTarget;
3210    }
3211
3212    /**
3213     * @return {@link #note} (Free-text information captured about the task as it progresses.)
3214     */
3215    public List<Annotation> getNote() { 
3216      if (this.note == null)
3217        this.note = new ArrayList<Annotation>();
3218      return this.note;
3219    }
3220
3221    /**
3222     * @return Returns a reference to <code>this</code> for easy method chaining
3223     */
3224    public Task setNote(List<Annotation> theNote) { 
3225      this.note = theNote;
3226      return this;
3227    }
3228
3229    public boolean hasNote() { 
3230      if (this.note == null)
3231        return false;
3232      for (Annotation item : this.note)
3233        if (!item.isEmpty())
3234          return true;
3235      return false;
3236    }
3237
3238    public Annotation addNote() { //3
3239      Annotation t = new Annotation();
3240      if (this.note == null)
3241        this.note = new ArrayList<Annotation>();
3242      this.note.add(t);
3243      return t;
3244    }
3245
3246    public Task addNote(Annotation t) { //3
3247      if (t == null)
3248        return this;
3249      if (this.note == null)
3250        this.note = new ArrayList<Annotation>();
3251      this.note.add(t);
3252      return this;
3253    }
3254
3255    /**
3256     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3257     */
3258    public Annotation getNoteFirstRep() { 
3259      if (getNote().isEmpty()) {
3260        addNote();
3261      }
3262      return getNote().get(0);
3263    }
3264
3265    /**
3266     * @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.)
3267     */
3268    public List<Reference> getRelevantHistory() { 
3269      if (this.relevantHistory == null)
3270        this.relevantHistory = new ArrayList<Reference>();
3271      return this.relevantHistory;
3272    }
3273
3274    /**
3275     * @return Returns a reference to <code>this</code> for easy method chaining
3276     */
3277    public Task setRelevantHistory(List<Reference> theRelevantHistory) { 
3278      this.relevantHistory = theRelevantHistory;
3279      return this;
3280    }
3281
3282    public boolean hasRelevantHistory() { 
3283      if (this.relevantHistory == null)
3284        return false;
3285      for (Reference item : this.relevantHistory)
3286        if (!item.isEmpty())
3287          return true;
3288      return false;
3289    }
3290
3291    public Reference addRelevantHistory() { //3
3292      Reference t = new Reference();
3293      if (this.relevantHistory == null)
3294        this.relevantHistory = new ArrayList<Reference>();
3295      this.relevantHistory.add(t);
3296      return t;
3297    }
3298
3299    public Task addRelevantHistory(Reference t) { //3
3300      if (t == null)
3301        return this;
3302      if (this.relevantHistory == null)
3303        this.relevantHistory = new ArrayList<Reference>();
3304      this.relevantHistory.add(t);
3305      return this;
3306    }
3307
3308    /**
3309     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
3310     */
3311    public Reference getRelevantHistoryFirstRep() { 
3312      if (getRelevantHistory().isEmpty()) {
3313        addRelevantHistory();
3314      }
3315      return getRelevantHistory().get(0);
3316    }
3317
3318    /**
3319     * @deprecated Use Reference#setResource(IBaseResource) instead
3320     */
3321    @Deprecated
3322    public List<Provenance> getRelevantHistoryTarget() { 
3323      if (this.relevantHistoryTarget == null)
3324        this.relevantHistoryTarget = new ArrayList<Provenance>();
3325      return this.relevantHistoryTarget;
3326    }
3327
3328    /**
3329     * @deprecated Use Reference#setResource(IBaseResource) instead
3330     */
3331    @Deprecated
3332    public Provenance addRelevantHistoryTarget() { 
3333      Provenance r = new Provenance();
3334      if (this.relevantHistoryTarget == null)
3335        this.relevantHistoryTarget = new ArrayList<Provenance>();
3336      this.relevantHistoryTarget.add(r);
3337      return r;
3338    }
3339
3340    /**
3341     * @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.)
3342     */
3343    public TaskRestrictionComponent getRestriction() { 
3344      if (this.restriction == null)
3345        if (Configuration.errorOnAutoCreate())
3346          throw new Error("Attempt to auto-create Task.restriction");
3347        else if (Configuration.doAutoCreate())
3348          this.restriction = new TaskRestrictionComponent(); // cc
3349      return this.restriction;
3350    }
3351
3352    public boolean hasRestriction() { 
3353      return this.restriction != null && !this.restriction.isEmpty();
3354    }
3355
3356    /**
3357     * @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.)
3358     */
3359    public Task setRestriction(TaskRestrictionComponent value) { 
3360      this.restriction = value;
3361      return this;
3362    }
3363
3364    /**
3365     * @return {@link #input} (Additional information that may be needed in the execution of the task.)
3366     */
3367    public List<ParameterComponent> getInput() { 
3368      if (this.input == null)
3369        this.input = new ArrayList<ParameterComponent>();
3370      return this.input;
3371    }
3372
3373    /**
3374     * @return Returns a reference to <code>this</code> for easy method chaining
3375     */
3376    public Task setInput(List<ParameterComponent> theInput) { 
3377      this.input = theInput;
3378      return this;
3379    }
3380
3381    public boolean hasInput() { 
3382      if (this.input == null)
3383        return false;
3384      for (ParameterComponent item : this.input)
3385        if (!item.isEmpty())
3386          return true;
3387      return false;
3388    }
3389
3390    public ParameterComponent addInput() { //3
3391      ParameterComponent t = new ParameterComponent();
3392      if (this.input == null)
3393        this.input = new ArrayList<ParameterComponent>();
3394      this.input.add(t);
3395      return t;
3396    }
3397
3398    public Task addInput(ParameterComponent t) { //3
3399      if (t == null)
3400        return this;
3401      if (this.input == null)
3402        this.input = new ArrayList<ParameterComponent>();
3403      this.input.add(t);
3404      return this;
3405    }
3406
3407    /**
3408     * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
3409     */
3410    public ParameterComponent getInputFirstRep() { 
3411      if (getInput().isEmpty()) {
3412        addInput();
3413      }
3414      return getInput().get(0);
3415    }
3416
3417    /**
3418     * @return {@link #output} (Outputs produced by the Task.)
3419     */
3420    public List<TaskOutputComponent> getOutput() { 
3421      if (this.output == null)
3422        this.output = new ArrayList<TaskOutputComponent>();
3423      return this.output;
3424    }
3425
3426    /**
3427     * @return Returns a reference to <code>this</code> for easy method chaining
3428     */
3429    public Task setOutput(List<TaskOutputComponent> theOutput) { 
3430      this.output = theOutput;
3431      return this;
3432    }
3433
3434    public boolean hasOutput() { 
3435      if (this.output == null)
3436        return false;
3437      for (TaskOutputComponent item : this.output)
3438        if (!item.isEmpty())
3439          return true;
3440      return false;
3441    }
3442
3443    public TaskOutputComponent addOutput() { //3
3444      TaskOutputComponent t = new TaskOutputComponent();
3445      if (this.output == null)
3446        this.output = new ArrayList<TaskOutputComponent>();
3447      this.output.add(t);
3448      return t;
3449    }
3450
3451    public Task addOutput(TaskOutputComponent t) { //3
3452      if (t == null)
3453        return this;
3454      if (this.output == null)
3455        this.output = new ArrayList<TaskOutputComponent>();
3456      this.output.add(t);
3457      return this;
3458    }
3459
3460    /**
3461     * @return The first repetition of repeating field {@link #output}, creating it if it does not already exist
3462     */
3463    public TaskOutputComponent getOutputFirstRep() { 
3464      if (getOutput().isEmpty()) {
3465        addOutput();
3466      }
3467      return getOutput().get(0);
3468    }
3469
3470      protected void listChildren(List<Property> children) {
3471        super.listChildren(children);
3472        children.add(new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier));
3473        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));
3474        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));
3475        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));
3476        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));
3477        children.add(new Property("partOf", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, partOf));
3478        children.add(new Property("status", "code", "The current status of the task.", 0, 1, status));
3479        children.add(new Property("statusReason", "CodeableConcept", "An explanation as to why this task is held, failed, was refused, etc.", 0, 1, statusReason));
3480        children.add(new Property("businessStatus", "CodeableConcept", "Contains business-specific nuances of the business state.", 0, 1, businessStatus));
3481        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));
3482        children.add(new Property("priority", "code", "Indicates how quickly the Task should be addressed with respect to other requests.", 0, 1, priority));
3483        children.add(new Property("code", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, 1, code));
3484        children.add(new Property("description", "string", "A free-text description of what is to be performed.", 0, 1, description));
3485        children.add(new Property("focus", "Reference(Any)", "The request being actioned or the resource being manipulated by this task.", 0, 1, focus));
3486        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_));
3487        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.", 0, 1, context));
3488        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));
3489        children.add(new Property("authoredOn", "dateTime", "The date and time this task was created.", 0, 1, authoredOn));
3490        children.add(new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, 1, lastModified));
3491        children.add(new Property("requester", "Reference(Device|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The creator of the task.", 0, 1, requester));
3492        children.add(new Property("performerType", "CodeableConcept", "The type of participant that can execute the task.", 0, java.lang.Integer.MAX_VALUE, performerType));
3493        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));
3494        children.add(new Property("location", "Reference(Location)", "The principal physical location where the this task is performed.", 0, 1, location));
3495        children.add(new Property("reasonCode", "CodeableConcept", "A description or code indicating why this task needs to be performed.", 0, 1, reasonCode));
3496        children.add(new Property("reasonReference", "Reference(Any)", "A resource reference indicating why this task needs to be performed.", 0, 1, reasonReference));
3497        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));
3498        children.add(new Property("note", "Annotation", "Free-text information captured about the task as it progresses.", 0, java.lang.Integer.MAX_VALUE, note));
3499        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));
3500        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));
3501        children.add(new Property("input", "", "Additional information that may be needed in the execution of the task.", 0, java.lang.Integer.MAX_VALUE, input));
3502        children.add(new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output));
3503      }
3504
3505      @Override
3506      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3507        switch (_hash) {
3508        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier);
3509        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);
3510        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);
3511        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);
3512        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);
3513        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, partOf);
3514        case -892481550: /*status*/  return new Property("status", "code", "The current status of the task.", 0, 1, status);
3515        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "An explanation as to why this task is held, failed, was refused, etc.", 0, 1, statusReason);
3516        case 2008591314: /*businessStatus*/  return new Property("businessStatus", "CodeableConcept", "Contains business-specific nuances of the business state.", 0, 1, businessStatus);
3517        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);
3518        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the Task should be addressed with respect to other requests.", 0, 1, priority);
3519        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, 1, code);
3520        case -1724546052: /*description*/  return new Property("description", "string", "A free-text description of what is to be performed.", 0, 1, description);
3521        case 97604824: /*focus*/  return new Property("focus", "Reference(Any)", "The request being actioned or the resource being manipulated by this task.", 0, 1, focus);
3522        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_);
3523        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.", 0, 1, context);
3524        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);
3525        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "The date and time this task was created.", 0, 1, authoredOn);
3526        case 1959003007: /*lastModified*/  return new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, 1, lastModified);
3527        case 693933948: /*requester*/  return new Property("requester", "Reference(Device|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The creator of the task.", 0, 1, requester);
3528        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "The type of participant that can execute the task.", 0, java.lang.Integer.MAX_VALUE, performerType);
3529        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);
3530        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The principal physical location where the this task is performed.", 0, 1, location);
3531        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "A description or code indicating why this task needs to be performed.", 0, 1, reasonCode);
3532        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Any)", "A resource reference indicating why this task needs to be performed.", 0, 1, reasonReference);
3533        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);
3534        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);
3535        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);
3536        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);
3537        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);
3538        case -1005512447: /*output*/  return new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output);
3539        default: return super.getNamedProperty(_hash, _name, _checkValid);
3540        }
3541
3542      }
3543
3544      @Override
3545      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3546        switch (hash) {
3547        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3548        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : new Base[] {this.instantiatesCanonical}; // CanonicalType
3549        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : new Base[] {this.instantiatesUri}; // UriType
3550        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3551        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
3552        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
3553        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<TaskStatus>
3554        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
3555        case 2008591314: /*businessStatus*/ return this.businessStatus == null ? new Base[0] : new Base[] {this.businessStatus}; // CodeableConcept
3556        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<TaskIntent>
3557        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<TaskPriority>
3558        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3559        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3560        case 97604824: /*focus*/ return this.focus == null ? new Base[0] : new Base[] {this.focus}; // Reference
3561        case 101577: /*for*/ return this.for_ == null ? new Base[0] : new Base[] {this.for_}; // Reference
3562        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
3563        case 1218624249: /*executionPeriod*/ return this.executionPeriod == null ? new Base[0] : new Base[] {this.executionPeriod}; // Period
3564        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
3565        case 1959003007: /*lastModified*/ return this.lastModified == null ? new Base[0] : new Base[] {this.lastModified}; // DateTimeType
3566        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference
3567        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
3568        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
3569        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3570        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : new Base[] {this.reasonCode}; // CodeableConcept
3571        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : new Base[] {this.reasonReference}; // Reference
3572        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference
3573        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3574        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
3575        case -1561062452: /*restriction*/ return this.restriction == null ? new Base[0] : new Base[] {this.restriction}; // TaskRestrictionComponent
3576        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // ParameterComponent
3577        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // TaskOutputComponent
3578        default: return super.getProperty(hash, name, checkValid);
3579        }
3580
3581      }
3582
3583      @Override
3584      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3585        switch (hash) {
3586        case -1618432855: // identifier
3587          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3588          return value;
3589        case 8911915: // instantiatesCanonical
3590          this.instantiatesCanonical = castToCanonical(value); // CanonicalType
3591          return value;
3592        case -1926393373: // instantiatesUri
3593          this.instantiatesUri = castToUri(value); // UriType
3594          return value;
3595        case -332612366: // basedOn
3596          this.getBasedOn().add(castToReference(value)); // Reference
3597          return value;
3598        case -445338488: // groupIdentifier
3599          this.groupIdentifier = castToIdentifier(value); // Identifier
3600          return value;
3601        case -995410646: // partOf
3602          this.getPartOf().add(castToReference(value)); // Reference
3603          return value;
3604        case -892481550: // status
3605          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3606          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3607          return value;
3608        case 2051346646: // statusReason
3609          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3610          return value;
3611        case 2008591314: // businessStatus
3612          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3613          return value;
3614        case -1183762788: // intent
3615          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3616          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3617          return value;
3618        case -1165461084: // priority
3619          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3620          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3621          return value;
3622        case 3059181: // code
3623          this.code = castToCodeableConcept(value); // CodeableConcept
3624          return value;
3625        case -1724546052: // description
3626          this.description = castToString(value); // StringType
3627          return value;
3628        case 97604824: // focus
3629          this.focus = castToReference(value); // Reference
3630          return value;
3631        case 101577: // for
3632          this.for_ = castToReference(value); // Reference
3633          return value;
3634        case 951530927: // context
3635          this.context = castToReference(value); // Reference
3636          return value;
3637        case 1218624249: // executionPeriod
3638          this.executionPeriod = castToPeriod(value); // Period
3639          return value;
3640        case -1500852503: // authoredOn
3641          this.authoredOn = castToDateTime(value); // DateTimeType
3642          return value;
3643        case 1959003007: // lastModified
3644          this.lastModified = castToDateTime(value); // DateTimeType
3645          return value;
3646        case 693933948: // requester
3647          this.requester = castToReference(value); // Reference
3648          return value;
3649        case -901444568: // performerType
3650          this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
3651          return value;
3652        case 106164915: // owner
3653          this.owner = castToReference(value); // Reference
3654          return value;
3655        case 1901043637: // location
3656          this.location = castToReference(value); // Reference
3657          return value;
3658        case 722137681: // reasonCode
3659          this.reasonCode = castToCodeableConcept(value); // CodeableConcept
3660          return value;
3661        case -1146218137: // reasonReference
3662          this.reasonReference = castToReference(value); // Reference
3663          return value;
3664        case 73049818: // insurance
3665          this.getInsurance().add(castToReference(value)); // Reference
3666          return value;
3667        case 3387378: // note
3668          this.getNote().add(castToAnnotation(value)); // Annotation
3669          return value;
3670        case 1538891575: // relevantHistory
3671          this.getRelevantHistory().add(castToReference(value)); // Reference
3672          return value;
3673        case -1561062452: // restriction
3674          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3675          return value;
3676        case 100358090: // input
3677          this.getInput().add((ParameterComponent) value); // ParameterComponent
3678          return value;
3679        case -1005512447: // output
3680          this.getOutput().add((TaskOutputComponent) value); // TaskOutputComponent
3681          return value;
3682        default: return super.setProperty(hash, name, value);
3683        }
3684
3685      }
3686
3687      @Override
3688      public Base setProperty(String name, Base value) throws FHIRException {
3689        if (name.equals("identifier")) {
3690          this.getIdentifier().add(castToIdentifier(value));
3691        } else if (name.equals("instantiatesCanonical")) {
3692          this.instantiatesCanonical = castToCanonical(value); // CanonicalType
3693        } else if (name.equals("instantiatesUri")) {
3694          this.instantiatesUri = castToUri(value); // UriType
3695        } else if (name.equals("basedOn")) {
3696          this.getBasedOn().add(castToReference(value));
3697        } else if (name.equals("groupIdentifier")) {
3698          this.groupIdentifier = castToIdentifier(value); // Identifier
3699        } else if (name.equals("partOf")) {
3700          this.getPartOf().add(castToReference(value));
3701        } else if (name.equals("status")) {
3702          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3703          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3704        } else if (name.equals("statusReason")) {
3705          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3706        } else if (name.equals("businessStatus")) {
3707          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3708        } else if (name.equals("intent")) {
3709          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3710          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3711        } else if (name.equals("priority")) {
3712          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3713          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3714        } else if (name.equals("code")) {
3715          this.code = castToCodeableConcept(value); // CodeableConcept
3716        } else if (name.equals("description")) {
3717          this.description = castToString(value); // StringType
3718        } else if (name.equals("focus")) {
3719          this.focus = castToReference(value); // Reference
3720        } else if (name.equals("for")) {
3721          this.for_ = castToReference(value); // Reference
3722        } else if (name.equals("context")) {
3723          this.context = castToReference(value); // Reference
3724        } else if (name.equals("executionPeriod")) {
3725          this.executionPeriod = castToPeriod(value); // Period
3726        } else if (name.equals("authoredOn")) {
3727          this.authoredOn = castToDateTime(value); // DateTimeType
3728        } else if (name.equals("lastModified")) {
3729          this.lastModified = castToDateTime(value); // DateTimeType
3730        } else if (name.equals("requester")) {
3731          this.requester = castToReference(value); // Reference
3732        } else if (name.equals("performerType")) {
3733          this.getPerformerType().add(castToCodeableConcept(value));
3734        } else if (name.equals("owner")) {
3735          this.owner = castToReference(value); // Reference
3736        } else if (name.equals("location")) {
3737          this.location = castToReference(value); // Reference
3738        } else if (name.equals("reasonCode")) {
3739          this.reasonCode = castToCodeableConcept(value); // CodeableConcept
3740        } else if (name.equals("reasonReference")) {
3741          this.reasonReference = castToReference(value); // Reference
3742        } else if (name.equals("insurance")) {
3743          this.getInsurance().add(castToReference(value));
3744        } else if (name.equals("note")) {
3745          this.getNote().add(castToAnnotation(value));
3746        } else if (name.equals("relevantHistory")) {
3747          this.getRelevantHistory().add(castToReference(value));
3748        } else if (name.equals("restriction")) {
3749          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3750        } else if (name.equals("input")) {
3751          this.getInput().add((ParameterComponent) value);
3752        } else if (name.equals("output")) {
3753          this.getOutput().add((TaskOutputComponent) value);
3754        } else
3755          return super.setProperty(name, value);
3756        return value;
3757      }
3758
3759      @Override
3760      public Base makeProperty(int hash, String name) throws FHIRException {
3761        switch (hash) {
3762        case -1618432855:  return addIdentifier(); 
3763        case 8911915:  return getInstantiatesCanonicalElement();
3764        case -1926393373:  return getInstantiatesUriElement();
3765        case -332612366:  return addBasedOn(); 
3766        case -445338488:  return getGroupIdentifier(); 
3767        case -995410646:  return addPartOf(); 
3768        case -892481550:  return getStatusElement();
3769        case 2051346646:  return getStatusReason(); 
3770        case 2008591314:  return getBusinessStatus(); 
3771        case -1183762788:  return getIntentElement();
3772        case -1165461084:  return getPriorityElement();
3773        case 3059181:  return getCode(); 
3774        case -1724546052:  return getDescriptionElement();
3775        case 97604824:  return getFocus(); 
3776        case 101577:  return getFor(); 
3777        case 951530927:  return getContext(); 
3778        case 1218624249:  return getExecutionPeriod(); 
3779        case -1500852503:  return getAuthoredOnElement();
3780        case 1959003007:  return getLastModifiedElement();
3781        case 693933948:  return getRequester(); 
3782        case -901444568:  return addPerformerType(); 
3783        case 106164915:  return getOwner(); 
3784        case 1901043637:  return getLocation(); 
3785        case 722137681:  return getReasonCode(); 
3786        case -1146218137:  return getReasonReference(); 
3787        case 73049818:  return addInsurance(); 
3788        case 3387378:  return addNote(); 
3789        case 1538891575:  return addRelevantHistory(); 
3790        case -1561062452:  return getRestriction(); 
3791        case 100358090:  return addInput(); 
3792        case -1005512447:  return addOutput(); 
3793        default: return super.makeProperty(hash, name);
3794        }
3795
3796      }
3797
3798      @Override
3799      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3800        switch (hash) {
3801        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3802        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3803        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3804        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3805        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
3806        case -995410646: /*partOf*/ return new String[] {"Reference"};
3807        case -892481550: /*status*/ return new String[] {"code"};
3808        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3809        case 2008591314: /*businessStatus*/ return new String[] {"CodeableConcept"};
3810        case -1183762788: /*intent*/ return new String[] {"code"};
3811        case -1165461084: /*priority*/ return new String[] {"code"};
3812        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3813        case -1724546052: /*description*/ return new String[] {"string"};
3814        case 97604824: /*focus*/ return new String[] {"Reference"};
3815        case 101577: /*for*/ return new String[] {"Reference"};
3816        case 951530927: /*context*/ return new String[] {"Reference"};
3817        case 1218624249: /*executionPeriod*/ return new String[] {"Period"};
3818        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
3819        case 1959003007: /*lastModified*/ return new String[] {"dateTime"};
3820        case 693933948: /*requester*/ return new String[] {"Reference"};
3821        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
3822        case 106164915: /*owner*/ return new String[] {"Reference"};
3823        case 1901043637: /*location*/ return new String[] {"Reference"};
3824        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
3825        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
3826        case 73049818: /*insurance*/ return new String[] {"Reference"};
3827        case 3387378: /*note*/ return new String[] {"Annotation"};
3828        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
3829        case -1561062452: /*restriction*/ return new String[] {};
3830        case 100358090: /*input*/ return new String[] {};
3831        case -1005512447: /*output*/ return new String[] {};
3832        default: return super.getTypesForProperty(hash, name);
3833        }
3834
3835      }
3836
3837      @Override
3838      public Base addChild(String name) throws FHIRException {
3839        if (name.equals("identifier")) {
3840          return addIdentifier();
3841        }
3842        else if (name.equals("instantiatesCanonical")) {
3843          throw new FHIRException("Cannot call addChild on a primitive type Task.instantiatesCanonical");
3844        }
3845        else if (name.equals("instantiatesUri")) {
3846          throw new FHIRException("Cannot call addChild on a primitive type Task.instantiatesUri");
3847        }
3848        else if (name.equals("basedOn")) {
3849          return addBasedOn();
3850        }
3851        else if (name.equals("groupIdentifier")) {
3852          this.groupIdentifier = new Identifier();
3853          return this.groupIdentifier;
3854        }
3855        else if (name.equals("partOf")) {
3856          return addPartOf();
3857        }
3858        else if (name.equals("status")) {
3859          throw new FHIRException("Cannot call addChild on a primitive type Task.status");
3860        }
3861        else if (name.equals("statusReason")) {
3862          this.statusReason = new CodeableConcept();
3863          return this.statusReason;
3864        }
3865        else if (name.equals("businessStatus")) {
3866          this.businessStatus = new CodeableConcept();
3867          return this.businessStatus;
3868        }
3869        else if (name.equals("intent")) {
3870          throw new FHIRException("Cannot call addChild on a primitive type Task.intent");
3871        }
3872        else if (name.equals("priority")) {
3873          throw new FHIRException("Cannot call addChild on a primitive type Task.priority");
3874        }
3875        else if (name.equals("code")) {
3876          this.code = new CodeableConcept();
3877          return this.code;
3878        }
3879        else if (name.equals("description")) {
3880          throw new FHIRException("Cannot call addChild on a primitive type Task.description");
3881        }
3882        else if (name.equals("focus")) {
3883          this.focus = new Reference();
3884          return this.focus;
3885        }
3886        else if (name.equals("for")) {
3887          this.for_ = new Reference();
3888          return this.for_;
3889        }
3890        else if (name.equals("context")) {
3891          this.context = new Reference();
3892          return this.context;
3893        }
3894        else if (name.equals("executionPeriod")) {
3895          this.executionPeriod = new Period();
3896          return this.executionPeriod;
3897        }
3898        else if (name.equals("authoredOn")) {
3899          throw new FHIRException("Cannot call addChild on a primitive type Task.authoredOn");
3900        }
3901        else if (name.equals("lastModified")) {
3902          throw new FHIRException("Cannot call addChild on a primitive type Task.lastModified");
3903        }
3904        else if (name.equals("requester")) {
3905          this.requester = new Reference();
3906          return this.requester;
3907        }
3908        else if (name.equals("performerType")) {
3909          return addPerformerType();
3910        }
3911        else if (name.equals("owner")) {
3912          this.owner = new Reference();
3913          return this.owner;
3914        }
3915        else if (name.equals("location")) {
3916          this.location = new Reference();
3917          return this.location;
3918        }
3919        else if (name.equals("reasonCode")) {
3920          this.reasonCode = new CodeableConcept();
3921          return this.reasonCode;
3922        }
3923        else if (name.equals("reasonReference")) {
3924          this.reasonReference = new Reference();
3925          return this.reasonReference;
3926        }
3927        else if (name.equals("insurance")) {
3928          return addInsurance();
3929        }
3930        else if (name.equals("note")) {
3931          return addNote();
3932        }
3933        else if (name.equals("relevantHistory")) {
3934          return addRelevantHistory();
3935        }
3936        else if (name.equals("restriction")) {
3937          this.restriction = new TaskRestrictionComponent();
3938          return this.restriction;
3939        }
3940        else if (name.equals("input")) {
3941          return addInput();
3942        }
3943        else if (name.equals("output")) {
3944          return addOutput();
3945        }
3946        else
3947          return super.addChild(name);
3948      }
3949
3950  public String fhirType() {
3951    return "Task";
3952
3953  }
3954
3955      public Task copy() {
3956        Task dst = new Task();
3957        copyValues(dst);
3958        if (identifier != null) {
3959          dst.identifier = new ArrayList<Identifier>();
3960          for (Identifier i : identifier)
3961            dst.identifier.add(i.copy());
3962        };
3963        dst.instantiatesCanonical = instantiatesCanonical == null ? null : instantiatesCanonical.copy();
3964        dst.instantiatesUri = instantiatesUri == null ? null : instantiatesUri.copy();
3965        if (basedOn != null) {
3966          dst.basedOn = new ArrayList<Reference>();
3967          for (Reference i : basedOn)
3968            dst.basedOn.add(i.copy());
3969        };
3970        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
3971        if (partOf != null) {
3972          dst.partOf = new ArrayList<Reference>();
3973          for (Reference i : partOf)
3974            dst.partOf.add(i.copy());
3975        };
3976        dst.status = status == null ? null : status.copy();
3977        dst.statusReason = statusReason == null ? null : statusReason.copy();
3978        dst.businessStatus = businessStatus == null ? null : businessStatus.copy();
3979        dst.intent = intent == null ? null : intent.copy();
3980        dst.priority = priority == null ? null : priority.copy();
3981        dst.code = code == null ? null : code.copy();
3982        dst.description = description == null ? null : description.copy();
3983        dst.focus = focus == null ? null : focus.copy();
3984        dst.for_ = for_ == null ? null : for_.copy();
3985        dst.context = context == null ? null : context.copy();
3986        dst.executionPeriod = executionPeriod == null ? null : executionPeriod.copy();
3987        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
3988        dst.lastModified = lastModified == null ? null : lastModified.copy();
3989        dst.requester = requester == null ? null : requester.copy();
3990        if (performerType != null) {
3991          dst.performerType = new ArrayList<CodeableConcept>();
3992          for (CodeableConcept i : performerType)
3993            dst.performerType.add(i.copy());
3994        };
3995        dst.owner = owner == null ? null : owner.copy();
3996        dst.location = location == null ? null : location.copy();
3997        dst.reasonCode = reasonCode == null ? null : reasonCode.copy();
3998        dst.reasonReference = reasonReference == null ? null : reasonReference.copy();
3999        if (insurance != null) {
4000          dst.insurance = new ArrayList<Reference>();
4001          for (Reference i : insurance)
4002            dst.insurance.add(i.copy());
4003        };
4004        if (note != null) {
4005          dst.note = new ArrayList<Annotation>();
4006          for (Annotation i : note)
4007            dst.note.add(i.copy());
4008        };
4009        if (relevantHistory != null) {
4010          dst.relevantHistory = new ArrayList<Reference>();
4011          for (Reference i : relevantHistory)
4012            dst.relevantHistory.add(i.copy());
4013        };
4014        dst.restriction = restriction == null ? null : restriction.copy();
4015        if (input != null) {
4016          dst.input = new ArrayList<ParameterComponent>();
4017          for (ParameterComponent i : input)
4018            dst.input.add(i.copy());
4019        };
4020        if (output != null) {
4021          dst.output = new ArrayList<TaskOutputComponent>();
4022          for (TaskOutputComponent i : output)
4023            dst.output.add(i.copy());
4024        };
4025        return dst;
4026      }
4027
4028      protected Task typedCopy() {
4029        return copy();
4030      }
4031
4032      @Override
4033      public boolean equalsDeep(Base other_) {
4034        if (!super.equalsDeep(other_))
4035          return false;
4036        if (!(other_ instanceof Task))
4037          return false;
4038        Task o = (Task) other_;
4039        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4040           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
4041           && compareDeep(groupIdentifier, o.groupIdentifier, true) && compareDeep(partOf, o.partOf, true)
4042           && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) && compareDeep(businessStatus, o.businessStatus, true)
4043           && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
4044           && compareDeep(description, o.description, true) && compareDeep(focus, o.focus, true) && compareDeep(for_, o.for_, true)
4045           && compareDeep(context, o.context, true) && compareDeep(executionPeriod, o.executionPeriod, true)
4046           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(lastModified, o.lastModified, true)
4047           && compareDeep(requester, o.requester, true) && compareDeep(performerType, o.performerType, true)
4048           && compareDeep(owner, o.owner, true) && compareDeep(location, o.location, true) && compareDeep(reasonCode, o.reasonCode, true)
4049           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(insurance, o.insurance, true)
4050           && compareDeep(note, o.note, true) && compareDeep(relevantHistory, o.relevantHistory, true) && compareDeep(restriction, o.restriction, true)
4051           && compareDeep(input, o.input, true) && compareDeep(output, o.output, true);
4052      }
4053
4054      @Override
4055      public boolean equalsShallow(Base other_) {
4056        if (!super.equalsShallow(other_))
4057          return false;
4058        if (!(other_ instanceof Task))
4059          return false;
4060        Task o = (Task) other_;
4061        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
4062           && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) && compareValues(description, o.description, true)
4063           && compareValues(authoredOn, o.authoredOn, true) && compareValues(lastModified, o.lastModified, true)
4064          ;
4065      }
4066
4067      public boolean isEmpty() {
4068        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4069          , instantiatesUri, basedOn, groupIdentifier, partOf, status, statusReason, businessStatus
4070          , intent, priority, code, description, focus, for_, context, executionPeriod
4071          , authoredOn, lastModified, requester, performerType, owner, location, reasonCode
4072          , reasonReference, insurance, note, relevantHistory, restriction, input, output
4073          );
4074      }
4075
4076  @Override
4077  public ResourceType getResourceType() {
4078    return ResourceType.Task;
4079   }
4080
4081 /**
4082   * Search parameter: <b>owner</b>
4083   * <p>
4084   * Description: <b>Search by task owner</b><br>
4085   * Type: <b>reference</b><br>
4086   * Path: <b>Task.owner</b><br>
4087   * </p>
4088   */
4089  @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 } )
4090  public static final String SP_OWNER = "owner";
4091 /**
4092   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
4093   * <p>
4094   * Description: <b>Search by task owner</b><br>
4095   * Type: <b>reference</b><br>
4096   * Path: <b>Task.owner</b><br>
4097   * </p>
4098   */
4099  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
4100
4101/**
4102   * Constant for fluent queries to be used to add include statements. Specifies
4103   * the path value of "<b>Task:owner</b>".
4104   */
4105  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Task:owner").toLocked();
4106
4107 /**
4108   * Search parameter: <b>requester</b>
4109   * <p>
4110   * Description: <b>Search by task requester</b><br>
4111   * Type: <b>reference</b><br>
4112   * Path: <b>Task.requester</b><br>
4113   * </p>
4114   */
4115  @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 } )
4116  public static final String SP_REQUESTER = "requester";
4117 /**
4118   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
4119   * <p>
4120   * Description: <b>Search by task requester</b><br>
4121   * Type: <b>reference</b><br>
4122   * Path: <b>Task.requester</b><br>
4123   * </p>
4124   */
4125  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
4126
4127/**
4128   * Constant for fluent queries to be used to add include statements. Specifies
4129   * the path value of "<b>Task:requester</b>".
4130   */
4131  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("Task:requester").toLocked();
4132
4133 /**
4134   * Search parameter: <b>identifier</b>
4135   * <p>
4136   * Description: <b>Search for a task instance by its business identifier</b><br>
4137   * Type: <b>token</b><br>
4138   * Path: <b>Task.identifier</b><br>
4139   * </p>
4140   */
4141  @SearchParamDefinition(name="identifier", path="Task.identifier", description="Search for a task instance by its business identifier", type="token" )
4142  public static final String SP_IDENTIFIER = "identifier";
4143 /**
4144   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4145   * <p>
4146   * Description: <b>Search for a task instance by its business identifier</b><br>
4147   * Type: <b>token</b><br>
4148   * Path: <b>Task.identifier</b><br>
4149   * </p>
4150   */
4151  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4152
4153 /**
4154   * Search parameter: <b>business-status</b>
4155   * <p>
4156   * Description: <b>Search by business status</b><br>
4157   * Type: <b>token</b><br>
4158   * Path: <b>Task.businessStatus</b><br>
4159   * </p>
4160   */
4161  @SearchParamDefinition(name="business-status", path="Task.businessStatus", description="Search by business status", type="token" )
4162  public static final String SP_BUSINESS_STATUS = "business-status";
4163 /**
4164   * <b>Fluent Client</b> search parameter constant for <b>business-status</b>
4165   * <p>
4166   * Description: <b>Search by business status</b><br>
4167   * Type: <b>token</b><br>
4168   * Path: <b>Task.businessStatus</b><br>
4169   * </p>
4170   */
4171  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BUSINESS_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BUSINESS_STATUS);
4172
4173 /**
4174   * Search parameter: <b>period</b>
4175   * <p>
4176   * Description: <b>Search by period Task is/was underway</b><br>
4177   * Type: <b>date</b><br>
4178   * Path: <b>Task.executionPeriod</b><br>
4179   * </p>
4180   */
4181  @SearchParamDefinition(name="period", path="Task.executionPeriod", description="Search by period Task is/was underway", type="date" )
4182  public static final String SP_PERIOD = "period";
4183 /**
4184   * <b>Fluent Client</b> search parameter constant for <b>period</b>
4185   * <p>
4186   * Description: <b>Search by period Task is/was underway</b><br>
4187   * Type: <b>date</b><br>
4188   * Path: <b>Task.executionPeriod</b><br>
4189   * </p>
4190   */
4191  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
4192
4193 /**
4194   * Search parameter: <b>code</b>
4195   * <p>
4196   * Description: <b>Search by task code</b><br>
4197   * Type: <b>token</b><br>
4198   * Path: <b>Task.code</b><br>
4199   * </p>
4200   */
4201  @SearchParamDefinition(name="code", path="Task.code", description="Search by task code", type="token" )
4202  public static final String SP_CODE = "code";
4203 /**
4204   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4205   * <p>
4206   * Description: <b>Search by task code</b><br>
4207   * Type: <b>token</b><br>
4208   * Path: <b>Task.code</b><br>
4209   * </p>
4210   */
4211  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4212
4213 /**
4214   * Search parameter: <b>performer</b>
4215   * <p>
4216   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
4217   * Type: <b>token</b><br>
4218   * Path: <b>Task.performerType</b><br>
4219   * </p>
4220   */
4221  @SearchParamDefinition(name="performer", path="Task.performerType", description="Search by recommended type of performer (e.g., Requester, Performer, Scheduler).", type="token" )
4222  public static final String SP_PERFORMER = "performer";
4223 /**
4224   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
4225   * <p>
4226   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
4227   * Type: <b>token</b><br>
4228   * Path: <b>Task.performerType</b><br>
4229   * </p>
4230   */
4231  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PERFORMER);
4232
4233 /**
4234   * Search parameter: <b>subject</b>
4235   * <p>
4236   * Description: <b>Search by subject</b><br>
4237   * Type: <b>reference</b><br>
4238   * Path: <b>Task.for</b><br>
4239   * </p>
4240   */
4241  @SearchParamDefinition(name="subject", path="Task.for", description="Search by subject", type="reference" )
4242  public static final String SP_SUBJECT = "subject";
4243 /**
4244   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4245   * <p>
4246   * Description: <b>Search by subject</b><br>
4247   * Type: <b>reference</b><br>
4248   * Path: <b>Task.for</b><br>
4249   * </p>
4250   */
4251  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4252
4253/**
4254   * Constant for fluent queries to be used to add include statements. Specifies
4255   * the path value of "<b>Task:subject</b>".
4256   */
4257  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Task:subject").toLocked();
4258
4259 /**
4260   * Search parameter: <b>focus</b>
4261   * <p>
4262   * Description: <b>Search by task focus</b><br>
4263   * Type: <b>reference</b><br>
4264   * Path: <b>Task.focus</b><br>
4265   * </p>
4266   */
4267  @SearchParamDefinition(name="focus", path="Task.focus", description="Search by task focus", type="reference" )
4268  public static final String SP_FOCUS = "focus";
4269 /**
4270   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
4271   * <p>
4272   * Description: <b>Search by task focus</b><br>
4273   * Type: <b>reference</b><br>
4274   * Path: <b>Task.focus</b><br>
4275   * </p>
4276   */
4277  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOCUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FOCUS);
4278
4279/**
4280   * Constant for fluent queries to be used to add include statements. Specifies
4281   * the path value of "<b>Task:focus</b>".
4282   */
4283  public static final ca.uhn.fhir.model.api.Include INCLUDE_FOCUS = new ca.uhn.fhir.model.api.Include("Task:focus").toLocked();
4284
4285 /**
4286   * Search parameter: <b>part-of</b>
4287   * <p>
4288   * Description: <b>Search by task this task is part of</b><br>
4289   * Type: <b>reference</b><br>
4290   * Path: <b>Task.partOf</b><br>
4291   * </p>
4292   */
4293  @SearchParamDefinition(name="part-of", path="Task.partOf", description="Search by task this task is part of", type="reference", target={Task.class } )
4294  public static final String SP_PART_OF = "part-of";
4295 /**
4296   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
4297   * <p>
4298   * Description: <b>Search by task this task is part of</b><br>
4299   * Type: <b>reference</b><br>
4300   * Path: <b>Task.partOf</b><br>
4301   * </p>
4302   */
4303  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
4304
4305/**
4306   * Constant for fluent queries to be used to add include statements. Specifies
4307   * the path value of "<b>Task:part-of</b>".
4308   */
4309  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Task:part-of").toLocked();
4310
4311 /**
4312   * Search parameter: <b>priority</b>
4313   * <p>
4314   * Description: <b>Search by task priority</b><br>
4315   * Type: <b>token</b><br>
4316   * Path: <b>Task.priority</b><br>
4317   * </p>
4318   */
4319  @SearchParamDefinition(name="priority", path="Task.priority", description="Search by task priority", type="token" )
4320  public static final String SP_PRIORITY = "priority";
4321 /**
4322   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
4323   * <p>
4324   * Description: <b>Search by task priority</b><br>
4325   * Type: <b>token</b><br>
4326   * Path: <b>Task.priority</b><br>
4327   * </p>
4328   */
4329  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
4330
4331 /**
4332   * Search parameter: <b>authored-on</b>
4333   * <p>
4334   * Description: <b>Search by creation date</b><br>
4335   * Type: <b>date</b><br>
4336   * Path: <b>Task.authoredOn</b><br>
4337   * </p>
4338   */
4339  @SearchParamDefinition(name="authored-on", path="Task.authoredOn", description="Search by creation date", type="date" )
4340  public static final String SP_AUTHORED_ON = "authored-on";
4341 /**
4342   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
4343   * <p>
4344   * Description: <b>Search by creation date</b><br>
4345   * Type: <b>date</b><br>
4346   * Path: <b>Task.authoredOn</b><br>
4347   * </p>
4348   */
4349  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED_ON);
4350
4351 /**
4352   * Search parameter: <b>intent</b>
4353   * <p>
4354   * Description: <b>Search by task intent</b><br>
4355   * Type: <b>token</b><br>
4356   * Path: <b>Task.intent</b><br>
4357   * </p>
4358   */
4359  @SearchParamDefinition(name="intent", path="Task.intent", description="Search by task intent", type="token" )
4360  public static final String SP_INTENT = "intent";
4361 /**
4362   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
4363   * <p>
4364   * Description: <b>Search by task intent</b><br>
4365   * Type: <b>token</b><br>
4366   * Path: <b>Task.intent</b><br>
4367   * </p>
4368   */
4369  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4370
4371 /**
4372   * Search parameter: <b>group-identifier</b>
4373   * <p>
4374   * Description: <b>Search by group identifier</b><br>
4375   * Type: <b>token</b><br>
4376   * Path: <b>Task.groupIdentifier</b><br>
4377   * </p>
4378   */
4379  @SearchParamDefinition(name="group-identifier", path="Task.groupIdentifier", description="Search by group identifier", type="token" )
4380  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
4381 /**
4382   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
4383   * <p>
4384   * Description: <b>Search by group identifier</b><br>
4385   * Type: <b>token</b><br>
4386   * Path: <b>Task.groupIdentifier</b><br>
4387   * </p>
4388   */
4389  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
4390
4391 /**
4392   * Search parameter: <b>based-on</b>
4393   * <p>
4394   * Description: <b>Search by requests this task is based on</b><br>
4395   * Type: <b>reference</b><br>
4396   * Path: <b>Task.basedOn</b><br>
4397   * </p>
4398   */
4399  @SearchParamDefinition(name="based-on", path="Task.basedOn", description="Search by requests this task is based on", type="reference" )
4400  public static final String SP_BASED_ON = "based-on";
4401 /**
4402   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
4403   * <p>
4404   * Description: <b>Search by requests this task is based on</b><br>
4405   * Type: <b>reference</b><br>
4406   * Path: <b>Task.basedOn</b><br>
4407   * </p>
4408   */
4409  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
4410
4411/**
4412   * Constant for fluent queries to be used to add include statements. Specifies
4413   * the path value of "<b>Task:based-on</b>".
4414   */
4415  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Task:based-on").toLocked();
4416
4417 /**
4418   * Search parameter: <b>patient</b>
4419   * <p>
4420   * Description: <b>Search by patient</b><br>
4421   * Type: <b>reference</b><br>
4422   * Path: <b>Task.for</b><br>
4423   * </p>
4424   */
4425  @SearchParamDefinition(name="patient", path="Task.for.where(resolve() is Patient)", description="Search by patient", type="reference", target={Patient.class } )
4426  public static final String SP_PATIENT = "patient";
4427 /**
4428   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4429   * <p>
4430   * Description: <b>Search by patient</b><br>
4431   * Type: <b>reference</b><br>
4432   * Path: <b>Task.for</b><br>
4433   * </p>
4434   */
4435  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4436
4437/**
4438   * Constant for fluent queries to be used to add include statements. Specifies
4439   * the path value of "<b>Task:patient</b>".
4440   */
4441  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Task:patient").toLocked();
4442
4443 /**
4444   * Search parameter: <b>context</b>
4445   * <p>
4446   * Description: <b>Search by encounter or episode</b><br>
4447   * Type: <b>reference</b><br>
4448   * Path: <b>Task.context</b><br>
4449   * </p>
4450   */
4451  @SearchParamDefinition(name="context", path="Task.context", description="Search by encounter or episode", type="reference", target={Encounter.class, EpisodeOfCare.class } )
4452  public static final String SP_CONTEXT = "context";
4453 /**
4454   * <b>Fluent Client</b> search parameter constant for <b>context</b>
4455   * <p>
4456   * Description: <b>Search by encounter or episode</b><br>
4457   * Type: <b>reference</b><br>
4458   * Path: <b>Task.context</b><br>
4459   * </p>
4460   */
4461  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
4462
4463/**
4464   * Constant for fluent queries to be used to add include statements. Specifies
4465   * the path value of "<b>Task:context</b>".
4466   */
4467  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("Task:context").toLocked();
4468
4469 /**
4470   * Search parameter: <b>modified</b>
4471   * <p>
4472   * Description: <b>Search by last modification date</b><br>
4473   * Type: <b>date</b><br>
4474   * Path: <b>Task.lastModified</b><br>
4475   * </p>
4476   */
4477  @SearchParamDefinition(name="modified", path="Task.lastModified", description="Search by last modification date", type="date" )
4478  public static final String SP_MODIFIED = "modified";
4479 /**
4480   * <b>Fluent Client</b> search parameter constant for <b>modified</b>
4481   * <p>
4482   * Description: <b>Search by last modification date</b><br>
4483   * Type: <b>date</b><br>
4484   * Path: <b>Task.lastModified</b><br>
4485   * </p>
4486   */
4487  public static final ca.uhn.fhir.rest.gclient.DateClientParam MODIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_MODIFIED);
4488
4489 /**
4490   * Search parameter: <b>status</b>
4491   * <p>
4492   * Description: <b>Search by task status</b><br>
4493   * Type: <b>token</b><br>
4494   * Path: <b>Task.status</b><br>
4495   * </p>
4496   */
4497  @SearchParamDefinition(name="status", path="Task.status", description="Search by task status", type="token" )
4498  public static final String SP_STATUS = "status";
4499 /**
4500   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4501   * <p>
4502   * Description: <b>Search by task status</b><br>
4503   * Type: <b>token</b><br>
4504   * Path: <b>Task.status</b><br>
4505   * </p>
4506   */
4507  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4508
4509
4510}
4511