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