001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.
047 */
048@ResourceDef(name="CarePlan", profile="http://hl7.org/fhir/StructureDefinition/CarePlan")
049public class CarePlan extends DomainResource {
050
051    public enum CarePlanStatus {
052        /**
053         * The request has been created but is not yet complete or ready for action.
054         */
055        DRAFT, 
056        /**
057         * The request is in force and ready to be acted upon.
058         */
059        ACTIVE, 
060        /**
061         * The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.
062         */
063        ONHOLD, 
064        /**
065         * The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.
066         */
067        REVOKED, 
068        /**
069         * The activity described by the request has been fully performed.  No further activity will occur.
070         */
071        COMPLETED, 
072        /**
073         * This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".).
074         */
075        ENTEREDINERROR, 
076        /**
077         * The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.
078         */
079        UNKNOWN, 
080        /**
081         * added to help the parsers with the generic types
082         */
083        NULL;
084        public static CarePlanStatus fromCode(String codeString) throws FHIRException {
085            if (codeString == null || "".equals(codeString))
086                return null;
087        if ("draft".equals(codeString))
088          return DRAFT;
089        if ("active".equals(codeString))
090          return ACTIVE;
091        if ("on-hold".equals(codeString))
092          return ONHOLD;
093        if ("revoked".equals(codeString))
094          return REVOKED;
095        if ("completed".equals(codeString))
096          return COMPLETED;
097        if ("entered-in-error".equals(codeString))
098          return ENTEREDINERROR;
099        if ("unknown".equals(codeString))
100          return UNKNOWN;
101        if (Configuration.isAcceptInvalidEnums())
102          return null;
103        else
104          throw new FHIRException("Unknown CarePlanStatus code '"+codeString+"'");
105        }
106        public String toCode() {
107          switch (this) {
108            case DRAFT: return "draft";
109            case ACTIVE: return "active";
110            case ONHOLD: return "on-hold";
111            case REVOKED: return "revoked";
112            case COMPLETED: return "completed";
113            case ENTEREDINERROR: return "entered-in-error";
114            case UNKNOWN: return "unknown";
115            default: return "?";
116          }
117        }
118        public String getSystem() {
119          switch (this) {
120            case DRAFT: return "http://hl7.org/fhir/request-status";
121            case ACTIVE: return "http://hl7.org/fhir/request-status";
122            case ONHOLD: return "http://hl7.org/fhir/request-status";
123            case REVOKED: return "http://hl7.org/fhir/request-status";
124            case COMPLETED: return "http://hl7.org/fhir/request-status";
125            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
126            case UNKNOWN: return "http://hl7.org/fhir/request-status";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case DRAFT: return "The request has been created but is not yet complete or ready for action.";
133            case ACTIVE: return "The request is in force and ready to be acted upon.";
134            case ONHOLD: return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
135            case REVOKED: return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
136            case COMPLETED: return "The activity described by the request has been fully performed.  No further activity will occur.";
137            case ENTEREDINERROR: return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
138            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.";
139            default: return "?";
140          }
141        }
142        public String getDisplay() {
143          switch (this) {
144            case DRAFT: return "Draft";
145            case ACTIVE: return "Active";
146            case ONHOLD: return "On Hold";
147            case REVOKED: return "Revoked";
148            case COMPLETED: return "Completed";
149            case ENTEREDINERROR: return "Entered in Error";
150            case UNKNOWN: return "Unknown";
151            default: return "?";
152          }
153        }
154    }
155
156  public static class CarePlanStatusEnumFactory implements EnumFactory<CarePlanStatus> {
157    public CarePlanStatus fromCode(String codeString) throws IllegalArgumentException {
158      if (codeString == null || "".equals(codeString))
159            if (codeString == null || "".equals(codeString))
160                return null;
161        if ("draft".equals(codeString))
162          return CarePlanStatus.DRAFT;
163        if ("active".equals(codeString))
164          return CarePlanStatus.ACTIVE;
165        if ("on-hold".equals(codeString))
166          return CarePlanStatus.ONHOLD;
167        if ("revoked".equals(codeString))
168          return CarePlanStatus.REVOKED;
169        if ("completed".equals(codeString))
170          return CarePlanStatus.COMPLETED;
171        if ("entered-in-error".equals(codeString))
172          return CarePlanStatus.ENTEREDINERROR;
173        if ("unknown".equals(codeString))
174          return CarePlanStatus.UNKNOWN;
175        throw new IllegalArgumentException("Unknown CarePlanStatus code '"+codeString+"'");
176        }
177        public Enumeration<CarePlanStatus> fromType(Base code) throws FHIRException {
178          if (code == null)
179            return null;
180          if (code.isEmpty())
181            return new Enumeration<CarePlanStatus>(this);
182          String codeString = ((PrimitiveType) code).asStringValue();
183          if (codeString == null || "".equals(codeString))
184            return null;
185        if ("draft".equals(codeString))
186          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.DRAFT);
187        if ("active".equals(codeString))
188          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.ACTIVE);
189        if ("on-hold".equals(codeString))
190          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.ONHOLD);
191        if ("revoked".equals(codeString))
192          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.REVOKED);
193        if ("completed".equals(codeString))
194          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.COMPLETED);
195        if ("entered-in-error".equals(codeString))
196          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.ENTEREDINERROR);
197        if ("unknown".equals(codeString))
198          return new Enumeration<CarePlanStatus>(this, CarePlanStatus.UNKNOWN);
199        throw new FHIRException("Unknown CarePlanStatus code '"+codeString+"'");
200        }
201    public String toCode(CarePlanStatus code) {
202      if (code == CarePlanStatus.DRAFT)
203        return "draft";
204      if (code == CarePlanStatus.ACTIVE)
205        return "active";
206      if (code == CarePlanStatus.ONHOLD)
207        return "on-hold";
208      if (code == CarePlanStatus.REVOKED)
209        return "revoked";
210      if (code == CarePlanStatus.COMPLETED)
211        return "completed";
212      if (code == CarePlanStatus.ENTEREDINERROR)
213        return "entered-in-error";
214      if (code == CarePlanStatus.UNKNOWN)
215        return "unknown";
216      return "?";
217      }
218    public String toSystem(CarePlanStatus code) {
219      return code.getSystem();
220      }
221    }
222
223    public enum CarePlanIntent {
224        /**
225         * null
226         */
227        PROPOSAL, 
228        /**
229         * null
230         */
231        PLAN, 
232        /**
233         * null
234         */
235        ORDER, 
236        /**
237         * null
238         */
239        OPTION, 
240        /**
241         * added to help the parsers with the generic types
242         */
243        NULL;
244        public static CarePlanIntent fromCode(String codeString) throws FHIRException {
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("proposal".equals(codeString))
248          return PROPOSAL;
249        if ("plan".equals(codeString))
250          return PLAN;
251        if ("order".equals(codeString))
252          return ORDER;
253        if ("option".equals(codeString))
254          return OPTION;
255        if (Configuration.isAcceptInvalidEnums())
256          return null;
257        else
258          throw new FHIRException("Unknown CarePlanIntent code '"+codeString+"'");
259        }
260        public String toCode() {
261          switch (this) {
262            case PROPOSAL: return "proposal";
263            case PLAN: return "plan";
264            case ORDER: return "order";
265            case OPTION: return "option";
266            default: return "?";
267          }
268        }
269        public String getSystem() {
270          switch (this) {
271            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
272            case PLAN: return "http://hl7.org/fhir/request-intent";
273            case ORDER: return "http://hl7.org/fhir/request-intent";
274            case OPTION: return "http://hl7.org/fhir/request-intent";
275            default: return "?";
276          }
277        }
278        public String getDefinition() {
279          switch (this) {
280            case PROPOSAL: return "";
281            case PLAN: return "";
282            case ORDER: return "";
283            case OPTION: return "";
284            default: return "?";
285          }
286        }
287        public String getDisplay() {
288          switch (this) {
289            case PROPOSAL: return "proposal";
290            case PLAN: return "plan";
291            case ORDER: return "order";
292            case OPTION: return "option";
293            default: return "?";
294          }
295        }
296    }
297
298  public static class CarePlanIntentEnumFactory implements EnumFactory<CarePlanIntent> {
299    public CarePlanIntent fromCode(String codeString) throws IllegalArgumentException {
300      if (codeString == null || "".equals(codeString))
301            if (codeString == null || "".equals(codeString))
302                return null;
303        if ("proposal".equals(codeString))
304          return CarePlanIntent.PROPOSAL;
305        if ("plan".equals(codeString))
306          return CarePlanIntent.PLAN;
307        if ("order".equals(codeString))
308          return CarePlanIntent.ORDER;
309        if ("option".equals(codeString))
310          return CarePlanIntent.OPTION;
311        throw new IllegalArgumentException("Unknown CarePlanIntent code '"+codeString+"'");
312        }
313        public Enumeration<CarePlanIntent> fromType(Base code) throws FHIRException {
314          if (code == null)
315            return null;
316          if (code.isEmpty())
317            return new Enumeration<CarePlanIntent>(this);
318          String codeString = ((PrimitiveType) code).asStringValue();
319          if (codeString == null || "".equals(codeString))
320            return null;
321        if ("proposal".equals(codeString))
322          return new Enumeration<CarePlanIntent>(this, CarePlanIntent.PROPOSAL);
323        if ("plan".equals(codeString))
324          return new Enumeration<CarePlanIntent>(this, CarePlanIntent.PLAN);
325        if ("order".equals(codeString))
326          return new Enumeration<CarePlanIntent>(this, CarePlanIntent.ORDER);
327        if ("option".equals(codeString))
328          return new Enumeration<CarePlanIntent>(this, CarePlanIntent.OPTION);
329        throw new FHIRException("Unknown CarePlanIntent code '"+codeString+"'");
330        }
331    public String toCode(CarePlanIntent code) {
332      if (code == CarePlanIntent.PROPOSAL)
333        return "proposal";
334      if (code == CarePlanIntent.PLAN)
335        return "plan";
336      if (code == CarePlanIntent.ORDER)
337        return "order";
338      if (code == CarePlanIntent.OPTION)
339        return "option";
340      return "?";
341      }
342    public String toSystem(CarePlanIntent code) {
343      return code.getSystem();
344      }
345    }
346
347    public enum CarePlanActivityKind {
348        /**
349         * null
350         */
351        APPOINTMENT, 
352        /**
353         * null
354         */
355        COMMUNICATIONREQUEST, 
356        /**
357         * null
358         */
359        DEVICEREQUEST, 
360        /**
361         * null
362         */
363        MEDICATIONREQUEST, 
364        /**
365         * null
366         */
367        NUTRITIONORDER, 
368        /**
369         * null
370         */
371        TASK, 
372        /**
373         * null
374         */
375        SERVICEREQUEST, 
376        /**
377         * null
378         */
379        VISIONPRESCRIPTION, 
380        /**
381         * added to help the parsers with the generic types
382         */
383        NULL;
384        public static CarePlanActivityKind fromCode(String codeString) throws FHIRException {
385            if (codeString == null || "".equals(codeString))
386                return null;
387        if ("Appointment".equals(codeString))
388          return APPOINTMENT;
389        if ("CommunicationRequest".equals(codeString))
390          return COMMUNICATIONREQUEST;
391        if ("DeviceRequest".equals(codeString))
392          return DEVICEREQUEST;
393        if ("MedicationRequest".equals(codeString))
394          return MEDICATIONREQUEST;
395        if ("NutritionOrder".equals(codeString))
396          return NUTRITIONORDER;
397        if ("Task".equals(codeString))
398          return TASK;
399        if ("ServiceRequest".equals(codeString))
400          return SERVICEREQUEST;
401        if ("VisionPrescription".equals(codeString))
402          return VISIONPRESCRIPTION;
403        if (Configuration.isAcceptInvalidEnums())
404          return null;
405        else
406          throw new FHIRException("Unknown CarePlanActivityKind code '"+codeString+"'");
407        }
408        public String toCode() {
409          switch (this) {
410            case APPOINTMENT: return "Appointment";
411            case COMMUNICATIONREQUEST: return "CommunicationRequest";
412            case DEVICEREQUEST: return "DeviceRequest";
413            case MEDICATIONREQUEST: return "MedicationRequest";
414            case NUTRITIONORDER: return "NutritionOrder";
415            case TASK: return "Task";
416            case SERVICEREQUEST: return "ServiceRequest";
417            case VISIONPRESCRIPTION: return "VisionPrescription";
418            default: return "?";
419          }
420        }
421        public String getSystem() {
422          switch (this) {
423            case APPOINTMENT: return "http://hl7.org/fhir/resource-types";
424            case COMMUNICATIONREQUEST: return "http://hl7.org/fhir/resource-types";
425            case DEVICEREQUEST: return "http://hl7.org/fhir/resource-types";
426            case MEDICATIONREQUEST: return "http://hl7.org/fhir/resource-types";
427            case NUTRITIONORDER: return "http://hl7.org/fhir/resource-types";
428            case TASK: return "http://hl7.org/fhir/resource-types";
429            case SERVICEREQUEST: return "http://hl7.org/fhir/resource-types";
430            case VISIONPRESCRIPTION: return "http://hl7.org/fhir/resource-types";
431            default: return "?";
432          }
433        }
434        public String getDefinition() {
435          switch (this) {
436            case APPOINTMENT: return "";
437            case COMMUNICATIONREQUEST: return "";
438            case DEVICEREQUEST: return "";
439            case MEDICATIONREQUEST: return "";
440            case NUTRITIONORDER: return "";
441            case TASK: return "";
442            case SERVICEREQUEST: return "";
443            case VISIONPRESCRIPTION: return "";
444            default: return "?";
445          }
446        }
447        public String getDisplay() {
448          switch (this) {
449            case APPOINTMENT: return "Appointment";
450            case COMMUNICATIONREQUEST: return "CommunicationRequest";
451            case DEVICEREQUEST: return "DeviceRequest";
452            case MEDICATIONREQUEST: return "MedicationRequest";
453            case NUTRITIONORDER: return "NutritionOrder";
454            case TASK: return "Task";
455            case SERVICEREQUEST: return "ServiceRequest";
456            case VISIONPRESCRIPTION: return "VisionPrescription";
457            default: return "?";
458          }
459        }
460    }
461
462  public static class CarePlanActivityKindEnumFactory implements EnumFactory<CarePlanActivityKind> {
463    public CarePlanActivityKind fromCode(String codeString) throws IllegalArgumentException {
464      if (codeString == null || "".equals(codeString))
465            if (codeString == null || "".equals(codeString))
466                return null;
467        if ("Appointment".equals(codeString))
468          return CarePlanActivityKind.APPOINTMENT;
469        if ("CommunicationRequest".equals(codeString))
470          return CarePlanActivityKind.COMMUNICATIONREQUEST;
471        if ("DeviceRequest".equals(codeString))
472          return CarePlanActivityKind.DEVICEREQUEST;
473        if ("MedicationRequest".equals(codeString))
474          return CarePlanActivityKind.MEDICATIONREQUEST;
475        if ("NutritionOrder".equals(codeString))
476          return CarePlanActivityKind.NUTRITIONORDER;
477        if ("Task".equals(codeString))
478          return CarePlanActivityKind.TASK;
479        if ("ServiceRequest".equals(codeString))
480          return CarePlanActivityKind.SERVICEREQUEST;
481        if ("VisionPrescription".equals(codeString))
482          return CarePlanActivityKind.VISIONPRESCRIPTION;
483        throw new IllegalArgumentException("Unknown CarePlanActivityKind code '"+codeString+"'");
484        }
485        public Enumeration<CarePlanActivityKind> fromType(Base code) throws FHIRException {
486          if (code == null)
487            return null;
488          if (code.isEmpty())
489            return new Enumeration<CarePlanActivityKind>(this);
490          String codeString = ((PrimitiveType) code).asStringValue();
491          if (codeString == null || "".equals(codeString))
492            return null;
493        if ("Appointment".equals(codeString))
494          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.APPOINTMENT);
495        if ("CommunicationRequest".equals(codeString))
496          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.COMMUNICATIONREQUEST);
497        if ("DeviceRequest".equals(codeString))
498          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.DEVICEREQUEST);
499        if ("MedicationRequest".equals(codeString))
500          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.MEDICATIONREQUEST);
501        if ("NutritionOrder".equals(codeString))
502          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.NUTRITIONORDER);
503        if ("Task".equals(codeString))
504          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.TASK);
505        if ("ServiceRequest".equals(codeString))
506          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.SERVICEREQUEST);
507        if ("VisionPrescription".equals(codeString))
508          return new Enumeration<CarePlanActivityKind>(this, CarePlanActivityKind.VISIONPRESCRIPTION);
509        throw new FHIRException("Unknown CarePlanActivityKind code '"+codeString+"'");
510        }
511    public String toCode(CarePlanActivityKind code) {
512      if (code == CarePlanActivityKind.APPOINTMENT)
513        return "Appointment";
514      if (code == CarePlanActivityKind.COMMUNICATIONREQUEST)
515        return "CommunicationRequest";
516      if (code == CarePlanActivityKind.DEVICEREQUEST)
517        return "DeviceRequest";
518      if (code == CarePlanActivityKind.MEDICATIONREQUEST)
519        return "MedicationRequest";
520      if (code == CarePlanActivityKind.NUTRITIONORDER)
521        return "NutritionOrder";
522      if (code == CarePlanActivityKind.TASK)
523        return "Task";
524      if (code == CarePlanActivityKind.SERVICEREQUEST)
525        return "ServiceRequest";
526      if (code == CarePlanActivityKind.VISIONPRESCRIPTION)
527        return "VisionPrescription";
528      return "?";
529      }
530    public String toSystem(CarePlanActivityKind code) {
531      return code.getSystem();
532      }
533    }
534
535    public enum CarePlanActivityStatus {
536        /**
537         * Care plan activity is planned but no action has yet been taken.
538         */
539        NOTSTARTED, 
540        /**
541         * Appointment or other booking has occurred but activity has not yet begun.
542         */
543        SCHEDULED, 
544        /**
545         * Care plan activity has been started but is not yet complete.
546         */
547        INPROGRESS, 
548        /**
549         * Care plan activity was started but has temporarily ceased with an expectation of resumption at a future time.
550         */
551        ONHOLD, 
552        /**
553         * Care plan activity has been completed (more or less) as planned.
554         */
555        COMPLETED, 
556        /**
557         * The planned care plan activity has been withdrawn.
558         */
559        CANCELLED, 
560        /**
561         * The planned care plan activity has been ended prior to completion after the activity was started.
562         */
563        STOPPED, 
564        /**
565         * The current state of the care plan activity is not known.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which one.
566         */
567        UNKNOWN, 
568        /**
569         * Care plan activity was entered in error and voided.
570         */
571        ENTEREDINERROR, 
572        /**
573         * added to help the parsers with the generic types
574         */
575        NULL;
576        public static CarePlanActivityStatus fromCode(String codeString) throws FHIRException {
577            if (codeString == null || "".equals(codeString))
578                return null;
579        if ("not-started".equals(codeString))
580          return NOTSTARTED;
581        if ("scheduled".equals(codeString))
582          return SCHEDULED;
583        if ("in-progress".equals(codeString))
584          return INPROGRESS;
585        if ("on-hold".equals(codeString))
586          return ONHOLD;
587        if ("completed".equals(codeString))
588          return COMPLETED;
589        if ("cancelled".equals(codeString))
590          return CANCELLED;
591        if ("stopped".equals(codeString))
592          return STOPPED;
593        if ("unknown".equals(codeString))
594          return UNKNOWN;
595        if ("entered-in-error".equals(codeString))
596          return ENTEREDINERROR;
597        if (Configuration.isAcceptInvalidEnums())
598          return null;
599        else
600          throw new FHIRException("Unknown CarePlanActivityStatus code '"+codeString+"'");
601        }
602        public String toCode() {
603          switch (this) {
604            case NOTSTARTED: return "not-started";
605            case SCHEDULED: return "scheduled";
606            case INPROGRESS: return "in-progress";
607            case ONHOLD: return "on-hold";
608            case COMPLETED: return "completed";
609            case CANCELLED: return "cancelled";
610            case STOPPED: return "stopped";
611            case UNKNOWN: return "unknown";
612            case ENTEREDINERROR: return "entered-in-error";
613            default: return "?";
614          }
615        }
616        public String getSystem() {
617          switch (this) {
618            case NOTSTARTED: return "http://hl7.org/fhir/care-plan-activity-status";
619            case SCHEDULED: return "http://hl7.org/fhir/care-plan-activity-status";
620            case INPROGRESS: return "http://hl7.org/fhir/care-plan-activity-status";
621            case ONHOLD: return "http://hl7.org/fhir/care-plan-activity-status";
622            case COMPLETED: return "http://hl7.org/fhir/care-plan-activity-status";
623            case CANCELLED: return "http://hl7.org/fhir/care-plan-activity-status";
624            case STOPPED: return "http://hl7.org/fhir/care-plan-activity-status";
625            case UNKNOWN: return "http://hl7.org/fhir/care-plan-activity-status";
626            case ENTEREDINERROR: return "http://hl7.org/fhir/care-plan-activity-status";
627            default: return "?";
628          }
629        }
630        public String getDefinition() {
631          switch (this) {
632            case NOTSTARTED: return "Care plan activity is planned but no action has yet been taken.";
633            case SCHEDULED: return "Appointment or other booking has occurred but activity has not yet begun.";
634            case INPROGRESS: return "Care plan activity has been started but is not yet complete.";
635            case ONHOLD: return "Care plan activity was started but has temporarily ceased with an expectation of resumption at a future time.";
636            case COMPLETED: return "Care plan activity has been completed (more or less) as planned.";
637            case CANCELLED: return "The planned care plan activity has been withdrawn.";
638            case STOPPED: return "The planned care plan activity has been ended prior to completion after the activity was started.";
639            case UNKNOWN: return "The current state of the care plan activity is not known.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which one.";
640            case ENTEREDINERROR: return "Care plan activity was entered in error and voided.";
641            default: return "?";
642          }
643        }
644        public String getDisplay() {
645          switch (this) {
646            case NOTSTARTED: return "Not Started";
647            case SCHEDULED: return "Scheduled";
648            case INPROGRESS: return "In Progress";
649            case ONHOLD: return "On Hold";
650            case COMPLETED: return "Completed";
651            case CANCELLED: return "Cancelled";
652            case STOPPED: return "Stopped";
653            case UNKNOWN: return "Unknown";
654            case ENTEREDINERROR: return "Entered in Error";
655            default: return "?";
656          }
657        }
658    }
659
660  public static class CarePlanActivityStatusEnumFactory implements EnumFactory<CarePlanActivityStatus> {
661    public CarePlanActivityStatus fromCode(String codeString) throws IllegalArgumentException {
662      if (codeString == null || "".equals(codeString))
663            if (codeString == null || "".equals(codeString))
664                return null;
665        if ("not-started".equals(codeString))
666          return CarePlanActivityStatus.NOTSTARTED;
667        if ("scheduled".equals(codeString))
668          return CarePlanActivityStatus.SCHEDULED;
669        if ("in-progress".equals(codeString))
670          return CarePlanActivityStatus.INPROGRESS;
671        if ("on-hold".equals(codeString))
672          return CarePlanActivityStatus.ONHOLD;
673        if ("completed".equals(codeString))
674          return CarePlanActivityStatus.COMPLETED;
675        if ("cancelled".equals(codeString))
676          return CarePlanActivityStatus.CANCELLED;
677        if ("stopped".equals(codeString))
678          return CarePlanActivityStatus.STOPPED;
679        if ("unknown".equals(codeString))
680          return CarePlanActivityStatus.UNKNOWN;
681        if ("entered-in-error".equals(codeString))
682          return CarePlanActivityStatus.ENTEREDINERROR;
683        throw new IllegalArgumentException("Unknown CarePlanActivityStatus code '"+codeString+"'");
684        }
685        public Enumeration<CarePlanActivityStatus> fromType(Base code) throws FHIRException {
686          if (code == null)
687            return null;
688          if (code.isEmpty())
689            return new Enumeration<CarePlanActivityStatus>(this);
690          String codeString = ((PrimitiveType) code).asStringValue();
691          if (codeString == null || "".equals(codeString))
692            return null;
693        if ("not-started".equals(codeString))
694          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.NOTSTARTED);
695        if ("scheduled".equals(codeString))
696          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.SCHEDULED);
697        if ("in-progress".equals(codeString))
698          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.INPROGRESS);
699        if ("on-hold".equals(codeString))
700          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.ONHOLD);
701        if ("completed".equals(codeString))
702          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.COMPLETED);
703        if ("cancelled".equals(codeString))
704          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.CANCELLED);
705        if ("stopped".equals(codeString))
706          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.STOPPED);
707        if ("unknown".equals(codeString))
708          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.UNKNOWN);
709        if ("entered-in-error".equals(codeString))
710          return new Enumeration<CarePlanActivityStatus>(this, CarePlanActivityStatus.ENTEREDINERROR);
711        throw new FHIRException("Unknown CarePlanActivityStatus code '"+codeString+"'");
712        }
713    public String toCode(CarePlanActivityStatus code) {
714      if (code == CarePlanActivityStatus.NOTSTARTED)
715        return "not-started";
716      if (code == CarePlanActivityStatus.SCHEDULED)
717        return "scheduled";
718      if (code == CarePlanActivityStatus.INPROGRESS)
719        return "in-progress";
720      if (code == CarePlanActivityStatus.ONHOLD)
721        return "on-hold";
722      if (code == CarePlanActivityStatus.COMPLETED)
723        return "completed";
724      if (code == CarePlanActivityStatus.CANCELLED)
725        return "cancelled";
726      if (code == CarePlanActivityStatus.STOPPED)
727        return "stopped";
728      if (code == CarePlanActivityStatus.UNKNOWN)
729        return "unknown";
730      if (code == CarePlanActivityStatus.ENTEREDINERROR)
731        return "entered-in-error";
732      return "?";
733      }
734    public String toSystem(CarePlanActivityStatus code) {
735      return code.getSystem();
736      }
737    }
738
739    @Block()
740    public static class CarePlanActivityComponent extends BackboneElement implements IBaseBackboneElement {
741        /**
742         * Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not).
743         */
744        @Child(name = "outcomeCodeableConcept", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
745        @Description(shortDefinition="Results of the activity", formalDefinition="Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not)." )
746        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-plan-activity-outcome")
747        protected List<CodeableConcept> outcomeCodeableConcept;
748
749        /**
750         * Details of the outcome or action resulting from the activity.  The reference to an "event" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).
751         */
752        @Child(name = "outcomeReference", type = {Reference.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
753        @Description(shortDefinition="Appointment, Encounter, Procedure, etc.", formalDefinition="Details of the outcome or action resulting from the activity.  The reference to an \"event\" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource)." )
754        protected List<Reference> outcomeReference;
755        /**
756         * The actual objects that are the target of the reference (Details of the outcome or action resulting from the activity.  The reference to an "event" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).)
757         */
758        protected List<Resource> outcomeReferenceTarget;
759
760
761        /**
762         * Notes about the adherence/status/progress of the activity.
763         */
764        @Child(name = "progress", type = {Annotation.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
765        @Description(shortDefinition="Comments about the activity status/progress", formalDefinition="Notes about the adherence/status/progress of the activity." )
766        protected List<Annotation> progress;
767
768        /**
769         * The details of the proposed activity represented in a specific resource.
770         */
771        @Child(name = "reference", type = {Appointment.class, CommunicationRequest.class, DeviceRequest.class, MedicationRequest.class, NutritionOrder.class, Task.class, ServiceRequest.class, VisionPrescription.class, RequestGroup.class}, order=4, min=0, max=1, modifier=false, summary=false)
772        @Description(shortDefinition="Activity details defined in specific resource", formalDefinition="The details of the proposed activity represented in a specific resource." )
773        protected Reference reference;
774
775        /**
776         * The actual object that is the target of the reference (The details of the proposed activity represented in a specific resource.)
777         */
778        protected Resource referenceTarget;
779
780        /**
781         * A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.
782         */
783        @Child(name = "detail", type = {}, order=5, min=0, max=1, modifier=false, summary=false)
784        @Description(shortDefinition="In-line definition of activity", formalDefinition="A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc." )
785        protected CarePlanActivityDetailComponent detail;
786
787        private static final long serialVersionUID = -609287300L;
788
789    /**
790     * Constructor
791     */
792      public CarePlanActivityComponent() {
793        super();
794      }
795
796        /**
797         * @return {@link #outcomeCodeableConcept} (Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not).)
798         */
799        public List<CodeableConcept> getOutcomeCodeableConcept() { 
800          if (this.outcomeCodeableConcept == null)
801            this.outcomeCodeableConcept = new ArrayList<CodeableConcept>();
802          return this.outcomeCodeableConcept;
803        }
804
805        /**
806         * @return Returns a reference to <code>this</code> for easy method chaining
807         */
808        public CarePlanActivityComponent setOutcomeCodeableConcept(List<CodeableConcept> theOutcomeCodeableConcept) { 
809          this.outcomeCodeableConcept = theOutcomeCodeableConcept;
810          return this;
811        }
812
813        public boolean hasOutcomeCodeableConcept() { 
814          if (this.outcomeCodeableConcept == null)
815            return false;
816          for (CodeableConcept item : this.outcomeCodeableConcept)
817            if (!item.isEmpty())
818              return true;
819          return false;
820        }
821
822        public CodeableConcept addOutcomeCodeableConcept() { //3
823          CodeableConcept t = new CodeableConcept();
824          if (this.outcomeCodeableConcept == null)
825            this.outcomeCodeableConcept = new ArrayList<CodeableConcept>();
826          this.outcomeCodeableConcept.add(t);
827          return t;
828        }
829
830        public CarePlanActivityComponent addOutcomeCodeableConcept(CodeableConcept t) { //3
831          if (t == null)
832            return this;
833          if (this.outcomeCodeableConcept == null)
834            this.outcomeCodeableConcept = new ArrayList<CodeableConcept>();
835          this.outcomeCodeableConcept.add(t);
836          return this;
837        }
838
839        /**
840         * @return The first repetition of repeating field {@link #outcomeCodeableConcept}, creating it if it does not already exist
841         */
842        public CodeableConcept getOutcomeCodeableConceptFirstRep() { 
843          if (getOutcomeCodeableConcept().isEmpty()) {
844            addOutcomeCodeableConcept();
845          }
846          return getOutcomeCodeableConcept().get(0);
847        }
848
849        /**
850         * @return {@link #outcomeReference} (Details of the outcome or action resulting from the activity.  The reference to an "event" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).)
851         */
852        public List<Reference> getOutcomeReference() { 
853          if (this.outcomeReference == null)
854            this.outcomeReference = new ArrayList<Reference>();
855          return this.outcomeReference;
856        }
857
858        /**
859         * @return Returns a reference to <code>this</code> for easy method chaining
860         */
861        public CarePlanActivityComponent setOutcomeReference(List<Reference> theOutcomeReference) { 
862          this.outcomeReference = theOutcomeReference;
863          return this;
864        }
865
866        public boolean hasOutcomeReference() { 
867          if (this.outcomeReference == null)
868            return false;
869          for (Reference item : this.outcomeReference)
870            if (!item.isEmpty())
871              return true;
872          return false;
873        }
874
875        public Reference addOutcomeReference() { //3
876          Reference t = new Reference();
877          if (this.outcomeReference == null)
878            this.outcomeReference = new ArrayList<Reference>();
879          this.outcomeReference.add(t);
880          return t;
881        }
882
883        public CarePlanActivityComponent addOutcomeReference(Reference t) { //3
884          if (t == null)
885            return this;
886          if (this.outcomeReference == null)
887            this.outcomeReference = new ArrayList<Reference>();
888          this.outcomeReference.add(t);
889          return this;
890        }
891
892        /**
893         * @return The first repetition of repeating field {@link #outcomeReference}, creating it if it does not already exist
894         */
895        public Reference getOutcomeReferenceFirstRep() { 
896          if (getOutcomeReference().isEmpty()) {
897            addOutcomeReference();
898          }
899          return getOutcomeReference().get(0);
900        }
901
902        /**
903         * @deprecated Use Reference#setResource(IBaseResource) instead
904         */
905        @Deprecated
906        public List<Resource> getOutcomeReferenceTarget() { 
907          if (this.outcomeReferenceTarget == null)
908            this.outcomeReferenceTarget = new ArrayList<Resource>();
909          return this.outcomeReferenceTarget;
910        }
911
912        /**
913         * @return {@link #progress} (Notes about the adherence/status/progress of the activity.)
914         */
915        public List<Annotation> getProgress() { 
916          if (this.progress == null)
917            this.progress = new ArrayList<Annotation>();
918          return this.progress;
919        }
920
921        /**
922         * @return Returns a reference to <code>this</code> for easy method chaining
923         */
924        public CarePlanActivityComponent setProgress(List<Annotation> theProgress) { 
925          this.progress = theProgress;
926          return this;
927        }
928
929        public boolean hasProgress() { 
930          if (this.progress == null)
931            return false;
932          for (Annotation item : this.progress)
933            if (!item.isEmpty())
934              return true;
935          return false;
936        }
937
938        public Annotation addProgress() { //3
939          Annotation t = new Annotation();
940          if (this.progress == null)
941            this.progress = new ArrayList<Annotation>();
942          this.progress.add(t);
943          return t;
944        }
945
946        public CarePlanActivityComponent addProgress(Annotation t) { //3
947          if (t == null)
948            return this;
949          if (this.progress == null)
950            this.progress = new ArrayList<Annotation>();
951          this.progress.add(t);
952          return this;
953        }
954
955        /**
956         * @return The first repetition of repeating field {@link #progress}, creating it if it does not already exist
957         */
958        public Annotation getProgressFirstRep() { 
959          if (getProgress().isEmpty()) {
960            addProgress();
961          }
962          return getProgress().get(0);
963        }
964
965        /**
966         * @return {@link #reference} (The details of the proposed activity represented in a specific resource.)
967         */
968        public Reference getReference() { 
969          if (this.reference == null)
970            if (Configuration.errorOnAutoCreate())
971              throw new Error("Attempt to auto-create CarePlanActivityComponent.reference");
972            else if (Configuration.doAutoCreate())
973              this.reference = new Reference(); // cc
974          return this.reference;
975        }
976
977        public boolean hasReference() { 
978          return this.reference != null && !this.reference.isEmpty();
979        }
980
981        /**
982         * @param value {@link #reference} (The details of the proposed activity represented in a specific resource.)
983         */
984        public CarePlanActivityComponent setReference(Reference value) { 
985          this.reference = value;
986          return this;
987        }
988
989        /**
990         * @return {@link #reference} 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 details of the proposed activity represented in a specific resource.)
991         */
992        public Resource getReferenceTarget() { 
993          return this.referenceTarget;
994        }
995
996        /**
997         * @param value {@link #reference} 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 details of the proposed activity represented in a specific resource.)
998         */
999        public CarePlanActivityComponent setReferenceTarget(Resource value) { 
1000          this.referenceTarget = value;
1001          return this;
1002        }
1003
1004        /**
1005         * @return {@link #detail} (A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.)
1006         */
1007        public CarePlanActivityDetailComponent getDetail() { 
1008          if (this.detail == null)
1009            if (Configuration.errorOnAutoCreate())
1010              throw new Error("Attempt to auto-create CarePlanActivityComponent.detail");
1011            else if (Configuration.doAutoCreate())
1012              this.detail = new CarePlanActivityDetailComponent(); // cc
1013          return this.detail;
1014        }
1015
1016        public boolean hasDetail() { 
1017          return this.detail != null && !this.detail.isEmpty();
1018        }
1019
1020        /**
1021         * @param value {@link #detail} (A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.)
1022         */
1023        public CarePlanActivityComponent setDetail(CarePlanActivityDetailComponent value) { 
1024          this.detail = value;
1025          return this;
1026        }
1027
1028        protected void listChildren(List<Property> children) {
1029          super.listChildren(children);
1030          children.add(new Property("outcomeCodeableConcept", "CodeableConcept", "Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not).", 0, java.lang.Integer.MAX_VALUE, outcomeCodeableConcept));
1031          children.add(new Property("outcomeReference", "Reference(Any)", "Details of the outcome or action resulting from the activity.  The reference to an \"event\" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).", 0, java.lang.Integer.MAX_VALUE, outcomeReference));
1032          children.add(new Property("progress", "Annotation", "Notes about the adherence/status/progress of the activity.", 0, java.lang.Integer.MAX_VALUE, progress));
1033          children.add(new Property("reference", "Reference(Appointment|CommunicationRequest|DeviceRequest|MedicationRequest|NutritionOrder|Task|ServiceRequest|VisionPrescription|RequestGroup)", "The details of the proposed activity represented in a specific resource.", 0, 1, reference));
1034          children.add(new Property("detail", "", "A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.", 0, 1, detail));
1035        }
1036
1037        @Override
1038        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1039          switch (_hash) {
1040          case -511913489: /*outcomeCodeableConcept*/  return new Property("outcomeCodeableConcept", "CodeableConcept", "Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not).", 0, java.lang.Integer.MAX_VALUE, outcomeCodeableConcept);
1041          case -782273511: /*outcomeReference*/  return new Property("outcomeReference", "Reference(Any)", "Details of the outcome or action resulting from the activity.  The reference to an \"event\" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).", 0, java.lang.Integer.MAX_VALUE, outcomeReference);
1042          case -1001078227: /*progress*/  return new Property("progress", "Annotation", "Notes about the adherence/status/progress of the activity.", 0, java.lang.Integer.MAX_VALUE, progress);
1043          case -925155509: /*reference*/  return new Property("reference", "Reference(Appointment|CommunicationRequest|DeviceRequest|MedicationRequest|NutritionOrder|Task|ServiceRequest|VisionPrescription|RequestGroup)", "The details of the proposed activity represented in a specific resource.", 0, 1, reference);
1044          case -1335224239: /*detail*/  return new Property("detail", "", "A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.", 0, 1, detail);
1045          default: return super.getNamedProperty(_hash, _name, _checkValid);
1046          }
1047
1048        }
1049
1050      @Override
1051      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1052        switch (hash) {
1053        case -511913489: /*outcomeCodeableConcept*/ return this.outcomeCodeableConcept == null ? new Base[0] : this.outcomeCodeableConcept.toArray(new Base[this.outcomeCodeableConcept.size()]); // CodeableConcept
1054        case -782273511: /*outcomeReference*/ return this.outcomeReference == null ? new Base[0] : this.outcomeReference.toArray(new Base[this.outcomeReference.size()]); // Reference
1055        case -1001078227: /*progress*/ return this.progress == null ? new Base[0] : this.progress.toArray(new Base[this.progress.size()]); // Annotation
1056        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
1057        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // CarePlanActivityDetailComponent
1058        default: return super.getProperty(hash, name, checkValid);
1059        }
1060
1061      }
1062
1063      @Override
1064      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1065        switch (hash) {
1066        case -511913489: // outcomeCodeableConcept
1067          this.getOutcomeCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept
1068          return value;
1069        case -782273511: // outcomeReference
1070          this.getOutcomeReference().add(castToReference(value)); // Reference
1071          return value;
1072        case -1001078227: // progress
1073          this.getProgress().add(castToAnnotation(value)); // Annotation
1074          return value;
1075        case -925155509: // reference
1076          this.reference = castToReference(value); // Reference
1077          return value;
1078        case -1335224239: // detail
1079          this.detail = (CarePlanActivityDetailComponent) value; // CarePlanActivityDetailComponent
1080          return value;
1081        default: return super.setProperty(hash, name, value);
1082        }
1083
1084      }
1085
1086      @Override
1087      public Base setProperty(String name, Base value) throws FHIRException {
1088        if (name.equals("outcomeCodeableConcept")) {
1089          this.getOutcomeCodeableConcept().add(castToCodeableConcept(value));
1090        } else if (name.equals("outcomeReference")) {
1091          this.getOutcomeReference().add(castToReference(value));
1092        } else if (name.equals("progress")) {
1093          this.getProgress().add(castToAnnotation(value));
1094        } else if (name.equals("reference")) {
1095          this.reference = castToReference(value); // Reference
1096        } else if (name.equals("detail")) {
1097          this.detail = (CarePlanActivityDetailComponent) value; // CarePlanActivityDetailComponent
1098        } else
1099          return super.setProperty(name, value);
1100        return value;
1101      }
1102
1103      @Override
1104      public Base makeProperty(int hash, String name) throws FHIRException {
1105        switch (hash) {
1106        case -511913489:  return addOutcomeCodeableConcept(); 
1107        case -782273511:  return addOutcomeReference(); 
1108        case -1001078227:  return addProgress(); 
1109        case -925155509:  return getReference(); 
1110        case -1335224239:  return getDetail(); 
1111        default: return super.makeProperty(hash, name);
1112        }
1113
1114      }
1115
1116      @Override
1117      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1118        switch (hash) {
1119        case -511913489: /*outcomeCodeableConcept*/ return new String[] {"CodeableConcept"};
1120        case -782273511: /*outcomeReference*/ return new String[] {"Reference"};
1121        case -1001078227: /*progress*/ return new String[] {"Annotation"};
1122        case -925155509: /*reference*/ return new String[] {"Reference"};
1123        case -1335224239: /*detail*/ return new String[] {};
1124        default: return super.getTypesForProperty(hash, name);
1125        }
1126
1127      }
1128
1129      @Override
1130      public Base addChild(String name) throws FHIRException {
1131        if (name.equals("outcomeCodeableConcept")) {
1132          return addOutcomeCodeableConcept();
1133        }
1134        else if (name.equals("outcomeReference")) {
1135          return addOutcomeReference();
1136        }
1137        else if (name.equals("progress")) {
1138          return addProgress();
1139        }
1140        else if (name.equals("reference")) {
1141          this.reference = new Reference();
1142          return this.reference;
1143        }
1144        else if (name.equals("detail")) {
1145          this.detail = new CarePlanActivityDetailComponent();
1146          return this.detail;
1147        }
1148        else
1149          return super.addChild(name);
1150      }
1151
1152      public CarePlanActivityComponent copy() {
1153        CarePlanActivityComponent dst = new CarePlanActivityComponent();
1154        copyValues(dst);
1155        if (outcomeCodeableConcept != null) {
1156          dst.outcomeCodeableConcept = new ArrayList<CodeableConcept>();
1157          for (CodeableConcept i : outcomeCodeableConcept)
1158            dst.outcomeCodeableConcept.add(i.copy());
1159        };
1160        if (outcomeReference != null) {
1161          dst.outcomeReference = new ArrayList<Reference>();
1162          for (Reference i : outcomeReference)
1163            dst.outcomeReference.add(i.copy());
1164        };
1165        if (progress != null) {
1166          dst.progress = new ArrayList<Annotation>();
1167          for (Annotation i : progress)
1168            dst.progress.add(i.copy());
1169        };
1170        dst.reference = reference == null ? null : reference.copy();
1171        dst.detail = detail == null ? null : detail.copy();
1172        return dst;
1173      }
1174
1175      @Override
1176      public boolean equalsDeep(Base other_) {
1177        if (!super.equalsDeep(other_))
1178          return false;
1179        if (!(other_ instanceof CarePlanActivityComponent))
1180          return false;
1181        CarePlanActivityComponent o = (CarePlanActivityComponent) other_;
1182        return compareDeep(outcomeCodeableConcept, o.outcomeCodeableConcept, true) && compareDeep(outcomeReference, o.outcomeReference, true)
1183           && compareDeep(progress, o.progress, true) && compareDeep(reference, o.reference, true) && compareDeep(detail, o.detail, true)
1184          ;
1185      }
1186
1187      @Override
1188      public boolean equalsShallow(Base other_) {
1189        if (!super.equalsShallow(other_))
1190          return false;
1191        if (!(other_ instanceof CarePlanActivityComponent))
1192          return false;
1193        CarePlanActivityComponent o = (CarePlanActivityComponent) other_;
1194        return true;
1195      }
1196
1197      public boolean isEmpty() {
1198        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(outcomeCodeableConcept, outcomeReference
1199          , progress, reference, detail);
1200      }
1201
1202  public String fhirType() {
1203    return "CarePlan.activity";
1204
1205  }
1206
1207  }
1208
1209    @Block()
1210    public static class CarePlanActivityDetailComponent extends BackboneElement implements IBaseBackboneElement {
1211        /**
1212         * A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.
1213         */
1214        @Child(name = "kind", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1215        @Description(shortDefinition="Kind of resource", formalDefinition="A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest." )
1216        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-plan-activity-kind")
1217        protected Enumeration<CarePlanActivityKind> kind;
1218
1219        /**
1220         * The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.
1221         */
1222        @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1223        @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity." )
1224        protected List<CanonicalType> instantiatesCanonical;
1225
1226        /**
1227         * The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.
1228         */
1229        @Child(name = "instantiatesUri", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1230        @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity." )
1231        protected List<UriType> instantiatesUri;
1232
1233        /**
1234         * Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter.
1235         */
1236        @Child(name = "code", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1237        @Description(shortDefinition="Detail type of activity", formalDefinition="Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter." )
1238        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-code")
1239        protected CodeableConcept code;
1240
1241        /**
1242         * Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited.
1243         */
1244        @Child(name = "reasonCode", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1245        @Description(shortDefinition="Why activity should be done or why activity was prohibited", formalDefinition="Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited." )
1246        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
1247        protected List<CodeableConcept> reasonCode;
1248
1249        /**
1250         * Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan.
1251         */
1252        @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1253        @Description(shortDefinition="Why activity is needed", formalDefinition="Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan." )
1254        protected List<Reference> reasonReference;
1255        /**
1256         * The actual objects that are the target of the reference (Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan.)
1257         */
1258        protected List<Resource> reasonReferenceTarget;
1259
1260
1261        /**
1262         * Internal reference that identifies the goals that this activity is intended to contribute towards meeting.
1263         */
1264        @Child(name = "goal", type = {Goal.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1265        @Description(shortDefinition="Goals this activity relates to", formalDefinition="Internal reference that identifies the goals that this activity is intended to contribute towards meeting." )
1266        protected List<Reference> goal;
1267        /**
1268         * The actual objects that are the target of the reference (Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1269         */
1270        protected List<Goal> goalTarget;
1271
1272
1273        /**
1274         * Identifies what progress is being made for the specific activity.
1275         */
1276        @Child(name = "status", type = {CodeType.class}, order=8, min=1, max=1, modifier=true, summary=false)
1277        @Description(shortDefinition="not-started | scheduled | in-progress | on-hold | completed | cancelled | stopped | unknown | entered-in-error", formalDefinition="Identifies what progress is being made for the specific activity." )
1278        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-plan-activity-status")
1279        protected Enumeration<CarePlanActivityStatus> status;
1280
1281        /**
1282         * Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.
1283         */
1284        @Child(name = "statusReason", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
1285        @Description(shortDefinition="Reason for current status", formalDefinition="Provides reason why the activity isn't yet started, is on hold, was cancelled, etc." )
1286        protected CodeableConcept statusReason;
1287
1288        /**
1289         * If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
1290         */
1291        @Child(name = "doNotPerform", type = {BooleanType.class}, order=10, min=0, max=1, modifier=true, summary=false)
1292        @Description(shortDefinition="If true, activity is prohibiting action", formalDefinition="If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan." )
1293        protected BooleanType doNotPerform;
1294
1295        /**
1296         * The period, timing or frequency upon which the described activity is to occur.
1297         */
1298        @Child(name = "scheduled", type = {Timing.class, Period.class, StringType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1299        @Description(shortDefinition="When activity is to occur", formalDefinition="The period, timing or frequency upon which the described activity is to occur." )
1300        protected Type scheduled;
1301
1302        /**
1303         * Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.
1304         */
1305        @Child(name = "location", type = {Location.class}, order=12, min=0, max=1, modifier=false, summary=false)
1306        @Description(shortDefinition="Where it should happen", formalDefinition="Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc." )
1307        protected Reference location;
1308
1309        /**
1310         * The actual object that is the target of the reference (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1311         */
1312        protected Location locationTarget;
1313
1314        /**
1315         * Identifies who's expected to be involved in the activity.
1316         */
1317        @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, RelatedPerson.class, Patient.class, CareTeam.class, HealthcareService.class, Device.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1318        @Description(shortDefinition="Who will be responsible?", formalDefinition="Identifies who's expected to be involved in the activity." )
1319        protected List<Reference> performer;
1320        /**
1321         * The actual objects that are the target of the reference (Identifies who's expected to be involved in the activity.)
1322         */
1323        protected List<Resource> performerTarget;
1324
1325
1326        /**
1327         * Identifies the food, drug or other product to be consumed or supplied in the activity.
1328         */
1329        @Child(name = "product", type = {CodeableConcept.class, Medication.class, Substance.class}, order=14, min=0, max=1, modifier=false, summary=false)
1330        @Description(shortDefinition="What is to be administered/supplied", formalDefinition="Identifies the food, drug or other product to be consumed or supplied in the activity." )
1331        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes")
1332        protected Type product;
1333
1334        /**
1335         * Identifies the quantity expected to be consumed in a given day.
1336         */
1337        @Child(name = "dailyAmount", type = {Quantity.class}, order=15, min=0, max=1, modifier=false, summary=false)
1338        @Description(shortDefinition="How to consume/day?", formalDefinition="Identifies the quantity expected to be consumed in a given day." )
1339        protected Quantity dailyAmount;
1340
1341        /**
1342         * Identifies the quantity expected to be supplied, administered or consumed by the subject.
1343         */
1344        @Child(name = "quantity", type = {Quantity.class}, order=16, min=0, max=1, modifier=false, summary=false)
1345        @Description(shortDefinition="How much to administer/supply/consume", formalDefinition="Identifies the quantity expected to be supplied, administered or consumed by the subject." )
1346        protected Quantity quantity;
1347
1348        /**
1349         * This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.
1350         */
1351        @Child(name = "description", type = {StringType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1352        @Description(shortDefinition="Extra info describing activity to perform", formalDefinition="This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc." )
1353        protected StringType description;
1354
1355        private static final long serialVersionUID = 1355568081L;
1356
1357    /**
1358     * Constructor
1359     */
1360      public CarePlanActivityDetailComponent() {
1361        super();
1362      }
1363
1364    /**
1365     * Constructor
1366     */
1367      public CarePlanActivityDetailComponent(Enumeration<CarePlanActivityStatus> status) {
1368        super();
1369        this.status = status;
1370      }
1371
1372        /**
1373         * @return {@link #kind} (A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
1374         */
1375        public Enumeration<CarePlanActivityKind> getKindElement() { 
1376          if (this.kind == null)
1377            if (Configuration.errorOnAutoCreate())
1378              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.kind");
1379            else if (Configuration.doAutoCreate())
1380              this.kind = new Enumeration<CarePlanActivityKind>(new CarePlanActivityKindEnumFactory()); // bb
1381          return this.kind;
1382        }
1383
1384        public boolean hasKindElement() { 
1385          return this.kind != null && !this.kind.isEmpty();
1386        }
1387
1388        public boolean hasKind() { 
1389          return this.kind != null && !this.kind.isEmpty();
1390        }
1391
1392        /**
1393         * @param value {@link #kind} (A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
1394         */
1395        public CarePlanActivityDetailComponent setKindElement(Enumeration<CarePlanActivityKind> value) { 
1396          this.kind = value;
1397          return this;
1398        }
1399
1400        /**
1401         * @return A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.
1402         */
1403        public CarePlanActivityKind getKind() { 
1404          return this.kind == null ? null : this.kind.getValue();
1405        }
1406
1407        /**
1408         * @param value A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.
1409         */
1410        public CarePlanActivityDetailComponent setKind(CarePlanActivityKind value) { 
1411          if (value == null)
1412            this.kind = null;
1413          else {
1414            if (this.kind == null)
1415              this.kind = new Enumeration<CarePlanActivityKind>(new CarePlanActivityKindEnumFactory());
1416            this.kind.setValue(value);
1417          }
1418          return this;
1419        }
1420
1421        /**
1422         * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1423         */
1424        public List<CanonicalType> getInstantiatesCanonical() { 
1425          if (this.instantiatesCanonical == null)
1426            this.instantiatesCanonical = new ArrayList<CanonicalType>();
1427          return this.instantiatesCanonical;
1428        }
1429
1430        /**
1431         * @return Returns a reference to <code>this</code> for easy method chaining
1432         */
1433        public CarePlanActivityDetailComponent setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
1434          this.instantiatesCanonical = theInstantiatesCanonical;
1435          return this;
1436        }
1437
1438        public boolean hasInstantiatesCanonical() { 
1439          if (this.instantiatesCanonical == null)
1440            return false;
1441          for (CanonicalType item : this.instantiatesCanonical)
1442            if (!item.isEmpty())
1443              return true;
1444          return false;
1445        }
1446
1447        /**
1448         * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1449         */
1450        public CanonicalType addInstantiatesCanonicalElement() {//2 
1451          CanonicalType t = new CanonicalType();
1452          if (this.instantiatesCanonical == null)
1453            this.instantiatesCanonical = new ArrayList<CanonicalType>();
1454          this.instantiatesCanonical.add(t);
1455          return t;
1456        }
1457
1458        /**
1459         * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1460         */
1461        public CarePlanActivityDetailComponent addInstantiatesCanonical(String value) { //1
1462          CanonicalType t = new CanonicalType();
1463          t.setValue(value);
1464          if (this.instantiatesCanonical == null)
1465            this.instantiatesCanonical = new ArrayList<CanonicalType>();
1466          this.instantiatesCanonical.add(t);
1467          return this;
1468        }
1469
1470        /**
1471         * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1472         */
1473        public boolean hasInstantiatesCanonical(String value) { 
1474          if (this.instantiatesCanonical == null)
1475            return false;
1476          for (CanonicalType v : this.instantiatesCanonical)
1477            if (v.getValue().equals(value)) // canonical(PlanDefinition|ActivityDefinition|Questionnaire|Measure|OperationDefinition)
1478              return true;
1479          return false;
1480        }
1481
1482        /**
1483         * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1484         */
1485        public List<UriType> getInstantiatesUri() { 
1486          if (this.instantiatesUri == null)
1487            this.instantiatesUri = new ArrayList<UriType>();
1488          return this.instantiatesUri;
1489        }
1490
1491        /**
1492         * @return Returns a reference to <code>this</code> for easy method chaining
1493         */
1494        public CarePlanActivityDetailComponent setInstantiatesUri(List<UriType> theInstantiatesUri) { 
1495          this.instantiatesUri = theInstantiatesUri;
1496          return this;
1497        }
1498
1499        public boolean hasInstantiatesUri() { 
1500          if (this.instantiatesUri == null)
1501            return false;
1502          for (UriType item : this.instantiatesUri)
1503            if (!item.isEmpty())
1504              return true;
1505          return false;
1506        }
1507
1508        /**
1509         * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1510         */
1511        public UriType addInstantiatesUriElement() {//2 
1512          UriType t = new UriType();
1513          if (this.instantiatesUri == null)
1514            this.instantiatesUri = new ArrayList<UriType>();
1515          this.instantiatesUri.add(t);
1516          return t;
1517        }
1518
1519        /**
1520         * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1521         */
1522        public CarePlanActivityDetailComponent addInstantiatesUri(String value) { //1
1523          UriType t = new UriType();
1524          t.setValue(value);
1525          if (this.instantiatesUri == null)
1526            this.instantiatesUri = new ArrayList<UriType>();
1527          this.instantiatesUri.add(t);
1528          return this;
1529        }
1530
1531        /**
1532         * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.)
1533         */
1534        public boolean hasInstantiatesUri(String value) { 
1535          if (this.instantiatesUri == null)
1536            return false;
1537          for (UriType v : this.instantiatesUri)
1538            if (v.getValue().equals(value)) // uri
1539              return true;
1540          return false;
1541        }
1542
1543        /**
1544         * @return {@link #code} (Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter.)
1545         */
1546        public CodeableConcept getCode() { 
1547          if (this.code == null)
1548            if (Configuration.errorOnAutoCreate())
1549              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.code");
1550            else if (Configuration.doAutoCreate())
1551              this.code = new CodeableConcept(); // cc
1552          return this.code;
1553        }
1554
1555        public boolean hasCode() { 
1556          return this.code != null && !this.code.isEmpty();
1557        }
1558
1559        /**
1560         * @param value {@link #code} (Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter.)
1561         */
1562        public CarePlanActivityDetailComponent setCode(CodeableConcept value) { 
1563          this.code = value;
1564          return this;
1565        }
1566
1567        /**
1568         * @return {@link #reasonCode} (Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited.)
1569         */
1570        public List<CodeableConcept> getReasonCode() { 
1571          if (this.reasonCode == null)
1572            this.reasonCode = new ArrayList<CodeableConcept>();
1573          return this.reasonCode;
1574        }
1575
1576        /**
1577         * @return Returns a reference to <code>this</code> for easy method chaining
1578         */
1579        public CarePlanActivityDetailComponent setReasonCode(List<CodeableConcept> theReasonCode) { 
1580          this.reasonCode = theReasonCode;
1581          return this;
1582        }
1583
1584        public boolean hasReasonCode() { 
1585          if (this.reasonCode == null)
1586            return false;
1587          for (CodeableConcept item : this.reasonCode)
1588            if (!item.isEmpty())
1589              return true;
1590          return false;
1591        }
1592
1593        public CodeableConcept addReasonCode() { //3
1594          CodeableConcept t = new CodeableConcept();
1595          if (this.reasonCode == null)
1596            this.reasonCode = new ArrayList<CodeableConcept>();
1597          this.reasonCode.add(t);
1598          return t;
1599        }
1600
1601        public CarePlanActivityDetailComponent addReasonCode(CodeableConcept t) { //3
1602          if (t == null)
1603            return this;
1604          if (this.reasonCode == null)
1605            this.reasonCode = new ArrayList<CodeableConcept>();
1606          this.reasonCode.add(t);
1607          return this;
1608        }
1609
1610        /**
1611         * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
1612         */
1613        public CodeableConcept getReasonCodeFirstRep() { 
1614          if (getReasonCode().isEmpty()) {
1615            addReasonCode();
1616          }
1617          return getReasonCode().get(0);
1618        }
1619
1620        /**
1621         * @return {@link #reasonReference} (Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan.)
1622         */
1623        public List<Reference> getReasonReference() { 
1624          if (this.reasonReference == null)
1625            this.reasonReference = new ArrayList<Reference>();
1626          return this.reasonReference;
1627        }
1628
1629        /**
1630         * @return Returns a reference to <code>this</code> for easy method chaining
1631         */
1632        public CarePlanActivityDetailComponent setReasonReference(List<Reference> theReasonReference) { 
1633          this.reasonReference = theReasonReference;
1634          return this;
1635        }
1636
1637        public boolean hasReasonReference() { 
1638          if (this.reasonReference == null)
1639            return false;
1640          for (Reference item : this.reasonReference)
1641            if (!item.isEmpty())
1642              return true;
1643          return false;
1644        }
1645
1646        public Reference addReasonReference() { //3
1647          Reference t = new Reference();
1648          if (this.reasonReference == null)
1649            this.reasonReference = new ArrayList<Reference>();
1650          this.reasonReference.add(t);
1651          return t;
1652        }
1653
1654        public CarePlanActivityDetailComponent addReasonReference(Reference t) { //3
1655          if (t == null)
1656            return this;
1657          if (this.reasonReference == null)
1658            this.reasonReference = new ArrayList<Reference>();
1659          this.reasonReference.add(t);
1660          return this;
1661        }
1662
1663        /**
1664         * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
1665         */
1666        public Reference getReasonReferenceFirstRep() { 
1667          if (getReasonReference().isEmpty()) {
1668            addReasonReference();
1669          }
1670          return getReasonReference().get(0);
1671        }
1672
1673        /**
1674         * @deprecated Use Reference#setResource(IBaseResource) instead
1675         */
1676        @Deprecated
1677        public List<Resource> getReasonReferenceTarget() { 
1678          if (this.reasonReferenceTarget == null)
1679            this.reasonReferenceTarget = new ArrayList<Resource>();
1680          return this.reasonReferenceTarget;
1681        }
1682
1683        /**
1684         * @return {@link #goal} (Internal reference that identifies the goals that this activity is intended to contribute towards meeting.)
1685         */
1686        public List<Reference> getGoal() { 
1687          if (this.goal == null)
1688            this.goal = new ArrayList<Reference>();
1689          return this.goal;
1690        }
1691
1692        /**
1693         * @return Returns a reference to <code>this</code> for easy method chaining
1694         */
1695        public CarePlanActivityDetailComponent setGoal(List<Reference> theGoal) { 
1696          this.goal = theGoal;
1697          return this;
1698        }
1699
1700        public boolean hasGoal() { 
1701          if (this.goal == null)
1702            return false;
1703          for (Reference item : this.goal)
1704            if (!item.isEmpty())
1705              return true;
1706          return false;
1707        }
1708
1709        public Reference addGoal() { //3
1710          Reference t = new Reference();
1711          if (this.goal == null)
1712            this.goal = new ArrayList<Reference>();
1713          this.goal.add(t);
1714          return t;
1715        }
1716
1717        public CarePlanActivityDetailComponent addGoal(Reference t) { //3
1718          if (t == null)
1719            return this;
1720          if (this.goal == null)
1721            this.goal = new ArrayList<Reference>();
1722          this.goal.add(t);
1723          return this;
1724        }
1725
1726        /**
1727         * @return The first repetition of repeating field {@link #goal}, creating it if it does not already exist
1728         */
1729        public Reference getGoalFirstRep() { 
1730          if (getGoal().isEmpty()) {
1731            addGoal();
1732          }
1733          return getGoal().get(0);
1734        }
1735
1736        /**
1737         * @deprecated Use Reference#setResource(IBaseResource) instead
1738         */
1739        @Deprecated
1740        public List<Goal> getGoalTarget() { 
1741          if (this.goalTarget == null)
1742            this.goalTarget = new ArrayList<Goal>();
1743          return this.goalTarget;
1744        }
1745
1746        /**
1747         * @deprecated Use Reference#setResource(IBaseResource) instead
1748         */
1749        @Deprecated
1750        public Goal addGoalTarget() { 
1751          Goal r = new Goal();
1752          if (this.goalTarget == null)
1753            this.goalTarget = new ArrayList<Goal>();
1754          this.goalTarget.add(r);
1755          return r;
1756        }
1757
1758        /**
1759         * @return {@link #status} (Identifies what progress is being made for the specific activity.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1760         */
1761        public Enumeration<CarePlanActivityStatus> getStatusElement() { 
1762          if (this.status == null)
1763            if (Configuration.errorOnAutoCreate())
1764              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.status");
1765            else if (Configuration.doAutoCreate())
1766              this.status = new Enumeration<CarePlanActivityStatus>(new CarePlanActivityStatusEnumFactory()); // bb
1767          return this.status;
1768        }
1769
1770        public boolean hasStatusElement() { 
1771          return this.status != null && !this.status.isEmpty();
1772        }
1773
1774        public boolean hasStatus() { 
1775          return this.status != null && !this.status.isEmpty();
1776        }
1777
1778        /**
1779         * @param value {@link #status} (Identifies what progress is being made for the specific activity.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1780         */
1781        public CarePlanActivityDetailComponent setStatusElement(Enumeration<CarePlanActivityStatus> value) { 
1782          this.status = value;
1783          return this;
1784        }
1785
1786        /**
1787         * @return Identifies what progress is being made for the specific activity.
1788         */
1789        public CarePlanActivityStatus getStatus() { 
1790          return this.status == null ? null : this.status.getValue();
1791        }
1792
1793        /**
1794         * @param value Identifies what progress is being made for the specific activity.
1795         */
1796        public CarePlanActivityDetailComponent setStatus(CarePlanActivityStatus value) { 
1797            if (this.status == null)
1798              this.status = new Enumeration<CarePlanActivityStatus>(new CarePlanActivityStatusEnumFactory());
1799            this.status.setValue(value);
1800          return this;
1801        }
1802
1803        /**
1804         * @return {@link #statusReason} (Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.)
1805         */
1806        public CodeableConcept getStatusReason() { 
1807          if (this.statusReason == null)
1808            if (Configuration.errorOnAutoCreate())
1809              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.statusReason");
1810            else if (Configuration.doAutoCreate())
1811              this.statusReason = new CodeableConcept(); // cc
1812          return this.statusReason;
1813        }
1814
1815        public boolean hasStatusReason() { 
1816          return this.statusReason != null && !this.statusReason.isEmpty();
1817        }
1818
1819        /**
1820         * @param value {@link #statusReason} (Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.)
1821         */
1822        public CarePlanActivityDetailComponent setStatusReason(CodeableConcept value) { 
1823          this.statusReason = value;
1824          return this;
1825        }
1826
1827        /**
1828         * @return {@link #doNotPerform} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
1829         */
1830        public BooleanType getDoNotPerformElement() { 
1831          if (this.doNotPerform == null)
1832            if (Configuration.errorOnAutoCreate())
1833              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.doNotPerform");
1834            else if (Configuration.doAutoCreate())
1835              this.doNotPerform = new BooleanType(); // bb
1836          return this.doNotPerform;
1837        }
1838
1839        public boolean hasDoNotPerformElement() { 
1840          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
1841        }
1842
1843        public boolean hasDoNotPerform() { 
1844          return this.doNotPerform != null && !this.doNotPerform.isEmpty();
1845        }
1846
1847        /**
1848         * @param value {@link #doNotPerform} (If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value
1849         */
1850        public CarePlanActivityDetailComponent setDoNotPerformElement(BooleanType value) { 
1851          this.doNotPerform = value;
1852          return this;
1853        }
1854
1855        /**
1856         * @return If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
1857         */
1858        public boolean getDoNotPerform() { 
1859          return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue();
1860        }
1861
1862        /**
1863         * @param value If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.
1864         */
1865        public CarePlanActivityDetailComponent setDoNotPerform(boolean value) { 
1866            if (this.doNotPerform == null)
1867              this.doNotPerform = new BooleanType();
1868            this.doNotPerform.setValue(value);
1869          return this;
1870        }
1871
1872        /**
1873         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1874         */
1875        public Type getScheduled() { 
1876          return this.scheduled;
1877        }
1878
1879        /**
1880         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1881         */
1882        public Timing getScheduledTiming() throws FHIRException { 
1883          if (this.scheduled == null)
1884            this.scheduled = new Timing();
1885          if (!(this.scheduled instanceof Timing))
1886            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1887          return (Timing) this.scheduled;
1888        }
1889
1890        public boolean hasScheduledTiming() { 
1891          return this != null && this.scheduled instanceof Timing;
1892        }
1893
1894        /**
1895         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1896         */
1897        public Period getScheduledPeriod() throws FHIRException { 
1898          if (this.scheduled == null)
1899            this.scheduled = new Period();
1900          if (!(this.scheduled instanceof Period))
1901            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1902          return (Period) this.scheduled;
1903        }
1904
1905        public boolean hasScheduledPeriod() { 
1906          return this != null && this.scheduled instanceof Period;
1907        }
1908
1909        /**
1910         * @return {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1911         */
1912        public StringType getScheduledStringType() throws FHIRException { 
1913          if (this.scheduled == null)
1914            this.scheduled = new StringType();
1915          if (!(this.scheduled instanceof StringType))
1916            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.scheduled.getClass().getName()+" was encountered");
1917          return (StringType) this.scheduled;
1918        }
1919
1920        public boolean hasScheduledStringType() { 
1921          return this != null && this.scheduled instanceof StringType;
1922        }
1923
1924        public boolean hasScheduled() { 
1925          return this.scheduled != null && !this.scheduled.isEmpty();
1926        }
1927
1928        /**
1929         * @param value {@link #scheduled} (The period, timing or frequency upon which the described activity is to occur.)
1930         */
1931        public CarePlanActivityDetailComponent setScheduled(Type value) { 
1932          if (value != null && !(value instanceof Timing || value instanceof Period || value instanceof StringType))
1933            throw new Error("Not the right type for CarePlan.activity.detail.scheduled[x]: "+value.fhirType());
1934          this.scheduled = value;
1935          return this;
1936        }
1937
1938        /**
1939         * @return {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1940         */
1941        public Reference getLocation() { 
1942          if (this.location == null)
1943            if (Configuration.errorOnAutoCreate())
1944              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.location");
1945            else if (Configuration.doAutoCreate())
1946              this.location = new Reference(); // cc
1947          return this.location;
1948        }
1949
1950        public boolean hasLocation() { 
1951          return this.location != null && !this.location.isEmpty();
1952        }
1953
1954        /**
1955         * @param value {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1956         */
1957        public CarePlanActivityDetailComponent setLocation(Reference value) { 
1958          this.location = value;
1959          return this;
1960        }
1961
1962        /**
1963         * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1964         */
1965        public Location getLocationTarget() { 
1966          if (this.locationTarget == null)
1967            if (Configuration.errorOnAutoCreate())
1968              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.location");
1969            else if (Configuration.doAutoCreate())
1970              this.locationTarget = new Location(); // aa
1971          return this.locationTarget;
1972        }
1973
1974        /**
1975         * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.)
1976         */
1977        public CarePlanActivityDetailComponent setLocationTarget(Location value) { 
1978          this.locationTarget = value;
1979          return this;
1980        }
1981
1982        /**
1983         * @return {@link #performer} (Identifies who's expected to be involved in the activity.)
1984         */
1985        public List<Reference> getPerformer() { 
1986          if (this.performer == null)
1987            this.performer = new ArrayList<Reference>();
1988          return this.performer;
1989        }
1990
1991        /**
1992         * @return Returns a reference to <code>this</code> for easy method chaining
1993         */
1994        public CarePlanActivityDetailComponent setPerformer(List<Reference> thePerformer) { 
1995          this.performer = thePerformer;
1996          return this;
1997        }
1998
1999        public boolean hasPerformer() { 
2000          if (this.performer == null)
2001            return false;
2002          for (Reference item : this.performer)
2003            if (!item.isEmpty())
2004              return true;
2005          return false;
2006        }
2007
2008        public Reference addPerformer() { //3
2009          Reference t = new Reference();
2010          if (this.performer == null)
2011            this.performer = new ArrayList<Reference>();
2012          this.performer.add(t);
2013          return t;
2014        }
2015
2016        public CarePlanActivityDetailComponent addPerformer(Reference t) { //3
2017          if (t == null)
2018            return this;
2019          if (this.performer == null)
2020            this.performer = new ArrayList<Reference>();
2021          this.performer.add(t);
2022          return this;
2023        }
2024
2025        /**
2026         * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist
2027         */
2028        public Reference getPerformerFirstRep() { 
2029          if (getPerformer().isEmpty()) {
2030            addPerformer();
2031          }
2032          return getPerformer().get(0);
2033        }
2034
2035        /**
2036         * @deprecated Use Reference#setResource(IBaseResource) instead
2037         */
2038        @Deprecated
2039        public List<Resource> getPerformerTarget() { 
2040          if (this.performerTarget == null)
2041            this.performerTarget = new ArrayList<Resource>();
2042          return this.performerTarget;
2043        }
2044
2045        /**
2046         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
2047         */
2048        public Type getProduct() { 
2049          return this.product;
2050        }
2051
2052        /**
2053         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
2054         */
2055        public CodeableConcept getProductCodeableConcept() throws FHIRException { 
2056          if (this.product == null)
2057            this.product = new CodeableConcept();
2058          if (!(this.product instanceof CodeableConcept))
2059            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.product.getClass().getName()+" was encountered");
2060          return (CodeableConcept) this.product;
2061        }
2062
2063        public boolean hasProductCodeableConcept() { 
2064          return this != null && this.product instanceof CodeableConcept;
2065        }
2066
2067        /**
2068         * @return {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
2069         */
2070        public Reference getProductReference() throws FHIRException { 
2071          if (this.product == null)
2072            this.product = new Reference();
2073          if (!(this.product instanceof Reference))
2074            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.product.getClass().getName()+" was encountered");
2075          return (Reference) this.product;
2076        }
2077
2078        public boolean hasProductReference() { 
2079          return this != null && this.product instanceof Reference;
2080        }
2081
2082        public boolean hasProduct() { 
2083          return this.product != null && !this.product.isEmpty();
2084        }
2085
2086        /**
2087         * @param value {@link #product} (Identifies the food, drug or other product to be consumed or supplied in the activity.)
2088         */
2089        public CarePlanActivityDetailComponent setProduct(Type value) { 
2090          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2091            throw new Error("Not the right type for CarePlan.activity.detail.product[x]: "+value.fhirType());
2092          this.product = value;
2093          return this;
2094        }
2095
2096        /**
2097         * @return {@link #dailyAmount} (Identifies the quantity expected to be consumed in a given day.)
2098         */
2099        public Quantity getDailyAmount() { 
2100          if (this.dailyAmount == null)
2101            if (Configuration.errorOnAutoCreate())
2102              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.dailyAmount");
2103            else if (Configuration.doAutoCreate())
2104              this.dailyAmount = new Quantity(); // cc
2105          return this.dailyAmount;
2106        }
2107
2108        public boolean hasDailyAmount() { 
2109          return this.dailyAmount != null && !this.dailyAmount.isEmpty();
2110        }
2111
2112        /**
2113         * @param value {@link #dailyAmount} (Identifies the quantity expected to be consumed in a given day.)
2114         */
2115        public CarePlanActivityDetailComponent setDailyAmount(Quantity value) { 
2116          this.dailyAmount = value;
2117          return this;
2118        }
2119
2120        /**
2121         * @return {@link #quantity} (Identifies the quantity expected to be supplied, administered or consumed by the subject.)
2122         */
2123        public Quantity getQuantity() { 
2124          if (this.quantity == null)
2125            if (Configuration.errorOnAutoCreate())
2126              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.quantity");
2127            else if (Configuration.doAutoCreate())
2128              this.quantity = new Quantity(); // cc
2129          return this.quantity;
2130        }
2131
2132        public boolean hasQuantity() { 
2133          return this.quantity != null && !this.quantity.isEmpty();
2134        }
2135
2136        /**
2137         * @param value {@link #quantity} (Identifies the quantity expected to be supplied, administered or consumed by the subject.)
2138         */
2139        public CarePlanActivityDetailComponent setQuantity(Quantity value) { 
2140          this.quantity = value;
2141          return this;
2142        }
2143
2144        /**
2145         * @return {@link #description} (This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2146         */
2147        public StringType getDescriptionElement() { 
2148          if (this.description == null)
2149            if (Configuration.errorOnAutoCreate())
2150              throw new Error("Attempt to auto-create CarePlanActivityDetailComponent.description");
2151            else if (Configuration.doAutoCreate())
2152              this.description = new StringType(); // bb
2153          return this.description;
2154        }
2155
2156        public boolean hasDescriptionElement() { 
2157          return this.description != null && !this.description.isEmpty();
2158        }
2159
2160        public boolean hasDescription() { 
2161          return this.description != null && !this.description.isEmpty();
2162        }
2163
2164        /**
2165         * @param value {@link #description} (This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2166         */
2167        public CarePlanActivityDetailComponent setDescriptionElement(StringType value) { 
2168          this.description = value;
2169          return this;
2170        }
2171
2172        /**
2173         * @return This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.
2174         */
2175        public String getDescription() { 
2176          return this.description == null ? null : this.description.getValue();
2177        }
2178
2179        /**
2180         * @param value This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.
2181         */
2182        public CarePlanActivityDetailComponent setDescription(String value) { 
2183          if (Utilities.noString(value))
2184            this.description = null;
2185          else {
2186            if (this.description == null)
2187              this.description = new StringType();
2188            this.description.setValue(value);
2189          }
2190          return this;
2191        }
2192
2193        protected void listChildren(List<Property> children) {
2194          super.listChildren(children);
2195          children.add(new Property("kind", "code", "A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.", 0, 1, kind));
2196          children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Questionnaire|Measure|OperationDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
2197          children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
2198          children.add(new Property("code", "CodeableConcept", "Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter.", 0, 1, code));
2199          children.add(new Property("reasonCode", "CodeableConcept", "Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
2200          children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
2201          children.add(new Property("goal", "Reference(Goal)", "Internal reference that identifies the goals that this activity is intended to contribute towards meeting.", 0, java.lang.Integer.MAX_VALUE, goal));
2202          children.add(new Property("status", "code", "Identifies what progress is being made for the specific activity.", 0, 1, status));
2203          children.add(new Property("statusReason", "CodeableConcept", "Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.", 0, 1, statusReason));
2204          children.add(new Property("doNotPerform", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, doNotPerform));
2205          children.add(new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled));
2206          children.add(new Property("location", "Reference(Location)", "Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.", 0, 1, location));
2207          children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|RelatedPerson|Patient|CareTeam|HealthcareService|Device)", "Identifies who's expected to be involved in the activity.", 0, java.lang.Integer.MAX_VALUE, performer));
2208          children.add(new Property("product[x]", "CodeableConcept|Reference(Medication|Substance)", "Identifies the food, drug or other product to be consumed or supplied in the activity.", 0, 1, product));
2209          children.add(new Property("dailyAmount", "SimpleQuantity", "Identifies the quantity expected to be consumed in a given day.", 0, 1, dailyAmount));
2210          children.add(new Property("quantity", "SimpleQuantity", "Identifies the quantity expected to be supplied, administered or consumed by the subject.", 0, 1, quantity));
2211          children.add(new Property("description", "string", "This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.", 0, 1, description));
2212        }
2213
2214        @Override
2215        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2216          switch (_hash) {
2217          case 3292052: /*kind*/  return new Property("kind", "code", "A description of the kind of resource the in-line definition of a care plan activity is representing.  The CarePlan.activity.detail is an in-line definition when a resource is not referenced using CarePlan.activity.reference.  For example, a MedicationRequest, a ServiceRequest, or a CommunicationRequest.", 0, 1, kind);
2218          case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|ActivityDefinition|Questionnaire|Measure|OperationDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
2219          case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan activity.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
2220          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Detailed description of the type of planned activity; e.g. what lab test, what procedure, what kind of encounter.", 0, 1, code);
2221          case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
2222          case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource, such as the health condition(s), whose existence justifies this request and drove the inclusion of this particular activity as part of the plan.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
2223          case 3178259: /*goal*/  return new Property("goal", "Reference(Goal)", "Internal reference that identifies the goals that this activity is intended to contribute towards meeting.", 0, java.lang.Integer.MAX_VALUE, goal);
2224          case -892481550: /*status*/  return new Property("status", "code", "Identifies what progress is being made for the specific activity.", 0, 1, status);
2225          case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.", 0, 1, statusReason);
2226          case -1788508167: /*doNotPerform*/  return new Property("doNotPerform", "boolean", "If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, or missing, indicates that the described activity is one that should be engaged in when following the plan.", 0, 1, doNotPerform);
2227          case 1162627251: /*scheduled[x]*/  return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
2228          case -160710483: /*scheduled*/  return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
2229          case 998483799: /*scheduledTiming*/  return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
2230          case 880422094: /*scheduledPeriod*/  return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
2231          case 980162334: /*scheduledString*/  return new Property("scheduled[x]", "Timing|Period|string", "The period, timing or frequency upon which the described activity is to occur.", 0, 1, scheduled);
2232          case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.", 0, 1, location);
2233          case 481140686: /*performer*/  return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|RelatedPerson|Patient|CareTeam|HealthcareService|Device)", "Identifies who's expected to be involved in the activity.", 0, java.lang.Integer.MAX_VALUE, performer);
2234          case 1753005361: /*product[x]*/  return new Property("product[x]", "CodeableConcept|Reference(Medication|Substance)", "Identifies the food, drug or other product to be consumed or supplied in the activity.", 0, 1, product);
2235          case -309474065: /*product*/  return new Property("product[x]", "CodeableConcept|Reference(Medication|Substance)", "Identifies the food, drug or other product to be consumed or supplied in the activity.", 0, 1, product);
2236          case 906854066: /*productCodeableConcept*/  return new Property("product[x]", "CodeableConcept|Reference(Medication|Substance)", "Identifies the food, drug or other product to be consumed or supplied in the activity.", 0, 1, product);
2237          case -669667556: /*productReference*/  return new Property("product[x]", "CodeableConcept|Reference(Medication|Substance)", "Identifies the food, drug or other product to be consumed or supplied in the activity.", 0, 1, product);
2238          case -768908335: /*dailyAmount*/  return new Property("dailyAmount", "SimpleQuantity", "Identifies the quantity expected to be consumed in a given day.", 0, 1, dailyAmount);
2239          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "Identifies the quantity expected to be supplied, administered or consumed by the subject.", 0, 1, quantity);
2240          case -1724546052: /*description*/  return new Property("description", "string", "This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.", 0, 1, description);
2241          default: return super.getNamedProperty(_hash, _name, _checkValid);
2242          }
2243
2244        }
2245
2246      @Override
2247      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2248        switch (hash) {
2249        case 3292052: /*kind*/ return this.kind == null ? new Base[0] : new Base[] {this.kind}; // Enumeration<CarePlanActivityKind>
2250        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
2251        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
2252        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2253        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
2254        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
2255        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // Reference
2256        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CarePlanActivityStatus>
2257        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept
2258        case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType
2259        case -160710483: /*scheduled*/ return this.scheduled == null ? new Base[0] : new Base[] {this.scheduled}; // Type
2260        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
2261        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference
2262        case -309474065: /*product*/ return this.product == null ? new Base[0] : new Base[] {this.product}; // Type
2263        case -768908335: /*dailyAmount*/ return this.dailyAmount == null ? new Base[0] : new Base[] {this.dailyAmount}; // Quantity
2264        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2265        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2266        default: return super.getProperty(hash, name, checkValid);
2267        }
2268
2269      }
2270
2271      @Override
2272      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2273        switch (hash) {
2274        case 3292052: // kind
2275          value = new CarePlanActivityKindEnumFactory().fromType(castToCode(value));
2276          this.kind = (Enumeration) value; // Enumeration<CarePlanActivityKind>
2277          return value;
2278        case 8911915: // instantiatesCanonical
2279          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
2280          return value;
2281        case -1926393373: // instantiatesUri
2282          this.getInstantiatesUri().add(castToUri(value)); // UriType
2283          return value;
2284        case 3059181: // code
2285          this.code = castToCodeableConcept(value); // CodeableConcept
2286          return value;
2287        case 722137681: // reasonCode
2288          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
2289          return value;
2290        case -1146218137: // reasonReference
2291          this.getReasonReference().add(castToReference(value)); // Reference
2292          return value;
2293        case 3178259: // goal
2294          this.getGoal().add(castToReference(value)); // Reference
2295          return value;
2296        case -892481550: // status
2297          value = new CarePlanActivityStatusEnumFactory().fromType(castToCode(value));
2298          this.status = (Enumeration) value; // Enumeration<CarePlanActivityStatus>
2299          return value;
2300        case 2051346646: // statusReason
2301          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2302          return value;
2303        case -1788508167: // doNotPerform
2304          this.doNotPerform = castToBoolean(value); // BooleanType
2305          return value;
2306        case -160710483: // scheduled
2307          this.scheduled = castToType(value); // Type
2308          return value;
2309        case 1901043637: // location
2310          this.location = castToReference(value); // Reference
2311          return value;
2312        case 481140686: // performer
2313          this.getPerformer().add(castToReference(value)); // Reference
2314          return value;
2315        case -309474065: // product
2316          this.product = castToType(value); // Type
2317          return value;
2318        case -768908335: // dailyAmount
2319          this.dailyAmount = castToQuantity(value); // Quantity
2320          return value;
2321        case -1285004149: // quantity
2322          this.quantity = castToQuantity(value); // Quantity
2323          return value;
2324        case -1724546052: // description
2325          this.description = castToString(value); // StringType
2326          return value;
2327        default: return super.setProperty(hash, name, value);
2328        }
2329
2330      }
2331
2332      @Override
2333      public Base setProperty(String name, Base value) throws FHIRException {
2334        if (name.equals("kind")) {
2335          value = new CarePlanActivityKindEnumFactory().fromType(castToCode(value));
2336          this.kind = (Enumeration) value; // Enumeration<CarePlanActivityKind>
2337        } else if (name.equals("instantiatesCanonical")) {
2338          this.getInstantiatesCanonical().add(castToCanonical(value));
2339        } else if (name.equals("instantiatesUri")) {
2340          this.getInstantiatesUri().add(castToUri(value));
2341        } else if (name.equals("code")) {
2342          this.code = castToCodeableConcept(value); // CodeableConcept
2343        } else if (name.equals("reasonCode")) {
2344          this.getReasonCode().add(castToCodeableConcept(value));
2345        } else if (name.equals("reasonReference")) {
2346          this.getReasonReference().add(castToReference(value));
2347        } else if (name.equals("goal")) {
2348          this.getGoal().add(castToReference(value));
2349        } else if (name.equals("status")) {
2350          value = new CarePlanActivityStatusEnumFactory().fromType(castToCode(value));
2351          this.status = (Enumeration) value; // Enumeration<CarePlanActivityStatus>
2352        } else if (name.equals("statusReason")) {
2353          this.statusReason = castToCodeableConcept(value); // CodeableConcept
2354        } else if (name.equals("doNotPerform")) {
2355          this.doNotPerform = castToBoolean(value); // BooleanType
2356        } else if (name.equals("scheduled[x]")) {
2357          this.scheduled = castToType(value); // Type
2358        } else if (name.equals("location")) {
2359          this.location = castToReference(value); // Reference
2360        } else if (name.equals("performer")) {
2361          this.getPerformer().add(castToReference(value));
2362        } else if (name.equals("product[x]")) {
2363          this.product = castToType(value); // Type
2364        } else if (name.equals("dailyAmount")) {
2365          this.dailyAmount = castToQuantity(value); // Quantity
2366        } else if (name.equals("quantity")) {
2367          this.quantity = castToQuantity(value); // Quantity
2368        } else if (name.equals("description")) {
2369          this.description = castToString(value); // StringType
2370        } else
2371          return super.setProperty(name, value);
2372        return value;
2373      }
2374
2375      @Override
2376      public Base makeProperty(int hash, String name) throws FHIRException {
2377        switch (hash) {
2378        case 3292052:  return getKindElement();
2379        case 8911915:  return addInstantiatesCanonicalElement();
2380        case -1926393373:  return addInstantiatesUriElement();
2381        case 3059181:  return getCode(); 
2382        case 722137681:  return addReasonCode(); 
2383        case -1146218137:  return addReasonReference(); 
2384        case 3178259:  return addGoal(); 
2385        case -892481550:  return getStatusElement();
2386        case 2051346646:  return getStatusReason(); 
2387        case -1788508167:  return getDoNotPerformElement();
2388        case 1162627251:  return getScheduled(); 
2389        case -160710483:  return getScheduled(); 
2390        case 1901043637:  return getLocation(); 
2391        case 481140686:  return addPerformer(); 
2392        case 1753005361:  return getProduct(); 
2393        case -309474065:  return getProduct(); 
2394        case -768908335:  return getDailyAmount(); 
2395        case -1285004149:  return getQuantity(); 
2396        case -1724546052:  return getDescriptionElement();
2397        default: return super.makeProperty(hash, name);
2398        }
2399
2400      }
2401
2402      @Override
2403      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2404        switch (hash) {
2405        case 3292052: /*kind*/ return new String[] {"code"};
2406        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
2407        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
2408        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2409        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
2410        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
2411        case 3178259: /*goal*/ return new String[] {"Reference"};
2412        case -892481550: /*status*/ return new String[] {"code"};
2413        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
2414        case -1788508167: /*doNotPerform*/ return new String[] {"boolean"};
2415        case -160710483: /*scheduled*/ return new String[] {"Timing", "Period", "string"};
2416        case 1901043637: /*location*/ return new String[] {"Reference"};
2417        case 481140686: /*performer*/ return new String[] {"Reference"};
2418        case -309474065: /*product*/ return new String[] {"CodeableConcept", "Reference"};
2419        case -768908335: /*dailyAmount*/ return new String[] {"SimpleQuantity"};
2420        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
2421        case -1724546052: /*description*/ return new String[] {"string"};
2422        default: return super.getTypesForProperty(hash, name);
2423        }
2424
2425      }
2426
2427      @Override
2428      public Base addChild(String name) throws FHIRException {
2429        if (name.equals("kind")) {
2430          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.kind");
2431        }
2432        else if (name.equals("instantiatesCanonical")) {
2433          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesCanonical");
2434        }
2435        else if (name.equals("instantiatesUri")) {
2436          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesUri");
2437        }
2438        else if (name.equals("code")) {
2439          this.code = new CodeableConcept();
2440          return this.code;
2441        }
2442        else if (name.equals("reasonCode")) {
2443          return addReasonCode();
2444        }
2445        else if (name.equals("reasonReference")) {
2446          return addReasonReference();
2447        }
2448        else if (name.equals("goal")) {
2449          return addGoal();
2450        }
2451        else if (name.equals("status")) {
2452          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.status");
2453        }
2454        else if (name.equals("statusReason")) {
2455          this.statusReason = new CodeableConcept();
2456          return this.statusReason;
2457        }
2458        else if (name.equals("doNotPerform")) {
2459          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.doNotPerform");
2460        }
2461        else if (name.equals("scheduledTiming")) {
2462          this.scheduled = new Timing();
2463          return this.scheduled;
2464        }
2465        else if (name.equals("scheduledPeriod")) {
2466          this.scheduled = new Period();
2467          return this.scheduled;
2468        }
2469        else if (name.equals("scheduledString")) {
2470          this.scheduled = new StringType();
2471          return this.scheduled;
2472        }
2473        else if (name.equals("location")) {
2474          this.location = new Reference();
2475          return this.location;
2476        }
2477        else if (name.equals("performer")) {
2478          return addPerformer();
2479        }
2480        else if (name.equals("productCodeableConcept")) {
2481          this.product = new CodeableConcept();
2482          return this.product;
2483        }
2484        else if (name.equals("productReference")) {
2485          this.product = new Reference();
2486          return this.product;
2487        }
2488        else if (name.equals("dailyAmount")) {
2489          this.dailyAmount = new Quantity();
2490          return this.dailyAmount;
2491        }
2492        else if (name.equals("quantity")) {
2493          this.quantity = new Quantity();
2494          return this.quantity;
2495        }
2496        else if (name.equals("description")) {
2497          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.description");
2498        }
2499        else
2500          return super.addChild(name);
2501      }
2502
2503      public CarePlanActivityDetailComponent copy() {
2504        CarePlanActivityDetailComponent dst = new CarePlanActivityDetailComponent();
2505        copyValues(dst);
2506        dst.kind = kind == null ? null : kind.copy();
2507        if (instantiatesCanonical != null) {
2508          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
2509          for (CanonicalType i : instantiatesCanonical)
2510            dst.instantiatesCanonical.add(i.copy());
2511        };
2512        if (instantiatesUri != null) {
2513          dst.instantiatesUri = new ArrayList<UriType>();
2514          for (UriType i : instantiatesUri)
2515            dst.instantiatesUri.add(i.copy());
2516        };
2517        dst.code = code == null ? null : code.copy();
2518        if (reasonCode != null) {
2519          dst.reasonCode = new ArrayList<CodeableConcept>();
2520          for (CodeableConcept i : reasonCode)
2521            dst.reasonCode.add(i.copy());
2522        };
2523        if (reasonReference != null) {
2524          dst.reasonReference = new ArrayList<Reference>();
2525          for (Reference i : reasonReference)
2526            dst.reasonReference.add(i.copy());
2527        };
2528        if (goal != null) {
2529          dst.goal = new ArrayList<Reference>();
2530          for (Reference i : goal)
2531            dst.goal.add(i.copy());
2532        };
2533        dst.status = status == null ? null : status.copy();
2534        dst.statusReason = statusReason == null ? null : statusReason.copy();
2535        dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy();
2536        dst.scheduled = scheduled == null ? null : scheduled.copy();
2537        dst.location = location == null ? null : location.copy();
2538        if (performer != null) {
2539          dst.performer = new ArrayList<Reference>();
2540          for (Reference i : performer)
2541            dst.performer.add(i.copy());
2542        };
2543        dst.product = product == null ? null : product.copy();
2544        dst.dailyAmount = dailyAmount == null ? null : dailyAmount.copy();
2545        dst.quantity = quantity == null ? null : quantity.copy();
2546        dst.description = description == null ? null : description.copy();
2547        return dst;
2548      }
2549
2550      @Override
2551      public boolean equalsDeep(Base other_) {
2552        if (!super.equalsDeep(other_))
2553          return false;
2554        if (!(other_ instanceof CarePlanActivityDetailComponent))
2555          return false;
2556        CarePlanActivityDetailComponent o = (CarePlanActivityDetailComponent) other_;
2557        return compareDeep(kind, o.kind, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
2558           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(code, o.code, true) && compareDeep(reasonCode, o.reasonCode, true)
2559           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(goal, o.goal, true) && compareDeep(status, o.status, true)
2560           && compareDeep(statusReason, o.statusReason, true) && compareDeep(doNotPerform, o.doNotPerform, true)
2561           && compareDeep(scheduled, o.scheduled, true) && compareDeep(location, o.location, true) && compareDeep(performer, o.performer, true)
2562           && compareDeep(product, o.product, true) && compareDeep(dailyAmount, o.dailyAmount, true) && compareDeep(quantity, o.quantity, true)
2563           && compareDeep(description, o.description, true);
2564      }
2565
2566      @Override
2567      public boolean equalsShallow(Base other_) {
2568        if (!super.equalsShallow(other_))
2569          return false;
2570        if (!(other_ instanceof CarePlanActivityDetailComponent))
2571          return false;
2572        CarePlanActivityDetailComponent o = (CarePlanActivityDetailComponent) other_;
2573        return compareValues(kind, o.kind, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
2574           && compareValues(status, o.status, true) && compareValues(doNotPerform, o.doNotPerform, true) && compareValues(description, o.description, true)
2575          ;
2576      }
2577
2578      public boolean isEmpty() {
2579        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, instantiatesCanonical
2580          , instantiatesUri, code, reasonCode, reasonReference, goal, status, statusReason
2581          , doNotPerform, scheduled, location, performer, product, dailyAmount, quantity
2582          , description);
2583      }
2584
2585  public String fhirType() {
2586    return "CarePlan.activity.detail";
2587
2588  }
2589
2590  }
2591
2592    /**
2593     * Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server.
2594     */
2595    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2596    @Description(shortDefinition="External Ids for this plan", formalDefinition="Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server." )
2597    protected List<Identifier> identifier;
2598
2599    /**
2600     * The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.
2601     */
2602    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2603    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan." )
2604    protected List<CanonicalType> instantiatesCanonical;
2605
2606    /**
2607     * The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.
2608     */
2609    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2610    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan." )
2611    protected List<UriType> instantiatesUri;
2612
2613    /**
2614     * A care plan that is fulfilled in whole or in part by this care plan.
2615     */
2616    @Child(name = "basedOn", type = {CarePlan.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2617    @Description(shortDefinition="Fulfills CarePlan", formalDefinition="A care plan that is fulfilled in whole or in part by this care plan." )
2618    protected List<Reference> basedOn;
2619    /**
2620     * The actual objects that are the target of the reference (A care plan that is fulfilled in whole or in part by this care plan.)
2621     */
2622    protected List<CarePlan> basedOnTarget;
2623
2624
2625    /**
2626     * Completed or terminated care plan whose function is taken by this new care plan.
2627     */
2628    @Child(name = "replaces", type = {CarePlan.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2629    @Description(shortDefinition="CarePlan replaced by this CarePlan", formalDefinition="Completed or terminated care plan whose function is taken by this new care plan." )
2630    protected List<Reference> replaces;
2631    /**
2632     * The actual objects that are the target of the reference (Completed or terminated care plan whose function is taken by this new care plan.)
2633     */
2634    protected List<CarePlan> replacesTarget;
2635
2636
2637    /**
2638     * A larger care plan of which this particular care plan is a component or step.
2639     */
2640    @Child(name = "partOf", type = {CarePlan.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2641    @Description(shortDefinition="Part of referenced CarePlan", formalDefinition="A larger care plan of which this particular care plan is a component or step." )
2642    protected List<Reference> partOf;
2643    /**
2644     * The actual objects that are the target of the reference (A larger care plan of which this particular care plan is a component or step.)
2645     */
2646    protected List<CarePlan> partOfTarget;
2647
2648
2649    /**
2650     * Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
2651     */
2652    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
2653    @Description(shortDefinition="draft | active | suspended | completed | entered-in-error | cancelled | unknown", formalDefinition="Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record." )
2654    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
2655    protected Enumeration<CarePlanStatus> status;
2656
2657    /**
2658     * Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.
2659     */
2660    @Child(name = "intent", type = {CodeType.class}, order=7, min=1, max=1, modifier=true, summary=true)
2661    @Description(shortDefinition="proposal | plan | order | option", formalDefinition="Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain." )
2662    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-plan-intent")
2663    protected Enumeration<CarePlanIntent> intent;
2664
2665    /**
2666     * Identifies what "kind" of plan this is to support differentiation between multiple co-existing plans; e.g. "Home health", "psychiatric", "asthma", "disease management", "wellness plan", etc.
2667     */
2668    @Child(name = "category", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2669    @Description(shortDefinition="Type of plan", formalDefinition="Identifies what \"kind\" of plan this is to support differentiation between multiple co-existing plans; e.g. \"Home health\", \"psychiatric\", \"asthma\", \"disease management\", \"wellness plan\", etc." )
2670    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/care-plan-category")
2671    protected List<CodeableConcept> category;
2672
2673    /**
2674     * Human-friendly name for the care plan.
2675     */
2676    @Child(name = "title", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2677    @Description(shortDefinition="Human-friendly name for the care plan", formalDefinition="Human-friendly name for the care plan." )
2678    protected StringType title;
2679
2680    /**
2681     * A description of the scope and nature of the plan.
2682     */
2683    @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
2684    @Description(shortDefinition="Summary of nature of plan", formalDefinition="A description of the scope and nature of the plan." )
2685    protected StringType description;
2686
2687    /**
2688     * Identifies the patient or group whose intended care is described by the plan.
2689     */
2690    @Child(name = "subject", type = {Patient.class, Group.class}, order=11, min=1, max=1, modifier=false, summary=true)
2691    @Description(shortDefinition="Who the care plan is for", formalDefinition="Identifies the patient or group whose intended care is described by the plan." )
2692    protected Reference subject;
2693
2694    /**
2695     * The actual object that is the target of the reference (Identifies the patient or group whose intended care is described by the plan.)
2696     */
2697    protected Resource subjectTarget;
2698
2699    /**
2700     * The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.
2701     */
2702    @Child(name = "encounter", type = {Encounter.class}, order=12, min=0, max=1, modifier=false, summary=true)
2703    @Description(shortDefinition="Encounter created as part of", formalDefinition="The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated." )
2704    protected Reference encounter;
2705
2706    /**
2707     * The actual object that is the target of the reference (The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.)
2708     */
2709    protected Encounter encounterTarget;
2710
2711    /**
2712     * Indicates when the plan did (or is intended to) come into effect and end.
2713     */
2714    @Child(name = "period", type = {Period.class}, order=13, min=0, max=1, modifier=false, summary=true)
2715    @Description(shortDefinition="Time period plan covers", formalDefinition="Indicates when the plan did (or is intended to) come into effect and end." )
2716    protected Period period;
2717
2718    /**
2719     * Represents when this particular CarePlan record was created in the system, which is often a system-generated date.
2720     */
2721    @Child(name = "created", type = {DateTimeType.class}, order=14, min=0, max=1, modifier=false, summary=true)
2722    @Description(shortDefinition="Date record was first recorded", formalDefinition="Represents when this particular CarePlan record was created in the system, which is often a system-generated date." )
2723    protected DateTimeType created;
2724
2725    /**
2726     * When populated, the author is responsible for the care plan.  The care plan is attributed to the author.
2727     */
2728    @Child(name = "author", type = {Patient.class, Practitioner.class, PractitionerRole.class, Device.class, RelatedPerson.class, Organization.class, CareTeam.class}, order=15, min=0, max=1, modifier=false, summary=true)
2729    @Description(shortDefinition="Who is the designated responsible party", formalDefinition="When populated, the author is responsible for the care plan.  The care plan is attributed to the author." )
2730    protected Reference author;
2731
2732    /**
2733     * The actual object that is the target of the reference (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
2734     */
2735    protected Resource authorTarget;
2736
2737    /**
2738     * Identifies the individual(s) or organization who provided the contents of the care plan.
2739     */
2740    @Child(name = "contributor", type = {Patient.class, Practitioner.class, PractitionerRole.class, Device.class, RelatedPerson.class, Organization.class, CareTeam.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2741    @Description(shortDefinition="Who provided the content of the care plan", formalDefinition="Identifies the individual(s) or organization who provided the contents of the care plan." )
2742    protected List<Reference> contributor;
2743    /**
2744     * The actual objects that are the target of the reference (Identifies the individual(s) or organization who provided the contents of the care plan.)
2745     */
2746    protected List<Resource> contributorTarget;
2747
2748
2749    /**
2750     * Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.
2751     */
2752    @Child(name = "careTeam", type = {CareTeam.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2753    @Description(shortDefinition="Who's involved in plan?", formalDefinition="Identifies all people and organizations who are expected to be involved in the care envisioned by this plan." )
2754    protected List<Reference> careTeam;
2755    /**
2756     * The actual objects that are the target of the reference (Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.)
2757     */
2758    protected List<CareTeam> careTeamTarget;
2759
2760
2761    /**
2762     * Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.
2763     */
2764    @Child(name = "addresses", type = {Condition.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2765    @Description(shortDefinition="Health issues this plan addresses", formalDefinition="Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan." )
2766    protected List<Reference> addresses;
2767    /**
2768     * The actual objects that are the target of the reference (Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
2769     */
2770    protected List<Condition> addressesTarget;
2771
2772
2773    /**
2774     * Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc.
2775     */
2776    @Child(name = "supportingInfo", type = {Reference.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2777    @Description(shortDefinition="Information considered as part of plan", formalDefinition="Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc." )
2778    protected List<Reference> supportingInfo;
2779    /**
2780     * The actual objects that are the target of the reference (Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc.)
2781     */
2782    protected List<Resource> supportingInfoTarget;
2783
2784
2785    /**
2786     * Describes the intended objective(s) of carrying out the care plan.
2787     */
2788    @Child(name = "goal", type = {Goal.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2789    @Description(shortDefinition="Desired outcome of plan", formalDefinition="Describes the intended objective(s) of carrying out the care plan." )
2790    protected List<Reference> goal;
2791    /**
2792     * The actual objects that are the target of the reference (Describes the intended objective(s) of carrying out the care plan.)
2793     */
2794    protected List<Goal> goalTarget;
2795
2796
2797    /**
2798     * Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.
2799     */
2800    @Child(name = "activity", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2801    @Description(shortDefinition="Action to occur as part of plan", formalDefinition="Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc." )
2802    protected List<CarePlanActivityComponent> activity;
2803
2804    /**
2805     * General notes about the care plan not covered elsewhere.
2806     */
2807    @Child(name = "note", type = {Annotation.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2808    @Description(shortDefinition="Comments about the plan", formalDefinition="General notes about the care plan not covered elsewhere." )
2809    protected List<Annotation> note;
2810
2811    private static final long serialVersionUID = -584930613L;
2812
2813  /**
2814   * Constructor
2815   */
2816    public CarePlan() {
2817      super();
2818    }
2819
2820  /**
2821   * Constructor
2822   */
2823    public CarePlan(Enumeration<CarePlanStatus> status, Enumeration<CarePlanIntent> intent, Reference subject) {
2824      super();
2825      this.status = status;
2826      this.intent = intent;
2827      this.subject = subject;
2828    }
2829
2830    /**
2831     * @return {@link #identifier} (Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server.)
2832     */
2833    public List<Identifier> getIdentifier() { 
2834      if (this.identifier == null)
2835        this.identifier = new ArrayList<Identifier>();
2836      return this.identifier;
2837    }
2838
2839    /**
2840     * @return Returns a reference to <code>this</code> for easy method chaining
2841     */
2842    public CarePlan setIdentifier(List<Identifier> theIdentifier) { 
2843      this.identifier = theIdentifier;
2844      return this;
2845    }
2846
2847    public boolean hasIdentifier() { 
2848      if (this.identifier == null)
2849        return false;
2850      for (Identifier item : this.identifier)
2851        if (!item.isEmpty())
2852          return true;
2853      return false;
2854    }
2855
2856    public Identifier addIdentifier() { //3
2857      Identifier t = new Identifier();
2858      if (this.identifier == null)
2859        this.identifier = new ArrayList<Identifier>();
2860      this.identifier.add(t);
2861      return t;
2862    }
2863
2864    public CarePlan addIdentifier(Identifier t) { //3
2865      if (t == null)
2866        return this;
2867      if (this.identifier == null)
2868        this.identifier = new ArrayList<Identifier>();
2869      this.identifier.add(t);
2870      return this;
2871    }
2872
2873    /**
2874     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2875     */
2876    public Identifier getIdentifierFirstRep() { 
2877      if (getIdentifier().isEmpty()) {
2878        addIdentifier();
2879      }
2880      return getIdentifier().get(0);
2881    }
2882
2883    /**
2884     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2885     */
2886    public List<CanonicalType> getInstantiatesCanonical() { 
2887      if (this.instantiatesCanonical == null)
2888        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2889      return this.instantiatesCanonical;
2890    }
2891
2892    /**
2893     * @return Returns a reference to <code>this</code> for easy method chaining
2894     */
2895    public CarePlan setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
2896      this.instantiatesCanonical = theInstantiatesCanonical;
2897      return this;
2898    }
2899
2900    public boolean hasInstantiatesCanonical() { 
2901      if (this.instantiatesCanonical == null)
2902        return false;
2903      for (CanonicalType item : this.instantiatesCanonical)
2904        if (!item.isEmpty())
2905          return true;
2906      return false;
2907    }
2908
2909    /**
2910     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2911     */
2912    public CanonicalType addInstantiatesCanonicalElement() {//2 
2913      CanonicalType t = new CanonicalType();
2914      if (this.instantiatesCanonical == null)
2915        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2916      this.instantiatesCanonical.add(t);
2917      return t;
2918    }
2919
2920    /**
2921     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2922     */
2923    public CarePlan addInstantiatesCanonical(String value) { //1
2924      CanonicalType t = new CanonicalType();
2925      t.setValue(value);
2926      if (this.instantiatesCanonical == null)
2927        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2928      this.instantiatesCanonical.add(t);
2929      return this;
2930    }
2931
2932    /**
2933     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2934     */
2935    public boolean hasInstantiatesCanonical(String value) { 
2936      if (this.instantiatesCanonical == null)
2937        return false;
2938      for (CanonicalType v : this.instantiatesCanonical)
2939        if (v.getValue().equals(value)) // canonical(PlanDefinition|Questionnaire|Measure|ActivityDefinition|OperationDefinition)
2940          return true;
2941      return false;
2942    }
2943
2944    /**
2945     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2946     */
2947    public List<UriType> getInstantiatesUri() { 
2948      if (this.instantiatesUri == null)
2949        this.instantiatesUri = new ArrayList<UriType>();
2950      return this.instantiatesUri;
2951    }
2952
2953    /**
2954     * @return Returns a reference to <code>this</code> for easy method chaining
2955     */
2956    public CarePlan setInstantiatesUri(List<UriType> theInstantiatesUri) { 
2957      this.instantiatesUri = theInstantiatesUri;
2958      return this;
2959    }
2960
2961    public boolean hasInstantiatesUri() { 
2962      if (this.instantiatesUri == null)
2963        return false;
2964      for (UriType item : this.instantiatesUri)
2965        if (!item.isEmpty())
2966          return true;
2967      return false;
2968    }
2969
2970    /**
2971     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2972     */
2973    public UriType addInstantiatesUriElement() {//2 
2974      UriType t = new UriType();
2975      if (this.instantiatesUri == null)
2976        this.instantiatesUri = new ArrayList<UriType>();
2977      this.instantiatesUri.add(t);
2978      return t;
2979    }
2980
2981    /**
2982     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2983     */
2984    public CarePlan addInstantiatesUri(String value) { //1
2985      UriType t = new UriType();
2986      t.setValue(value);
2987      if (this.instantiatesUri == null)
2988        this.instantiatesUri = new ArrayList<UriType>();
2989      this.instantiatesUri.add(t);
2990      return this;
2991    }
2992
2993    /**
2994     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.)
2995     */
2996    public boolean hasInstantiatesUri(String value) { 
2997      if (this.instantiatesUri == null)
2998        return false;
2999      for (UriType v : this.instantiatesUri)
3000        if (v.getValue().equals(value)) // uri
3001          return true;
3002      return false;
3003    }
3004
3005    /**
3006     * @return {@link #basedOn} (A care plan that is fulfilled in whole or in part by this care plan.)
3007     */
3008    public List<Reference> getBasedOn() { 
3009      if (this.basedOn == null)
3010        this.basedOn = new ArrayList<Reference>();
3011      return this.basedOn;
3012    }
3013
3014    /**
3015     * @return Returns a reference to <code>this</code> for easy method chaining
3016     */
3017    public CarePlan setBasedOn(List<Reference> theBasedOn) { 
3018      this.basedOn = theBasedOn;
3019      return this;
3020    }
3021
3022    public boolean hasBasedOn() { 
3023      if (this.basedOn == null)
3024        return false;
3025      for (Reference item : this.basedOn)
3026        if (!item.isEmpty())
3027          return true;
3028      return false;
3029    }
3030
3031    public Reference addBasedOn() { //3
3032      Reference t = new Reference();
3033      if (this.basedOn == null)
3034        this.basedOn = new ArrayList<Reference>();
3035      this.basedOn.add(t);
3036      return t;
3037    }
3038
3039    public CarePlan addBasedOn(Reference t) { //3
3040      if (t == null)
3041        return this;
3042      if (this.basedOn == null)
3043        this.basedOn = new ArrayList<Reference>();
3044      this.basedOn.add(t);
3045      return this;
3046    }
3047
3048    /**
3049     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
3050     */
3051    public Reference getBasedOnFirstRep() { 
3052      if (getBasedOn().isEmpty()) {
3053        addBasedOn();
3054      }
3055      return getBasedOn().get(0);
3056    }
3057
3058    /**
3059     * @deprecated Use Reference#setResource(IBaseResource) instead
3060     */
3061    @Deprecated
3062    public List<CarePlan> getBasedOnTarget() { 
3063      if (this.basedOnTarget == null)
3064        this.basedOnTarget = new ArrayList<CarePlan>();
3065      return this.basedOnTarget;
3066    }
3067
3068    /**
3069     * @deprecated Use Reference#setResource(IBaseResource) instead
3070     */
3071    @Deprecated
3072    public CarePlan addBasedOnTarget() { 
3073      CarePlan r = new CarePlan();
3074      if (this.basedOnTarget == null)
3075        this.basedOnTarget = new ArrayList<CarePlan>();
3076      this.basedOnTarget.add(r);
3077      return r;
3078    }
3079
3080    /**
3081     * @return {@link #replaces} (Completed or terminated care plan whose function is taken by this new care plan.)
3082     */
3083    public List<Reference> getReplaces() { 
3084      if (this.replaces == null)
3085        this.replaces = new ArrayList<Reference>();
3086      return this.replaces;
3087    }
3088
3089    /**
3090     * @return Returns a reference to <code>this</code> for easy method chaining
3091     */
3092    public CarePlan setReplaces(List<Reference> theReplaces) { 
3093      this.replaces = theReplaces;
3094      return this;
3095    }
3096
3097    public boolean hasReplaces() { 
3098      if (this.replaces == null)
3099        return false;
3100      for (Reference item : this.replaces)
3101        if (!item.isEmpty())
3102          return true;
3103      return false;
3104    }
3105
3106    public Reference addReplaces() { //3
3107      Reference t = new Reference();
3108      if (this.replaces == null)
3109        this.replaces = new ArrayList<Reference>();
3110      this.replaces.add(t);
3111      return t;
3112    }
3113
3114    public CarePlan addReplaces(Reference t) { //3
3115      if (t == null)
3116        return this;
3117      if (this.replaces == null)
3118        this.replaces = new ArrayList<Reference>();
3119      this.replaces.add(t);
3120      return this;
3121    }
3122
3123    /**
3124     * @return The first repetition of repeating field {@link #replaces}, creating it if it does not already exist
3125     */
3126    public Reference getReplacesFirstRep() { 
3127      if (getReplaces().isEmpty()) {
3128        addReplaces();
3129      }
3130      return getReplaces().get(0);
3131    }
3132
3133    /**
3134     * @deprecated Use Reference#setResource(IBaseResource) instead
3135     */
3136    @Deprecated
3137    public List<CarePlan> getReplacesTarget() { 
3138      if (this.replacesTarget == null)
3139        this.replacesTarget = new ArrayList<CarePlan>();
3140      return this.replacesTarget;
3141    }
3142
3143    /**
3144     * @deprecated Use Reference#setResource(IBaseResource) instead
3145     */
3146    @Deprecated
3147    public CarePlan addReplacesTarget() { 
3148      CarePlan r = new CarePlan();
3149      if (this.replacesTarget == null)
3150        this.replacesTarget = new ArrayList<CarePlan>();
3151      this.replacesTarget.add(r);
3152      return r;
3153    }
3154
3155    /**
3156     * @return {@link #partOf} (A larger care plan of which this particular care plan is a component or step.)
3157     */
3158    public List<Reference> getPartOf() { 
3159      if (this.partOf == null)
3160        this.partOf = new ArrayList<Reference>();
3161      return this.partOf;
3162    }
3163
3164    /**
3165     * @return Returns a reference to <code>this</code> for easy method chaining
3166     */
3167    public CarePlan setPartOf(List<Reference> thePartOf) { 
3168      this.partOf = thePartOf;
3169      return this;
3170    }
3171
3172    public boolean hasPartOf() { 
3173      if (this.partOf == null)
3174        return false;
3175      for (Reference item : this.partOf)
3176        if (!item.isEmpty())
3177          return true;
3178      return false;
3179    }
3180
3181    public Reference addPartOf() { //3
3182      Reference t = new Reference();
3183      if (this.partOf == null)
3184        this.partOf = new ArrayList<Reference>();
3185      this.partOf.add(t);
3186      return t;
3187    }
3188
3189    public CarePlan addPartOf(Reference t) { //3
3190      if (t == null)
3191        return this;
3192      if (this.partOf == null)
3193        this.partOf = new ArrayList<Reference>();
3194      this.partOf.add(t);
3195      return this;
3196    }
3197
3198    /**
3199     * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist
3200     */
3201    public Reference getPartOfFirstRep() { 
3202      if (getPartOf().isEmpty()) {
3203        addPartOf();
3204      }
3205      return getPartOf().get(0);
3206    }
3207
3208    /**
3209     * @deprecated Use Reference#setResource(IBaseResource) instead
3210     */
3211    @Deprecated
3212    public List<CarePlan> getPartOfTarget() { 
3213      if (this.partOfTarget == null)
3214        this.partOfTarget = new ArrayList<CarePlan>();
3215      return this.partOfTarget;
3216    }
3217
3218    /**
3219     * @deprecated Use Reference#setResource(IBaseResource) instead
3220     */
3221    @Deprecated
3222    public CarePlan addPartOfTarget() { 
3223      CarePlan r = new CarePlan();
3224      if (this.partOfTarget == null)
3225        this.partOfTarget = new ArrayList<CarePlan>();
3226      this.partOfTarget.add(r);
3227      return r;
3228    }
3229
3230    /**
3231     * @return {@link #status} (Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3232     */
3233    public Enumeration<CarePlanStatus> getStatusElement() { 
3234      if (this.status == null)
3235        if (Configuration.errorOnAutoCreate())
3236          throw new Error("Attempt to auto-create CarePlan.status");
3237        else if (Configuration.doAutoCreate())
3238          this.status = new Enumeration<CarePlanStatus>(new CarePlanStatusEnumFactory()); // bb
3239      return this.status;
3240    }
3241
3242    public boolean hasStatusElement() { 
3243      return this.status != null && !this.status.isEmpty();
3244    }
3245
3246    public boolean hasStatus() { 
3247      return this.status != null && !this.status.isEmpty();
3248    }
3249
3250    /**
3251     * @param value {@link #status} (Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3252     */
3253    public CarePlan setStatusElement(Enumeration<CarePlanStatus> value) { 
3254      this.status = value;
3255      return this;
3256    }
3257
3258    /**
3259     * @return Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
3260     */
3261    public CarePlanStatus getStatus() { 
3262      return this.status == null ? null : this.status.getValue();
3263    }
3264
3265    /**
3266     * @param value Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.
3267     */
3268    public CarePlan setStatus(CarePlanStatus value) { 
3269        if (this.status == null)
3270          this.status = new Enumeration<CarePlanStatus>(new CarePlanStatusEnumFactory());
3271        this.status.setValue(value);
3272      return this;
3273    }
3274
3275    /**
3276     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3277     */
3278    public Enumeration<CarePlanIntent> getIntentElement() { 
3279      if (this.intent == null)
3280        if (Configuration.errorOnAutoCreate())
3281          throw new Error("Attempt to auto-create CarePlan.intent");
3282        else if (Configuration.doAutoCreate())
3283          this.intent = new Enumeration<CarePlanIntent>(new CarePlanIntentEnumFactory()); // bb
3284      return this.intent;
3285    }
3286
3287    public boolean hasIntentElement() { 
3288      return this.intent != null && !this.intent.isEmpty();
3289    }
3290
3291    public boolean hasIntent() { 
3292      return this.intent != null && !this.intent.isEmpty();
3293    }
3294
3295    /**
3296     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3297     */
3298    public CarePlan setIntentElement(Enumeration<CarePlanIntent> value) { 
3299      this.intent = value;
3300      return this;
3301    }
3302
3303    /**
3304     * @return Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.
3305     */
3306    public CarePlanIntent getIntent() { 
3307      return this.intent == null ? null : this.intent.getValue();
3308    }
3309
3310    /**
3311     * @param value Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.
3312     */
3313    public CarePlan setIntent(CarePlanIntent value) { 
3314        if (this.intent == null)
3315          this.intent = new Enumeration<CarePlanIntent>(new CarePlanIntentEnumFactory());
3316        this.intent.setValue(value);
3317      return this;
3318    }
3319
3320    /**
3321     * @return {@link #category} (Identifies what "kind" of plan this is to support differentiation between multiple co-existing plans; e.g. "Home health", "psychiatric", "asthma", "disease management", "wellness plan", etc.)
3322     */
3323    public List<CodeableConcept> getCategory() { 
3324      if (this.category == null)
3325        this.category = new ArrayList<CodeableConcept>();
3326      return this.category;
3327    }
3328
3329    /**
3330     * @return Returns a reference to <code>this</code> for easy method chaining
3331     */
3332    public CarePlan setCategory(List<CodeableConcept> theCategory) { 
3333      this.category = theCategory;
3334      return this;
3335    }
3336
3337    public boolean hasCategory() { 
3338      if (this.category == null)
3339        return false;
3340      for (CodeableConcept item : this.category)
3341        if (!item.isEmpty())
3342          return true;
3343      return false;
3344    }
3345
3346    public CodeableConcept addCategory() { //3
3347      CodeableConcept t = new CodeableConcept();
3348      if (this.category == null)
3349        this.category = new ArrayList<CodeableConcept>();
3350      this.category.add(t);
3351      return t;
3352    }
3353
3354    public CarePlan addCategory(CodeableConcept t) { //3
3355      if (t == null)
3356        return this;
3357      if (this.category == null)
3358        this.category = new ArrayList<CodeableConcept>();
3359      this.category.add(t);
3360      return this;
3361    }
3362
3363    /**
3364     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist
3365     */
3366    public CodeableConcept getCategoryFirstRep() { 
3367      if (getCategory().isEmpty()) {
3368        addCategory();
3369      }
3370      return getCategory().get(0);
3371    }
3372
3373    /**
3374     * @return {@link #title} (Human-friendly name for the care plan.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3375     */
3376    public StringType getTitleElement() { 
3377      if (this.title == null)
3378        if (Configuration.errorOnAutoCreate())
3379          throw new Error("Attempt to auto-create CarePlan.title");
3380        else if (Configuration.doAutoCreate())
3381          this.title = new StringType(); // bb
3382      return this.title;
3383    }
3384
3385    public boolean hasTitleElement() { 
3386      return this.title != null && !this.title.isEmpty();
3387    }
3388
3389    public boolean hasTitle() { 
3390      return this.title != null && !this.title.isEmpty();
3391    }
3392
3393    /**
3394     * @param value {@link #title} (Human-friendly name for the care plan.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3395     */
3396    public CarePlan setTitleElement(StringType value) { 
3397      this.title = value;
3398      return this;
3399    }
3400
3401    /**
3402     * @return Human-friendly name for the care plan.
3403     */
3404    public String getTitle() { 
3405      return this.title == null ? null : this.title.getValue();
3406    }
3407
3408    /**
3409     * @param value Human-friendly name for the care plan.
3410     */
3411    public CarePlan setTitle(String value) { 
3412      if (Utilities.noString(value))
3413        this.title = null;
3414      else {
3415        if (this.title == null)
3416          this.title = new StringType();
3417        this.title.setValue(value);
3418      }
3419      return this;
3420    }
3421
3422    /**
3423     * @return {@link #description} (A description of the scope and nature of the plan.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3424     */
3425    public StringType getDescriptionElement() { 
3426      if (this.description == null)
3427        if (Configuration.errorOnAutoCreate())
3428          throw new Error("Attempt to auto-create CarePlan.description");
3429        else if (Configuration.doAutoCreate())
3430          this.description = new StringType(); // bb
3431      return this.description;
3432    }
3433
3434    public boolean hasDescriptionElement() { 
3435      return this.description != null && !this.description.isEmpty();
3436    }
3437
3438    public boolean hasDescription() { 
3439      return this.description != null && !this.description.isEmpty();
3440    }
3441
3442    /**
3443     * @param value {@link #description} (A description of the scope and nature of the plan.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3444     */
3445    public CarePlan setDescriptionElement(StringType value) { 
3446      this.description = value;
3447      return this;
3448    }
3449
3450    /**
3451     * @return A description of the scope and nature of the plan.
3452     */
3453    public String getDescription() { 
3454      return this.description == null ? null : this.description.getValue();
3455    }
3456
3457    /**
3458     * @param value A description of the scope and nature of the plan.
3459     */
3460    public CarePlan setDescription(String value) { 
3461      if (Utilities.noString(value))
3462        this.description = null;
3463      else {
3464        if (this.description == null)
3465          this.description = new StringType();
3466        this.description.setValue(value);
3467      }
3468      return this;
3469    }
3470
3471    /**
3472     * @return {@link #subject} (Identifies the patient or group whose intended care is described by the plan.)
3473     */
3474    public Reference getSubject() { 
3475      if (this.subject == null)
3476        if (Configuration.errorOnAutoCreate())
3477          throw new Error("Attempt to auto-create CarePlan.subject");
3478        else if (Configuration.doAutoCreate())
3479          this.subject = new Reference(); // cc
3480      return this.subject;
3481    }
3482
3483    public boolean hasSubject() { 
3484      return this.subject != null && !this.subject.isEmpty();
3485    }
3486
3487    /**
3488     * @param value {@link #subject} (Identifies the patient or group whose intended care is described by the plan.)
3489     */
3490    public CarePlan setSubject(Reference value) { 
3491      this.subject = value;
3492      return this;
3493    }
3494
3495    /**
3496     * @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 or group whose intended care is described by the plan.)
3497     */
3498    public Resource getSubjectTarget() { 
3499      return this.subjectTarget;
3500    }
3501
3502    /**
3503     * @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 or group whose intended care is described by the plan.)
3504     */
3505    public CarePlan setSubjectTarget(Resource value) { 
3506      this.subjectTarget = value;
3507      return this;
3508    }
3509
3510    /**
3511     * @return {@link #encounter} (The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.)
3512     */
3513    public Reference getEncounter() { 
3514      if (this.encounter == null)
3515        if (Configuration.errorOnAutoCreate())
3516          throw new Error("Attempt to auto-create CarePlan.encounter");
3517        else if (Configuration.doAutoCreate())
3518          this.encounter = new Reference(); // cc
3519      return this.encounter;
3520    }
3521
3522    public boolean hasEncounter() { 
3523      return this.encounter != null && !this.encounter.isEmpty();
3524    }
3525
3526    /**
3527     * @param value {@link #encounter} (The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.)
3528     */
3529    public CarePlan setEncounter(Reference value) { 
3530      this.encounter = value;
3531      return this;
3532    }
3533
3534    /**
3535     * @return {@link #encounter} 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 Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.)
3536     */
3537    public Encounter getEncounterTarget() { 
3538      if (this.encounterTarget == null)
3539        if (Configuration.errorOnAutoCreate())
3540          throw new Error("Attempt to auto-create CarePlan.encounter");
3541        else if (Configuration.doAutoCreate())
3542          this.encounterTarget = new Encounter(); // aa
3543      return this.encounterTarget;
3544    }
3545
3546    /**
3547     * @param value {@link #encounter} 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 Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.)
3548     */
3549    public CarePlan setEncounterTarget(Encounter value) { 
3550      this.encounterTarget = value;
3551      return this;
3552    }
3553
3554    /**
3555     * @return {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
3556     */
3557    public Period getPeriod() { 
3558      if (this.period == null)
3559        if (Configuration.errorOnAutoCreate())
3560          throw new Error("Attempt to auto-create CarePlan.period");
3561        else if (Configuration.doAutoCreate())
3562          this.period = new Period(); // cc
3563      return this.period;
3564    }
3565
3566    public boolean hasPeriod() { 
3567      return this.period != null && !this.period.isEmpty();
3568    }
3569
3570    /**
3571     * @param value {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
3572     */
3573    public CarePlan setPeriod(Period value) { 
3574      this.period = value;
3575      return this;
3576    }
3577
3578    /**
3579     * @return {@link #created} (Represents when this particular CarePlan record was created in the system, which is often a system-generated date.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
3580     */
3581    public DateTimeType getCreatedElement() { 
3582      if (this.created == null)
3583        if (Configuration.errorOnAutoCreate())
3584          throw new Error("Attempt to auto-create CarePlan.created");
3585        else if (Configuration.doAutoCreate())
3586          this.created = new DateTimeType(); // bb
3587      return this.created;
3588    }
3589
3590    public boolean hasCreatedElement() { 
3591      return this.created != null && !this.created.isEmpty();
3592    }
3593
3594    public boolean hasCreated() { 
3595      return this.created != null && !this.created.isEmpty();
3596    }
3597
3598    /**
3599     * @param value {@link #created} (Represents when this particular CarePlan record was created in the system, which is often a system-generated date.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
3600     */
3601    public CarePlan setCreatedElement(DateTimeType value) { 
3602      this.created = value;
3603      return this;
3604    }
3605
3606    /**
3607     * @return Represents when this particular CarePlan record was created in the system, which is often a system-generated date.
3608     */
3609    public Date getCreated() { 
3610      return this.created == null ? null : this.created.getValue();
3611    }
3612
3613    /**
3614     * @param value Represents when this particular CarePlan record was created in the system, which is often a system-generated date.
3615     */
3616    public CarePlan setCreated(Date value) { 
3617      if (value == null)
3618        this.created = null;
3619      else {
3620        if (this.created == null)
3621          this.created = new DateTimeType();
3622        this.created.setValue(value);
3623      }
3624      return this;
3625    }
3626
3627    /**
3628     * @return {@link #author} (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3629     */
3630    public Reference getAuthor() { 
3631      if (this.author == null)
3632        if (Configuration.errorOnAutoCreate())
3633          throw new Error("Attempt to auto-create CarePlan.author");
3634        else if (Configuration.doAutoCreate())
3635          this.author = new Reference(); // cc
3636      return this.author;
3637    }
3638
3639    public boolean hasAuthor() { 
3640      return this.author != null && !this.author.isEmpty();
3641    }
3642
3643    /**
3644     * @param value {@link #author} (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3645     */
3646    public CarePlan setAuthor(Reference value) { 
3647      this.author = value;
3648      return this;
3649    }
3650
3651    /**
3652     * @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. (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3653     */
3654    public Resource getAuthorTarget() { 
3655      return this.authorTarget;
3656    }
3657
3658    /**
3659     * @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. (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3660     */
3661    public CarePlan setAuthorTarget(Resource value) { 
3662      this.authorTarget = value;
3663      return this;
3664    }
3665
3666    /**
3667     * @return {@link #contributor} (Identifies the individual(s) or organization who provided the contents of the care plan.)
3668     */
3669    public List<Reference> getContributor() { 
3670      if (this.contributor == null)
3671        this.contributor = new ArrayList<Reference>();
3672      return this.contributor;
3673    }
3674
3675    /**
3676     * @return Returns a reference to <code>this</code> for easy method chaining
3677     */
3678    public CarePlan setContributor(List<Reference> theContributor) { 
3679      this.contributor = theContributor;
3680      return this;
3681    }
3682
3683    public boolean hasContributor() { 
3684      if (this.contributor == null)
3685        return false;
3686      for (Reference item : this.contributor)
3687        if (!item.isEmpty())
3688          return true;
3689      return false;
3690    }
3691
3692    public Reference addContributor() { //3
3693      Reference t = new Reference();
3694      if (this.contributor == null)
3695        this.contributor = new ArrayList<Reference>();
3696      this.contributor.add(t);
3697      return t;
3698    }
3699
3700    public CarePlan addContributor(Reference t) { //3
3701      if (t == null)
3702        return this;
3703      if (this.contributor == null)
3704        this.contributor = new ArrayList<Reference>();
3705      this.contributor.add(t);
3706      return this;
3707    }
3708
3709    /**
3710     * @return The first repetition of repeating field {@link #contributor}, creating it if it does not already exist
3711     */
3712    public Reference getContributorFirstRep() { 
3713      if (getContributor().isEmpty()) {
3714        addContributor();
3715      }
3716      return getContributor().get(0);
3717    }
3718
3719    /**
3720     * @deprecated Use Reference#setResource(IBaseResource) instead
3721     */
3722    @Deprecated
3723    public List<Resource> getContributorTarget() { 
3724      if (this.contributorTarget == null)
3725        this.contributorTarget = new ArrayList<Resource>();
3726      return this.contributorTarget;
3727    }
3728
3729    /**
3730     * @return {@link #careTeam} (Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.)
3731     */
3732    public List<Reference> getCareTeam() { 
3733      if (this.careTeam == null)
3734        this.careTeam = new ArrayList<Reference>();
3735      return this.careTeam;
3736    }
3737
3738    /**
3739     * @return Returns a reference to <code>this</code> for easy method chaining
3740     */
3741    public CarePlan setCareTeam(List<Reference> theCareTeam) { 
3742      this.careTeam = theCareTeam;
3743      return this;
3744    }
3745
3746    public boolean hasCareTeam() { 
3747      if (this.careTeam == null)
3748        return false;
3749      for (Reference item : this.careTeam)
3750        if (!item.isEmpty())
3751          return true;
3752      return false;
3753    }
3754
3755    public Reference addCareTeam() { //3
3756      Reference t = new Reference();
3757      if (this.careTeam == null)
3758        this.careTeam = new ArrayList<Reference>();
3759      this.careTeam.add(t);
3760      return t;
3761    }
3762
3763    public CarePlan addCareTeam(Reference t) { //3
3764      if (t == null)
3765        return this;
3766      if (this.careTeam == null)
3767        this.careTeam = new ArrayList<Reference>();
3768      this.careTeam.add(t);
3769      return this;
3770    }
3771
3772    /**
3773     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
3774     */
3775    public Reference getCareTeamFirstRep() { 
3776      if (getCareTeam().isEmpty()) {
3777        addCareTeam();
3778      }
3779      return getCareTeam().get(0);
3780    }
3781
3782    /**
3783     * @deprecated Use Reference#setResource(IBaseResource) instead
3784     */
3785    @Deprecated
3786    public List<CareTeam> getCareTeamTarget() { 
3787      if (this.careTeamTarget == null)
3788        this.careTeamTarget = new ArrayList<CareTeam>();
3789      return this.careTeamTarget;
3790    }
3791
3792    /**
3793     * @deprecated Use Reference#setResource(IBaseResource) instead
3794     */
3795    @Deprecated
3796    public CareTeam addCareTeamTarget() { 
3797      CareTeam r = new CareTeam();
3798      if (this.careTeamTarget == null)
3799        this.careTeamTarget = new ArrayList<CareTeam>();
3800      this.careTeamTarget.add(r);
3801      return r;
3802    }
3803
3804    /**
3805     * @return {@link #addresses} (Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
3806     */
3807    public List<Reference> getAddresses() { 
3808      if (this.addresses == null)
3809        this.addresses = new ArrayList<Reference>();
3810      return this.addresses;
3811    }
3812
3813    /**
3814     * @return Returns a reference to <code>this</code> for easy method chaining
3815     */
3816    public CarePlan setAddresses(List<Reference> theAddresses) { 
3817      this.addresses = theAddresses;
3818      return this;
3819    }
3820
3821    public boolean hasAddresses() { 
3822      if (this.addresses == null)
3823        return false;
3824      for (Reference item : this.addresses)
3825        if (!item.isEmpty())
3826          return true;
3827      return false;
3828    }
3829
3830    public Reference addAddresses() { //3
3831      Reference t = new Reference();
3832      if (this.addresses == null)
3833        this.addresses = new ArrayList<Reference>();
3834      this.addresses.add(t);
3835      return t;
3836    }
3837
3838    public CarePlan addAddresses(Reference t) { //3
3839      if (t == null)
3840        return this;
3841      if (this.addresses == null)
3842        this.addresses = new ArrayList<Reference>();
3843      this.addresses.add(t);
3844      return this;
3845    }
3846
3847    /**
3848     * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist
3849     */
3850    public Reference getAddressesFirstRep() { 
3851      if (getAddresses().isEmpty()) {
3852        addAddresses();
3853      }
3854      return getAddresses().get(0);
3855    }
3856
3857    /**
3858     * @deprecated Use Reference#setResource(IBaseResource) instead
3859     */
3860    @Deprecated
3861    public List<Condition> getAddressesTarget() { 
3862      if (this.addressesTarget == null)
3863        this.addressesTarget = new ArrayList<Condition>();
3864      return this.addressesTarget;
3865    }
3866
3867    /**
3868     * @deprecated Use Reference#setResource(IBaseResource) instead
3869     */
3870    @Deprecated
3871    public Condition addAddressesTarget() { 
3872      Condition r = new Condition();
3873      if (this.addressesTarget == null)
3874        this.addressesTarget = new ArrayList<Condition>();
3875      this.addressesTarget.add(r);
3876      return r;
3877    }
3878
3879    /**
3880     * @return {@link #supportingInfo} (Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc.)
3881     */
3882    public List<Reference> getSupportingInfo() { 
3883      if (this.supportingInfo == null)
3884        this.supportingInfo = new ArrayList<Reference>();
3885      return this.supportingInfo;
3886    }
3887
3888    /**
3889     * @return Returns a reference to <code>this</code> for easy method chaining
3890     */
3891    public CarePlan setSupportingInfo(List<Reference> theSupportingInfo) { 
3892      this.supportingInfo = theSupportingInfo;
3893      return this;
3894    }
3895
3896    public boolean hasSupportingInfo() { 
3897      if (this.supportingInfo == null)
3898        return false;
3899      for (Reference item : this.supportingInfo)
3900        if (!item.isEmpty())
3901          return true;
3902      return false;
3903    }
3904
3905    public Reference addSupportingInfo() { //3
3906      Reference t = new Reference();
3907      if (this.supportingInfo == null)
3908        this.supportingInfo = new ArrayList<Reference>();
3909      this.supportingInfo.add(t);
3910      return t;
3911    }
3912
3913    public CarePlan addSupportingInfo(Reference t) { //3
3914      if (t == null)
3915        return this;
3916      if (this.supportingInfo == null)
3917        this.supportingInfo = new ArrayList<Reference>();
3918      this.supportingInfo.add(t);
3919      return this;
3920    }
3921
3922    /**
3923     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
3924     */
3925    public Reference getSupportingInfoFirstRep() { 
3926      if (getSupportingInfo().isEmpty()) {
3927        addSupportingInfo();
3928      }
3929      return getSupportingInfo().get(0);
3930    }
3931
3932    /**
3933     * @deprecated Use Reference#setResource(IBaseResource) instead
3934     */
3935    @Deprecated
3936    public List<Resource> getSupportingInfoTarget() { 
3937      if (this.supportingInfoTarget == null)
3938        this.supportingInfoTarget = new ArrayList<Resource>();
3939      return this.supportingInfoTarget;
3940    }
3941
3942    /**
3943     * @return {@link #goal} (Describes the intended objective(s) of carrying out the care plan.)
3944     */
3945    public List<Reference> getGoal() { 
3946      if (this.goal == null)
3947        this.goal = new ArrayList<Reference>();
3948      return this.goal;
3949    }
3950
3951    /**
3952     * @return Returns a reference to <code>this</code> for easy method chaining
3953     */
3954    public CarePlan setGoal(List<Reference> theGoal) { 
3955      this.goal = theGoal;
3956      return this;
3957    }
3958
3959    public boolean hasGoal() { 
3960      if (this.goal == null)
3961        return false;
3962      for (Reference item : this.goal)
3963        if (!item.isEmpty())
3964          return true;
3965      return false;
3966    }
3967
3968    public Reference addGoal() { //3
3969      Reference t = new Reference();
3970      if (this.goal == null)
3971        this.goal = new ArrayList<Reference>();
3972      this.goal.add(t);
3973      return t;
3974    }
3975
3976    public CarePlan addGoal(Reference t) { //3
3977      if (t == null)
3978        return this;
3979      if (this.goal == null)
3980        this.goal = new ArrayList<Reference>();
3981      this.goal.add(t);
3982      return this;
3983    }
3984
3985    /**
3986     * @return The first repetition of repeating field {@link #goal}, creating it if it does not already exist
3987     */
3988    public Reference getGoalFirstRep() { 
3989      if (getGoal().isEmpty()) {
3990        addGoal();
3991      }
3992      return getGoal().get(0);
3993    }
3994
3995    /**
3996     * @deprecated Use Reference#setResource(IBaseResource) instead
3997     */
3998    @Deprecated
3999    public List<Goal> getGoalTarget() { 
4000      if (this.goalTarget == null)
4001        this.goalTarget = new ArrayList<Goal>();
4002      return this.goalTarget;
4003    }
4004
4005    /**
4006     * @deprecated Use Reference#setResource(IBaseResource) instead
4007     */
4008    @Deprecated
4009    public Goal addGoalTarget() { 
4010      Goal r = new Goal();
4011      if (this.goalTarget == null)
4012        this.goalTarget = new ArrayList<Goal>();
4013      this.goalTarget.add(r);
4014      return r;
4015    }
4016
4017    /**
4018     * @return {@link #activity} (Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.)
4019     */
4020    public List<CarePlanActivityComponent> getActivity() { 
4021      if (this.activity == null)
4022        this.activity = new ArrayList<CarePlanActivityComponent>();
4023      return this.activity;
4024    }
4025
4026    /**
4027     * @return Returns a reference to <code>this</code> for easy method chaining
4028     */
4029    public CarePlan setActivity(List<CarePlanActivityComponent> theActivity) { 
4030      this.activity = theActivity;
4031      return this;
4032    }
4033
4034    public boolean hasActivity() { 
4035      if (this.activity == null)
4036        return false;
4037      for (CarePlanActivityComponent item : this.activity)
4038        if (!item.isEmpty())
4039          return true;
4040      return false;
4041    }
4042
4043    public CarePlanActivityComponent addActivity() { //3
4044      CarePlanActivityComponent t = new CarePlanActivityComponent();
4045      if (this.activity == null)
4046        this.activity = new ArrayList<CarePlanActivityComponent>();
4047      this.activity.add(t);
4048      return t;
4049    }
4050
4051    public CarePlan addActivity(CarePlanActivityComponent t) { //3
4052      if (t == null)
4053        return this;
4054      if (this.activity == null)
4055        this.activity = new ArrayList<CarePlanActivityComponent>();
4056      this.activity.add(t);
4057      return this;
4058    }
4059
4060    /**
4061     * @return The first repetition of repeating field {@link #activity}, creating it if it does not already exist
4062     */
4063    public CarePlanActivityComponent getActivityFirstRep() { 
4064      if (getActivity().isEmpty()) {
4065        addActivity();
4066      }
4067      return getActivity().get(0);
4068    }
4069
4070    /**
4071     * @return {@link #note} (General notes about the care plan not covered elsewhere.)
4072     */
4073    public List<Annotation> getNote() { 
4074      if (this.note == null)
4075        this.note = new ArrayList<Annotation>();
4076      return this.note;
4077    }
4078
4079    /**
4080     * @return Returns a reference to <code>this</code> for easy method chaining
4081     */
4082    public CarePlan setNote(List<Annotation> theNote) { 
4083      this.note = theNote;
4084      return this;
4085    }
4086
4087    public boolean hasNote() { 
4088      if (this.note == null)
4089        return false;
4090      for (Annotation item : this.note)
4091        if (!item.isEmpty())
4092          return true;
4093      return false;
4094    }
4095
4096    public Annotation addNote() { //3
4097      Annotation t = new Annotation();
4098      if (this.note == null)
4099        this.note = new ArrayList<Annotation>();
4100      this.note.add(t);
4101      return t;
4102    }
4103
4104    public CarePlan addNote(Annotation t) { //3
4105      if (t == null)
4106        return this;
4107      if (this.note == null)
4108        this.note = new ArrayList<Annotation>();
4109      this.note.add(t);
4110      return this;
4111    }
4112
4113    /**
4114     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
4115     */
4116    public Annotation getNoteFirstRep() { 
4117      if (getNote().isEmpty()) {
4118        addNote();
4119      }
4120      return getNote().get(0);
4121    }
4122
4123      protected void listChildren(List<Property> children) {
4124        super.listChildren(children);
4125        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
4126        children.add(new Property("instantiatesCanonical", "canonical(PlanDefinition|Questionnaire|Measure|ActivityDefinition|OperationDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
4127        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
4128        children.add(new Property("basedOn", "Reference(CarePlan)", "A care plan that is fulfilled in whole or in part by this care plan.", 0, java.lang.Integer.MAX_VALUE, basedOn));
4129        children.add(new Property("replaces", "Reference(CarePlan)", "Completed or terminated care plan whose function is taken by this new care plan.", 0, java.lang.Integer.MAX_VALUE, replaces));
4130        children.add(new Property("partOf", "Reference(CarePlan)", "A larger care plan of which this particular care plan is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf));
4131        children.add(new Property("status", "code", "Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.", 0, 1, status));
4132        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.", 0, 1, intent));
4133        children.add(new Property("category", "CodeableConcept", "Identifies what \"kind\" of plan this is to support differentiation between multiple co-existing plans; e.g. \"Home health\", \"psychiatric\", \"asthma\", \"disease management\", \"wellness plan\", etc.", 0, java.lang.Integer.MAX_VALUE, category));
4134        children.add(new Property("title", "string", "Human-friendly name for the care plan.", 0, 1, title));
4135        children.add(new Property("description", "string", "A description of the scope and nature of the plan.", 0, 1, description));
4136        children.add(new Property("subject", "Reference(Patient|Group)", "Identifies the patient or group whose intended care is described by the plan.", 0, 1, subject));
4137        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.", 0, 1, encounter));
4138        children.add(new Property("period", "Period", "Indicates when the plan did (or is intended to) come into effect and end.", 0, 1, period));
4139        children.add(new Property("created", "dateTime", "Represents when this particular CarePlan record was created in the system, which is often a system-generated date.", 0, 1, created));
4140        children.add(new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Device|RelatedPerson|Organization|CareTeam)", "When populated, the author is responsible for the care plan.  The care plan is attributed to the author.", 0, 1, author));
4141        children.add(new Property("contributor", "Reference(Patient|Practitioner|PractitionerRole|Device|RelatedPerson|Organization|CareTeam)", "Identifies the individual(s) or organization who provided the contents of the care plan.", 0, java.lang.Integer.MAX_VALUE, contributor));
4142        children.add(new Property("careTeam", "Reference(CareTeam)", "Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.", 0, java.lang.Integer.MAX_VALUE, careTeam));
4143        children.add(new Property("addresses", "Reference(Condition)", "Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.", 0, java.lang.Integer.MAX_VALUE, addresses));
4144        children.add(new Property("supportingInfo", "Reference(Any)", "Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
4145        children.add(new Property("goal", "Reference(Goal)", "Describes the intended objective(s) of carrying out the care plan.", 0, java.lang.Integer.MAX_VALUE, goal));
4146        children.add(new Property("activity", "", "Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.", 0, java.lang.Integer.MAX_VALUE, activity));
4147        children.add(new Property("note", "Annotation", "General notes about the care plan not covered elsewhere.", 0, java.lang.Integer.MAX_VALUE, note));
4148      }
4149
4150      @Override
4151      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4152        switch (_hash) {
4153        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this care plan by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
4154        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(PlanDefinition|Questionnaire|Measure|ActivityDefinition|OperationDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
4155        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, questionnaire or other definition that is adhered to in whole or in part by this CarePlan.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
4156        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan)", "A care plan that is fulfilled in whole or in part by this care plan.", 0, java.lang.Integer.MAX_VALUE, basedOn);
4157        case -430332865: /*replaces*/  return new Property("replaces", "Reference(CarePlan)", "Completed or terminated care plan whose function is taken by this new care plan.", 0, java.lang.Integer.MAX_VALUE, replaces);
4158        case -995410646: /*partOf*/  return new Property("partOf", "Reference(CarePlan)", "A larger care plan of which this particular care plan is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf);
4159        case -892481550: /*status*/  return new Property("status", "code", "Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.", 0, 1, status);
4160        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.", 0, 1, intent);
4161        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Identifies what \"kind\" of plan this is to support differentiation between multiple co-existing plans; e.g. \"Home health\", \"psychiatric\", \"asthma\", \"disease management\", \"wellness plan\", etc.", 0, java.lang.Integer.MAX_VALUE, category);
4162        case 110371416: /*title*/  return new Property("title", "string", "Human-friendly name for the care plan.", 0, 1, title);
4163        case -1724546052: /*description*/  return new Property("description", "string", "A description of the scope and nature of the plan.", 0, 1, description);
4164        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "Identifies the patient or group whose intended care is described by the plan.", 0, 1, subject);
4165        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter during which this CarePlan was created or to which the creation of this record is tightly associated.", 0, 1, encounter);
4166        case -991726143: /*period*/  return new Property("period", "Period", "Indicates when the plan did (or is intended to) come into effect and end.", 0, 1, period);
4167        case 1028554472: /*created*/  return new Property("created", "dateTime", "Represents when this particular CarePlan record was created in the system, which is often a system-generated date.", 0, 1, created);
4168        case -1406328437: /*author*/  return new Property("author", "Reference(Patient|Practitioner|PractitionerRole|Device|RelatedPerson|Organization|CareTeam)", "When populated, the author is responsible for the care plan.  The care plan is attributed to the author.", 0, 1, author);
4169        case -1895276325: /*contributor*/  return new Property("contributor", "Reference(Patient|Practitioner|PractitionerRole|Device|RelatedPerson|Organization|CareTeam)", "Identifies the individual(s) or organization who provided the contents of the care plan.", 0, java.lang.Integer.MAX_VALUE, contributor);
4170        case -7323378: /*careTeam*/  return new Property("careTeam", "Reference(CareTeam)", "Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.", 0, java.lang.Integer.MAX_VALUE, careTeam);
4171        case 874544034: /*addresses*/  return new Property("addresses", "Reference(Condition)", "Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.", 0, java.lang.Integer.MAX_VALUE, addresses);
4172        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "Reference(Any)", "Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include comorbidities, recent procedures, limitations, recent assessments, etc.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
4173        case 3178259: /*goal*/  return new Property("goal", "Reference(Goal)", "Describes the intended objective(s) of carrying out the care plan.", 0, java.lang.Integer.MAX_VALUE, goal);
4174        case -1655966961: /*activity*/  return new Property("activity", "", "Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.", 0, java.lang.Integer.MAX_VALUE, activity);
4175        case 3387378: /*note*/  return new Property("note", "Annotation", "General notes about the care plan not covered elsewhere.", 0, java.lang.Integer.MAX_VALUE, note);
4176        default: return super.getNamedProperty(_hash, _name, _checkValid);
4177        }
4178
4179      }
4180
4181      @Override
4182      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4183        switch (hash) {
4184        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4185        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
4186        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
4187        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
4188        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
4189        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
4190        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CarePlanStatus>
4191        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<CarePlanIntent>
4192        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
4193        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4194        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
4195        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
4196        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
4197        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
4198        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
4199        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
4200        case -1895276325: /*contributor*/ return this.contributor == null ? new Base[0] : this.contributor.toArray(new Base[this.contributor.size()]); // Reference
4201        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // Reference
4202        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
4203        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
4204        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // Reference
4205        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : this.activity.toArray(new Base[this.activity.size()]); // CarePlanActivityComponent
4206        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4207        default: return super.getProperty(hash, name, checkValid);
4208        }
4209
4210      }
4211
4212      @Override
4213      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4214        switch (hash) {
4215        case -1618432855: // identifier
4216          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4217          return value;
4218        case 8911915: // instantiatesCanonical
4219          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
4220          return value;
4221        case -1926393373: // instantiatesUri
4222          this.getInstantiatesUri().add(castToUri(value)); // UriType
4223          return value;
4224        case -332612366: // basedOn
4225          this.getBasedOn().add(castToReference(value)); // Reference
4226          return value;
4227        case -430332865: // replaces
4228          this.getReplaces().add(castToReference(value)); // Reference
4229          return value;
4230        case -995410646: // partOf
4231          this.getPartOf().add(castToReference(value)); // Reference
4232          return value;
4233        case -892481550: // status
4234          value = new CarePlanStatusEnumFactory().fromType(castToCode(value));
4235          this.status = (Enumeration) value; // Enumeration<CarePlanStatus>
4236          return value;
4237        case -1183762788: // intent
4238          value = new CarePlanIntentEnumFactory().fromType(castToCode(value));
4239          this.intent = (Enumeration) value; // Enumeration<CarePlanIntent>
4240          return value;
4241        case 50511102: // category
4242          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
4243          return value;
4244        case 110371416: // title
4245          this.title = castToString(value); // StringType
4246          return value;
4247        case -1724546052: // description
4248          this.description = castToString(value); // StringType
4249          return value;
4250        case -1867885268: // subject
4251          this.subject = castToReference(value); // Reference
4252          return value;
4253        case 1524132147: // encounter
4254          this.encounter = castToReference(value); // Reference
4255          return value;
4256        case -991726143: // period
4257          this.period = castToPeriod(value); // Period
4258          return value;
4259        case 1028554472: // created
4260          this.created = castToDateTime(value); // DateTimeType
4261          return value;
4262        case -1406328437: // author
4263          this.author = castToReference(value); // Reference
4264          return value;
4265        case -1895276325: // contributor
4266          this.getContributor().add(castToReference(value)); // Reference
4267          return value;
4268        case -7323378: // careTeam
4269          this.getCareTeam().add(castToReference(value)); // Reference
4270          return value;
4271        case 874544034: // addresses
4272          this.getAddresses().add(castToReference(value)); // Reference
4273          return value;
4274        case 1922406657: // supportingInfo
4275          this.getSupportingInfo().add(castToReference(value)); // Reference
4276          return value;
4277        case 3178259: // goal
4278          this.getGoal().add(castToReference(value)); // Reference
4279          return value;
4280        case -1655966961: // activity
4281          this.getActivity().add((CarePlanActivityComponent) value); // CarePlanActivityComponent
4282          return value;
4283        case 3387378: // note
4284          this.getNote().add(castToAnnotation(value)); // Annotation
4285          return value;
4286        default: return super.setProperty(hash, name, value);
4287        }
4288
4289      }
4290
4291      @Override
4292      public Base setProperty(String name, Base value) throws FHIRException {
4293        if (name.equals("identifier")) {
4294          this.getIdentifier().add(castToIdentifier(value));
4295        } else if (name.equals("instantiatesCanonical")) {
4296          this.getInstantiatesCanonical().add(castToCanonical(value));
4297        } else if (name.equals("instantiatesUri")) {
4298          this.getInstantiatesUri().add(castToUri(value));
4299        } else if (name.equals("basedOn")) {
4300          this.getBasedOn().add(castToReference(value));
4301        } else if (name.equals("replaces")) {
4302          this.getReplaces().add(castToReference(value));
4303        } else if (name.equals("partOf")) {
4304          this.getPartOf().add(castToReference(value));
4305        } else if (name.equals("status")) {
4306          value = new CarePlanStatusEnumFactory().fromType(castToCode(value));
4307          this.status = (Enumeration) value; // Enumeration<CarePlanStatus>
4308        } else if (name.equals("intent")) {
4309          value = new CarePlanIntentEnumFactory().fromType(castToCode(value));
4310          this.intent = (Enumeration) value; // Enumeration<CarePlanIntent>
4311        } else if (name.equals("category")) {
4312          this.getCategory().add(castToCodeableConcept(value));
4313        } else if (name.equals("title")) {
4314          this.title = castToString(value); // StringType
4315        } else if (name.equals("description")) {
4316          this.description = castToString(value); // StringType
4317        } else if (name.equals("subject")) {
4318          this.subject = castToReference(value); // Reference
4319        } else if (name.equals("encounter")) {
4320          this.encounter = castToReference(value); // Reference
4321        } else if (name.equals("period")) {
4322          this.period = castToPeriod(value); // Period
4323        } else if (name.equals("created")) {
4324          this.created = castToDateTime(value); // DateTimeType
4325        } else if (name.equals("author")) {
4326          this.author = castToReference(value); // Reference
4327        } else if (name.equals("contributor")) {
4328          this.getContributor().add(castToReference(value));
4329        } else if (name.equals("careTeam")) {
4330          this.getCareTeam().add(castToReference(value));
4331        } else if (name.equals("addresses")) {
4332          this.getAddresses().add(castToReference(value));
4333        } else if (name.equals("supportingInfo")) {
4334          this.getSupportingInfo().add(castToReference(value));
4335        } else if (name.equals("goal")) {
4336          this.getGoal().add(castToReference(value));
4337        } else if (name.equals("activity")) {
4338          this.getActivity().add((CarePlanActivityComponent) value);
4339        } else if (name.equals("note")) {
4340          this.getNote().add(castToAnnotation(value));
4341        } else
4342          return super.setProperty(name, value);
4343        return value;
4344      }
4345
4346      @Override
4347      public Base makeProperty(int hash, String name) throws FHIRException {
4348        switch (hash) {
4349        case -1618432855:  return addIdentifier(); 
4350        case 8911915:  return addInstantiatesCanonicalElement();
4351        case -1926393373:  return addInstantiatesUriElement();
4352        case -332612366:  return addBasedOn(); 
4353        case -430332865:  return addReplaces(); 
4354        case -995410646:  return addPartOf(); 
4355        case -892481550:  return getStatusElement();
4356        case -1183762788:  return getIntentElement();
4357        case 50511102:  return addCategory(); 
4358        case 110371416:  return getTitleElement();
4359        case -1724546052:  return getDescriptionElement();
4360        case -1867885268:  return getSubject(); 
4361        case 1524132147:  return getEncounter(); 
4362        case -991726143:  return getPeriod(); 
4363        case 1028554472:  return getCreatedElement();
4364        case -1406328437:  return getAuthor(); 
4365        case -1895276325:  return addContributor(); 
4366        case -7323378:  return addCareTeam(); 
4367        case 874544034:  return addAddresses(); 
4368        case 1922406657:  return addSupportingInfo(); 
4369        case 3178259:  return addGoal(); 
4370        case -1655966961:  return addActivity(); 
4371        case 3387378:  return addNote(); 
4372        default: return super.makeProperty(hash, name);
4373        }
4374
4375      }
4376
4377      @Override
4378      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4379        switch (hash) {
4380        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4381        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
4382        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
4383        case -332612366: /*basedOn*/ return new String[] {"Reference"};
4384        case -430332865: /*replaces*/ return new String[] {"Reference"};
4385        case -995410646: /*partOf*/ return new String[] {"Reference"};
4386        case -892481550: /*status*/ return new String[] {"code"};
4387        case -1183762788: /*intent*/ return new String[] {"code"};
4388        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4389        case 110371416: /*title*/ return new String[] {"string"};
4390        case -1724546052: /*description*/ return new String[] {"string"};
4391        case -1867885268: /*subject*/ return new String[] {"Reference"};
4392        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4393        case -991726143: /*period*/ return new String[] {"Period"};
4394        case 1028554472: /*created*/ return new String[] {"dateTime"};
4395        case -1406328437: /*author*/ return new String[] {"Reference"};
4396        case -1895276325: /*contributor*/ return new String[] {"Reference"};
4397        case -7323378: /*careTeam*/ return new String[] {"Reference"};
4398        case 874544034: /*addresses*/ return new String[] {"Reference"};
4399        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
4400        case 3178259: /*goal*/ return new String[] {"Reference"};
4401        case -1655966961: /*activity*/ return new String[] {};
4402        case 3387378: /*note*/ return new String[] {"Annotation"};
4403        default: return super.getTypesForProperty(hash, name);
4404        }
4405
4406      }
4407
4408      @Override
4409      public Base addChild(String name) throws FHIRException {
4410        if (name.equals("identifier")) {
4411          return addIdentifier();
4412        }
4413        else if (name.equals("instantiatesCanonical")) {
4414          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesCanonical");
4415        }
4416        else if (name.equals("instantiatesUri")) {
4417          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesUri");
4418        }
4419        else if (name.equals("basedOn")) {
4420          return addBasedOn();
4421        }
4422        else if (name.equals("replaces")) {
4423          return addReplaces();
4424        }
4425        else if (name.equals("partOf")) {
4426          return addPartOf();
4427        }
4428        else if (name.equals("status")) {
4429          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.status");
4430        }
4431        else if (name.equals("intent")) {
4432          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.intent");
4433        }
4434        else if (name.equals("category")) {
4435          return addCategory();
4436        }
4437        else if (name.equals("title")) {
4438          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.title");
4439        }
4440        else if (name.equals("description")) {
4441          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.description");
4442        }
4443        else if (name.equals("subject")) {
4444          this.subject = new Reference();
4445          return this.subject;
4446        }
4447        else if (name.equals("encounter")) {
4448          this.encounter = new Reference();
4449          return this.encounter;
4450        }
4451        else if (name.equals("period")) {
4452          this.period = new Period();
4453          return this.period;
4454        }
4455        else if (name.equals("created")) {
4456          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.created");
4457        }
4458        else if (name.equals("author")) {
4459          this.author = new Reference();
4460          return this.author;
4461        }
4462        else if (name.equals("contributor")) {
4463          return addContributor();
4464        }
4465        else if (name.equals("careTeam")) {
4466          return addCareTeam();
4467        }
4468        else if (name.equals("addresses")) {
4469          return addAddresses();
4470        }
4471        else if (name.equals("supportingInfo")) {
4472          return addSupportingInfo();
4473        }
4474        else if (name.equals("goal")) {
4475          return addGoal();
4476        }
4477        else if (name.equals("activity")) {
4478          return addActivity();
4479        }
4480        else if (name.equals("note")) {
4481          return addNote();
4482        }
4483        else
4484          return super.addChild(name);
4485      }
4486
4487  public String fhirType() {
4488    return "CarePlan";
4489
4490  }
4491
4492      public CarePlan copy() {
4493        CarePlan dst = new CarePlan();
4494        copyValues(dst);
4495        if (identifier != null) {
4496          dst.identifier = new ArrayList<Identifier>();
4497          for (Identifier i : identifier)
4498            dst.identifier.add(i.copy());
4499        };
4500        if (instantiatesCanonical != null) {
4501          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4502          for (CanonicalType i : instantiatesCanonical)
4503            dst.instantiatesCanonical.add(i.copy());
4504        };
4505        if (instantiatesUri != null) {
4506          dst.instantiatesUri = new ArrayList<UriType>();
4507          for (UriType i : instantiatesUri)
4508            dst.instantiatesUri.add(i.copy());
4509        };
4510        if (basedOn != null) {
4511          dst.basedOn = new ArrayList<Reference>();
4512          for (Reference i : basedOn)
4513            dst.basedOn.add(i.copy());
4514        };
4515        if (replaces != null) {
4516          dst.replaces = new ArrayList<Reference>();
4517          for (Reference i : replaces)
4518            dst.replaces.add(i.copy());
4519        };
4520        if (partOf != null) {
4521          dst.partOf = new ArrayList<Reference>();
4522          for (Reference i : partOf)
4523            dst.partOf.add(i.copy());
4524        };
4525        dst.status = status == null ? null : status.copy();
4526        dst.intent = intent == null ? null : intent.copy();
4527        if (category != null) {
4528          dst.category = new ArrayList<CodeableConcept>();
4529          for (CodeableConcept i : category)
4530            dst.category.add(i.copy());
4531        };
4532        dst.title = title == null ? null : title.copy();
4533        dst.description = description == null ? null : description.copy();
4534        dst.subject = subject == null ? null : subject.copy();
4535        dst.encounter = encounter == null ? null : encounter.copy();
4536        dst.period = period == null ? null : period.copy();
4537        dst.created = created == null ? null : created.copy();
4538        dst.author = author == null ? null : author.copy();
4539        if (contributor != null) {
4540          dst.contributor = new ArrayList<Reference>();
4541          for (Reference i : contributor)
4542            dst.contributor.add(i.copy());
4543        };
4544        if (careTeam != null) {
4545          dst.careTeam = new ArrayList<Reference>();
4546          for (Reference i : careTeam)
4547            dst.careTeam.add(i.copy());
4548        };
4549        if (addresses != null) {
4550          dst.addresses = new ArrayList<Reference>();
4551          for (Reference i : addresses)
4552            dst.addresses.add(i.copy());
4553        };
4554        if (supportingInfo != null) {
4555          dst.supportingInfo = new ArrayList<Reference>();
4556          for (Reference i : supportingInfo)
4557            dst.supportingInfo.add(i.copy());
4558        };
4559        if (goal != null) {
4560          dst.goal = new ArrayList<Reference>();
4561          for (Reference i : goal)
4562            dst.goal.add(i.copy());
4563        };
4564        if (activity != null) {
4565          dst.activity = new ArrayList<CarePlanActivityComponent>();
4566          for (CarePlanActivityComponent i : activity)
4567            dst.activity.add(i.copy());
4568        };
4569        if (note != null) {
4570          dst.note = new ArrayList<Annotation>();
4571          for (Annotation i : note)
4572            dst.note.add(i.copy());
4573        };
4574        return dst;
4575      }
4576
4577      protected CarePlan typedCopy() {
4578        return copy();
4579      }
4580
4581      @Override
4582      public boolean equalsDeep(Base other_) {
4583        if (!super.equalsDeep(other_))
4584          return false;
4585        if (!(other_ instanceof CarePlan))
4586          return false;
4587        CarePlan o = (CarePlan) other_;
4588        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4589           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
4590           && compareDeep(replaces, o.replaces, true) && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true)
4591           && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(title, o.title, true)
4592           && compareDeep(description, o.description, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
4593           && compareDeep(period, o.period, true) && compareDeep(created, o.created, true) && compareDeep(author, o.author, true)
4594           && compareDeep(contributor, o.contributor, true) && compareDeep(careTeam, o.careTeam, true) && compareDeep(addresses, o.addresses, true)
4595           && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(goal, o.goal, true) && compareDeep(activity, o.activity, true)
4596           && compareDeep(note, o.note, true);
4597      }
4598
4599      @Override
4600      public boolean equalsShallow(Base other_) {
4601        if (!super.equalsShallow(other_))
4602          return false;
4603        if (!(other_ instanceof CarePlan))
4604          return false;
4605        CarePlan o = (CarePlan) other_;
4606        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
4607           && compareValues(intent, o.intent, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
4608           && compareValues(created, o.created, true);
4609      }
4610
4611      public boolean isEmpty() {
4612        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4613          , instantiatesUri, basedOn, replaces, partOf, status, intent, category, title
4614          , description, subject, encounter, period, created, author, contributor, careTeam
4615          , addresses, supportingInfo, goal, activity, note);
4616      }
4617
4618  @Override
4619  public ResourceType getResourceType() {
4620    return ResourceType.CarePlan;
4621   }
4622
4623 /**
4624   * Search parameter: <b>date</b>
4625   * <p>
4626   * Description: <b>Time period plan covers</b><br>
4627   * Type: <b>date</b><br>
4628   * Path: <b>CarePlan.period</b><br>
4629   * </p>
4630   */
4631  @SearchParamDefinition(name="date", path="CarePlan.period", description="Time period plan covers", type="date" )
4632  public static final String SP_DATE = "date";
4633 /**
4634   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4635   * <p>
4636   * Description: <b>Time period plan covers</b><br>
4637   * Type: <b>date</b><br>
4638   * Path: <b>CarePlan.period</b><br>
4639   * </p>
4640   */
4641  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4642
4643 /**
4644   * Search parameter: <b>care-team</b>
4645   * <p>
4646   * Description: <b>Who's involved in plan?</b><br>
4647   * Type: <b>reference</b><br>
4648   * Path: <b>CarePlan.careTeam</b><br>
4649   * </p>
4650   */
4651  @SearchParamDefinition(name="care-team", path="CarePlan.careTeam", description="Who's involved in plan?", type="reference", target={CareTeam.class } )
4652  public static final String SP_CARE_TEAM = "care-team";
4653 /**
4654   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
4655   * <p>
4656   * Description: <b>Who's involved in plan?</b><br>
4657   * Type: <b>reference</b><br>
4658   * Path: <b>CarePlan.careTeam</b><br>
4659   * </p>
4660   */
4661  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
4662
4663/**
4664   * Constant for fluent queries to be used to add include statements. Specifies
4665   * the path value of "<b>CarePlan:care-team</b>".
4666   */
4667  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("CarePlan:care-team").toLocked();
4668
4669 /**
4670   * Search parameter: <b>identifier</b>
4671   * <p>
4672   * Description: <b>External Ids for this plan</b><br>
4673   * Type: <b>token</b><br>
4674   * Path: <b>CarePlan.identifier</b><br>
4675   * </p>
4676   */
4677  @SearchParamDefinition(name="identifier", path="CarePlan.identifier", description="External Ids for this plan", type="token" )
4678  public static final String SP_IDENTIFIER = "identifier";
4679 /**
4680   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4681   * <p>
4682   * Description: <b>External Ids for this plan</b><br>
4683   * Type: <b>token</b><br>
4684   * Path: <b>CarePlan.identifier</b><br>
4685   * </p>
4686   */
4687  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4688
4689 /**
4690   * Search parameter: <b>performer</b>
4691   * <p>
4692   * Description: <b>Matches if the practitioner is listed as a performer in any of the "simple" activities.  (For performers of the detailed activities, chain through the activitydetail search parameter.)</b><br>
4693   * Type: <b>reference</b><br>
4694   * Path: <b>CarePlan.activity.detail.performer</b><br>
4695   * </p>
4696   */
4697  @SearchParamDefinition(name="performer", path="CarePlan.activity.detail.performer", description="Matches if the practitioner is listed as a performer in any of the \"simple\" activities.  (For performers of the detailed activities, chain through the activitydetail search parameter.)", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={CareTeam.class, Device.class, HealthcareService.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
4698  public static final String SP_PERFORMER = "performer";
4699 /**
4700   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
4701   * <p>
4702   * Description: <b>Matches if the practitioner is listed as a performer in any of the "simple" activities.  (For performers of the detailed activities, chain through the activitydetail search parameter.)</b><br>
4703   * Type: <b>reference</b><br>
4704   * Path: <b>CarePlan.activity.detail.performer</b><br>
4705   * </p>
4706   */
4707  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
4708
4709/**
4710   * Constant for fluent queries to be used to add include statements. Specifies
4711   * the path value of "<b>CarePlan:performer</b>".
4712   */
4713  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("CarePlan:performer").toLocked();
4714
4715 /**
4716   * Search parameter: <b>goal</b>
4717   * <p>
4718   * Description: <b>Desired outcome of plan</b><br>
4719   * Type: <b>reference</b><br>
4720   * Path: <b>CarePlan.goal</b><br>
4721   * </p>
4722   */
4723  @SearchParamDefinition(name="goal", path="CarePlan.goal", description="Desired outcome of plan", type="reference", target={Goal.class } )
4724  public static final String SP_GOAL = "goal";
4725 /**
4726   * <b>Fluent Client</b> search parameter constant for <b>goal</b>
4727   * <p>
4728   * Description: <b>Desired outcome of plan</b><br>
4729   * Type: <b>reference</b><br>
4730   * Path: <b>CarePlan.goal</b><br>
4731   * </p>
4732   */
4733  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GOAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_GOAL);
4734
4735/**
4736   * Constant for fluent queries to be used to add include statements. Specifies
4737   * the path value of "<b>CarePlan:goal</b>".
4738   */
4739  public static final ca.uhn.fhir.model.api.Include INCLUDE_GOAL = new ca.uhn.fhir.model.api.Include("CarePlan:goal").toLocked();
4740
4741 /**
4742   * Search parameter: <b>subject</b>
4743   * <p>
4744   * Description: <b>Who the care plan is for</b><br>
4745   * Type: <b>reference</b><br>
4746   * Path: <b>CarePlan.subject</b><br>
4747   * </p>
4748   */
4749  @SearchParamDefinition(name="subject", path="CarePlan.subject", description="Who the care plan is for", type="reference", target={Group.class, Patient.class } )
4750  public static final String SP_SUBJECT = "subject";
4751 /**
4752   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4753   * <p>
4754   * Description: <b>Who the care plan is for</b><br>
4755   * Type: <b>reference</b><br>
4756   * Path: <b>CarePlan.subject</b><br>
4757   * </p>
4758   */
4759  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4760
4761/**
4762   * Constant for fluent queries to be used to add include statements. Specifies
4763   * the path value of "<b>CarePlan:subject</b>".
4764   */
4765  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CarePlan:subject").toLocked();
4766
4767 /**
4768   * Search parameter: <b>replaces</b>
4769   * <p>
4770   * Description: <b>CarePlan replaced by this CarePlan</b><br>
4771   * Type: <b>reference</b><br>
4772   * Path: <b>CarePlan.replaces</b><br>
4773   * </p>
4774   */
4775  @SearchParamDefinition(name="replaces", path="CarePlan.replaces", description="CarePlan replaced by this CarePlan", type="reference", target={CarePlan.class } )
4776  public static final String SP_REPLACES = "replaces";
4777 /**
4778   * <b>Fluent Client</b> search parameter constant for <b>replaces</b>
4779   * <p>
4780   * Description: <b>CarePlan replaced by this CarePlan</b><br>
4781   * Type: <b>reference</b><br>
4782   * Path: <b>CarePlan.replaces</b><br>
4783   * </p>
4784   */
4785  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPLACES = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REPLACES);
4786
4787/**
4788   * Constant for fluent queries to be used to add include statements. Specifies
4789   * the path value of "<b>CarePlan:replaces</b>".
4790   */
4791  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPLACES = new ca.uhn.fhir.model.api.Include("CarePlan:replaces").toLocked();
4792
4793 /**
4794   * Search parameter: <b>instantiates-canonical</b>
4795   * <p>
4796   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4797   * Type: <b>reference</b><br>
4798   * Path: <b>CarePlan.instantiatesCanonical</b><br>
4799   * </p>
4800   */
4801  @SearchParamDefinition(name="instantiates-canonical", path="CarePlan.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, Measure.class, OperationDefinition.class, PlanDefinition.class, Questionnaire.class } )
4802  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
4803 /**
4804   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
4805   * <p>
4806   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4807   * Type: <b>reference</b><br>
4808   * Path: <b>CarePlan.instantiatesCanonical</b><br>
4809   * </p>
4810   */
4811  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
4812
4813/**
4814   * Constant for fluent queries to be used to add include statements. Specifies
4815   * the path value of "<b>CarePlan:instantiates-canonical</b>".
4816   */
4817  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("CarePlan:instantiates-canonical").toLocked();
4818
4819 /**
4820   * Search parameter: <b>part-of</b>
4821   * <p>
4822   * Description: <b>Part of referenced CarePlan</b><br>
4823   * Type: <b>reference</b><br>
4824   * Path: <b>CarePlan.partOf</b><br>
4825   * </p>
4826   */
4827  @SearchParamDefinition(name="part-of", path="CarePlan.partOf", description="Part of referenced CarePlan", type="reference", target={CarePlan.class } )
4828  public static final String SP_PART_OF = "part-of";
4829 /**
4830   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
4831   * <p>
4832   * Description: <b>Part of referenced CarePlan</b><br>
4833   * Type: <b>reference</b><br>
4834   * Path: <b>CarePlan.partOf</b><br>
4835   * </p>
4836   */
4837  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
4838
4839/**
4840   * Constant for fluent queries to be used to add include statements. Specifies
4841   * the path value of "<b>CarePlan:part-of</b>".
4842   */
4843  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("CarePlan:part-of").toLocked();
4844
4845 /**
4846   * Search parameter: <b>encounter</b>
4847   * <p>
4848   * Description: <b>Encounter created as part of</b><br>
4849   * Type: <b>reference</b><br>
4850   * Path: <b>CarePlan.encounter</b><br>
4851   * </p>
4852   */
4853  @SearchParamDefinition(name="encounter", path="CarePlan.encounter", description="Encounter created as part of", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
4854  public static final String SP_ENCOUNTER = "encounter";
4855 /**
4856   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4857   * <p>
4858   * Description: <b>Encounter created as part of</b><br>
4859   * Type: <b>reference</b><br>
4860   * Path: <b>CarePlan.encounter</b><br>
4861   * </p>
4862   */
4863  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4864
4865/**
4866   * Constant for fluent queries to be used to add include statements. Specifies
4867   * the path value of "<b>CarePlan:encounter</b>".
4868   */
4869  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("CarePlan:encounter").toLocked();
4870
4871 /**
4872   * Search parameter: <b>intent</b>
4873   * <p>
4874   * Description: <b>proposal | plan | order | option</b><br>
4875   * Type: <b>token</b><br>
4876   * Path: <b>CarePlan.intent</b><br>
4877   * </p>
4878   */
4879  @SearchParamDefinition(name="intent", path="CarePlan.intent", description="proposal | plan | order | option", type="token" )
4880  public static final String SP_INTENT = "intent";
4881 /**
4882   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
4883   * <p>
4884   * Description: <b>proposal | plan | order | option</b><br>
4885   * Type: <b>token</b><br>
4886   * Path: <b>CarePlan.intent</b><br>
4887   * </p>
4888   */
4889  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4890
4891 /**
4892   * Search parameter: <b>activity-reference</b>
4893   * <p>
4894   * Description: <b>Activity details defined in specific resource</b><br>
4895   * Type: <b>reference</b><br>
4896   * Path: <b>CarePlan.activity.reference</b><br>
4897   * </p>
4898   */
4899  @SearchParamDefinition(name="activity-reference", path="CarePlan.activity.reference", description="Activity details defined in specific resource", type="reference", target={Appointment.class, CommunicationRequest.class, DeviceRequest.class, MedicationRequest.class, NutritionOrder.class, RequestGroup.class, ServiceRequest.class, Task.class, VisionPrescription.class } )
4900  public static final String SP_ACTIVITY_REFERENCE = "activity-reference";
4901 /**
4902   * <b>Fluent Client</b> search parameter constant for <b>activity-reference</b>
4903   * <p>
4904   * Description: <b>Activity details defined in specific resource</b><br>
4905   * Type: <b>reference</b><br>
4906   * Path: <b>CarePlan.activity.reference</b><br>
4907   * </p>
4908   */
4909  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTIVITY_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTIVITY_REFERENCE);
4910
4911/**
4912   * Constant for fluent queries to be used to add include statements. Specifies
4913   * the path value of "<b>CarePlan:activity-reference</b>".
4914   */
4915  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTIVITY_REFERENCE = new ca.uhn.fhir.model.api.Include("CarePlan:activity-reference").toLocked();
4916
4917 /**
4918   * Search parameter: <b>condition</b>
4919   * <p>
4920   * Description: <b>Health issues this plan addresses</b><br>
4921   * Type: <b>reference</b><br>
4922   * Path: <b>CarePlan.addresses</b><br>
4923   * </p>
4924   */
4925  @SearchParamDefinition(name="condition", path="CarePlan.addresses", description="Health issues this plan addresses", type="reference", target={Condition.class } )
4926  public static final String SP_CONDITION = "condition";
4927 /**
4928   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
4929   * <p>
4930   * Description: <b>Health issues this plan addresses</b><br>
4931   * Type: <b>reference</b><br>
4932   * Path: <b>CarePlan.addresses</b><br>
4933   * </p>
4934   */
4935  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONDITION);
4936
4937/**
4938   * Constant for fluent queries to be used to add include statements. Specifies
4939   * the path value of "<b>CarePlan:condition</b>".
4940   */
4941  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include("CarePlan:condition").toLocked();
4942
4943 /**
4944   * Search parameter: <b>based-on</b>
4945   * <p>
4946   * Description: <b>Fulfills CarePlan</b><br>
4947   * Type: <b>reference</b><br>
4948   * Path: <b>CarePlan.basedOn</b><br>
4949   * </p>
4950   */
4951  @SearchParamDefinition(name="based-on", path="CarePlan.basedOn", description="Fulfills CarePlan", type="reference", target={CarePlan.class } )
4952  public static final String SP_BASED_ON = "based-on";
4953 /**
4954   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
4955   * <p>
4956   * Description: <b>Fulfills CarePlan</b><br>
4957   * Type: <b>reference</b><br>
4958   * Path: <b>CarePlan.basedOn</b><br>
4959   * </p>
4960   */
4961  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
4962
4963/**
4964   * Constant for fluent queries to be used to add include statements. Specifies
4965   * the path value of "<b>CarePlan:based-on</b>".
4966   */
4967  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("CarePlan:based-on").toLocked();
4968
4969 /**
4970   * Search parameter: <b>patient</b>
4971   * <p>
4972   * Description: <b>Who the care plan is for</b><br>
4973   * Type: <b>reference</b><br>
4974   * Path: <b>CarePlan.subject</b><br>
4975   * </p>
4976   */
4977  @SearchParamDefinition(name="patient", path="CarePlan.subject.where(resolve() is Patient)", description="Who the care plan is for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
4978  public static final String SP_PATIENT = "patient";
4979 /**
4980   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4981   * <p>
4982   * Description: <b>Who the care plan is for</b><br>
4983   * Type: <b>reference</b><br>
4984   * Path: <b>CarePlan.subject</b><br>
4985   * </p>
4986   */
4987  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4988
4989/**
4990   * Constant for fluent queries to be used to add include statements. Specifies
4991   * the path value of "<b>CarePlan:patient</b>".
4992   */
4993  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CarePlan:patient").toLocked();
4994
4995 /**
4996   * Search parameter: <b>activity-date</b>
4997   * <p>
4998   * Description: <b>Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]</b><br>
4999   * Type: <b>date</b><br>
5000   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
5001   * </p>
5002   */
5003  @SearchParamDefinition(name="activity-date", path="CarePlan.activity.detail.scheduled", description="Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]", type="date" )
5004  public static final String SP_ACTIVITY_DATE = "activity-date";
5005 /**
5006   * <b>Fluent Client</b> search parameter constant for <b>activity-date</b>
5007   * <p>
5008   * Description: <b>Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]</b><br>
5009   * Type: <b>date</b><br>
5010   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
5011   * </p>
5012   */
5013  public static final ca.uhn.fhir.rest.gclient.DateClientParam ACTIVITY_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ACTIVITY_DATE);
5014
5015 /**
5016   * Search parameter: <b>instantiates-uri</b>
5017   * <p>
5018   * Description: <b>Instantiates external protocol or definition</b><br>
5019   * Type: <b>uri</b><br>
5020   * Path: <b>CarePlan.instantiatesUri</b><br>
5021   * </p>
5022   */
5023  @SearchParamDefinition(name="instantiates-uri", path="CarePlan.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
5024  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
5025 /**
5026   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
5027   * <p>
5028   * Description: <b>Instantiates external protocol or definition</b><br>
5029   * Type: <b>uri</b><br>
5030   * Path: <b>CarePlan.instantiatesUri</b><br>
5031   * </p>
5032   */
5033  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
5034
5035 /**
5036   * Search parameter: <b>category</b>
5037   * <p>
5038   * Description: <b>Type of plan</b><br>
5039   * Type: <b>token</b><br>
5040   * Path: <b>CarePlan.category</b><br>
5041   * </p>
5042   */
5043  @SearchParamDefinition(name="category", path="CarePlan.category", description="Type of plan", type="token" )
5044  public static final String SP_CATEGORY = "category";
5045 /**
5046   * <b>Fluent Client</b> search parameter constant for <b>category</b>
5047   * <p>
5048   * Description: <b>Type of plan</b><br>
5049   * Type: <b>token</b><br>
5050   * Path: <b>CarePlan.category</b><br>
5051   * </p>
5052   */
5053  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
5054
5055 /**
5056   * Search parameter: <b>activity-code</b>
5057   * <p>
5058   * Description: <b>Detail type of activity</b><br>
5059   * Type: <b>token</b><br>
5060   * Path: <b>CarePlan.activity.detail.code</b><br>
5061   * </p>
5062   */
5063  @SearchParamDefinition(name="activity-code", path="CarePlan.activity.detail.code", description="Detail type of activity", type="token" )
5064  public static final String SP_ACTIVITY_CODE = "activity-code";
5065 /**
5066   * <b>Fluent Client</b> search parameter constant for <b>activity-code</b>
5067   * <p>
5068   * Description: <b>Detail type of activity</b><br>
5069   * Type: <b>token</b><br>
5070   * Path: <b>CarePlan.activity.detail.code</b><br>
5071   * </p>
5072   */
5073  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVITY_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVITY_CODE);
5074
5075 /**
5076   * Search parameter: <b>status</b>
5077   * <p>
5078   * Description: <b>draft | active | suspended | completed | entered-in-error | cancelled | unknown</b><br>
5079   * Type: <b>token</b><br>
5080   * Path: <b>CarePlan.status</b><br>
5081   * </p>
5082   */
5083  @SearchParamDefinition(name="status", path="CarePlan.status", description="draft | active | suspended | completed | entered-in-error | cancelled | unknown", type="token" )
5084  public static final String SP_STATUS = "status";
5085 /**
5086   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5087   * <p>
5088   * Description: <b>draft | active | suspended | completed | entered-in-error | cancelled | unknown</b><br>
5089   * Type: <b>token</b><br>
5090   * Path: <b>CarePlan.status</b><br>
5091   * </p>
5092   */
5093  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5094
5095
5096}
5097