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, Sep 13, 2018 09:04-0400 for FHIR v3.5.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 authorization/request to act has been temporarily withdrawn but is expected to resume in the future.
062         */
063        ONHOLD, 
064        /**
065         * The authorization/request 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         * Activity against the request has been sufficiently completed to the satisfaction of the requester.
070         */
071        COMPLETED, 
072        /**
073         * This electronic record should never have existed, though 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 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 system creating the request does not know.
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 authorization/request to act has been temporarily withdrawn but is expected to resume in the future.";
135            case REVOKED: return "The authorization/request to act has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
136            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester.";
137            case ENTEREDINERROR: return "This electronic record should never have existed, though 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 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 system creating the request does not know.";
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         * 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         * Activity has been started but is not yet complete.
546         */
547        INPROGRESS, 
548        /**
549         * Activity was started but has temporarily ceased with an expectation of resumption at a future time.
550         */
551        ONHOLD, 
552        /**
553         * The activity has been completed (more or less) as planned.
554         */
555        COMPLETED, 
556        /**
557         * The planned activity has been withdrawn.
558         */
559        CANCELLED, 
560        /**
561         * The planned activity has been ended prior to completion after the activity was started.
562         */
563        STOPPED, 
564        /**
565         * The current state of the activity is not known.  Note: This concept is not to be used for "other".
566         */
567        UNKNOWN, 
568        /**
569         * The 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 "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 "Activity has been started but is not yet complete.";
635            case ONHOLD: return "Activity was started but has temporarily ceased with an expectation of resumption at a future time.";
636            case COMPLETED: return "The activity has been completed (more or less) as planned.";
637            case CANCELLED: return "The planned activity has been withdrawn.";
638            case STOPPED: return "The planned activity has been ended prior to completion after the activity was started.";
639            case UNKNOWN: return "The current state of the activity is not known.  Note: This concept is not to be used for \"other\".";
640            case ENTEREDINERROR: return "The 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            return null;
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            return null;
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            return null;
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            return null;
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            return null;
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     * Identifies the original context in which this particular care plan was created.
2701     */
2702    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=12, min=0, max=1, modifier=false, summary=true)
2703    @Description(shortDefinition="Created in context of", formalDefinition="Identifies the original context in which this particular care plan was created." )
2704    protected Reference context;
2705
2706    /**
2707     * The actual object that is the target of the reference (Identifies the original context in which this particular care plan was created.)
2708     */
2709    protected Resource contextTarget;
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 = 973275448L;
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 #context} (Identifies the original context in which this particular care plan was created.)
3512     */
3513    public Reference getContext() { 
3514      if (this.context == null)
3515        if (Configuration.errorOnAutoCreate())
3516          throw new Error("Attempt to auto-create CarePlan.context");
3517        else if (Configuration.doAutoCreate())
3518          this.context = new Reference(); // cc
3519      return this.context;
3520    }
3521
3522    public boolean hasContext() { 
3523      return this.context != null && !this.context.isEmpty();
3524    }
3525
3526    /**
3527     * @param value {@link #context} (Identifies the original context in which this particular care plan was created.)
3528     */
3529    public CarePlan setContext(Reference value) { 
3530      this.context = value;
3531      return this;
3532    }
3533
3534    /**
3535     * @return {@link #context} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the original context in which this particular care plan was created.)
3536     */
3537    public Resource getContextTarget() { 
3538      return this.contextTarget;
3539    }
3540
3541    /**
3542     * @param value {@link #context} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the original context in which this particular care plan was created.)
3543     */
3544    public CarePlan setContextTarget(Resource value) { 
3545      this.contextTarget = value;
3546      return this;
3547    }
3548
3549    /**
3550     * @return {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
3551     */
3552    public Period getPeriod() { 
3553      if (this.period == null)
3554        if (Configuration.errorOnAutoCreate())
3555          throw new Error("Attempt to auto-create CarePlan.period");
3556        else if (Configuration.doAutoCreate())
3557          this.period = new Period(); // cc
3558      return this.period;
3559    }
3560
3561    public boolean hasPeriod() { 
3562      return this.period != null && !this.period.isEmpty();
3563    }
3564
3565    /**
3566     * @param value {@link #period} (Indicates when the plan did (or is intended to) come into effect and end.)
3567     */
3568    public CarePlan setPeriod(Period value) { 
3569      this.period = value;
3570      return this;
3571    }
3572
3573    /**
3574     * @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
3575     */
3576    public DateTimeType getCreatedElement() { 
3577      if (this.created == null)
3578        if (Configuration.errorOnAutoCreate())
3579          throw new Error("Attempt to auto-create CarePlan.created");
3580        else if (Configuration.doAutoCreate())
3581          this.created = new DateTimeType(); // bb
3582      return this.created;
3583    }
3584
3585    public boolean hasCreatedElement() { 
3586      return this.created != null && !this.created.isEmpty();
3587    }
3588
3589    public boolean hasCreated() { 
3590      return this.created != null && !this.created.isEmpty();
3591    }
3592
3593    /**
3594     * @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
3595     */
3596    public CarePlan setCreatedElement(DateTimeType value) { 
3597      this.created = value;
3598      return this;
3599    }
3600
3601    /**
3602     * @return Represents when this particular CarePlan record was created in the system, which is often a system-generated date.
3603     */
3604    public Date getCreated() { 
3605      return this.created == null ? null : this.created.getValue();
3606    }
3607
3608    /**
3609     * @param value Represents when this particular CarePlan record was created in the system, which is often a system-generated date.
3610     */
3611    public CarePlan setCreated(Date value) { 
3612      if (value == null)
3613        this.created = null;
3614      else {
3615        if (this.created == null)
3616          this.created = new DateTimeType();
3617        this.created.setValue(value);
3618      }
3619      return this;
3620    }
3621
3622    /**
3623     * @return {@link #author} (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3624     */
3625    public Reference getAuthor() { 
3626      if (this.author == null)
3627        if (Configuration.errorOnAutoCreate())
3628          throw new Error("Attempt to auto-create CarePlan.author");
3629        else if (Configuration.doAutoCreate())
3630          this.author = new Reference(); // cc
3631      return this.author;
3632    }
3633
3634    public boolean hasAuthor() { 
3635      return this.author != null && !this.author.isEmpty();
3636    }
3637
3638    /**
3639     * @param value {@link #author} (When populated, the author is responsible for the care plan.  The care plan is attributed to the author.)
3640     */
3641    public CarePlan setAuthor(Reference value) { 
3642      this.author = value;
3643      return this;
3644    }
3645
3646    /**
3647     * @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.)
3648     */
3649    public Resource getAuthorTarget() { 
3650      return this.authorTarget;
3651    }
3652
3653    /**
3654     * @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.)
3655     */
3656    public CarePlan setAuthorTarget(Resource value) { 
3657      this.authorTarget = value;
3658      return this;
3659    }
3660
3661    /**
3662     * @return {@link #contributor} (Identifies the individual(s) or organization who provided the contents of the care plan.)
3663     */
3664    public List<Reference> getContributor() { 
3665      if (this.contributor == null)
3666        this.contributor = new ArrayList<Reference>();
3667      return this.contributor;
3668    }
3669
3670    /**
3671     * @return Returns a reference to <code>this</code> for easy method chaining
3672     */
3673    public CarePlan setContributor(List<Reference> theContributor) { 
3674      this.contributor = theContributor;
3675      return this;
3676    }
3677
3678    public boolean hasContributor() { 
3679      if (this.contributor == null)
3680        return false;
3681      for (Reference item : this.contributor)
3682        if (!item.isEmpty())
3683          return true;
3684      return false;
3685    }
3686
3687    public Reference addContributor() { //3
3688      Reference t = new Reference();
3689      if (this.contributor == null)
3690        this.contributor = new ArrayList<Reference>();
3691      this.contributor.add(t);
3692      return t;
3693    }
3694
3695    public CarePlan addContributor(Reference t) { //3
3696      if (t == null)
3697        return this;
3698      if (this.contributor == null)
3699        this.contributor = new ArrayList<Reference>();
3700      this.contributor.add(t);
3701      return this;
3702    }
3703
3704    /**
3705     * @return The first repetition of repeating field {@link #contributor}, creating it if it does not already exist
3706     */
3707    public Reference getContributorFirstRep() { 
3708      if (getContributor().isEmpty()) {
3709        addContributor();
3710      }
3711      return getContributor().get(0);
3712    }
3713
3714    /**
3715     * @deprecated Use Reference#setResource(IBaseResource) instead
3716     */
3717    @Deprecated
3718    public List<Resource> getContributorTarget() { 
3719      if (this.contributorTarget == null)
3720        this.contributorTarget = new ArrayList<Resource>();
3721      return this.contributorTarget;
3722    }
3723
3724    /**
3725     * @return {@link #careTeam} (Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.)
3726     */
3727    public List<Reference> getCareTeam() { 
3728      if (this.careTeam == null)
3729        this.careTeam = new ArrayList<Reference>();
3730      return this.careTeam;
3731    }
3732
3733    /**
3734     * @return Returns a reference to <code>this</code> for easy method chaining
3735     */
3736    public CarePlan setCareTeam(List<Reference> theCareTeam) { 
3737      this.careTeam = theCareTeam;
3738      return this;
3739    }
3740
3741    public boolean hasCareTeam() { 
3742      if (this.careTeam == null)
3743        return false;
3744      for (Reference item : this.careTeam)
3745        if (!item.isEmpty())
3746          return true;
3747      return false;
3748    }
3749
3750    public Reference addCareTeam() { //3
3751      Reference t = new Reference();
3752      if (this.careTeam == null)
3753        this.careTeam = new ArrayList<Reference>();
3754      this.careTeam.add(t);
3755      return t;
3756    }
3757
3758    public CarePlan addCareTeam(Reference t) { //3
3759      if (t == null)
3760        return this;
3761      if (this.careTeam == null)
3762        this.careTeam = new ArrayList<Reference>();
3763      this.careTeam.add(t);
3764      return this;
3765    }
3766
3767    /**
3768     * @return The first repetition of repeating field {@link #careTeam}, creating it if it does not already exist
3769     */
3770    public Reference getCareTeamFirstRep() { 
3771      if (getCareTeam().isEmpty()) {
3772        addCareTeam();
3773      }
3774      return getCareTeam().get(0);
3775    }
3776
3777    /**
3778     * @deprecated Use Reference#setResource(IBaseResource) instead
3779     */
3780    @Deprecated
3781    public List<CareTeam> getCareTeamTarget() { 
3782      if (this.careTeamTarget == null)
3783        this.careTeamTarget = new ArrayList<CareTeam>();
3784      return this.careTeamTarget;
3785    }
3786
3787    /**
3788     * @deprecated Use Reference#setResource(IBaseResource) instead
3789     */
3790    @Deprecated
3791    public CareTeam addCareTeamTarget() { 
3792      CareTeam r = new CareTeam();
3793      if (this.careTeamTarget == null)
3794        this.careTeamTarget = new ArrayList<CareTeam>();
3795      this.careTeamTarget.add(r);
3796      return r;
3797    }
3798
3799    /**
3800     * @return {@link #addresses} (Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.)
3801     */
3802    public List<Reference> getAddresses() { 
3803      if (this.addresses == null)
3804        this.addresses = new ArrayList<Reference>();
3805      return this.addresses;
3806    }
3807
3808    /**
3809     * @return Returns a reference to <code>this</code> for easy method chaining
3810     */
3811    public CarePlan setAddresses(List<Reference> theAddresses) { 
3812      this.addresses = theAddresses;
3813      return this;
3814    }
3815
3816    public boolean hasAddresses() { 
3817      if (this.addresses == null)
3818        return false;
3819      for (Reference item : this.addresses)
3820        if (!item.isEmpty())
3821          return true;
3822      return false;
3823    }
3824
3825    public Reference addAddresses() { //3
3826      Reference t = new Reference();
3827      if (this.addresses == null)
3828        this.addresses = new ArrayList<Reference>();
3829      this.addresses.add(t);
3830      return t;
3831    }
3832
3833    public CarePlan addAddresses(Reference t) { //3
3834      if (t == null)
3835        return this;
3836      if (this.addresses == null)
3837        this.addresses = new ArrayList<Reference>();
3838      this.addresses.add(t);
3839      return this;
3840    }
3841
3842    /**
3843     * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist
3844     */
3845    public Reference getAddressesFirstRep() { 
3846      if (getAddresses().isEmpty()) {
3847        addAddresses();
3848      }
3849      return getAddresses().get(0);
3850    }
3851
3852    /**
3853     * @deprecated Use Reference#setResource(IBaseResource) instead
3854     */
3855    @Deprecated
3856    public List<Condition> getAddressesTarget() { 
3857      if (this.addressesTarget == null)
3858        this.addressesTarget = new ArrayList<Condition>();
3859      return this.addressesTarget;
3860    }
3861
3862    /**
3863     * @deprecated Use Reference#setResource(IBaseResource) instead
3864     */
3865    @Deprecated
3866    public Condition addAddressesTarget() { 
3867      Condition r = new Condition();
3868      if (this.addressesTarget == null)
3869        this.addressesTarget = new ArrayList<Condition>();
3870      this.addressesTarget.add(r);
3871      return r;
3872    }
3873
3874    /**
3875     * @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.)
3876     */
3877    public List<Reference> getSupportingInfo() { 
3878      if (this.supportingInfo == null)
3879        this.supportingInfo = new ArrayList<Reference>();
3880      return this.supportingInfo;
3881    }
3882
3883    /**
3884     * @return Returns a reference to <code>this</code> for easy method chaining
3885     */
3886    public CarePlan setSupportingInfo(List<Reference> theSupportingInfo) { 
3887      this.supportingInfo = theSupportingInfo;
3888      return this;
3889    }
3890
3891    public boolean hasSupportingInfo() { 
3892      if (this.supportingInfo == null)
3893        return false;
3894      for (Reference item : this.supportingInfo)
3895        if (!item.isEmpty())
3896          return true;
3897      return false;
3898    }
3899
3900    public Reference addSupportingInfo() { //3
3901      Reference t = new Reference();
3902      if (this.supportingInfo == null)
3903        this.supportingInfo = new ArrayList<Reference>();
3904      this.supportingInfo.add(t);
3905      return t;
3906    }
3907
3908    public CarePlan addSupportingInfo(Reference t) { //3
3909      if (t == null)
3910        return this;
3911      if (this.supportingInfo == null)
3912        this.supportingInfo = new ArrayList<Reference>();
3913      this.supportingInfo.add(t);
3914      return this;
3915    }
3916
3917    /**
3918     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist
3919     */
3920    public Reference getSupportingInfoFirstRep() { 
3921      if (getSupportingInfo().isEmpty()) {
3922        addSupportingInfo();
3923      }
3924      return getSupportingInfo().get(0);
3925    }
3926
3927    /**
3928     * @deprecated Use Reference#setResource(IBaseResource) instead
3929     */
3930    @Deprecated
3931    public List<Resource> getSupportingInfoTarget() { 
3932      if (this.supportingInfoTarget == null)
3933        this.supportingInfoTarget = new ArrayList<Resource>();
3934      return this.supportingInfoTarget;
3935    }
3936
3937    /**
3938     * @return {@link #goal} (Describes the intended objective(s) of carrying out the care plan.)
3939     */
3940    public List<Reference> getGoal() { 
3941      if (this.goal == null)
3942        this.goal = new ArrayList<Reference>();
3943      return this.goal;
3944    }
3945
3946    /**
3947     * @return Returns a reference to <code>this</code> for easy method chaining
3948     */
3949    public CarePlan setGoal(List<Reference> theGoal) { 
3950      this.goal = theGoal;
3951      return this;
3952    }
3953
3954    public boolean hasGoal() { 
3955      if (this.goal == null)
3956        return false;
3957      for (Reference item : this.goal)
3958        if (!item.isEmpty())
3959          return true;
3960      return false;
3961    }
3962
3963    public Reference addGoal() { //3
3964      Reference t = new Reference();
3965      if (this.goal == null)
3966        this.goal = new ArrayList<Reference>();
3967      this.goal.add(t);
3968      return t;
3969    }
3970
3971    public CarePlan addGoal(Reference t) { //3
3972      if (t == null)
3973        return this;
3974      if (this.goal == null)
3975        this.goal = new ArrayList<Reference>();
3976      this.goal.add(t);
3977      return this;
3978    }
3979
3980    /**
3981     * @return The first repetition of repeating field {@link #goal}, creating it if it does not already exist
3982     */
3983    public Reference getGoalFirstRep() { 
3984      if (getGoal().isEmpty()) {
3985        addGoal();
3986      }
3987      return getGoal().get(0);
3988    }
3989
3990    /**
3991     * @deprecated Use Reference#setResource(IBaseResource) instead
3992     */
3993    @Deprecated
3994    public List<Goal> getGoalTarget() { 
3995      if (this.goalTarget == null)
3996        this.goalTarget = new ArrayList<Goal>();
3997      return this.goalTarget;
3998    }
3999
4000    /**
4001     * @deprecated Use Reference#setResource(IBaseResource) instead
4002     */
4003    @Deprecated
4004    public Goal addGoalTarget() { 
4005      Goal r = new Goal();
4006      if (this.goalTarget == null)
4007        this.goalTarget = new ArrayList<Goal>();
4008      this.goalTarget.add(r);
4009      return r;
4010    }
4011
4012    /**
4013     * @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.)
4014     */
4015    public List<CarePlanActivityComponent> getActivity() { 
4016      if (this.activity == null)
4017        this.activity = new ArrayList<CarePlanActivityComponent>();
4018      return this.activity;
4019    }
4020
4021    /**
4022     * @return Returns a reference to <code>this</code> for easy method chaining
4023     */
4024    public CarePlan setActivity(List<CarePlanActivityComponent> theActivity) { 
4025      this.activity = theActivity;
4026      return this;
4027    }
4028
4029    public boolean hasActivity() { 
4030      if (this.activity == null)
4031        return false;
4032      for (CarePlanActivityComponent item : this.activity)
4033        if (!item.isEmpty())
4034          return true;
4035      return false;
4036    }
4037
4038    public CarePlanActivityComponent addActivity() { //3
4039      CarePlanActivityComponent t = new CarePlanActivityComponent();
4040      if (this.activity == null)
4041        this.activity = new ArrayList<CarePlanActivityComponent>();
4042      this.activity.add(t);
4043      return t;
4044    }
4045
4046    public CarePlan addActivity(CarePlanActivityComponent t) { //3
4047      if (t == null)
4048        return this;
4049      if (this.activity == null)
4050        this.activity = new ArrayList<CarePlanActivityComponent>();
4051      this.activity.add(t);
4052      return this;
4053    }
4054
4055    /**
4056     * @return The first repetition of repeating field {@link #activity}, creating it if it does not already exist
4057     */
4058    public CarePlanActivityComponent getActivityFirstRep() { 
4059      if (getActivity().isEmpty()) {
4060        addActivity();
4061      }
4062      return getActivity().get(0);
4063    }
4064
4065    /**
4066     * @return {@link #note} (General notes about the care plan not covered elsewhere.)
4067     */
4068    public List<Annotation> getNote() { 
4069      if (this.note == null)
4070        this.note = new ArrayList<Annotation>();
4071      return this.note;
4072    }
4073
4074    /**
4075     * @return Returns a reference to <code>this</code> for easy method chaining
4076     */
4077    public CarePlan setNote(List<Annotation> theNote) { 
4078      this.note = theNote;
4079      return this;
4080    }
4081
4082    public boolean hasNote() { 
4083      if (this.note == null)
4084        return false;
4085      for (Annotation item : this.note)
4086        if (!item.isEmpty())
4087          return true;
4088      return false;
4089    }
4090
4091    public Annotation addNote() { //3
4092      Annotation t = new Annotation();
4093      if (this.note == null)
4094        this.note = new ArrayList<Annotation>();
4095      this.note.add(t);
4096      return t;
4097    }
4098
4099    public CarePlan addNote(Annotation t) { //3
4100      if (t == null)
4101        return this;
4102      if (this.note == null)
4103        this.note = new ArrayList<Annotation>();
4104      this.note.add(t);
4105      return this;
4106    }
4107
4108    /**
4109     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
4110     */
4111    public Annotation getNoteFirstRep() { 
4112      if (getNote().isEmpty()) {
4113        addNote();
4114      }
4115      return getNote().get(0);
4116    }
4117
4118      protected void listChildren(List<Property> children) {
4119        super.listChildren(children);
4120        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));
4121        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));
4122        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));
4123        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));
4124        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));
4125        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));
4126        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));
4127        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));
4128        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));
4129        children.add(new Property("title", "string", "Human-friendly name for the care plan.", 0, 1, title));
4130        children.add(new Property("description", "string", "A description of the scope and nature of the plan.", 0, 1, description));
4131        children.add(new Property("subject", "Reference(Patient|Group)", "Identifies the patient or group whose intended care is described by the plan.", 0, 1, subject));
4132        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "Identifies the original context in which this particular care plan was created.", 0, 1, context));
4133        children.add(new Property("period", "Period", "Indicates when the plan did (or is intended to) come into effect and end.", 0, 1, period));
4134        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));
4135        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));
4136        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));
4137        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));
4138        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));
4139        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));
4140        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));
4141        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));
4142        children.add(new Property("note", "Annotation", "General notes about the care plan not covered elsewhere.", 0, java.lang.Integer.MAX_VALUE, note));
4143      }
4144
4145      @Override
4146      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4147        switch (_hash) {
4148        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);
4149        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);
4150        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);
4151        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);
4152        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);
4153        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);
4154        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);
4155        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);
4156        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);
4157        case 110371416: /*title*/  return new Property("title", "string", "Human-friendly name for the care plan.", 0, 1, title);
4158        case -1724546052: /*description*/  return new Property("description", "string", "A description of the scope and nature of the plan.", 0, 1, description);
4159        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);
4160        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "Identifies the original context in which this particular care plan was created.", 0, 1, context);
4161        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);
4162        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);
4163        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);
4164        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);
4165        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);
4166        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);
4167        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);
4168        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);
4169        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);
4170        case 3387378: /*note*/  return new Property("note", "Annotation", "General notes about the care plan not covered elsewhere.", 0, java.lang.Integer.MAX_VALUE, note);
4171        default: return super.getNamedProperty(_hash, _name, _checkValid);
4172        }
4173
4174      }
4175
4176      @Override
4177      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4178        switch (hash) {
4179        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4180        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
4181        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
4182        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
4183        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
4184        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
4185        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CarePlanStatus>
4186        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<CarePlanIntent>
4187        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
4188        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4189        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
4190        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
4191        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
4192        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
4193        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
4194        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
4195        case -1895276325: /*contributor*/ return this.contributor == null ? new Base[0] : this.contributor.toArray(new Base[this.contributor.size()]); // Reference
4196        case -7323378: /*careTeam*/ return this.careTeam == null ? new Base[0] : this.careTeam.toArray(new Base[this.careTeam.size()]); // Reference
4197        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // Reference
4198        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // Reference
4199        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // Reference
4200        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : this.activity.toArray(new Base[this.activity.size()]); // CarePlanActivityComponent
4201        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4202        default: return super.getProperty(hash, name, checkValid);
4203        }
4204
4205      }
4206
4207      @Override
4208      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4209        switch (hash) {
4210        case -1618432855: // identifier
4211          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4212          return value;
4213        case 8911915: // instantiatesCanonical
4214          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
4215          return value;
4216        case -1926393373: // instantiatesUri
4217          this.getInstantiatesUri().add(castToUri(value)); // UriType
4218          return value;
4219        case -332612366: // basedOn
4220          this.getBasedOn().add(castToReference(value)); // Reference
4221          return value;
4222        case -430332865: // replaces
4223          this.getReplaces().add(castToReference(value)); // Reference
4224          return value;
4225        case -995410646: // partOf
4226          this.getPartOf().add(castToReference(value)); // Reference
4227          return value;
4228        case -892481550: // status
4229          value = new CarePlanStatusEnumFactory().fromType(castToCode(value));
4230          this.status = (Enumeration) value; // Enumeration<CarePlanStatus>
4231          return value;
4232        case -1183762788: // intent
4233          value = new CarePlanIntentEnumFactory().fromType(castToCode(value));
4234          this.intent = (Enumeration) value; // Enumeration<CarePlanIntent>
4235          return value;
4236        case 50511102: // category
4237          this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
4238          return value;
4239        case 110371416: // title
4240          this.title = castToString(value); // StringType
4241          return value;
4242        case -1724546052: // description
4243          this.description = castToString(value); // StringType
4244          return value;
4245        case -1867885268: // subject
4246          this.subject = castToReference(value); // Reference
4247          return value;
4248        case 951530927: // context
4249          this.context = castToReference(value); // Reference
4250          return value;
4251        case -991726143: // period
4252          this.period = castToPeriod(value); // Period
4253          return value;
4254        case 1028554472: // created
4255          this.created = castToDateTime(value); // DateTimeType
4256          return value;
4257        case -1406328437: // author
4258          this.author = castToReference(value); // Reference
4259          return value;
4260        case -1895276325: // contributor
4261          this.getContributor().add(castToReference(value)); // Reference
4262          return value;
4263        case -7323378: // careTeam
4264          this.getCareTeam().add(castToReference(value)); // Reference
4265          return value;
4266        case 874544034: // addresses
4267          this.getAddresses().add(castToReference(value)); // Reference
4268          return value;
4269        case 1922406657: // supportingInfo
4270          this.getSupportingInfo().add(castToReference(value)); // Reference
4271          return value;
4272        case 3178259: // goal
4273          this.getGoal().add(castToReference(value)); // Reference
4274          return value;
4275        case -1655966961: // activity
4276          this.getActivity().add((CarePlanActivityComponent) value); // CarePlanActivityComponent
4277          return value;
4278        case 3387378: // note
4279          this.getNote().add(castToAnnotation(value)); // Annotation
4280          return value;
4281        default: return super.setProperty(hash, name, value);
4282        }
4283
4284      }
4285
4286      @Override
4287      public Base setProperty(String name, Base value) throws FHIRException {
4288        if (name.equals("identifier")) {
4289          this.getIdentifier().add(castToIdentifier(value));
4290        } else if (name.equals("instantiatesCanonical")) {
4291          this.getInstantiatesCanonical().add(castToCanonical(value));
4292        } else if (name.equals("instantiatesUri")) {
4293          this.getInstantiatesUri().add(castToUri(value));
4294        } else if (name.equals("basedOn")) {
4295          this.getBasedOn().add(castToReference(value));
4296        } else if (name.equals("replaces")) {
4297          this.getReplaces().add(castToReference(value));
4298        } else if (name.equals("partOf")) {
4299          this.getPartOf().add(castToReference(value));
4300        } else if (name.equals("status")) {
4301          value = new CarePlanStatusEnumFactory().fromType(castToCode(value));
4302          this.status = (Enumeration) value; // Enumeration<CarePlanStatus>
4303        } else if (name.equals("intent")) {
4304          value = new CarePlanIntentEnumFactory().fromType(castToCode(value));
4305          this.intent = (Enumeration) value; // Enumeration<CarePlanIntent>
4306        } else if (name.equals("category")) {
4307          this.getCategory().add(castToCodeableConcept(value));
4308        } else if (name.equals("title")) {
4309          this.title = castToString(value); // StringType
4310        } else if (name.equals("description")) {
4311          this.description = castToString(value); // StringType
4312        } else if (name.equals("subject")) {
4313          this.subject = castToReference(value); // Reference
4314        } else if (name.equals("context")) {
4315          this.context = castToReference(value); // Reference
4316        } else if (name.equals("period")) {
4317          this.period = castToPeriod(value); // Period
4318        } else if (name.equals("created")) {
4319          this.created = castToDateTime(value); // DateTimeType
4320        } else if (name.equals("author")) {
4321          this.author = castToReference(value); // Reference
4322        } else if (name.equals("contributor")) {
4323          this.getContributor().add(castToReference(value));
4324        } else if (name.equals("careTeam")) {
4325          this.getCareTeam().add(castToReference(value));
4326        } else if (name.equals("addresses")) {
4327          this.getAddresses().add(castToReference(value));
4328        } else if (name.equals("supportingInfo")) {
4329          this.getSupportingInfo().add(castToReference(value));
4330        } else if (name.equals("goal")) {
4331          this.getGoal().add(castToReference(value));
4332        } else if (name.equals("activity")) {
4333          this.getActivity().add((CarePlanActivityComponent) value);
4334        } else if (name.equals("note")) {
4335          this.getNote().add(castToAnnotation(value));
4336        } else
4337          return super.setProperty(name, value);
4338        return value;
4339      }
4340
4341      @Override
4342      public Base makeProperty(int hash, String name) throws FHIRException {
4343        switch (hash) {
4344        case -1618432855:  return addIdentifier(); 
4345        case 8911915:  return addInstantiatesCanonicalElement();
4346        case -1926393373:  return addInstantiatesUriElement();
4347        case -332612366:  return addBasedOn(); 
4348        case -430332865:  return addReplaces(); 
4349        case -995410646:  return addPartOf(); 
4350        case -892481550:  return getStatusElement();
4351        case -1183762788:  return getIntentElement();
4352        case 50511102:  return addCategory(); 
4353        case 110371416:  return getTitleElement();
4354        case -1724546052:  return getDescriptionElement();
4355        case -1867885268:  return getSubject(); 
4356        case 951530927:  return getContext(); 
4357        case -991726143:  return getPeriod(); 
4358        case 1028554472:  return getCreatedElement();
4359        case -1406328437:  return getAuthor(); 
4360        case -1895276325:  return addContributor(); 
4361        case -7323378:  return addCareTeam(); 
4362        case 874544034:  return addAddresses(); 
4363        case 1922406657:  return addSupportingInfo(); 
4364        case 3178259:  return addGoal(); 
4365        case -1655966961:  return addActivity(); 
4366        case 3387378:  return addNote(); 
4367        default: return super.makeProperty(hash, name);
4368        }
4369
4370      }
4371
4372      @Override
4373      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4374        switch (hash) {
4375        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4376        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
4377        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
4378        case -332612366: /*basedOn*/ return new String[] {"Reference"};
4379        case -430332865: /*replaces*/ return new String[] {"Reference"};
4380        case -995410646: /*partOf*/ return new String[] {"Reference"};
4381        case -892481550: /*status*/ return new String[] {"code"};
4382        case -1183762788: /*intent*/ return new String[] {"code"};
4383        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4384        case 110371416: /*title*/ return new String[] {"string"};
4385        case -1724546052: /*description*/ return new String[] {"string"};
4386        case -1867885268: /*subject*/ return new String[] {"Reference"};
4387        case 951530927: /*context*/ return new String[] {"Reference"};
4388        case -991726143: /*period*/ return new String[] {"Period"};
4389        case 1028554472: /*created*/ return new String[] {"dateTime"};
4390        case -1406328437: /*author*/ return new String[] {"Reference"};
4391        case -1895276325: /*contributor*/ return new String[] {"Reference"};
4392        case -7323378: /*careTeam*/ return new String[] {"Reference"};
4393        case 874544034: /*addresses*/ return new String[] {"Reference"};
4394        case 1922406657: /*supportingInfo*/ return new String[] {"Reference"};
4395        case 3178259: /*goal*/ return new String[] {"Reference"};
4396        case -1655966961: /*activity*/ return new String[] {};
4397        case 3387378: /*note*/ return new String[] {"Annotation"};
4398        default: return super.getTypesForProperty(hash, name);
4399        }
4400
4401      }
4402
4403      @Override
4404      public Base addChild(String name) throws FHIRException {
4405        if (name.equals("identifier")) {
4406          return addIdentifier();
4407        }
4408        else if (name.equals("instantiatesCanonical")) {
4409          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesCanonical");
4410        }
4411        else if (name.equals("instantiatesUri")) {
4412          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.instantiatesUri");
4413        }
4414        else if (name.equals("basedOn")) {
4415          return addBasedOn();
4416        }
4417        else if (name.equals("replaces")) {
4418          return addReplaces();
4419        }
4420        else if (name.equals("partOf")) {
4421          return addPartOf();
4422        }
4423        else if (name.equals("status")) {
4424          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.status");
4425        }
4426        else if (name.equals("intent")) {
4427          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.intent");
4428        }
4429        else if (name.equals("category")) {
4430          return addCategory();
4431        }
4432        else if (name.equals("title")) {
4433          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.title");
4434        }
4435        else if (name.equals("description")) {
4436          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.description");
4437        }
4438        else if (name.equals("subject")) {
4439          this.subject = new Reference();
4440          return this.subject;
4441        }
4442        else if (name.equals("context")) {
4443          this.context = new Reference();
4444          return this.context;
4445        }
4446        else if (name.equals("period")) {
4447          this.period = new Period();
4448          return this.period;
4449        }
4450        else if (name.equals("created")) {
4451          throw new FHIRException("Cannot call addChild on a primitive type CarePlan.created");
4452        }
4453        else if (name.equals("author")) {
4454          this.author = new Reference();
4455          return this.author;
4456        }
4457        else if (name.equals("contributor")) {
4458          return addContributor();
4459        }
4460        else if (name.equals("careTeam")) {
4461          return addCareTeam();
4462        }
4463        else if (name.equals("addresses")) {
4464          return addAddresses();
4465        }
4466        else if (name.equals("supportingInfo")) {
4467          return addSupportingInfo();
4468        }
4469        else if (name.equals("goal")) {
4470          return addGoal();
4471        }
4472        else if (name.equals("activity")) {
4473          return addActivity();
4474        }
4475        else if (name.equals("note")) {
4476          return addNote();
4477        }
4478        else
4479          return super.addChild(name);
4480      }
4481
4482  public String fhirType() {
4483    return "CarePlan";
4484
4485  }
4486
4487      public CarePlan copy() {
4488        CarePlan dst = new CarePlan();
4489        copyValues(dst);
4490        if (identifier != null) {
4491          dst.identifier = new ArrayList<Identifier>();
4492          for (Identifier i : identifier)
4493            dst.identifier.add(i.copy());
4494        };
4495        if (instantiatesCanonical != null) {
4496          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4497          for (CanonicalType i : instantiatesCanonical)
4498            dst.instantiatesCanonical.add(i.copy());
4499        };
4500        if (instantiatesUri != null) {
4501          dst.instantiatesUri = new ArrayList<UriType>();
4502          for (UriType i : instantiatesUri)
4503            dst.instantiatesUri.add(i.copy());
4504        };
4505        if (basedOn != null) {
4506          dst.basedOn = new ArrayList<Reference>();
4507          for (Reference i : basedOn)
4508            dst.basedOn.add(i.copy());
4509        };
4510        if (replaces != null) {
4511          dst.replaces = new ArrayList<Reference>();
4512          for (Reference i : replaces)
4513            dst.replaces.add(i.copy());
4514        };
4515        if (partOf != null) {
4516          dst.partOf = new ArrayList<Reference>();
4517          for (Reference i : partOf)
4518            dst.partOf.add(i.copy());
4519        };
4520        dst.status = status == null ? null : status.copy();
4521        dst.intent = intent == null ? null : intent.copy();
4522        if (category != null) {
4523          dst.category = new ArrayList<CodeableConcept>();
4524          for (CodeableConcept i : category)
4525            dst.category.add(i.copy());
4526        };
4527        dst.title = title == null ? null : title.copy();
4528        dst.description = description == null ? null : description.copy();
4529        dst.subject = subject == null ? null : subject.copy();
4530        dst.context = context == null ? null : context.copy();
4531        dst.period = period == null ? null : period.copy();
4532        dst.created = created == null ? null : created.copy();
4533        dst.author = author == null ? null : author.copy();
4534        if (contributor != null) {
4535          dst.contributor = new ArrayList<Reference>();
4536          for (Reference i : contributor)
4537            dst.contributor.add(i.copy());
4538        };
4539        if (careTeam != null) {
4540          dst.careTeam = new ArrayList<Reference>();
4541          for (Reference i : careTeam)
4542            dst.careTeam.add(i.copy());
4543        };
4544        if (addresses != null) {
4545          dst.addresses = new ArrayList<Reference>();
4546          for (Reference i : addresses)
4547            dst.addresses.add(i.copy());
4548        };
4549        if (supportingInfo != null) {
4550          dst.supportingInfo = new ArrayList<Reference>();
4551          for (Reference i : supportingInfo)
4552            dst.supportingInfo.add(i.copy());
4553        };
4554        if (goal != null) {
4555          dst.goal = new ArrayList<Reference>();
4556          for (Reference i : goal)
4557            dst.goal.add(i.copy());
4558        };
4559        if (activity != null) {
4560          dst.activity = new ArrayList<CarePlanActivityComponent>();
4561          for (CarePlanActivityComponent i : activity)
4562            dst.activity.add(i.copy());
4563        };
4564        if (note != null) {
4565          dst.note = new ArrayList<Annotation>();
4566          for (Annotation i : note)
4567            dst.note.add(i.copy());
4568        };
4569        return dst;
4570      }
4571
4572      protected CarePlan typedCopy() {
4573        return copy();
4574      }
4575
4576      @Override
4577      public boolean equalsDeep(Base other_) {
4578        if (!super.equalsDeep(other_))
4579          return false;
4580        if (!(other_ instanceof CarePlan))
4581          return false;
4582        CarePlan o = (CarePlan) other_;
4583        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4584           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
4585           && compareDeep(replaces, o.replaces, true) && compareDeep(partOf, o.partOf, true) && compareDeep(status, o.status, true)
4586           && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(title, o.title, true)
4587           && compareDeep(description, o.description, true) && compareDeep(subject, o.subject, true) && compareDeep(context, o.context, true)
4588           && compareDeep(period, o.period, true) && compareDeep(created, o.created, true) && compareDeep(author, o.author, true)
4589           && compareDeep(contributor, o.contributor, true) && compareDeep(careTeam, o.careTeam, true) && compareDeep(addresses, o.addresses, true)
4590           && compareDeep(supportingInfo, o.supportingInfo, true) && compareDeep(goal, o.goal, true) && compareDeep(activity, o.activity, true)
4591           && compareDeep(note, o.note, true);
4592      }
4593
4594      @Override
4595      public boolean equalsShallow(Base other_) {
4596        if (!super.equalsShallow(other_))
4597          return false;
4598        if (!(other_ instanceof CarePlan))
4599          return false;
4600        CarePlan o = (CarePlan) other_;
4601        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
4602           && compareValues(intent, o.intent, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
4603           && compareValues(created, o.created, true);
4604      }
4605
4606      public boolean isEmpty() {
4607        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4608          , instantiatesUri, basedOn, replaces, partOf, status, intent, category, title
4609          , description, subject, context, period, created, author, contributor, careTeam
4610          , addresses, supportingInfo, goal, activity, note);
4611      }
4612
4613  @Override
4614  public ResourceType getResourceType() {
4615    return ResourceType.CarePlan;
4616   }
4617
4618 /**
4619   * Search parameter: <b>date</b>
4620   * <p>
4621   * Description: <b>Time period plan covers</b><br>
4622   * Type: <b>date</b><br>
4623   * Path: <b>CarePlan.period</b><br>
4624   * </p>
4625   */
4626  @SearchParamDefinition(name="date", path="CarePlan.period", description="Time period plan covers", type="date" )
4627  public static final String SP_DATE = "date";
4628 /**
4629   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4630   * <p>
4631   * Description: <b>Time period plan covers</b><br>
4632   * Type: <b>date</b><br>
4633   * Path: <b>CarePlan.period</b><br>
4634   * </p>
4635   */
4636  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4637
4638 /**
4639   * Search parameter: <b>care-team</b>
4640   * <p>
4641   * Description: <b>Who's involved in plan?</b><br>
4642   * Type: <b>reference</b><br>
4643   * Path: <b>CarePlan.careTeam</b><br>
4644   * </p>
4645   */
4646  @SearchParamDefinition(name="care-team", path="CarePlan.careTeam", description="Who's involved in plan?", type="reference", target={CareTeam.class } )
4647  public static final String SP_CARE_TEAM = "care-team";
4648 /**
4649   * <b>Fluent Client</b> search parameter constant for <b>care-team</b>
4650   * <p>
4651   * Description: <b>Who's involved in plan?</b><br>
4652   * Type: <b>reference</b><br>
4653   * Path: <b>CarePlan.careTeam</b><br>
4654   * </p>
4655   */
4656  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CARE_TEAM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CARE_TEAM);
4657
4658/**
4659   * Constant for fluent queries to be used to add include statements. Specifies
4660   * the path value of "<b>CarePlan:care-team</b>".
4661   */
4662  public static final ca.uhn.fhir.model.api.Include INCLUDE_CARE_TEAM = new ca.uhn.fhir.model.api.Include("CarePlan:care-team").toLocked();
4663
4664 /**
4665   * Search parameter: <b>identifier</b>
4666   * <p>
4667   * Description: <b>External Ids for this plan</b><br>
4668   * Type: <b>token</b><br>
4669   * Path: <b>CarePlan.identifier</b><br>
4670   * </p>
4671   */
4672  @SearchParamDefinition(name="identifier", path="CarePlan.identifier", description="External Ids for this plan", type="token" )
4673  public static final String SP_IDENTIFIER = "identifier";
4674 /**
4675   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4676   * <p>
4677   * Description: <b>External Ids for this plan</b><br>
4678   * Type: <b>token</b><br>
4679   * Path: <b>CarePlan.identifier</b><br>
4680   * </p>
4681   */
4682  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4683
4684 /**
4685   * Search parameter: <b>performer</b>
4686   * <p>
4687   * 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>
4688   * Type: <b>reference</b><br>
4689   * Path: <b>CarePlan.activity.detail.performer</b><br>
4690   * </p>
4691   */
4692  @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 } )
4693  public static final String SP_PERFORMER = "performer";
4694 /**
4695   * <b>Fluent Client</b> search parameter constant for <b>performer</b>
4696   * <p>
4697   * 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>
4698   * Type: <b>reference</b><br>
4699   * Path: <b>CarePlan.activity.detail.performer</b><br>
4700   * </p>
4701   */
4702  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PERFORMER);
4703
4704/**
4705   * Constant for fluent queries to be used to add include statements. Specifies
4706   * the path value of "<b>CarePlan:performer</b>".
4707   */
4708  public static final ca.uhn.fhir.model.api.Include INCLUDE_PERFORMER = new ca.uhn.fhir.model.api.Include("CarePlan:performer").toLocked();
4709
4710 /**
4711   * Search parameter: <b>goal</b>
4712   * <p>
4713   * Description: <b>Desired outcome of plan</b><br>
4714   * Type: <b>reference</b><br>
4715   * Path: <b>CarePlan.goal</b><br>
4716   * </p>
4717   */
4718  @SearchParamDefinition(name="goal", path="CarePlan.goal", description="Desired outcome of plan", type="reference", target={Goal.class } )
4719  public static final String SP_GOAL = "goal";
4720 /**
4721   * <b>Fluent Client</b> search parameter constant for <b>goal</b>
4722   * <p>
4723   * Description: <b>Desired outcome of plan</b><br>
4724   * Type: <b>reference</b><br>
4725   * Path: <b>CarePlan.goal</b><br>
4726   * </p>
4727   */
4728  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam GOAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_GOAL);
4729
4730/**
4731   * Constant for fluent queries to be used to add include statements. Specifies
4732   * the path value of "<b>CarePlan:goal</b>".
4733   */
4734  public static final ca.uhn.fhir.model.api.Include INCLUDE_GOAL = new ca.uhn.fhir.model.api.Include("CarePlan:goal").toLocked();
4735
4736 /**
4737   * Search parameter: <b>subject</b>
4738   * <p>
4739   * Description: <b>Who the care plan is for</b><br>
4740   * Type: <b>reference</b><br>
4741   * Path: <b>CarePlan.subject</b><br>
4742   * </p>
4743   */
4744  @SearchParamDefinition(name="subject", path="CarePlan.subject", description="Who the care plan is for", type="reference", target={Group.class, Patient.class } )
4745  public static final String SP_SUBJECT = "subject";
4746 /**
4747   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
4748   * <p>
4749   * Description: <b>Who the care plan is for</b><br>
4750   * Type: <b>reference</b><br>
4751   * Path: <b>CarePlan.subject</b><br>
4752   * </p>
4753   */
4754  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
4755
4756/**
4757   * Constant for fluent queries to be used to add include statements. Specifies
4758   * the path value of "<b>CarePlan:subject</b>".
4759   */
4760  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("CarePlan:subject").toLocked();
4761
4762 /**
4763   * Search parameter: <b>replaces</b>
4764   * <p>
4765   * Description: <b>CarePlan replaced by this CarePlan</b><br>
4766   * Type: <b>reference</b><br>
4767   * Path: <b>CarePlan.replaces</b><br>
4768   * </p>
4769   */
4770  @SearchParamDefinition(name="replaces", path="CarePlan.replaces", description="CarePlan replaced by this CarePlan", type="reference", target={CarePlan.class } )
4771  public static final String SP_REPLACES = "replaces";
4772 /**
4773   * <b>Fluent Client</b> search parameter constant for <b>replaces</b>
4774   * <p>
4775   * Description: <b>CarePlan replaced by this CarePlan</b><br>
4776   * Type: <b>reference</b><br>
4777   * Path: <b>CarePlan.replaces</b><br>
4778   * </p>
4779   */
4780  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPLACES = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REPLACES);
4781
4782/**
4783   * Constant for fluent queries to be used to add include statements. Specifies
4784   * the path value of "<b>CarePlan:replaces</b>".
4785   */
4786  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPLACES = new ca.uhn.fhir.model.api.Include("CarePlan:replaces").toLocked();
4787
4788 /**
4789   * Search parameter: <b>instantiates-canonical</b>
4790   * <p>
4791   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4792   * Type: <b>reference</b><br>
4793   * Path: <b>CarePlan.instantiatesCanonical</b><br>
4794   * </p>
4795   */
4796  @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 } )
4797  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
4798 /**
4799   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
4800   * <p>
4801   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4802   * Type: <b>reference</b><br>
4803   * Path: <b>CarePlan.instantiatesCanonical</b><br>
4804   * </p>
4805   */
4806  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
4807
4808/**
4809   * Constant for fluent queries to be used to add include statements. Specifies
4810   * the path value of "<b>CarePlan:instantiates-canonical</b>".
4811   */
4812  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("CarePlan:instantiates-canonical").toLocked();
4813
4814 /**
4815   * Search parameter: <b>part-of</b>
4816   * <p>
4817   * Description: <b>Part of referenced CarePlan</b><br>
4818   * Type: <b>reference</b><br>
4819   * Path: <b>CarePlan.partOf</b><br>
4820   * </p>
4821   */
4822  @SearchParamDefinition(name="part-of", path="CarePlan.partOf", description="Part of referenced CarePlan", type="reference", target={CarePlan.class } )
4823  public static final String SP_PART_OF = "part-of";
4824 /**
4825   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
4826   * <p>
4827   * Description: <b>Part of referenced CarePlan</b><br>
4828   * Type: <b>reference</b><br>
4829   * Path: <b>CarePlan.partOf</b><br>
4830   * </p>
4831   */
4832  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PART_OF);
4833
4834/**
4835   * Constant for fluent queries to be used to add include statements. Specifies
4836   * the path value of "<b>CarePlan:part-of</b>".
4837   */
4838  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include("CarePlan:part-of").toLocked();
4839
4840 /**
4841   * Search parameter: <b>encounter</b>
4842   * <p>
4843   * Description: <b>Created in context of</b><br>
4844   * Type: <b>reference</b><br>
4845   * Path: <b>CarePlan.context</b><br>
4846   * </p>
4847   */
4848  @SearchParamDefinition(name="encounter", path="CarePlan.context.where(resolve() is Encounter)", description="Created in context of", type="reference", target={Encounter.class } )
4849  public static final String SP_ENCOUNTER = "encounter";
4850 /**
4851   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4852   * <p>
4853   * Description: <b>Created in context of</b><br>
4854   * Type: <b>reference</b><br>
4855   * Path: <b>CarePlan.context</b><br>
4856   * </p>
4857   */
4858  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4859
4860/**
4861   * Constant for fluent queries to be used to add include statements. Specifies
4862   * the path value of "<b>CarePlan:encounter</b>".
4863   */
4864  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("CarePlan:encounter").toLocked();
4865
4866 /**
4867   * Search parameter: <b>intent</b>
4868   * <p>
4869   * Description: <b>proposal | plan | order | option</b><br>
4870   * Type: <b>token</b><br>
4871   * Path: <b>CarePlan.intent</b><br>
4872   * </p>
4873   */
4874  @SearchParamDefinition(name="intent", path="CarePlan.intent", description="proposal | plan | order | option", type="token" )
4875  public static final String SP_INTENT = "intent";
4876 /**
4877   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
4878   * <p>
4879   * Description: <b>proposal | plan | order | option</b><br>
4880   * Type: <b>token</b><br>
4881   * Path: <b>CarePlan.intent</b><br>
4882   * </p>
4883   */
4884  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
4885
4886 /**
4887   * Search parameter: <b>activity-reference</b>
4888   * <p>
4889   * Description: <b>Activity details defined in specific resource</b><br>
4890   * Type: <b>reference</b><br>
4891   * Path: <b>CarePlan.activity.reference</b><br>
4892   * </p>
4893   */
4894  @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 } )
4895  public static final String SP_ACTIVITY_REFERENCE = "activity-reference";
4896 /**
4897   * <b>Fluent Client</b> search parameter constant for <b>activity-reference</b>
4898   * <p>
4899   * Description: <b>Activity details defined in specific resource</b><br>
4900   * Type: <b>reference</b><br>
4901   * Path: <b>CarePlan.activity.reference</b><br>
4902   * </p>
4903   */
4904  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTIVITY_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTIVITY_REFERENCE);
4905
4906/**
4907   * Constant for fluent queries to be used to add include statements. Specifies
4908   * the path value of "<b>CarePlan:activity-reference</b>".
4909   */
4910  public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTIVITY_REFERENCE = new ca.uhn.fhir.model.api.Include("CarePlan:activity-reference").toLocked();
4911
4912 /**
4913   * Search parameter: <b>condition</b>
4914   * <p>
4915   * Description: <b>Health issues this plan addresses</b><br>
4916   * Type: <b>reference</b><br>
4917   * Path: <b>CarePlan.addresses</b><br>
4918   * </p>
4919   */
4920  @SearchParamDefinition(name="condition", path="CarePlan.addresses", description="Health issues this plan addresses", type="reference", target={Condition.class } )
4921  public static final String SP_CONDITION = "condition";
4922 /**
4923   * <b>Fluent Client</b> search parameter constant for <b>condition</b>
4924   * <p>
4925   * Description: <b>Health issues this plan addresses</b><br>
4926   * Type: <b>reference</b><br>
4927   * Path: <b>CarePlan.addresses</b><br>
4928   * </p>
4929   */
4930  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONDITION);
4931
4932/**
4933   * Constant for fluent queries to be used to add include statements. Specifies
4934   * the path value of "<b>CarePlan:condition</b>".
4935   */
4936  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONDITION = new ca.uhn.fhir.model.api.Include("CarePlan:condition").toLocked();
4937
4938 /**
4939   * Search parameter: <b>based-on</b>
4940   * <p>
4941   * Description: <b>Fulfills CarePlan</b><br>
4942   * Type: <b>reference</b><br>
4943   * Path: <b>CarePlan.basedOn</b><br>
4944   * </p>
4945   */
4946  @SearchParamDefinition(name="based-on", path="CarePlan.basedOn", description="Fulfills CarePlan", type="reference", target={CarePlan.class } )
4947  public static final String SP_BASED_ON = "based-on";
4948 /**
4949   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
4950   * <p>
4951   * Description: <b>Fulfills CarePlan</b><br>
4952   * Type: <b>reference</b><br>
4953   * Path: <b>CarePlan.basedOn</b><br>
4954   * </p>
4955   */
4956  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
4957
4958/**
4959   * Constant for fluent queries to be used to add include statements. Specifies
4960   * the path value of "<b>CarePlan:based-on</b>".
4961   */
4962  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("CarePlan:based-on").toLocked();
4963
4964 /**
4965   * Search parameter: <b>patient</b>
4966   * <p>
4967   * Description: <b>Who the care plan is for</b><br>
4968   * Type: <b>reference</b><br>
4969   * Path: <b>CarePlan.subject</b><br>
4970   * </p>
4971   */
4972  @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 } )
4973  public static final String SP_PATIENT = "patient";
4974 /**
4975   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4976   * <p>
4977   * Description: <b>Who the care plan is for</b><br>
4978   * Type: <b>reference</b><br>
4979   * Path: <b>CarePlan.subject</b><br>
4980   * </p>
4981   */
4982  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4983
4984/**
4985   * Constant for fluent queries to be used to add include statements. Specifies
4986   * the path value of "<b>CarePlan:patient</b>".
4987   */
4988  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("CarePlan:patient").toLocked();
4989
4990 /**
4991   * Search parameter: <b>context</b>
4992   * <p>
4993   * Description: <b>Created in context of</b><br>
4994   * Type: <b>reference</b><br>
4995   * Path: <b>CarePlan.context</b><br>
4996   * </p>
4997   */
4998  @SearchParamDefinition(name="context", path="CarePlan.context", description="Created in context of", type="reference", target={Encounter.class, EpisodeOfCare.class } )
4999  public static final String SP_CONTEXT = "context";
5000 /**
5001   * <b>Fluent Client</b> search parameter constant for <b>context</b>
5002   * <p>
5003   * Description: <b>Created in context of</b><br>
5004   * Type: <b>reference</b><br>
5005   * Path: <b>CarePlan.context</b><br>
5006   * </p>
5007   */
5008  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
5009
5010/**
5011   * Constant for fluent queries to be used to add include statements. Specifies
5012   * the path value of "<b>CarePlan:context</b>".
5013   */
5014  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("CarePlan:context").toLocked();
5015
5016 /**
5017   * Search parameter: <b>activity-date</b>
5018   * <p>
5019   * Description: <b>Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]</b><br>
5020   * Type: <b>date</b><br>
5021   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
5022   * </p>
5023   */
5024  @SearchParamDefinition(name="activity-date", path="CarePlan.activity.detail.scheduled", description="Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]", type="date" )
5025  public static final String SP_ACTIVITY_DATE = "activity-date";
5026 /**
5027   * <b>Fluent Client</b> search parameter constant for <b>activity-date</b>
5028   * <p>
5029   * Description: <b>Specified date occurs within period specified by CarePlan.activity.detail.scheduled[x]</b><br>
5030   * Type: <b>date</b><br>
5031   * Path: <b>CarePlan.activity.detail.scheduled[x]</b><br>
5032   * </p>
5033   */
5034  public static final ca.uhn.fhir.rest.gclient.DateClientParam ACTIVITY_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_ACTIVITY_DATE);
5035
5036 /**
5037   * Search parameter: <b>instantiates-uri</b>
5038   * <p>
5039   * Description: <b>Instantiates external protocol or definition</b><br>
5040   * Type: <b>uri</b><br>
5041   * Path: <b>CarePlan.instantiatesUri</b><br>
5042   * </p>
5043   */
5044  @SearchParamDefinition(name="instantiates-uri", path="CarePlan.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
5045  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
5046 /**
5047   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
5048   * <p>
5049   * Description: <b>Instantiates external protocol or definition</b><br>
5050   * Type: <b>uri</b><br>
5051   * Path: <b>CarePlan.instantiatesUri</b><br>
5052   * </p>
5053   */
5054  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
5055
5056 /**
5057   * Search parameter: <b>category</b>
5058   * <p>
5059   * Description: <b>Type of plan</b><br>
5060   * Type: <b>token</b><br>
5061   * Path: <b>CarePlan.category</b><br>
5062   * </p>
5063   */
5064  @SearchParamDefinition(name="category", path="CarePlan.category", description="Type of plan", type="token" )
5065  public static final String SP_CATEGORY = "category";
5066 /**
5067   * <b>Fluent Client</b> search parameter constant for <b>category</b>
5068   * <p>
5069   * Description: <b>Type of plan</b><br>
5070   * Type: <b>token</b><br>
5071   * Path: <b>CarePlan.category</b><br>
5072   * </p>
5073   */
5074  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
5075
5076 /**
5077   * Search parameter: <b>activity-code</b>
5078   * <p>
5079   * Description: <b>Detail type of activity</b><br>
5080   * Type: <b>token</b><br>
5081   * Path: <b>CarePlan.activity.detail.code</b><br>
5082   * </p>
5083   */
5084  @SearchParamDefinition(name="activity-code", path="CarePlan.activity.detail.code", description="Detail type of activity", type="token" )
5085  public static final String SP_ACTIVITY_CODE = "activity-code";
5086 /**
5087   * <b>Fluent Client</b> search parameter constant for <b>activity-code</b>
5088   * <p>
5089   * Description: <b>Detail type of activity</b><br>
5090   * Type: <b>token</b><br>
5091   * Path: <b>CarePlan.activity.detail.code</b><br>
5092   * </p>
5093   */
5094  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVITY_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVITY_CODE);
5095
5096 /**
5097   * Search parameter: <b>status</b>
5098   * <p>
5099   * Description: <b>draft | active | suspended | completed | entered-in-error | cancelled | unknown</b><br>
5100   * Type: <b>token</b><br>
5101   * Path: <b>CarePlan.status</b><br>
5102   * </p>
5103   */
5104  @SearchParamDefinition(name="status", path="CarePlan.status", description="draft | active | suspended | completed | entered-in-error | cancelled | unknown", type="token" )
5105  public static final String SP_STATUS = "status";
5106 /**
5107   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5108   * <p>
5109   * Description: <b>draft | active | suspended | completed | entered-in-error | cancelled | unknown</b><br>
5110   * Type: <b>token</b><br>
5111   * Path: <b>CarePlan.status</b><br>
5112   * </p>
5113   */
5114  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5115
5116
5117}
5118