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