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