001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045/**
046 * Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.
047 */
048@ResourceDef(name="Goal", profile="http://hl7.org/fhir/Profile/Goal")
049public class Goal extends DomainResource {
050
051    public enum GoalStatus {
052        /**
053         * A goal is proposed for this patient
054         */
055        PROPOSED, 
056        /**
057         * A goal is planned for this patient
058         */
059        PLANNED, 
060        /**
061         * A proposed goal was accepted
062         */
063        ACCEPTED, 
064        /**
065         * A proposed goal was rejected
066         */
067        REJECTED, 
068        /**
069         * The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)
070         */
071        INPROGRESS, 
072        /**
073         * The goal has been met and no further action is needed
074         */
075        ACHIEVED, 
076        /**
077         * The goal has been met, but ongoing activity is needed to sustain the goal objective
078         */
079        SUSTAINING, 
080        /**
081         * The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.
082         */
083        ONHOLD, 
084        /**
085         * The goal is no longer being sought
086         */
087        CANCELLED, 
088        /**
089         * added to help the parsers
090         */
091        NULL;
092        public static GoalStatus fromCode(String codeString) throws FHIRException {
093            if (codeString == null || "".equals(codeString))
094                return null;
095        if ("proposed".equals(codeString))
096          return PROPOSED;
097        if ("planned".equals(codeString))
098          return PLANNED;
099        if ("accepted".equals(codeString))
100          return ACCEPTED;
101        if ("rejected".equals(codeString))
102          return REJECTED;
103        if ("in-progress".equals(codeString))
104          return INPROGRESS;
105        if ("achieved".equals(codeString))
106          return ACHIEVED;
107        if ("sustaining".equals(codeString))
108          return SUSTAINING;
109        if ("on-hold".equals(codeString))
110          return ONHOLD;
111        if ("cancelled".equals(codeString))
112          return CANCELLED;
113        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
114        }
115        public String toCode() {
116          switch (this) {
117            case PROPOSED: return "proposed";
118            case PLANNED: return "planned";
119            case ACCEPTED: return "accepted";
120            case REJECTED: return "rejected";
121            case INPROGRESS: return "in-progress";
122            case ACHIEVED: return "achieved";
123            case SUSTAINING: return "sustaining";
124            case ONHOLD: return "on-hold";
125            case CANCELLED: return "cancelled";
126            default: return "?";
127          }
128        }
129        public String getSystem() {
130          switch (this) {
131            case PROPOSED: return "http://hl7.org/fhir/goal-status";
132            case PLANNED: return "http://hl7.org/fhir/goal-status";
133            case ACCEPTED: return "http://hl7.org/fhir/goal-status";
134            case REJECTED: return "http://hl7.org/fhir/goal-status";
135            case INPROGRESS: return "http://hl7.org/fhir/goal-status";
136            case ACHIEVED: return "http://hl7.org/fhir/goal-status";
137            case SUSTAINING: return "http://hl7.org/fhir/goal-status";
138            case ONHOLD: return "http://hl7.org/fhir/goal-status";
139            case CANCELLED: return "http://hl7.org/fhir/goal-status";
140            default: return "?";
141          }
142        }
143        public String getDefinition() {
144          switch (this) {
145            case PROPOSED: return "A goal is proposed for this patient";
146            case PLANNED: return "A goal is planned for this patient";
147            case ACCEPTED: return "A proposed goal was accepted";
148            case REJECTED: return "A proposed goal was rejected";
149            case INPROGRESS: return "The goal is being sought but has not yet been reached.  (Also applies if goal was reached in the past but there has been regression and goal is being sought again)";
150            case ACHIEVED: return "The goal has been met and no further action is needed";
151            case SUSTAINING: return "The goal has been met, but ongoing activity is needed to sustain the goal objective";
152            case ONHOLD: return "The goal remains a long term objective but is no longer being actively pursued for a temporary period of time.";
153            case CANCELLED: return "The goal is no longer being sought";
154            default: return "?";
155          }
156        }
157        public String getDisplay() {
158          switch (this) {
159            case PROPOSED: return "Proposed";
160            case PLANNED: return "Planned";
161            case ACCEPTED: return "Accepted";
162            case REJECTED: return "Rejected";
163            case INPROGRESS: return "In Progress";
164            case ACHIEVED: return "Achieved";
165            case SUSTAINING: return "Sustaining";
166            case ONHOLD: return "On Hold";
167            case CANCELLED: return "Cancelled";
168            default: return "?";
169          }
170        }
171    }
172
173  public static class GoalStatusEnumFactory implements EnumFactory<GoalStatus> {
174    public GoalStatus fromCode(String codeString) throws IllegalArgumentException {
175      if (codeString == null || "".equals(codeString))
176            if (codeString == null || "".equals(codeString))
177                return null;
178        if ("proposed".equals(codeString))
179          return GoalStatus.PROPOSED;
180        if ("planned".equals(codeString))
181          return GoalStatus.PLANNED;
182        if ("accepted".equals(codeString))
183          return GoalStatus.ACCEPTED;
184        if ("rejected".equals(codeString))
185          return GoalStatus.REJECTED;
186        if ("in-progress".equals(codeString))
187          return GoalStatus.INPROGRESS;
188        if ("achieved".equals(codeString))
189          return GoalStatus.ACHIEVED;
190        if ("sustaining".equals(codeString))
191          return GoalStatus.SUSTAINING;
192        if ("on-hold".equals(codeString))
193          return GoalStatus.ONHOLD;
194        if ("cancelled".equals(codeString))
195          return GoalStatus.CANCELLED;
196        throw new IllegalArgumentException("Unknown GoalStatus code '"+codeString+"'");
197        }
198        public Enumeration<GoalStatus> fromType(Base code) throws FHIRException {
199          if (code == null || code.isEmpty())
200            return null;
201          String codeString = ((PrimitiveType) code).asStringValue();
202          if (codeString == null || "".equals(codeString))
203            return null;
204        if ("proposed".equals(codeString))
205          return new Enumeration<GoalStatus>(this, GoalStatus.PROPOSED);
206        if ("planned".equals(codeString))
207          return new Enumeration<GoalStatus>(this, GoalStatus.PLANNED);
208        if ("accepted".equals(codeString))
209          return new Enumeration<GoalStatus>(this, GoalStatus.ACCEPTED);
210        if ("rejected".equals(codeString))
211          return new Enumeration<GoalStatus>(this, GoalStatus.REJECTED);
212        if ("in-progress".equals(codeString))
213          return new Enumeration<GoalStatus>(this, GoalStatus.INPROGRESS);
214        if ("achieved".equals(codeString))
215          return new Enumeration<GoalStatus>(this, GoalStatus.ACHIEVED);
216        if ("sustaining".equals(codeString))
217          return new Enumeration<GoalStatus>(this, GoalStatus.SUSTAINING);
218        if ("on-hold".equals(codeString))
219          return new Enumeration<GoalStatus>(this, GoalStatus.ONHOLD);
220        if ("cancelled".equals(codeString))
221          return new Enumeration<GoalStatus>(this, GoalStatus.CANCELLED);
222        throw new FHIRException("Unknown GoalStatus code '"+codeString+"'");
223        }
224    public String toCode(GoalStatus code) {
225      if (code == GoalStatus.PROPOSED)
226        return "proposed";
227      if (code == GoalStatus.PLANNED)
228        return "planned";
229      if (code == GoalStatus.ACCEPTED)
230        return "accepted";
231      if (code == GoalStatus.REJECTED)
232        return "rejected";
233      if (code == GoalStatus.INPROGRESS)
234        return "in-progress";
235      if (code == GoalStatus.ACHIEVED)
236        return "achieved";
237      if (code == GoalStatus.SUSTAINING)
238        return "sustaining";
239      if (code == GoalStatus.ONHOLD)
240        return "on-hold";
241      if (code == GoalStatus.CANCELLED)
242        return "cancelled";
243      return "?";
244      }
245    public String toSystem(GoalStatus code) {
246      return code.getSystem();
247      }
248    }
249
250    @Block()
251    public static class GoalOutcomeComponent extends BackboneElement implements IBaseBackboneElement {
252        /**
253         * Details of what's changed (or not changed).
254         */
255        @Child(name = "result", type = {CodeableConcept.class, Observation.class}, order=1, min=0, max=1, modifier=false, summary=false)
256        @Description(shortDefinition="Code or observation that resulted from goal", formalDefinition="Details of what's changed (or not changed)." )
257        protected Type result;
258
259        private static final long serialVersionUID = 1994317639L;
260
261    /**
262     * Constructor
263     */
264      public GoalOutcomeComponent() {
265        super();
266      }
267
268        /**
269         * @return {@link #result} (Details of what's changed (or not changed).)
270         */
271        public Type getResult() { 
272          return this.result;
273        }
274
275        /**
276         * @return {@link #result} (Details of what's changed (or not changed).)
277         */
278        public CodeableConcept getResultCodeableConcept() throws FHIRException { 
279          if (!(this.result instanceof CodeableConcept))
280            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.result.getClass().getName()+" was encountered");
281          return (CodeableConcept) this.result;
282        }
283
284        public boolean hasResultCodeableConcept() { 
285          return this.result instanceof CodeableConcept;
286        }
287
288        /**
289         * @return {@link #result} (Details of what's changed (or not changed).)
290         */
291        public Reference getResultReference() throws FHIRException { 
292          if (!(this.result instanceof Reference))
293            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.result.getClass().getName()+" was encountered");
294          return (Reference) this.result;
295        }
296
297        public boolean hasResultReference() { 
298          return this.result instanceof Reference;
299        }
300
301        public boolean hasResult() { 
302          return this.result != null && !this.result.isEmpty();
303        }
304
305        /**
306         * @param value {@link #result} (Details of what's changed (or not changed).)
307         */
308        public GoalOutcomeComponent setResult(Type value) { 
309          this.result = value;
310          return this;
311        }
312
313        protected void listChildren(List<Property> childrenList) {
314          super.listChildren(childrenList);
315          childrenList.add(new Property("result[x]", "CodeableConcept|Reference(Observation)", "Details of what's changed (or not changed).", 0, java.lang.Integer.MAX_VALUE, result));
316        }
317
318      @Override
319      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
320        switch (hash) {
321        case -934426595: /*result*/ return this.result == null ? new Base[0] : new Base[] {this.result}; // Type
322        default: return super.getProperty(hash, name, checkValid);
323        }
324
325      }
326
327      @Override
328      public void setProperty(int hash, String name, Base value) throws FHIRException {
329        switch (hash) {
330        case -934426595: // result
331          this.result = (Type) value; // Type
332          break;
333        default: super.setProperty(hash, name, value);
334        }
335
336      }
337
338      @Override
339      public void setProperty(String name, Base value) throws FHIRException {
340        if (name.equals("result[x]"))
341          this.result = (Type) value; // Type
342        else
343          super.setProperty(name, value);
344      }
345
346      @Override
347      public Base makeProperty(int hash, String name) throws FHIRException {
348        switch (hash) {
349        case -1819555005:  return getResult(); // Type
350        default: return super.makeProperty(hash, name);
351        }
352
353      }
354
355      @Override
356      public Base addChild(String name) throws FHIRException {
357        if (name.equals("resultCodeableConcept")) {
358          this.result = new CodeableConcept();
359          return this.result;
360        }
361        else if (name.equals("resultReference")) {
362          this.result = new Reference();
363          return this.result;
364        }
365        else
366          return super.addChild(name);
367      }
368
369      public GoalOutcomeComponent copy() {
370        GoalOutcomeComponent dst = new GoalOutcomeComponent();
371        copyValues(dst);
372        dst.result = result == null ? null : result.copy();
373        return dst;
374      }
375
376      @Override
377      public boolean equalsDeep(Base other) {
378        if (!super.equalsDeep(other))
379          return false;
380        if (!(other instanceof GoalOutcomeComponent))
381          return false;
382        GoalOutcomeComponent o = (GoalOutcomeComponent) other;
383        return compareDeep(result, o.result, true);
384      }
385
386      @Override
387      public boolean equalsShallow(Base other) {
388        if (!super.equalsShallow(other))
389          return false;
390        if (!(other instanceof GoalOutcomeComponent))
391          return false;
392        GoalOutcomeComponent o = (GoalOutcomeComponent) other;
393        return true;
394      }
395
396      public boolean isEmpty() {
397        return super.isEmpty() && (result == null || result.isEmpty());
398      }
399
400  public String fhirType() {
401    return "Goal.outcome";
402
403  }
404
405  }
406
407    /**
408     * This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
409     */
410    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
411    @Description(shortDefinition="External Ids for this goal", formalDefinition="This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
412    protected List<Identifier> identifier;
413
414    /**
415     * Identifies the patient, group or organization for whom the goal is being established.
416     */
417    @Child(name = "subject", type = {Patient.class, Group.class, Organization.class}, order=1, min=0, max=1, modifier=false, summary=true)
418    @Description(shortDefinition="Who this goal is intended for", formalDefinition="Identifies the patient, group or organization for whom the goal is being established." )
419    protected Reference subject;
420
421    /**
422     * The actual object that is the target of the reference (Identifies the patient, group or organization for whom the goal is being established.)
423     */
424    protected Resource subjectTarget;
425
426    /**
427     * The date or event after which the goal should begin being pursued.
428     */
429    @Child(name = "start", type = {DateType.class, CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
430    @Description(shortDefinition="When goal pursuit begins", formalDefinition="The date or event after which the goal should begin being pursued." )
431    protected Type start;
432
433    /**
434     * Indicates either the date or the duration after start by which the goal should be met.
435     */
436    @Child(name = "target", type = {DateType.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
437    @Description(shortDefinition="Reach goal on or before", formalDefinition="Indicates either the date or the duration after start by which the goal should be met." )
438    protected Type target;
439
440    /**
441     * Indicates a category the goal falls within.
442     */
443    @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
444    @Description(shortDefinition="E.g. Treatment, dietary, behavioral, etc.", formalDefinition="Indicates a category the goal falls within." )
445    protected List<CodeableConcept> category;
446
447    /**
448     * Human-readable description of a specific desired objective of care.
449     */
450    @Child(name = "description", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
451    @Description(shortDefinition="What's the desired outcome?", formalDefinition="Human-readable description of a specific desired objective of care." )
452    protected StringType description;
453
454    /**
455     * Indicates whether the goal has been reached and is still considered relevant.
456     */
457    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
458    @Description(shortDefinition="proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled", formalDefinition="Indicates whether the goal has been reached and is still considered relevant." )
459    protected Enumeration<GoalStatus> status;
460
461    /**
462     * Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
463     */
464    @Child(name = "statusDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=true)
465    @Description(shortDefinition="When goal status took effect", formalDefinition="Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc." )
466    protected DateType statusDate;
467
468    /**
469     * Captures the reason for the current status.
470     */
471    @Child(name = "statusReason", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
472    @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current status." )
473    protected CodeableConcept statusReason;
474
475    /**
476     * Indicates whose goal this is - patient goal, practitioner goal, etc.
477     */
478    @Child(name = "author", type = {Patient.class, Practitioner.class, RelatedPerson.class}, order=9, min=0, max=1, modifier=false, summary=true)
479    @Description(shortDefinition="Who's responsible for creating Goal?", formalDefinition="Indicates whose goal this is - patient goal, practitioner goal, etc." )
480    protected Reference author;
481
482    /**
483     * The actual object that is the target of the reference (Indicates whose goal this is - patient goal, practitioner goal, etc.)
484     */
485    protected Resource authorTarget;
486
487    /**
488     * Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.
489     */
490    @Child(name = "priority", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
491    @Description(shortDefinition="high | medium |low", formalDefinition="Identifies the mutually agreed level of importance associated with reaching/sustaining the goal." )
492    protected CodeableConcept priority;
493
494    /**
495     * The identified conditions and other health record elements that are intended to be addressed by the goal.
496     */
497    @Child(name = "addresses", type = {Condition.class, Observation.class, MedicationStatement.class, NutritionOrder.class, ProcedureRequest.class, RiskAssessment.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
498    @Description(shortDefinition="Issues addressed by this goal", formalDefinition="The identified conditions and other health record elements that are intended to be addressed by the goal." )
499    protected List<Reference> addresses;
500    /**
501     * The actual objects that are the target of the reference (The identified conditions and other health record elements that are intended to be addressed by the goal.)
502     */
503    protected List<Resource> addressesTarget;
504
505
506    /**
507     * Any comments related to the goal.
508     */
509    @Child(name = "note", type = {Annotation.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
510    @Description(shortDefinition="Comments about the goal", formalDefinition="Any comments related to the goal." )
511    protected List<Annotation> note;
512
513    /**
514     * Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.
515     */
516    @Child(name = "outcome", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
517    @Description(shortDefinition="What was end result of goal?", formalDefinition="Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved." )
518    protected List<GoalOutcomeComponent> outcome;
519
520    private static final long serialVersionUID = 2029459056L;
521
522  /**
523   * Constructor
524   */
525    public Goal() {
526      super();
527    }
528
529  /**
530   * Constructor
531   */
532    public Goal(StringType description, Enumeration<GoalStatus> status) {
533      super();
534      this.description = description;
535      this.status = status;
536    }
537
538    /**
539     * @return {@link #identifier} (This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
540     */
541    public List<Identifier> getIdentifier() { 
542      if (this.identifier == null)
543        this.identifier = new ArrayList<Identifier>();
544      return this.identifier;
545    }
546
547    public boolean hasIdentifier() { 
548      if (this.identifier == null)
549        return false;
550      for (Identifier item : this.identifier)
551        if (!item.isEmpty())
552          return true;
553      return false;
554    }
555
556    /**
557     * @return {@link #identifier} (This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
558     */
559    // syntactic sugar
560    public Identifier addIdentifier() { //3
561      Identifier t = new Identifier();
562      if (this.identifier == null)
563        this.identifier = new ArrayList<Identifier>();
564      this.identifier.add(t);
565      return t;
566    }
567
568    // syntactic sugar
569    public Goal addIdentifier(Identifier t) { //3
570      if (t == null)
571        return this;
572      if (this.identifier == null)
573        this.identifier = new ArrayList<Identifier>();
574      this.identifier.add(t);
575      return this;
576    }
577
578    /**
579     * @return {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
580     */
581    public Reference getSubject() { 
582      if (this.subject == null)
583        if (Configuration.errorOnAutoCreate())
584          throw new Error("Attempt to auto-create Goal.subject");
585        else if (Configuration.doAutoCreate())
586          this.subject = new Reference(); // cc
587      return this.subject;
588    }
589
590    public boolean hasSubject() { 
591      return this.subject != null && !this.subject.isEmpty();
592    }
593
594    /**
595     * @param value {@link #subject} (Identifies the patient, group or organization for whom the goal is being established.)
596     */
597    public Goal setSubject(Reference value) { 
598      this.subject = value;
599      return this;
600    }
601
602    /**
603     * @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. (Identifies the patient, group or organization for whom the goal is being established.)
604     */
605    public Resource getSubjectTarget() { 
606      return this.subjectTarget;
607    }
608
609    /**
610     * @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. (Identifies the patient, group or organization for whom the goal is being established.)
611     */
612    public Goal setSubjectTarget(Resource value) { 
613      this.subjectTarget = value;
614      return this;
615    }
616
617    /**
618     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
619     */
620    public Type getStart() { 
621      return this.start;
622    }
623
624    /**
625     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
626     */
627    public DateType getStartDateType() throws FHIRException { 
628      if (!(this.start instanceof DateType))
629        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.start.getClass().getName()+" was encountered");
630      return (DateType) this.start;
631    }
632
633    public boolean hasStartDateType() { 
634      return this.start instanceof DateType;
635    }
636
637    /**
638     * @return {@link #start} (The date or event after which the goal should begin being pursued.)
639     */
640    public CodeableConcept getStartCodeableConcept() throws FHIRException { 
641      if (!(this.start instanceof CodeableConcept))
642        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.start.getClass().getName()+" was encountered");
643      return (CodeableConcept) this.start;
644    }
645
646    public boolean hasStartCodeableConcept() { 
647      return this.start instanceof CodeableConcept;
648    }
649
650    public boolean hasStart() { 
651      return this.start != null && !this.start.isEmpty();
652    }
653
654    /**
655     * @param value {@link #start} (The date or event after which the goal should begin being pursued.)
656     */
657    public Goal setStart(Type value) { 
658      this.start = value;
659      return this;
660    }
661
662    /**
663     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
664     */
665    public Type getTarget() { 
666      return this.target;
667    }
668
669    /**
670     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
671     */
672    public DateType getTargetDateType() throws FHIRException { 
673      if (!(this.target instanceof DateType))
674        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.target.getClass().getName()+" was encountered");
675      return (DateType) this.target;
676    }
677
678    public boolean hasTargetDateType() { 
679      return this.target instanceof DateType;
680    }
681
682    /**
683     * @return {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
684     */
685    public Duration getTargetDuration() throws FHIRException { 
686      if (!(this.target instanceof Duration))
687        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.target.getClass().getName()+" was encountered");
688      return (Duration) this.target;
689    }
690
691    public boolean hasTargetDuration() { 
692      return this.target instanceof Duration;
693    }
694
695    public boolean hasTarget() { 
696      return this.target != null && !this.target.isEmpty();
697    }
698
699    /**
700     * @param value {@link #target} (Indicates either the date or the duration after start by which the goal should be met.)
701     */
702    public Goal setTarget(Type value) { 
703      this.target = value;
704      return this;
705    }
706
707    /**
708     * @return {@link #category} (Indicates a category the goal falls within.)
709     */
710    public List<CodeableConcept> getCategory() { 
711      if (this.category == null)
712        this.category = new ArrayList<CodeableConcept>();
713      return this.category;
714    }
715
716    public boolean hasCategory() { 
717      if (this.category == null)
718        return false;
719      for (CodeableConcept item : this.category)
720        if (!item.isEmpty())
721          return true;
722      return false;
723    }
724
725    /**
726     * @return {@link #category} (Indicates a category the goal falls within.)
727     */
728    // syntactic sugar
729    public CodeableConcept addCategory() { //3
730      CodeableConcept t = new CodeableConcept();
731      if (this.category == null)
732        this.category = new ArrayList<CodeableConcept>();
733      this.category.add(t);
734      return t;
735    }
736
737    // syntactic sugar
738    public Goal addCategory(CodeableConcept t) { //3
739      if (t == null)
740        return this;
741      if (this.category == null)
742        this.category = new ArrayList<CodeableConcept>();
743      this.category.add(t);
744      return this;
745    }
746
747    /**
748     * @return {@link #description} (Human-readable description of a specific desired objective of care.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
749     */
750    public StringType getDescriptionElement() { 
751      if (this.description == null)
752        if (Configuration.errorOnAutoCreate())
753          throw new Error("Attempt to auto-create Goal.description");
754        else if (Configuration.doAutoCreate())
755          this.description = new StringType(); // bb
756      return this.description;
757    }
758
759    public boolean hasDescriptionElement() { 
760      return this.description != null && !this.description.isEmpty();
761    }
762
763    public boolean hasDescription() { 
764      return this.description != null && !this.description.isEmpty();
765    }
766
767    /**
768     * @param value {@link #description} (Human-readable description of a specific desired objective of care.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
769     */
770    public Goal setDescriptionElement(StringType value) { 
771      this.description = value;
772      return this;
773    }
774
775    /**
776     * @return Human-readable description of a specific desired objective of care.
777     */
778    public String getDescription() { 
779      return this.description == null ? null : this.description.getValue();
780    }
781
782    /**
783     * @param value Human-readable description of a specific desired objective of care.
784     */
785    public Goal setDescription(String value) { 
786        if (this.description == null)
787          this.description = new StringType();
788        this.description.setValue(value);
789      return this;
790    }
791
792    /**
793     * @return {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
794     */
795    public Enumeration<GoalStatus> getStatusElement() { 
796      if (this.status == null)
797        if (Configuration.errorOnAutoCreate())
798          throw new Error("Attempt to auto-create Goal.status");
799        else if (Configuration.doAutoCreate())
800          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory()); // bb
801      return this.status;
802    }
803
804    public boolean hasStatusElement() { 
805      return this.status != null && !this.status.isEmpty();
806    }
807
808    public boolean hasStatus() { 
809      return this.status != null && !this.status.isEmpty();
810    }
811
812    /**
813     * @param value {@link #status} (Indicates whether the goal has been reached and is still considered relevant.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
814     */
815    public Goal setStatusElement(Enumeration<GoalStatus> value) { 
816      this.status = value;
817      return this;
818    }
819
820    /**
821     * @return Indicates whether the goal has been reached and is still considered relevant.
822     */
823    public GoalStatus getStatus() { 
824      return this.status == null ? null : this.status.getValue();
825    }
826
827    /**
828     * @param value Indicates whether the goal has been reached and is still considered relevant.
829     */
830    public Goal setStatus(GoalStatus value) { 
831        if (this.status == null)
832          this.status = new Enumeration<GoalStatus>(new GoalStatusEnumFactory());
833        this.status.setValue(value);
834      return this;
835    }
836
837    /**
838     * @return {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
839     */
840    public DateType getStatusDateElement() { 
841      if (this.statusDate == null)
842        if (Configuration.errorOnAutoCreate())
843          throw new Error("Attempt to auto-create Goal.statusDate");
844        else if (Configuration.doAutoCreate())
845          this.statusDate = new DateType(); // bb
846      return this.statusDate;
847    }
848
849    public boolean hasStatusDateElement() { 
850      return this.statusDate != null && !this.statusDate.isEmpty();
851    }
852
853    public boolean hasStatusDate() { 
854      return this.statusDate != null && !this.statusDate.isEmpty();
855    }
856
857    /**
858     * @param value {@link #statusDate} (Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
859     */
860    public Goal setStatusDateElement(DateType value) { 
861      this.statusDate = value;
862      return this;
863    }
864
865    /**
866     * @return Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
867     */
868    public Date getStatusDate() { 
869      return this.statusDate == null ? null : this.statusDate.getValue();
870    }
871
872    /**
873     * @param value Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.
874     */
875    public Goal setStatusDate(Date value) { 
876      if (value == null)
877        this.statusDate = null;
878      else {
879        if (this.statusDate == null)
880          this.statusDate = new DateType();
881        this.statusDate.setValue(value);
882      }
883      return this;
884    }
885
886    /**
887     * @return {@link #statusReason} (Captures the reason for the current status.)
888     */
889    public CodeableConcept getStatusReason() { 
890      if (this.statusReason == null)
891        if (Configuration.errorOnAutoCreate())
892          throw new Error("Attempt to auto-create Goal.statusReason");
893        else if (Configuration.doAutoCreate())
894          this.statusReason = new CodeableConcept(); // cc
895      return this.statusReason;
896    }
897
898    public boolean hasStatusReason() { 
899      return this.statusReason != null && !this.statusReason.isEmpty();
900    }
901
902    /**
903     * @param value {@link #statusReason} (Captures the reason for the current status.)
904     */
905    public Goal setStatusReason(CodeableConcept value) { 
906      this.statusReason = value;
907      return this;
908    }
909
910    /**
911     * @return {@link #author} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
912     */
913    public Reference getAuthor() { 
914      if (this.author == null)
915        if (Configuration.errorOnAutoCreate())
916          throw new Error("Attempt to auto-create Goal.author");
917        else if (Configuration.doAutoCreate())
918          this.author = new Reference(); // cc
919      return this.author;
920    }
921
922    public boolean hasAuthor() { 
923      return this.author != null && !this.author.isEmpty();
924    }
925
926    /**
927     * @param value {@link #author} (Indicates whose goal this is - patient goal, practitioner goal, etc.)
928     */
929    public Goal setAuthor(Reference value) { 
930      this.author = value;
931      return this;
932    }
933
934    /**
935     * @return {@link #author} 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. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
936     */
937    public Resource getAuthorTarget() { 
938      return this.authorTarget;
939    }
940
941    /**
942     * @param value {@link #author} 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. (Indicates whose goal this is - patient goal, practitioner goal, etc.)
943     */
944    public Goal setAuthorTarget(Resource value) { 
945      this.authorTarget = value;
946      return this;
947    }
948
949    /**
950     * @return {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
951     */
952    public CodeableConcept getPriority() { 
953      if (this.priority == null)
954        if (Configuration.errorOnAutoCreate())
955          throw new Error("Attempt to auto-create Goal.priority");
956        else if (Configuration.doAutoCreate())
957          this.priority = new CodeableConcept(); // cc
958      return this.priority;
959    }
960
961    public boolean hasPriority() { 
962      return this.priority != null && !this.priority.isEmpty();
963    }
964
965    /**
966     * @param value {@link #priority} (Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.)
967     */
968    public Goal setPriority(CodeableConcept value) { 
969      this.priority = value;
970      return this;
971    }
972
973    /**
974     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
975     */
976    public List<Reference> getAddresses() { 
977      if (this.addresses == null)
978        this.addresses = new ArrayList<Reference>();
979      return this.addresses;
980    }
981
982    public boolean hasAddresses() { 
983      if (this.addresses == null)
984        return false;
985      for (Reference item : this.addresses)
986        if (!item.isEmpty())
987          return true;
988      return false;
989    }
990
991    /**
992     * @return {@link #addresses} (The identified conditions and other health record elements that are intended to be addressed by the goal.)
993     */
994    // syntactic sugar
995    public Reference addAddresses() { //3
996      Reference t = new Reference();
997      if (this.addresses == null)
998        this.addresses = new ArrayList<Reference>();
999      this.addresses.add(t);
1000      return t;
1001    }
1002
1003    // syntactic sugar
1004    public Goal addAddresses(Reference t) { //3
1005      if (t == null)
1006        return this;
1007      if (this.addresses == null)
1008        this.addresses = new ArrayList<Reference>();
1009      this.addresses.add(t);
1010      return this;
1011    }
1012
1013    /**
1014     * @return {@link #addresses} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The identified conditions and other health record elements that are intended to be addressed by the goal.)
1015     */
1016    public List<Resource> getAddressesTarget() { 
1017      if (this.addressesTarget == null)
1018        this.addressesTarget = new ArrayList<Resource>();
1019      return this.addressesTarget;
1020    }
1021
1022    /**
1023     * @return {@link #note} (Any comments related to the goal.)
1024     */
1025    public List<Annotation> getNote() { 
1026      if (this.note == null)
1027        this.note = new ArrayList<Annotation>();
1028      return this.note;
1029    }
1030
1031    public boolean hasNote() { 
1032      if (this.note == null)
1033        return false;
1034      for (Annotation item : this.note)
1035        if (!item.isEmpty())
1036          return true;
1037      return false;
1038    }
1039
1040    /**
1041     * @return {@link #note} (Any comments related to the goal.)
1042     */
1043    // syntactic sugar
1044    public Annotation addNote() { //3
1045      Annotation t = new Annotation();
1046      if (this.note == null)
1047        this.note = new ArrayList<Annotation>();
1048      this.note.add(t);
1049      return t;
1050    }
1051
1052    // syntactic sugar
1053    public Goal addNote(Annotation t) { //3
1054      if (t == null)
1055        return this;
1056      if (this.note == null)
1057        this.note = new ArrayList<Annotation>();
1058      this.note.add(t);
1059      return this;
1060    }
1061
1062    /**
1063     * @return {@link #outcome} (Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.)
1064     */
1065    public List<GoalOutcomeComponent> getOutcome() { 
1066      if (this.outcome == null)
1067        this.outcome = new ArrayList<GoalOutcomeComponent>();
1068      return this.outcome;
1069    }
1070
1071    public boolean hasOutcome() { 
1072      if (this.outcome == null)
1073        return false;
1074      for (GoalOutcomeComponent item : this.outcome)
1075        if (!item.isEmpty())
1076          return true;
1077      return false;
1078    }
1079
1080    /**
1081     * @return {@link #outcome} (Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.)
1082     */
1083    // syntactic sugar
1084    public GoalOutcomeComponent addOutcome() { //3
1085      GoalOutcomeComponent t = new GoalOutcomeComponent();
1086      if (this.outcome == null)
1087        this.outcome = new ArrayList<GoalOutcomeComponent>();
1088      this.outcome.add(t);
1089      return t;
1090    }
1091
1092    // syntactic sugar
1093    public Goal addOutcome(GoalOutcomeComponent t) { //3
1094      if (t == null)
1095        return this;
1096      if (this.outcome == null)
1097        this.outcome = new ArrayList<GoalOutcomeComponent>();
1098      this.outcome.add(t);
1099      return this;
1100    }
1101
1102      protected void listChildren(List<Property> childrenList) {
1103        super.listChildren(childrenList);
1104        childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
1105        childrenList.add(new Property("subject", "Reference(Patient|Group|Organization)", "Identifies the patient, group or organization for whom the goal is being established.", 0, java.lang.Integer.MAX_VALUE, subject));
1106        childrenList.add(new Property("start[x]", "date|CodeableConcept", "The date or event after which the goal should begin being pursued.", 0, java.lang.Integer.MAX_VALUE, start));
1107        childrenList.add(new Property("target[x]", "date|Duration", "Indicates either the date or the duration after start by which the goal should be met.", 0, java.lang.Integer.MAX_VALUE, target));
1108        childrenList.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, java.lang.Integer.MAX_VALUE, category));
1109        childrenList.add(new Property("description", "string", "Human-readable description of a specific desired objective of care.", 0, java.lang.Integer.MAX_VALUE, description));
1110        childrenList.add(new Property("status", "code", "Indicates whether the goal has been reached and is still considered relevant.", 0, java.lang.Integer.MAX_VALUE, status));
1111        childrenList.add(new Property("statusDate", "date", "Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.", 0, java.lang.Integer.MAX_VALUE, statusDate));
1112        childrenList.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current status.", 0, java.lang.Integer.MAX_VALUE, statusReason));
1113        childrenList.add(new Property("author", "Reference(Patient|Practitioner|RelatedPerson)", "Indicates whose goal this is - patient goal, practitioner goal, etc.", 0, java.lang.Integer.MAX_VALUE, author));
1114        childrenList.add(new Property("priority", "CodeableConcept", "Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.", 0, java.lang.Integer.MAX_VALUE, priority));
1115        childrenList.add(new Property("addresses", "Reference(Condition|Observation|MedicationStatement|NutritionOrder|ProcedureRequest|RiskAssessment)", "The identified conditions and other health record elements that are intended to be addressed by the goal.", 0, java.lang.Integer.MAX_VALUE, addresses));
1116        childrenList.add(new Property("note", "Annotation", "Any comments related to the goal.", 0, java.lang.Integer.MAX_VALUE, note));
1117        childrenList.add(new Property("outcome", "", "Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved.", 0, java.lang.Integer.MAX_VALUE, outcome));
1118      }
1119
1120      @Override
1121      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1122        switch (hash) {
1123        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1124        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1125        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // Type
1126        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Type
1127        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
1128        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1129        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<GoalStatus>
1130        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateType
1131        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
1132        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
1133        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1134        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
1135        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1136        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : this.outcome.toArray(new Base[this.outcome.size()]); // GoalOutcomeComponent
1137        default: return super.getProperty(hash, name, checkValid);
1138        }
1139
1140      }
1141
1142      @Override
1143      public void setProperty(int hash, String name, Base value) throws FHIRException {
1144        switch (hash) {
1145        case -1618432855: // identifier
1146          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1147          break;
1148        case -1867885268: // subject
1149          this.subject = castToReference(value); // Reference
1150          break;
1151        case 109757538: // start
1152          this.start = (Type) value; // Type
1153          break;
1154        case -880905839: // target
1155          this.target = (Type) value; // Type
1156          break;
1157        case 50511102: // category
1158          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
1159          break;
1160        case -1724546052: // description
1161          this.description = castToString(value); // StringType
1162          break;
1163        case -892481550: // status
1164          this.status = new GoalStatusEnumFactory().fromType(value); // Enumeration<GoalStatus>
1165          break;
1166        case 247524032: // statusDate
1167          this.statusDate = castToDate(value); // DateType
1168          break;
1169        case 2051346646: // statusReason
1170          this.statusReason = castToCodeableConcept(value); // CodeableConcept
1171          break;
1172        case -1406328437: // author
1173          this.author = castToReference(value); // Reference
1174          break;
1175        case -1165461084: // priority
1176          this.priority = castToCodeableConcept(value); // CodeableConcept
1177          break;
1178        case 874544034: // addresses
1179          this.getAddresses().add(castToReference(value)); // Reference
1180          break;
1181        case 3387378: // note
1182          this.getNote().add(castToAnnotation(value)); // Annotation
1183          break;
1184        case -1106507950: // outcome
1185          this.getOutcome().add((GoalOutcomeComponent) value); // GoalOutcomeComponent
1186          break;
1187        default: super.setProperty(hash, name, value);
1188        }
1189
1190      }
1191
1192      @Override
1193      public void setProperty(String name, Base value) throws FHIRException {
1194        if (name.equals("identifier"))
1195          this.getIdentifier().add(castToIdentifier(value));
1196        else if (name.equals("subject"))
1197          this.subject = castToReference(value); // Reference
1198        else if (name.equals("start[x]"))
1199          this.start = (Type) value; // Type
1200        else if (name.equals("target[x]"))
1201          this.target = (Type) value; // Type
1202        else if (name.equals("category"))
1203          this.getCategory().add(castToCodeableConcept(value));
1204        else if (name.equals("description"))
1205          this.description = castToString(value); // StringType
1206        else if (name.equals("status"))
1207          this.status = new GoalStatusEnumFactory().fromType(value); // Enumeration<GoalStatus>
1208        else if (name.equals("statusDate"))
1209          this.statusDate = castToDate(value); // DateType
1210        else if (name.equals("statusReason"))
1211          this.statusReason = castToCodeableConcept(value); // CodeableConcept
1212        else if (name.equals("author"))
1213          this.author = castToReference(value); // Reference
1214        else if (name.equals("priority"))
1215          this.priority = castToCodeableConcept(value); // CodeableConcept
1216        else if (name.equals("addresses"))
1217          this.getAddresses().add(castToReference(value));
1218        else if (name.equals("note"))
1219          this.getNote().add(castToAnnotation(value));
1220        else if (name.equals("outcome"))
1221          this.getOutcome().add((GoalOutcomeComponent) value);
1222        else
1223          super.setProperty(name, value);
1224      }
1225
1226      @Override
1227      public Base makeProperty(int hash, String name) throws FHIRException {
1228        switch (hash) {
1229        case -1618432855:  return addIdentifier(); // Identifier
1230        case -1867885268:  return getSubject(); // Reference
1231        case 1316793566:  return getStart(); // Type
1232        case -815579825:  return getTarget(); // Type
1233        case 50511102:  return addCategory(); // CodeableConcept
1234        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
1235        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<GoalStatus>
1236        case 247524032: throw new FHIRException("Cannot make property statusDate as it is not a complex type"); // DateType
1237        case 2051346646:  return getStatusReason(); // CodeableConcept
1238        case -1406328437:  return getAuthor(); // Reference
1239        case -1165461084:  return getPriority(); // CodeableConcept
1240        case 874544034:  return addAddresses(); // Reference
1241        case 3387378:  return addNote(); // Annotation
1242        case -1106507950:  return addOutcome(); // GoalOutcomeComponent
1243        default: return super.makeProperty(hash, name);
1244        }
1245
1246      }
1247
1248      @Override
1249      public Base addChild(String name) throws FHIRException {
1250        if (name.equals("identifier")) {
1251          return addIdentifier();
1252        }
1253        else if (name.equals("subject")) {
1254          this.subject = new Reference();
1255          return this.subject;
1256        }
1257        else if (name.equals("startDate")) {
1258          this.start = new DateType();
1259          return this.start;
1260        }
1261        else if (name.equals("startCodeableConcept")) {
1262          this.start = new CodeableConcept();
1263          return this.start;
1264        }
1265        else if (name.equals("targetDate")) {
1266          this.target = new DateType();
1267          return this.target;
1268        }
1269        else if (name.equals("targetDuration")) {
1270          this.target = new Duration();
1271          return this.target;
1272        }
1273        else if (name.equals("category")) {
1274          return addCategory();
1275        }
1276        else if (name.equals("description")) {
1277          throw new FHIRException("Cannot call addChild on a primitive type Goal.description");
1278        }
1279        else if (name.equals("status")) {
1280          throw new FHIRException("Cannot call addChild on a primitive type Goal.status");
1281        }
1282        else if (name.equals("statusDate")) {
1283          throw new FHIRException("Cannot call addChild on a primitive type Goal.statusDate");
1284        }
1285        else if (name.equals("statusReason")) {
1286          this.statusReason = new CodeableConcept();
1287          return this.statusReason;
1288        }
1289        else if (name.equals("author")) {
1290          this.author = new Reference();
1291          return this.author;
1292        }
1293        else if (name.equals("priority")) {
1294          this.priority = new CodeableConcept();
1295          return this.priority;
1296        }
1297        else if (name.equals("addresses")) {
1298          return addAddresses();
1299        }
1300        else if (name.equals("note")) {
1301          return addNote();
1302        }
1303        else if (name.equals("outcome")) {
1304          return addOutcome();
1305        }
1306        else
1307          return super.addChild(name);
1308      }
1309
1310  public String fhirType() {
1311    return "Goal";
1312
1313  }
1314
1315      public Goal copy() {
1316        Goal dst = new Goal();
1317        copyValues(dst);
1318        if (identifier != null) {
1319          dst.identifier = new ArrayList<Identifier>();
1320          for (Identifier i : identifier)
1321            dst.identifier.add(i.copy());
1322        };
1323        dst.subject = subject == null ? null : subject.copy();
1324        dst.start = start == null ? null : start.copy();
1325        dst.target = target == null ? null : target.copy();
1326        if (category != null) {
1327          dst.category = new ArrayList<CodeableConcept>();
1328          for (CodeableConcept i : category)
1329            dst.category.add(i.copy());
1330        };
1331        dst.description = description == null ? null : description.copy();
1332        dst.status = status == null ? null : status.copy();
1333        dst.statusDate = statusDate == null ? null : statusDate.copy();
1334        dst.statusReason = statusReason == null ? null : statusReason.copy();
1335        dst.author = author == null ? null : author.copy();
1336        dst.priority = priority == null ? null : priority.copy();
1337        if (addresses != null) {
1338          dst.addresses = new ArrayList<Reference>();
1339          for (Reference i : addresses)
1340            dst.addresses.add(i.copy());
1341        };
1342        if (note != null) {
1343          dst.note = new ArrayList<Annotation>();
1344          for (Annotation i : note)
1345            dst.note.add(i.copy());
1346        };
1347        if (outcome != null) {
1348          dst.outcome = new ArrayList<GoalOutcomeComponent>();
1349          for (GoalOutcomeComponent i : outcome)
1350            dst.outcome.add(i.copy());
1351        };
1352        return dst;
1353      }
1354
1355      protected Goal typedCopy() {
1356        return copy();
1357      }
1358
1359      @Override
1360      public boolean equalsDeep(Base other) {
1361        if (!super.equalsDeep(other))
1362          return false;
1363        if (!(other instanceof Goal))
1364          return false;
1365        Goal o = (Goal) other;
1366        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(start, o.start, true)
1367           && compareDeep(target, o.target, true) && compareDeep(category, o.category, true) && compareDeep(description, o.description, true)
1368           && compareDeep(status, o.status, true) && compareDeep(statusDate, o.statusDate, true) && compareDeep(statusReason, o.statusReason, true)
1369           && compareDeep(author, o.author, true) && compareDeep(priority, o.priority, true) && compareDeep(addresses, o.addresses, true)
1370           && compareDeep(note, o.note, true) && compareDeep(outcome, o.outcome, true);
1371      }
1372
1373      @Override
1374      public boolean equalsShallow(Base other) {
1375        if (!super.equalsShallow(other))
1376          return false;
1377        if (!(other instanceof Goal))
1378          return false;
1379        Goal o = (Goal) other;
1380        return compareValues(description, o.description, true) && compareValues(status, o.status, true) && compareValues(statusDate, o.statusDate, true)
1381          ;
1382      }
1383
1384      public boolean isEmpty() {
1385        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (subject == null || subject.isEmpty())
1386           && (start == null || start.isEmpty()) && (target == null || target.isEmpty()) && (category == null || category.isEmpty())
1387           && (description == null || description.isEmpty()) && (status == null || status.isEmpty())
1388           && (statusDate == null || statusDate.isEmpty()) && (statusReason == null || statusReason.isEmpty())
1389           && (author == null || author.isEmpty()) && (priority == null || priority.isEmpty()) && (addresses == null || addresses.isEmpty())
1390           && (note == null || note.isEmpty()) && (outcome == null || outcome.isEmpty());
1391      }
1392
1393  @Override
1394  public ResourceType getResourceType() {
1395    return ResourceType.Goal;
1396   }
1397
1398 /**
1399   * Search parameter: <b>targetdate</b>
1400   * <p>
1401   * Description: <b>Reach goal on or before</b><br>
1402   * Type: <b>date</b><br>
1403   * Path: <b>Goal.targetDate</b><br>
1404   * </p>
1405   */
1406  @SearchParamDefinition(name="targetdate", path="Goal.target.as(Date)", description="Reach goal on or before", type="date" )
1407  public static final String SP_TARGETDATE = "targetdate";
1408 /**
1409   * <b>Fluent Client</b> search parameter constant for <b>targetdate</b>
1410   * <p>
1411   * Description: <b>Reach goal on or before</b><br>
1412   * Type: <b>date</b><br>
1413   * Path: <b>Goal.targetDate</b><br>
1414   * </p>
1415   */
1416  public static final ca.uhn.fhir.rest.gclient.DateClientParam TARGETDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_TARGETDATE);
1417
1418 /**
1419   * Search parameter: <b>category</b>
1420   * <p>
1421   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1422   * Type: <b>token</b><br>
1423   * Path: <b>Goal.category</b><br>
1424   * </p>
1425   */
1426  @SearchParamDefinition(name="category", path="Goal.category", description="E.g. Treatment, dietary, behavioral, etc.", type="token" )
1427  public static final String SP_CATEGORY = "category";
1428 /**
1429   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1430   * <p>
1431   * Description: <b>E.g. Treatment, dietary, behavioral, etc.</b><br>
1432   * Type: <b>token</b><br>
1433   * Path: <b>Goal.category</b><br>
1434   * </p>
1435   */
1436  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1437
1438 /**
1439   * Search parameter: <b>patient</b>
1440   * <p>
1441   * Description: <b>Who this goal is intended for</b><br>
1442   * Type: <b>reference</b><br>
1443   * Path: <b>Goal.subject</b><br>
1444   * </p>
1445   */
1446  @SearchParamDefinition(name="patient", path="Goal.subject", description="Who this goal is intended for", type="reference" )
1447  public static final String SP_PATIENT = "patient";
1448 /**
1449   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1450   * <p>
1451   * Description: <b>Who this goal is intended for</b><br>
1452   * Type: <b>reference</b><br>
1453   * Path: <b>Goal.subject</b><br>
1454   * </p>
1455   */
1456  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1457
1458/**
1459   * Constant for fluent queries to be used to add include statements. Specifies
1460   * the path value of "<b>Goal:patient</b>".
1461   */
1462  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Goal:patient").toLocked();
1463
1464 /**
1465   * Search parameter: <b>status</b>
1466   * <p>
1467   * Description: <b>proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled</b><br>
1468   * Type: <b>token</b><br>
1469   * Path: <b>Goal.status</b><br>
1470   * </p>
1471   */
1472  @SearchParamDefinition(name="status", path="Goal.status", description="proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled", type="token" )
1473  public static final String SP_STATUS = "status";
1474 /**
1475   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1476   * <p>
1477   * Description: <b>proposed | planned | accepted | rejected | in-progress | achieved | sustaining | on-hold | cancelled</b><br>
1478   * Type: <b>token</b><br>
1479   * Path: <b>Goal.status</b><br>
1480   * </p>
1481   */
1482  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1483
1484 /**
1485   * Search parameter: <b>subject</b>
1486   * <p>
1487   * Description: <b>Who this goal is intended for</b><br>
1488   * Type: <b>reference</b><br>
1489   * Path: <b>Goal.subject</b><br>
1490   * </p>
1491   */
1492  @SearchParamDefinition(name="subject", path="Goal.subject", description="Who this goal is intended for", type="reference" )
1493  public static final String SP_SUBJECT = "subject";
1494 /**
1495   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1496   * <p>
1497   * Description: <b>Who this goal is intended for</b><br>
1498   * Type: <b>reference</b><br>
1499   * Path: <b>Goal.subject</b><br>
1500   * </p>
1501   */
1502  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1503
1504/**
1505   * Constant for fluent queries to be used to add include statements. Specifies
1506   * the path value of "<b>Goal:subject</b>".
1507   */
1508  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Goal:subject").toLocked();
1509
1510 /**
1511   * Search parameter: <b>identifier</b>
1512   * <p>
1513   * Description: <b>External Ids for this goal</b><br>
1514   * Type: <b>token</b><br>
1515   * Path: <b>Goal.identifier</b><br>
1516   * </p>
1517   */
1518  @SearchParamDefinition(name="identifier", path="Goal.identifier", description="External Ids for this goal", type="token" )
1519  public static final String SP_IDENTIFIER = "identifier";
1520 /**
1521   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1522   * <p>
1523   * Description: <b>External Ids for this goal</b><br>
1524   * Type: <b>token</b><br>
1525   * Path: <b>Goal.identifier</b><br>
1526   * </p>
1527   */
1528  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1529
1530
1531}
1532