001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046/**
047 * A task to be performed.
048 */
049@ResourceDef(name="Task", profile="http://hl7.org/fhir/Profile/Task")
050public class Task extends DomainResource {
051
052    public enum TaskPriority {
053        /**
054         * This task has low priority.
055         */
056        LOW, 
057        /**
058         * This task has normal priority.
059         */
060        NORMAL, 
061        /**
062         * This task has high priority.
063         */
064        HIGH, 
065        /**
066         * added to help the parsers
067         */
068        NULL;
069        public static TaskPriority fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("low".equals(codeString))
073          return LOW;
074        if ("normal".equals(codeString))
075          return NORMAL;
076        if ("high".equals(codeString))
077          return HIGH;
078        throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
079        }
080        public String toCode() {
081          switch (this) {
082            case LOW: return "low";
083            case NORMAL: return "normal";
084            case HIGH: return "high";
085            default: return "?";
086          }
087        }
088        public String getSystem() {
089          switch (this) {
090            case LOW: return "http://hl7.org/fhir/task-priority";
091            case NORMAL: return "http://hl7.org/fhir/task-priority";
092            case HIGH: return "http://hl7.org/fhir/task-priority";
093            default: return "?";
094          }
095        }
096        public String getDefinition() {
097          switch (this) {
098            case LOW: return "This task has low priority.";
099            case NORMAL: return "This task has normal priority.";
100            case HIGH: return "This task has high priority.";
101            default: return "?";
102          }
103        }
104        public String getDisplay() {
105          switch (this) {
106            case LOW: return "Low";
107            case NORMAL: return "Normal";
108            case HIGH: return "High";
109            default: return "?";
110          }
111        }
112    }
113
114  public static class TaskPriorityEnumFactory implements EnumFactory<TaskPriority> {
115    public TaskPriority fromCode(String codeString) throws IllegalArgumentException {
116      if (codeString == null || "".equals(codeString))
117            if (codeString == null || "".equals(codeString))
118                return null;
119        if ("low".equals(codeString))
120          return TaskPriority.LOW;
121        if ("normal".equals(codeString))
122          return TaskPriority.NORMAL;
123        if ("high".equals(codeString))
124          return TaskPriority.HIGH;
125        throw new IllegalArgumentException("Unknown TaskPriority code '"+codeString+"'");
126        }
127        public Enumeration<TaskPriority> fromType(Base code) throws FHIRException {
128          if (code == null || code.isEmpty())
129            return null;
130          String codeString = ((PrimitiveType) code).asStringValue();
131          if (codeString == null || "".equals(codeString))
132            return null;
133        if ("low".equals(codeString))
134          return new Enumeration<TaskPriority>(this, TaskPriority.LOW);
135        if ("normal".equals(codeString))
136          return new Enumeration<TaskPriority>(this, TaskPriority.NORMAL);
137        if ("high".equals(codeString))
138          return new Enumeration<TaskPriority>(this, TaskPriority.HIGH);
139        throw new FHIRException("Unknown TaskPriority code '"+codeString+"'");
140        }
141    public String toCode(TaskPriority code) {
142      if (code == TaskPriority.LOW)
143        return "low";
144      if (code == TaskPriority.NORMAL)
145        return "normal";
146      if (code == TaskPriority.HIGH)
147        return "high";
148      return "?";
149      }
150    public String toSystem(TaskPriority code) {
151      return code.getSystem();
152      }
153    }
154
155    public enum TaskStatus {
156        /**
157         * The task is not yet ready to be acted upon.
158         */
159        DRAFT, 
160        /**
161         * The task is ready to be acted upon
162         */
163        REQUESTED, 
164        /**
165         * A potential performer has claimed ownership of the task and is evaluating whether to perform it
166         */
167        RECEIVED, 
168        /**
169         * The potential performer has agreed to execute the task but has not yet started work
170         */
171        ACCEPTED, 
172        /**
173         * The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.
174         */
175        REJECTED, 
176        /**
177         * 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         */
179        READY, 
180        /**
181         * Task has been started but is not yet complete.
182         */
183        INPROGRESS, 
184        /**
185         * Task has been started but work has been paused
186         */
187        ONHOLD, 
188        /**
189         * The task was attempted but could not be completed due to some error.
190         */
191        FAILED, 
192        /**
193         * The task has been completed (more or less) as requested.
194         */
195        COMPLETED, 
196        /**
197         * added to help the parsers
198         */
199        NULL;
200        public static TaskStatus fromCode(String codeString) throws FHIRException {
201            if (codeString == null || "".equals(codeString))
202                return null;
203        if ("draft".equals(codeString))
204          return DRAFT;
205        if ("requested".equals(codeString))
206          return REQUESTED;
207        if ("received".equals(codeString))
208          return RECEIVED;
209        if ("accepted".equals(codeString))
210          return ACCEPTED;
211        if ("rejected".equals(codeString))
212          return REJECTED;
213        if ("ready".equals(codeString))
214          return READY;
215        if ("in-progress".equals(codeString))
216          return INPROGRESS;
217        if ("on-hold".equals(codeString))
218          return ONHOLD;
219        if ("failed".equals(codeString))
220          return FAILED;
221        if ("completed".equals(codeString))
222          return COMPLETED;
223        throw new FHIRException("Unknown TaskStatus code '"+codeString+"'");
224        }
225        public String toCode() {
226          switch (this) {
227            case DRAFT: return "draft";
228            case REQUESTED: return "requested";
229            case RECEIVED: return "received";
230            case ACCEPTED: return "accepted";
231            case REJECTED: return "rejected";
232            case READY: return "ready";
233            case INPROGRESS: return "in-progress";
234            case ONHOLD: return "on-hold";
235            case FAILED: return "failed";
236            case COMPLETED: return "completed";
237            default: return "?";
238          }
239        }
240        public String getSystem() {
241          switch (this) {
242            case DRAFT: return "http://hl7.org/fhir/task-status";
243            case REQUESTED: return "http://hl7.org/fhir/task-status";
244            case RECEIVED: return "http://hl7.org/fhir/task-status";
245            case ACCEPTED: return "http://hl7.org/fhir/task-status";
246            case REJECTED: return "http://hl7.org/fhir/task-status";
247            case READY: return "http://hl7.org/fhir/task-status";
248            case INPROGRESS: return "http://hl7.org/fhir/task-status";
249            case ONHOLD: return "http://hl7.org/fhir/task-status";
250            case FAILED: return "http://hl7.org/fhir/task-status";
251            case COMPLETED: return "http://hl7.org/fhir/task-status";
252            default: return "?";
253          }
254        }
255        public String getDefinition() {
256          switch (this) {
257            case DRAFT: return "The task is not yet ready to be acted upon.";
258            case REQUESTED: return "The task is ready to be acted upon";
259            case RECEIVED: return "A potential performer has claimed ownership of the task and is evaluating whether to perform it";
260            case ACCEPTED: return "The potential performer has agreed to execute the task but has not yet started work";
261            case REJECTED: return "The potential performer who claimed ownership of the task has decided not to execute it prior to performing any action.";
262            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.";
263            case INPROGRESS: return "Task has been started but is not yet complete.";
264            case ONHOLD: return "Task has been started but work has been paused";
265            case FAILED: return "The task was attempted but could not be completed due to some error.";
266            case COMPLETED: return "The task has been completed (more or less) as requested.";
267            default: return "?";
268          }
269        }
270        public String getDisplay() {
271          switch (this) {
272            case DRAFT: return "Draft";
273            case REQUESTED: return "Requested";
274            case RECEIVED: return "Received";
275            case ACCEPTED: return "Accepted";
276            case REJECTED: return "Rejected";
277            case READY: return "Ready";
278            case INPROGRESS: return "In Progress";
279            case ONHOLD: return "On Hold";
280            case FAILED: return "Failed";
281            case COMPLETED: return "Completed";
282            default: return "?";
283          }
284        }
285    }
286
287  public static class TaskStatusEnumFactory implements EnumFactory<TaskStatus> {
288    public TaskStatus fromCode(String codeString) throws IllegalArgumentException {
289      if (codeString == null || "".equals(codeString))
290            if (codeString == null || "".equals(codeString))
291                return null;
292        if ("draft".equals(codeString))
293          return TaskStatus.DRAFT;
294        if ("requested".equals(codeString))
295          return TaskStatus.REQUESTED;
296        if ("received".equals(codeString))
297          return TaskStatus.RECEIVED;
298        if ("accepted".equals(codeString))
299          return TaskStatus.ACCEPTED;
300        if ("rejected".equals(codeString))
301          return TaskStatus.REJECTED;
302        if ("ready".equals(codeString))
303          return TaskStatus.READY;
304        if ("in-progress".equals(codeString))
305          return TaskStatus.INPROGRESS;
306        if ("on-hold".equals(codeString))
307          return TaskStatus.ONHOLD;
308        if ("failed".equals(codeString))
309          return TaskStatus.FAILED;
310        if ("completed".equals(codeString))
311          return TaskStatus.COMPLETED;
312        throw new IllegalArgumentException("Unknown TaskStatus code '"+codeString+"'");
313        }
314        public Enumeration<TaskStatus> fromType(Base code) throws FHIRException {
315          if (code == null || code.isEmpty())
316            return null;
317          String codeString = ((PrimitiveType) code).asStringValue();
318          if (codeString == null || "".equals(codeString))
319            return null;
320        if ("draft".equals(codeString))
321          return new Enumeration<TaskStatus>(this, TaskStatus.DRAFT);
322        if ("requested".equals(codeString))
323          return new Enumeration<TaskStatus>(this, TaskStatus.REQUESTED);
324        if ("received".equals(codeString))
325          return new Enumeration<TaskStatus>(this, TaskStatus.RECEIVED);
326        if ("accepted".equals(codeString))
327          return new Enumeration<TaskStatus>(this, TaskStatus.ACCEPTED);
328        if ("rejected".equals(codeString))
329          return new Enumeration<TaskStatus>(this, TaskStatus.REJECTED);
330        if ("ready".equals(codeString))
331          return new Enumeration<TaskStatus>(this, TaskStatus.READY);
332        if ("in-progress".equals(codeString))
333          return new Enumeration<TaskStatus>(this, TaskStatus.INPROGRESS);
334        if ("on-hold".equals(codeString))
335          return new Enumeration<TaskStatus>(this, TaskStatus.ONHOLD);
336        if ("failed".equals(codeString))
337          return new Enumeration<TaskStatus>(this, TaskStatus.FAILED);
338        if ("completed".equals(codeString))
339          return new Enumeration<TaskStatus>(this, TaskStatus.COMPLETED);
340        throw new FHIRException("Unknown TaskStatus code '"+codeString+"'");
341        }
342    public String toCode(TaskStatus code) {
343      if (code == TaskStatus.DRAFT)
344        return "draft";
345      if (code == TaskStatus.REQUESTED)
346        return "requested";
347      if (code == TaskStatus.RECEIVED)
348        return "received";
349      if (code == TaskStatus.ACCEPTED)
350        return "accepted";
351      if (code == TaskStatus.REJECTED)
352        return "rejected";
353      if (code == TaskStatus.READY)
354        return "ready";
355      if (code == TaskStatus.INPROGRESS)
356        return "in-progress";
357      if (code == TaskStatus.ONHOLD)
358        return "on-hold";
359      if (code == TaskStatus.FAILED)
360        return "failed";
361      if (code == TaskStatus.COMPLETED)
362        return "completed";
363      return "?";
364      }
365    public String toSystem(TaskStatus code) {
366      return code.getSystem();
367      }
368    }
369
370    @Block()
371    public static class ParameterComponent extends BackboneElement implements IBaseBackboneElement {
372        /**
373         * The name of the input parameter.
374         */
375        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
376        @Description(shortDefinition="Input Name", formalDefinition="The name of the input parameter." )
377        protected StringType name;
378
379        /**
380         * The value of the input parameter as a basic type.
381         */
382        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
383        @Description(shortDefinition="Input Value", formalDefinition="The value of the input parameter as a basic type." )
384        protected org.hl7.fhir.dstu2016may.model.Type value;
385
386        private static final long serialVersionUID = 342865819L;
387
388    /**
389     * Constructor
390     */
391      public ParameterComponent() {
392        super();
393      }
394
395    /**
396     * Constructor
397     */
398      public ParameterComponent(StringType name, org.hl7.fhir.dstu2016may.model.Type value) {
399        super();
400        this.name = name;
401        this.value = value;
402      }
403
404        /**
405         * @return {@link #name} (The name of the input parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
406         */
407        public StringType getNameElement() { 
408          if (this.name == null)
409            if (Configuration.errorOnAutoCreate())
410              throw new Error("Attempt to auto-create ParameterComponent.name");
411            else if (Configuration.doAutoCreate())
412              this.name = new StringType(); // bb
413          return this.name;
414        }
415
416        public boolean hasNameElement() { 
417          return this.name != null && !this.name.isEmpty();
418        }
419
420        public boolean hasName() { 
421          return this.name != null && !this.name.isEmpty();
422        }
423
424        /**
425         * @param value {@link #name} (The name of the input parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
426         */
427        public ParameterComponent setNameElement(StringType value) { 
428          this.name = value;
429          return this;
430        }
431
432        /**
433         * @return The name of the input parameter.
434         */
435        public String getName() { 
436          return this.name == null ? null : this.name.getValue();
437        }
438
439        /**
440         * @param value The name of the input parameter.
441         */
442        public ParameterComponent setName(String value) { 
443            if (this.name == null)
444              this.name = new StringType();
445            this.name.setValue(value);
446          return this;
447        }
448
449        /**
450         * @return {@link #value} (The value of the input parameter as a basic type.)
451         */
452        public org.hl7.fhir.dstu2016may.model.Type getValue() { 
453          return this.value;
454        }
455
456        public boolean hasValue() { 
457          return this.value != null && !this.value.isEmpty();
458        }
459
460        /**
461         * @param value {@link #value} (The value of the input parameter as a basic type.)
462         */
463        public ParameterComponent setValue(org.hl7.fhir.dstu2016may.model.Type value) { 
464          this.value = value;
465          return this;
466        }
467
468        protected void listChildren(List<Property> childrenList) {
469          super.listChildren(childrenList);
470          childrenList.add(new Property("name", "string", "The name of the input parameter.", 0, java.lang.Integer.MAX_VALUE, name));
471          childrenList.add(new Property("value[x]", "*", "The value of the input parameter as a basic type.", 0, java.lang.Integer.MAX_VALUE, value));
472        }
473
474      @Override
475      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
476        switch (hash) {
477        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
478        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu2016may.model.Type
479        default: return super.getProperty(hash, name, checkValid);
480        }
481
482      }
483
484      @Override
485      public void setProperty(int hash, String name, Base value) throws FHIRException {
486        switch (hash) {
487        case 3373707: // name
488          this.name = castToString(value); // StringType
489          break;
490        case 111972721: // value
491          this.value = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
492          break;
493        default: super.setProperty(hash, name, value);
494        }
495
496      }
497
498      @Override
499      public void setProperty(String name, Base value) throws FHIRException {
500        if (name.equals("name"))
501          this.name = castToString(value); // StringType
502        else if (name.equals("value[x]"))
503          this.value = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
504        else
505          super.setProperty(name, value);
506      }
507
508      @Override
509      public Base makeProperty(int hash, String name) throws FHIRException {
510        switch (hash) {
511        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
512        case -1410166417:  return getValue(); // org.hl7.fhir.dstu2016may.model.Type
513        default: return super.makeProperty(hash, name);
514        }
515
516      }
517
518      @Override
519      public Base addChild(String name) throws FHIRException {
520        if (name.equals("name")) {
521          throw new FHIRException("Cannot call addChild on a primitive type Task.name");
522        }
523        else if (name.equals("valueBoolean")) {
524          this.value = new BooleanType();
525          return this.value;
526        }
527        else if (name.equals("valueInteger")) {
528          this.value = new IntegerType();
529          return this.value;
530        }
531        else if (name.equals("valueDecimal")) {
532          this.value = new DecimalType();
533          return this.value;
534        }
535        else if (name.equals("valueBase64Binary")) {
536          this.value = new Base64BinaryType();
537          return this.value;
538        }
539        else if (name.equals("valueInstant")) {
540          this.value = new InstantType();
541          return this.value;
542        }
543        else if (name.equals("valueString")) {
544          this.value = new StringType();
545          return this.value;
546        }
547        else if (name.equals("valueUri")) {
548          this.value = new UriType();
549          return this.value;
550        }
551        else if (name.equals("valueDate")) {
552          this.value = new DateType();
553          return this.value;
554        }
555        else if (name.equals("valueDateTime")) {
556          this.value = new DateTimeType();
557          return this.value;
558        }
559        else if (name.equals("valueTime")) {
560          this.value = new TimeType();
561          return this.value;
562        }
563        else if (name.equals("valueCode")) {
564          this.value = new CodeType();
565          return this.value;
566        }
567        else if (name.equals("valueOid")) {
568          this.value = new OidType();
569          return this.value;
570        }
571        else if (name.equals("valueId")) {
572          this.value = new IdType();
573          return this.value;
574        }
575        else if (name.equals("valueUnsignedInt")) {
576          this.value = new UnsignedIntType();
577          return this.value;
578        }
579        else if (name.equals("valuePositiveInt")) {
580          this.value = new PositiveIntType();
581          return this.value;
582        }
583        else if (name.equals("valueMarkdown")) {
584          this.value = new MarkdownType();
585          return this.value;
586        }
587        else if (name.equals("valueAnnotation")) {
588          this.value = new Annotation();
589          return this.value;
590        }
591        else if (name.equals("valueAttachment")) {
592          this.value = new Attachment();
593          return this.value;
594        }
595        else if (name.equals("valueIdentifier")) {
596          this.value = new Identifier();
597          return this.value;
598        }
599        else if (name.equals("valueCodeableConcept")) {
600          this.value = new CodeableConcept();
601          return this.value;
602        }
603        else if (name.equals("valueCoding")) {
604          this.value = new Coding();
605          return this.value;
606        }
607        else if (name.equals("valueQuantity")) {
608          this.value = new Quantity();
609          return this.value;
610        }
611        else if (name.equals("valueRange")) {
612          this.value = new Range();
613          return this.value;
614        }
615        else if (name.equals("valuePeriod")) {
616          this.value = new Period();
617          return this.value;
618        }
619        else if (name.equals("valueRatio")) {
620          this.value = new Ratio();
621          return this.value;
622        }
623        else if (name.equals("valueSampledData")) {
624          this.value = new SampledData();
625          return this.value;
626        }
627        else if (name.equals("valueSignature")) {
628          this.value = new Signature();
629          return this.value;
630        }
631        else if (name.equals("valueHumanName")) {
632          this.value = new HumanName();
633          return this.value;
634        }
635        else if (name.equals("valueAddress")) {
636          this.value = new Address();
637          return this.value;
638        }
639        else if (name.equals("valueContactPoint")) {
640          this.value = new ContactPoint();
641          return this.value;
642        }
643        else if (name.equals("valueTiming")) {
644          this.value = new Timing();
645          return this.value;
646        }
647        else if (name.equals("valueReference")) {
648          this.value = new Reference();
649          return this.value;
650        }
651        else if (name.equals("valueMeta")) {
652          this.value = new Meta();
653          return this.value;
654        }
655        else
656          return super.addChild(name);
657      }
658
659      public ParameterComponent copy() {
660        ParameterComponent dst = new ParameterComponent();
661        copyValues(dst);
662        dst.name = name == null ? null : name.copy();
663        dst.value = value == null ? null : value.copy();
664        return dst;
665      }
666
667      @Override
668      public boolean equalsDeep(Base other) {
669        if (!super.equalsDeep(other))
670          return false;
671        if (!(other instanceof ParameterComponent))
672          return false;
673        ParameterComponent o = (ParameterComponent) other;
674        return compareDeep(name, o.name, true) && compareDeep(value, o.value, true);
675      }
676
677      @Override
678      public boolean equalsShallow(Base other) {
679        if (!super.equalsShallow(other))
680          return false;
681        if (!(other instanceof ParameterComponent))
682          return false;
683        ParameterComponent o = (ParameterComponent) other;
684        return compareValues(name, o.name, true);
685      }
686
687      public boolean isEmpty() {
688        return super.isEmpty() && (name == null || name.isEmpty()) && (value == null || value.isEmpty())
689          ;
690      }
691
692  public String fhirType() {
693    return "Task.input";
694
695  }
696
697  }
698
699    @Block()
700    public static class TaskOutputComponent extends BackboneElement implements IBaseBackboneElement {
701        /**
702         * The name of the Output parameter.
703         */
704        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
705        @Description(shortDefinition="Output Name", formalDefinition="The name of the Output parameter." )
706        protected StringType name;
707
708        /**
709         * The value of the Output parameter as a basic type.
710         */
711        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=false)
712        @Description(shortDefinition="Output Value", formalDefinition="The value of the Output parameter as a basic type." )
713        protected org.hl7.fhir.dstu2016may.model.Type value;
714
715        private static final long serialVersionUID = 342865819L;
716
717    /**
718     * Constructor
719     */
720      public TaskOutputComponent() {
721        super();
722      }
723
724    /**
725     * Constructor
726     */
727      public TaskOutputComponent(StringType name, org.hl7.fhir.dstu2016may.model.Type value) {
728        super();
729        this.name = name;
730        this.value = value;
731      }
732
733        /**
734         * @return {@link #name} (The name of the Output parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
735         */
736        public StringType getNameElement() { 
737          if (this.name == null)
738            if (Configuration.errorOnAutoCreate())
739              throw new Error("Attempt to auto-create TaskOutputComponent.name");
740            else if (Configuration.doAutoCreate())
741              this.name = new StringType(); // bb
742          return this.name;
743        }
744
745        public boolean hasNameElement() { 
746          return this.name != null && !this.name.isEmpty();
747        }
748
749        public boolean hasName() { 
750          return this.name != null && !this.name.isEmpty();
751        }
752
753        /**
754         * @param value {@link #name} (The name of the Output parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
755         */
756        public TaskOutputComponent setNameElement(StringType value) { 
757          this.name = value;
758          return this;
759        }
760
761        /**
762         * @return The name of the Output parameter.
763         */
764        public String getName() { 
765          return this.name == null ? null : this.name.getValue();
766        }
767
768        /**
769         * @param value The name of the Output parameter.
770         */
771        public TaskOutputComponent setName(String value) { 
772            if (this.name == null)
773              this.name = new StringType();
774            this.name.setValue(value);
775          return this;
776        }
777
778        /**
779         * @return {@link #value} (The value of the Output parameter as a basic type.)
780         */
781        public org.hl7.fhir.dstu2016may.model.Type getValue() { 
782          return this.value;
783        }
784
785        public boolean hasValue() { 
786          return this.value != null && !this.value.isEmpty();
787        }
788
789        /**
790         * @param value {@link #value} (The value of the Output parameter as a basic type.)
791         */
792        public TaskOutputComponent setValue(org.hl7.fhir.dstu2016may.model.Type value) { 
793          this.value = value;
794          return this;
795        }
796
797        protected void listChildren(List<Property> childrenList) {
798          super.listChildren(childrenList);
799          childrenList.add(new Property("name", "string", "The name of the Output parameter.", 0, java.lang.Integer.MAX_VALUE, name));
800          childrenList.add(new Property("value[x]", "*", "The value of the Output parameter as a basic type.", 0, java.lang.Integer.MAX_VALUE, value));
801        }
802
803      @Override
804      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
805        switch (hash) {
806        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
807        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu2016may.model.Type
808        default: return super.getProperty(hash, name, checkValid);
809        }
810
811      }
812
813      @Override
814      public void setProperty(int hash, String name, Base value) throws FHIRException {
815        switch (hash) {
816        case 3373707: // name
817          this.name = castToString(value); // StringType
818          break;
819        case 111972721: // value
820          this.value = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
821          break;
822        default: super.setProperty(hash, name, value);
823        }
824
825      }
826
827      @Override
828      public void setProperty(String name, Base value) throws FHIRException {
829        if (name.equals("name"))
830          this.name = castToString(value); // StringType
831        else if (name.equals("value[x]"))
832          this.value = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
833        else
834          super.setProperty(name, value);
835      }
836
837      @Override
838      public Base makeProperty(int hash, String name) throws FHIRException {
839        switch (hash) {
840        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
841        case -1410166417:  return getValue(); // org.hl7.fhir.dstu2016may.model.Type
842        default: return super.makeProperty(hash, name);
843        }
844
845      }
846
847      @Override
848      public Base addChild(String name) throws FHIRException {
849        if (name.equals("name")) {
850          throw new FHIRException("Cannot call addChild on a primitive type Task.name");
851        }
852        else if (name.equals("valueBoolean")) {
853          this.value = new BooleanType();
854          return this.value;
855        }
856        else if (name.equals("valueInteger")) {
857          this.value = new IntegerType();
858          return this.value;
859        }
860        else if (name.equals("valueDecimal")) {
861          this.value = new DecimalType();
862          return this.value;
863        }
864        else if (name.equals("valueBase64Binary")) {
865          this.value = new Base64BinaryType();
866          return this.value;
867        }
868        else if (name.equals("valueInstant")) {
869          this.value = new InstantType();
870          return this.value;
871        }
872        else if (name.equals("valueString")) {
873          this.value = new StringType();
874          return this.value;
875        }
876        else if (name.equals("valueUri")) {
877          this.value = new UriType();
878          return this.value;
879        }
880        else if (name.equals("valueDate")) {
881          this.value = new DateType();
882          return this.value;
883        }
884        else if (name.equals("valueDateTime")) {
885          this.value = new DateTimeType();
886          return this.value;
887        }
888        else if (name.equals("valueTime")) {
889          this.value = new TimeType();
890          return this.value;
891        }
892        else if (name.equals("valueCode")) {
893          this.value = new CodeType();
894          return this.value;
895        }
896        else if (name.equals("valueOid")) {
897          this.value = new OidType();
898          return this.value;
899        }
900        else if (name.equals("valueId")) {
901          this.value = new IdType();
902          return this.value;
903        }
904        else if (name.equals("valueUnsignedInt")) {
905          this.value = new UnsignedIntType();
906          return this.value;
907        }
908        else if (name.equals("valuePositiveInt")) {
909          this.value = new PositiveIntType();
910          return this.value;
911        }
912        else if (name.equals("valueMarkdown")) {
913          this.value = new MarkdownType();
914          return this.value;
915        }
916        else if (name.equals("valueAnnotation")) {
917          this.value = new Annotation();
918          return this.value;
919        }
920        else if (name.equals("valueAttachment")) {
921          this.value = new Attachment();
922          return this.value;
923        }
924        else if (name.equals("valueIdentifier")) {
925          this.value = new Identifier();
926          return this.value;
927        }
928        else if (name.equals("valueCodeableConcept")) {
929          this.value = new CodeableConcept();
930          return this.value;
931        }
932        else if (name.equals("valueCoding")) {
933          this.value = new Coding();
934          return this.value;
935        }
936        else if (name.equals("valueQuantity")) {
937          this.value = new Quantity();
938          return this.value;
939        }
940        else if (name.equals("valueRange")) {
941          this.value = new Range();
942          return this.value;
943        }
944        else if (name.equals("valuePeriod")) {
945          this.value = new Period();
946          return this.value;
947        }
948        else if (name.equals("valueRatio")) {
949          this.value = new Ratio();
950          return this.value;
951        }
952        else if (name.equals("valueSampledData")) {
953          this.value = new SampledData();
954          return this.value;
955        }
956        else if (name.equals("valueSignature")) {
957          this.value = new Signature();
958          return this.value;
959        }
960        else if (name.equals("valueHumanName")) {
961          this.value = new HumanName();
962          return this.value;
963        }
964        else if (name.equals("valueAddress")) {
965          this.value = new Address();
966          return this.value;
967        }
968        else if (name.equals("valueContactPoint")) {
969          this.value = new ContactPoint();
970          return this.value;
971        }
972        else if (name.equals("valueTiming")) {
973          this.value = new Timing();
974          return this.value;
975        }
976        else if (name.equals("valueReference")) {
977          this.value = new Reference();
978          return this.value;
979        }
980        else if (name.equals("valueMeta")) {
981          this.value = new Meta();
982          return this.value;
983        }
984        else
985          return super.addChild(name);
986      }
987
988      public TaskOutputComponent copy() {
989        TaskOutputComponent dst = new TaskOutputComponent();
990        copyValues(dst);
991        dst.name = name == null ? null : name.copy();
992        dst.value = value == null ? null : value.copy();
993        return dst;
994      }
995
996      @Override
997      public boolean equalsDeep(Base other) {
998        if (!super.equalsDeep(other))
999          return false;
1000        if (!(other instanceof TaskOutputComponent))
1001          return false;
1002        TaskOutputComponent o = (TaskOutputComponent) other;
1003        return compareDeep(name, o.name, true) && compareDeep(value, o.value, true);
1004      }
1005
1006      @Override
1007      public boolean equalsShallow(Base other) {
1008        if (!super.equalsShallow(other))
1009          return false;
1010        if (!(other instanceof TaskOutputComponent))
1011          return false;
1012        TaskOutputComponent o = (TaskOutputComponent) other;
1013        return compareValues(name, o.name, true);
1014      }
1015
1016      public boolean isEmpty() {
1017        return super.isEmpty() && (name == null || name.isEmpty()) && (value == null || value.isEmpty())
1018          ;
1019      }
1020
1021  public String fhirType() {
1022    return "Task.output";
1023
1024  }
1025
1026  }
1027
1028    /**
1029     * The business identifier for this task.
1030     */
1031    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=false)
1032    @Description(shortDefinition="Task Instance Identifier", formalDefinition="The business identifier for this task." )
1033    protected Identifier identifier;
1034
1035    /**
1036     * A name or code (or both) briefly describing what the task involves.
1037     */
1038    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1039    @Description(shortDefinition="Task Type", formalDefinition="A name or code (or both) briefly describing what the task involves." )
1040    protected CodeableConcept type;
1041
1042    /**
1043     * A description of this task.
1044     */
1045    @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1046    @Description(shortDefinition="Task Description", formalDefinition="A description of this task." )
1047    protected StringType description;
1048
1049    /**
1050     * The type of participant that can execute the task.
1051     */
1052    @Child(name = "performerType", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1053    @Description(shortDefinition="requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer", formalDefinition="The type of participant that can execute the task." )
1054    protected List<Coding> performerType;
1055
1056    /**
1057     * The priority of the task among other tasks of the same type.
1058     */
1059    @Child(name = "priority", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1060    @Description(shortDefinition="low | normal | high", formalDefinition="The priority of the task among other tasks of the same type." )
1061    protected Enumeration<TaskPriority> priority;
1062
1063    /**
1064     * The current status of the task.
1065     */
1066    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1067    @Description(shortDefinition="draft | requested | received | accepted | +", formalDefinition="The current status of the task." )
1068    protected Enumeration<TaskStatus> status;
1069
1070    /**
1071     * An explaination as to why this task failed.
1072     */
1073    @Child(name = "failureReason", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
1074    @Description(shortDefinition="Task Failure Reason", formalDefinition="An explaination as to why this task failed." )
1075    protected CodeableConcept failureReason;
1076
1077    /**
1078     * The subject of the task.
1079     */
1080    @Child(name = "subject", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
1081    @Description(shortDefinition="Task Subject", formalDefinition="The subject of the task." )
1082    protected Reference subject;
1083
1084    /**
1085     * The actual object that is the target of the reference (The subject of the task.)
1086     */
1087    protected Resource subjectTarget;
1088
1089    /**
1090     * The entity who benefits from the performance of the service specified in the task (e.g., the patient).
1091     */
1092    @Child(name = "for", type = {}, order=8, min=0, max=1, modifier=false, summary=true)
1093    @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)." )
1094    protected Reference for_;
1095
1096    /**
1097     * 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).)
1098     */
1099    protected Resource for_Target;
1100
1101    /**
1102     * A reference to a formal or informal definition of the task.
1103     */
1104    @Child(name = "definition", type = {UriType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1105    @Description(shortDefinition="Task Definition", formalDefinition="A reference to a formal or informal definition of the task." )
1106    protected UriType definition;
1107
1108    /**
1109     * The date and time this task was created.
1110     */
1111    @Child(name = "created", type = {DateTimeType.class}, order=10, min=1, max=1, modifier=false, summary=false)
1112    @Description(shortDefinition="Task Creation Date", formalDefinition="The date and time this task was created." )
1113    protected DateTimeType created;
1114
1115    /**
1116     * The date and time of last modification to this task.
1117     */
1118    @Child(name = "lastModified", type = {DateTimeType.class}, order=11, min=1, max=1, modifier=false, summary=true)
1119    @Description(shortDefinition="Task Last Modified Date", formalDefinition="The date and time of last modification to this task." )
1120    protected DateTimeType lastModified;
1121
1122    /**
1123     * The creator of the task.
1124     */
1125    @Child(name = "creator", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=12, min=1, max=1, modifier=false, summary=false)
1126    @Description(shortDefinition="Task Creator", formalDefinition="The creator of the task." )
1127    protected Reference creator;
1128
1129    /**
1130     * The actual object that is the target of the reference (The creator of the task.)
1131     */
1132    protected Resource creatorTarget;
1133
1134    /**
1135     * The owner of this task.  The participant who can execute this task.
1136     */
1137    @Child(name = "owner", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=13, min=0, max=1, modifier=false, summary=false)
1138    @Description(shortDefinition="Task Owner", formalDefinition="The owner of this task.  The participant who can execute this task." )
1139    protected Reference owner;
1140
1141    /**
1142     * The actual object that is the target of the reference (The owner of this task.  The participant who can execute this task.)
1143     */
1144    protected Resource ownerTarget;
1145
1146    /**
1147     * Task that this particular task is part of.
1148     */
1149    @Child(name = "parent", type = {Task.class}, order=14, min=0, max=1, modifier=false, summary=false)
1150    @Description(shortDefinition="Composite task", formalDefinition="Task that this particular task is part of." )
1151    protected Reference parent;
1152
1153    /**
1154     * The actual object that is the target of the reference (Task that this particular task is part of.)
1155     */
1156    protected Task parentTarget;
1157
1158    /**
1159     * Inputs to the task.
1160     */
1161    @Child(name = "input", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1162    @Description(shortDefinition="Task Input", formalDefinition="Inputs to the task." )
1163    protected List<ParameterComponent> input;
1164
1165    /**
1166     * Outputs produced by the Task.
1167     */
1168    @Child(name = "output", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1169    @Description(shortDefinition="Task Output", formalDefinition="Outputs produced by the Task." )
1170    protected List<TaskOutputComponent> output;
1171
1172    private static final long serialVersionUID = 969281174L;
1173
1174  /**
1175   * Constructor
1176   */
1177    public Task() {
1178      super();
1179    }
1180
1181  /**
1182   * Constructor
1183   */
1184    public Task(Enumeration<TaskStatus> status, DateTimeType created, DateTimeType lastModified, Reference creator) {
1185      super();
1186      this.status = status;
1187      this.created = created;
1188      this.lastModified = lastModified;
1189      this.creator = creator;
1190    }
1191
1192    /**
1193     * @return {@link #identifier} (The business identifier for this task.)
1194     */
1195    public Identifier getIdentifier() { 
1196      if (this.identifier == null)
1197        if (Configuration.errorOnAutoCreate())
1198          throw new Error("Attempt to auto-create Task.identifier");
1199        else if (Configuration.doAutoCreate())
1200          this.identifier = new Identifier(); // cc
1201      return this.identifier;
1202    }
1203
1204    public boolean hasIdentifier() { 
1205      return this.identifier != null && !this.identifier.isEmpty();
1206    }
1207
1208    /**
1209     * @param value {@link #identifier} (The business identifier for this task.)
1210     */
1211    public Task setIdentifier(Identifier value) { 
1212      this.identifier = value;
1213      return this;
1214    }
1215
1216    /**
1217     * @return {@link #type} (A name or code (or both) briefly describing what the task involves.)
1218     */
1219    public CodeableConcept getType() { 
1220      if (this.type == null)
1221        if (Configuration.errorOnAutoCreate())
1222          throw new Error("Attempt to auto-create Task.type");
1223        else if (Configuration.doAutoCreate())
1224          this.type = new CodeableConcept(); // cc
1225      return this.type;
1226    }
1227
1228    public boolean hasType() { 
1229      return this.type != null && !this.type.isEmpty();
1230    }
1231
1232    /**
1233     * @param value {@link #type} (A name or code (or both) briefly describing what the task involves.)
1234     */
1235    public Task setType(CodeableConcept value) { 
1236      this.type = value;
1237      return this;
1238    }
1239
1240    /**
1241     * @return {@link #description} (A description of this task.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1242     */
1243    public StringType getDescriptionElement() { 
1244      if (this.description == null)
1245        if (Configuration.errorOnAutoCreate())
1246          throw new Error("Attempt to auto-create Task.description");
1247        else if (Configuration.doAutoCreate())
1248          this.description = new StringType(); // bb
1249      return this.description;
1250    }
1251
1252    public boolean hasDescriptionElement() { 
1253      return this.description != null && !this.description.isEmpty();
1254    }
1255
1256    public boolean hasDescription() { 
1257      return this.description != null && !this.description.isEmpty();
1258    }
1259
1260    /**
1261     * @param value {@link #description} (A description of this task.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1262     */
1263    public Task setDescriptionElement(StringType value) { 
1264      this.description = value;
1265      return this;
1266    }
1267
1268    /**
1269     * @return A description of this task.
1270     */
1271    public String getDescription() { 
1272      return this.description == null ? null : this.description.getValue();
1273    }
1274
1275    /**
1276     * @param value A description of this task.
1277     */
1278    public Task setDescription(String value) { 
1279      if (Utilities.noString(value))
1280        this.description = null;
1281      else {
1282        if (this.description == null)
1283          this.description = new StringType();
1284        this.description.setValue(value);
1285      }
1286      return this;
1287    }
1288
1289    /**
1290     * @return {@link #performerType} (The type of participant that can execute the task.)
1291     */
1292    public List<Coding> getPerformerType() { 
1293      if (this.performerType == null)
1294        this.performerType = new ArrayList<Coding>();
1295      return this.performerType;
1296    }
1297
1298    public boolean hasPerformerType() { 
1299      if (this.performerType == null)
1300        return false;
1301      for (Coding item : this.performerType)
1302        if (!item.isEmpty())
1303          return true;
1304      return false;
1305    }
1306
1307    /**
1308     * @return {@link #performerType} (The type of participant that can execute the task.)
1309     */
1310    // syntactic sugar
1311    public Coding addPerformerType() { //3
1312      Coding t = new Coding();
1313      if (this.performerType == null)
1314        this.performerType = new ArrayList<Coding>();
1315      this.performerType.add(t);
1316      return t;
1317    }
1318
1319    // syntactic sugar
1320    public Task addPerformerType(Coding t) { //3
1321      if (t == null)
1322        return this;
1323      if (this.performerType == null)
1324        this.performerType = new ArrayList<Coding>();
1325      this.performerType.add(t);
1326      return this;
1327    }
1328
1329    /**
1330     * @return {@link #priority} (The priority of the task among other tasks of the same type.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1331     */
1332    public Enumeration<TaskPriority> getPriorityElement() { 
1333      if (this.priority == null)
1334        if (Configuration.errorOnAutoCreate())
1335          throw new Error("Attempt to auto-create Task.priority");
1336        else if (Configuration.doAutoCreate())
1337          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory()); // bb
1338      return this.priority;
1339    }
1340
1341    public boolean hasPriorityElement() { 
1342      return this.priority != null && !this.priority.isEmpty();
1343    }
1344
1345    public boolean hasPriority() { 
1346      return this.priority != null && !this.priority.isEmpty();
1347    }
1348
1349    /**
1350     * @param value {@link #priority} (The priority of the task among other tasks of the same type.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1351     */
1352    public Task setPriorityElement(Enumeration<TaskPriority> value) { 
1353      this.priority = value;
1354      return this;
1355    }
1356
1357    /**
1358     * @return The priority of the task among other tasks of the same type.
1359     */
1360    public TaskPriority getPriority() { 
1361      return this.priority == null ? null : this.priority.getValue();
1362    }
1363
1364    /**
1365     * @param value The priority of the task among other tasks of the same type.
1366     */
1367    public Task setPriority(TaskPriority value) { 
1368      if (value == null)
1369        this.priority = null;
1370      else {
1371        if (this.priority == null)
1372          this.priority = new Enumeration<TaskPriority>(new TaskPriorityEnumFactory());
1373        this.priority.setValue(value);
1374      }
1375      return this;
1376    }
1377
1378    /**
1379     * @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
1380     */
1381    public Enumeration<TaskStatus> getStatusElement() { 
1382      if (this.status == null)
1383        if (Configuration.errorOnAutoCreate())
1384          throw new Error("Attempt to auto-create Task.status");
1385        else if (Configuration.doAutoCreate())
1386          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory()); // bb
1387      return this.status;
1388    }
1389
1390    public boolean hasStatusElement() { 
1391      return this.status != null && !this.status.isEmpty();
1392    }
1393
1394    public boolean hasStatus() { 
1395      return this.status != null && !this.status.isEmpty();
1396    }
1397
1398    /**
1399     * @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
1400     */
1401    public Task setStatusElement(Enumeration<TaskStatus> value) { 
1402      this.status = value;
1403      return this;
1404    }
1405
1406    /**
1407     * @return The current status of the task.
1408     */
1409    public TaskStatus getStatus() { 
1410      return this.status == null ? null : this.status.getValue();
1411    }
1412
1413    /**
1414     * @param value The current status of the task.
1415     */
1416    public Task setStatus(TaskStatus value) { 
1417        if (this.status == null)
1418          this.status = new Enumeration<TaskStatus>(new TaskStatusEnumFactory());
1419        this.status.setValue(value);
1420      return this;
1421    }
1422
1423    /**
1424     * @return {@link #failureReason} (An explaination as to why this task failed.)
1425     */
1426    public CodeableConcept getFailureReason() { 
1427      if (this.failureReason == null)
1428        if (Configuration.errorOnAutoCreate())
1429          throw new Error("Attempt to auto-create Task.failureReason");
1430        else if (Configuration.doAutoCreate())
1431          this.failureReason = new CodeableConcept(); // cc
1432      return this.failureReason;
1433    }
1434
1435    public boolean hasFailureReason() { 
1436      return this.failureReason != null && !this.failureReason.isEmpty();
1437    }
1438
1439    /**
1440     * @param value {@link #failureReason} (An explaination as to why this task failed.)
1441     */
1442    public Task setFailureReason(CodeableConcept value) { 
1443      this.failureReason = value;
1444      return this;
1445    }
1446
1447    /**
1448     * @return {@link #subject} (The subject of the task.)
1449     */
1450    public Reference getSubject() { 
1451      if (this.subject == null)
1452        if (Configuration.errorOnAutoCreate())
1453          throw new Error("Attempt to auto-create Task.subject");
1454        else if (Configuration.doAutoCreate())
1455          this.subject = new Reference(); // cc
1456      return this.subject;
1457    }
1458
1459    public boolean hasSubject() { 
1460      return this.subject != null && !this.subject.isEmpty();
1461    }
1462
1463    /**
1464     * @param value {@link #subject} (The subject of the task.)
1465     */
1466    public Task setSubject(Reference value) { 
1467      this.subject = value;
1468      return this;
1469    }
1470
1471    /**
1472     * @return {@link #subject} 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 subject of the task.)
1473     */
1474    public Resource getSubjectTarget() { 
1475      return this.subjectTarget;
1476    }
1477
1478    /**
1479     * @param value {@link #subject} 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 subject of the task.)
1480     */
1481    public Task setSubjectTarget(Resource value) { 
1482      this.subjectTarget = value;
1483      return this;
1484    }
1485
1486    /**
1487     * @return {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
1488     */
1489    public Reference getFor() { 
1490      if (this.for_ == null)
1491        if (Configuration.errorOnAutoCreate())
1492          throw new Error("Attempt to auto-create Task.for_");
1493        else if (Configuration.doAutoCreate())
1494          this.for_ = new Reference(); // cc
1495      return this.for_;
1496    }
1497
1498    public boolean hasFor() { 
1499      return this.for_ != null && !this.for_.isEmpty();
1500    }
1501
1502    /**
1503     * @param value {@link #for_} (The entity who benefits from the performance of the service specified in the task (e.g., the patient).)
1504     */
1505    public Task setFor(Reference value) { 
1506      this.for_ = value;
1507      return this;
1508    }
1509
1510    /**
1511     * @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).)
1512     */
1513    public Resource getForTarget() { 
1514      return this.for_Target;
1515    }
1516
1517    /**
1518     * @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).)
1519     */
1520    public Task setForTarget(Resource value) { 
1521      this.for_Target = value;
1522      return this;
1523    }
1524
1525    /**
1526     * @return {@link #definition} (A reference to a formal or informal definition of the task.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
1527     */
1528    public UriType getDefinitionElement() { 
1529      if (this.definition == null)
1530        if (Configuration.errorOnAutoCreate())
1531          throw new Error("Attempt to auto-create Task.definition");
1532        else if (Configuration.doAutoCreate())
1533          this.definition = new UriType(); // bb
1534      return this.definition;
1535    }
1536
1537    public boolean hasDefinitionElement() { 
1538      return this.definition != null && !this.definition.isEmpty();
1539    }
1540
1541    public boolean hasDefinition() { 
1542      return this.definition != null && !this.definition.isEmpty();
1543    }
1544
1545    /**
1546     * @param value {@link #definition} (A reference to a formal or informal definition of the task.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
1547     */
1548    public Task setDefinitionElement(UriType value) { 
1549      this.definition = value;
1550      return this;
1551    }
1552
1553    /**
1554     * @return A reference to a formal or informal definition of the task.
1555     */
1556    public String getDefinition() { 
1557      return this.definition == null ? null : this.definition.getValue();
1558    }
1559
1560    /**
1561     * @param value A reference to a formal or informal definition of the task.
1562     */
1563    public Task setDefinition(String value) { 
1564      if (Utilities.noString(value))
1565        this.definition = null;
1566      else {
1567        if (this.definition == null)
1568          this.definition = new UriType();
1569        this.definition.setValue(value);
1570      }
1571      return this;
1572    }
1573
1574    /**
1575     * @return {@link #created} (The date and time this task was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1576     */
1577    public DateTimeType getCreatedElement() { 
1578      if (this.created == null)
1579        if (Configuration.errorOnAutoCreate())
1580          throw new Error("Attempt to auto-create Task.created");
1581        else if (Configuration.doAutoCreate())
1582          this.created = new DateTimeType(); // bb
1583      return this.created;
1584    }
1585
1586    public boolean hasCreatedElement() { 
1587      return this.created != null && !this.created.isEmpty();
1588    }
1589
1590    public boolean hasCreated() { 
1591      return this.created != null && !this.created.isEmpty();
1592    }
1593
1594    /**
1595     * @param value {@link #created} (The date and time this task was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
1596     */
1597    public Task setCreatedElement(DateTimeType value) { 
1598      this.created = value;
1599      return this;
1600    }
1601
1602    /**
1603     * @return The date and time this task was created.
1604     */
1605    public Date getCreated() { 
1606      return this.created == null ? null : this.created.getValue();
1607    }
1608
1609    /**
1610     * @param value The date and time this task was created.
1611     */
1612    public Task setCreated(Date value) { 
1613        if (this.created == null)
1614          this.created = new DateTimeType();
1615        this.created.setValue(value);
1616      return this;
1617    }
1618
1619    /**
1620     * @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
1621     */
1622    public DateTimeType getLastModifiedElement() { 
1623      if (this.lastModified == null)
1624        if (Configuration.errorOnAutoCreate())
1625          throw new Error("Attempt to auto-create Task.lastModified");
1626        else if (Configuration.doAutoCreate())
1627          this.lastModified = new DateTimeType(); // bb
1628      return this.lastModified;
1629    }
1630
1631    public boolean hasLastModifiedElement() { 
1632      return this.lastModified != null && !this.lastModified.isEmpty();
1633    }
1634
1635    public boolean hasLastModified() { 
1636      return this.lastModified != null && !this.lastModified.isEmpty();
1637    }
1638
1639    /**
1640     * @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
1641     */
1642    public Task setLastModifiedElement(DateTimeType value) { 
1643      this.lastModified = value;
1644      return this;
1645    }
1646
1647    /**
1648     * @return The date and time of last modification to this task.
1649     */
1650    public Date getLastModified() { 
1651      return this.lastModified == null ? null : this.lastModified.getValue();
1652    }
1653
1654    /**
1655     * @param value The date and time of last modification to this task.
1656     */
1657    public Task setLastModified(Date value) { 
1658        if (this.lastModified == null)
1659          this.lastModified = new DateTimeType();
1660        this.lastModified.setValue(value);
1661      return this;
1662    }
1663
1664    /**
1665     * @return {@link #creator} (The creator of the task.)
1666     */
1667    public Reference getCreator() { 
1668      if (this.creator == null)
1669        if (Configuration.errorOnAutoCreate())
1670          throw new Error("Attempt to auto-create Task.creator");
1671        else if (Configuration.doAutoCreate())
1672          this.creator = new Reference(); // cc
1673      return this.creator;
1674    }
1675
1676    public boolean hasCreator() { 
1677      return this.creator != null && !this.creator.isEmpty();
1678    }
1679
1680    /**
1681     * @param value {@link #creator} (The creator of the task.)
1682     */
1683    public Task setCreator(Reference value) { 
1684      this.creator = value;
1685      return this;
1686    }
1687
1688    /**
1689     * @return {@link #creator} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The creator of the task.)
1690     */
1691    public Resource getCreatorTarget() { 
1692      return this.creatorTarget;
1693    }
1694
1695    /**
1696     * @param value {@link #creator} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The creator of the task.)
1697     */
1698    public Task setCreatorTarget(Resource value) { 
1699      this.creatorTarget = value;
1700      return this;
1701    }
1702
1703    /**
1704     * @return {@link #owner} (The owner of this task.  The participant who can execute this task.)
1705     */
1706    public Reference getOwner() { 
1707      if (this.owner == null)
1708        if (Configuration.errorOnAutoCreate())
1709          throw new Error("Attempt to auto-create Task.owner");
1710        else if (Configuration.doAutoCreate())
1711          this.owner = new Reference(); // cc
1712      return this.owner;
1713    }
1714
1715    public boolean hasOwner() { 
1716      return this.owner != null && !this.owner.isEmpty();
1717    }
1718
1719    /**
1720     * @param value {@link #owner} (The owner of this task.  The participant who can execute this task.)
1721     */
1722    public Task setOwner(Reference value) { 
1723      this.owner = value;
1724      return this;
1725    }
1726
1727    /**
1728     * @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. (The owner of this task.  The participant who can execute this task.)
1729     */
1730    public Resource getOwnerTarget() { 
1731      return this.ownerTarget;
1732    }
1733
1734    /**
1735     * @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. (The owner of this task.  The participant who can execute this task.)
1736     */
1737    public Task setOwnerTarget(Resource value) { 
1738      this.ownerTarget = value;
1739      return this;
1740    }
1741
1742    /**
1743     * @return {@link #parent} (Task that this particular task is part of.)
1744     */
1745    public Reference getParent() { 
1746      if (this.parent == null)
1747        if (Configuration.errorOnAutoCreate())
1748          throw new Error("Attempt to auto-create Task.parent");
1749        else if (Configuration.doAutoCreate())
1750          this.parent = new Reference(); // cc
1751      return this.parent;
1752    }
1753
1754    public boolean hasParent() { 
1755      return this.parent != null && !this.parent.isEmpty();
1756    }
1757
1758    /**
1759     * @param value {@link #parent} (Task that this particular task is part of.)
1760     */
1761    public Task setParent(Reference value) { 
1762      this.parent = value;
1763      return this;
1764    }
1765
1766    /**
1767     * @return {@link #parent} 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. (Task that this particular task is part of.)
1768     */
1769    public Task getParentTarget() { 
1770      if (this.parentTarget == null)
1771        if (Configuration.errorOnAutoCreate())
1772          throw new Error("Attempt to auto-create Task.parent");
1773        else if (Configuration.doAutoCreate())
1774          this.parentTarget = new Task(); // aa
1775      return this.parentTarget;
1776    }
1777
1778    /**
1779     * @param value {@link #parent} 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. (Task that this particular task is part of.)
1780     */
1781    public Task setParentTarget(Task value) { 
1782      this.parentTarget = value;
1783      return this;
1784    }
1785
1786    /**
1787     * @return {@link #input} (Inputs to the task.)
1788     */
1789    public List<ParameterComponent> getInput() { 
1790      if (this.input == null)
1791        this.input = new ArrayList<ParameterComponent>();
1792      return this.input;
1793    }
1794
1795    public boolean hasInput() { 
1796      if (this.input == null)
1797        return false;
1798      for (ParameterComponent item : this.input)
1799        if (!item.isEmpty())
1800          return true;
1801      return false;
1802    }
1803
1804    /**
1805     * @return {@link #input} (Inputs to the task.)
1806     */
1807    // syntactic sugar
1808    public ParameterComponent addInput() { //3
1809      ParameterComponent t = new ParameterComponent();
1810      if (this.input == null)
1811        this.input = new ArrayList<ParameterComponent>();
1812      this.input.add(t);
1813      return t;
1814    }
1815
1816    // syntactic sugar
1817    public Task addInput(ParameterComponent t) { //3
1818      if (t == null)
1819        return this;
1820      if (this.input == null)
1821        this.input = new ArrayList<ParameterComponent>();
1822      this.input.add(t);
1823      return this;
1824    }
1825
1826    /**
1827     * @return {@link #output} (Outputs produced by the Task.)
1828     */
1829    public List<TaskOutputComponent> getOutput() { 
1830      if (this.output == null)
1831        this.output = new ArrayList<TaskOutputComponent>();
1832      return this.output;
1833    }
1834
1835    public boolean hasOutput() { 
1836      if (this.output == null)
1837        return false;
1838      for (TaskOutputComponent item : this.output)
1839        if (!item.isEmpty())
1840          return true;
1841      return false;
1842    }
1843
1844    /**
1845     * @return {@link #output} (Outputs produced by the Task.)
1846     */
1847    // syntactic sugar
1848    public TaskOutputComponent addOutput() { //3
1849      TaskOutputComponent t = new TaskOutputComponent();
1850      if (this.output == null)
1851        this.output = new ArrayList<TaskOutputComponent>();
1852      this.output.add(t);
1853      return t;
1854    }
1855
1856    // syntactic sugar
1857    public Task addOutput(TaskOutputComponent t) { //3
1858      if (t == null)
1859        return this;
1860      if (this.output == null)
1861        this.output = new ArrayList<TaskOutputComponent>();
1862      this.output.add(t);
1863      return this;
1864    }
1865
1866      protected void listChildren(List<Property> childrenList) {
1867        super.listChildren(childrenList);
1868        childrenList.add(new Property("identifier", "Identifier", "The business identifier for this task.", 0, java.lang.Integer.MAX_VALUE, identifier));
1869        childrenList.add(new Property("type", "CodeableConcept", "A name or code (or both) briefly describing what the task involves.", 0, java.lang.Integer.MAX_VALUE, type));
1870        childrenList.add(new Property("description", "string", "A description of this task.", 0, java.lang.Integer.MAX_VALUE, description));
1871        childrenList.add(new Property("performerType", "Coding", "The type of participant that can execute the task.", 0, java.lang.Integer.MAX_VALUE, performerType));
1872        childrenList.add(new Property("priority", "code", "The priority of the task among other tasks of the same type.", 0, java.lang.Integer.MAX_VALUE, priority));
1873        childrenList.add(new Property("status", "code", "The current status of the task.", 0, java.lang.Integer.MAX_VALUE, status));
1874        childrenList.add(new Property("failureReason", "CodeableConcept", "An explaination as to why this task failed.", 0, java.lang.Integer.MAX_VALUE, failureReason));
1875        childrenList.add(new Property("subject", "Reference(Any)", "The subject of the task.", 0, java.lang.Integer.MAX_VALUE, subject));
1876        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_));
1877        childrenList.add(new Property("definition", "uri", "A reference to a formal or informal definition of the task.", 0, java.lang.Integer.MAX_VALUE, definition));
1878        childrenList.add(new Property("created", "dateTime", "The date and time this task was created.", 0, java.lang.Integer.MAX_VALUE, created));
1879        childrenList.add(new Property("lastModified", "dateTime", "The date and time of last modification to this task.", 0, java.lang.Integer.MAX_VALUE, lastModified));
1880        childrenList.add(new Property("creator", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The creator of the task.", 0, java.lang.Integer.MAX_VALUE, creator));
1881        childrenList.add(new Property("owner", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The owner of this task.  The participant who can execute this task.", 0, java.lang.Integer.MAX_VALUE, owner));
1882        childrenList.add(new Property("parent", "Reference(Task)", "Task that this particular task is part of.", 0, java.lang.Integer.MAX_VALUE, parent));
1883        childrenList.add(new Property("input", "", "Inputs to the task.", 0, java.lang.Integer.MAX_VALUE, input));
1884        childrenList.add(new Property("output", "", "Outputs produced by the Task.", 0, java.lang.Integer.MAX_VALUE, output));
1885      }
1886
1887      @Override
1888      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1889        switch (hash) {
1890        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1891        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1892        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1893        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : this.performerType.toArray(new Base[this.performerType.size()]); // Coding
1894        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<TaskPriority>
1895        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<TaskStatus>
1896        case -1990598546: /*failureReason*/ return this.failureReason == null ? new Base[0] : new Base[] {this.failureReason}; // CodeableConcept
1897        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1898        case 101577: /*for*/ return this.for_ == null ? new Base[0] : new Base[] {this.for_}; // Reference
1899        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
1900        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
1901        case 1959003007: /*lastModified*/ return this.lastModified == null ? new Base[0] : new Base[] {this.lastModified}; // DateTimeType
1902        case 1028554796: /*creator*/ return this.creator == null ? new Base[0] : new Base[] {this.creator}; // Reference
1903        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
1904        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
1905        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // ParameterComponent
1906        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // TaskOutputComponent
1907        default: return super.getProperty(hash, name, checkValid);
1908        }
1909
1910      }
1911
1912      @Override
1913      public void setProperty(int hash, String name, Base value) throws FHIRException {
1914        switch (hash) {
1915        case -1618432855: // identifier
1916          this.identifier = castToIdentifier(value); // Identifier
1917          break;
1918        case 3575610: // type
1919          this.type = castToCodeableConcept(value); // CodeableConcept
1920          break;
1921        case -1724546052: // description
1922          this.description = castToString(value); // StringType
1923          break;
1924        case -901444568: // performerType
1925          this.getPerformerType().add(castToCoding(value)); // Coding
1926          break;
1927        case -1165461084: // priority
1928          this.priority = new TaskPriorityEnumFactory().fromType(value); // Enumeration<TaskPriority>
1929          break;
1930        case -892481550: // status
1931          this.status = new TaskStatusEnumFactory().fromType(value); // Enumeration<TaskStatus>
1932          break;
1933        case -1990598546: // failureReason
1934          this.failureReason = castToCodeableConcept(value); // CodeableConcept
1935          break;
1936        case -1867885268: // subject
1937          this.subject = castToReference(value); // Reference
1938          break;
1939        case 101577: // for
1940          this.for_ = castToReference(value); // Reference
1941          break;
1942        case -1014418093: // definition
1943          this.definition = castToUri(value); // UriType
1944          break;
1945        case 1028554472: // created
1946          this.created = castToDateTime(value); // DateTimeType
1947          break;
1948        case 1959003007: // lastModified
1949          this.lastModified = castToDateTime(value); // DateTimeType
1950          break;
1951        case 1028554796: // creator
1952          this.creator = castToReference(value); // Reference
1953          break;
1954        case 106164915: // owner
1955          this.owner = castToReference(value); // Reference
1956          break;
1957        case -995424086: // parent
1958          this.parent = castToReference(value); // Reference
1959          break;
1960        case 100358090: // input
1961          this.getInput().add((ParameterComponent) value); // ParameterComponent
1962          break;
1963        case -1005512447: // output
1964          this.getOutput().add((TaskOutputComponent) value); // TaskOutputComponent
1965          break;
1966        default: super.setProperty(hash, name, value);
1967        }
1968
1969      }
1970
1971      @Override
1972      public void setProperty(String name, Base value) throws FHIRException {
1973        if (name.equals("identifier"))
1974          this.identifier = castToIdentifier(value); // Identifier
1975        else if (name.equals("type"))
1976          this.type = castToCodeableConcept(value); // CodeableConcept
1977        else if (name.equals("description"))
1978          this.description = castToString(value); // StringType
1979        else if (name.equals("performerType"))
1980          this.getPerformerType().add(castToCoding(value));
1981        else if (name.equals("priority"))
1982          this.priority = new TaskPriorityEnumFactory().fromType(value); // Enumeration<TaskPriority>
1983        else if (name.equals("status"))
1984          this.status = new TaskStatusEnumFactory().fromType(value); // Enumeration<TaskStatus>
1985        else if (name.equals("failureReason"))
1986          this.failureReason = castToCodeableConcept(value); // CodeableConcept
1987        else if (name.equals("subject"))
1988          this.subject = castToReference(value); // Reference
1989        else if (name.equals("for"))
1990          this.for_ = castToReference(value); // Reference
1991        else if (name.equals("definition"))
1992          this.definition = castToUri(value); // UriType
1993        else if (name.equals("created"))
1994          this.created = castToDateTime(value); // DateTimeType
1995        else if (name.equals("lastModified"))
1996          this.lastModified = castToDateTime(value); // DateTimeType
1997        else if (name.equals("creator"))
1998          this.creator = castToReference(value); // Reference
1999        else if (name.equals("owner"))
2000          this.owner = castToReference(value); // Reference
2001        else if (name.equals("parent"))
2002          this.parent = castToReference(value); // Reference
2003        else if (name.equals("input"))
2004          this.getInput().add((ParameterComponent) value);
2005        else if (name.equals("output"))
2006          this.getOutput().add((TaskOutputComponent) value);
2007        else
2008          super.setProperty(name, value);
2009      }
2010
2011      @Override
2012      public Base makeProperty(int hash, String name) throws FHIRException {
2013        switch (hash) {
2014        case -1618432855:  return getIdentifier(); // Identifier
2015        case 3575610:  return getType(); // CodeableConcept
2016        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
2017        case -901444568:  return addPerformerType(); // Coding
2018        case -1165461084: throw new FHIRException("Cannot make property priority as it is not a complex type"); // Enumeration<TaskPriority>
2019        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<TaskStatus>
2020        case -1990598546:  return getFailureReason(); // CodeableConcept
2021        case -1867885268:  return getSubject(); // Reference
2022        case 101577:  return getFor(); // Reference
2023        case -1014418093: throw new FHIRException("Cannot make property definition as it is not a complex type"); // UriType
2024        case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
2025        case 1959003007: throw new FHIRException("Cannot make property lastModified as it is not a complex type"); // DateTimeType
2026        case 1028554796:  return getCreator(); // Reference
2027        case 106164915:  return getOwner(); // Reference
2028        case -995424086:  return getParent(); // Reference
2029        case 100358090:  return addInput(); // ParameterComponent
2030        case -1005512447:  return addOutput(); // TaskOutputComponent
2031        default: return super.makeProperty(hash, name);
2032        }
2033
2034      }
2035
2036      @Override
2037      public Base addChild(String name) throws FHIRException {
2038        if (name.equals("identifier")) {
2039          this.identifier = new Identifier();
2040          return this.identifier;
2041        }
2042        else if (name.equals("type")) {
2043          this.type = new CodeableConcept();
2044          return this.type;
2045        }
2046        else if (name.equals("description")) {
2047          throw new FHIRException("Cannot call addChild on a primitive type Task.description");
2048        }
2049        else if (name.equals("performerType")) {
2050          return addPerformerType();
2051        }
2052        else if (name.equals("priority")) {
2053          throw new FHIRException("Cannot call addChild on a primitive type Task.priority");
2054        }
2055        else if (name.equals("status")) {
2056          throw new FHIRException("Cannot call addChild on a primitive type Task.status");
2057        }
2058        else if (name.equals("failureReason")) {
2059          this.failureReason = new CodeableConcept();
2060          return this.failureReason;
2061        }
2062        else if (name.equals("subject")) {
2063          this.subject = new Reference();
2064          return this.subject;
2065        }
2066        else if (name.equals("for")) {
2067          this.for_ = new Reference();
2068          return this.for_;
2069        }
2070        else if (name.equals("definition")) {
2071          throw new FHIRException("Cannot call addChild on a primitive type Task.definition");
2072        }
2073        else if (name.equals("created")) {
2074          throw new FHIRException("Cannot call addChild on a primitive type Task.created");
2075        }
2076        else if (name.equals("lastModified")) {
2077          throw new FHIRException("Cannot call addChild on a primitive type Task.lastModified");
2078        }
2079        else if (name.equals("creator")) {
2080          this.creator = new Reference();
2081          return this.creator;
2082        }
2083        else if (name.equals("owner")) {
2084          this.owner = new Reference();
2085          return this.owner;
2086        }
2087        else if (name.equals("parent")) {
2088          this.parent = new Reference();
2089          return this.parent;
2090        }
2091        else if (name.equals("input")) {
2092          return addInput();
2093        }
2094        else if (name.equals("output")) {
2095          return addOutput();
2096        }
2097        else
2098          return super.addChild(name);
2099      }
2100
2101  public String fhirType() {
2102    return "Task";
2103
2104  }
2105
2106      public Task copy() {
2107        Task dst = new Task();
2108        copyValues(dst);
2109        dst.identifier = identifier == null ? null : identifier.copy();
2110        dst.type = type == null ? null : type.copy();
2111        dst.description = description == null ? null : description.copy();
2112        if (performerType != null) {
2113          dst.performerType = new ArrayList<Coding>();
2114          for (Coding i : performerType)
2115            dst.performerType.add(i.copy());
2116        };
2117        dst.priority = priority == null ? null : priority.copy();
2118        dst.status = status == null ? null : status.copy();
2119        dst.failureReason = failureReason == null ? null : failureReason.copy();
2120        dst.subject = subject == null ? null : subject.copy();
2121        dst.for_ = for_ == null ? null : for_.copy();
2122        dst.definition = definition == null ? null : definition.copy();
2123        dst.created = created == null ? null : created.copy();
2124        dst.lastModified = lastModified == null ? null : lastModified.copy();
2125        dst.creator = creator == null ? null : creator.copy();
2126        dst.owner = owner == null ? null : owner.copy();
2127        dst.parent = parent == null ? null : parent.copy();
2128        if (input != null) {
2129          dst.input = new ArrayList<ParameterComponent>();
2130          for (ParameterComponent i : input)
2131            dst.input.add(i.copy());
2132        };
2133        if (output != null) {
2134          dst.output = new ArrayList<TaskOutputComponent>();
2135          for (TaskOutputComponent i : output)
2136            dst.output.add(i.copy());
2137        };
2138        return dst;
2139      }
2140
2141      protected Task typedCopy() {
2142        return copy();
2143      }
2144
2145      @Override
2146      public boolean equalsDeep(Base other) {
2147        if (!super.equalsDeep(other))
2148          return false;
2149        if (!(other instanceof Task))
2150          return false;
2151        Task o = (Task) other;
2152        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(description, o.description, true)
2153           && compareDeep(performerType, o.performerType, true) && compareDeep(priority, o.priority, true)
2154           && compareDeep(status, o.status, true) && compareDeep(failureReason, o.failureReason, true) && compareDeep(subject, o.subject, true)
2155           && compareDeep(for_, o.for_, true) && compareDeep(definition, o.definition, true) && compareDeep(created, o.created, true)
2156           && compareDeep(lastModified, o.lastModified, true) && compareDeep(creator, o.creator, true) && compareDeep(owner, o.owner, true)
2157           && compareDeep(parent, o.parent, true) && compareDeep(input, o.input, true) && compareDeep(output, o.output, true)
2158          ;
2159      }
2160
2161      @Override
2162      public boolean equalsShallow(Base other) {
2163        if (!super.equalsShallow(other))
2164          return false;
2165        if (!(other instanceof Task))
2166          return false;
2167        Task o = (Task) other;
2168        return compareValues(description, o.description, true) && compareValues(priority, o.priority, true)
2169           && compareValues(status, o.status, true) && compareValues(definition, o.definition, true) && compareValues(created, o.created, true)
2170           && compareValues(lastModified, o.lastModified, true);
2171      }
2172
2173      public boolean isEmpty() {
2174        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (type == null || type.isEmpty())
2175           && (description == null || description.isEmpty()) && (performerType == null || performerType.isEmpty())
2176           && (priority == null || priority.isEmpty()) && (status == null || status.isEmpty()) && (failureReason == null || failureReason.isEmpty())
2177           && (subject == null || subject.isEmpty()) && (for_ == null || for_.isEmpty()) && (definition == null || definition.isEmpty())
2178           && (created == null || created.isEmpty()) && (lastModified == null || lastModified.isEmpty())
2179           && (creator == null || creator.isEmpty()) && (owner == null || owner.isEmpty()) && (parent == null || parent.isEmpty())
2180           && (input == null || input.isEmpty()) && (output == null || output.isEmpty());
2181      }
2182
2183  @Override
2184  public ResourceType getResourceType() {
2185    return ResourceType.Task;
2186   }
2187
2188 /**
2189   * Search parameter: <b>definition</b>
2190   * <p>
2191   * Description: <b>Search by task definition</b><br>
2192   * Type: <b>uri</b><br>
2193   * Path: <b>Task.definition</b><br>
2194   * </p>
2195   */
2196  @SearchParamDefinition(name="definition", path="Task.definition", description="Search by task definition", type="uri" )
2197  public static final String SP_DEFINITION = "definition";
2198 /**
2199   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
2200   * <p>
2201   * Description: <b>Search by task definition</b><br>
2202   * Type: <b>uri</b><br>
2203   * Path: <b>Task.definition</b><br>
2204   * </p>
2205   */
2206  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DEFINITION);
2207
2208 /**
2209   * Search parameter: <b>status</b>
2210   * <p>
2211   * Description: <b>Search by task status</b><br>
2212   * Type: <b>token</b><br>
2213   * Path: <b>Task.status</b><br>
2214   * </p>
2215   */
2216  @SearchParamDefinition(name="status", path="Task.status", description="Search by task status", type="token" )
2217  public static final String SP_STATUS = "status";
2218 /**
2219   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2220   * <p>
2221   * Description: <b>Search by task status</b><br>
2222   * Type: <b>token</b><br>
2223   * Path: <b>Task.status</b><br>
2224   * </p>
2225   */
2226  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2227
2228 /**
2229   * Search parameter: <b>subject</b>
2230   * <p>
2231   * Description: <b>Search by task subject</b><br>
2232   * Type: <b>reference</b><br>
2233   * Path: <b>Task.subject</b><br>
2234   * </p>
2235   */
2236  @SearchParamDefinition(name="subject", path="Task.subject", description="Search by task subject", type="reference" )
2237  public static final String SP_SUBJECT = "subject";
2238 /**
2239   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2240   * <p>
2241   * Description: <b>Search by task subject</b><br>
2242   * Type: <b>reference</b><br>
2243   * Path: <b>Task.subject</b><br>
2244   * </p>
2245   */
2246  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2247
2248/**
2249   * Constant for fluent queries to be used to add include statements. Specifies
2250   * the path value of "<b>Task:subject</b>".
2251   */
2252  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Task:subject").toLocked();
2253
2254 /**
2255   * Search parameter: <b>parent</b>
2256   * <p>
2257   * Description: <b>Search by parent task</b><br>
2258   * Type: <b>reference</b><br>
2259   * Path: <b>Task.parent</b><br>
2260   * </p>
2261   */
2262  @SearchParamDefinition(name="parent", path="Task.parent", description="Search by parent task", type="reference" )
2263  public static final String SP_PARENT = "parent";
2264 /**
2265   * <b>Fluent Client</b> search parameter constant for <b>parent</b>
2266   * <p>
2267   * Description: <b>Search by parent task</b><br>
2268   * Type: <b>reference</b><br>
2269   * Path: <b>Task.parent</b><br>
2270   * </p>
2271   */
2272  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT);
2273
2274/**
2275   * Constant for fluent queries to be used to add include statements. Specifies
2276   * the path value of "<b>Task:parent</b>".
2277   */
2278  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("Task:parent").toLocked();
2279
2280 /**
2281   * Search parameter: <b>type</b>
2282   * <p>
2283   * Description: <b>Search by task type</b><br>
2284   * Type: <b>token</b><br>
2285   * Path: <b>Task.type</b><br>
2286   * </p>
2287   */
2288  @SearchParamDefinition(name="type", path="Task.type", description="Search by task type", type="token" )
2289  public static final String SP_TYPE = "type";
2290 /**
2291   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2292   * <p>
2293   * Description: <b>Search by task type</b><br>
2294   * Type: <b>token</b><br>
2295   * Path: <b>Task.type</b><br>
2296   * </p>
2297   */
2298  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2299
2300 /**
2301   * Search parameter: <b>modified</b>
2302   * <p>
2303   * Description: <b>Search by last modification date</b><br>
2304   * Type: <b>date</b><br>
2305   * Path: <b>Task.lastModified</b><br>
2306   * </p>
2307   */
2308  @SearchParamDefinition(name="modified", path="Task.lastModified", description="Search by last modification date", type="date" )
2309  public static final String SP_MODIFIED = "modified";
2310 /**
2311   * <b>Fluent Client</b> search parameter constant for <b>modified</b>
2312   * <p>
2313   * Description: <b>Search by last modification date</b><br>
2314   * Type: <b>date</b><br>
2315   * Path: <b>Task.lastModified</b><br>
2316   * </p>
2317   */
2318  public static final ca.uhn.fhir.rest.gclient.DateClientParam MODIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_MODIFIED);
2319
2320 /**
2321   * Search parameter: <b>creator</b>
2322   * <p>
2323   * Description: <b>Search by task creator</b><br>
2324   * Type: <b>reference</b><br>
2325   * Path: <b>Task.creator</b><br>
2326   * </p>
2327   */
2328  @SearchParamDefinition(name="creator", path="Task.creator", description="Search by task creator", type="reference" )
2329  public static final String SP_CREATOR = "creator";
2330 /**
2331   * <b>Fluent Client</b> search parameter constant for <b>creator</b>
2332   * <p>
2333   * Description: <b>Search by task creator</b><br>
2334   * Type: <b>reference</b><br>
2335   * Path: <b>Task.creator</b><br>
2336   * </p>
2337   */
2338  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CREATOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CREATOR);
2339
2340/**
2341   * Constant for fluent queries to be used to add include statements. Specifies
2342   * the path value of "<b>Task:creator</b>".
2343   */
2344  public static final ca.uhn.fhir.model.api.Include INCLUDE_CREATOR = new ca.uhn.fhir.model.api.Include("Task:creator").toLocked();
2345
2346 /**
2347   * Search parameter: <b>failure</b>
2348   * <p>
2349   * Description: <b>Search by failure reason</b><br>
2350   * Type: <b>token</b><br>
2351   * Path: <b>Task.failureReason</b><br>
2352   * </p>
2353   */
2354  @SearchParamDefinition(name="failure", path="Task.failureReason", description="Search by failure reason", type="token" )
2355  public static final String SP_FAILURE = "failure";
2356 /**
2357   * <b>Fluent Client</b> search parameter constant for <b>failure</b>
2358   * <p>
2359   * Description: <b>Search by failure reason</b><br>
2360   * Type: <b>token</b><br>
2361   * Path: <b>Task.failureReason</b><br>
2362   * </p>
2363   */
2364  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FAILURE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FAILURE);
2365
2366 /**
2367   * Search parameter: <b>created</b>
2368   * <p>
2369   * Description: <b>Search by creation date</b><br>
2370   * Type: <b>date</b><br>
2371   * Path: <b>Task.created</b><br>
2372   * </p>
2373   */
2374  @SearchParamDefinition(name="created", path="Task.created", description="Search by creation date", type="date" )
2375  public static final String SP_CREATED = "created";
2376 /**
2377   * <b>Fluent Client</b> search parameter constant for <b>created</b>
2378   * <p>
2379   * Description: <b>Search by creation date</b><br>
2380   * Type: <b>date</b><br>
2381   * Path: <b>Task.created</b><br>
2382   * </p>
2383   */
2384  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
2385
2386 /**
2387   * Search parameter: <b>priority</b>
2388   * <p>
2389   * Description: <b>Search by task priority</b><br>
2390   * Type: <b>token</b><br>
2391   * Path: <b>Task.priority</b><br>
2392   * </p>
2393   */
2394  @SearchParamDefinition(name="priority", path="Task.priority", description="Search by task priority", type="token" )
2395  public static final String SP_PRIORITY = "priority";
2396 /**
2397   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
2398   * <p>
2399   * Description: <b>Search by task priority</b><br>
2400   * Type: <b>token</b><br>
2401   * Path: <b>Task.priority</b><br>
2402   * </p>
2403   */
2404  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
2405
2406 /**
2407   * Search parameter: <b>owner</b>
2408   * <p>
2409   * Description: <b>Search by task owner</b><br>
2410   * Type: <b>reference</b><br>
2411   * Path: <b>Task.owner</b><br>
2412   * </p>
2413   */
2414  @SearchParamDefinition(name="owner", path="Task.owner", description="Search by task owner", type="reference" )
2415  public static final String SP_OWNER = "owner";
2416 /**
2417   * <b>Fluent Client</b> search parameter constant for <b>owner</b>
2418   * <p>
2419   * Description: <b>Search by task owner</b><br>
2420   * Type: <b>reference</b><br>
2421   * Path: <b>Task.owner</b><br>
2422   * </p>
2423   */
2424  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
2425
2426/**
2427   * Constant for fluent queries to be used to add include statements. Specifies
2428   * the path value of "<b>Task:owner</b>".
2429   */
2430  public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Task:owner").toLocked();
2431
2432 /**
2433   * Search parameter: <b>performer</b>
2434   * <p>
2435   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
2436   * Type: <b>token</b><br>
2437   * Path: <b>Task.performerType</b><br>
2438   * </p>
2439   */
2440  @SearchParamDefinition(name="performer", path="Task.performerType", description="Search by recommended type of performer (e.g., Requester, Performer, Scheduler).", type="token" )
2441  public static final String SP_PERFORMER = "performer";
2442 /**
2443   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
2444   * <p>
2445   * Description: <b>Search by recommended type of performer (e.g., Requester, Performer, Scheduler).</b><br>
2446   * Type: <b>token</b><br>
2447   * Path: <b>Task.performerType</b><br>
2448   * </p>
2449   */
2450  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PERFORMER);
2451
2452 /**
2453   * Search parameter: <b>identifier</b>
2454   * <p>
2455   * Description: <b>Search for a task instance by its business identifier</b><br>
2456   * Type: <b>token</b><br>
2457   * Path: <b>Task.identifier</b><br>
2458   * </p>
2459   */
2460  @SearchParamDefinition(name="identifier", path="Task.identifier", description="Search for a task instance by its business identifier", type="token" )
2461  public static final String SP_IDENTIFIER = "identifier";
2462 /**
2463   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2464   * <p>
2465   * Description: <b>Search for a task instance by its business identifier</b><br>
2466   * Type: <b>token</b><br>
2467   * Path: <b>Task.identifier</b><br>
2468   * </p>
2469   */
2470  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2471
2472
2473}
2474