001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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/Profile/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         * 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         * Task has been started but is not yet complete.
082         */
083        INPROGRESS, 
084        /**
085         * 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 "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 "Task has been started but is not yet complete.";
180            case ONHOLD: return "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 request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act
306         */
307        PROPOSAL, 
308        /**
309         * The request represents an intension to ensure something occurs without providing an authorization for others to act
310         */
311        PLAN, 
312        /**
313         * The request represents a request/demand and authorization for action
314         */
315        ORDER, 
316        /**
317         * The request represents an original authorization for action
318         */
319        ORIGINALORDER, 
320        /**
321         * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization
322         */
323        REFLEXORDER, 
324        /**
325         * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order
326         */
327        FILLERORDER, 
328        /**
329         * An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.
330         */
331        INSTANCEORDER, 
332        /**
333         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.
334
335Refer to [[[RequestGroup]]] for additional information on how this status is used
336         */
337        OPTION, 
338        /**
339         * added to help the parsers with the generic types
340         */
341        NULL;
342        public static TaskIntent fromCode(String codeString) throws FHIRException {
343            if (codeString == null || "".equals(codeString))
344                return null;
345        if ("proposal".equals(codeString))
346          return PROPOSAL;
347        if ("plan".equals(codeString))
348          return PLAN;
349        if ("order".equals(codeString))
350          return ORDER;
351        if ("original-order".equals(codeString))
352          return ORIGINALORDER;
353        if ("reflex-order".equals(codeString))
354          return REFLEXORDER;
355        if ("filler-order".equals(codeString))
356          return FILLERORDER;
357        if ("instance-order".equals(codeString))
358          return INSTANCEORDER;
359        if ("option".equals(codeString))
360          return OPTION;
361        if (Configuration.isAcceptInvalidEnums())
362          return null;
363        else
364          throw new FHIRException("Unknown TaskIntent code '"+codeString+"'");
365        }
366        public String toCode() {
367          switch (this) {
368            case PROPOSAL: return "proposal";
369            case PLAN: return "plan";
370            case ORDER: return "order";
371            case ORIGINALORDER: return "original-order";
372            case REFLEXORDER: return "reflex-order";
373            case FILLERORDER: return "filler-order";
374            case INSTANCEORDER: return "instance-order";
375            case OPTION: return "option";
376            default: return "?";
377          }
378        }
379        public String getSystem() {
380          switch (this) {
381            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
382            case PLAN: return "http://hl7.org/fhir/request-intent";
383            case ORDER: return "http://hl7.org/fhir/request-intent";
384            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
385            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
386            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
387            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
388            case OPTION: return "http://hl7.org/fhir/request-intent";
389            default: return "?";
390          }
391        }
392        public String getDefinition() {
393          switch (this) {
394            case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act";
395            case PLAN: return "The request represents an intension to ensure something occurs without providing an authorization for others to act";
396            case ORDER: return "The request represents a request/demand and authorization for action";
397            case ORIGINALORDER: return "The request represents an original authorization for action";
398            case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization";
399            case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order";
400            case INSTANCEORDER: return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
401            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.\n\nRefer to [[[RequestGroup]]] for additional information on how this status is used";
402            default: return "?";
403          }
404        }
405        public String getDisplay() {
406          switch (this) {
407            case PROPOSAL: return "Proposal";
408            case PLAN: return "Plan";
409            case ORDER: return "Order";
410            case ORIGINALORDER: return "Original Order";
411            case REFLEXORDER: return "Reflex Order";
412            case FILLERORDER: return "Filler Order";
413            case INSTANCEORDER: return "Instance Order";
414            case OPTION: return "Option";
415            default: return "?";
416          }
417        }
418    }
419
420  public static class TaskIntentEnumFactory implements EnumFactory<TaskIntent> {
421    public TaskIntent fromCode(String codeString) throws IllegalArgumentException {
422      if (codeString == null || "".equals(codeString))
423            if (codeString == null || "".equals(codeString))
424                return null;
425        if ("proposal".equals(codeString))
426          return TaskIntent.PROPOSAL;
427        if ("plan".equals(codeString))
428          return TaskIntent.PLAN;
429        if ("order".equals(codeString))
430          return TaskIntent.ORDER;
431        if ("original-order".equals(codeString))
432          return TaskIntent.ORIGINALORDER;
433        if ("reflex-order".equals(codeString))
434          return TaskIntent.REFLEXORDER;
435        if ("filler-order".equals(codeString))
436          return TaskIntent.FILLERORDER;
437        if ("instance-order".equals(codeString))
438          return TaskIntent.INSTANCEORDER;
439        if ("option".equals(codeString))
440          return TaskIntent.OPTION;
441        throw new IllegalArgumentException("Unknown TaskIntent code '"+codeString+"'");
442        }
443        public Enumeration<TaskIntent> fromType(Base code) throws FHIRException {
444          if (code == null)
445            return null;
446          if (code.isEmpty())
447            return new Enumeration<TaskIntent>(this);
448          String codeString = ((PrimitiveType) code).asStringValue();
449          if (codeString == null || "".equals(codeString))
450            return null;
451        if ("proposal".equals(codeString))
452          return new Enumeration<TaskIntent>(this, TaskIntent.PROPOSAL);
453        if ("plan".equals(codeString))
454          return new Enumeration<TaskIntent>(this, TaskIntent.PLAN);
455        if ("order".equals(codeString))
456          return new Enumeration<TaskIntent>(this, TaskIntent.ORDER);
457        if ("original-order".equals(codeString))
458          return new Enumeration<TaskIntent>(this, TaskIntent.ORIGINALORDER);
459        if ("reflex-order".equals(codeString))
460          return new Enumeration<TaskIntent>(this, TaskIntent.REFLEXORDER);
461        if ("filler-order".equals(codeString))
462          return new Enumeration<TaskIntent>(this, TaskIntent.FILLERORDER);
463        if ("instance-order".equals(codeString))
464          return new Enumeration<TaskIntent>(this, TaskIntent.INSTANCEORDER);
465        if ("option".equals(codeString))
466          return new Enumeration<TaskIntent>(this, TaskIntent.OPTION);
467        throw new FHIRException("Unknown TaskIntent code '"+codeString+"'");
468        }
469    public String toCode(TaskIntent code) {
470      if (code == TaskIntent.PROPOSAL)
471        return "proposal";
472      if (code == TaskIntent.PLAN)
473        return "plan";
474      if (code == TaskIntent.ORDER)
475        return "order";
476      if (code == TaskIntent.ORIGINALORDER)
477        return "original-order";
478      if (code == TaskIntent.REFLEXORDER)
479        return "reflex-order";
480      if (code == TaskIntent.FILLERORDER)
481        return "filler-order";
482      if (code == TaskIntent.INSTANCEORDER)
483        return "instance-order";
484      if (code == TaskIntent.OPTION)
485        return "option";
486      return "?";
487      }
488    public String toSystem(TaskIntent code) {
489      return code.getSystem();
490      }
491    }
492
493    public enum TaskPriority {
494        /**
495         * The request has normal priority
496         */
497        ROUTINE, 
498        /**
499         * The request should be actioned promptly - higher priority than routine
500         */
501        URGENT, 
502        /**
503         * The request should be actioned as soon as possible - higher priority than urgent
504         */
505        ASAP, 
506        /**
507         * The request should be actioned immediately - highest possible priority.  E.g. an emergency
508         */
509        STAT, 
510        /**
511         * added to help the parsers with the generic types
512         */
513        NULL;
514        public static TaskPriority fromCode(String codeString) throws FHIRException {
515            if (codeString == null || "".equals(codeString))
516                return null;
517        if ("routine".equals(codeString))
518          return ROUTINE;
519        if ("urgent".equals(codeString))
520          return URGENT;
521        if ("asap".equals(codeString))
522          return ASAP;
523        if ("stat".equals(codeString))
524          return STAT;
525        if (Configuration.isAcceptInvalidEnums())
526          return null;
527        else
528          throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
529        }
530        public String toCode() {
531          switch (this) {
532            case ROUTINE: return "routine";
533            case URGENT: return "urgent";
534            case ASAP: return "asap";
535            case STAT: return "stat";
536            default: return "?";
537          }
538        }
539        public String getSystem() {
540          switch (this) {
541            case ROUTINE: return "http://hl7.org/fhir/request-priority";
542            case URGENT: return "http://hl7.org/fhir/request-priority";
543            case ASAP: return "http://hl7.org/fhir/request-priority";
544            case STAT: return "http://hl7.org/fhir/request-priority";
545            default: return "?";
546          }
547        }
548        public String getDefinition() {
549          switch (this) {
550            case ROUTINE: return "The request has normal priority";
551            case URGENT: return "The request should be actioned promptly - higher priority than routine";
552            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent";
553            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency";
554            default: return "?";
555          }
556        }
557        public String getDisplay() {
558          switch (this) {
559            case ROUTINE: return "Routine";
560            case URGENT: return "Urgent";
561            case ASAP: return "ASAP";
562            case STAT: return "STAT";
563            default: return "?";
564          }
565        }
566    }
567
568  public static class TaskPriorityEnumFactory implements EnumFactory<TaskPriority> {
569    public TaskPriority fromCode(String codeString) throws IllegalArgumentException {
570      if (codeString == null || "".equals(codeString))
571            if (codeString == null || "".equals(codeString))
572                return null;
573        if ("routine".equals(codeString))
574          return TaskPriority.ROUTINE;
575        if ("urgent".equals(codeString))
576          return TaskPriority.URGENT;
577        if ("asap".equals(codeString))
578          return TaskPriority.ASAP;
579        if ("stat".equals(codeString))
580          return TaskPriority.STAT;
581        throw new IllegalArgumentException("Unknown TaskPriority code '"+codeString+"'");
582        }
583        public Enumeration<TaskPriority> fromType(Base code) throws FHIRException {
584          if (code == null)
585            return null;
586          if (code.isEmpty())
587            return new Enumeration<TaskPriority>(this);
588          String codeString = ((PrimitiveType) code).asStringValue();
589          if (codeString == null || "".equals(codeString))
590            return null;
591        if ("routine".equals(codeString))
592          return new Enumeration<TaskPriority>(this, TaskPriority.ROUTINE);
593        if ("urgent".equals(codeString))
594          return new Enumeration<TaskPriority>(this, TaskPriority.URGENT);
595        if ("asap".equals(codeString))
596          return new Enumeration<TaskPriority>(this, TaskPriority.ASAP);
597        if ("stat".equals(codeString))
598          return new Enumeration<TaskPriority>(this, TaskPriority.STAT);
599        throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
600        }
601    public String toCode(TaskPriority code) {
602      if (code == TaskPriority.ROUTINE)
603        return "routine";
604      if (code == TaskPriority.URGENT)
605        return "urgent";
606      if (code == TaskPriority.ASAP)
607        return "asap";
608      if (code == TaskPriority.STAT)
609        return "stat";
610      return "?";
611      }
612    public String toSystem(TaskPriority code) {
613      return code.getSystem();
614      }
615    }
616
617    @Block()
618    public static class TaskRequesterComponent extends BackboneElement implements IBaseBackboneElement {
619        /**
620         * The device, practitioner, etc. who initiated the task.
621         */
622        @Child(name = "agent", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=1, min=1, max=1, modifier=false, summary=true)
623        @Description(shortDefinition="Individual asking for task", formalDefinition="The device, practitioner, etc. who initiated the task." )
624        protected Reference agent;
625
626        /**
627         * The actual object that is the target of the reference (The device, practitioner, etc. who initiated the task.)
628         */
629        protected Resource agentTarget;
630
631        /**
632         * The organization the device or practitioner was acting on behalf of when they initiated the task.
633         */
634        @Child(name = "onBehalfOf", type = {Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
635        @Description(shortDefinition="Organization individual is acting for", formalDefinition="The organization the device or practitioner was acting on behalf of when they initiated the task." )
636        protected Reference onBehalfOf;
637
638        /**
639         * The actual object that is the target of the reference (The organization the device or practitioner was acting on behalf of when they initiated the task.)
640         */
641        protected Organization onBehalfOfTarget;
642
643        private static final long serialVersionUID = -71453027L;
644
645    /**
646     * Constructor
647     */
648      public TaskRequesterComponent() {
649        super();
650      }
651
652    /**
653     * Constructor
654     */
655      public TaskRequesterComponent(Reference agent) {
656        super();
657        this.agent = agent;
658      }
659
660        /**
661         * @return {@link #agent} (The device, practitioner, etc. who initiated the task.)
662         */
663        public Reference getAgent() { 
664          if (this.agent == null)
665            if (Configuration.errorOnAutoCreate())
666              throw new Error("Attempt to auto-create TaskRequesterComponent.agent");
667            else if (Configuration.doAutoCreate())
668              this.agent = new Reference(); // cc
669          return this.agent;
670        }
671
672        public boolean hasAgent() { 
673          return this.agent != null && !this.agent.isEmpty();
674        }
675
676        /**
677         * @param value {@link #agent} (The device, practitioner, etc. who initiated the task.)
678         */
679        public TaskRequesterComponent setAgent(Reference value) { 
680          this.agent = value;
681          return this;
682        }
683
684        /**
685         * @return {@link #agent} 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 device, practitioner, etc. who initiated the task.)
686         */
687        public Resource getAgentTarget() { 
688          return this.agentTarget;
689        }
690
691        /**
692         * @param value {@link #agent} 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 device, practitioner, etc. who initiated the task.)
693         */
694        public TaskRequesterComponent setAgentTarget(Resource value) { 
695          this.agentTarget = value;
696          return this;
697        }
698
699        /**
700         * @return {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of when they initiated the task.)
701         */
702        public Reference getOnBehalfOf() { 
703          if (this.onBehalfOf == null)
704            if (Configuration.errorOnAutoCreate())
705              throw new Error("Attempt to auto-create TaskRequesterComponent.onBehalfOf");
706            else if (Configuration.doAutoCreate())
707              this.onBehalfOf = new Reference(); // cc
708          return this.onBehalfOf;
709        }
710
711        public boolean hasOnBehalfOf() { 
712          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
713        }
714
715        /**
716         * @param value {@link #onBehalfOf} (The organization the device or practitioner was acting on behalf of when they initiated the task.)
717         */
718        public TaskRequesterComponent setOnBehalfOf(Reference value) { 
719          this.onBehalfOf = value;
720          return this;
721        }
722
723        /**
724         * @return {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of when they initiated the task.)
725         */
726        public Organization getOnBehalfOfTarget() { 
727          if (this.onBehalfOfTarget == null)
728            if (Configuration.errorOnAutoCreate())
729              throw new Error("Attempt to auto-create TaskRequesterComponent.onBehalfOf");
730            else if (Configuration.doAutoCreate())
731              this.onBehalfOfTarget = new Organization(); // aa
732          return this.onBehalfOfTarget;
733        }
734
735        /**
736         * @param value {@link #onBehalfOf} 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 organization the device or practitioner was acting on behalf of when they initiated the task.)
737         */
738        public TaskRequesterComponent setOnBehalfOfTarget(Organization value) { 
739          this.onBehalfOfTarget = value;
740          return this;
741        }
742
743        protected void listChildren(List<Property> childrenList) {
744          super.listChildren(childrenList);
745          childrenList.add(new Property("agent", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The device, practitioner, etc. who initiated the task.", 0, java.lang.Integer.MAX_VALUE, agent));
746          childrenList.add(new Property("onBehalfOf", "Reference(Organization)", "The organization the device or practitioner was acting on behalf of when they initiated the task.", 0, java.lang.Integer.MAX_VALUE, onBehalfOf));
747        }
748
749      @Override
750      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
751        switch (hash) {
752        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : new Base[] {this.agent}; // Reference
753        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
754        default: return super.getProperty(hash, name, checkValid);
755        }
756
757      }
758
759      @Override
760      public Base setProperty(int hash, String name, Base value) throws FHIRException {
761        switch (hash) {
762        case 92750597: // agent
763          this.agent = castToReference(value); // Reference
764          return value;
765        case -14402964: // onBehalfOf
766          this.onBehalfOf = castToReference(value); // Reference
767          return value;
768        default: return super.setProperty(hash, name, value);
769        }
770
771      }
772
773      @Override
774      public Base setProperty(String name, Base value) throws FHIRException {
775        if (name.equals("agent")) {
776          this.agent = castToReference(value); // Reference
777        } else if (name.equals("onBehalfOf")) {
778          this.onBehalfOf = castToReference(value); // Reference
779        } else
780          return super.setProperty(name, value);
781        return value;
782      }
783
784      @Override
785      public Base makeProperty(int hash, String name) throws FHIRException {
786        switch (hash) {
787        case 92750597:  return getAgent(); 
788        case -14402964:  return getOnBehalfOf(); 
789        default: return super.makeProperty(hash, name);
790        }
791
792      }
793
794      @Override
795      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
796        switch (hash) {
797        case 92750597: /*agent*/ return new String[] {"Reference"};
798        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
799        default: return super.getTypesForProperty(hash, name);
800        }
801
802      }
803
804      @Override
805      public Base addChild(String name) throws FHIRException {
806        if (name.equals("agent")) {
807          this.agent = new Reference();
808          return this.agent;
809        }
810        else if (name.equals("onBehalfOf")) {
811          this.onBehalfOf = new Reference();
812          return this.onBehalfOf;
813        }
814        else
815          return super.addChild(name);
816      }
817
818      public TaskRequesterComponent copy() {
819        TaskRequesterComponent dst = new TaskRequesterComponent();
820        copyValues(dst);
821        dst.agent = agent == null ? null : agent.copy();
822        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
823        return dst;
824      }
825
826      @Override
827      public boolean equalsDeep(Base other) {
828        if (!super.equalsDeep(other))
829          return false;
830        if (!(other instanceof TaskRequesterComponent))
831          return false;
832        TaskRequesterComponent o = (TaskRequesterComponent) other;
833        return compareDeep(agent, o.agent, true) && compareDeep(onBehalfOf, o.onBehalfOf, true);
834      }
835
836      @Override
837      public boolean equalsShallow(Base other) {
838        if (!super.equalsShallow(other))
839          return false;
840        if (!(other instanceof TaskRequesterComponent))
841          return false;
842        TaskRequesterComponent o = (TaskRequesterComponent) other;
843        return true;
844      }
845
846      public boolean isEmpty() {
847        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(agent, onBehalfOf);
848      }
849
850  public String fhirType() {
851    return "Task.requester";
852
853  }
854
855  }
856
857    @Block()
858    public static class TaskRestrictionComponent extends BackboneElement implements IBaseBackboneElement {
859        /**
860         * Indicates the number of times the requested action should occur.
861         */
862        @Child(name = "repetitions", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
863        @Description(shortDefinition="How many times to repeat", formalDefinition="Indicates the number of times the requested action should occur." )
864        protected PositiveIntType repetitions;
865
866        /**
867         * Over what time-period is fulfillment sought.
868         */
869        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
870        @Description(shortDefinition="When fulfillment sought", formalDefinition="Over what time-period is fulfillment sought." )
871        protected Period period;
872
873        /**
874         * For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?
875         */
876        @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)
877        @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?" )
878        protected List<Reference> recipient;
879        /**
880         * 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?)
881         */
882        protected List<Resource> recipientTarget;
883
884
885        private static final long serialVersionUID = 1503908360L;
886
887    /**
888     * Constructor
889     */
890      public TaskRestrictionComponent() {
891        super();
892      }
893
894        /**
895         * @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
896         */
897        public PositiveIntType getRepetitionsElement() { 
898          if (this.repetitions == null)
899            if (Configuration.errorOnAutoCreate())
900              throw new Error("Attempt to auto-create TaskRestrictionComponent.repetitions");
901            else if (Configuration.doAutoCreate())
902              this.repetitions = new PositiveIntType(); // bb
903          return this.repetitions;
904        }
905
906        public boolean hasRepetitionsElement() { 
907          return this.repetitions != null && !this.repetitions.isEmpty();
908        }
909
910        public boolean hasRepetitions() { 
911          return this.repetitions != null && !this.repetitions.isEmpty();
912        }
913
914        /**
915         * @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
916         */
917        public TaskRestrictionComponent setRepetitionsElement(PositiveIntType value) { 
918          this.repetitions = value;
919          return this;
920        }
921
922        /**
923         * @return Indicates the number of times the requested action should occur.
924         */
925        public int getRepetitions() { 
926          return this.repetitions == null || this.repetitions.isEmpty() ? 0 : this.repetitions.getValue();
927        }
928
929        /**
930         * @param value Indicates the number of times the requested action should occur.
931         */
932        public TaskRestrictionComponent setRepetitions(int value) { 
933            if (this.repetitions == null)
934              this.repetitions = new PositiveIntType();
935            this.repetitions.setValue(value);
936          return this;
937        }
938
939        /**
940         * @return {@link #period} (Over what time-period is fulfillment sought.)
941         */
942        public Period getPeriod() { 
943          if (this.period == null)
944            if (Configuration.errorOnAutoCreate())
945              throw new Error("Attempt to auto-create TaskRestrictionComponent.period");
946            else if (Configuration.doAutoCreate())
947              this.period = new Period(); // cc
948          return this.period;
949        }
950
951        public boolean hasPeriod() { 
952          return this.period != null && !this.period.isEmpty();
953        }
954
955        /**
956         * @param value {@link #period} (Over what time-period is fulfillment sought.)
957         */
958        public TaskRestrictionComponent setPeriod(Period value) { 
959          this.period = value;
960          return this;
961        }
962
963        /**
964         * @return {@link #recipient} (For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?)
965         */
966        public List<Reference> getRecipient() { 
967          if (this.recipient == null)
968            this.recipient = new ArrayList<Reference>();
969          return this.recipient;
970        }
971
972        /**
973         * @return Returns a reference to <code>this</code> for easy method chaining
974         */
975        public TaskRestrictionComponent setRecipient(List<Reference> theRecipient) { 
976          this.recipient = theRecipient;
977          return this;
978        }
979
980        public boolean hasRecipient() { 
981          if (this.recipient == null)
982            return false;
983          for (Reference item : this.recipient)
984            if (!item.isEmpty())
985              return true;
986          return false;
987        }
988
989        public Reference addRecipient() { //3
990          Reference t = new Reference();
991          if (this.recipient == null)
992            this.recipient = new ArrayList<Reference>();
993          this.recipient.add(t);
994          return t;
995        }
996
997        public TaskRestrictionComponent addRecipient(Reference t) { //3
998          if (t == null)
999            return this;
1000          if (this.recipient == null)
1001            this.recipient = new ArrayList<Reference>();
1002          this.recipient.add(t);
1003          return this;
1004        }
1005
1006        /**
1007         * @return The first repetition of repeating field {@link #recipient}, creating it if it does not already exist
1008         */
1009        public Reference getRecipientFirstRep() { 
1010          if (getRecipient().isEmpty()) {
1011            addRecipient();
1012          }
1013          return getRecipient().get(0);
1014        }
1015
1016        /**
1017         * @deprecated Use Reference#setResource(IBaseResource) instead
1018         */
1019        @Deprecated
1020        public List<Resource> getRecipientTarget() { 
1021          if (this.recipientTarget == null)
1022            this.recipientTarget = new ArrayList<Resource>();
1023          return this.recipientTarget;
1024        }
1025
1026        protected void listChildren(List<Property> childrenList) {
1027          super.listChildren(childrenList);
1028          childrenList.add(new Property("repetitions", "positiveInt", "Indicates the number of times the requested action should occur.", 0, java.lang.Integer.MAX_VALUE, repetitions));
1029          childrenList.add(new Property("period", "Period", "Over what time-period is fulfillment sought.", 0, java.lang.Integer.MAX_VALUE, period));
1030          childrenList.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));
1031        }
1032
1033      @Override
1034      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1035        switch (hash) {
1036        case 984367650: /*repetitions*/ return this.repetitions == null ? new Base[0] : new Base[] {this.repetitions}; // PositiveIntType
1037        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1038        case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : this.recipient.toArray(new Base[this.recipient.size()]); // Reference
1039        default: return super.getProperty(hash, name, checkValid);
1040        }
1041
1042      }
1043
1044      @Override
1045      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1046        switch (hash) {
1047        case 984367650: // repetitions
1048          this.repetitions = castToPositiveInt(value); // PositiveIntType
1049          return value;
1050        case -991726143: // period
1051          this.period = castToPeriod(value); // Period
1052          return value;
1053        case 820081177: // recipient
1054          this.getRecipient().add(castToReference(value)); // Reference
1055          return value;
1056        default: return super.setProperty(hash, name, value);
1057        }
1058
1059      }
1060
1061      @Override
1062      public Base setProperty(String name, Base value) throws FHIRException {
1063        if (name.equals("repetitions")) {
1064          this.repetitions = castToPositiveInt(value); // PositiveIntType
1065        } else if (name.equals("period")) {
1066          this.period = castToPeriod(value); // Period
1067        } else if (name.equals("recipient")) {
1068          this.getRecipient().add(castToReference(value));
1069        } else
1070          return super.setProperty(name, value);
1071        return value;
1072      }
1073
1074      @Override
1075      public Base makeProperty(int hash, String name) throws FHIRException {
1076        switch (hash) {
1077        case 984367650:  return getRepetitionsElement();
1078        case -991726143:  return getPeriod(); 
1079        case 820081177:  return addRecipient(); 
1080        default: return super.makeProperty(hash, name);
1081        }
1082
1083      }
1084
1085      @Override
1086      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1087        switch (hash) {
1088        case 984367650: /*repetitions*/ return new String[] {"positiveInt"};
1089        case -991726143: /*period*/ return new String[] {"Period"};
1090        case 820081177: /*recipient*/ return new String[] {"Reference"};
1091        default: return super.getTypesForProperty(hash, name);
1092        }
1093
1094      }
1095
1096      @Override
1097      public Base addChild(String name) throws FHIRException {
1098        if (name.equals("repetitions")) {
1099          throw new FHIRException("Cannot call addChild on a primitive type Task.repetitions");
1100        }
1101        else if (name.equals("period")) {
1102          this.period = new Period();
1103          return this.period;
1104        }
1105        else if (name.equals("recipient")) {
1106          return addRecipient();
1107        }
1108        else
1109          return super.addChild(name);
1110      }
1111
1112      public TaskRestrictionComponent copy() {
1113        TaskRestrictionComponent dst = new TaskRestrictionComponent();
1114        copyValues(dst);
1115        dst.repetitions = repetitions == null ? null : repetitions.copy();
1116        dst.period = period == null ? null : period.copy();
1117        if (recipient != null) {
1118          dst.recipient = new ArrayList<Reference>();
1119          for (Reference i : recipient)
1120            dst.recipient.add(i.copy());
1121        };
1122        return dst;
1123      }
1124
1125      @Override
1126      public boolean equalsDeep(Base other) {
1127        if (!super.equalsDeep(other))
1128          return false;
1129        if (!(other instanceof TaskRestrictionComponent))
1130          return false;
1131        TaskRestrictionComponent o = (TaskRestrictionComponent) other;
1132        return compareDeep(repetitions, o.repetitions, true) && compareDeep(period, o.period, true) && compareDeep(recipient, o.recipient, true)
1133          ;
1134      }
1135
1136      @Override
1137      public boolean equalsShallow(Base other) {
1138        if (!super.equalsShallow(other))
1139          return false;
1140        if (!(other instanceof TaskRestrictionComponent))
1141          return false;
1142        TaskRestrictionComponent o = (TaskRestrictionComponent) other;
1143        return compareValues(repetitions, o.repetitions, true);
1144      }
1145
1146      public boolean isEmpty() {
1147        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(repetitions, period, recipient
1148          );
1149      }
1150
1151  public String fhirType() {
1152    return "Task.restriction";
1153
1154  }
1155
1156  }
1157
1158    @Block()
1159    public static class ParameterComponent extends BackboneElement implements IBaseBackboneElement {
1160        /**
1161         * A code or description indicating how the input is intended to be used as part of the task execution.
1162         */
1163        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1164        @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." )
1165        protected CodeableConcept type;
1166
1167        /**
1168         * The value of the input parameter as a basic type.
1169         */
1170        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
1171        @Description(shortDefinition="Content to use in performing the task", formalDefinition="The value of the input parameter as a basic type." )
1172        protected org.hl7.fhir.dstu3.model.Type value;
1173
1174        private static final long serialVersionUID = -852629026L;
1175
1176    /**
1177     * Constructor
1178     */
1179      public ParameterComponent() {
1180        super();
1181      }
1182
1183    /**
1184     * Constructor
1185     */
1186      public ParameterComponent(CodeableConcept type, org.hl7.fhir.dstu3.model.Type value) {
1187        super();
1188        this.type = type;
1189        this.value = value;
1190      }
1191
1192        /**
1193         * @return {@link #type} (A code or description indicating how the input is intended to be used as part of the task execution.)
1194         */
1195        public CodeableConcept getType() { 
1196          if (this.type == null)
1197            if (Configuration.errorOnAutoCreate())
1198              throw new Error("Attempt to auto-create ParameterComponent.type");
1199            else if (Configuration.doAutoCreate())
1200              this.type = new CodeableConcept(); // cc
1201          return this.type;
1202        }
1203
1204        public boolean hasType() { 
1205          return this.type != null && !this.type.isEmpty();
1206        }
1207
1208        /**
1209         * @param value {@link #type} (A code or description indicating how the input is intended to be used as part of the task execution.)
1210         */
1211        public ParameterComponent setType(CodeableConcept value) { 
1212          this.type = value;
1213          return this;
1214        }
1215
1216        /**
1217         * @return {@link #value} (The value of the input parameter as a basic type.)
1218         */
1219        public org.hl7.fhir.dstu3.model.Type getValue() { 
1220          return this.value;
1221        }
1222
1223        public boolean hasValue() { 
1224          return this.value != null && !this.value.isEmpty();
1225        }
1226
1227        /**
1228         * @param value {@link #value} (The value of the input parameter as a basic type.)
1229         */
1230        public ParameterComponent setValue(org.hl7.fhir.dstu3.model.Type value) { 
1231          this.value = value;
1232          return this;
1233        }
1234
1235        protected void listChildren(List<Property> childrenList) {
1236          super.listChildren(childrenList);
1237          childrenList.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, java.lang.Integer.MAX_VALUE, type));
1238          childrenList.add(new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, java.lang.Integer.MAX_VALUE, value));
1239        }
1240
1241      @Override
1242      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1243        switch (hash) {
1244        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1245        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu3.model.Type
1246        default: return super.getProperty(hash, name, checkValid);
1247        }
1248
1249      }
1250
1251      @Override
1252      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1253        switch (hash) {
1254        case 3575610: // type
1255          this.type = castToCodeableConcept(value); // CodeableConcept
1256          return value;
1257        case 111972721: // value
1258          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
1259          return value;
1260        default: return super.setProperty(hash, name, value);
1261        }
1262
1263      }
1264
1265      @Override
1266      public Base setProperty(String name, Base value) throws FHIRException {
1267        if (name.equals("type")) {
1268          this.type = castToCodeableConcept(value); // CodeableConcept
1269        } else if (name.equals("value[x]")) {
1270          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
1271        } else
1272          return super.setProperty(name, value);
1273        return value;
1274      }
1275
1276      @Override
1277      public Base makeProperty(int hash, String name) throws FHIRException {
1278        switch (hash) {
1279        case 3575610:  return getType(); 
1280        case -1410166417:  return getValue(); 
1281        case 111972721:  return getValue(); 
1282        default: return super.makeProperty(hash, name);
1283        }
1284
1285      }
1286
1287      @Override
1288      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1289        switch (hash) {
1290        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1291        case 111972721: /*value*/ return new String[] {"*"};
1292        default: return super.getTypesForProperty(hash, name);
1293        }
1294
1295      }
1296
1297      @Override
1298      public Base addChild(String name) throws FHIRException {
1299        if (name.equals("type")) {
1300          this.type = new CodeableConcept();
1301          return this.type;
1302        }
1303        else if (name.equals("valueBoolean")) {
1304          this.value = new BooleanType();
1305          return this.value;
1306        }
1307        else if (name.equals("valueInteger")) {
1308          this.value = new IntegerType();
1309          return this.value;
1310        }
1311        else if (name.equals("valueDecimal")) {
1312          this.value = new DecimalType();
1313          return this.value;
1314        }
1315        else if (name.equals("valueBase64Binary")) {
1316          this.value = new Base64BinaryType();
1317          return this.value;
1318        }
1319        else if (name.equals("valueInstant")) {
1320          this.value = new InstantType();
1321          return this.value;
1322        }
1323        else if (name.equals("valueString")) {
1324          this.value = new StringType();
1325          return this.value;
1326        }
1327        else if (name.equals("valueUri")) {
1328          this.value = new UriType();
1329          return this.value;
1330        }
1331        else if (name.equals("valueDate")) {
1332          this.value = new DateType();
1333          return this.value;
1334        }
1335        else if (name.equals("valueDateTime")) {
1336          this.value = new DateTimeType();
1337          return this.value;
1338        }
1339        else if (name.equals("valueTime")) {
1340          this.value = new TimeType();
1341          return this.value;
1342        }
1343        else if (name.equals("valueCode")) {
1344          this.value = new CodeType();
1345          return this.value;
1346        }
1347        else if (name.equals("valueOid")) {
1348          this.value = new OidType();
1349          return this.value;
1350        }
1351        else if (name.equals("valueId")) {
1352          this.value = new IdType();
1353          return this.value;
1354        }
1355        else if (name.equals("valueUnsignedInt")) {
1356          this.value = new UnsignedIntType();
1357          return this.value;
1358        }
1359        else if (name.equals("valuePositiveInt")) {
1360          this.value = new PositiveIntType();
1361          return this.value;
1362        }
1363        else if (name.equals("valueMarkdown")) {
1364          this.value = new MarkdownType();
1365          return this.value;
1366        }
1367        else if (name.equals("valueAnnotation")) {
1368          this.value = new Annotation();
1369          return this.value;
1370        }
1371        else if (name.equals("valueAttachment")) {
1372          this.value = new Attachment();
1373          return this.value;
1374        }
1375        else if (name.equals("valueIdentifier")) {
1376          this.value = new Identifier();
1377          return this.value;
1378        }
1379        else if (name.equals("valueCodeableConcept")) {
1380          this.value = new CodeableConcept();
1381          return this.value;
1382        }
1383        else if (name.equals("valueCoding")) {
1384          this.value = new Coding();
1385          return this.value;
1386        }
1387        else if (name.equals("valueQuantity")) {
1388          this.value = new Quantity();
1389          return this.value;
1390        }
1391        else if (name.equals("valueRange")) {
1392          this.value = new Range();
1393          return this.value;
1394        }
1395        else if (name.equals("valuePeriod")) {
1396          this.value = new Period();
1397          return this.value;
1398        }
1399        else if (name.equals("valueRatio")) {
1400          this.value = new Ratio();
1401          return this.value;
1402        }
1403        else if (name.equals("valueSampledData")) {
1404          this.value = new SampledData();
1405          return this.value;
1406        }
1407        else if (name.equals("valueSignature")) {
1408          this.value = new Signature();
1409          return this.value;
1410        }
1411        else if (name.equals("valueHumanName")) {
1412          this.value = new HumanName();
1413          return this.value;
1414        }
1415        else if (name.equals("valueAddress")) {
1416          this.value = new Address();
1417          return this.value;
1418        }
1419        else if (name.equals("valueContactPoint")) {
1420          this.value = new ContactPoint();
1421          return this.value;
1422        }
1423        else if (name.equals("valueTiming")) {
1424          this.value = new Timing();
1425          return this.value;
1426        }
1427        else if (name.equals("valueReference")) {
1428          this.value = new Reference();
1429          return this.value;
1430        }
1431        else if (name.equals("valueMeta")) {
1432          this.value = new Meta();
1433          return this.value;
1434        }
1435        else
1436          return super.addChild(name);
1437      }
1438
1439      public ParameterComponent copy() {
1440        ParameterComponent dst = new ParameterComponent();
1441        copyValues(dst);
1442        dst.type = type == null ? null : type.copy();
1443        dst.value = value == null ? null : value.copy();
1444        return dst;
1445      }
1446
1447      @Override
1448      public boolean equalsDeep(Base other) {
1449        if (!super.equalsDeep(other))
1450          return false;
1451        if (!(other instanceof ParameterComponent))
1452          return false;
1453        ParameterComponent o = (ParameterComponent) other;
1454        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
1455      }
1456
1457      @Override
1458      public boolean equalsShallow(Base other) {
1459        if (!super.equalsShallow(other))
1460          return false;
1461        if (!(other instanceof ParameterComponent))
1462          return false;
1463        ParameterComponent o = (ParameterComponent) other;
1464        return true;
1465      }
1466
1467      public boolean isEmpty() {
1468        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
1469      }
1470
1471  public String fhirType() {
1472    return "Task.input";
1473
1474  }
1475
1476  }
1477
1478    @Block()
1479    public static class TaskOutputComponent extends BackboneElement implements IBaseBackboneElement {
1480        /**
1481         * The name of the Output parameter.
1482         */
1483        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1484        @Description(shortDefinition="Label for output", formalDefinition="The name of the Output parameter." )
1485        protected CodeableConcept type;
1486
1487        /**
1488         * The value of the Output parameter as a basic type.
1489         */
1490        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
1491        @Description(shortDefinition="Result of output", formalDefinition="The value of the Output parameter as a basic type." )
1492        protected org.hl7.fhir.dstu3.model.Type value;
1493
1494        private static final long serialVersionUID = -852629026L;
1495
1496    /**
1497     * Constructor
1498     */
1499      public TaskOutputComponent() {
1500        super();
1501      }
1502
1503    /**
1504     * Constructor
1505     */
1506      public TaskOutputComponent(CodeableConcept type, org.hl7.fhir.dstu3.model.Type value) {
1507        super();
1508        this.type = type;
1509        this.value = value;
1510      }
1511
1512        /**
1513         * @return {@link #type} (The name of the Output parameter.)
1514         */
1515        public CodeableConcept getType() { 
1516          if (this.type == null)
1517            if (Configuration.errorOnAutoCreate())
1518              throw new Error("Attempt to auto-create TaskOutputComponent.type");
1519            else if (Configuration.doAutoCreate())
1520              this.type = new CodeableConcept(); // cc
1521          return this.type;
1522        }
1523
1524        public boolean hasType() { 
1525          return this.type != null && !this.type.isEmpty();
1526        }
1527
1528        /**
1529         * @param value {@link #type} (The name of the Output parameter.)
1530         */
1531        public TaskOutputComponent setType(CodeableConcept value) { 
1532          this.type = value;
1533          return this;
1534        }
1535
1536        /**
1537         * @return {@link #value} (The value of the Output parameter as a basic type.)
1538         */
1539        public org.hl7.fhir.dstu3.model.Type getValue() { 
1540          return this.value;
1541        }
1542
1543        public boolean hasValue() { 
1544          return this.value != null && !this.value.isEmpty();
1545        }
1546
1547        /**
1548         * @param value {@link #value} (The value of the Output parameter as a basic type.)
1549         */
1550        public TaskOutputComponent setValue(org.hl7.fhir.dstu3.model.Type value) { 
1551          this.value = value;
1552          return this;
1553        }
1554
1555        protected void listChildren(List<Property> childrenList) {
1556          super.listChildren(childrenList);
1557          childrenList.add(new Property("type", "CodeableConcept", "The name of the Output parameter.", 0, java.lang.Integer.MAX_VALUE, type));
1558          childrenList.add(new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, java.lang.Integer.MAX_VALUE, value));
1559        }
1560
1561      @Override
1562      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1563        switch (hash) {
1564        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1565        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu3.model.Type
1566        default: return super.getProperty(hash, name, checkValid);
1567        }
1568
1569      }
1570
1571      @Override
1572      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1573        switch (hash) {
1574        case 3575610: // type
1575          this.type = castToCodeableConcept(value); // CodeableConcept
1576          return value;
1577        case 111972721: // value
1578          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
1579          return value;
1580        default: return super.setProperty(hash, name, value);
1581        }
1582
1583      }
1584
1585      @Override
1586      public Base setProperty(String name, Base value) throws FHIRException {
1587        if (name.equals("type")) {
1588          this.type = castToCodeableConcept(value); // CodeableConcept
1589        } else if (name.equals("value[x]")) {
1590          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
1591        } else
1592          return super.setProperty(name, value);
1593        return value;
1594      }
1595
1596      @Override
1597      public Base makeProperty(int hash, String name) throws FHIRException {
1598        switch (hash) {
1599        case 3575610:  return getType(); 
1600        case -1410166417:  return getValue(); 
1601        case 111972721:  return getValue(); 
1602        default: return super.makeProperty(hash, name);
1603        }
1604
1605      }
1606
1607      @Override
1608      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1609        switch (hash) {
1610        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1611        case 111972721: /*value*/ return new String[] {"*"};
1612        default: return super.getTypesForProperty(hash, name);
1613        }
1614
1615      }
1616
1617      @Override
1618      public Base addChild(String name) throws FHIRException {
1619        if (name.equals("type")) {
1620          this.type = new CodeableConcept();
1621          return this.type;
1622        }
1623        else if (name.equals("valueBoolean")) {
1624          this.value = new BooleanType();
1625          return this.value;
1626        }
1627        else if (name.equals("valueInteger")) {
1628          this.value = new IntegerType();
1629          return this.value;
1630        }
1631        else if (name.equals("valueDecimal")) {
1632          this.value = new DecimalType();
1633          return this.value;
1634        }
1635        else if (name.equals("valueBase64Binary")) {
1636          this.value = new Base64BinaryType();
1637          return this.value;
1638        }
1639        else if (name.equals("valueInstant")) {
1640          this.value = new InstantType();
1641          return this.value;
1642        }
1643        else if (name.equals("valueString")) {
1644          this.value = new StringType();
1645          return this.value;
1646        }
1647        else if (name.equals("valueUri")) {
1648          this.value = new UriType();
1649          return this.value;
1650        }
1651        else if (name.equals("valueDate")) {
1652          this.value = new DateType();
1653          return this.value;
1654        }
1655        else if (name.equals("valueDateTime")) {
1656          this.value = new DateTimeType();
1657          return this.value;
1658        }
1659        else if (name.equals("valueTime")) {
1660          this.value = new TimeType();
1661          return this.value;
1662        }
1663        else if (name.equals("valueCode")) {
1664          this.value = new CodeType();
1665          return this.value;
1666        }
1667        else if (name.equals("valueOid")) {
1668          this.value = new OidType();
1669          return this.value;
1670        }
1671        else if (name.equals("valueId")) {
1672          this.value = new IdType();
1673          return this.value;
1674        }
1675        else if (name.equals("valueUnsignedInt")) {
1676          this.value = new UnsignedIntType();
1677          return this.value;
1678        }
1679        else if (name.equals("valuePositiveInt")) {
1680          this.value = new PositiveIntType();
1681          return this.value;
1682        }
1683        else if (name.equals("valueMarkdown")) {
1684          this.value = new MarkdownType();
1685          return this.value;
1686        }
1687        else if (name.equals("valueAnnotation")) {
1688          this.value = new Annotation();
1689          return this.value;
1690        }
1691        else if (name.equals("valueAttachment")) {
1692          this.value = new Attachment();
1693          return this.value;
1694        }
1695        else if (name.equals("valueIdentifier")) {
1696          this.value = new Identifier();
1697          return this.value;
1698        }
1699        else if (name.equals("valueCodeableConcept")) {
1700          this.value = new CodeableConcept();
1701          return this.value;
1702        }
1703        else if (name.equals("valueCoding")) {
1704          this.value = new Coding();
1705          return this.value;
1706        }
1707        else if (name.equals("valueQuantity")) {
1708          this.value = new Quantity();
1709          return this.value;
1710        }
1711        else if (name.equals("valueRange")) {
1712          this.value = new Range();
1713          return this.value;
1714        }
1715        else if (name.equals("valuePeriod")) {
1716          this.value = new Period();
1717          return this.value;
1718        }
1719        else if (name.equals("valueRatio")) {
1720          this.value = new Ratio();
1721          return this.value;
1722        }
1723        else if (name.equals("valueSampledData")) {
1724          this.value = new SampledData();
1725          return this.value;
1726        }
1727        else if (name.equals("valueSignature")) {
1728          this.value = new Signature();
1729          return this.value;
1730        }
1731        else if (name.equals("valueHumanName")) {
1732          this.value = new HumanName();
1733          return this.value;
1734        }
1735        else if (name.equals("valueAddress")) {
1736          this.value = new Address();
1737          return this.value;
1738        }
1739        else if (name.equals("valueContactPoint")) {
1740          this.value = new ContactPoint();
1741          return this.value;
1742        }
1743        else if (name.equals("valueTiming")) {
1744          this.value = new Timing();
1745          return this.value;
1746        }
1747        else if (name.equals("valueReference")) {
1748          this.value = new Reference();
1749          return this.value;
1750        }
1751        else if (name.equals("valueMeta")) {
1752          this.value = new Meta();
1753          return this.value;
1754        }
1755        else
1756          return super.addChild(name);
1757      }
1758
1759      public TaskOutputComponent copy() {
1760        TaskOutputComponent dst = new TaskOutputComponent();
1761        copyValues(dst);
1762        dst.type = type == null ? null : type.copy();
1763        dst.value = value == null ? null : value.copy();
1764        return dst;
1765      }
1766
1767      @Override
1768      public boolean equalsDeep(Base other) {
1769        if (!super.equalsDeep(other))
1770          return false;
1771        if (!(other instanceof TaskOutputComponent))
1772          return false;
1773        TaskOutputComponent o = (TaskOutputComponent) other;
1774        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
1775      }
1776
1777      @Override
1778      public boolean equalsShallow(Base other) {
1779        if (!super.equalsShallow(other))
1780          return false;
1781        if (!(other instanceof TaskOutputComponent))
1782          return false;
1783        TaskOutputComponent o = (TaskOutputComponent) other;
1784        return true;
1785      }
1786
1787      public boolean isEmpty() {
1788        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
1789      }
1790
1791  public String fhirType() {
1792    return "Task.output";
1793
1794  }
1795
1796  }
1797
1798    /**
1799     * The business identifier for this task.
1800     */
1801    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1802    @Description(shortDefinition="Task Instance Identifier", formalDefinition="The business identifier for this task." )
1803    protected List<Identifier> identifier;
1804
1805    /**
1806     * A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.
1807     */
1808    @Child(name = "definition", type = {UriType.class, ActivityDefinition.class}, order=1, min=0, max=1, modifier=false, summary=true)
1809    @Description(shortDefinition="Formal definition of task", formalDefinition="A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc." )
1810    protected Type definition;
1811
1812    /**
1813     * BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a "request" resource such as a ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient.
1814     */
1815    @Child(name = "basedOn", type = {Reference.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1816    @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 ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the \"request\" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient." )
1817    protected List<Reference> basedOn;
1818    /**
1819     * 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 ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient.)
1820     */
1821    protected List<Resource> basedOnTarget;
1822
1823
1824    /**
1825     * An identifier that links together multiple tasks and other requests that were created in the same context.
1826     */
1827    @Child(name = "groupIdentifier", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
1828    @Description(shortDefinition="Requisition or grouper id", formalDefinition="An identifier that links together multiple tasks and other requests that were created in the same context." )
1829    protected Identifier groupIdentifier;
1830
1831    /**
1832     * Task that this particular task is part of.
1833     */
1834    @Child(name = "partOf", type = {Task.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1835    @Description(shortDefinition="Composite task", formalDefinition="Task that this particular task is part of." )
1836    protected List<Reference> partOf;
1837    /**
1838     * The actual objects that are the target of the reference (Task that this particular task is part of.)
1839     */
1840    protected List<Task> partOfTarget;
1841
1842
1843    /**
1844     * The current status of the task.
1845     */
1846    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1847    @Description(shortDefinition="draft | requested | received | accepted | +", formalDefinition="The current status of the task." )
1848    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-status")
1849    protected Enumeration<TaskStatus> status;
1850
1851    /**
1852     * An explanation as to why this task is held, failed, was refused, etc.
1853     */
1854    @Child(name = "statusReason", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
1855    @Description(shortDefinition="Reason for current status", formalDefinition="An explanation as to why this task is held, failed, was refused, etc." )
1856    protected CodeableConcept statusReason;
1857
1858    /**
1859     * Contains business-specific nuances of the business state.
1860     */
1861    @Child(name = "businessStatus", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
1862    @Description(shortDefinition="E.g. \"Specimen collected\", \"IV prepped\"", formalDefinition="Contains business-specific nuances of the business state." )
1863    protected CodeableConcept businessStatus;
1864
1865    /**
1866     * Indicates the "level" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc.
1867     */
1868    @Child(name = "intent", type = {CodeType.class}, order=8, min=1, max=1, modifier=false, summary=true)
1869    @Description(shortDefinition="proposal | plan | order +", formalDefinition="Indicates the \"level\" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc." )
1870    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
1871    protected Enumeration<TaskIntent> intent;
1872
1873    /**
1874     * Indicates how quickly the Task should be addressed with respect to other requests.
1875     */
1876    @Child(name = "priority", type = {CodeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
1877    @Description(shortDefinition="normal | urgent | asap | stat", formalDefinition="Indicates how quickly the Task should be addressed with respect to other requests." )
1878    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
1879    protected Enumeration<TaskPriority> priority;
1880
1881    /**
1882     * A name or code (or both) briefly describing what the task involves.
1883     */
1884    @Child(name = "code", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
1885    @Description(shortDefinition="Task Type", formalDefinition="A name or code (or both) briefly describing what the task involves." )
1886    protected CodeableConcept code;
1887
1888    /**
1889     * A free-text description of what is to be performed.
1890     */
1891    @Child(name = "description", type = {StringType.class}, order=11, min=0, max=1, modifier=false, summary=true)
1892    @Description(shortDefinition="Human-readable explanation of task", formalDefinition="A free-text description of what is to be performed." )
1893    protected StringType description;
1894
1895    /**
1896     * The request being actioned or the resource being manipulated by this task.
1897     */
1898    @Child(name = "focus", type = {Reference.class}, order=12, min=0, max=1, modifier=false, summary=true)
1899    @Description(shortDefinition="What task is acting on", formalDefinition="The request being actioned or the resource being manipulated by this task." )
1900    protected Reference focus;
1901
1902    /**
1903     * The actual object that is the target of the reference (The request being actioned or the resource being manipulated by this task.)
1904     */
1905    protected Resource focusTarget;
1906
1907    /**
1908     * The entity who benefits from the performance of the service specified in the task (e.g., the patient).
1909     */
1910    @Child(name = "for", type = {Reference.class}, order=13, min=0, max=1, modifier=false, summary=true)
1911    @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)." )
1912    protected Reference for_;
1913
1914    /**
1915     * 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).)
1916     */
1917    protected Resource for_Target;
1918
1919    /**
1920     * The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.
1921     */
1922    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=14, min=0, max=1, modifier=false, summary=true)
1923    @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." )
1924    protected Reference context;
1925
1926    /**
1927     * 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.)
1928     */
1929    protected Resource contextTarget;
1930
1931    /**
1932     * 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).
1933     */
1934    @Child(name = "executionPeriod", type = {Period.class}, order=15, min=0, max=1, modifier=false, summary=true)
1935    @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)." )
1936    protected Period executionPeriod;
1937
1938    /**
1939     * The date and time this task was created.
1940     */
1941    @Child(name = "authoredOn", type = {DateTimeType.class}, order=16, min=0, max=1, modifier=false, summary=false)
1942    @Description(shortDefinition="Task Creation Date", formalDefinition="The date and time this task was created." )
1943    protected DateTimeType authoredOn;
1944
1945    /**
1946     * The date and time of last modification to this task.
1947     */
1948    @Child(name = "lastModified", type = {DateTimeType.class}, order=17, min=0, max=1, modifier=false, summary=true)
1949    @Description(shortDefinition="Task Last Modified Date", formalDefinition="The date and time of last modification to this task." )
1950    protected DateTimeType lastModified;
1951
1952    /**
1953     * The creator of the task.
1954     */
1955    @Child(name = "requester", type = {}, order=18, min=0, max=1, modifier=false, summary=true)
1956    @Description(shortDefinition="Who is asking for task to be done", formalDefinition="The creator of the task." )
1957    protected TaskRequesterComponent requester;
1958
1959    /**
1960     * The type of participant that can execute the task.
1961     */
1962    @Child(name = "performerType", type = {CodeableConcept.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1963    @Description(shortDefinition="requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer", formalDefinition="The type of participant that can execute the task." )
1964    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/task-performer-type")
1965    protected List<CodeableConcept> performerType;
1966
1967    /**
1968     * Individual organization or Device currently responsible for task execution.
1969     */
1970    @Child(name = "owner", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=20, min=0, max=1, modifier=false, summary=true)
1971    @Description(shortDefinition="Responsible individual", formalDefinition="Individual organization or Device currently responsible for task execution." )
1972    protected Reference owner;
1973
1974    /**
1975     * The actual object that is the target of the reference (Individual organization or Device currently responsible for task execution.)
1976     */
1977    protected Resource ownerTarget;
1978
1979    /**
1980     * A description or code indicating why this task needs to be performed.
1981     */
1982    @Child(name = "reason", type = {CodeableConcept.class}, order=21, min=0, max=1, modifier=false, summary=false)
1983    @Description(shortDefinition="Why task is needed", formalDefinition="A description or code indicating why this task needs to be performed." )
1984    protected CodeableConcept reason;
1985
1986    /**
1987     * Free-text information captured about the task as it progresses.
1988     */
1989    @Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1990    @Description(shortDefinition="Comments made about the task", formalDefinition="Free-text information captured about the task as it progresses." )
1991    protected List<Annotation> note;
1992
1993    /**
1994     * 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.
1995     */
1996    @Child(name = "relevantHistory", type = {Provenance.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1997    @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." )
1998    protected List<Reference> relevantHistory;
1999    /**
2000     * 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.)
2001     */
2002    protected List<Provenance> relevantHistoryTarget;
2003
2004
2005    /**
2006     * 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.
2007     */
2008    @Child(name = "restriction", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
2009    @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." )
2010    protected TaskRestrictionComponent restriction;
2011
2012    /**
2013     * Additional information that may be needed in the execution of the task.
2014     */
2015    @Child(name = "input", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2016    @Description(shortDefinition="Information used to perform task", formalDefinition="Additional information that may be needed in the execution of the task." )
2017    protected List<ParameterComponent> input;
2018
2019    /**
2020     * Outputs produced by the Task.
2021     */
2022    @Child(name = "output", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2023    @Description(shortDefinition="Information produced as part of task", formalDefinition="Outputs produced by the Task." )
2024    protected List<TaskOutputComponent> output;
2025
2026    private static final long serialVersionUID = 2060755798L;
2027
2028  /**
2029   * Constructor
2030   */
2031    public Task() {
2032      super();
2033    }
2034
2035  /**
2036   * Constructor
2037   */
2038    public Task(Enumeration<TaskStatus> status, Enumeration<TaskIntent> intent) {
2039      super();
2040      this.status = status;
2041      this.intent = intent;
2042    }
2043
2044    /**
2045     * @return {@link #identifier} (The business identifier for this task.)
2046     */
2047    public List<Identifier> getIdentifier() { 
2048      if (this.identifier == null)
2049        this.identifier = new ArrayList<Identifier>();
2050      return this.identifier;
2051    }
2052
2053    /**
2054     * @return Returns a reference to <code>this</code> for easy method chaining
2055     */
2056    public Task setIdentifier(List<Identifier> theIdentifier) { 
2057      this.identifier = theIdentifier;
2058      return this;
2059    }
2060
2061    public boolean hasIdentifier() { 
2062      if (this.identifier == null)
2063        return false;
2064      for (Identifier item : this.identifier)
2065        if (!item.isEmpty())
2066          return true;
2067      return false;
2068    }
2069
2070    public Identifier addIdentifier() { //3
2071      Identifier t = new Identifier();
2072      if (this.identifier == null)
2073        this.identifier = new ArrayList<Identifier>();
2074      this.identifier.add(t);
2075      return t;
2076    }
2077
2078    public Task addIdentifier(Identifier t) { //3
2079      if (t == null)
2080        return this;
2081      if (this.identifier == null)
2082        this.identifier = new ArrayList<Identifier>();
2083      this.identifier.add(t);
2084      return this;
2085    }
2086
2087    /**
2088     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2089     */
2090    public Identifier getIdentifierFirstRep() { 
2091      if (getIdentifier().isEmpty()) {
2092        addIdentifier();
2093      }
2094      return getIdentifier().get(0);
2095    }
2096
2097    /**
2098     * @return {@link #definition} (A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.)
2099     */
2100    public Type getDefinition() { 
2101      return this.definition;
2102    }
2103
2104    /**
2105     * @return {@link #definition} (A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.)
2106     */
2107    public UriType getDefinitionUriType() throws FHIRException { 
2108      if (!(this.definition instanceof UriType))
2109        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.definition.getClass().getName()+" was encountered");
2110      return (UriType) this.definition;
2111    }
2112
2113    public boolean hasDefinitionUriType() { 
2114      return this.definition instanceof UriType;
2115    }
2116
2117    /**
2118     * @return {@link #definition} (A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.)
2119     */
2120    public Reference getDefinitionReference() throws FHIRException { 
2121      if (!(this.definition instanceof Reference))
2122        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.definition.getClass().getName()+" was encountered");
2123      return (Reference) this.definition;
2124    }
2125
2126    public boolean hasDefinitionReference() { 
2127      return this.definition instanceof Reference;
2128    }
2129
2130    public boolean hasDefinition() { 
2131      return this.definition != null && !this.definition.isEmpty();
2132    }
2133
2134    /**
2135     * @param value {@link #definition} (A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.)
2136     */
2137    public Task setDefinition(Type value) { 
2138      this.definition = value;
2139      return this;
2140    }
2141
2142    /**
2143     * @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 ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient.)
2144     */
2145    public List<Reference> getBasedOn() { 
2146      if (this.basedOn == null)
2147        this.basedOn = new ArrayList<Reference>();
2148      return this.basedOn;
2149    }
2150
2151    /**
2152     * @return Returns a reference to <code>this</code> for easy method chaining
2153     */
2154    public Task setBasedOn(List<Reference> theBasedOn) { 
2155      this.basedOn = theBasedOn;
2156      return this;
2157    }
2158
2159    public boolean hasBasedOn() { 
2160      if (this.basedOn == null)
2161        return false;
2162      for (Reference item : this.basedOn)
2163        if (!item.isEmpty())
2164          return true;
2165      return false;
2166    }
2167
2168    public Reference addBasedOn() { //3
2169      Reference t = new Reference();
2170      if (this.basedOn == null)
2171        this.basedOn = new ArrayList<Reference>();
2172      this.basedOn.add(t);
2173      return t;
2174    }
2175
2176    public Task addBasedOn(Reference t) { //3
2177      if (t == null)
2178        return this;
2179      if (this.basedOn == null)
2180        this.basedOn = new ArrayList<Reference>();
2181      this.basedOn.add(t);
2182      return this;
2183    }
2184
2185    /**
2186     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
2187     */
2188    public Reference getBasedOnFirstRep() { 
2189      if (getBasedOn().isEmpty()) {
2190        addBasedOn();
2191      }
2192      return getBasedOn().get(0);
2193    }
2194
2195    /**
2196     * @deprecated Use Reference#setResource(IBaseResource) instead
2197     */
2198    @Deprecated
2199    public List<Resource> getBasedOnTarget() { 
2200      if (this.basedOnTarget == null)
2201        this.basedOnTarget = new ArrayList<Resource>();
2202      return this.basedOnTarget;
2203    }
2204
2205    /**
2206     * @return {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2207     */
2208    public Identifier getGroupIdentifier() { 
2209      if (this.groupIdentifier == null)
2210        if (Configuration.errorOnAutoCreate())
2211          throw new Error("Attempt to auto-create Task.groupIdentifier");
2212        else if (Configuration.doAutoCreate())
2213          this.groupIdentifier = new Identifier(); // cc
2214      return this.groupIdentifier;
2215    }
2216
2217    public boolean hasGroupIdentifier() { 
2218      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
2219    }
2220
2221    /**
2222     * @param value {@link #groupIdentifier} (An identifier that links together multiple tasks and other requests that were created in the same context.)
2223     */
2224    public Task setGroupIdentifier(Identifier value) { 
2225      this.groupIdentifier = value;
2226      return this;
2227    }
2228
2229    /**
2230     * @return {@link #partOf} (Task that this particular task is part of.)
2231     */
2232    public List<Reference> getPartOf() { 
2233      if (this.partOf == null)
2234        this.partOf = new ArrayList<Reference>();
2235      return this.partOf;
2236    }
2237
2238    /**
2239     * @return Returns a reference to <code>this</code> for easy method chaining
2240     */
2241    public Task setPartOf(List<Reference> thePartOf) { 
2242      this.partOf = thePartOf;
2243      return this;
2244    }
2245
2246    public boolean hasPartOf() { 
2247      if (this.partOf == null)
2248        return false;
2249      for (Reference item : this.partOf)
2250        if (!item.isEmpty())
2251          return true;
2252      return false;
2253    }
2254
2255    public Reference addPartOf() { //3
2256      Reference t = new Reference();
2257      if (this.partOf == null)
2258        this.partOf = new ArrayList<Reference>();
2259      this.partOf.add(t);
2260      return t;
2261    }
2262
2263    public Task addPartOf(Reference t) { //3
2264      if (t == null)
2265        return this;
2266      if (this.partOf == null)
2267        this.partOf = new ArrayList<Reference>();
2268      this.partOf.add(t);
2269      return this;
2270    }
2271
2272    /**
2273     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
2274     */
2275    public Reference getPartOfFirstRep() { 
2276      if (getPartOf().isEmpty()) {
2277        addPartOf();
2278      }
2279      return getPartOf().get(0);
2280    }
2281
2282    /**
2283     * @deprecated Use Reference#setResource(IBaseResource) instead
2284     */
2285    @Deprecated
2286    public List<Task> getPartOfTarget() { 
2287      if (this.partOfTarget == null)
2288        this.partOfTarget = new ArrayList<Task>();
2289      return this.partOfTarget;
2290    }
2291
2292    /**
2293     * @deprecated Use Reference#setResource(IBaseResource) instead
2294     */
2295    @Deprecated
2296    public Task addPartOfTarget() { 
2297      Task r = new Task();
2298      if (this.partOfTarget == null)
2299        this.partOfTarget = new ArrayList<Task>();
2300      this.partOfTarget.add(r);
2301      return r;
2302    }
2303
2304    /**
2305     * @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
2306     */
2307    public Enumeration<TaskStatus> getStatusElement() { 
2308      if (this.status == null)
2309        if (Configuration.errorOnAutoCreate())
2310          throw new Error("Attempt to auto-create Task.status");
2311        else if (Configuration.doAutoCreate())
2312          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory()); // bb
2313      return this.status;
2314    }
2315
2316    public boolean hasStatusElement() { 
2317      return this.status != null && !this.status.isEmpty();
2318    }
2319
2320    public boolean hasStatus() { 
2321      return this.status != null && !this.status.isEmpty();
2322    }
2323
2324    /**
2325     * @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
2326     */
2327    public Task setStatusElement(Enumeration<TaskStatus> value) { 
2328      this.status = value;
2329      return this;
2330    }
2331
2332    /**
2333     * @return The current status of the task.
2334     */
2335    public TaskStatus getStatus() { 
2336      return this.status == null ? null : this.status.getValue();
2337    }
2338
2339    /**
2340     * @param value The current status of the task.
2341     */
2342    public Task setStatus(TaskStatus value) { 
2343        if (this.status == null)
2344          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory());
2345        this.status.setValue(value);
2346      return this;
2347    }
2348
2349    /**
2350     * @return {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2351     */
2352    public CodeableConcept getStatusReason() { 
2353      if (this.statusReason == null)
2354        if (Configuration.errorOnAutoCreate())
2355          throw new Error("Attempt to auto-create Task.statusReason");
2356        else if (Configuration.doAutoCreate())
2357          this.statusReason = new CodeableConcept(); // cc
2358      return this.statusReason;
2359    }
2360
2361    public boolean hasStatusReason() { 
2362      return this.statusReason != null && !this.statusReason.isEmpty();
2363    }
2364
2365    /**
2366     * @param value {@link #statusReason} (An explanation as to why this task is held, failed, was refused, etc.)
2367     */
2368    public Task setStatusReason(CodeableConcept value) { 
2369      this.statusReason = value;
2370      return this;
2371    }
2372
2373    /**
2374     * @return {@link #businessStatus} (Contains business-specific nuances of the business state.)
2375     */
2376    public CodeableConcept getBusinessStatus() { 
2377      if (this.businessStatus == null)
2378        if (Configuration.errorOnAutoCreate())
2379          throw new Error("Attempt to auto-create Task.businessStatus");
2380        else if (Configuration.doAutoCreate())
2381          this.businessStatus = new CodeableConcept(); // cc
2382      return this.businessStatus;
2383    }
2384
2385    public boolean hasBusinessStatus() { 
2386      return this.businessStatus != null && !this.businessStatus.isEmpty();
2387    }
2388
2389    /**
2390     * @param value {@link #businessStatus} (Contains business-specific nuances of the business state.)
2391     */
2392    public Task setBusinessStatus(CodeableConcept value) { 
2393      this.businessStatus = value;
2394      return this;
2395    }
2396
2397    /**
2398     * @return {@link #intent} (Indicates the "level" of actionability associated with the Task.  I.e. Is 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
2399     */
2400    public Enumeration<TaskIntent> getIntentElement() { 
2401      if (this.intent == null)
2402        if (Configuration.errorOnAutoCreate())
2403          throw new Error("Attempt to auto-create Task.intent");
2404        else if (Configuration.doAutoCreate())
2405          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory()); // bb
2406      return this.intent;
2407    }
2408
2409    public boolean hasIntentElement() { 
2410      return this.intent != null && !this.intent.isEmpty();
2411    }
2412
2413    public boolean hasIntent() { 
2414      return this.intent != null && !this.intent.isEmpty();
2415    }
2416
2417    /**
2418     * @param value {@link #intent} (Indicates the "level" of actionability associated with the Task.  I.e. Is 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
2419     */
2420    public Task setIntentElement(Enumeration<TaskIntent> value) { 
2421      this.intent = value;
2422      return this;
2423    }
2424
2425    /**
2426     * @return Indicates the "level" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc.
2427     */
2428    public TaskIntent getIntent() { 
2429      return this.intent == null ? null : this.intent.getValue();
2430    }
2431
2432    /**
2433     * @param value Indicates the "level" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc.
2434     */
2435    public Task setIntent(TaskIntent value) { 
2436        if (this.intent == null)
2437          this.intent = new Enumeration<TaskIntent>(new TaskIntentEnumFactory());
2438        this.intent.setValue(value);
2439      return this;
2440    }
2441
2442    /**
2443     * @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
2444     */
2445    public Enumeration<TaskPriority> getPriorityElement() { 
2446      if (this.priority == null)
2447        if (Configuration.errorOnAutoCreate())
2448          throw new Error("Attempt to auto-create Task.priority");
2449        else if (Configuration.doAutoCreate())
2450          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory()); // bb
2451      return this.priority;
2452    }
2453
2454    public boolean hasPriorityElement() { 
2455      return this.priority != null && !this.priority.isEmpty();
2456    }
2457
2458    public boolean hasPriority() { 
2459      return this.priority != null && !this.priority.isEmpty();
2460    }
2461
2462    /**
2463     * @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
2464     */
2465    public Task setPriorityElement(Enumeration<TaskPriority> value) { 
2466      this.priority = value;
2467      return this;
2468    }
2469
2470    /**
2471     * @return Indicates how quickly the Task should be addressed with respect to other requests.
2472     */
2473    public TaskPriority getPriority() { 
2474      return this.priority == null ? null : this.priority.getValue();
2475    }
2476
2477    /**
2478     * @param value Indicates how quickly the Task should be addressed with respect to other requests.
2479     */
2480    public Task setPriority(TaskPriority value) { 
2481      if (value == null)
2482        this.priority = null;
2483      else {
2484        if (this.priority == null)
2485          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory());
2486        this.priority.setValue(value);
2487      }
2488      return this;
2489    }
2490
2491    /**
2492     * @return {@link #code} (A name or code (or both) briefly describing what the task involves.)
2493     */
2494    public CodeableConcept getCode() { 
2495      if (this.code == null)
2496        if (Configuration.errorOnAutoCreate())
2497          throw new Error("Attempt to auto-create Task.code");
2498        else if (Configuration.doAutoCreate())
2499          this.code = new CodeableConcept(); // cc
2500      return this.code;
2501    }
2502
2503    public boolean hasCode() { 
2504      return this.code != null && !this.code.isEmpty();
2505    }
2506
2507    /**
2508     * @param value {@link #code} (A name or code (or both) briefly describing what the task involves.)
2509     */
2510    public Task setCode(CodeableConcept value) { 
2511      this.code = value;
2512      return this;
2513    }
2514
2515    /**
2516     * @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
2517     */
2518    public StringType getDescriptionElement() { 
2519      if (this.description == null)
2520        if (Configuration.errorOnAutoCreate())
2521          throw new Error("Attempt to auto-create Task.description");
2522        else if (Configuration.doAutoCreate())
2523          this.description = new StringType(); // bb
2524      return this.description;
2525    }
2526
2527    public boolean hasDescriptionElement() { 
2528      return this.description != null && !this.description.isEmpty();
2529    }
2530
2531    public boolean hasDescription() { 
2532      return this.description != null && !this.description.isEmpty();
2533    }
2534
2535    /**
2536     * @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
2537     */
2538    public Task setDescriptionElement(StringType value) { 
2539      this.description = value;
2540      return this;
2541    }
2542
2543    /**
2544     * @return A free-text description of what is to be performed.
2545     */
2546    public String getDescription() { 
2547      return this.description == null ? null : this.description.getValue();
2548    }
2549
2550    /**
2551     * @param value A free-text description of what is to be performed.
2552     */
2553    public Task setDescription(String value) { 
2554      if (Utilities.noString(value))
2555        this.description = null;
2556      else {
2557        if (this.description == null)
2558          this.description = new StringType();
2559        this.description.setValue(value);
2560      }
2561      return this;
2562    }
2563
2564    /**
2565     * @return {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2566     */
2567    public Reference getFocus() { 
2568      if (this.focus == null)
2569        if (Configuration.errorOnAutoCreate())
2570          throw new Error("Attempt to auto-create Task.focus");
2571        else if (Configuration.doAutoCreate())
2572          this.focus = new Reference(); // cc
2573      return this.focus;
2574    }
2575
2576    public boolean hasFocus() { 
2577      return this.focus != null && !this.focus.isEmpty();
2578    }
2579
2580    /**
2581     * @param value {@link #focus} (The request being actioned or the resource being manipulated by this task.)
2582     */
2583    public Task setFocus(Reference value) { 
2584      this.focus = value;
2585      return this;
2586    }
2587
2588    /**
2589     * @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.)
2590     */
2591    public Resource getFocusTarget() { 
2592      return this.focusTarget;
2593    }
2594
2595    /**
2596     * @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.)
2597     */
2598    public Task setFocusTarget(Resource value) { 
2599      this.focusTarget = value;
2600      return this;
2601    }
2602
2603    /**
2604     * @return {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2605     */
2606    public Reference getFor() { 
2607      if (this.for_ == null)
2608        if (Configuration.errorOnAutoCreate())
2609          throw new Error("Attempt to auto-create Task.for_");
2610        else if (Configuration.doAutoCreate())
2611          this.for_ = new Reference(); // cc
2612      return this.for_;
2613    }
2614
2615    public boolean hasFor() { 
2616      return this.for_ != null && !this.for_.isEmpty();
2617    }
2618
2619    /**
2620     * @param value {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
2621     */
2622    public Task setFor(Reference value) { 
2623      this.for_ = value;
2624      return this;
2625    }
2626
2627    /**
2628     * @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).)
2629     */
2630    public Resource getForTarget() { 
2631      return this.for_Target;
2632    }
2633
2634    /**
2635     * @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).)
2636     */
2637    public Task setForTarget(Resource value) { 
2638      this.for_Target = value;
2639      return this;
2640    }
2641
2642    /**
2643     * @return {@link #context} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2644     */
2645    public Reference getContext() { 
2646      if (this.context == null)
2647        if (Configuration.errorOnAutoCreate())
2648          throw new Error("Attempt to auto-create Task.context");
2649        else if (Configuration.doAutoCreate())
2650          this.context = new Reference(); // cc
2651      return this.context;
2652    }
2653
2654    public boolean hasContext() { 
2655      return this.context != null && !this.context.isEmpty();
2656    }
2657
2658    /**
2659     * @param value {@link #context} (The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.)
2660     */
2661    public Task setContext(Reference value) { 
2662      this.context = value;
2663      return this;
2664    }
2665
2666    /**
2667     * @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.)
2668     */
2669    public Resource getContextTarget() { 
2670      return this.contextTarget;
2671    }
2672
2673    /**
2674     * @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.)
2675     */
2676    public Task setContextTarget(Resource value) { 
2677      this.contextTarget = value;
2678      return this;
2679    }
2680
2681    /**
2682     * @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).)
2683     */
2684    public Period getExecutionPeriod() { 
2685      if (this.executionPeriod == null)
2686        if (Configuration.errorOnAutoCreate())
2687          throw new Error("Attempt to auto-create Task.executionPeriod");
2688        else if (Configuration.doAutoCreate())
2689          this.executionPeriod = new Period(); // cc
2690      return this.executionPeriod;
2691    }
2692
2693    public boolean hasExecutionPeriod() { 
2694      return this.executionPeriod != null && !this.executionPeriod.isEmpty();
2695    }
2696
2697    /**
2698     * @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).)
2699     */
2700    public Task setExecutionPeriod(Period value) { 
2701      this.executionPeriod = value;
2702      return this;
2703    }
2704
2705    /**
2706     * @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
2707     */
2708    public DateTimeType getAuthoredOnElement() { 
2709      if (this.authoredOn == null)
2710        if (Configuration.errorOnAutoCreate())
2711          throw new Error("Attempt to auto-create Task.authoredOn");
2712        else if (Configuration.doAutoCreate())
2713          this.authoredOn = new DateTimeType(); // bb
2714      return this.authoredOn;
2715    }
2716
2717    public boolean hasAuthoredOnElement() { 
2718      return this.authoredOn != null && !this.authoredOn.isEmpty();
2719    }
2720
2721    public boolean hasAuthoredOn() { 
2722      return this.authoredOn != null && !this.authoredOn.isEmpty();
2723    }
2724
2725    /**
2726     * @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
2727     */
2728    public Task setAuthoredOnElement(DateTimeType value) { 
2729      this.authoredOn = value;
2730      return this;
2731    }
2732
2733    /**
2734     * @return The date and time this task was created.
2735     */
2736    public Date getAuthoredOn() { 
2737      return this.authoredOn == null ? null : this.authoredOn.getValue();
2738    }
2739
2740    /**
2741     * @param value The date and time this task was created.
2742     */
2743    public Task setAuthoredOn(Date value) { 
2744      if (value == null)
2745        this.authoredOn = null;
2746      else {
2747        if (this.authoredOn == null)
2748          this.authoredOn = new DateTimeType();
2749        this.authoredOn.setValue(value);
2750      }
2751      return this;
2752    }
2753
2754    /**
2755     * @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
2756     */
2757    public DateTimeType getLastModifiedElement() { 
2758      if (this.lastModified == null)
2759        if (Configuration.errorOnAutoCreate())
2760          throw new Error("Attempt to auto-create Task.lastModified");
2761        else if (Configuration.doAutoCreate())
2762          this.lastModified = new DateTimeType(); // bb
2763      return this.lastModified;
2764    }
2765
2766    public boolean hasLastModifiedElement() { 
2767      return this.lastModified != null && !this.lastModified.isEmpty();
2768    }
2769
2770    public boolean hasLastModified() { 
2771      return this.lastModified != null && !this.lastModified.isEmpty();
2772    }
2773
2774    /**
2775     * @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
2776     */
2777    public Task setLastModifiedElement(DateTimeType value) { 
2778      this.lastModified = value;
2779      return this;
2780    }
2781
2782    /**
2783     * @return The date and time of last modification to this task.
2784     */
2785    public Date getLastModified() { 
2786      return this.lastModified == null ? null : this.lastModified.getValue();
2787    }
2788
2789    /**
2790     * @param value The date and time of last modification to this task.
2791     */
2792    public Task setLastModified(Date value) { 
2793      if (value == null)
2794        this.lastModified = null;
2795      else {
2796        if (this.lastModified == null)
2797          this.lastModified = new DateTimeType();
2798        this.lastModified.setValue(value);
2799      }
2800      return this;
2801    }
2802
2803    /**
2804     * @return {@link #requester} (The creator of the task.)
2805     */
2806    public TaskRequesterComponent getRequester() { 
2807      if (this.requester == null)
2808        if (Configuration.errorOnAutoCreate())
2809          throw new Error("Attempt to auto-create Task.requester");
2810        else if (Configuration.doAutoCreate())
2811          this.requester = new TaskRequesterComponent(); // cc
2812      return this.requester;
2813    }
2814
2815    public boolean hasRequester() { 
2816      return this.requester != null && !this.requester.isEmpty();
2817    }
2818
2819    /**
2820     * @param value {@link #requester} (The creator of the task.)
2821     */
2822    public Task setRequester(TaskRequesterComponent value) { 
2823      this.requester = value;
2824      return this;
2825    }
2826
2827    /**
2828     * @return {@link #performerType} (The type of participant that can execute the task.)
2829     */
2830    public List<CodeableConcept> getPerformerType() { 
2831      if (this.performerType == null)
2832        this.performerType = new ArrayList<CodeableConcept>();
2833      return this.performerType;
2834    }
2835
2836    /**
2837     * @return Returns a reference to <code>this</code> for easy method chaining
2838     */
2839    public Task setPerformerType(List<CodeableConcept> thePerformerType) { 
2840      this.performerType = thePerformerType;
2841      return this;
2842    }
2843
2844    public boolean hasPerformerType() { 
2845      if (this.performerType == null)
2846        return false;
2847      for (CodeableConcept item : this.performerType)
2848        if (!item.isEmpty())
2849          return true;
2850      return false;
2851    }
2852
2853    public CodeableConcept addPerformerType() { //3
2854      CodeableConcept t = new CodeableConcept();
2855      if (this.performerType == null)
2856        this.performerType = new ArrayList<CodeableConcept>();
2857      this.performerType.add(t);
2858      return t;
2859    }
2860
2861    public Task addPerformerType(CodeableConcept t) { //3
2862      if (t == null)
2863        return this;
2864      if (this.performerType == null)
2865        this.performerType = new ArrayList<CodeableConcept>();
2866      this.performerType.add(t);
2867      return this;
2868    }
2869
2870    /**
2871     * @return The first repetition of repeating field {@link #performerType}, creating it if it does not already exist
2872     */
2873    public CodeableConcept getPerformerTypeFirstRep() { 
2874      if (getPerformerType().isEmpty()) {
2875        addPerformerType();
2876      }
2877      return getPerformerType().get(0);
2878    }
2879
2880    /**
2881     * @return {@link #owner} (Individual organization or Device currently responsible for task execution.)
2882     */
2883    public Reference getOwner() { 
2884      if (this.owner == null)
2885        if (Configuration.errorOnAutoCreate())
2886          throw new Error("Attempt to auto-create Task.owner");
2887        else if (Configuration.doAutoCreate())
2888          this.owner = new Reference(); // cc
2889      return this.owner;
2890    }
2891
2892    public boolean hasOwner() { 
2893      return this.owner != null && !this.owner.isEmpty();
2894    }
2895
2896    /**
2897     * @param value {@link #owner} (Individual organization or Device currently responsible for task execution.)
2898     */
2899    public Task setOwner(Reference value) { 
2900      this.owner = value;
2901      return this;
2902    }
2903
2904    /**
2905     * @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.)
2906     */
2907    public Resource getOwnerTarget() { 
2908      return this.ownerTarget;
2909    }
2910
2911    /**
2912     * @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.)
2913     */
2914    public Task setOwnerTarget(Resource value) { 
2915      this.ownerTarget = value;
2916      return this;
2917    }
2918
2919    /**
2920     * @return {@link #reason} (A description or code indicating why this task needs to be performed.)
2921     */
2922    public CodeableConcept getReason() { 
2923      if (this.reason == null)
2924        if (Configuration.errorOnAutoCreate())
2925          throw new Error("Attempt to auto-create Task.reason");
2926        else if (Configuration.doAutoCreate())
2927          this.reason = new CodeableConcept(); // cc
2928      return this.reason;
2929    }
2930
2931    public boolean hasReason() { 
2932      return this.reason != null && !this.reason.isEmpty();
2933    }
2934
2935    /**
2936     * @param value {@link #reason} (A description or code indicating why this task needs to be performed.)
2937     */
2938    public Task setReason(CodeableConcept value) { 
2939      this.reason = value;
2940      return this;
2941    }
2942
2943    /**
2944     * @return {@link #note} (Free-text information captured about the task as it progresses.)
2945     */
2946    public List<Annotation> getNote() { 
2947      if (this.note == null)
2948        this.note = new ArrayList<Annotation>();
2949      return this.note;
2950    }
2951
2952    /**
2953     * @return Returns a reference to <code>this</code> for easy method chaining
2954     */
2955    public Task setNote(List<Annotation> theNote) { 
2956      this.note = theNote;
2957      return this;
2958    }
2959
2960    public boolean hasNote() { 
2961      if (this.note == null)
2962        return false;
2963      for (Annotation item : this.note)
2964        if (!item.isEmpty())
2965          return true;
2966      return false;
2967    }
2968
2969    public Annotation addNote() { //3
2970      Annotation t = new Annotation();
2971      if (this.note == null)
2972        this.note = new ArrayList<Annotation>();
2973      this.note.add(t);
2974      return t;
2975    }
2976
2977    public Task addNote(Annotation t) { //3
2978      if (t == null)
2979        return this;
2980      if (this.note == null)
2981        this.note = new ArrayList<Annotation>();
2982      this.note.add(t);
2983      return this;
2984    }
2985
2986    /**
2987     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
2988     */
2989    public Annotation getNoteFirstRep() { 
2990      if (getNote().isEmpty()) {
2991        addNote();
2992      }
2993      return getNote().get(0);
2994    }
2995
2996    /**
2997     * @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.)
2998     */
2999    public List<Reference> getRelevantHistory() { 
3000      if (this.relevantHistory == null)
3001        this.relevantHistory = new ArrayList<Reference>();
3002      return this.relevantHistory;
3003    }
3004
3005    /**
3006     * @return Returns a reference to <code>this</code> for easy method chaining
3007     */
3008    public Task setRelevantHistory(List<Reference> theRelevantHistory) { 
3009      this.relevantHistory = theRelevantHistory;
3010      return this;
3011    }
3012
3013    public boolean hasRelevantHistory() { 
3014      if (this.relevantHistory == null)
3015        return false;
3016      for (Reference item : this.relevantHistory)
3017        if (!item.isEmpty())
3018          return true;
3019      return false;
3020    }
3021
3022    public Reference addRelevantHistory() { //3
3023      Reference t = new Reference();
3024      if (this.relevantHistory == null)
3025        this.relevantHistory = new ArrayList<Reference>();
3026      this.relevantHistory.add(t);
3027      return t;
3028    }
3029
3030    public Task addRelevantHistory(Reference t) { //3
3031      if (t == null)
3032        return this;
3033      if (this.relevantHistory == null)
3034        this.relevantHistory = new ArrayList<Reference>();
3035      this.relevantHistory.add(t);
3036      return this;
3037    }
3038
3039    /**
3040     * @return The first repetition of repeating field {@link #relevantHistory}, creating it if it does not already exist
3041     */
3042    public Reference getRelevantHistoryFirstRep() { 
3043      if (getRelevantHistory().isEmpty()) {
3044        addRelevantHistory();
3045      }
3046      return getRelevantHistory().get(0);
3047    }
3048
3049    /**
3050     * @deprecated Use Reference#setResource(IBaseResource) instead
3051     */
3052    @Deprecated
3053    public List<Provenance> getRelevantHistoryTarget() { 
3054      if (this.relevantHistoryTarget == null)
3055        this.relevantHistoryTarget = new ArrayList<Provenance>();
3056      return this.relevantHistoryTarget;
3057    }
3058
3059    /**
3060     * @deprecated Use Reference#setResource(IBaseResource) instead
3061     */
3062    @Deprecated
3063    public Provenance addRelevantHistoryTarget() { 
3064      Provenance r = new Provenance();
3065      if (this.relevantHistoryTarget == null)
3066        this.relevantHistoryTarget = new ArrayList<Provenance>();
3067      this.relevantHistoryTarget.add(r);
3068      return r;
3069    }
3070
3071    /**
3072     * @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.)
3073     */
3074    public TaskRestrictionComponent getRestriction() { 
3075      if (this.restriction == null)
3076        if (Configuration.errorOnAutoCreate())
3077          throw new Error("Attempt to auto-create Task.restriction");
3078        else if (Configuration.doAutoCreate())
3079          this.restriction = new TaskRestrictionComponent(); // cc
3080      return this.restriction;
3081    }
3082
3083    public boolean hasRestriction() { 
3084      return this.restriction != null && !this.restriction.isEmpty();
3085    }
3086
3087    /**
3088     * @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.)
3089     */
3090    public Task setRestriction(TaskRestrictionComponent value) { 
3091      this.restriction = value;
3092      return this;
3093    }
3094
3095    /**
3096     * @return {@link #input} (Additional information that may be needed in the execution of the task.)
3097     */
3098    public List<ParameterComponent> getInput() { 
3099      if (this.input == null)
3100        this.input = new ArrayList<ParameterComponent>();
3101      return this.input;
3102    }
3103
3104    /**
3105     * @return Returns a reference to <code>this</code> for easy method chaining
3106     */
3107    public Task setInput(List<ParameterComponent> theInput) { 
3108      this.input = theInput;
3109      return this;
3110    }
3111
3112    public boolean hasInput() { 
3113      if (this.input == null)
3114        return false;
3115      for (ParameterComponent item : this.input)
3116        if (!item.isEmpty())
3117          return true;
3118      return false;
3119    }
3120
3121    public ParameterComponent addInput() { //3
3122      ParameterComponent t = new ParameterComponent();
3123      if (this.input == null)
3124        this.input = new ArrayList<ParameterComponent>();
3125      this.input.add(t);
3126      return t;
3127    }
3128
3129    public Task addInput(ParameterComponent t) { //3
3130      if (t == null)
3131        return this;
3132      if (this.input == null)
3133        this.input = new ArrayList<ParameterComponent>();
3134      this.input.add(t);
3135      return this;
3136    }
3137
3138    /**
3139     * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
3140     */
3141    public ParameterComponent getInputFirstRep() { 
3142      if (getInput().isEmpty()) {
3143        addInput();
3144      }
3145      return getInput().get(0);
3146    }
3147
3148    /**
3149     * @return {@link #output} (Outputs produced by the Task.)
3150     */
3151    public List<TaskOutputComponent> getOutput() { 
3152      if (this.output == null)
3153        this.output = new ArrayList<TaskOutputComponent>();
3154      return this.output;
3155    }
3156
3157    /**
3158     * @return Returns a reference to <code>this</code> for easy method chaining
3159     */
3160    public Task setOutput(List<TaskOutputComponent> theOutput) { 
3161      this.output = theOutput;
3162      return this;
3163    }
3164
3165    public boolean hasOutput() { 
3166      if (this.output == null)
3167        return false;
3168      for (TaskOutputComponent item : this.output)
3169        if (!item.isEmpty())
3170          return true;
3171      return false;
3172    }
3173
3174    public TaskOutputComponent addOutput() { //3
3175      TaskOutputComponent t = new TaskOutputComponent();
3176      if (this.output == null)
3177        this.output = new ArrayList<TaskOutputComponent>();
3178      this.output.add(t);
3179      return t;
3180    }
3181
3182    public Task addOutput(TaskOutputComponent t) { //3
3183      if (t == null)
3184        return this;
3185      if (this.output == null)
3186        this.output = new ArrayList<TaskOutputComponent>();
3187      this.output.add(t);
3188      return this;
3189    }
3190
3191    /**
3192     * @return The first repetition of repeating field {@link #output}, creating it if it does not already exist
3193     */
3194    public TaskOutputComponent getOutputFirstRep() { 
3195      if (getOutput().isEmpty()) {
3196        addOutput();
3197      }
3198      return getOutput().get(0);
3199    }
3200
3201      protected void listChildren(List<Property> childrenList) {
3202        super.listChildren(childrenList);
3203        childrenList.add(new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier));
3204        childrenList.add(new Property("definition[x]", "uri|Reference(ActivityDefinition)", "A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.", 0, java.lang.Integer.MAX_VALUE, definition));
3205        childrenList.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 ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the \"request\" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient.", 0, java.lang.Integer.MAX_VALUE, basedOn));
3206        childrenList.add(new Property("groupIdentifier", "Identifier", "An identifier that links together multiple tasks and other requests that were created in the same context.", 0, java.lang.Integer.MAX_VALUE, groupIdentifier));
3207        childrenList.add(new Property("partOf", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, partOf));
3208        childrenList.add(new Property("status", "code", "The current status of the task.", 0, java.lang.Integer.MAX_VALUE, status));
3209        childrenList.add(new Property("statusReason", "CodeableConcept", "An explanation as to why this task is held, failed, was refused, etc.", 0, java.lang.Integer.MAX_VALUE, statusReason));
3210        childrenList.add(new Property("businessStatus", "CodeableConcept", "Contains business-specific nuances of the business state.", 0, java.lang.Integer.MAX_VALUE, businessStatus));
3211        childrenList.add(new Property("intent", "code", "Indicates the \"level\" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc.", 0, java.lang.Integer.MAX_VALUE, intent));
3212        childrenList.add(new Property("priority", "code", "Indicates how quickly the Task should be addressed with respect to other requests.", 0, java.lang.Integer.MAX_VALUE, priority));
3213        childrenList.add(new Property("code", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, java.lang.Integer.MAX_VALUE, code));
3214        childrenList.add(new Property("description", "string", "A free-text description of what is to be performed.", 0, java.lang.Integer.MAX_VALUE, description));
3215        childrenList.add(new Property("focus", "Reference(Any)", "The request being actioned or the resource being manipulated by this task.", 0, java.lang.Integer.MAX_VALUE, focus));
3216        childrenList.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, java.lang.Integer.MAX_VALUE, for_));
3217        childrenList.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, java.lang.Integer.MAX_VALUE, context));
3218        childrenList.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, java.lang.Integer.MAX_VALUE, executionPeriod));
3219        childrenList.add(new Property("authoredOn", "dateTime", "The date and time this task was created.", 0, java.lang.Integer.MAX_VALUE, authoredOn));
3220        childrenList.add(new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, java.lang.Integer.MAX_VALUE, lastModified));
3221        childrenList.add(new Property("requester", "", "The creator of the task.", 0, java.lang.Integer.MAX_VALUE, requester));
3222        childrenList.add(new Property("performerType", "CodeableConcept", "The type of participant that can execute the task.", 0, java.lang.Integer.MAX_VALUE, performerType));
3223        childrenList.add(new Property("owner", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "Individual organization or Device currently responsible for task execution.", 0, java.lang.Integer.MAX_VALUE, owner));
3224        childrenList.add(new Property("reason", "CodeableConcept", "A description or code indicating why this task needs to be performed.", 0, java.lang.Integer.MAX_VALUE, reason));
3225        childrenList.add(new Property("note", "Annotation", "Free-text information captured about the task as it progresses.", 0, java.lang.Integer.MAX_VALUE, note));
3226        childrenList.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));
3227        childrenList.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, java.lang.Integer.MAX_VALUE, restriction));
3228        childrenList.add(new Property("input", "", "Additional information that may be needed in the execution of the task.", 0, java.lang.Integer.MAX_VALUE, input));
3229        childrenList.add(new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output));
3230      }
3231
3232      @Override
3233      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3234        switch (hash) {
3235        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3236        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // Type
3237        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3238        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
3239        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
3240        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<TaskStatus>
3241        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
3242        case 2008591314: /*businessStatus*/ return this.businessStatus == null ? new Base[0] : new Base[] {this.businessStatus}; // CodeableConcept
3243        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<TaskIntent>
3244        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<TaskPriority>
3245        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3246        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3247        case 97604824: /*focus*/ return this.focus == null ? new Base[0] : new Base[] {this.focus}; // Reference
3248        case 101577: /*for*/ return this.for_ == null ? new Base[0] : new Base[] {this.for_}; // Reference
3249        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
3250        case 1218624249: /*executionPeriod*/ return this.executionPeriod == null ? new Base[0] : new Base[] {this.executionPeriod}; // Period
3251        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
3252        case 1959003007: /*lastModified*/ return this.lastModified == null ? new Base[0] : new Base[] {this.lastModified}; // DateTimeType
3253        case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // TaskRequesterComponent
3254        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // CodeableConcept
3255        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
3256        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
3257        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3258        case 1538891575: /*relevantHistory*/ return this.relevantHistory == null ? new Base[0] : this.relevantHistory.toArray(new Base[this.relevantHistory.size()]); // Reference
3259        case -1561062452: /*restriction*/ return this.restriction == null ? new Base[0] : new Base[] {this.restriction}; // TaskRestrictionComponent
3260        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // ParameterComponent
3261        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // TaskOutputComponent
3262        default: return super.getProperty(hash, name, checkValid);
3263        }
3264
3265      }
3266
3267      @Override
3268      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3269        switch (hash) {
3270        case -1618432855: // identifier
3271          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3272          return value;
3273        case -1014418093: // definition
3274          this.definition = castToType(value); // Type
3275          return value;
3276        case -332612366: // basedOn
3277          this.getBasedOn().add(castToReference(value)); // Reference
3278          return value;
3279        case -445338488: // groupIdentifier
3280          this.groupIdentifier = castToIdentifier(value); // Identifier
3281          return value;
3282        case -995410646: // partOf
3283          this.getPartOf().add(castToReference(value)); // Reference
3284          return value;
3285        case -892481550: // status
3286          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3287          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3288          return value;
3289        case 2051346646: // statusReason
3290          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3291          return value;
3292        case 2008591314: // businessStatus
3293          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3294          return value;
3295        case -1183762788: // intent
3296          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3297          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3298          return value;
3299        case -1165461084: // priority
3300          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3301          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3302          return value;
3303        case 3059181: // code
3304          this.code = castToCodeableConcept(value); // CodeableConcept
3305          return value;
3306        case -1724546052: // description
3307          this.description = castToString(value); // StringType
3308          return value;
3309        case 97604824: // focus
3310          this.focus = castToReference(value); // Reference
3311          return value;
3312        case 101577: // for
3313          this.for_ = castToReference(value); // Reference
3314          return value;
3315        case 951530927: // context
3316          this.context = castToReference(value); // Reference
3317          return value;
3318        case 1218624249: // executionPeriod
3319          this.executionPeriod = castToPeriod(value); // Period
3320          return value;
3321        case -1500852503: // authoredOn
3322          this.authoredOn = castToDateTime(value); // DateTimeType
3323          return value;
3324        case 1959003007: // lastModified
3325          this.lastModified = castToDateTime(value); // DateTimeType
3326          return value;
3327        case 693933948: // requester
3328          this.requester = (TaskRequesterComponent) value; // TaskRequesterComponent
3329          return value;
3330        case -901444568: // performerType
3331          this.getPerformerType().add(castToCodeableConcept(value)); // CodeableConcept
3332          return value;
3333        case 106164915: // owner
3334          this.owner = castToReference(value); // Reference
3335          return value;
3336        case -934964668: // reason
3337          this.reason = castToCodeableConcept(value); // CodeableConcept
3338          return value;
3339        case 3387378: // note
3340          this.getNote().add(castToAnnotation(value)); // Annotation
3341          return value;
3342        case 1538891575: // relevantHistory
3343          this.getRelevantHistory().add(castToReference(value)); // Reference
3344          return value;
3345        case -1561062452: // restriction
3346          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3347          return value;
3348        case 100358090: // input
3349          this.getInput().add((ParameterComponent) value); // ParameterComponent
3350          return value;
3351        case -1005512447: // output
3352          this.getOutput().add((TaskOutputComponent) value); // TaskOutputComponent
3353          return value;
3354        default: return super.setProperty(hash, name, value);
3355        }
3356
3357      }
3358
3359      @Override
3360      public Base setProperty(String name, Base value) throws FHIRException {
3361        if (name.equals("identifier")) {
3362          this.getIdentifier().add(castToIdentifier(value));
3363        } else if (name.equals("definition[x]")) {
3364          this.definition = castToType(value); // Type
3365        } else if (name.equals("basedOn")) {
3366          this.getBasedOn().add(castToReference(value));
3367        } else if (name.equals("groupIdentifier")) {
3368          this.groupIdentifier = castToIdentifier(value); // Identifier
3369        } else if (name.equals("partOf")) {
3370          this.getPartOf().add(castToReference(value));
3371        } else if (name.equals("status")) {
3372          value = new TaskStatusEnumFactory().fromType(castToCode(value));
3373          this.status = (Enumeration) value; // Enumeration<TaskStatus>
3374        } else if (name.equals("statusReason")) {
3375          this.statusReason = castToCodeableConcept(value); // CodeableConcept
3376        } else if (name.equals("businessStatus")) {
3377          this.businessStatus = castToCodeableConcept(value); // CodeableConcept
3378        } else if (name.equals("intent")) {
3379          value = new TaskIntentEnumFactory().fromType(castToCode(value));
3380          this.intent = (Enumeration) value; // Enumeration<TaskIntent>
3381        } else if (name.equals("priority")) {
3382          value = new TaskPriorityEnumFactory().fromType(castToCode(value));
3383          this.priority = (Enumeration) value; // Enumeration<TaskPriority>
3384        } else if (name.equals("code")) {
3385          this.code = castToCodeableConcept(value); // CodeableConcept
3386        } else if (name.equals("description")) {
3387          this.description = castToString(value); // StringType
3388        } else if (name.equals("focus")) {
3389          this.focus = castToReference(value); // Reference
3390        } else if (name.equals("for")) {
3391          this.for_ = castToReference(value); // Reference
3392        } else if (name.equals("context")) {
3393          this.context = castToReference(value); // Reference
3394        } else if (name.equals("executionPeriod")) {
3395          this.executionPeriod = castToPeriod(value); // Period
3396        } else if (name.equals("authoredOn")) {
3397          this.authoredOn = castToDateTime(value); // DateTimeType
3398        } else if (name.equals("lastModified")) {
3399          this.lastModified = castToDateTime(value); // DateTimeType
3400        } else if (name.equals("requester")) {
3401          this.requester = (TaskRequesterComponent) value; // TaskRequesterComponent
3402        } else if (name.equals("performerType")) {
3403          this.getPerformerType().add(castToCodeableConcept(value));
3404        } else if (name.equals("owner")) {
3405          this.owner = castToReference(value); // Reference
3406        } else if (name.equals("reason")) {
3407          this.reason = castToCodeableConcept(value); // CodeableConcept
3408        } else if (name.equals("note")) {
3409          this.getNote().add(castToAnnotation(value));
3410        } else if (name.equals("relevantHistory")) {
3411          this.getRelevantHistory().add(castToReference(value));
3412        } else if (name.equals("restriction")) {
3413          this.restriction = (TaskRestrictionComponent) value; // TaskRestrictionComponent
3414        } else if (name.equals("input")) {
3415          this.getInput().add((ParameterComponent) value);
3416        } else if (name.equals("output")) {
3417          this.getOutput().add((TaskOutputComponent) value);
3418        } else
3419          return super.setProperty(name, value);
3420        return value;
3421      }
3422
3423      @Override
3424      public Base makeProperty(int hash, String name) throws FHIRException {
3425        switch (hash) {
3426        case -1618432855:  return addIdentifier(); 
3427        case -1139422643:  return getDefinition(); 
3428        case -1014418093:  return getDefinition(); 
3429        case -332612366:  return addBasedOn(); 
3430        case -445338488:  return getGroupIdentifier(); 
3431        case -995410646:  return addPartOf(); 
3432        case -892481550:  return getStatusElement();
3433        case 2051346646:  return getStatusReason(); 
3434        case 2008591314:  return getBusinessStatus(); 
3435        case -1183762788:  return getIntentElement();
3436        case -1165461084:  return getPriorityElement();
3437        case 3059181:  return getCode(); 
3438        case -1724546052:  return getDescriptionElement();
3439        case 97604824:  return getFocus(); 
3440        case 101577:  return getFor(); 
3441        case 951530927:  return getContext(); 
3442        case 1218624249:  return getExecutionPeriod(); 
3443        case -1500852503:  return getAuthoredOnElement();
3444        case 1959003007:  return getLastModifiedElement();
3445        case 693933948:  return getRequester(); 
3446        case -901444568:  return addPerformerType(); 
3447        case 106164915:  return getOwner(); 
3448        case -934964668:  return getReason(); 
3449        case 3387378:  return addNote(); 
3450        case 1538891575:  return addRelevantHistory(); 
3451        case -1561062452:  return getRestriction(); 
3452        case 100358090:  return addInput(); 
3453        case -1005512447:  return addOutput(); 
3454        default: return super.makeProperty(hash, name);
3455        }
3456
3457      }
3458
3459      @Override
3460      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3461        switch (hash) {
3462        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3463        case -1014418093: /*definition*/ return new String[] {"uri", "Reference"};
3464        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3465        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
3466        case -995410646: /*partOf*/ return new String[] {"Reference"};
3467        case -892481550: /*status*/ return new String[] {"code"};
3468        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3469        case 2008591314: /*businessStatus*/ return new String[] {"CodeableConcept"};
3470        case -1183762788: /*intent*/ return new String[] {"code"};
3471        case -1165461084: /*priority*/ return new String[] {"code"};
3472        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3473        case -1724546052: /*description*/ return new String[] {"string"};
3474        case 97604824: /*focus*/ return new String[] {"Reference"};
3475        case 101577: /*for*/ return new String[] {"Reference"};
3476        case 951530927: /*context*/ return new String[] {"Reference"};
3477        case 1218624249: /*executionPeriod*/ return new String[] {"Period"};
3478        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
3479        case 1959003007: /*lastModified*/ return new String[] {"dateTime"};
3480        case 693933948: /*requester*/ return new String[] {};
3481        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
3482        case 106164915: /*owner*/ return new String[] {"Reference"};
3483        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
3484        case 3387378: /*note*/ return new String[] {"Annotation"};
3485        case 1538891575: /*relevantHistory*/ return new String[] {"Reference"};
3486        case -1561062452: /*restriction*/ return new String[] {};
3487        case 100358090: /*input*/ return new String[] {};
3488        case -1005512447: /*output*/ return new String[] {};
3489        default: return super.getTypesForProperty(hash, name);
3490        }
3491
3492      }
3493
3494      @Override
3495      public Base addChild(String name) throws FHIRException {
3496        if (name.equals("identifier")) {
3497          return addIdentifier();
3498        }
3499        else if (name.equals("definitionUri")) {
3500          this.definition = new UriType();
3501          return this.definition;
3502        }
3503        else if (name.equals("definitionReference")) {
3504          this.definition = new Reference();
3505          return this.definition;
3506        }
3507        else if (name.equals("basedOn")) {
3508          return addBasedOn();
3509        }
3510        else if (name.equals("groupIdentifier")) {
3511          this.groupIdentifier = new Identifier();
3512          return this.groupIdentifier;
3513        }
3514        else if (name.equals("partOf")) {
3515          return addPartOf();
3516        }
3517        else if (name.equals("status")) {
3518          throw new FHIRException("Cannot call addChild on a primitive type Task.status");
3519        }
3520        else if (name.equals("statusReason")) {
3521          this.statusReason = new CodeableConcept();
3522          return this.statusReason;
3523        }
3524        else if (name.equals("businessStatus")) {
3525          this.businessStatus = new CodeableConcept();
3526          return this.businessStatus;
3527        }
3528        else if (name.equals("intent")) {
3529          throw new FHIRException("Cannot call addChild on a primitive type Task.intent");
3530        }
3531        else if (name.equals("priority")) {
3532          throw new FHIRException("Cannot call addChild on a primitive type Task.priority");
3533        }
3534        else if (name.equals("code")) {
3535          this.code = new CodeableConcept();
3536          return this.code;
3537        }
3538        else if (name.equals("description")) {
3539          throw new FHIRException("Cannot call addChild on a primitive type Task.description");
3540        }
3541        else if (name.equals("focus")) {
3542          this.focus = new Reference();
3543          return this.focus;
3544        }
3545        else if (name.equals("for")) {
3546          this.for_ = new Reference();
3547          return this.for_;
3548        }
3549        else if (name.equals("context")) {
3550          this.context = new Reference();
3551          return this.context;
3552        }
3553        else if (name.equals("executionPeriod")) {
3554          this.executionPeriod = new Period();
3555          return this.executionPeriod;
3556        }
3557        else if (name.equals("authoredOn")) {
3558          throw new FHIRException("Cannot call addChild on a primitive type Task.authoredOn");
3559        }
3560        else if (name.equals("lastModified")) {
3561          throw new FHIRException("Cannot call addChild on a primitive type Task.lastModified");
3562        }
3563        else if (name.equals("requester")) {
3564          this.requester = new TaskRequesterComponent();
3565          return this.requester;
3566        }
3567        else if (name.equals("performerType")) {
3568          return addPerformerType();
3569        }
3570        else if (name.equals("owner")) {
3571          this.owner = new Reference();
3572          return this.owner;
3573        }
3574        else if (name.equals("reason")) {
3575          this.reason = new CodeableConcept();
3576          return this.reason;
3577        }
3578        else if (name.equals("note")) {
3579          return addNote();
3580        }
3581        else if (name.equals("relevantHistory")) {
3582          return addRelevantHistory();
3583        }
3584        else if (name.equals("restriction")) {
3585          this.restriction = new TaskRestrictionComponent();
3586          return this.restriction;
3587        }
3588        else if (name.equals("input")) {
3589          return addInput();
3590        }
3591        else if (name.equals("output")) {
3592          return addOutput();
3593        }
3594        else
3595          return super.addChild(name);
3596      }
3597
3598  public String fhirType() {
3599    return "Task";
3600
3601  }
3602
3603      public Task copy() {
3604        Task dst = new Task();
3605        copyValues(dst);
3606        if (identifier != null) {
3607          dst.identifier = new ArrayList<Identifier>();
3608          for (Identifier i : identifier)
3609            dst.identifier.add(i.copy());
3610        };
3611        dst.definition = definition == null ? null : definition.copy();
3612        if (basedOn != null) {
3613          dst.basedOn = new ArrayList<Reference>();
3614          for (Reference i : basedOn)
3615            dst.basedOn.add(i.copy());
3616        };
3617        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
3618        if (partOf != null) {
3619          dst.partOf = new ArrayList<Reference>();
3620          for (Reference i : partOf)
3621            dst.partOf.add(i.copy());
3622        };
3623        dst.status = status == null ? null : status.copy();
3624        dst.statusReason = statusReason == null ? null : statusReason.copy();
3625        dst.businessStatus = businessStatus == null ? null : businessStatus.copy();
3626        dst.intent = intent == null ? null : intent.copy();
3627        dst.priority = priority == null ? null : priority.copy();
3628        dst.code = code == null ? null : code.copy();
3629        dst.description = description == null ? null : description.copy();
3630        dst.focus = focus == null ? null : focus.copy();
3631        dst.for_ = for_ == null ? null : for_.copy();
3632        dst.context = context == null ? null : context.copy();
3633        dst.executionPeriod = executionPeriod == null ? null : executionPeriod.copy();
3634        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
3635        dst.lastModified = lastModified == null ? null : lastModified.copy();
3636        dst.requester = requester == null ? null : requester.copy();
3637        if (performerType != null) {
3638          dst.performerType = new ArrayList<CodeableConcept>();
3639          for (CodeableConcept i : performerType)
3640            dst.performerType.add(i.copy());
3641        };
3642        dst.owner = owner == null ? null : owner.copy();
3643        dst.reason = reason == null ? null : reason.copy();
3644        if (note != null) {
3645          dst.note = new ArrayList<Annotation>();
3646          for (Annotation i : note)
3647            dst.note.add(i.copy());
3648        };
3649        if (relevantHistory != null) {
3650          dst.relevantHistory = new ArrayList<Reference>();
3651          for (Reference i : relevantHistory)
3652            dst.relevantHistory.add(i.copy());
3653        };
3654        dst.restriction = restriction == null ? null : restriction.copy();
3655        if (input != null) {
3656          dst.input = new ArrayList<ParameterComponent>();
3657          for (ParameterComponent i : input)
3658            dst.input.add(i.copy());
3659        };
3660        if (output != null) {
3661          dst.output = new ArrayList<TaskOutputComponent>();
3662          for (TaskOutputComponent i : output)
3663            dst.output.add(i.copy());
3664        };
3665        return dst;
3666      }
3667
3668      protected Task typedCopy() {
3669        return copy();
3670      }
3671
3672      @Override
3673      public boolean equalsDeep(Base other) {
3674        if (!super.equalsDeep(other))
3675          return false;
3676        if (!(other instanceof Task))
3677          return false;
3678        Task o = (Task) other;
3679        return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true)
3680           && compareDeep(basedOn, o.basedOn, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
3681           && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
3682           && compareDeep(businessStatus, o.businessStatus, true) && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true)
3683           && compareDeep(code, o.code, true) && compareDeep(description, o.description, true) && compareDeep(focus, o.focus, true)
3684           && compareDeep(for_, o.for_, true) && compareDeep(context, o.context, true) && compareDeep(executionPeriod, o.executionPeriod, true)
3685           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(lastModified, o.lastModified, true)
3686           && compareDeep(requester, o.requester, true) && compareDeep(performerType, o.performerType, true)
3687           && compareDeep(owner, o.owner, true) && compareDeep(reason, o.reason, true) && compareDeep(note, o.note, true)
3688           && compareDeep(relevantHistory, o.relevantHistory, true) && compareDeep(restriction, o.restriction, true)
3689           && compareDeep(input, o.input, true) && compareDeep(output, o.output, true);
3690      }
3691
3692      @Override
3693      public boolean equalsShallow(Base other) {
3694        if (!super.equalsShallow(other))
3695          return false;
3696        if (!(other instanceof Task))
3697          return false;
3698        Task o = (Task) other;
3699        return compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
3700           && compareValues(description, o.description, true) && compareValues(authoredOn, o.authoredOn, true)
3701           && compareValues(lastModified, o.lastModified, true);
3702      }
3703
3704      public boolean isEmpty() {
3705        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, basedOn
3706          , groupIdentifier, partOf, status, statusReason, businessStatus, intent, priority
3707          , code, description, focus, for_, context, executionPeriod, authoredOn, lastModified
3708          , requester, performerType, owner, reason, note, relevantHistory, restriction
3709          , input, output);
3710      }
3711
3712  @Override
3713  public ResourceType getResourceType() {
3714    return ResourceType.Task;
3715   }
3716
3717 /**
3718   * Search parameter: <b>owner</b>
3719   * <p>
3720   * Description: <b>Search by task owner</b><br>
3721   * Type: <b>reference</b><br>
3722   * Path: <b>Task.owner</b><br>
3723   * </p>
3724   */
3725  @SearchParamDefinition(name="owner", path="Task.owner", description="Search by task owner", type="reference", target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3726  public static final String SP_OWNER = "owner";
3727 /**
3728   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
3729   * <p>
3730   * Description: <b>Search by task owner</b><br>
3731   * Type: <b>reference</b><br>
3732   * Path: <b>Task.owner</b><br>
3733   * </p>
3734   */
3735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
3736
3737/**
3738   * Constant for fluent queries to be used to add include statements. Specifies
3739   * the path value of "<b>Task:owner</b>".
3740   */
3741  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Task:owner").toLocked();
3742
3743 /**
3744   * Search parameter: <b>requester</b>
3745   * <p>
3746   * Description: <b>Search by task requester</b><br>
3747   * Type: <b>reference</b><br>
3748   * Path: <b>Task.requester.agent</b><br>
3749   * </p>
3750   */
3751  @SearchParamDefinition(name="requester", path="Task.requester.agent", description="Search by task requester", type="reference", target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3752  public static final String SP_REQUESTER = "requester";
3753 /**
3754   * <b>Fluent Client</b> search parameter constant for <b>requester</b>
3755   * <p>
3756   * Description: <b>Search by task requester</b><br>
3757   * Type: <b>reference</b><br>
3758   * Path: <b>Task.requester.agent</b><br>
3759   * </p>
3760   */
3761  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER);
3762
3763/**
3764   * Constant for fluent queries to be used to add include statements. Specifies
3765   * the path value of "<b>Task:requester</b>".
3766   */
3767  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("Task:requester").toLocked();
3768
3769 /**
3770   * Search parameter: <b>identifier</b>
3771   * <p>
3772   * Description: <b>Search for a task instance by its business identifier</b><br>
3773   * Type: <b>token</b><br>
3774   * Path: <b>Task.identifier</b><br>
3775   * </p>
3776   */
3777  @SearchParamDefinition(name="identifier", path="Task.identifier", description="Search for a task instance by its business identifier", type="token" )
3778  public static final String SP_IDENTIFIER = "identifier";
3779 /**
3780   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3781   * <p>
3782   * Description: <b>Search for a task instance by its business identifier</b><br>
3783   * Type: <b>token</b><br>
3784   * Path: <b>Task.identifier</b><br>
3785   * </p>
3786   */
3787  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3788
3789 /**
3790   * Search parameter: <b>business-status</b>
3791   * <p>
3792   * Description: <b>Search by business status</b><br>
3793   * Type: <b>token</b><br>
3794   * Path: <b>Task.businessStatus</b><br>
3795   * </p>
3796   */
3797  @SearchParamDefinition(name="business-status", path="Task.businessStatus", description="Search by business status", type="token" )
3798  public static final String SP_BUSINESS_STATUS = "business-status";
3799 /**
3800   * <b>Fluent Client</b> search parameter constant for <b>business-status</b>
3801   * <p>
3802   * Description: <b>Search by business status</b><br>
3803   * Type: <b>token</b><br>
3804   * Path: <b>Task.businessStatus</b><br>
3805   * </p>
3806   */
3807  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BUSINESS_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BUSINESS_STATUS);
3808
3809 /**
3810   * Search parameter: <b>period</b>
3811   * <p>
3812   * Description: <b>Search by period Task is/was underway</b><br>
3813   * Type: <b>date</b><br>
3814   * Path: <b>Task.executionPeriod</b><br>
3815   * </p>
3816   */
3817  @SearchParamDefinition(name="period", path="Task.executionPeriod", description="Search by period Task is/was underway", type="date" )
3818  public static final String SP_PERIOD = "period";
3819 /**
3820   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3821   * <p>
3822   * Description: <b>Search by period Task is/was underway</b><br>
3823   * Type: <b>date</b><br>
3824   * Path: <b>Task.executionPeriod</b><br>
3825   * </p>
3826   */
3827  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
3828
3829 /**
3830   * Search parameter: <b>code</b>
3831   * <p>
3832   * Description: <b>Search by task code</b><br>
3833   * Type: <b>token</b><br>
3834   * Path: <b>Task.code</b><br>
3835   * </p>
3836   */
3837  @SearchParamDefinition(name="code", path="Task.code", description="Search by task code", type="token" )
3838  public static final String SP_CODE = "code";
3839 /**
3840   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3841   * <p>
3842   * Description: <b>Search by task code</b><br>
3843   * Type: <b>token</b><br>
3844   * Path: <b>Task.code</b><br>
3845   * </p>
3846   */
3847  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3848
3849 /**
3850   * Search parameter: <b>performer</b>
3851   * <p>
3852   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
3853   * Type: <b>token</b><br>
3854   * Path: <b>Task.performerType</b><br>
3855   * </p>
3856   */
3857  @SearchParamDefinition(name="performer", path="Task.performerType", description="Search by recommended type of performer (e.g., Requester, Performer, Scheduler).", type="token" )
3858  public static final String SP_PERFORMER = "performer";
3859 /**
3860   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
3861   * <p>
3862   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
3863   * Type: <b>token</b><br>
3864   * Path: <b>Task.performerType</b><br>
3865   * </p>
3866   */
3867  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PERFORMER);
3868
3869 /**
3870   * Search parameter: <b>subject</b>
3871   * <p>
3872   * Description: <b>Search by subject</b><br>
3873   * Type: <b>reference</b><br>
3874   * Path: <b>Task.for</b><br>
3875   * </p>
3876   */
3877  @SearchParamDefinition(name="subject", path="Task.for", description="Search by subject", type="reference" )
3878  public static final String SP_SUBJECT = "subject";
3879 /**
3880   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3881   * <p>
3882   * Description: <b>Search by subject</b><br>
3883   * Type: <b>reference</b><br>
3884   * Path: <b>Task.for</b><br>
3885   * </p>
3886   */
3887  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3888
3889/**
3890   * Constant for fluent queries to be used to add include statements. Specifies
3891   * the path value of "<b>Task:subject</b>".
3892   */
3893  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Task:subject").toLocked();
3894
3895 /**
3896   * Search parameter: <b>focus</b>
3897   * <p>
3898   * Description: <b>Search by task focus</b><br>
3899   * Type: <b>reference</b><br>
3900   * Path: <b>Task.focus</b><br>
3901   * </p>
3902   */
3903  @SearchParamDefinition(name="focus", path="Task.focus", description="Search by task focus", type="reference" )
3904  public static final String SP_FOCUS = "focus";
3905 /**
3906   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
3907   * <p>
3908   * Description: <b>Search by task focus</b><br>
3909   * Type: <b>reference</b><br>
3910   * Path: <b>Task.focus</b><br>
3911   * </p>
3912   */
3913  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOCUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FOCUS);
3914
3915/**
3916   * Constant for fluent queries to be used to add include statements. Specifies
3917   * the path value of "<b>Task:focus</b>".
3918   */
3919  public static final ca.uhn.fhir.model.api.Include INCLUDE_FOCUS = new ca.uhn.fhir.model.api.Include("Task:focus").toLocked();
3920
3921 /**
3922   * Search parameter: <b>part-of</b>
3923   * <p>
3924   * Description: <b>Search by task this task is part of</b><br>
3925   * Type: <b>reference</b><br>
3926   * Path: <b>Task.partOf</b><br>
3927   * </p>
3928   */
3929  @SearchParamDefinition(name="part-of", path="Task.partOf", description="Search by task this task is part of", type="reference", target={Task.class } )
3930  public static final String SP_PART_OF = "part-of";
3931 /**
3932   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
3933   * <p>
3934   * Description: <b>Search by task this task is part of</b><br>
3935   * Type: <b>reference</b><br>
3936   * Path: <b>Task.partOf</b><br>
3937   * </p>
3938   */
3939  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
3940
3941/**
3942   * Constant for fluent queries to be used to add include statements. Specifies
3943   * the path value of "<b>Task:part-of</b>".
3944   */
3945  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("Task:part-of").toLocked();
3946
3947 /**
3948   * Search parameter: <b>priority</b>
3949   * <p>
3950   * Description: <b>Search by task priority</b><br>
3951   * Type: <b>token</b><br>
3952   * Path: <b>Task.priority</b><br>
3953   * </p>
3954   */
3955  @SearchParamDefinition(name="priority", path="Task.priority", description="Search by task priority", type="token" )
3956  public static final String SP_PRIORITY = "priority";
3957 /**
3958   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
3959   * <p>
3960   * Description: <b>Search by task priority</b><br>
3961   * Type: <b>token</b><br>
3962   * Path: <b>Task.priority</b><br>
3963   * </p>
3964   */
3965  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
3966
3967 /**
3968   * Search parameter: <b>authored-on</b>
3969   * <p>
3970   * Description: <b>Search by creation date</b><br>
3971   * Type: <b>date</b><br>
3972   * Path: <b>Task.authoredOn</b><br>
3973   * </p>
3974   */
3975  @SearchParamDefinition(name="authored-on", path="Task.authoredOn", description="Search by creation date", type="date" )
3976  public static final String SP_AUTHORED_ON = "authored-on";
3977 /**
3978   * <b>Fluent Client</b> search parameter constant for <b>authored-on</b>
3979   * <p>
3980   * Description: <b>Search by creation date</b><br>
3981   * Type: <b>date</b><br>
3982   * Path: <b>Task.authoredOn</b><br>
3983   * </p>
3984   */
3985  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED_ON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED_ON);
3986
3987 /**
3988   * Search parameter: <b>intent</b>
3989   * <p>
3990   * Description: <b>Search by task intent</b><br>
3991   * Type: <b>token</b><br>
3992   * Path: <b>Task.intent</b><br>
3993   * </p>
3994   */
3995  @SearchParamDefinition(name="intent", path="Task.intent", description="Search by task intent", type="token" )
3996  public static final String SP_INTENT = "intent";
3997 /**
3998   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
3999   * <p>
4000   * Description: <b>Search by task intent</b><br>
4001   * Type: <b>token</b><br>
4002   * Path: <b>Task.intent</b><br>
4003   * </p>
4004   */
4005  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4006
4007 /**
4008   * Search parameter: <b>group-identifier</b>
4009   * <p>
4010   * Description: <b>Search by group identifier</b><br>
4011   * Type: <b>token</b><br>
4012   * Path: <b>Task.groupIdentifier</b><br>
4013   * </p>
4014   */
4015  @SearchParamDefinition(name="group-identifier", path="Task.groupIdentifier", description="Search by group identifier", type="token" )
4016  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
4017 /**
4018   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
4019   * <p>
4020   * Description: <b>Search by group identifier</b><br>
4021   * Type: <b>token</b><br>
4022   * Path: <b>Task.groupIdentifier</b><br>
4023   * </p>
4024   */
4025  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
4026
4027 /**
4028   * Search parameter: <b>based-on</b>
4029   * <p>
4030   * Description: <b>Search by requests this task is based on</b><br>
4031   * Type: <b>reference</b><br>
4032   * Path: <b>Task.basedOn</b><br>
4033   * </p>
4034   */
4035  @SearchParamDefinition(name="based-on", path="Task.basedOn", description="Search by requests this task is based on", type="reference" )
4036  public static final String SP_BASED_ON = "based-on";
4037 /**
4038   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
4039   * <p>
4040   * Description: <b>Search by requests this task is based on</b><br>
4041   * Type: <b>reference</b><br>
4042   * Path: <b>Task.basedOn</b><br>
4043   * </p>
4044   */
4045  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
4046
4047/**
4048   * Constant for fluent queries to be used to add include statements. Specifies
4049   * the path value of "<b>Task:based-on</b>".
4050   */
4051  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Task:based-on").toLocked();
4052
4053 /**
4054   * Search parameter: <b>patient</b>
4055   * <p>
4056   * Description: <b>Search by patient</b><br>
4057   * Type: <b>reference</b><br>
4058   * Path: <b>Task.for</b><br>
4059   * </p>
4060   */
4061  @SearchParamDefinition(name="patient", path="Task.for", description="Search by patient", type="reference", target={Patient.class } )
4062  public static final String SP_PATIENT = "patient";
4063 /**
4064   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4065   * <p>
4066   * Description: <b>Search by patient</b><br>
4067   * Type: <b>reference</b><br>
4068   * Path: <b>Task.for</b><br>
4069   * </p>
4070   */
4071  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4072
4073/**
4074   * Constant for fluent queries to be used to add include statements. Specifies
4075   * the path value of "<b>Task:patient</b>".
4076   */
4077  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Task:patient").toLocked();
4078
4079 /**
4080   * Search parameter: <b>organization</b>
4081   * <p>
4082   * Description: <b>Search by responsible organization</b><br>
4083   * Type: <b>reference</b><br>
4084   * Path: <b>Task.requester.onBehalfOf</b><br>
4085   * </p>
4086   */
4087  @SearchParamDefinition(name="organization", path="Task.requester.onBehalfOf", description="Search by responsible organization", type="reference", target={Organization.class } )
4088  public static final String SP_ORGANIZATION = "organization";
4089 /**
4090   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
4091   * <p>
4092   * Description: <b>Search by responsible organization</b><br>
4093   * Type: <b>reference</b><br>
4094   * Path: <b>Task.requester.onBehalfOf</b><br>
4095   * </p>
4096   */
4097  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
4098
4099/**
4100   * Constant for fluent queries to be used to add include statements. Specifies
4101   * the path value of "<b>Task:organization</b>".
4102   */
4103  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Task:organization").toLocked();
4104
4105 /**
4106   * Search parameter: <b>context</b>
4107   * <p>
4108   * Description: <b>Search by encounter or episode</b><br>
4109   * Type: <b>reference</b><br>
4110   * Path: <b>Task.context</b><br>
4111   * </p>
4112   */
4113  @SearchParamDefinition(name="context", path="Task.context", description="Search by encounter or episode", type="reference", target={Encounter.class, EpisodeOfCare.class } )
4114  public static final String SP_CONTEXT = "context";
4115 /**
4116   * <b>Fluent Client</b> search parameter constant for <b>context</b>
4117   * <p>
4118   * Description: <b>Search by encounter or episode</b><br>
4119   * Type: <b>reference</b><br>
4120   * Path: <b>Task.context</b><br>
4121   * </p>
4122   */
4123  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
4124
4125/**
4126   * Constant for fluent queries to be used to add include statements. Specifies
4127   * the path value of "<b>Task:context</b>".
4128   */
4129  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("Task:context").toLocked();
4130
4131 /**
4132   * Search parameter: <b>modified</b>
4133   * <p>
4134   * Description: <b>Search by last modification date</b><br>
4135   * Type: <b>date</b><br>
4136   * Path: <b>Task.lastModified</b><br>
4137   * </p>
4138   */
4139  @SearchParamDefinition(name="modified", path="Task.lastModified", description="Search by last modification date", type="date" )
4140  public static final String SP_MODIFIED = "modified";
4141 /**
4142   * <b>Fluent Client</b> search parameter constant for <b>modified</b>
4143   * <p>
4144   * Description: <b>Search by last modification date</b><br>
4145   * Type: <b>date</b><br>
4146   * Path: <b>Task.lastModified</b><br>
4147   * </p>
4148   */
4149  public static final ca.uhn.fhir.rest.gclient.DateClientParam MODIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_MODIFIED);
4150
4151 /**
4152   * Search parameter: <b>status</b>
4153   * <p>
4154   * Description: <b>Search by task status</b><br>
4155   * Type: <b>token</b><br>
4156   * Path: <b>Task.status</b><br>
4157   * </p>
4158   */
4159  @SearchParamDefinition(name="status", path="Task.status", description="Search by task status", type="token" )
4160  public static final String SP_STATUS = "status";
4161 /**
4162   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4163   * <p>
4164   * Description: <b>Search by task status</b><br>
4165   * Type: <b>token</b><br>
4166   * Path: <b>Task.status</b><br>
4167   * </p>
4168   */
4169  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4170
4171
4172}
4173