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