001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.r4.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.
048 */
049@ResourceDef(name="PlanDefinition", profile="http://hl7.org/fhir/StructureDefinition/PlanDefinition")
050@ChildOrder(names={"url", "identifier", "version", "name", "title", "subtitle", "type", "status", "experimental", "subject[x]", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "usage", "copyright", "approvalDate", "lastReviewDate", "effectivePeriod", "topic", "author", "editor", "reviewer", "endorser", "relatedArtifact", "library", "goal", "action"})
051public class PlanDefinition extends MetadataResource {
052
053    public enum RequestPriority {
054        /**
055         * The request has normal priority.
056         */
057        ROUTINE, 
058        /**
059         * The request should be actioned promptly - higher priority than routine.
060         */
061        URGENT, 
062        /**
063         * The request should be actioned as soon as possible - higher priority than urgent.
064         */
065        ASAP, 
066        /**
067         * The request should be actioned immediately - highest possible priority.  E.g. an emergency.
068         */
069        STAT, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static RequestPriority fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("routine".equals(codeString))
078          return ROUTINE;
079        if ("urgent".equals(codeString))
080          return URGENT;
081        if ("asap".equals(codeString))
082          return ASAP;
083        if ("stat".equals(codeString))
084          return STAT;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ROUTINE: return "routine";
093            case URGENT: return "urgent";
094            case ASAP: return "asap";
095            case STAT: return "stat";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ROUTINE: return "http://hl7.org/fhir/request-priority";
102            case URGENT: return "http://hl7.org/fhir/request-priority";
103            case ASAP: return "http://hl7.org/fhir/request-priority";
104            case STAT: return "http://hl7.org/fhir/request-priority";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ROUTINE: return "The request has normal priority.";
111            case URGENT: return "The request should be actioned promptly - higher priority than routine.";
112            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent.";
113            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ROUTINE: return "Routine";
120            case URGENT: return "Urgent";
121            case ASAP: return "ASAP";
122            case STAT: return "STAT";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class RequestPriorityEnumFactory implements EnumFactory<RequestPriority> {
129    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("routine".equals(codeString))
134          return RequestPriority.ROUTINE;
135        if ("urgent".equals(codeString))
136          return RequestPriority.URGENT;
137        if ("asap".equals(codeString))
138          return RequestPriority.ASAP;
139        if ("stat".equals(codeString))
140          return RequestPriority.STAT;
141        throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
142        }
143        public Enumeration<RequestPriority> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<RequestPriority>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("routine".equals(codeString))
152          return new Enumeration<RequestPriority>(this, RequestPriority.ROUTINE);
153        if ("urgent".equals(codeString))
154          return new Enumeration<RequestPriority>(this, RequestPriority.URGENT);
155        if ("asap".equals(codeString))
156          return new Enumeration<RequestPriority>(this, RequestPriority.ASAP);
157        if ("stat".equals(codeString))
158          return new Enumeration<RequestPriority>(this, RequestPriority.STAT);
159        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
160        }
161    public String toCode(RequestPriority code) {
162      if (code == RequestPriority.ROUTINE)
163        return "routine";
164      if (code == RequestPriority.URGENT)
165        return "urgent";
166      if (code == RequestPriority.ASAP)
167        return "asap";
168      if (code == RequestPriority.STAT)
169        return "stat";
170      return "?";
171      }
172    public String toSystem(RequestPriority code) {
173      return code.getSystem();
174      }
175    }
176
177    public enum ActionConditionKind {
178        /**
179         * The condition describes whether or not a given action is applicable.
180         */
181        APPLICABILITY, 
182        /**
183         * The condition is a starting condition for the action.
184         */
185        START, 
186        /**
187         * The condition is a stop, or exit condition for the action.
188         */
189        STOP, 
190        /**
191         * added to help the parsers with the generic types
192         */
193        NULL;
194        public static ActionConditionKind fromCode(String codeString) throws FHIRException {
195            if (codeString == null || "".equals(codeString))
196                return null;
197        if ("applicability".equals(codeString))
198          return APPLICABILITY;
199        if ("start".equals(codeString))
200          return START;
201        if ("stop".equals(codeString))
202          return STOP;
203        if (Configuration.isAcceptInvalidEnums())
204          return null;
205        else
206          throw new FHIRException("Unknown ActionConditionKind code '"+codeString+"'");
207        }
208        public String toCode() {
209          switch (this) {
210            case APPLICABILITY: return "applicability";
211            case START: return "start";
212            case STOP: return "stop";
213            default: return "?";
214          }
215        }
216        public String getSystem() {
217          switch (this) {
218            case APPLICABILITY: return "http://hl7.org/fhir/action-condition-kind";
219            case START: return "http://hl7.org/fhir/action-condition-kind";
220            case STOP: return "http://hl7.org/fhir/action-condition-kind";
221            default: return "?";
222          }
223        }
224        public String getDefinition() {
225          switch (this) {
226            case APPLICABILITY: return "The condition describes whether or not a given action is applicable.";
227            case START: return "The condition is a starting condition for the action.";
228            case STOP: return "The condition is a stop, or exit condition for the action.";
229            default: return "?";
230          }
231        }
232        public String getDisplay() {
233          switch (this) {
234            case APPLICABILITY: return "Applicability";
235            case START: return "Start";
236            case STOP: return "Stop";
237            default: return "?";
238          }
239        }
240    }
241
242  public static class ActionConditionKindEnumFactory implements EnumFactory<ActionConditionKind> {
243    public ActionConditionKind fromCode(String codeString) throws IllegalArgumentException {
244      if (codeString == null || "".equals(codeString))
245            if (codeString == null || "".equals(codeString))
246                return null;
247        if ("applicability".equals(codeString))
248          return ActionConditionKind.APPLICABILITY;
249        if ("start".equals(codeString))
250          return ActionConditionKind.START;
251        if ("stop".equals(codeString))
252          return ActionConditionKind.STOP;
253        throw new IllegalArgumentException("Unknown ActionConditionKind code '"+codeString+"'");
254        }
255        public Enumeration<ActionConditionKind> fromType(Base code) throws FHIRException {
256          if (code == null)
257            return null;
258          if (code.isEmpty())
259            return new Enumeration<ActionConditionKind>(this);
260          String codeString = ((PrimitiveType) code).asStringValue();
261          if (codeString == null || "".equals(codeString))
262            return null;
263        if ("applicability".equals(codeString))
264          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.APPLICABILITY);
265        if ("start".equals(codeString))
266          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.START);
267        if ("stop".equals(codeString))
268          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.STOP);
269        throw new FHIRException("Unknown ActionConditionKind code '"+codeString+"'");
270        }
271    public String toCode(ActionConditionKind code) {
272      if (code == ActionConditionKind.APPLICABILITY)
273        return "applicability";
274      if (code == ActionConditionKind.START)
275        return "start";
276      if (code == ActionConditionKind.STOP)
277        return "stop";
278      return "?";
279      }
280    public String toSystem(ActionConditionKind code) {
281      return code.getSystem();
282      }
283    }
284
285    public enum ActionRelationshipType {
286        /**
287         * The action must be performed before the start of the related action.
288         */
289        BEFORESTART, 
290        /**
291         * The action must be performed before the related action.
292         */
293        BEFORE, 
294        /**
295         * The action must be performed before the end of the related action.
296         */
297        BEFOREEND, 
298        /**
299         * The action must be performed concurrent with the start of the related action.
300         */
301        CONCURRENTWITHSTART, 
302        /**
303         * The action must be performed concurrent with the related action.
304         */
305        CONCURRENT, 
306        /**
307         * The action must be performed concurrent with the end of the related action.
308         */
309        CONCURRENTWITHEND, 
310        /**
311         * The action must be performed after the start of the related action.
312         */
313        AFTERSTART, 
314        /**
315         * The action must be performed after the related action.
316         */
317        AFTER, 
318        /**
319         * The action must be performed after the end of the related action.
320         */
321        AFTEREND, 
322        /**
323         * added to help the parsers with the generic types
324         */
325        NULL;
326        public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
327            if (codeString == null || "".equals(codeString))
328                return null;
329        if ("before-start".equals(codeString))
330          return BEFORESTART;
331        if ("before".equals(codeString))
332          return BEFORE;
333        if ("before-end".equals(codeString))
334          return BEFOREEND;
335        if ("concurrent-with-start".equals(codeString))
336          return CONCURRENTWITHSTART;
337        if ("concurrent".equals(codeString))
338          return CONCURRENT;
339        if ("concurrent-with-end".equals(codeString))
340          return CONCURRENTWITHEND;
341        if ("after-start".equals(codeString))
342          return AFTERSTART;
343        if ("after".equals(codeString))
344          return AFTER;
345        if ("after-end".equals(codeString))
346          return AFTEREND;
347        if (Configuration.isAcceptInvalidEnums())
348          return null;
349        else
350          throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
351        }
352        public String toCode() {
353          switch (this) {
354            case BEFORESTART: return "before-start";
355            case BEFORE: return "before";
356            case BEFOREEND: return "before-end";
357            case CONCURRENTWITHSTART: return "concurrent-with-start";
358            case CONCURRENT: return "concurrent";
359            case CONCURRENTWITHEND: return "concurrent-with-end";
360            case AFTERSTART: return "after-start";
361            case AFTER: return "after";
362            case AFTEREND: return "after-end";
363            default: return "?";
364          }
365        }
366        public String getSystem() {
367          switch (this) {
368            case BEFORESTART: return "http://hl7.org/fhir/action-relationship-type";
369            case BEFORE: return "http://hl7.org/fhir/action-relationship-type";
370            case BEFOREEND: return "http://hl7.org/fhir/action-relationship-type";
371            case CONCURRENTWITHSTART: return "http://hl7.org/fhir/action-relationship-type";
372            case CONCURRENT: return "http://hl7.org/fhir/action-relationship-type";
373            case CONCURRENTWITHEND: return "http://hl7.org/fhir/action-relationship-type";
374            case AFTERSTART: return "http://hl7.org/fhir/action-relationship-type";
375            case AFTER: return "http://hl7.org/fhir/action-relationship-type";
376            case AFTEREND: return "http://hl7.org/fhir/action-relationship-type";
377            default: return "?";
378          }
379        }
380        public String getDefinition() {
381          switch (this) {
382            case BEFORESTART: return "The action must be performed before the start of the related action.";
383            case BEFORE: return "The action must be performed before the related action.";
384            case BEFOREEND: return "The action must be performed before the end of the related action.";
385            case CONCURRENTWITHSTART: return "The action must be performed concurrent with the start of the related action.";
386            case CONCURRENT: return "The action must be performed concurrent with the related action.";
387            case CONCURRENTWITHEND: return "The action must be performed concurrent with the end of the related action.";
388            case AFTERSTART: return "The action must be performed after the start of the related action.";
389            case AFTER: return "The action must be performed after the related action.";
390            case AFTEREND: return "The action must be performed after the end of the related action.";
391            default: return "?";
392          }
393        }
394        public String getDisplay() {
395          switch (this) {
396            case BEFORESTART: return "Before Start";
397            case BEFORE: return "Before";
398            case BEFOREEND: return "Before End";
399            case CONCURRENTWITHSTART: return "Concurrent With Start";
400            case CONCURRENT: return "Concurrent";
401            case CONCURRENTWITHEND: return "Concurrent With End";
402            case AFTERSTART: return "After Start";
403            case AFTER: return "After";
404            case AFTEREND: return "After End";
405            default: return "?";
406          }
407        }
408    }
409
410  public static class ActionRelationshipTypeEnumFactory implements EnumFactory<ActionRelationshipType> {
411    public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
412      if (codeString == null || "".equals(codeString))
413            if (codeString == null || "".equals(codeString))
414                return null;
415        if ("before-start".equals(codeString))
416          return ActionRelationshipType.BEFORESTART;
417        if ("before".equals(codeString))
418          return ActionRelationshipType.BEFORE;
419        if ("before-end".equals(codeString))
420          return ActionRelationshipType.BEFOREEND;
421        if ("concurrent-with-start".equals(codeString))
422          return ActionRelationshipType.CONCURRENTWITHSTART;
423        if ("concurrent".equals(codeString))
424          return ActionRelationshipType.CONCURRENT;
425        if ("concurrent-with-end".equals(codeString))
426          return ActionRelationshipType.CONCURRENTWITHEND;
427        if ("after-start".equals(codeString))
428          return ActionRelationshipType.AFTERSTART;
429        if ("after".equals(codeString))
430          return ActionRelationshipType.AFTER;
431        if ("after-end".equals(codeString))
432          return ActionRelationshipType.AFTEREND;
433        throw new IllegalArgumentException("Unknown ActionRelationshipType code '"+codeString+"'");
434        }
435        public Enumeration<ActionRelationshipType> fromType(Base code) throws FHIRException {
436          if (code == null)
437            return null;
438          if (code.isEmpty())
439            return new Enumeration<ActionRelationshipType>(this);
440          String codeString = ((PrimitiveType) code).asStringValue();
441          if (codeString == null || "".equals(codeString))
442            return null;
443        if ("before-start".equals(codeString))
444          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFORESTART);
445        if ("before".equals(codeString))
446          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFORE);
447        if ("before-end".equals(codeString))
448          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFOREEND);
449        if ("concurrent-with-start".equals(codeString))
450          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENTWITHSTART);
451        if ("concurrent".equals(codeString))
452          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENT);
453        if ("concurrent-with-end".equals(codeString))
454          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENTWITHEND);
455        if ("after-start".equals(codeString))
456          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTERSTART);
457        if ("after".equals(codeString))
458          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTER);
459        if ("after-end".equals(codeString))
460          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTEREND);
461        throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
462        }
463    public String toCode(ActionRelationshipType code) {
464      if (code == ActionRelationshipType.BEFORESTART)
465        return "before-start";
466      if (code == ActionRelationshipType.BEFORE)
467        return "before";
468      if (code == ActionRelationshipType.BEFOREEND)
469        return "before-end";
470      if (code == ActionRelationshipType.CONCURRENTWITHSTART)
471        return "concurrent-with-start";
472      if (code == ActionRelationshipType.CONCURRENT)
473        return "concurrent";
474      if (code == ActionRelationshipType.CONCURRENTWITHEND)
475        return "concurrent-with-end";
476      if (code == ActionRelationshipType.AFTERSTART)
477        return "after-start";
478      if (code == ActionRelationshipType.AFTER)
479        return "after";
480      if (code == ActionRelationshipType.AFTEREND)
481        return "after-end";
482      return "?";
483      }
484    public String toSystem(ActionRelationshipType code) {
485      return code.getSystem();
486      }
487    }
488
489    public enum ActionParticipantType {
490        /**
491         * The participant is the patient under evaluation.
492         */
493        PATIENT, 
494        /**
495         * The participant is a practitioner involved in the patient's care.
496         */
497        PRACTITIONER, 
498        /**
499         * The participant is a person related to the patient.
500         */
501        RELATEDPERSON, 
502        /**
503         * The participant is a system or device used in the care of the patient.
504         */
505        DEVICE, 
506        /**
507         * added to help the parsers with the generic types
508         */
509        NULL;
510        public static ActionParticipantType fromCode(String codeString) throws FHIRException {
511            if (codeString == null || "".equals(codeString))
512                return null;
513        if ("patient".equals(codeString))
514          return PATIENT;
515        if ("practitioner".equals(codeString))
516          return PRACTITIONER;
517        if ("related-person".equals(codeString))
518          return RELATEDPERSON;
519        if ("device".equals(codeString))
520          return DEVICE;
521        if (Configuration.isAcceptInvalidEnums())
522          return null;
523        else
524          throw new FHIRException("Unknown ActionParticipantType code '"+codeString+"'");
525        }
526        public String toCode() {
527          switch (this) {
528            case PATIENT: return "patient";
529            case PRACTITIONER: return "practitioner";
530            case RELATEDPERSON: return "related-person";
531            case DEVICE: return "device";
532            default: return "?";
533          }
534        }
535        public String getSystem() {
536          switch (this) {
537            case PATIENT: return "http://hl7.org/fhir/action-participant-type";
538            case PRACTITIONER: return "http://hl7.org/fhir/action-participant-type";
539            case RELATEDPERSON: return "http://hl7.org/fhir/action-participant-type";
540            case DEVICE: return "http://hl7.org/fhir/action-participant-type";
541            default: return "?";
542          }
543        }
544        public String getDefinition() {
545          switch (this) {
546            case PATIENT: return "The participant is the patient under evaluation.";
547            case PRACTITIONER: return "The participant is a practitioner involved in the patient's care.";
548            case RELATEDPERSON: return "The participant is a person related to the patient.";
549            case DEVICE: return "The participant is a system or device used in the care of the patient.";
550            default: return "?";
551          }
552        }
553        public String getDisplay() {
554          switch (this) {
555            case PATIENT: return "Patient";
556            case PRACTITIONER: return "Practitioner";
557            case RELATEDPERSON: return "Related Person";
558            case DEVICE: return "Device";
559            default: return "?";
560          }
561        }
562    }
563
564  public static class ActionParticipantTypeEnumFactory implements EnumFactory<ActionParticipantType> {
565    public ActionParticipantType fromCode(String codeString) throws IllegalArgumentException {
566      if (codeString == null || "".equals(codeString))
567            if (codeString == null || "".equals(codeString))
568                return null;
569        if ("patient".equals(codeString))
570          return ActionParticipantType.PATIENT;
571        if ("practitioner".equals(codeString))
572          return ActionParticipantType.PRACTITIONER;
573        if ("related-person".equals(codeString))
574          return ActionParticipantType.RELATEDPERSON;
575        if ("device".equals(codeString))
576          return ActionParticipantType.DEVICE;
577        throw new IllegalArgumentException("Unknown ActionParticipantType code '"+codeString+"'");
578        }
579        public Enumeration<ActionParticipantType> fromType(Base code) throws FHIRException {
580          if (code == null)
581            return null;
582          if (code.isEmpty())
583            return new Enumeration<ActionParticipantType>(this);
584          String codeString = ((PrimitiveType) code).asStringValue();
585          if (codeString == null || "".equals(codeString))
586            return null;
587        if ("patient".equals(codeString))
588          return new Enumeration<ActionParticipantType>(this, ActionParticipantType.PATIENT);
589        if ("practitioner".equals(codeString))
590          return new Enumeration<ActionParticipantType>(this, ActionParticipantType.PRACTITIONER);
591        if ("related-person".equals(codeString))
592          return new Enumeration<ActionParticipantType>(this, ActionParticipantType.RELATEDPERSON);
593        if ("device".equals(codeString))
594          return new Enumeration<ActionParticipantType>(this, ActionParticipantType.DEVICE);
595        throw new FHIRException("Unknown ActionParticipantType code '"+codeString+"'");
596        }
597    public String toCode(ActionParticipantType code) {
598      if (code == ActionParticipantType.PATIENT)
599        return "patient";
600      if (code == ActionParticipantType.PRACTITIONER)
601        return "practitioner";
602      if (code == ActionParticipantType.RELATEDPERSON)
603        return "related-person";
604      if (code == ActionParticipantType.DEVICE)
605        return "device";
606      return "?";
607      }
608    public String toSystem(ActionParticipantType code) {
609      return code.getSystem();
610      }
611    }
612
613    public enum ActionGroupingBehavior {
614        /**
615         * Any group marked with this behavior should be displayed as a visual group to the end user.
616         */
617        VISUALGROUP, 
618        /**
619         * A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so.
620         */
621        LOGICALGROUP, 
622        /**
623         * A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are "aspirin, 500 mg, 2 times per day" and "aspirin, 300 mg, 3 times per day". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of "AtMostOne", unless it's a required action, in which case, it would be "ExactlyOne".
624         */
625        SENTENCEGROUP, 
626        /**
627         * added to help the parsers with the generic types
628         */
629        NULL;
630        public static ActionGroupingBehavior fromCode(String codeString) throws FHIRException {
631            if (codeString == null || "".equals(codeString))
632                return null;
633        if ("visual-group".equals(codeString))
634          return VISUALGROUP;
635        if ("logical-group".equals(codeString))
636          return LOGICALGROUP;
637        if ("sentence-group".equals(codeString))
638          return SENTENCEGROUP;
639        if (Configuration.isAcceptInvalidEnums())
640          return null;
641        else
642          throw new FHIRException("Unknown ActionGroupingBehavior code '"+codeString+"'");
643        }
644        public String toCode() {
645          switch (this) {
646            case VISUALGROUP: return "visual-group";
647            case LOGICALGROUP: return "logical-group";
648            case SENTENCEGROUP: return "sentence-group";
649            default: return "?";
650          }
651        }
652        public String getSystem() {
653          switch (this) {
654            case VISUALGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
655            case LOGICALGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
656            case SENTENCEGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
657            default: return "?";
658          }
659        }
660        public String getDefinition() {
661          switch (this) {
662            case VISUALGROUP: return "Any group marked with this behavior should be displayed as a visual group to the end user.";
663            case LOGICALGROUP: return "A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so.";
664            case SENTENCEGROUP: return "A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are \"aspirin, 500 mg, 2 times per day\" and \"aspirin, 300 mg, 3 times per day\". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of \"AtMostOne\", unless it's a required action, in which case, it would be \"ExactlyOne\".";
665            default: return "?";
666          }
667        }
668        public String getDisplay() {
669          switch (this) {
670            case VISUALGROUP: return "Visual Group";
671            case LOGICALGROUP: return "Logical Group";
672            case SENTENCEGROUP: return "Sentence Group";
673            default: return "?";
674          }
675        }
676    }
677
678  public static class ActionGroupingBehaviorEnumFactory implements EnumFactory<ActionGroupingBehavior> {
679    public ActionGroupingBehavior fromCode(String codeString) throws IllegalArgumentException {
680      if (codeString == null || "".equals(codeString))
681            if (codeString == null || "".equals(codeString))
682                return null;
683        if ("visual-group".equals(codeString))
684          return ActionGroupingBehavior.VISUALGROUP;
685        if ("logical-group".equals(codeString))
686          return ActionGroupingBehavior.LOGICALGROUP;
687        if ("sentence-group".equals(codeString))
688          return ActionGroupingBehavior.SENTENCEGROUP;
689        throw new IllegalArgumentException("Unknown ActionGroupingBehavior code '"+codeString+"'");
690        }
691        public Enumeration<ActionGroupingBehavior> fromType(Base code) throws FHIRException {
692          if (code == null)
693            return null;
694          if (code.isEmpty())
695            return new Enumeration<ActionGroupingBehavior>(this);
696          String codeString = ((PrimitiveType) code).asStringValue();
697          if (codeString == null || "".equals(codeString))
698            return null;
699        if ("visual-group".equals(codeString))
700          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.VISUALGROUP);
701        if ("logical-group".equals(codeString))
702          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.LOGICALGROUP);
703        if ("sentence-group".equals(codeString))
704          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.SENTENCEGROUP);
705        throw new FHIRException("Unknown ActionGroupingBehavior code '"+codeString+"'");
706        }
707    public String toCode(ActionGroupingBehavior code) {
708      if (code == ActionGroupingBehavior.VISUALGROUP)
709        return "visual-group";
710      if (code == ActionGroupingBehavior.LOGICALGROUP)
711        return "logical-group";
712      if (code == ActionGroupingBehavior.SENTENCEGROUP)
713        return "sentence-group";
714      return "?";
715      }
716    public String toSystem(ActionGroupingBehavior code) {
717      return code.getSystem();
718      }
719    }
720
721    public enum ActionSelectionBehavior {
722        /**
723         * Any number of the actions in the group may be chosen, from zero to all.
724         */
725        ANY, 
726        /**
727         * All the actions in the group must be selected as a single unit.
728         */
729        ALL, 
730        /**
731         * All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected.
732         */
733        ALLORNONE, 
734        /**
735         * The end user must choose one and only one of the selectable actions in the group. The user SHALL NOT choose none of the actions in the group.
736         */
737        EXACTLYONE, 
738        /**
739         * The end user may choose zero or at most one of the actions in the group.
740         */
741        ATMOSTONE, 
742        /**
743         * The end user must choose a minimum of one, and as many additional as desired.
744         */
745        ONEORMORE, 
746        /**
747         * added to help the parsers with the generic types
748         */
749        NULL;
750        public static ActionSelectionBehavior fromCode(String codeString) throws FHIRException {
751            if (codeString == null || "".equals(codeString))
752                return null;
753        if ("any".equals(codeString))
754          return ANY;
755        if ("all".equals(codeString))
756          return ALL;
757        if ("all-or-none".equals(codeString))
758          return ALLORNONE;
759        if ("exactly-one".equals(codeString))
760          return EXACTLYONE;
761        if ("at-most-one".equals(codeString))
762          return ATMOSTONE;
763        if ("one-or-more".equals(codeString))
764          return ONEORMORE;
765        if (Configuration.isAcceptInvalidEnums())
766          return null;
767        else
768          throw new FHIRException("Unknown ActionSelectionBehavior code '"+codeString+"'");
769        }
770        public String toCode() {
771          switch (this) {
772            case ANY: return "any";
773            case ALL: return "all";
774            case ALLORNONE: return "all-or-none";
775            case EXACTLYONE: return "exactly-one";
776            case ATMOSTONE: return "at-most-one";
777            case ONEORMORE: return "one-or-more";
778            default: return "?";
779          }
780        }
781        public String getSystem() {
782          switch (this) {
783            case ANY: return "http://hl7.org/fhir/action-selection-behavior";
784            case ALL: return "http://hl7.org/fhir/action-selection-behavior";
785            case ALLORNONE: return "http://hl7.org/fhir/action-selection-behavior";
786            case EXACTLYONE: return "http://hl7.org/fhir/action-selection-behavior";
787            case ATMOSTONE: return "http://hl7.org/fhir/action-selection-behavior";
788            case ONEORMORE: return "http://hl7.org/fhir/action-selection-behavior";
789            default: return "?";
790          }
791        }
792        public String getDefinition() {
793          switch (this) {
794            case ANY: return "Any number of the actions in the group may be chosen, from zero to all.";
795            case ALL: return "All the actions in the group must be selected as a single unit.";
796            case ALLORNONE: return "All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected.";
797            case EXACTLYONE: return "The end user must choose one and only one of the selectable actions in the group. The user SHALL NOT choose none of the actions in the group.";
798            case ATMOSTONE: return "The end user may choose zero or at most one of the actions in the group.";
799            case ONEORMORE: return "The end user must choose a minimum of one, and as many additional as desired.";
800            default: return "?";
801          }
802        }
803        public String getDisplay() {
804          switch (this) {
805            case ANY: return "Any";
806            case ALL: return "All";
807            case ALLORNONE: return "All Or None";
808            case EXACTLYONE: return "Exactly One";
809            case ATMOSTONE: return "At Most One";
810            case ONEORMORE: return "One Or More";
811            default: return "?";
812          }
813        }
814    }
815
816  public static class ActionSelectionBehaviorEnumFactory implements EnumFactory<ActionSelectionBehavior> {
817    public ActionSelectionBehavior fromCode(String codeString) throws IllegalArgumentException {
818      if (codeString == null || "".equals(codeString))
819            if (codeString == null || "".equals(codeString))
820                return null;
821        if ("any".equals(codeString))
822          return ActionSelectionBehavior.ANY;
823        if ("all".equals(codeString))
824          return ActionSelectionBehavior.ALL;
825        if ("all-or-none".equals(codeString))
826          return ActionSelectionBehavior.ALLORNONE;
827        if ("exactly-one".equals(codeString))
828          return ActionSelectionBehavior.EXACTLYONE;
829        if ("at-most-one".equals(codeString))
830          return ActionSelectionBehavior.ATMOSTONE;
831        if ("one-or-more".equals(codeString))
832          return ActionSelectionBehavior.ONEORMORE;
833        throw new IllegalArgumentException("Unknown ActionSelectionBehavior code '"+codeString+"'");
834        }
835        public Enumeration<ActionSelectionBehavior> fromType(Base code) throws FHIRException {
836          if (code == null)
837            return null;
838          if (code.isEmpty())
839            return new Enumeration<ActionSelectionBehavior>(this);
840          String codeString = ((PrimitiveType) code).asStringValue();
841          if (codeString == null || "".equals(codeString))
842            return null;
843        if ("any".equals(codeString))
844          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ANY);
845        if ("all".equals(codeString))
846          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ALL);
847        if ("all-or-none".equals(codeString))
848          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ALLORNONE);
849        if ("exactly-one".equals(codeString))
850          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.EXACTLYONE);
851        if ("at-most-one".equals(codeString))
852          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ATMOSTONE);
853        if ("one-or-more".equals(codeString))
854          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ONEORMORE);
855        throw new FHIRException("Unknown ActionSelectionBehavior code '"+codeString+"'");
856        }
857    public String toCode(ActionSelectionBehavior code) {
858      if (code == ActionSelectionBehavior.ANY)
859        return "any";
860      if (code == ActionSelectionBehavior.ALL)
861        return "all";
862      if (code == ActionSelectionBehavior.ALLORNONE)
863        return "all-or-none";
864      if (code == ActionSelectionBehavior.EXACTLYONE)
865        return "exactly-one";
866      if (code == ActionSelectionBehavior.ATMOSTONE)
867        return "at-most-one";
868      if (code == ActionSelectionBehavior.ONEORMORE)
869        return "one-or-more";
870      return "?";
871      }
872    public String toSystem(ActionSelectionBehavior code) {
873      return code.getSystem();
874      }
875    }
876
877    public enum ActionRequiredBehavior {
878        /**
879         * An action with this behavior must be included in the actions processed by the end user; the end user SHALL NOT choose not to include this action.
880         */
881        MUST, 
882        /**
883         * An action with this behavior may be included in the set of actions processed by the end user.
884         */
885        COULD, 
886        /**
887         * An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included.
888         */
889        MUSTUNLESSDOCUMENTED, 
890        /**
891         * added to help the parsers with the generic types
892         */
893        NULL;
894        public static ActionRequiredBehavior fromCode(String codeString) throws FHIRException {
895            if (codeString == null || "".equals(codeString))
896                return null;
897        if ("must".equals(codeString))
898          return MUST;
899        if ("could".equals(codeString))
900          return COULD;
901        if ("must-unless-documented".equals(codeString))
902          return MUSTUNLESSDOCUMENTED;
903        if (Configuration.isAcceptInvalidEnums())
904          return null;
905        else
906          throw new FHIRException("Unknown ActionRequiredBehavior code '"+codeString+"'");
907        }
908        public String toCode() {
909          switch (this) {
910            case MUST: return "must";
911            case COULD: return "could";
912            case MUSTUNLESSDOCUMENTED: return "must-unless-documented";
913            default: return "?";
914          }
915        }
916        public String getSystem() {
917          switch (this) {
918            case MUST: return "http://hl7.org/fhir/action-required-behavior";
919            case COULD: return "http://hl7.org/fhir/action-required-behavior";
920            case MUSTUNLESSDOCUMENTED: return "http://hl7.org/fhir/action-required-behavior";
921            default: return "?";
922          }
923        }
924        public String getDefinition() {
925          switch (this) {
926            case MUST: return "An action with this behavior must be included in the actions processed by the end user; the end user SHALL NOT choose not to include this action.";
927            case COULD: return "An action with this behavior may be included in the set of actions processed by the end user.";
928            case MUSTUNLESSDOCUMENTED: return "An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included.";
929            default: return "?";
930          }
931        }
932        public String getDisplay() {
933          switch (this) {
934            case MUST: return "Must";
935            case COULD: return "Could";
936            case MUSTUNLESSDOCUMENTED: return "Must Unless Documented";
937            default: return "?";
938          }
939        }
940    }
941
942  public static class ActionRequiredBehaviorEnumFactory implements EnumFactory<ActionRequiredBehavior> {
943    public ActionRequiredBehavior fromCode(String codeString) throws IllegalArgumentException {
944      if (codeString == null || "".equals(codeString))
945            if (codeString == null || "".equals(codeString))
946                return null;
947        if ("must".equals(codeString))
948          return ActionRequiredBehavior.MUST;
949        if ("could".equals(codeString))
950          return ActionRequiredBehavior.COULD;
951        if ("must-unless-documented".equals(codeString))
952          return ActionRequiredBehavior.MUSTUNLESSDOCUMENTED;
953        throw new IllegalArgumentException("Unknown ActionRequiredBehavior code '"+codeString+"'");
954        }
955        public Enumeration<ActionRequiredBehavior> fromType(Base code) throws FHIRException {
956          if (code == null)
957            return null;
958          if (code.isEmpty())
959            return new Enumeration<ActionRequiredBehavior>(this);
960          String codeString = ((PrimitiveType) code).asStringValue();
961          if (codeString == null || "".equals(codeString))
962            return null;
963        if ("must".equals(codeString))
964          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.MUST);
965        if ("could".equals(codeString))
966          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.COULD);
967        if ("must-unless-documented".equals(codeString))
968          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
969        throw new FHIRException("Unknown ActionRequiredBehavior code '"+codeString+"'");
970        }
971    public String toCode(ActionRequiredBehavior code) {
972      if (code == ActionRequiredBehavior.MUST)
973        return "must";
974      if (code == ActionRequiredBehavior.COULD)
975        return "could";
976      if (code == ActionRequiredBehavior.MUSTUNLESSDOCUMENTED)
977        return "must-unless-documented";
978      return "?";
979      }
980    public String toSystem(ActionRequiredBehavior code) {
981      return code.getSystem();
982      }
983    }
984
985    public enum ActionPrecheckBehavior {
986        /**
987         * An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider "pre-checking" such an action as a convenience for the user.
988         */
989        YES, 
990        /**
991         * An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not "pre-check" such an action.
992         */
993        NO, 
994        /**
995         * added to help the parsers with the generic types
996         */
997        NULL;
998        public static ActionPrecheckBehavior fromCode(String codeString) throws FHIRException {
999            if (codeString == null || "".equals(codeString))
1000                return null;
1001        if ("yes".equals(codeString))
1002          return YES;
1003        if ("no".equals(codeString))
1004          return NO;
1005        if (Configuration.isAcceptInvalidEnums())
1006          return null;
1007        else
1008          throw new FHIRException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1009        }
1010        public String toCode() {
1011          switch (this) {
1012            case YES: return "yes";
1013            case NO: return "no";
1014            default: return "?";
1015          }
1016        }
1017        public String getSystem() {
1018          switch (this) {
1019            case YES: return "http://hl7.org/fhir/action-precheck-behavior";
1020            case NO: return "http://hl7.org/fhir/action-precheck-behavior";
1021            default: return "?";
1022          }
1023        }
1024        public String getDefinition() {
1025          switch (this) {
1026            case YES: return "An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider \"pre-checking\" such an action as a convenience for the user.";
1027            case NO: return "An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not \"pre-check\" such an action.";
1028            default: return "?";
1029          }
1030        }
1031        public String getDisplay() {
1032          switch (this) {
1033            case YES: return "Yes";
1034            case NO: return "No";
1035            default: return "?";
1036          }
1037        }
1038    }
1039
1040  public static class ActionPrecheckBehaviorEnumFactory implements EnumFactory<ActionPrecheckBehavior> {
1041    public ActionPrecheckBehavior fromCode(String codeString) throws IllegalArgumentException {
1042      if (codeString == null || "".equals(codeString))
1043            if (codeString == null || "".equals(codeString))
1044                return null;
1045        if ("yes".equals(codeString))
1046          return ActionPrecheckBehavior.YES;
1047        if ("no".equals(codeString))
1048          return ActionPrecheckBehavior.NO;
1049        throw new IllegalArgumentException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1050        }
1051        public Enumeration<ActionPrecheckBehavior> fromType(Base code) throws FHIRException {
1052          if (code == null)
1053            return null;
1054          if (code.isEmpty())
1055            return new Enumeration<ActionPrecheckBehavior>(this);
1056          String codeString = ((PrimitiveType) code).asStringValue();
1057          if (codeString == null || "".equals(codeString))
1058            return null;
1059        if ("yes".equals(codeString))
1060          return new Enumeration<ActionPrecheckBehavior>(this, ActionPrecheckBehavior.YES);
1061        if ("no".equals(codeString))
1062          return new Enumeration<ActionPrecheckBehavior>(this, ActionPrecheckBehavior.NO);
1063        throw new FHIRException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1064        }
1065    public String toCode(ActionPrecheckBehavior code) {
1066      if (code == ActionPrecheckBehavior.YES)
1067        return "yes";
1068      if (code == ActionPrecheckBehavior.NO)
1069        return "no";
1070      return "?";
1071      }
1072    public String toSystem(ActionPrecheckBehavior code) {
1073      return code.getSystem();
1074      }
1075    }
1076
1077    public enum ActionCardinalityBehavior {
1078        /**
1079         * The action may only be selected one time.
1080         */
1081        SINGLE, 
1082        /**
1083         * The action may be selected multiple times.
1084         */
1085        MULTIPLE, 
1086        /**
1087         * added to help the parsers with the generic types
1088         */
1089        NULL;
1090        public static ActionCardinalityBehavior fromCode(String codeString) throws FHIRException {
1091            if (codeString == null || "".equals(codeString))
1092                return null;
1093        if ("single".equals(codeString))
1094          return SINGLE;
1095        if ("multiple".equals(codeString))
1096          return MULTIPLE;
1097        if (Configuration.isAcceptInvalidEnums())
1098          return null;
1099        else
1100          throw new FHIRException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1101        }
1102        public String toCode() {
1103          switch (this) {
1104            case SINGLE: return "single";
1105            case MULTIPLE: return "multiple";
1106            default: return "?";
1107          }
1108        }
1109        public String getSystem() {
1110          switch (this) {
1111            case SINGLE: return "http://hl7.org/fhir/action-cardinality-behavior";
1112            case MULTIPLE: return "http://hl7.org/fhir/action-cardinality-behavior";
1113            default: return "?";
1114          }
1115        }
1116        public String getDefinition() {
1117          switch (this) {
1118            case SINGLE: return "The action may only be selected one time.";
1119            case MULTIPLE: return "The action may be selected multiple times.";
1120            default: return "?";
1121          }
1122        }
1123        public String getDisplay() {
1124          switch (this) {
1125            case SINGLE: return "Single";
1126            case MULTIPLE: return "Multiple";
1127            default: return "?";
1128          }
1129        }
1130    }
1131
1132  public static class ActionCardinalityBehaviorEnumFactory implements EnumFactory<ActionCardinalityBehavior> {
1133    public ActionCardinalityBehavior fromCode(String codeString) throws IllegalArgumentException {
1134      if (codeString == null || "".equals(codeString))
1135            if (codeString == null || "".equals(codeString))
1136                return null;
1137        if ("single".equals(codeString))
1138          return ActionCardinalityBehavior.SINGLE;
1139        if ("multiple".equals(codeString))
1140          return ActionCardinalityBehavior.MULTIPLE;
1141        throw new IllegalArgumentException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1142        }
1143        public Enumeration<ActionCardinalityBehavior> fromType(Base code) throws FHIRException {
1144          if (code == null)
1145            return null;
1146          if (code.isEmpty())
1147            return new Enumeration<ActionCardinalityBehavior>(this);
1148          String codeString = ((PrimitiveType) code).asStringValue();
1149          if (codeString == null || "".equals(codeString))
1150            return null;
1151        if ("single".equals(codeString))
1152          return new Enumeration<ActionCardinalityBehavior>(this, ActionCardinalityBehavior.SINGLE);
1153        if ("multiple".equals(codeString))
1154          return new Enumeration<ActionCardinalityBehavior>(this, ActionCardinalityBehavior.MULTIPLE);
1155        throw new FHIRException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1156        }
1157    public String toCode(ActionCardinalityBehavior code) {
1158      if (code == ActionCardinalityBehavior.SINGLE)
1159        return "single";
1160      if (code == ActionCardinalityBehavior.MULTIPLE)
1161        return "multiple";
1162      return "?";
1163      }
1164    public String toSystem(ActionCardinalityBehavior code) {
1165      return code.getSystem();
1166      }
1167    }
1168
1169    @Block()
1170    public static class PlanDefinitionGoalComponent extends BackboneElement implements IBaseBackboneElement {
1171        /**
1172         * Indicates a category the goal falls within.
1173         */
1174        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1175        @Description(shortDefinition="E.g. Treatment, dietary, behavioral", formalDefinition="Indicates a category the goal falls within." )
1176        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-category")
1177        protected CodeableConcept category;
1178
1179        /**
1180         * Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".
1181         */
1182        @Child(name = "description", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
1183        @Description(shortDefinition="Code or text describing the goal", formalDefinition="Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\"." )
1184        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
1185        protected CodeableConcept description;
1186
1187        /**
1188         * Identifies the expected level of importance associated with reaching/sustaining the defined goal.
1189         */
1190        @Child(name = "priority", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1191        @Description(shortDefinition="high-priority | medium-priority | low-priority", formalDefinition="Identifies the expected level of importance associated with reaching/sustaining the defined goal." )
1192        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-priority")
1193        protected CodeableConcept priority;
1194
1195        /**
1196         * The event after which the goal should begin being pursued.
1197         */
1198        @Child(name = "start", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1199        @Description(shortDefinition="When goal pursuit begins", formalDefinition="The event after which the goal should begin being pursued." )
1200        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-start-event")
1201        protected CodeableConcept start;
1202
1203        /**
1204         * Identifies problems, conditions, issues, or concerns the goal is intended to address.
1205         */
1206        @Child(name = "addresses", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1207        @Description(shortDefinition="What does the goal address", formalDefinition="Identifies problems, conditions, issues, or concerns the goal is intended to address." )
1208        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
1209        protected List<CodeableConcept> addresses;
1210
1211        /**
1212         * Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.
1213         */
1214        @Child(name = "documentation", type = {RelatedArtifact.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1215        @Description(shortDefinition="Supporting documentation for the goal", formalDefinition="Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources." )
1216        protected List<RelatedArtifact> documentation;
1217
1218        /**
1219         * Indicates what should be done and within what timeframe.
1220         */
1221        @Child(name = "target", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1222        @Description(shortDefinition="Target outcome for the goal", formalDefinition="Indicates what should be done and within what timeframe." )
1223        protected List<PlanDefinitionGoalTargetComponent> target;
1224
1225        private static final long serialVersionUID = -795308926L;
1226
1227    /**
1228     * Constructor
1229     */
1230      public PlanDefinitionGoalComponent() {
1231        super();
1232      }
1233
1234    /**
1235     * Constructor
1236     */
1237      public PlanDefinitionGoalComponent(CodeableConcept description) {
1238        super();
1239        this.description = description;
1240      }
1241
1242        /**
1243         * @return {@link #category} (Indicates a category the goal falls within.)
1244         */
1245        public CodeableConcept getCategory() { 
1246          if (this.category == null)
1247            if (Configuration.errorOnAutoCreate())
1248              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.category");
1249            else if (Configuration.doAutoCreate())
1250              this.category = new CodeableConcept(); // cc
1251          return this.category;
1252        }
1253
1254        public boolean hasCategory() { 
1255          return this.category != null && !this.category.isEmpty();
1256        }
1257
1258        /**
1259         * @param value {@link #category} (Indicates a category the goal falls within.)
1260         */
1261        public PlanDefinitionGoalComponent setCategory(CodeableConcept value) { 
1262          this.category = value;
1263          return this;
1264        }
1265
1266        /**
1267         * @return {@link #description} (Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".)
1268         */
1269        public CodeableConcept getDescription() { 
1270          if (this.description == null)
1271            if (Configuration.errorOnAutoCreate())
1272              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.description");
1273            else if (Configuration.doAutoCreate())
1274              this.description = new CodeableConcept(); // cc
1275          return this.description;
1276        }
1277
1278        public boolean hasDescription() { 
1279          return this.description != null && !this.description.isEmpty();
1280        }
1281
1282        /**
1283         * @param value {@link #description} (Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".)
1284         */
1285        public PlanDefinitionGoalComponent setDescription(CodeableConcept value) { 
1286          this.description = value;
1287          return this;
1288        }
1289
1290        /**
1291         * @return {@link #priority} (Identifies the expected level of importance associated with reaching/sustaining the defined goal.)
1292         */
1293        public CodeableConcept getPriority() { 
1294          if (this.priority == null)
1295            if (Configuration.errorOnAutoCreate())
1296              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.priority");
1297            else if (Configuration.doAutoCreate())
1298              this.priority = new CodeableConcept(); // cc
1299          return this.priority;
1300        }
1301
1302        public boolean hasPriority() { 
1303          return this.priority != null && !this.priority.isEmpty();
1304        }
1305
1306        /**
1307         * @param value {@link #priority} (Identifies the expected level of importance associated with reaching/sustaining the defined goal.)
1308         */
1309        public PlanDefinitionGoalComponent setPriority(CodeableConcept value) { 
1310          this.priority = value;
1311          return this;
1312        }
1313
1314        /**
1315         * @return {@link #start} (The event after which the goal should begin being pursued.)
1316         */
1317        public CodeableConcept getStart() { 
1318          if (this.start == null)
1319            if (Configuration.errorOnAutoCreate())
1320              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.start");
1321            else if (Configuration.doAutoCreate())
1322              this.start = new CodeableConcept(); // cc
1323          return this.start;
1324        }
1325
1326        public boolean hasStart() { 
1327          return this.start != null && !this.start.isEmpty();
1328        }
1329
1330        /**
1331         * @param value {@link #start} (The event after which the goal should begin being pursued.)
1332         */
1333        public PlanDefinitionGoalComponent setStart(CodeableConcept value) { 
1334          this.start = value;
1335          return this;
1336        }
1337
1338        /**
1339         * @return {@link #addresses} (Identifies problems, conditions, issues, or concerns the goal is intended to address.)
1340         */
1341        public List<CodeableConcept> getAddresses() { 
1342          if (this.addresses == null)
1343            this.addresses = new ArrayList<CodeableConcept>();
1344          return this.addresses;
1345        }
1346
1347        /**
1348         * @return Returns a reference to <code>this</code> for easy method chaining
1349         */
1350        public PlanDefinitionGoalComponent setAddresses(List<CodeableConcept> theAddresses) { 
1351          this.addresses = theAddresses;
1352          return this;
1353        }
1354
1355        public boolean hasAddresses() { 
1356          if (this.addresses == null)
1357            return false;
1358          for (CodeableConcept item : this.addresses)
1359            if (!item.isEmpty())
1360              return true;
1361          return false;
1362        }
1363
1364        public CodeableConcept addAddresses() { //3
1365          CodeableConcept t = new CodeableConcept();
1366          if (this.addresses == null)
1367            this.addresses = new ArrayList<CodeableConcept>();
1368          this.addresses.add(t);
1369          return t;
1370        }
1371
1372        public PlanDefinitionGoalComponent addAddresses(CodeableConcept t) { //3
1373          if (t == null)
1374            return this;
1375          if (this.addresses == null)
1376            this.addresses = new ArrayList<CodeableConcept>();
1377          this.addresses.add(t);
1378          return this;
1379        }
1380
1381        /**
1382         * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist
1383         */
1384        public CodeableConcept getAddressesFirstRep() { 
1385          if (getAddresses().isEmpty()) {
1386            addAddresses();
1387          }
1388          return getAddresses().get(0);
1389        }
1390
1391        /**
1392         * @return {@link #documentation} (Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.)
1393         */
1394        public List<RelatedArtifact> getDocumentation() { 
1395          if (this.documentation == null)
1396            this.documentation = new ArrayList<RelatedArtifact>();
1397          return this.documentation;
1398        }
1399
1400        /**
1401         * @return Returns a reference to <code>this</code> for easy method chaining
1402         */
1403        public PlanDefinitionGoalComponent setDocumentation(List<RelatedArtifact> theDocumentation) { 
1404          this.documentation = theDocumentation;
1405          return this;
1406        }
1407
1408        public boolean hasDocumentation() { 
1409          if (this.documentation == null)
1410            return false;
1411          for (RelatedArtifact item : this.documentation)
1412            if (!item.isEmpty())
1413              return true;
1414          return false;
1415        }
1416
1417        public RelatedArtifact addDocumentation() { //3
1418          RelatedArtifact t = new RelatedArtifact();
1419          if (this.documentation == null)
1420            this.documentation = new ArrayList<RelatedArtifact>();
1421          this.documentation.add(t);
1422          return t;
1423        }
1424
1425        public PlanDefinitionGoalComponent addDocumentation(RelatedArtifact t) { //3
1426          if (t == null)
1427            return this;
1428          if (this.documentation == null)
1429            this.documentation = new ArrayList<RelatedArtifact>();
1430          this.documentation.add(t);
1431          return this;
1432        }
1433
1434        /**
1435         * @return The first repetition of repeating field {@link #documentation}, creating it if it does not already exist
1436         */
1437        public RelatedArtifact getDocumentationFirstRep() { 
1438          if (getDocumentation().isEmpty()) {
1439            addDocumentation();
1440          }
1441          return getDocumentation().get(0);
1442        }
1443
1444        /**
1445         * @return {@link #target} (Indicates what should be done and within what timeframe.)
1446         */
1447        public List<PlanDefinitionGoalTargetComponent> getTarget() { 
1448          if (this.target == null)
1449            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
1450          return this.target;
1451        }
1452
1453        /**
1454         * @return Returns a reference to <code>this</code> for easy method chaining
1455         */
1456        public PlanDefinitionGoalComponent setTarget(List<PlanDefinitionGoalTargetComponent> theTarget) { 
1457          this.target = theTarget;
1458          return this;
1459        }
1460
1461        public boolean hasTarget() { 
1462          if (this.target == null)
1463            return false;
1464          for (PlanDefinitionGoalTargetComponent item : this.target)
1465            if (!item.isEmpty())
1466              return true;
1467          return false;
1468        }
1469
1470        public PlanDefinitionGoalTargetComponent addTarget() { //3
1471          PlanDefinitionGoalTargetComponent t = new PlanDefinitionGoalTargetComponent();
1472          if (this.target == null)
1473            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
1474          this.target.add(t);
1475          return t;
1476        }
1477
1478        public PlanDefinitionGoalComponent addTarget(PlanDefinitionGoalTargetComponent t) { //3
1479          if (t == null)
1480            return this;
1481          if (this.target == null)
1482            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
1483          this.target.add(t);
1484          return this;
1485        }
1486
1487        /**
1488         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
1489         */
1490        public PlanDefinitionGoalTargetComponent getTargetFirstRep() { 
1491          if (getTarget().isEmpty()) {
1492            addTarget();
1493          }
1494          return getTarget().get(0);
1495        }
1496
1497        protected void listChildren(List<Property> children) {
1498          super.listChildren(children);
1499          children.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, 1, category));
1500          children.add(new Property("description", "CodeableConcept", "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".", 0, 1, description));
1501          children.add(new Property("priority", "CodeableConcept", "Identifies the expected level of importance associated with reaching/sustaining the defined goal.", 0, 1, priority));
1502          children.add(new Property("start", "CodeableConcept", "The event after which the goal should begin being pursued.", 0, 1, start));
1503          children.add(new Property("addresses", "CodeableConcept", "Identifies problems, conditions, issues, or concerns the goal is intended to address.", 0, java.lang.Integer.MAX_VALUE, addresses));
1504          children.add(new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
1505          children.add(new Property("target", "", "Indicates what should be done and within what timeframe.", 0, java.lang.Integer.MAX_VALUE, target));
1506        }
1507
1508        @Override
1509        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1510          switch (_hash) {
1511          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, 1, category);
1512          case -1724546052: /*description*/  return new Property("description", "CodeableConcept", "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".", 0, 1, description);
1513          case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Identifies the expected level of importance associated with reaching/sustaining the defined goal.", 0, 1, priority);
1514          case 109757538: /*start*/  return new Property("start", "CodeableConcept", "The event after which the goal should begin being pursued.", 0, 1, start);
1515          case 874544034: /*addresses*/  return new Property("addresses", "CodeableConcept", "Identifies problems, conditions, issues, or concerns the goal is intended to address.", 0, java.lang.Integer.MAX_VALUE, addresses);
1516          case 1587405498: /*documentation*/  return new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation);
1517          case -880905839: /*target*/  return new Property("target", "", "Indicates what should be done and within what timeframe.", 0, java.lang.Integer.MAX_VALUE, target);
1518          default: return super.getNamedProperty(_hash, _name, _checkValid);
1519          }
1520
1521        }
1522
1523      @Override
1524      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1525        switch (hash) {
1526        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
1527        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // CodeableConcept
1528        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
1529        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // CodeableConcept
1530        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // CodeableConcept
1531        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
1532        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // PlanDefinitionGoalTargetComponent
1533        default: return super.getProperty(hash, name, checkValid);
1534        }
1535
1536      }
1537
1538      @Override
1539      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1540        switch (hash) {
1541        case 50511102: // category
1542          this.category = castToCodeableConcept(value); // CodeableConcept
1543          return value;
1544        case -1724546052: // description
1545          this.description = castToCodeableConcept(value); // CodeableConcept
1546          return value;
1547        case -1165461084: // priority
1548          this.priority = castToCodeableConcept(value); // CodeableConcept
1549          return value;
1550        case 109757538: // start
1551          this.start = castToCodeableConcept(value); // CodeableConcept
1552          return value;
1553        case 874544034: // addresses
1554          this.getAddresses().add(castToCodeableConcept(value)); // CodeableConcept
1555          return value;
1556        case 1587405498: // documentation
1557          this.getDocumentation().add(castToRelatedArtifact(value)); // RelatedArtifact
1558          return value;
1559        case -880905839: // target
1560          this.getTarget().add((PlanDefinitionGoalTargetComponent) value); // PlanDefinitionGoalTargetComponent
1561          return value;
1562        default: return super.setProperty(hash, name, value);
1563        }
1564
1565      }
1566
1567      @Override
1568      public Base setProperty(String name, Base value) throws FHIRException {
1569        if (name.equals("category")) {
1570          this.category = castToCodeableConcept(value); // CodeableConcept
1571        } else if (name.equals("description")) {
1572          this.description = castToCodeableConcept(value); // CodeableConcept
1573        } else if (name.equals("priority")) {
1574          this.priority = castToCodeableConcept(value); // CodeableConcept
1575        } else if (name.equals("start")) {
1576          this.start = castToCodeableConcept(value); // CodeableConcept
1577        } else if (name.equals("addresses")) {
1578          this.getAddresses().add(castToCodeableConcept(value));
1579        } else if (name.equals("documentation")) {
1580          this.getDocumentation().add(castToRelatedArtifact(value));
1581        } else if (name.equals("target")) {
1582          this.getTarget().add((PlanDefinitionGoalTargetComponent) value);
1583        } else
1584          return super.setProperty(name, value);
1585        return value;
1586      }
1587
1588      @Override
1589      public Base makeProperty(int hash, String name) throws FHIRException {
1590        switch (hash) {
1591        case 50511102:  return getCategory(); 
1592        case -1724546052:  return getDescription(); 
1593        case -1165461084:  return getPriority(); 
1594        case 109757538:  return getStart(); 
1595        case 874544034:  return addAddresses(); 
1596        case 1587405498:  return addDocumentation(); 
1597        case -880905839:  return addTarget(); 
1598        default: return super.makeProperty(hash, name);
1599        }
1600
1601      }
1602
1603      @Override
1604      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1605        switch (hash) {
1606        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1607        case -1724546052: /*description*/ return new String[] {"CodeableConcept"};
1608        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
1609        case 109757538: /*start*/ return new String[] {"CodeableConcept"};
1610        case 874544034: /*addresses*/ return new String[] {"CodeableConcept"};
1611        case 1587405498: /*documentation*/ return new String[] {"RelatedArtifact"};
1612        case -880905839: /*target*/ return new String[] {};
1613        default: return super.getTypesForProperty(hash, name);
1614        }
1615
1616      }
1617
1618      @Override
1619      public Base addChild(String name) throws FHIRException {
1620        if (name.equals("category")) {
1621          this.category = new CodeableConcept();
1622          return this.category;
1623        }
1624        else if (name.equals("description")) {
1625          this.description = new CodeableConcept();
1626          return this.description;
1627        }
1628        else if (name.equals("priority")) {
1629          this.priority = new CodeableConcept();
1630          return this.priority;
1631        }
1632        else if (name.equals("start")) {
1633          this.start = new CodeableConcept();
1634          return this.start;
1635        }
1636        else if (name.equals("addresses")) {
1637          return addAddresses();
1638        }
1639        else if (name.equals("documentation")) {
1640          return addDocumentation();
1641        }
1642        else if (name.equals("target")) {
1643          return addTarget();
1644        }
1645        else
1646          return super.addChild(name);
1647      }
1648
1649      public PlanDefinitionGoalComponent copy() {
1650        PlanDefinitionGoalComponent dst = new PlanDefinitionGoalComponent();
1651        copyValues(dst);
1652        dst.category = category == null ? null : category.copy();
1653        dst.description = description == null ? null : description.copy();
1654        dst.priority = priority == null ? null : priority.copy();
1655        dst.start = start == null ? null : start.copy();
1656        if (addresses != null) {
1657          dst.addresses = new ArrayList<CodeableConcept>();
1658          for (CodeableConcept i : addresses)
1659            dst.addresses.add(i.copy());
1660        };
1661        if (documentation != null) {
1662          dst.documentation = new ArrayList<RelatedArtifact>();
1663          for (RelatedArtifact i : documentation)
1664            dst.documentation.add(i.copy());
1665        };
1666        if (target != null) {
1667          dst.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
1668          for (PlanDefinitionGoalTargetComponent i : target)
1669            dst.target.add(i.copy());
1670        };
1671        return dst;
1672      }
1673
1674      @Override
1675      public boolean equalsDeep(Base other_) {
1676        if (!super.equalsDeep(other_))
1677          return false;
1678        if (!(other_ instanceof PlanDefinitionGoalComponent))
1679          return false;
1680        PlanDefinitionGoalComponent o = (PlanDefinitionGoalComponent) other_;
1681        return compareDeep(category, o.category, true) && compareDeep(description, o.description, true)
1682           && compareDeep(priority, o.priority, true) && compareDeep(start, o.start, true) && compareDeep(addresses, o.addresses, true)
1683           && compareDeep(documentation, o.documentation, true) && compareDeep(target, o.target, true);
1684      }
1685
1686      @Override
1687      public boolean equalsShallow(Base other_) {
1688        if (!super.equalsShallow(other_))
1689          return false;
1690        if (!(other_ instanceof PlanDefinitionGoalComponent))
1691          return false;
1692        PlanDefinitionGoalComponent o = (PlanDefinitionGoalComponent) other_;
1693        return true;
1694      }
1695
1696      public boolean isEmpty() {
1697        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, description, priority
1698          , start, addresses, documentation, target);
1699      }
1700
1701  public String fhirType() {
1702    return "PlanDefinition.goal";
1703
1704  }
1705
1706  }
1707
1708    @Block()
1709    public static class PlanDefinitionGoalTargetComponent extends BackboneElement implements IBaseBackboneElement {
1710        /**
1711         * The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.
1712         */
1713        @Child(name = "measure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1714        @Description(shortDefinition="The parameter whose value is to be tracked", formalDefinition="The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level." )
1715        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
1716        protected CodeableConcept measure;
1717
1718        /**
1719         * The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.
1720         */
1721        @Child(name = "detail", type = {Quantity.class, Range.class, CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1722        @Description(shortDefinition="The target value to be achieved", formalDefinition="The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value." )
1723        protected Type detail;
1724
1725        /**
1726         * Indicates the timeframe after the start of the goal in which the goal should be met.
1727         */
1728        @Child(name = "due", type = {Duration.class}, order=3, min=0, max=1, modifier=false, summary=false)
1729        @Description(shortDefinition="Reach goal within", formalDefinition="Indicates the timeframe after the start of the goal in which the goal should be met." )
1730        protected Duration due;
1731
1732        private static final long serialVersionUID = -131874144L;
1733
1734    /**
1735     * Constructor
1736     */
1737      public PlanDefinitionGoalTargetComponent() {
1738        super();
1739      }
1740
1741        /**
1742         * @return {@link #measure} (The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
1743         */
1744        public CodeableConcept getMeasure() { 
1745          if (this.measure == null)
1746            if (Configuration.errorOnAutoCreate())
1747              throw new Error("Attempt to auto-create PlanDefinitionGoalTargetComponent.measure");
1748            else if (Configuration.doAutoCreate())
1749              this.measure = new CodeableConcept(); // cc
1750          return this.measure;
1751        }
1752
1753        public boolean hasMeasure() { 
1754          return this.measure != null && !this.measure.isEmpty();
1755        }
1756
1757        /**
1758         * @param value {@link #measure} (The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
1759         */
1760        public PlanDefinitionGoalTargetComponent setMeasure(CodeableConcept value) { 
1761          this.measure = value;
1762          return this;
1763        }
1764
1765        /**
1766         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
1767         */
1768        public Type getDetail() { 
1769          return this.detail;
1770        }
1771
1772        /**
1773         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
1774         */
1775        public Quantity getDetailQuantity() throws FHIRException { 
1776          if (this.detail == null)
1777            return null;
1778          if (!(this.detail instanceof Quantity))
1779            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.detail.getClass().getName()+" was encountered");
1780          return (Quantity) this.detail;
1781        }
1782
1783        public boolean hasDetailQuantity() { 
1784          return this != null && this.detail instanceof Quantity;
1785        }
1786
1787        /**
1788         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
1789         */
1790        public Range getDetailRange() throws FHIRException { 
1791          if (this.detail == null)
1792            return null;
1793          if (!(this.detail instanceof Range))
1794            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.detail.getClass().getName()+" was encountered");
1795          return (Range) this.detail;
1796        }
1797
1798        public boolean hasDetailRange() { 
1799          return this != null && this.detail instanceof Range;
1800        }
1801
1802        /**
1803         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
1804         */
1805        public CodeableConcept getDetailCodeableConcept() throws FHIRException { 
1806          if (this.detail == null)
1807            return null;
1808          if (!(this.detail instanceof CodeableConcept))
1809            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.detail.getClass().getName()+" was encountered");
1810          return (CodeableConcept) this.detail;
1811        }
1812
1813        public boolean hasDetailCodeableConcept() { 
1814          return this != null && this.detail instanceof CodeableConcept;
1815        }
1816
1817        public boolean hasDetail() { 
1818          return this.detail != null && !this.detail.isEmpty();
1819        }
1820
1821        /**
1822         * @param value {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
1823         */
1824        public PlanDefinitionGoalTargetComponent setDetail(Type value) { 
1825          if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof CodeableConcept))
1826            throw new Error("Not the right type for PlanDefinition.goal.target.detail[x]: "+value.fhirType());
1827          this.detail = value;
1828          return this;
1829        }
1830
1831        /**
1832         * @return {@link #due} (Indicates the timeframe after the start of the goal in which the goal should be met.)
1833         */
1834        public Duration getDue() { 
1835          if (this.due == null)
1836            if (Configuration.errorOnAutoCreate())
1837              throw new Error("Attempt to auto-create PlanDefinitionGoalTargetComponent.due");
1838            else if (Configuration.doAutoCreate())
1839              this.due = new Duration(); // cc
1840          return this.due;
1841        }
1842
1843        public boolean hasDue() { 
1844          return this.due != null && !this.due.isEmpty();
1845        }
1846
1847        /**
1848         * @param value {@link #due} (Indicates the timeframe after the start of the goal in which the goal should be met.)
1849         */
1850        public PlanDefinitionGoalTargetComponent setDue(Duration value) { 
1851          this.due = value;
1852          return this;
1853        }
1854
1855        protected void listChildren(List<Property> children) {
1856          super.listChildren(children);
1857          children.add(new Property("measure", "CodeableConcept", "The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure));
1858          children.add(new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail));
1859          children.add(new Property("due", "Duration", "Indicates the timeframe after the start of the goal in which the goal should be met.", 0, 1, due));
1860        }
1861
1862        @Override
1863        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1864          switch (_hash) {
1865          case 938321246: /*measure*/  return new Property("measure", "CodeableConcept", "The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure);
1866          case -1973084529: /*detail[x]*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
1867          case -1335224239: /*detail*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
1868          case -1313079300: /*detailQuantity*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
1869          case -2062632084: /*detailRange*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
1870          case -175586544: /*detailCodeableConcept*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
1871          case 99828: /*due*/  return new Property("due", "Duration", "Indicates the timeframe after the start of the goal in which the goal should be met.", 0, 1, due);
1872          default: return super.getNamedProperty(_hash, _name, _checkValid);
1873          }
1874
1875        }
1876
1877      @Override
1878      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1879        switch (hash) {
1880        case 938321246: /*measure*/ return this.measure == null ? new Base[0] : new Base[] {this.measure}; // CodeableConcept
1881        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // Type
1882        case 99828: /*due*/ return this.due == null ? new Base[0] : new Base[] {this.due}; // Duration
1883        default: return super.getProperty(hash, name, checkValid);
1884        }
1885
1886      }
1887
1888      @Override
1889      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1890        switch (hash) {
1891        case 938321246: // measure
1892          this.measure = castToCodeableConcept(value); // CodeableConcept
1893          return value;
1894        case -1335224239: // detail
1895          this.detail = castToType(value); // Type
1896          return value;
1897        case 99828: // due
1898          this.due = castToDuration(value); // Duration
1899          return value;
1900        default: return super.setProperty(hash, name, value);
1901        }
1902
1903      }
1904
1905      @Override
1906      public Base setProperty(String name, Base value) throws FHIRException {
1907        if (name.equals("measure")) {
1908          this.measure = castToCodeableConcept(value); // CodeableConcept
1909        } else if (name.equals("detail[x]")) {
1910          this.detail = castToType(value); // Type
1911        } else if (name.equals("due")) {
1912          this.due = castToDuration(value); // Duration
1913        } else
1914          return super.setProperty(name, value);
1915        return value;
1916      }
1917
1918      @Override
1919      public Base makeProperty(int hash, String name) throws FHIRException {
1920        switch (hash) {
1921        case 938321246:  return getMeasure(); 
1922        case -1973084529:  return getDetail(); 
1923        case -1335224239:  return getDetail(); 
1924        case 99828:  return getDue(); 
1925        default: return super.makeProperty(hash, name);
1926        }
1927
1928      }
1929
1930      @Override
1931      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1932        switch (hash) {
1933        case 938321246: /*measure*/ return new String[] {"CodeableConcept"};
1934        case -1335224239: /*detail*/ return new String[] {"Quantity", "Range", "CodeableConcept"};
1935        case 99828: /*due*/ return new String[] {"Duration"};
1936        default: return super.getTypesForProperty(hash, name);
1937        }
1938
1939      }
1940
1941      @Override
1942      public Base addChild(String name) throws FHIRException {
1943        if (name.equals("measure")) {
1944          this.measure = new CodeableConcept();
1945          return this.measure;
1946        }
1947        else if (name.equals("detailQuantity")) {
1948          this.detail = new Quantity();
1949          return this.detail;
1950        }
1951        else if (name.equals("detailRange")) {
1952          this.detail = new Range();
1953          return this.detail;
1954        }
1955        else if (name.equals("detailCodeableConcept")) {
1956          this.detail = new CodeableConcept();
1957          return this.detail;
1958        }
1959        else if (name.equals("due")) {
1960          this.due = new Duration();
1961          return this.due;
1962        }
1963        else
1964          return super.addChild(name);
1965      }
1966
1967      public PlanDefinitionGoalTargetComponent copy() {
1968        PlanDefinitionGoalTargetComponent dst = new PlanDefinitionGoalTargetComponent();
1969        copyValues(dst);
1970        dst.measure = measure == null ? null : measure.copy();
1971        dst.detail = detail == null ? null : detail.copy();
1972        dst.due = due == null ? null : due.copy();
1973        return dst;
1974      }
1975
1976      @Override
1977      public boolean equalsDeep(Base other_) {
1978        if (!super.equalsDeep(other_))
1979          return false;
1980        if (!(other_ instanceof PlanDefinitionGoalTargetComponent))
1981          return false;
1982        PlanDefinitionGoalTargetComponent o = (PlanDefinitionGoalTargetComponent) other_;
1983        return compareDeep(measure, o.measure, true) && compareDeep(detail, o.detail, true) && compareDeep(due, o.due, true)
1984          ;
1985      }
1986
1987      @Override
1988      public boolean equalsShallow(Base other_) {
1989        if (!super.equalsShallow(other_))
1990          return false;
1991        if (!(other_ instanceof PlanDefinitionGoalTargetComponent))
1992          return false;
1993        PlanDefinitionGoalTargetComponent o = (PlanDefinitionGoalTargetComponent) other_;
1994        return true;
1995      }
1996
1997      public boolean isEmpty() {
1998        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(measure, detail, due);
1999      }
2000
2001  public String fhirType() {
2002    return "PlanDefinition.goal.target";
2003
2004  }
2005
2006  }
2007
2008    @Block()
2009    public static class PlanDefinitionActionComponent extends BackboneElement implements IBaseBackboneElement {
2010        /**
2011         * A user-visible prefix for the action.
2012         */
2013        @Child(name = "prefix", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2014        @Description(shortDefinition="User-visible prefix for the action (e.g. 1. or A.)", formalDefinition="A user-visible prefix for the action." )
2015        protected StringType prefix;
2016
2017        /**
2018         * The title of the action displayed to a user.
2019         */
2020        @Child(name = "title", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2021        @Description(shortDefinition="User-visible title", formalDefinition="The title of the action displayed to a user." )
2022        protected StringType title;
2023
2024        /**
2025         * A brief description of the action used to provide a summary to display to the user.
2026         */
2027        @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2028        @Description(shortDefinition="Brief description of the action", formalDefinition="A brief description of the action used to provide a summary to display to the user." )
2029        protected StringType description;
2030
2031        /**
2032         * A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
2033         */
2034        @Child(name = "textEquivalent", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2035        @Description(shortDefinition="Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system", formalDefinition="A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically." )
2036        protected StringType textEquivalent;
2037
2038        /**
2039         * Indicates how quickly the action should be addressed with respect to other actions.
2040         */
2041        @Child(name = "priority", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
2042        @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the action should be addressed with respect to other actions." )
2043        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
2044        protected Enumeration<RequestPriority> priority;
2045
2046        /**
2047         * A code that provides meaning for the action or action group. For example, a section may have a LOINC code for the section of a documentation template.
2048         */
2049        @Child(name = "code", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2050        @Description(shortDefinition="Code representing the meaning of the action or sub-actions", formalDefinition="A code that provides meaning for the action or action group. For example, a section may have a LOINC code for the section of a documentation template." )
2051        protected List<CodeableConcept> code;
2052
2053        /**
2054         * A description of why this action is necessary or appropriate.
2055         */
2056        @Child(name = "reason", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2057        @Description(shortDefinition="Why the action should be performed", formalDefinition="A description of why this action is necessary or appropriate." )
2058        protected List<CodeableConcept> reason;
2059
2060        /**
2061         * Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.
2062         */
2063        @Child(name = "documentation", type = {RelatedArtifact.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2064        @Description(shortDefinition="Supporting documentation for the intended performer of the action", formalDefinition="Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources." )
2065        protected List<RelatedArtifact> documentation;
2066
2067        /**
2068         * Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.
2069         */
2070        @Child(name = "goalId", type = {IdType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2071        @Description(shortDefinition="What goals this action supports", formalDefinition="Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition." )
2072        protected List<IdType> goalId;
2073
2074        /**
2075         * A description of when the action should be triggered.
2076         */
2077        @Child(name = "trigger", type = {TriggerDefinition.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2078        @Description(shortDefinition="When the action should be triggered", formalDefinition="A description of when the action should be triggered." )
2079        protected List<TriggerDefinition> trigger;
2080
2081        /**
2082         * An expression that describes applicability criteria or start/stop conditions for the action.
2083         */
2084        @Child(name = "condition", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2085        @Description(shortDefinition="Whether or not the action is applicable", formalDefinition="An expression that describes applicability criteria or start/stop conditions for the action." )
2086        protected List<PlanDefinitionActionConditionComponent> condition;
2087
2088        /**
2089         * Defines input data requirements for the action.
2090         */
2091        @Child(name = "input", type = {DataRequirement.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2092        @Description(shortDefinition="Input data requirements", formalDefinition="Defines input data requirements for the action." )
2093        protected List<DataRequirement> input;
2094
2095        /**
2096         * Defines the outputs of the action, if any.
2097         */
2098        @Child(name = "output", type = {DataRequirement.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2099        @Description(shortDefinition="Output data definition", formalDefinition="Defines the outputs of the action, if any." )
2100        protected List<DataRequirement> output;
2101
2102        /**
2103         * A relationship to another action such as "before" or "30-60 minutes after start of".
2104         */
2105        @Child(name = "relatedAction", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2106        @Description(shortDefinition="Relationship to another action", formalDefinition="A relationship to another action such as \"before\" or \"30-60 minutes after start of\"." )
2107        protected List<PlanDefinitionActionRelatedActionComponent> relatedAction;
2108
2109        /**
2110         * An optional value describing when the action should be performed.
2111         */
2112        @Child(name = "timing", type = {DateTimeType.class, Age.class, Period.class, Duration.class, Range.class, Timing.class}, order=15, min=0, max=1, modifier=false, summary=false)
2113        @Description(shortDefinition="When the action should take place", formalDefinition="An optional value describing when the action should be performed." )
2114        protected Type timing;
2115
2116        /**
2117         * Indicates who should participate in performing the action described.
2118         */
2119        @Child(name = "participant", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2120        @Description(shortDefinition="Who should participate in the action", formalDefinition="Indicates who should participate in performing the action described." )
2121        protected List<PlanDefinitionActionParticipantComponent> participant;
2122
2123        /**
2124         * The type of action to perform (create, update, remove).
2125         */
2126        @Child(name = "type", type = {CodeableConcept.class}, order=17, min=0, max=1, modifier=false, summary=false)
2127        @Description(shortDefinition="create | update | remove | fire-event", formalDefinition="The type of action to perform (create, update, remove)." )
2128        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-type")
2129        protected CodeableConcept type;
2130
2131        /**
2132         * Defines the grouping behavior for the action and its children.
2133         */
2134        @Child(name = "groupingBehavior", type = {CodeType.class}, order=18, min=0, max=1, modifier=false, summary=false)
2135        @Description(shortDefinition="visual-group | logical-group | sentence-group", formalDefinition="Defines the grouping behavior for the action and its children." )
2136        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-grouping-behavior")
2137        protected Enumeration<ActionGroupingBehavior> groupingBehavior;
2138
2139        /**
2140         * Defines the selection behavior for the action and its children.
2141         */
2142        @Child(name = "selectionBehavior", type = {CodeType.class}, order=19, min=0, max=1, modifier=false, summary=false)
2143        @Description(shortDefinition="any | all | all-or-none | exactly-one | at-most-one | one-or-more", formalDefinition="Defines the selection behavior for the action and its children." )
2144        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-selection-behavior")
2145        protected Enumeration<ActionSelectionBehavior> selectionBehavior;
2146
2147        /**
2148         * Defines the required behavior for the action.
2149         */
2150        @Child(name = "requiredBehavior", type = {CodeType.class}, order=20, min=0, max=1, modifier=false, summary=false)
2151        @Description(shortDefinition="must | could | must-unless-documented", formalDefinition="Defines the required behavior for the action." )
2152        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-required-behavior")
2153        protected Enumeration<ActionRequiredBehavior> requiredBehavior;
2154
2155        /**
2156         * Defines whether the action should usually be preselected.
2157         */
2158        @Child(name = "precheckBehavior", type = {CodeType.class}, order=21, min=0, max=1, modifier=false, summary=false)
2159        @Description(shortDefinition="yes | no", formalDefinition="Defines whether the action should usually be preselected." )
2160        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-precheck-behavior")
2161        protected Enumeration<ActionPrecheckBehavior> precheckBehavior;
2162
2163        /**
2164         * Defines whether the action can be selected multiple times.
2165         */
2166        @Child(name = "cardinalityBehavior", type = {CodeType.class}, order=22, min=0, max=1, modifier=false, summary=false)
2167        @Description(shortDefinition="single | multiple", formalDefinition="Defines whether the action can be selected multiple times." )
2168        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-cardinality-behavior")
2169        protected Enumeration<ActionCardinalityBehavior> cardinalityBehavior;
2170
2171        /**
2172         * A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.
2173         */
2174        @Child(name = "definition", type = {CanonicalType.class}, order=23, min=0, max=1, modifier=false, summary=false)
2175        @Description(shortDefinition="Description of the activity to be performed", formalDefinition="A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken." )
2176        protected CanonicalType definition;
2177
2178        /**
2179         * A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
2180         */
2181        @Child(name = "transform", type = {CanonicalType.class}, order=24, min=0, max=1, modifier=false, summary=false)
2182        @Description(shortDefinition="Transform to apply the template", formalDefinition="A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input." )
2183        protected CanonicalType transform;
2184
2185        /**
2186         * Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.
2187         */
2188        @Child(name = "dynamicValue", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2189        @Description(shortDefinition="Dynamic aspects of the definition", formalDefinition="Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result." )
2190        protected List<PlanDefinitionActionDynamicValueComponent> dynamicValue;
2191
2192        /**
2193         * Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.
2194         */
2195        @Child(name = "action", type = {PlanDefinitionActionComponent.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2196        @Description(shortDefinition="A sub-action", formalDefinition="Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition." )
2197        protected List<PlanDefinitionActionComponent> action;
2198
2199        private static final long serialVersionUID = 1636345786L;
2200
2201    /**
2202     * Constructor
2203     */
2204      public PlanDefinitionActionComponent() {
2205        super();
2206      }
2207
2208        /**
2209         * @return {@link #prefix} (A user-visible prefix for the action.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
2210         */
2211        public StringType getPrefixElement() { 
2212          if (this.prefix == null)
2213            if (Configuration.errorOnAutoCreate())
2214              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.prefix");
2215            else if (Configuration.doAutoCreate())
2216              this.prefix = new StringType(); // bb
2217          return this.prefix;
2218        }
2219
2220        public boolean hasPrefixElement() { 
2221          return this.prefix != null && !this.prefix.isEmpty();
2222        }
2223
2224        public boolean hasPrefix() { 
2225          return this.prefix != null && !this.prefix.isEmpty();
2226        }
2227
2228        /**
2229         * @param value {@link #prefix} (A user-visible prefix for the action.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
2230         */
2231        public PlanDefinitionActionComponent setPrefixElement(StringType value) { 
2232          this.prefix = value;
2233          return this;
2234        }
2235
2236        /**
2237         * @return A user-visible prefix for the action.
2238         */
2239        public String getPrefix() { 
2240          return this.prefix == null ? null : this.prefix.getValue();
2241        }
2242
2243        /**
2244         * @param value A user-visible prefix for the action.
2245         */
2246        public PlanDefinitionActionComponent setPrefix(String value) { 
2247          if (Utilities.noString(value))
2248            this.prefix = null;
2249          else {
2250            if (this.prefix == null)
2251              this.prefix = new StringType();
2252            this.prefix.setValue(value);
2253          }
2254          return this;
2255        }
2256
2257        /**
2258         * @return {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2259         */
2260        public StringType getTitleElement() { 
2261          if (this.title == null)
2262            if (Configuration.errorOnAutoCreate())
2263              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.title");
2264            else if (Configuration.doAutoCreate())
2265              this.title = new StringType(); // bb
2266          return this.title;
2267        }
2268
2269        public boolean hasTitleElement() { 
2270          return this.title != null && !this.title.isEmpty();
2271        }
2272
2273        public boolean hasTitle() { 
2274          return this.title != null && !this.title.isEmpty();
2275        }
2276
2277        /**
2278         * @param value {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2279         */
2280        public PlanDefinitionActionComponent setTitleElement(StringType value) { 
2281          this.title = value;
2282          return this;
2283        }
2284
2285        /**
2286         * @return The title of the action displayed to a user.
2287         */
2288        public String getTitle() { 
2289          return this.title == null ? null : this.title.getValue();
2290        }
2291
2292        /**
2293         * @param value The title of the action displayed to a user.
2294         */
2295        public PlanDefinitionActionComponent setTitle(String value) { 
2296          if (Utilities.noString(value))
2297            this.title = null;
2298          else {
2299            if (this.title == null)
2300              this.title = new StringType();
2301            this.title.setValue(value);
2302          }
2303          return this;
2304        }
2305
2306        /**
2307         * @return {@link #description} (A brief description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2308         */
2309        public StringType getDescriptionElement() { 
2310          if (this.description == null)
2311            if (Configuration.errorOnAutoCreate())
2312              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.description");
2313            else if (Configuration.doAutoCreate())
2314              this.description = new StringType(); // bb
2315          return this.description;
2316        }
2317
2318        public boolean hasDescriptionElement() { 
2319          return this.description != null && !this.description.isEmpty();
2320        }
2321
2322        public boolean hasDescription() { 
2323          return this.description != null && !this.description.isEmpty();
2324        }
2325
2326        /**
2327         * @param value {@link #description} (A brief description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2328         */
2329        public PlanDefinitionActionComponent setDescriptionElement(StringType value) { 
2330          this.description = value;
2331          return this;
2332        }
2333
2334        /**
2335         * @return A brief description of the action used to provide a summary to display to the user.
2336         */
2337        public String getDescription() { 
2338          return this.description == null ? null : this.description.getValue();
2339        }
2340
2341        /**
2342         * @param value A brief description of the action used to provide a summary to display to the user.
2343         */
2344        public PlanDefinitionActionComponent setDescription(String value) { 
2345          if (Utilities.noString(value))
2346            this.description = null;
2347          else {
2348            if (this.description == null)
2349              this.description = new StringType();
2350            this.description.setValue(value);
2351          }
2352          return this;
2353        }
2354
2355        /**
2356         * @return {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
2357         */
2358        public StringType getTextEquivalentElement() { 
2359          if (this.textEquivalent == null)
2360            if (Configuration.errorOnAutoCreate())
2361              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.textEquivalent");
2362            else if (Configuration.doAutoCreate())
2363              this.textEquivalent = new StringType(); // bb
2364          return this.textEquivalent;
2365        }
2366
2367        public boolean hasTextEquivalentElement() { 
2368          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
2369        }
2370
2371        public boolean hasTextEquivalent() { 
2372          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
2373        }
2374
2375        /**
2376         * @param value {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
2377         */
2378        public PlanDefinitionActionComponent setTextEquivalentElement(StringType value) { 
2379          this.textEquivalent = value;
2380          return this;
2381        }
2382
2383        /**
2384         * @return A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
2385         */
2386        public String getTextEquivalent() { 
2387          return this.textEquivalent == null ? null : this.textEquivalent.getValue();
2388        }
2389
2390        /**
2391         * @param value A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
2392         */
2393        public PlanDefinitionActionComponent setTextEquivalent(String value) { 
2394          if (Utilities.noString(value))
2395            this.textEquivalent = null;
2396          else {
2397            if (this.textEquivalent == null)
2398              this.textEquivalent = new StringType();
2399            this.textEquivalent.setValue(value);
2400          }
2401          return this;
2402        }
2403
2404        /**
2405         * @return {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2406         */
2407        public Enumeration<RequestPriority> getPriorityElement() { 
2408          if (this.priority == null)
2409            if (Configuration.errorOnAutoCreate())
2410              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.priority");
2411            else if (Configuration.doAutoCreate())
2412              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
2413          return this.priority;
2414        }
2415
2416        public boolean hasPriorityElement() { 
2417          return this.priority != null && !this.priority.isEmpty();
2418        }
2419
2420        public boolean hasPriority() { 
2421          return this.priority != null && !this.priority.isEmpty();
2422        }
2423
2424        /**
2425         * @param value {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2426         */
2427        public PlanDefinitionActionComponent setPriorityElement(Enumeration<RequestPriority> value) { 
2428          this.priority = value;
2429          return this;
2430        }
2431
2432        /**
2433         * @return Indicates how quickly the action should be addressed with respect to other actions.
2434         */
2435        public RequestPriority getPriority() { 
2436          return this.priority == null ? null : this.priority.getValue();
2437        }
2438
2439        /**
2440         * @param value Indicates how quickly the action should be addressed with respect to other actions.
2441         */
2442        public PlanDefinitionActionComponent setPriority(RequestPriority value) { 
2443          if (value == null)
2444            this.priority = null;
2445          else {
2446            if (this.priority == null)
2447              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
2448            this.priority.setValue(value);
2449          }
2450          return this;
2451        }
2452
2453        /**
2454         * @return {@link #code} (A code that provides meaning for the action or action group. For example, a section may have a LOINC code for the section of a documentation template.)
2455         */
2456        public List<CodeableConcept> getCode() { 
2457          if (this.code == null)
2458            this.code = new ArrayList<CodeableConcept>();
2459          return this.code;
2460        }
2461
2462        /**
2463         * @return Returns a reference to <code>this</code> for easy method chaining
2464         */
2465        public PlanDefinitionActionComponent setCode(List<CodeableConcept> theCode) { 
2466          this.code = theCode;
2467          return this;
2468        }
2469
2470        public boolean hasCode() { 
2471          if (this.code == null)
2472            return false;
2473          for (CodeableConcept item : this.code)
2474            if (!item.isEmpty())
2475              return true;
2476          return false;
2477        }
2478
2479        public CodeableConcept addCode() { //3
2480          CodeableConcept t = new CodeableConcept();
2481          if (this.code == null)
2482            this.code = new ArrayList<CodeableConcept>();
2483          this.code.add(t);
2484          return t;
2485        }
2486
2487        public PlanDefinitionActionComponent addCode(CodeableConcept t) { //3
2488          if (t == null)
2489            return this;
2490          if (this.code == null)
2491            this.code = new ArrayList<CodeableConcept>();
2492          this.code.add(t);
2493          return this;
2494        }
2495
2496        /**
2497         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
2498         */
2499        public CodeableConcept getCodeFirstRep() { 
2500          if (getCode().isEmpty()) {
2501            addCode();
2502          }
2503          return getCode().get(0);
2504        }
2505
2506        /**
2507         * @return {@link #reason} (A description of why this action is necessary or appropriate.)
2508         */
2509        public List<CodeableConcept> getReason() { 
2510          if (this.reason == null)
2511            this.reason = new ArrayList<CodeableConcept>();
2512          return this.reason;
2513        }
2514
2515        /**
2516         * @return Returns a reference to <code>this</code> for easy method chaining
2517         */
2518        public PlanDefinitionActionComponent setReason(List<CodeableConcept> theReason) { 
2519          this.reason = theReason;
2520          return this;
2521        }
2522
2523        public boolean hasReason() { 
2524          if (this.reason == null)
2525            return false;
2526          for (CodeableConcept item : this.reason)
2527            if (!item.isEmpty())
2528              return true;
2529          return false;
2530        }
2531
2532        public CodeableConcept addReason() { //3
2533          CodeableConcept t = new CodeableConcept();
2534          if (this.reason == null)
2535            this.reason = new ArrayList<CodeableConcept>();
2536          this.reason.add(t);
2537          return t;
2538        }
2539
2540        public PlanDefinitionActionComponent addReason(CodeableConcept t) { //3
2541          if (t == null)
2542            return this;
2543          if (this.reason == null)
2544            this.reason = new ArrayList<CodeableConcept>();
2545          this.reason.add(t);
2546          return this;
2547        }
2548
2549        /**
2550         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist
2551         */
2552        public CodeableConcept getReasonFirstRep() { 
2553          if (getReason().isEmpty()) {
2554            addReason();
2555          }
2556          return getReason().get(0);
2557        }
2558
2559        /**
2560         * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
2561         */
2562        public List<RelatedArtifact> getDocumentation() { 
2563          if (this.documentation == null)
2564            this.documentation = new ArrayList<RelatedArtifact>();
2565          return this.documentation;
2566        }
2567
2568        /**
2569         * @return Returns a reference to <code>this</code> for easy method chaining
2570         */
2571        public PlanDefinitionActionComponent setDocumentation(List<RelatedArtifact> theDocumentation) { 
2572          this.documentation = theDocumentation;
2573          return this;
2574        }
2575
2576        public boolean hasDocumentation() { 
2577          if (this.documentation == null)
2578            return false;
2579          for (RelatedArtifact item : this.documentation)
2580            if (!item.isEmpty())
2581              return true;
2582          return false;
2583        }
2584
2585        public RelatedArtifact addDocumentation() { //3
2586          RelatedArtifact t = new RelatedArtifact();
2587          if (this.documentation == null)
2588            this.documentation = new ArrayList<RelatedArtifact>();
2589          this.documentation.add(t);
2590          return t;
2591        }
2592
2593        public PlanDefinitionActionComponent addDocumentation(RelatedArtifact t) { //3
2594          if (t == null)
2595            return this;
2596          if (this.documentation == null)
2597            this.documentation = new ArrayList<RelatedArtifact>();
2598          this.documentation.add(t);
2599          return this;
2600        }
2601
2602        /**
2603         * @return The first repetition of repeating field {@link #documentation}, creating it if it does not already exist
2604         */
2605        public RelatedArtifact getDocumentationFirstRep() { 
2606          if (getDocumentation().isEmpty()) {
2607            addDocumentation();
2608          }
2609          return getDocumentation().get(0);
2610        }
2611
2612        /**
2613         * @return {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.)
2614         */
2615        public List<IdType> getGoalId() { 
2616          if (this.goalId == null)
2617            this.goalId = new ArrayList<IdType>();
2618          return this.goalId;
2619        }
2620
2621        /**
2622         * @return Returns a reference to <code>this</code> for easy method chaining
2623         */
2624        public PlanDefinitionActionComponent setGoalId(List<IdType> theGoalId) { 
2625          this.goalId = theGoalId;
2626          return this;
2627        }
2628
2629        public boolean hasGoalId() { 
2630          if (this.goalId == null)
2631            return false;
2632          for (IdType item : this.goalId)
2633            if (!item.isEmpty())
2634              return true;
2635          return false;
2636        }
2637
2638        /**
2639         * @return {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.)
2640         */
2641        public IdType addGoalIdElement() {//2 
2642          IdType t = new IdType();
2643          if (this.goalId == null)
2644            this.goalId = new ArrayList<IdType>();
2645          this.goalId.add(t);
2646          return t;
2647        }
2648
2649        /**
2650         * @param value {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.)
2651         */
2652        public PlanDefinitionActionComponent addGoalId(String value) { //1
2653          IdType t = new IdType();
2654          t.setValue(value);
2655          if (this.goalId == null)
2656            this.goalId = new ArrayList<IdType>();
2657          this.goalId.add(t);
2658          return this;
2659        }
2660
2661        /**
2662         * @param value {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.)
2663         */
2664        public boolean hasGoalId(String value) { 
2665          if (this.goalId == null)
2666            return false;
2667          for (IdType v : this.goalId)
2668            if (v.getValue().equals(value)) // id
2669              return true;
2670          return false;
2671        }
2672
2673        /**
2674         * @return {@link #trigger} (A description of when the action should be triggered.)
2675         */
2676        public List<TriggerDefinition> getTrigger() { 
2677          if (this.trigger == null)
2678            this.trigger = new ArrayList<TriggerDefinition>();
2679          return this.trigger;
2680        }
2681
2682        /**
2683         * @return Returns a reference to <code>this</code> for easy method chaining
2684         */
2685        public PlanDefinitionActionComponent setTrigger(List<TriggerDefinition> theTrigger) { 
2686          this.trigger = theTrigger;
2687          return this;
2688        }
2689
2690        public boolean hasTrigger() { 
2691          if (this.trigger == null)
2692            return false;
2693          for (TriggerDefinition item : this.trigger)
2694            if (!item.isEmpty())
2695              return true;
2696          return false;
2697        }
2698
2699        public TriggerDefinition addTrigger() { //3
2700          TriggerDefinition t = new TriggerDefinition();
2701          if (this.trigger == null)
2702            this.trigger = new ArrayList<TriggerDefinition>();
2703          this.trigger.add(t);
2704          return t;
2705        }
2706
2707        public PlanDefinitionActionComponent addTrigger(TriggerDefinition t) { //3
2708          if (t == null)
2709            return this;
2710          if (this.trigger == null)
2711            this.trigger = new ArrayList<TriggerDefinition>();
2712          this.trigger.add(t);
2713          return this;
2714        }
2715
2716        /**
2717         * @return The first repetition of repeating field {@link #trigger}, creating it if it does not already exist
2718         */
2719        public TriggerDefinition getTriggerFirstRep() { 
2720          if (getTrigger().isEmpty()) {
2721            addTrigger();
2722          }
2723          return getTrigger().get(0);
2724        }
2725
2726        /**
2727         * @return {@link #condition} (An expression that describes applicability criteria or start/stop conditions for the action.)
2728         */
2729        public List<PlanDefinitionActionConditionComponent> getCondition() { 
2730          if (this.condition == null)
2731            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2732          return this.condition;
2733        }
2734
2735        /**
2736         * @return Returns a reference to <code>this</code> for easy method chaining
2737         */
2738        public PlanDefinitionActionComponent setCondition(List<PlanDefinitionActionConditionComponent> theCondition) { 
2739          this.condition = theCondition;
2740          return this;
2741        }
2742
2743        public boolean hasCondition() { 
2744          if (this.condition == null)
2745            return false;
2746          for (PlanDefinitionActionConditionComponent item : this.condition)
2747            if (!item.isEmpty())
2748              return true;
2749          return false;
2750        }
2751
2752        public PlanDefinitionActionConditionComponent addCondition() { //3
2753          PlanDefinitionActionConditionComponent t = new PlanDefinitionActionConditionComponent();
2754          if (this.condition == null)
2755            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2756          this.condition.add(t);
2757          return t;
2758        }
2759
2760        public PlanDefinitionActionComponent addCondition(PlanDefinitionActionConditionComponent t) { //3
2761          if (t == null)
2762            return this;
2763          if (this.condition == null)
2764            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2765          this.condition.add(t);
2766          return this;
2767        }
2768
2769        /**
2770         * @return The first repetition of repeating field {@link #condition}, creating it if it does not already exist
2771         */
2772        public PlanDefinitionActionConditionComponent getConditionFirstRep() { 
2773          if (getCondition().isEmpty()) {
2774            addCondition();
2775          }
2776          return getCondition().get(0);
2777        }
2778
2779        /**
2780         * @return {@link #input} (Defines input data requirements for the action.)
2781         */
2782        public List<DataRequirement> getInput() { 
2783          if (this.input == null)
2784            this.input = new ArrayList<DataRequirement>();
2785          return this.input;
2786        }
2787
2788        /**
2789         * @return Returns a reference to <code>this</code> for easy method chaining
2790         */
2791        public PlanDefinitionActionComponent setInput(List<DataRequirement> theInput) { 
2792          this.input = theInput;
2793          return this;
2794        }
2795
2796        public boolean hasInput() { 
2797          if (this.input == null)
2798            return false;
2799          for (DataRequirement item : this.input)
2800            if (!item.isEmpty())
2801              return true;
2802          return false;
2803        }
2804
2805        public DataRequirement addInput() { //3
2806          DataRequirement t = new DataRequirement();
2807          if (this.input == null)
2808            this.input = new ArrayList<DataRequirement>();
2809          this.input.add(t);
2810          return t;
2811        }
2812
2813        public PlanDefinitionActionComponent addInput(DataRequirement t) { //3
2814          if (t == null)
2815            return this;
2816          if (this.input == null)
2817            this.input = new ArrayList<DataRequirement>();
2818          this.input.add(t);
2819          return this;
2820        }
2821
2822        /**
2823         * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist
2824         */
2825        public DataRequirement getInputFirstRep() { 
2826          if (getInput().isEmpty()) {
2827            addInput();
2828          }
2829          return getInput().get(0);
2830        }
2831
2832        /**
2833         * @return {@link #output} (Defines the outputs of the action, if any.)
2834         */
2835        public List<DataRequirement> getOutput() { 
2836          if (this.output == null)
2837            this.output = new ArrayList<DataRequirement>();
2838          return this.output;
2839        }
2840
2841        /**
2842         * @return Returns a reference to <code>this</code> for easy method chaining
2843         */
2844        public PlanDefinitionActionComponent setOutput(List<DataRequirement> theOutput) { 
2845          this.output = theOutput;
2846          return this;
2847        }
2848
2849        public boolean hasOutput() { 
2850          if (this.output == null)
2851            return false;
2852          for (DataRequirement item : this.output)
2853            if (!item.isEmpty())
2854              return true;
2855          return false;
2856        }
2857
2858        public DataRequirement addOutput() { //3
2859          DataRequirement t = new DataRequirement();
2860          if (this.output == null)
2861            this.output = new ArrayList<DataRequirement>();
2862          this.output.add(t);
2863          return t;
2864        }
2865
2866        public PlanDefinitionActionComponent addOutput(DataRequirement t) { //3
2867          if (t == null)
2868            return this;
2869          if (this.output == null)
2870            this.output = new ArrayList<DataRequirement>();
2871          this.output.add(t);
2872          return this;
2873        }
2874
2875        /**
2876         * @return The first repetition of repeating field {@link #output}, creating it if it does not already exist
2877         */
2878        public DataRequirement getOutputFirstRep() { 
2879          if (getOutput().isEmpty()) {
2880            addOutput();
2881          }
2882          return getOutput().get(0);
2883        }
2884
2885        /**
2886         * @return {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
2887         */
2888        public List<PlanDefinitionActionRelatedActionComponent> getRelatedAction() { 
2889          if (this.relatedAction == null)
2890            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2891          return this.relatedAction;
2892        }
2893
2894        /**
2895         * @return Returns a reference to <code>this</code> for easy method chaining
2896         */
2897        public PlanDefinitionActionComponent setRelatedAction(List<PlanDefinitionActionRelatedActionComponent> theRelatedAction) { 
2898          this.relatedAction = theRelatedAction;
2899          return this;
2900        }
2901
2902        public boolean hasRelatedAction() { 
2903          if (this.relatedAction == null)
2904            return false;
2905          for (PlanDefinitionActionRelatedActionComponent item : this.relatedAction)
2906            if (!item.isEmpty())
2907              return true;
2908          return false;
2909        }
2910
2911        public PlanDefinitionActionRelatedActionComponent addRelatedAction() { //3
2912          PlanDefinitionActionRelatedActionComponent t = new PlanDefinitionActionRelatedActionComponent();
2913          if (this.relatedAction == null)
2914            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2915          this.relatedAction.add(t);
2916          return t;
2917        }
2918
2919        public PlanDefinitionActionComponent addRelatedAction(PlanDefinitionActionRelatedActionComponent t) { //3
2920          if (t == null)
2921            return this;
2922          if (this.relatedAction == null)
2923            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2924          this.relatedAction.add(t);
2925          return this;
2926        }
2927
2928        /**
2929         * @return The first repetition of repeating field {@link #relatedAction}, creating it if it does not already exist
2930         */
2931        public PlanDefinitionActionRelatedActionComponent getRelatedActionFirstRep() { 
2932          if (getRelatedAction().isEmpty()) {
2933            addRelatedAction();
2934          }
2935          return getRelatedAction().get(0);
2936        }
2937
2938        /**
2939         * @return {@link #timing} (An optional value describing when the action should be performed.)
2940         */
2941        public Type getTiming() { 
2942          return this.timing;
2943        }
2944
2945        /**
2946         * @return {@link #timing} (An optional value describing when the action should be performed.)
2947         */
2948        public DateTimeType getTimingDateTimeType() throws FHIRException { 
2949          if (this.timing == null)
2950            return null;
2951          if (!(this.timing instanceof DateTimeType))
2952            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered");
2953          return (DateTimeType) this.timing;
2954        }
2955
2956        public boolean hasTimingDateTimeType() { 
2957          return this != null && this.timing instanceof DateTimeType;
2958        }
2959
2960        /**
2961         * @return {@link #timing} (An optional value describing when the action should be performed.)
2962         */
2963        public Age getTimingAge() throws FHIRException { 
2964          if (this.timing == null)
2965            return null;
2966          if (!(this.timing instanceof Age))
2967            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.timing.getClass().getName()+" was encountered");
2968          return (Age) this.timing;
2969        }
2970
2971        public boolean hasTimingAge() { 
2972          return this != null && this.timing instanceof Age;
2973        }
2974
2975        /**
2976         * @return {@link #timing} (An optional value describing when the action should be performed.)
2977         */
2978        public Period getTimingPeriod() throws FHIRException { 
2979          if (this.timing == null)
2980            return null;
2981          if (!(this.timing instanceof Period))
2982            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
2983          return (Period) this.timing;
2984        }
2985
2986        public boolean hasTimingPeriod() { 
2987          return this != null && this.timing instanceof Period;
2988        }
2989
2990        /**
2991         * @return {@link #timing} (An optional value describing when the action should be performed.)
2992         */
2993        public Duration getTimingDuration() throws FHIRException { 
2994          if (this.timing == null)
2995            return null;
2996          if (!(this.timing instanceof Duration))
2997            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.timing.getClass().getName()+" was encountered");
2998          return (Duration) this.timing;
2999        }
3000
3001        public boolean hasTimingDuration() { 
3002          return this != null && this.timing instanceof Duration;
3003        }
3004
3005        /**
3006         * @return {@link #timing} (An optional value describing when the action should be performed.)
3007         */
3008        public Range getTimingRange() throws FHIRException { 
3009          if (this.timing == null)
3010            return null;
3011          if (!(this.timing instanceof Range))
3012            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.timing.getClass().getName()+" was encountered");
3013          return (Range) this.timing;
3014        }
3015
3016        public boolean hasTimingRange() { 
3017          return this != null && this.timing instanceof Range;
3018        }
3019
3020        /**
3021         * @return {@link #timing} (An optional value describing when the action should be performed.)
3022         */
3023        public Timing getTimingTiming() throws FHIRException { 
3024          if (this.timing == null)
3025            return null;
3026          if (!(this.timing instanceof Timing))
3027            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
3028          return (Timing) this.timing;
3029        }
3030
3031        public boolean hasTimingTiming() { 
3032          return this != null && this.timing instanceof Timing;
3033        }
3034
3035        public boolean hasTiming() { 
3036          return this.timing != null && !this.timing.isEmpty();
3037        }
3038
3039        /**
3040         * @param value {@link #timing} (An optional value describing when the action should be performed.)
3041         */
3042        public PlanDefinitionActionComponent setTiming(Type value) { 
3043          if (value != null && !(value instanceof DateTimeType || value instanceof Age || value instanceof Period || value instanceof Duration || value instanceof Range || value instanceof Timing))
3044            throw new Error("Not the right type for PlanDefinition.action.timing[x]: "+value.fhirType());
3045          this.timing = value;
3046          return this;
3047        }
3048
3049        /**
3050         * @return {@link #participant} (Indicates who should participate in performing the action described.)
3051         */
3052        public List<PlanDefinitionActionParticipantComponent> getParticipant() { 
3053          if (this.participant == null)
3054            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
3055          return this.participant;
3056        }
3057
3058        /**
3059         * @return Returns a reference to <code>this</code> for easy method chaining
3060         */
3061        public PlanDefinitionActionComponent setParticipant(List<PlanDefinitionActionParticipantComponent> theParticipant) { 
3062          this.participant = theParticipant;
3063          return this;
3064        }
3065
3066        public boolean hasParticipant() { 
3067          if (this.participant == null)
3068            return false;
3069          for (PlanDefinitionActionParticipantComponent item : this.participant)
3070            if (!item.isEmpty())
3071              return true;
3072          return false;
3073        }
3074
3075        public PlanDefinitionActionParticipantComponent addParticipant() { //3
3076          PlanDefinitionActionParticipantComponent t = new PlanDefinitionActionParticipantComponent();
3077          if (this.participant == null)
3078            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
3079          this.participant.add(t);
3080          return t;
3081        }
3082
3083        public PlanDefinitionActionComponent addParticipant(PlanDefinitionActionParticipantComponent t) { //3
3084          if (t == null)
3085            return this;
3086          if (this.participant == null)
3087            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
3088          this.participant.add(t);
3089          return this;
3090        }
3091
3092        /**
3093         * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
3094         */
3095        public PlanDefinitionActionParticipantComponent getParticipantFirstRep() { 
3096          if (getParticipant().isEmpty()) {
3097            addParticipant();
3098          }
3099          return getParticipant().get(0);
3100        }
3101
3102        /**
3103         * @return {@link #type} (The type of action to perform (create, update, remove).)
3104         */
3105        public CodeableConcept getType() { 
3106          if (this.type == null)
3107            if (Configuration.errorOnAutoCreate())
3108              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.type");
3109            else if (Configuration.doAutoCreate())
3110              this.type = new CodeableConcept(); // cc
3111          return this.type;
3112        }
3113
3114        public boolean hasType() { 
3115          return this.type != null && !this.type.isEmpty();
3116        }
3117
3118        /**
3119         * @param value {@link #type} (The type of action to perform (create, update, remove).)
3120         */
3121        public PlanDefinitionActionComponent setType(CodeableConcept value) { 
3122          this.type = value;
3123          return this;
3124        }
3125
3126        /**
3127         * @return {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
3128         */
3129        public Enumeration<ActionGroupingBehavior> getGroupingBehaviorElement() { 
3130          if (this.groupingBehavior == null)
3131            if (Configuration.errorOnAutoCreate())
3132              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.groupingBehavior");
3133            else if (Configuration.doAutoCreate())
3134              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory()); // bb
3135          return this.groupingBehavior;
3136        }
3137
3138        public boolean hasGroupingBehaviorElement() { 
3139          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
3140        }
3141
3142        public boolean hasGroupingBehavior() { 
3143          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
3144        }
3145
3146        /**
3147         * @param value {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
3148         */
3149        public PlanDefinitionActionComponent setGroupingBehaviorElement(Enumeration<ActionGroupingBehavior> value) { 
3150          this.groupingBehavior = value;
3151          return this;
3152        }
3153
3154        /**
3155         * @return Defines the grouping behavior for the action and its children.
3156         */
3157        public ActionGroupingBehavior getGroupingBehavior() { 
3158          return this.groupingBehavior == null ? null : this.groupingBehavior.getValue();
3159        }
3160
3161        /**
3162         * @param value Defines the grouping behavior for the action and its children.
3163         */
3164        public PlanDefinitionActionComponent setGroupingBehavior(ActionGroupingBehavior value) { 
3165          if (value == null)
3166            this.groupingBehavior = null;
3167          else {
3168            if (this.groupingBehavior == null)
3169              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory());
3170            this.groupingBehavior.setValue(value);
3171          }
3172          return this;
3173        }
3174
3175        /**
3176         * @return {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
3177         */
3178        public Enumeration<ActionSelectionBehavior> getSelectionBehaviorElement() { 
3179          if (this.selectionBehavior == null)
3180            if (Configuration.errorOnAutoCreate())
3181              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.selectionBehavior");
3182            else if (Configuration.doAutoCreate())
3183              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory()); // bb
3184          return this.selectionBehavior;
3185        }
3186
3187        public boolean hasSelectionBehaviorElement() { 
3188          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
3189        }
3190
3191        public boolean hasSelectionBehavior() { 
3192          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
3193        }
3194
3195        /**
3196         * @param value {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
3197         */
3198        public PlanDefinitionActionComponent setSelectionBehaviorElement(Enumeration<ActionSelectionBehavior> value) { 
3199          this.selectionBehavior = value;
3200          return this;
3201        }
3202
3203        /**
3204         * @return Defines the selection behavior for the action and its children.
3205         */
3206        public ActionSelectionBehavior getSelectionBehavior() { 
3207          return this.selectionBehavior == null ? null : this.selectionBehavior.getValue();
3208        }
3209
3210        /**
3211         * @param value Defines the selection behavior for the action and its children.
3212         */
3213        public PlanDefinitionActionComponent setSelectionBehavior(ActionSelectionBehavior value) { 
3214          if (value == null)
3215            this.selectionBehavior = null;
3216          else {
3217            if (this.selectionBehavior == null)
3218              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory());
3219            this.selectionBehavior.setValue(value);
3220          }
3221          return this;
3222        }
3223
3224        /**
3225         * @return {@link #requiredBehavior} (Defines the required behavior for the action.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
3226         */
3227        public Enumeration<ActionRequiredBehavior> getRequiredBehaviorElement() { 
3228          if (this.requiredBehavior == null)
3229            if (Configuration.errorOnAutoCreate())
3230              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.requiredBehavior");
3231            else if (Configuration.doAutoCreate())
3232              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory()); // bb
3233          return this.requiredBehavior;
3234        }
3235
3236        public boolean hasRequiredBehaviorElement() { 
3237          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
3238        }
3239
3240        public boolean hasRequiredBehavior() { 
3241          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
3242        }
3243
3244        /**
3245         * @param value {@link #requiredBehavior} (Defines the required behavior for the action.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
3246         */
3247        public PlanDefinitionActionComponent setRequiredBehaviorElement(Enumeration<ActionRequiredBehavior> value) { 
3248          this.requiredBehavior = value;
3249          return this;
3250        }
3251
3252        /**
3253         * @return Defines the required behavior for the action.
3254         */
3255        public ActionRequiredBehavior getRequiredBehavior() { 
3256          return this.requiredBehavior == null ? null : this.requiredBehavior.getValue();
3257        }
3258
3259        /**
3260         * @param value Defines the required behavior for the action.
3261         */
3262        public PlanDefinitionActionComponent setRequiredBehavior(ActionRequiredBehavior value) { 
3263          if (value == null)
3264            this.requiredBehavior = null;
3265          else {
3266            if (this.requiredBehavior == null)
3267              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory());
3268            this.requiredBehavior.setValue(value);
3269          }
3270          return this;
3271        }
3272
3273        /**
3274         * @return {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
3275         */
3276        public Enumeration<ActionPrecheckBehavior> getPrecheckBehaviorElement() { 
3277          if (this.precheckBehavior == null)
3278            if (Configuration.errorOnAutoCreate())
3279              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.precheckBehavior");
3280            else if (Configuration.doAutoCreate())
3281              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory()); // bb
3282          return this.precheckBehavior;
3283        }
3284
3285        public boolean hasPrecheckBehaviorElement() { 
3286          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
3287        }
3288
3289        public boolean hasPrecheckBehavior() { 
3290          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
3291        }
3292
3293        /**
3294         * @param value {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
3295         */
3296        public PlanDefinitionActionComponent setPrecheckBehaviorElement(Enumeration<ActionPrecheckBehavior> value) { 
3297          this.precheckBehavior = value;
3298          return this;
3299        }
3300
3301        /**
3302         * @return Defines whether the action should usually be preselected.
3303         */
3304        public ActionPrecheckBehavior getPrecheckBehavior() { 
3305          return this.precheckBehavior == null ? null : this.precheckBehavior.getValue();
3306        }
3307
3308        /**
3309         * @param value Defines whether the action should usually be preselected.
3310         */
3311        public PlanDefinitionActionComponent setPrecheckBehavior(ActionPrecheckBehavior value) { 
3312          if (value == null)
3313            this.precheckBehavior = null;
3314          else {
3315            if (this.precheckBehavior == null)
3316              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory());
3317            this.precheckBehavior.setValue(value);
3318          }
3319          return this;
3320        }
3321
3322        /**
3323         * @return {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
3324         */
3325        public Enumeration<ActionCardinalityBehavior> getCardinalityBehaviorElement() { 
3326          if (this.cardinalityBehavior == null)
3327            if (Configuration.errorOnAutoCreate())
3328              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.cardinalityBehavior");
3329            else if (Configuration.doAutoCreate())
3330              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory()); // bb
3331          return this.cardinalityBehavior;
3332        }
3333
3334        public boolean hasCardinalityBehaviorElement() { 
3335          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
3336        }
3337
3338        public boolean hasCardinalityBehavior() { 
3339          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
3340        }
3341
3342        /**
3343         * @param value {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
3344         */
3345        public PlanDefinitionActionComponent setCardinalityBehaviorElement(Enumeration<ActionCardinalityBehavior> value) { 
3346          this.cardinalityBehavior = value;
3347          return this;
3348        }
3349
3350        /**
3351         * @return Defines whether the action can be selected multiple times.
3352         */
3353        public ActionCardinalityBehavior getCardinalityBehavior() { 
3354          return this.cardinalityBehavior == null ? null : this.cardinalityBehavior.getValue();
3355        }
3356
3357        /**
3358         * @param value Defines whether the action can be selected multiple times.
3359         */
3360        public PlanDefinitionActionComponent setCardinalityBehavior(ActionCardinalityBehavior value) { 
3361          if (value == null)
3362            this.cardinalityBehavior = null;
3363          else {
3364            if (this.cardinalityBehavior == null)
3365              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory());
3366            this.cardinalityBehavior.setValue(value);
3367          }
3368          return this;
3369        }
3370
3371        /**
3372         * @return {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
3373         */
3374        public CanonicalType getDefinitionElement() { 
3375          if (this.definition == null)
3376            if (Configuration.errorOnAutoCreate())
3377              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.definition");
3378            else if (Configuration.doAutoCreate())
3379              this.definition = new CanonicalType(); // bb
3380          return this.definition;
3381        }
3382
3383        public boolean hasDefinitionElement() { 
3384          return this.definition != null && !this.definition.isEmpty();
3385        }
3386
3387        public boolean hasDefinition() { 
3388          return this.definition != null && !this.definition.isEmpty();
3389        }
3390
3391        /**
3392         * @param value {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
3393         */
3394        public PlanDefinitionActionComponent setDefinitionElement(CanonicalType value) { 
3395          this.definition = value;
3396          return this;
3397        }
3398
3399        /**
3400         * @return A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.
3401         */
3402        public String getDefinition() { 
3403          return this.definition == null ? null : this.definition.getValue();
3404        }
3405
3406        /**
3407         * @param value A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.
3408         */
3409        public PlanDefinitionActionComponent setDefinition(String value) { 
3410          if (Utilities.noString(value))
3411            this.definition = null;
3412          else {
3413            if (this.definition == null)
3414              this.definition = new CanonicalType();
3415            this.definition.setValue(value);
3416          }
3417          return this;
3418        }
3419
3420        /**
3421         * @return {@link #transform} (A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
3422         */
3423        public CanonicalType getTransformElement() { 
3424          if (this.transform == null)
3425            if (Configuration.errorOnAutoCreate())
3426              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.transform");
3427            else if (Configuration.doAutoCreate())
3428              this.transform = new CanonicalType(); // bb
3429          return this.transform;
3430        }
3431
3432        public boolean hasTransformElement() { 
3433          return this.transform != null && !this.transform.isEmpty();
3434        }
3435
3436        public boolean hasTransform() { 
3437          return this.transform != null && !this.transform.isEmpty();
3438        }
3439
3440        /**
3441         * @param value {@link #transform} (A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
3442         */
3443        public PlanDefinitionActionComponent setTransformElement(CanonicalType value) { 
3444          this.transform = value;
3445          return this;
3446        }
3447
3448        /**
3449         * @return A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
3450         */
3451        public String getTransform() { 
3452          return this.transform == null ? null : this.transform.getValue();
3453        }
3454
3455        /**
3456         * @param value A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
3457         */
3458        public PlanDefinitionActionComponent setTransform(String value) { 
3459          if (Utilities.noString(value))
3460            this.transform = null;
3461          else {
3462            if (this.transform == null)
3463              this.transform = new CanonicalType();
3464            this.transform.setValue(value);
3465          }
3466          return this;
3467        }
3468
3469        /**
3470         * @return {@link #dynamicValue} (Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.)
3471         */
3472        public List<PlanDefinitionActionDynamicValueComponent> getDynamicValue() { 
3473          if (this.dynamicValue == null)
3474            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3475          return this.dynamicValue;
3476        }
3477
3478        /**
3479         * @return Returns a reference to <code>this</code> for easy method chaining
3480         */
3481        public PlanDefinitionActionComponent setDynamicValue(List<PlanDefinitionActionDynamicValueComponent> theDynamicValue) { 
3482          this.dynamicValue = theDynamicValue;
3483          return this;
3484        }
3485
3486        public boolean hasDynamicValue() { 
3487          if (this.dynamicValue == null)
3488            return false;
3489          for (PlanDefinitionActionDynamicValueComponent item : this.dynamicValue)
3490            if (!item.isEmpty())
3491              return true;
3492          return false;
3493        }
3494
3495        public PlanDefinitionActionDynamicValueComponent addDynamicValue() { //3
3496          PlanDefinitionActionDynamicValueComponent t = new PlanDefinitionActionDynamicValueComponent();
3497          if (this.dynamicValue == null)
3498            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3499          this.dynamicValue.add(t);
3500          return t;
3501        }
3502
3503        public PlanDefinitionActionComponent addDynamicValue(PlanDefinitionActionDynamicValueComponent t) { //3
3504          if (t == null)
3505            return this;
3506          if (this.dynamicValue == null)
3507            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3508          this.dynamicValue.add(t);
3509          return this;
3510        }
3511
3512        /**
3513         * @return The first repetition of repeating field {@link #dynamicValue}, creating it if it does not already exist
3514         */
3515        public PlanDefinitionActionDynamicValueComponent getDynamicValueFirstRep() { 
3516          if (getDynamicValue().isEmpty()) {
3517            addDynamicValue();
3518          }
3519          return getDynamicValue().get(0);
3520        }
3521
3522        /**
3523         * @return {@link #action} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
3524         */
3525        public List<PlanDefinitionActionComponent> getAction() { 
3526          if (this.action == null)
3527            this.action = new ArrayList<PlanDefinitionActionComponent>();
3528          return this.action;
3529        }
3530
3531        /**
3532         * @return Returns a reference to <code>this</code> for easy method chaining
3533         */
3534        public PlanDefinitionActionComponent setAction(List<PlanDefinitionActionComponent> theAction) { 
3535          this.action = theAction;
3536          return this;
3537        }
3538
3539        public boolean hasAction() { 
3540          if (this.action == null)
3541            return false;
3542          for (PlanDefinitionActionComponent item : this.action)
3543            if (!item.isEmpty())
3544              return true;
3545          return false;
3546        }
3547
3548        public PlanDefinitionActionComponent addAction() { //3
3549          PlanDefinitionActionComponent t = new PlanDefinitionActionComponent();
3550          if (this.action == null)
3551            this.action = new ArrayList<PlanDefinitionActionComponent>();
3552          this.action.add(t);
3553          return t;
3554        }
3555
3556        public PlanDefinitionActionComponent addAction(PlanDefinitionActionComponent t) { //3
3557          if (t == null)
3558            return this;
3559          if (this.action == null)
3560            this.action = new ArrayList<PlanDefinitionActionComponent>();
3561          this.action.add(t);
3562          return this;
3563        }
3564
3565        /**
3566         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
3567         */
3568        public PlanDefinitionActionComponent getActionFirstRep() { 
3569          if (getAction().isEmpty()) {
3570            addAction();
3571          }
3572          return getAction().get(0);
3573        }
3574
3575        protected void listChildren(List<Property> children) {
3576          super.listChildren(children);
3577          children.add(new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix));
3578          children.add(new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title));
3579          children.add(new Property("description", "string", "A brief description of the action used to provide a summary to display to the user.", 0, 1, description));
3580          children.add(new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent));
3581          children.add(new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority));
3582          children.add(new Property("code", "CodeableConcept", "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for the section of a documentation template.", 0, java.lang.Integer.MAX_VALUE, code));
3583          children.add(new Property("reason", "CodeableConcept", "A description of why this action is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, reason));
3584          children.add(new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
3585          children.add(new Property("goalId", "id", "Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.", 0, java.lang.Integer.MAX_VALUE, goalId));
3586          children.add(new Property("trigger", "TriggerDefinition", "A description of when the action should be triggered.", 0, java.lang.Integer.MAX_VALUE, trigger));
3587          children.add(new Property("condition", "", "An expression that describes applicability criteria or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition));
3588          children.add(new Property("input", "DataRequirement", "Defines input data requirements for the action.", 0, java.lang.Integer.MAX_VALUE, input));
3589          children.add(new Property("output", "DataRequirement", "Defines the outputs of the action, if any.", 0, java.lang.Integer.MAX_VALUE, output));
3590          children.add(new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction));
3591          children.add(new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing));
3592          children.add(new Property("participant", "", "Indicates who should participate in performing the action described.", 0, java.lang.Integer.MAX_VALUE, participant));
3593          children.add(new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type));
3594          children.add(new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior));
3595          children.add(new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior));
3596          children.add(new Property("requiredBehavior", "code", "Defines the required behavior for the action.", 0, 1, requiredBehavior));
3597          children.add(new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior));
3598          children.add(new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior));
3599          children.add(new Property("definition", "canonical(ActivityDefinition|PlanDefinition|Questionnaire)", "A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.", 0, 1, definition));
3600          children.add(new Property("transform", "canonical(StructureMap)", "A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.", 0, 1, transform));
3601          children.add(new Property("dynamicValue", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, dynamicValue));
3602          children.add(new Property("action", "@PlanDefinition.action", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action));
3603        }
3604
3605        @Override
3606        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3607          switch (_hash) {
3608          case -980110702: /*prefix*/  return new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix);
3609          case 110371416: /*title*/  return new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title);
3610          case -1724546052: /*description*/  return new Property("description", "string", "A brief description of the action used to provide a summary to display to the user.", 0, 1, description);
3611          case -900391049: /*textEquivalent*/  return new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent);
3612          case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority);
3613          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for the section of a documentation template.", 0, java.lang.Integer.MAX_VALUE, code);
3614          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "A description of why this action is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, reason);
3615          case 1587405498: /*documentation*/  return new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation);
3616          case -1240658034: /*goalId*/  return new Property("goalId", "id", "Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.", 0, java.lang.Integer.MAX_VALUE, goalId);
3617          case -1059891784: /*trigger*/  return new Property("trigger", "TriggerDefinition", "A description of when the action should be triggered.", 0, java.lang.Integer.MAX_VALUE, trigger);
3618          case -861311717: /*condition*/  return new Property("condition", "", "An expression that describes applicability criteria or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition);
3619          case 100358090: /*input*/  return new Property("input", "DataRequirement", "Defines input data requirements for the action.", 0, java.lang.Integer.MAX_VALUE, input);
3620          case -1005512447: /*output*/  return new Property("output", "DataRequirement", "Defines the outputs of the action, if any.", 0, java.lang.Integer.MAX_VALUE, output);
3621          case -384107967: /*relatedAction*/  return new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction);
3622          case 164632566: /*timing[x]*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3623          case -873664438: /*timing*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3624          case -1837458939: /*timingDateTime*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3625          case 164607061: /*timingAge*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3626          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3627          case -1327253506: /*timingDuration*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3628          case -710871277: /*timingRange*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3629          case -497554124: /*timingTiming*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3630          case 767422259: /*participant*/  return new Property("participant", "", "Indicates who should participate in performing the action described.", 0, java.lang.Integer.MAX_VALUE, participant);
3631          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type);
3632          case 586678389: /*groupingBehavior*/  return new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior);
3633          case 168639486: /*selectionBehavior*/  return new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior);
3634          case -1163906287: /*requiredBehavior*/  return new Property("requiredBehavior", "code", "Defines the required behavior for the action.", 0, 1, requiredBehavior);
3635          case -1174249033: /*precheckBehavior*/  return new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior);
3636          case -922577408: /*cardinalityBehavior*/  return new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior);
3637          case -1014418093: /*definition*/  return new Property("definition", "canonical(ActivityDefinition|PlanDefinition|Questionnaire)", "A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.", 0, 1, definition);
3638          case 1052666732: /*transform*/  return new Property("transform", "canonical(StructureMap)", "A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.", 0, 1, transform);
3639          case 572625010: /*dynamicValue*/  return new Property("dynamicValue", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, dynamicValue);
3640          case -1422950858: /*action*/  return new Property("action", "@PlanDefinition.action", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action);
3641          default: return super.getNamedProperty(_hash, _name, _checkValid);
3642          }
3643
3644        }
3645
3646      @Override
3647      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3648        switch (hash) {
3649        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
3650        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3651        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3652        case -900391049: /*textEquivalent*/ return this.textEquivalent == null ? new Base[0] : new Base[] {this.textEquivalent}; // StringType
3653        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
3654        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
3655        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
3656        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
3657        case -1240658034: /*goalId*/ return this.goalId == null ? new Base[0] : this.goalId.toArray(new Base[this.goalId.size()]); // IdType
3658        case -1059891784: /*trigger*/ return this.trigger == null ? new Base[0] : this.trigger.toArray(new Base[this.trigger.size()]); // TriggerDefinition
3659        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // PlanDefinitionActionConditionComponent
3660        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // DataRequirement
3661        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // DataRequirement
3662        case -384107967: /*relatedAction*/ return this.relatedAction == null ? new Base[0] : this.relatedAction.toArray(new Base[this.relatedAction.size()]); // PlanDefinitionActionRelatedActionComponent
3663        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
3664        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // PlanDefinitionActionParticipantComponent
3665        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3666        case 586678389: /*groupingBehavior*/ return this.groupingBehavior == null ? new Base[0] : new Base[] {this.groupingBehavior}; // Enumeration<ActionGroupingBehavior>
3667        case 168639486: /*selectionBehavior*/ return this.selectionBehavior == null ? new Base[0] : new Base[] {this.selectionBehavior}; // Enumeration<ActionSelectionBehavior>
3668        case -1163906287: /*requiredBehavior*/ return this.requiredBehavior == null ? new Base[0] : new Base[] {this.requiredBehavior}; // Enumeration<ActionRequiredBehavior>
3669        case -1174249033: /*precheckBehavior*/ return this.precheckBehavior == null ? new Base[0] : new Base[] {this.precheckBehavior}; // Enumeration<ActionPrecheckBehavior>
3670        case -922577408: /*cardinalityBehavior*/ return this.cardinalityBehavior == null ? new Base[0] : new Base[] {this.cardinalityBehavior}; // Enumeration<ActionCardinalityBehavior>
3671        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // CanonicalType
3672        case 1052666732: /*transform*/ return this.transform == null ? new Base[0] : new Base[] {this.transform}; // CanonicalType
3673        case 572625010: /*dynamicValue*/ return this.dynamicValue == null ? new Base[0] : this.dynamicValue.toArray(new Base[this.dynamicValue.size()]); // PlanDefinitionActionDynamicValueComponent
3674        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // PlanDefinitionActionComponent
3675        default: return super.getProperty(hash, name, checkValid);
3676        }
3677
3678      }
3679
3680      @Override
3681      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3682        switch (hash) {
3683        case -980110702: // prefix
3684          this.prefix = castToString(value); // StringType
3685          return value;
3686        case 110371416: // title
3687          this.title = castToString(value); // StringType
3688          return value;
3689        case -1724546052: // description
3690          this.description = castToString(value); // StringType
3691          return value;
3692        case -900391049: // textEquivalent
3693          this.textEquivalent = castToString(value); // StringType
3694          return value;
3695        case -1165461084: // priority
3696          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
3697          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3698          return value;
3699        case 3059181: // code
3700          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
3701          return value;
3702        case -934964668: // reason
3703          this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
3704          return value;
3705        case 1587405498: // documentation
3706          this.getDocumentation().add(castToRelatedArtifact(value)); // RelatedArtifact
3707          return value;
3708        case -1240658034: // goalId
3709          this.getGoalId().add(castToId(value)); // IdType
3710          return value;
3711        case -1059891784: // trigger
3712          this.getTrigger().add(castToTriggerDefinition(value)); // TriggerDefinition
3713          return value;
3714        case -861311717: // condition
3715          this.getCondition().add((PlanDefinitionActionConditionComponent) value); // PlanDefinitionActionConditionComponent
3716          return value;
3717        case 100358090: // input
3718          this.getInput().add(castToDataRequirement(value)); // DataRequirement
3719          return value;
3720        case -1005512447: // output
3721          this.getOutput().add(castToDataRequirement(value)); // DataRequirement
3722          return value;
3723        case -384107967: // relatedAction
3724          this.getRelatedAction().add((PlanDefinitionActionRelatedActionComponent) value); // PlanDefinitionActionRelatedActionComponent
3725          return value;
3726        case -873664438: // timing
3727          this.timing = castToType(value); // Type
3728          return value;
3729        case 767422259: // participant
3730          this.getParticipant().add((PlanDefinitionActionParticipantComponent) value); // PlanDefinitionActionParticipantComponent
3731          return value;
3732        case 3575610: // type
3733          this.type = castToCodeableConcept(value); // CodeableConcept
3734          return value;
3735        case 586678389: // groupingBehavior
3736          value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
3737          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
3738          return value;
3739        case 168639486: // selectionBehavior
3740          value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
3741          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
3742          return value;
3743        case -1163906287: // requiredBehavior
3744          value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
3745          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
3746          return value;
3747        case -1174249033: // precheckBehavior
3748          value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
3749          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
3750          return value;
3751        case -922577408: // cardinalityBehavior
3752          value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
3753          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
3754          return value;
3755        case -1014418093: // definition
3756          this.definition = castToCanonical(value); // CanonicalType
3757          return value;
3758        case 1052666732: // transform
3759          this.transform = castToCanonical(value); // CanonicalType
3760          return value;
3761        case 572625010: // dynamicValue
3762          this.getDynamicValue().add((PlanDefinitionActionDynamicValueComponent) value); // PlanDefinitionActionDynamicValueComponent
3763          return value;
3764        case -1422950858: // action
3765          this.getAction().add((PlanDefinitionActionComponent) value); // PlanDefinitionActionComponent
3766          return value;
3767        default: return super.setProperty(hash, name, value);
3768        }
3769
3770      }
3771
3772      @Override
3773      public Base setProperty(String name, Base value) throws FHIRException {
3774        if (name.equals("prefix")) {
3775          this.prefix = castToString(value); // StringType
3776        } else if (name.equals("title")) {
3777          this.title = castToString(value); // StringType
3778        } else if (name.equals("description")) {
3779          this.description = castToString(value); // StringType
3780        } else if (name.equals("textEquivalent")) {
3781          this.textEquivalent = castToString(value); // StringType
3782        } else if (name.equals("priority")) {
3783          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
3784          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3785        } else if (name.equals("code")) {
3786          this.getCode().add(castToCodeableConcept(value));
3787        } else if (name.equals("reason")) {
3788          this.getReason().add(castToCodeableConcept(value));
3789        } else if (name.equals("documentation")) {
3790          this.getDocumentation().add(castToRelatedArtifact(value));
3791        } else if (name.equals("goalId")) {
3792          this.getGoalId().add(castToId(value));
3793        } else if (name.equals("trigger")) {
3794          this.getTrigger().add(castToTriggerDefinition(value));
3795        } else if (name.equals("condition")) {
3796          this.getCondition().add((PlanDefinitionActionConditionComponent) value);
3797        } else if (name.equals("input")) {
3798          this.getInput().add(castToDataRequirement(value));
3799        } else if (name.equals("output")) {
3800          this.getOutput().add(castToDataRequirement(value));
3801        } else if (name.equals("relatedAction")) {
3802          this.getRelatedAction().add((PlanDefinitionActionRelatedActionComponent) value);
3803        } else if (name.equals("timing[x]")) {
3804          this.timing = castToType(value); // Type
3805        } else if (name.equals("participant")) {
3806          this.getParticipant().add((PlanDefinitionActionParticipantComponent) value);
3807        } else if (name.equals("type")) {
3808          this.type = castToCodeableConcept(value); // CodeableConcept
3809        } else if (name.equals("groupingBehavior")) {
3810          value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
3811          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
3812        } else if (name.equals("selectionBehavior")) {
3813          value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
3814          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
3815        } else if (name.equals("requiredBehavior")) {
3816          value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
3817          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
3818        } else if (name.equals("precheckBehavior")) {
3819          value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
3820          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
3821        } else if (name.equals("cardinalityBehavior")) {
3822          value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
3823          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
3824        } else if (name.equals("definition")) {
3825          this.definition = castToCanonical(value); // CanonicalType
3826        } else if (name.equals("transform")) {
3827          this.transform = castToCanonical(value); // CanonicalType
3828        } else if (name.equals("dynamicValue")) {
3829          this.getDynamicValue().add((PlanDefinitionActionDynamicValueComponent) value);
3830        } else if (name.equals("action")) {
3831          this.getAction().add((PlanDefinitionActionComponent) value);
3832        } else
3833          return super.setProperty(name, value);
3834        return value;
3835      }
3836
3837      @Override
3838      public Base makeProperty(int hash, String name) throws FHIRException {
3839        switch (hash) {
3840        case -980110702:  return getPrefixElement();
3841        case 110371416:  return getTitleElement();
3842        case -1724546052:  return getDescriptionElement();
3843        case -900391049:  return getTextEquivalentElement();
3844        case -1165461084:  return getPriorityElement();
3845        case 3059181:  return addCode(); 
3846        case -934964668:  return addReason(); 
3847        case 1587405498:  return addDocumentation(); 
3848        case -1240658034:  return addGoalIdElement();
3849        case -1059891784:  return addTrigger(); 
3850        case -861311717:  return addCondition(); 
3851        case 100358090:  return addInput(); 
3852        case -1005512447:  return addOutput(); 
3853        case -384107967:  return addRelatedAction(); 
3854        case 164632566:  return getTiming(); 
3855        case -873664438:  return getTiming(); 
3856        case 767422259:  return addParticipant(); 
3857        case 3575610:  return getType(); 
3858        case 586678389:  return getGroupingBehaviorElement();
3859        case 168639486:  return getSelectionBehaviorElement();
3860        case -1163906287:  return getRequiredBehaviorElement();
3861        case -1174249033:  return getPrecheckBehaviorElement();
3862        case -922577408:  return getCardinalityBehaviorElement();
3863        case -1014418093:  return getDefinitionElement();
3864        case 1052666732:  return getTransformElement();
3865        case 572625010:  return addDynamicValue(); 
3866        case -1422950858:  return addAction(); 
3867        default: return super.makeProperty(hash, name);
3868        }
3869
3870      }
3871
3872      @Override
3873      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3874        switch (hash) {
3875        case -980110702: /*prefix*/ return new String[] {"string"};
3876        case 110371416: /*title*/ return new String[] {"string"};
3877        case -1724546052: /*description*/ return new String[] {"string"};
3878        case -900391049: /*textEquivalent*/ return new String[] {"string"};
3879        case -1165461084: /*priority*/ return new String[] {"code"};
3880        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3881        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
3882        case 1587405498: /*documentation*/ return new String[] {"RelatedArtifact"};
3883        case -1240658034: /*goalId*/ return new String[] {"id"};
3884        case -1059891784: /*trigger*/ return new String[] {"TriggerDefinition"};
3885        case -861311717: /*condition*/ return new String[] {};
3886        case 100358090: /*input*/ return new String[] {"DataRequirement"};
3887        case -1005512447: /*output*/ return new String[] {"DataRequirement"};
3888        case -384107967: /*relatedAction*/ return new String[] {};
3889        case -873664438: /*timing*/ return new String[] {"dateTime", "Age", "Period", "Duration", "Range", "Timing"};
3890        case 767422259: /*participant*/ return new String[] {};
3891        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3892        case 586678389: /*groupingBehavior*/ return new String[] {"code"};
3893        case 168639486: /*selectionBehavior*/ return new String[] {"code"};
3894        case -1163906287: /*requiredBehavior*/ return new String[] {"code"};
3895        case -1174249033: /*precheckBehavior*/ return new String[] {"code"};
3896        case -922577408: /*cardinalityBehavior*/ return new String[] {"code"};
3897        case -1014418093: /*definition*/ return new String[] {"canonical"};
3898        case 1052666732: /*transform*/ return new String[] {"canonical"};
3899        case 572625010: /*dynamicValue*/ return new String[] {};
3900        case -1422950858: /*action*/ return new String[] {"@PlanDefinition.action"};
3901        default: return super.getTypesForProperty(hash, name);
3902        }
3903
3904      }
3905
3906      @Override
3907      public Base addChild(String name) throws FHIRException {
3908        if (name.equals("prefix")) {
3909          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.prefix");
3910        }
3911        else if (name.equals("title")) {
3912          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.title");
3913        }
3914        else if (name.equals("description")) {
3915          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.description");
3916        }
3917        else if (name.equals("textEquivalent")) {
3918          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.textEquivalent");
3919        }
3920        else if (name.equals("priority")) {
3921          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.priority");
3922        }
3923        else if (name.equals("code")) {
3924          return addCode();
3925        }
3926        else if (name.equals("reason")) {
3927          return addReason();
3928        }
3929        else if (name.equals("documentation")) {
3930          return addDocumentation();
3931        }
3932        else if (name.equals("goalId")) {
3933          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.goalId");
3934        }
3935        else if (name.equals("trigger")) {
3936          return addTrigger();
3937        }
3938        else if (name.equals("condition")) {
3939          return addCondition();
3940        }
3941        else if (name.equals("input")) {
3942          return addInput();
3943        }
3944        else if (name.equals("output")) {
3945          return addOutput();
3946        }
3947        else if (name.equals("relatedAction")) {
3948          return addRelatedAction();
3949        }
3950        else if (name.equals("timingDateTime")) {
3951          this.timing = new DateTimeType();
3952          return this.timing;
3953        }
3954        else if (name.equals("timingAge")) {
3955          this.timing = new Age();
3956          return this.timing;
3957        }
3958        else if (name.equals("timingPeriod")) {
3959          this.timing = new Period();
3960          return this.timing;
3961        }
3962        else if (name.equals("timingDuration")) {
3963          this.timing = new Duration();
3964          return this.timing;
3965        }
3966        else if (name.equals("timingRange")) {
3967          this.timing = new Range();
3968          return this.timing;
3969        }
3970        else if (name.equals("timingTiming")) {
3971          this.timing = new Timing();
3972          return this.timing;
3973        }
3974        else if (name.equals("participant")) {
3975          return addParticipant();
3976        }
3977        else if (name.equals("type")) {
3978          this.type = new CodeableConcept();
3979          return this.type;
3980        }
3981        else if (name.equals("groupingBehavior")) {
3982          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.groupingBehavior");
3983        }
3984        else if (name.equals("selectionBehavior")) {
3985          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.selectionBehavior");
3986        }
3987        else if (name.equals("requiredBehavior")) {
3988          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.requiredBehavior");
3989        }
3990        else if (name.equals("precheckBehavior")) {
3991          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.precheckBehavior");
3992        }
3993        else if (name.equals("cardinalityBehavior")) {
3994          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.cardinalityBehavior");
3995        }
3996        else if (name.equals("definition")) {
3997          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.definition");
3998        }
3999        else if (name.equals("transform")) {
4000          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.transform");
4001        }
4002        else if (name.equals("dynamicValue")) {
4003          return addDynamicValue();
4004        }
4005        else if (name.equals("action")) {
4006          return addAction();
4007        }
4008        else
4009          return super.addChild(name);
4010      }
4011
4012      public PlanDefinitionActionComponent copy() {
4013        PlanDefinitionActionComponent dst = new PlanDefinitionActionComponent();
4014        copyValues(dst);
4015        dst.prefix = prefix == null ? null : prefix.copy();
4016        dst.title = title == null ? null : title.copy();
4017        dst.description = description == null ? null : description.copy();
4018        dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
4019        dst.priority = priority == null ? null : priority.copy();
4020        if (code != null) {
4021          dst.code = new ArrayList<CodeableConcept>();
4022          for (CodeableConcept i : code)
4023            dst.code.add(i.copy());
4024        };
4025        if (reason != null) {
4026          dst.reason = new ArrayList<CodeableConcept>();
4027          for (CodeableConcept i : reason)
4028            dst.reason.add(i.copy());
4029        };
4030        if (documentation != null) {
4031          dst.documentation = new ArrayList<RelatedArtifact>();
4032          for (RelatedArtifact i : documentation)
4033            dst.documentation.add(i.copy());
4034        };
4035        if (goalId != null) {
4036          dst.goalId = new ArrayList<IdType>();
4037          for (IdType i : goalId)
4038            dst.goalId.add(i.copy());
4039        };
4040        if (trigger != null) {
4041          dst.trigger = new ArrayList<TriggerDefinition>();
4042          for (TriggerDefinition i : trigger)
4043            dst.trigger.add(i.copy());
4044        };
4045        if (condition != null) {
4046          dst.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
4047          for (PlanDefinitionActionConditionComponent i : condition)
4048            dst.condition.add(i.copy());
4049        };
4050        if (input != null) {
4051          dst.input = new ArrayList<DataRequirement>();
4052          for (DataRequirement i : input)
4053            dst.input.add(i.copy());
4054        };
4055        if (output != null) {
4056          dst.output = new ArrayList<DataRequirement>();
4057          for (DataRequirement i : output)
4058            dst.output.add(i.copy());
4059        };
4060        if (relatedAction != null) {
4061          dst.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
4062          for (PlanDefinitionActionRelatedActionComponent i : relatedAction)
4063            dst.relatedAction.add(i.copy());
4064        };
4065        dst.timing = timing == null ? null : timing.copy();
4066        if (participant != null) {
4067          dst.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
4068          for (PlanDefinitionActionParticipantComponent i : participant)
4069            dst.participant.add(i.copy());
4070        };
4071        dst.type = type == null ? null : type.copy();
4072        dst.groupingBehavior = groupingBehavior == null ? null : groupingBehavior.copy();
4073        dst.selectionBehavior = selectionBehavior == null ? null : selectionBehavior.copy();
4074        dst.requiredBehavior = requiredBehavior == null ? null : requiredBehavior.copy();
4075        dst.precheckBehavior = precheckBehavior == null ? null : precheckBehavior.copy();
4076        dst.cardinalityBehavior = cardinalityBehavior == null ? null : cardinalityBehavior.copy();
4077        dst.definition = definition == null ? null : definition.copy();
4078        dst.transform = transform == null ? null : transform.copy();
4079        if (dynamicValue != null) {
4080          dst.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
4081          for (PlanDefinitionActionDynamicValueComponent i : dynamicValue)
4082            dst.dynamicValue.add(i.copy());
4083        };
4084        if (action != null) {
4085          dst.action = new ArrayList<PlanDefinitionActionComponent>();
4086          for (PlanDefinitionActionComponent i : action)
4087            dst.action.add(i.copy());
4088        };
4089        return dst;
4090      }
4091
4092      @Override
4093      public boolean equalsDeep(Base other_) {
4094        if (!super.equalsDeep(other_))
4095          return false;
4096        if (!(other_ instanceof PlanDefinitionActionComponent))
4097          return false;
4098        PlanDefinitionActionComponent o = (PlanDefinitionActionComponent) other_;
4099        return compareDeep(prefix, o.prefix, true) && compareDeep(title, o.title, true) && compareDeep(description, o.description, true)
4100           && compareDeep(textEquivalent, o.textEquivalent, true) && compareDeep(priority, o.priority, true)
4101           && compareDeep(code, o.code, true) && compareDeep(reason, o.reason, true) && compareDeep(documentation, o.documentation, true)
4102           && compareDeep(goalId, o.goalId, true) && compareDeep(trigger, o.trigger, true) && compareDeep(condition, o.condition, true)
4103           && compareDeep(input, o.input, true) && compareDeep(output, o.output, true) && compareDeep(relatedAction, o.relatedAction, true)
4104           && compareDeep(timing, o.timing, true) && compareDeep(participant, o.participant, true) && compareDeep(type, o.type, true)
4105           && compareDeep(groupingBehavior, o.groupingBehavior, true) && compareDeep(selectionBehavior, o.selectionBehavior, true)
4106           && compareDeep(requiredBehavior, o.requiredBehavior, true) && compareDeep(precheckBehavior, o.precheckBehavior, true)
4107           && compareDeep(cardinalityBehavior, o.cardinalityBehavior, true) && compareDeep(definition, o.definition, true)
4108           && compareDeep(transform, o.transform, true) && compareDeep(dynamicValue, o.dynamicValue, true)
4109           && compareDeep(action, o.action, true);
4110      }
4111
4112      @Override
4113      public boolean equalsShallow(Base other_) {
4114        if (!super.equalsShallow(other_))
4115          return false;
4116        if (!(other_ instanceof PlanDefinitionActionComponent))
4117          return false;
4118        PlanDefinitionActionComponent o = (PlanDefinitionActionComponent) other_;
4119        return compareValues(prefix, o.prefix, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
4120           && compareValues(textEquivalent, o.textEquivalent, true) && compareValues(priority, o.priority, true)
4121           && compareValues(goalId, o.goalId, true) && compareValues(groupingBehavior, o.groupingBehavior, true)
4122           && compareValues(selectionBehavior, o.selectionBehavior, true) && compareValues(requiredBehavior, o.requiredBehavior, true)
4123           && compareValues(precheckBehavior, o.precheckBehavior, true) && compareValues(cardinalityBehavior, o.cardinalityBehavior, true)
4124          ;
4125      }
4126
4127      public boolean isEmpty() {
4128        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(prefix, title, description
4129          , textEquivalent, priority, code, reason, documentation, goalId, trigger, condition
4130          , input, output, relatedAction, timing, participant, type, groupingBehavior, selectionBehavior
4131          , requiredBehavior, precheckBehavior, cardinalityBehavior, definition, transform, dynamicValue
4132          , action);
4133      }
4134
4135  public String fhirType() {
4136    return "PlanDefinition.action";
4137
4138  }
4139
4140  }
4141
4142    @Block()
4143    public static class PlanDefinitionActionConditionComponent extends BackboneElement implements IBaseBackboneElement {
4144        /**
4145         * The kind of condition.
4146         */
4147        @Child(name = "kind", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4148        @Description(shortDefinition="applicability | start | stop", formalDefinition="The kind of condition." )
4149        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-condition-kind")
4150        protected Enumeration<ActionConditionKind> kind;
4151
4152        /**
4153         * An expression that returns true or false, indicating whether the condition is satisfied.
4154         */
4155        @Child(name = "expression", type = {Expression.class}, order=2, min=0, max=1, modifier=false, summary=false)
4156        @Description(shortDefinition="Boolean-valued expression", formalDefinition="An expression that returns true or false, indicating whether the condition is satisfied." )
4157        protected Expression expression;
4158
4159        private static final long serialVersionUID = -455150438L;
4160
4161    /**
4162     * Constructor
4163     */
4164      public PlanDefinitionActionConditionComponent() {
4165        super();
4166      }
4167
4168    /**
4169     * Constructor
4170     */
4171      public PlanDefinitionActionConditionComponent(Enumeration<ActionConditionKind> kind) {
4172        super();
4173        this.kind = kind;
4174      }
4175
4176        /**
4177         * @return {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
4178         */
4179        public Enumeration<ActionConditionKind> getKindElement() { 
4180          if (this.kind == null)
4181            if (Configuration.errorOnAutoCreate())
4182              throw new Error("Attempt to auto-create PlanDefinitionActionConditionComponent.kind");
4183            else if (Configuration.doAutoCreate())
4184              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory()); // bb
4185          return this.kind;
4186        }
4187
4188        public boolean hasKindElement() { 
4189          return this.kind != null && !this.kind.isEmpty();
4190        }
4191
4192        public boolean hasKind() { 
4193          return this.kind != null && !this.kind.isEmpty();
4194        }
4195
4196        /**
4197         * @param value {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
4198         */
4199        public PlanDefinitionActionConditionComponent setKindElement(Enumeration<ActionConditionKind> value) { 
4200          this.kind = value;
4201          return this;
4202        }
4203
4204        /**
4205         * @return The kind of condition.
4206         */
4207        public ActionConditionKind getKind() { 
4208          return this.kind == null ? null : this.kind.getValue();
4209        }
4210
4211        /**
4212         * @param value The kind of condition.
4213         */
4214        public PlanDefinitionActionConditionComponent setKind(ActionConditionKind value) { 
4215            if (this.kind == null)
4216              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory());
4217            this.kind.setValue(value);
4218          return this;
4219        }
4220
4221        /**
4222         * @return {@link #expression} (An expression that returns true or false, indicating whether the condition is satisfied.)
4223         */
4224        public Expression getExpression() { 
4225          if (this.expression == null)
4226            if (Configuration.errorOnAutoCreate())
4227              throw new Error("Attempt to auto-create PlanDefinitionActionConditionComponent.expression");
4228            else if (Configuration.doAutoCreate())
4229              this.expression = new Expression(); // cc
4230          return this.expression;
4231        }
4232
4233        public boolean hasExpression() { 
4234          return this.expression != null && !this.expression.isEmpty();
4235        }
4236
4237        /**
4238         * @param value {@link #expression} (An expression that returns true or false, indicating whether the condition is satisfied.)
4239         */
4240        public PlanDefinitionActionConditionComponent setExpression(Expression value) { 
4241          this.expression = value;
4242          return this;
4243        }
4244
4245        protected void listChildren(List<Property> children) {
4246          super.listChildren(children);
4247          children.add(new Property("kind", "code", "The kind of condition.", 0, 1, kind));
4248          children.add(new Property("expression", "Expression", "An expression that returns true or false, indicating whether the condition is satisfied.", 0, 1, expression));
4249        }
4250
4251        @Override
4252        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4253          switch (_hash) {
4254          case 3292052: /*kind*/  return new Property("kind", "code", "The kind of condition.", 0, 1, kind);
4255          case -1795452264: /*expression*/  return new Property("expression", "Expression", "An expression that returns true or false, indicating whether the condition is satisfied.", 0, 1, expression);
4256          default: return super.getNamedProperty(_hash, _name, _checkValid);
4257          }
4258
4259        }
4260
4261      @Override
4262      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4263        switch (hash) {
4264        case 3292052: /*kind*/ return this.kind == null ? new Base[0] : new Base[] {this.kind}; // Enumeration<ActionConditionKind>
4265        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
4266        default: return super.getProperty(hash, name, checkValid);
4267        }
4268
4269      }
4270
4271      @Override
4272      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4273        switch (hash) {
4274        case 3292052: // kind
4275          value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
4276          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
4277          return value;
4278        case -1795452264: // expression
4279          this.expression = castToExpression(value); // Expression
4280          return value;
4281        default: return super.setProperty(hash, name, value);
4282        }
4283
4284      }
4285
4286      @Override
4287      public Base setProperty(String name, Base value) throws FHIRException {
4288        if (name.equals("kind")) {
4289          value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
4290          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
4291        } else if (name.equals("expression")) {
4292          this.expression = castToExpression(value); // Expression
4293        } else
4294          return super.setProperty(name, value);
4295        return value;
4296      }
4297
4298      @Override
4299      public Base makeProperty(int hash, String name) throws FHIRException {
4300        switch (hash) {
4301        case 3292052:  return getKindElement();
4302        case -1795452264:  return getExpression(); 
4303        default: return super.makeProperty(hash, name);
4304        }
4305
4306      }
4307
4308      @Override
4309      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4310        switch (hash) {
4311        case 3292052: /*kind*/ return new String[] {"code"};
4312        case -1795452264: /*expression*/ return new String[] {"Expression"};
4313        default: return super.getTypesForProperty(hash, name);
4314        }
4315
4316      }
4317
4318      @Override
4319      public Base addChild(String name) throws FHIRException {
4320        if (name.equals("kind")) {
4321          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.kind");
4322        }
4323        else if (name.equals("expression")) {
4324          this.expression = new Expression();
4325          return this.expression;
4326        }
4327        else
4328          return super.addChild(name);
4329      }
4330
4331      public PlanDefinitionActionConditionComponent copy() {
4332        PlanDefinitionActionConditionComponent dst = new PlanDefinitionActionConditionComponent();
4333        copyValues(dst);
4334        dst.kind = kind == null ? null : kind.copy();
4335        dst.expression = expression == null ? null : expression.copy();
4336        return dst;
4337      }
4338
4339      @Override
4340      public boolean equalsDeep(Base other_) {
4341        if (!super.equalsDeep(other_))
4342          return false;
4343        if (!(other_ instanceof PlanDefinitionActionConditionComponent))
4344          return false;
4345        PlanDefinitionActionConditionComponent o = (PlanDefinitionActionConditionComponent) other_;
4346        return compareDeep(kind, o.kind, true) && compareDeep(expression, o.expression, true);
4347      }
4348
4349      @Override
4350      public boolean equalsShallow(Base other_) {
4351        if (!super.equalsShallow(other_))
4352          return false;
4353        if (!(other_ instanceof PlanDefinitionActionConditionComponent))
4354          return false;
4355        PlanDefinitionActionConditionComponent o = (PlanDefinitionActionConditionComponent) other_;
4356        return compareValues(kind, o.kind, true);
4357      }
4358
4359      public boolean isEmpty() {
4360        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, expression);
4361      }
4362
4363  public String fhirType() {
4364    return "PlanDefinition.action.condition";
4365
4366  }
4367
4368  }
4369
4370    @Block()
4371    public static class PlanDefinitionActionRelatedActionComponent extends BackboneElement implements IBaseBackboneElement {
4372        /**
4373         * The element id of the related action.
4374         */
4375        @Child(name = "actionId", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4376        @Description(shortDefinition="What action is this related to", formalDefinition="The element id of the related action." )
4377        protected IdType actionId;
4378
4379        /**
4380         * The relationship of this action to the related action.
4381         */
4382        @Child(name = "relationship", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
4383        @Description(shortDefinition="before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end", formalDefinition="The relationship of this action to the related action." )
4384        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-relationship-type")
4385        protected Enumeration<ActionRelationshipType> relationship;
4386
4387        /**
4388         * A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.
4389         */
4390        @Child(name = "offset", type = {Duration.class, Range.class}, order=3, min=0, max=1, modifier=false, summary=false)
4391        @Description(shortDefinition="Time offset for the relationship", formalDefinition="A duration or range of durations to apply to the relationship. For example, 30-60 minutes before." )
4392        protected Type offset;
4393
4394        private static final long serialVersionUID = 1063306770L;
4395
4396    /**
4397     * Constructor
4398     */
4399      public PlanDefinitionActionRelatedActionComponent() {
4400        super();
4401      }
4402
4403    /**
4404     * Constructor
4405     */
4406      public PlanDefinitionActionRelatedActionComponent(IdType actionId, Enumeration<ActionRelationshipType> relationship) {
4407        super();
4408        this.actionId = actionId;
4409        this.relationship = relationship;
4410      }
4411
4412        /**
4413         * @return {@link #actionId} (The element id of the related action.). This is the underlying object with id, value and extensions. The accessor "getActionId" gives direct access to the value
4414         */
4415        public IdType getActionIdElement() { 
4416          if (this.actionId == null)
4417            if (Configuration.errorOnAutoCreate())
4418              throw new Error("Attempt to auto-create PlanDefinitionActionRelatedActionComponent.actionId");
4419            else if (Configuration.doAutoCreate())
4420              this.actionId = new IdType(); // bb
4421          return this.actionId;
4422        }
4423
4424        public boolean hasActionIdElement() { 
4425          return this.actionId != null && !this.actionId.isEmpty();
4426        }
4427
4428        public boolean hasActionId() { 
4429          return this.actionId != null && !this.actionId.isEmpty();
4430        }
4431
4432        /**
4433         * @param value {@link #actionId} (The element id of the related action.). This is the underlying object with id, value and extensions. The accessor "getActionId" gives direct access to the value
4434         */
4435        public PlanDefinitionActionRelatedActionComponent setActionIdElement(IdType value) { 
4436          this.actionId = value;
4437          return this;
4438        }
4439
4440        /**
4441         * @return The element id of the related action.
4442         */
4443        public String getActionId() { 
4444          return this.actionId == null ? null : this.actionId.getValue();
4445        }
4446
4447        /**
4448         * @param value The element id of the related action.
4449         */
4450        public PlanDefinitionActionRelatedActionComponent setActionId(String value) { 
4451            if (this.actionId == null)
4452              this.actionId = new IdType();
4453            this.actionId.setValue(value);
4454          return this;
4455        }
4456
4457        /**
4458         * @return {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
4459         */
4460        public Enumeration<ActionRelationshipType> getRelationshipElement() { 
4461          if (this.relationship == null)
4462            if (Configuration.errorOnAutoCreate())
4463              throw new Error("Attempt to auto-create PlanDefinitionActionRelatedActionComponent.relationship");
4464            else if (Configuration.doAutoCreate())
4465              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory()); // bb
4466          return this.relationship;
4467        }
4468
4469        public boolean hasRelationshipElement() { 
4470          return this.relationship != null && !this.relationship.isEmpty();
4471        }
4472
4473        public boolean hasRelationship() { 
4474          return this.relationship != null && !this.relationship.isEmpty();
4475        }
4476
4477        /**
4478         * @param value {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
4479         */
4480        public PlanDefinitionActionRelatedActionComponent setRelationshipElement(Enumeration<ActionRelationshipType> value) { 
4481          this.relationship = value;
4482          return this;
4483        }
4484
4485        /**
4486         * @return The relationship of this action to the related action.
4487         */
4488        public ActionRelationshipType getRelationship() { 
4489          return this.relationship == null ? null : this.relationship.getValue();
4490        }
4491
4492        /**
4493         * @param value The relationship of this action to the related action.
4494         */
4495        public PlanDefinitionActionRelatedActionComponent setRelationship(ActionRelationshipType value) { 
4496            if (this.relationship == null)
4497              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory());
4498            this.relationship.setValue(value);
4499          return this;
4500        }
4501
4502        /**
4503         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4504         */
4505        public Type getOffset() { 
4506          return this.offset;
4507        }
4508
4509        /**
4510         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4511         */
4512        public Duration getOffsetDuration() throws FHIRException { 
4513          if (this.offset == null)
4514            return null;
4515          if (!(this.offset instanceof Duration))
4516            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.offset.getClass().getName()+" was encountered");
4517          return (Duration) this.offset;
4518        }
4519
4520        public boolean hasOffsetDuration() { 
4521          return this != null && this.offset instanceof Duration;
4522        }
4523
4524        /**
4525         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4526         */
4527        public Range getOffsetRange() throws FHIRException { 
4528          if (this.offset == null)
4529            return null;
4530          if (!(this.offset instanceof Range))
4531            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.offset.getClass().getName()+" was encountered");
4532          return (Range) this.offset;
4533        }
4534
4535        public boolean hasOffsetRange() { 
4536          return this != null && this.offset instanceof Range;
4537        }
4538
4539        public boolean hasOffset() { 
4540          return this.offset != null && !this.offset.isEmpty();
4541        }
4542
4543        /**
4544         * @param value {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4545         */
4546        public PlanDefinitionActionRelatedActionComponent setOffset(Type value) { 
4547          if (value != null && !(value instanceof Duration || value instanceof Range))
4548            throw new Error("Not the right type for PlanDefinition.action.relatedAction.offset[x]: "+value.fhirType());
4549          this.offset = value;
4550          return this;
4551        }
4552
4553        protected void listChildren(List<Property> children) {
4554          super.listChildren(children);
4555          children.add(new Property("actionId", "id", "The element id of the related action.", 0, 1, actionId));
4556          children.add(new Property("relationship", "code", "The relationship of this action to the related action.", 0, 1, relationship));
4557          children.add(new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset));
4558        }
4559
4560        @Override
4561        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4562          switch (_hash) {
4563          case -1656172047: /*actionId*/  return new Property("actionId", "id", "The element id of the related action.", 0, 1, actionId);
4564          case -261851592: /*relationship*/  return new Property("relationship", "code", "The relationship of this action to the related action.", 0, 1, relationship);
4565          case -1960684787: /*offset[x]*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
4566          case -1019779949: /*offset*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
4567          case 134075207: /*offsetDuration*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
4568          case 1263585386: /*offsetRange*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
4569          default: return super.getNamedProperty(_hash, _name, _checkValid);
4570          }
4571
4572        }
4573
4574      @Override
4575      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4576        switch (hash) {
4577        case -1656172047: /*actionId*/ return this.actionId == null ? new Base[0] : new Base[] {this.actionId}; // IdType
4578        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Enumeration<ActionRelationshipType>
4579        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // Type
4580        default: return super.getProperty(hash, name, checkValid);
4581        }
4582
4583      }
4584
4585      @Override
4586      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4587        switch (hash) {
4588        case -1656172047: // actionId
4589          this.actionId = castToId(value); // IdType
4590          return value;
4591        case -261851592: // relationship
4592          value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
4593          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
4594          return value;
4595        case -1019779949: // offset
4596          this.offset = castToType(value); // Type
4597          return value;
4598        default: return super.setProperty(hash, name, value);
4599        }
4600
4601      }
4602
4603      @Override
4604      public Base setProperty(String name, Base value) throws FHIRException {
4605        if (name.equals("actionId")) {
4606          this.actionId = castToId(value); // IdType
4607        } else if (name.equals("relationship")) {
4608          value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
4609          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
4610        } else if (name.equals("offset[x]")) {
4611          this.offset = castToType(value); // Type
4612        } else
4613          return super.setProperty(name, value);
4614        return value;
4615      }
4616
4617      @Override
4618      public Base makeProperty(int hash, String name) throws FHIRException {
4619        switch (hash) {
4620        case -1656172047:  return getActionIdElement();
4621        case -261851592:  return getRelationshipElement();
4622        case -1960684787:  return getOffset(); 
4623        case -1019779949:  return getOffset(); 
4624        default: return super.makeProperty(hash, name);
4625        }
4626
4627      }
4628
4629      @Override
4630      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4631        switch (hash) {
4632        case -1656172047: /*actionId*/ return new String[] {"id"};
4633        case -261851592: /*relationship*/ return new String[] {"code"};
4634        case -1019779949: /*offset*/ return new String[] {"Duration", "Range"};
4635        default: return super.getTypesForProperty(hash, name);
4636        }
4637
4638      }
4639
4640      @Override
4641      public Base addChild(String name) throws FHIRException {
4642        if (name.equals("actionId")) {
4643          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.actionId");
4644        }
4645        else if (name.equals("relationship")) {
4646          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.relationship");
4647        }
4648        else if (name.equals("offsetDuration")) {
4649          this.offset = new Duration();
4650          return this.offset;
4651        }
4652        else if (name.equals("offsetRange")) {
4653          this.offset = new Range();
4654          return this.offset;
4655        }
4656        else
4657          return super.addChild(name);
4658      }
4659
4660      public PlanDefinitionActionRelatedActionComponent copy() {
4661        PlanDefinitionActionRelatedActionComponent dst = new PlanDefinitionActionRelatedActionComponent();
4662        copyValues(dst);
4663        dst.actionId = actionId == null ? null : actionId.copy();
4664        dst.relationship = relationship == null ? null : relationship.copy();
4665        dst.offset = offset == null ? null : offset.copy();
4666        return dst;
4667      }
4668
4669      @Override
4670      public boolean equalsDeep(Base other_) {
4671        if (!super.equalsDeep(other_))
4672          return false;
4673        if (!(other_ instanceof PlanDefinitionActionRelatedActionComponent))
4674          return false;
4675        PlanDefinitionActionRelatedActionComponent o = (PlanDefinitionActionRelatedActionComponent) other_;
4676        return compareDeep(actionId, o.actionId, true) && compareDeep(relationship, o.relationship, true)
4677           && compareDeep(offset, o.offset, true);
4678      }
4679
4680      @Override
4681      public boolean equalsShallow(Base other_) {
4682        if (!super.equalsShallow(other_))
4683          return false;
4684        if (!(other_ instanceof PlanDefinitionActionRelatedActionComponent))
4685          return false;
4686        PlanDefinitionActionRelatedActionComponent o = (PlanDefinitionActionRelatedActionComponent) other_;
4687        return compareValues(actionId, o.actionId, true) && compareValues(relationship, o.relationship, true)
4688          ;
4689      }
4690
4691      public boolean isEmpty() {
4692        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actionId, relationship, offset
4693          );
4694      }
4695
4696  public String fhirType() {
4697    return "PlanDefinition.action.relatedAction";
4698
4699  }
4700
4701  }
4702
4703    @Block()
4704    public static class PlanDefinitionActionParticipantComponent extends BackboneElement implements IBaseBackboneElement {
4705        /**
4706         * The type of participant in the action.
4707         */
4708        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4709        @Description(shortDefinition="patient | practitioner | related-person | device", formalDefinition="The type of participant in the action." )
4710        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-participant-type")
4711        protected Enumeration<ActionParticipantType> type;
4712
4713        /**
4714         * The role the participant should play in performing the described action.
4715         */
4716        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
4717        @Description(shortDefinition="E.g. Nurse, Surgeon, Parent", formalDefinition="The role the participant should play in performing the described action." )
4718        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-participant-role")
4719        protected CodeableConcept role;
4720
4721        private static final long serialVersionUID = -1152013659L;
4722
4723    /**
4724     * Constructor
4725     */
4726      public PlanDefinitionActionParticipantComponent() {
4727        super();
4728      }
4729
4730    /**
4731     * Constructor
4732     */
4733      public PlanDefinitionActionParticipantComponent(Enumeration<ActionParticipantType> type) {
4734        super();
4735        this.type = type;
4736      }
4737
4738        /**
4739         * @return {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
4740         */
4741        public Enumeration<ActionParticipantType> getTypeElement() { 
4742          if (this.type == null)
4743            if (Configuration.errorOnAutoCreate())
4744              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.type");
4745            else if (Configuration.doAutoCreate())
4746              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory()); // bb
4747          return this.type;
4748        }
4749
4750        public boolean hasTypeElement() { 
4751          return this.type != null && !this.type.isEmpty();
4752        }
4753
4754        public boolean hasType() { 
4755          return this.type != null && !this.type.isEmpty();
4756        }
4757
4758        /**
4759         * @param value {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
4760         */
4761        public PlanDefinitionActionParticipantComponent setTypeElement(Enumeration<ActionParticipantType> value) { 
4762          this.type = value;
4763          return this;
4764        }
4765
4766        /**
4767         * @return The type of participant in the action.
4768         */
4769        public ActionParticipantType getType() { 
4770          return this.type == null ? null : this.type.getValue();
4771        }
4772
4773        /**
4774         * @param value The type of participant in the action.
4775         */
4776        public PlanDefinitionActionParticipantComponent setType(ActionParticipantType value) { 
4777            if (this.type == null)
4778              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory());
4779            this.type.setValue(value);
4780          return this;
4781        }
4782
4783        /**
4784         * @return {@link #role} (The role the participant should play in performing the described action.)
4785         */
4786        public CodeableConcept getRole() { 
4787          if (this.role == null)
4788            if (Configuration.errorOnAutoCreate())
4789              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.role");
4790            else if (Configuration.doAutoCreate())
4791              this.role = new CodeableConcept(); // cc
4792          return this.role;
4793        }
4794
4795        public boolean hasRole() { 
4796          return this.role != null && !this.role.isEmpty();
4797        }
4798
4799        /**
4800         * @param value {@link #role} (The role the participant should play in performing the described action.)
4801         */
4802        public PlanDefinitionActionParticipantComponent setRole(CodeableConcept value) { 
4803          this.role = value;
4804          return this;
4805        }
4806
4807        protected void listChildren(List<Property> children) {
4808          super.listChildren(children);
4809          children.add(new Property("type", "code", "The type of participant in the action.", 0, 1, type));
4810          children.add(new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role));
4811        }
4812
4813        @Override
4814        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4815          switch (_hash) {
4816          case 3575610: /*type*/  return new Property("type", "code", "The type of participant in the action.", 0, 1, type);
4817          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role);
4818          default: return super.getNamedProperty(_hash, _name, _checkValid);
4819          }
4820
4821        }
4822
4823      @Override
4824      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4825        switch (hash) {
4826        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ActionParticipantType>
4827        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
4828        default: return super.getProperty(hash, name, checkValid);
4829        }
4830
4831      }
4832
4833      @Override
4834      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4835        switch (hash) {
4836        case 3575610: // type
4837          value = new ActionParticipantTypeEnumFactory().fromType(castToCode(value));
4838          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
4839          return value;
4840        case 3506294: // role
4841          this.role = castToCodeableConcept(value); // CodeableConcept
4842          return value;
4843        default: return super.setProperty(hash, name, value);
4844        }
4845
4846      }
4847
4848      @Override
4849      public Base setProperty(String name, Base value) throws FHIRException {
4850        if (name.equals("type")) {
4851          value = new ActionParticipantTypeEnumFactory().fromType(castToCode(value));
4852          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
4853        } else if (name.equals("role")) {
4854          this.role = castToCodeableConcept(value); // CodeableConcept
4855        } else
4856          return super.setProperty(name, value);
4857        return value;
4858      }
4859
4860      @Override
4861      public Base makeProperty(int hash, String name) throws FHIRException {
4862        switch (hash) {
4863        case 3575610:  return getTypeElement();
4864        case 3506294:  return getRole(); 
4865        default: return super.makeProperty(hash, name);
4866        }
4867
4868      }
4869
4870      @Override
4871      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4872        switch (hash) {
4873        case 3575610: /*type*/ return new String[] {"code"};
4874        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
4875        default: return super.getTypesForProperty(hash, name);
4876        }
4877
4878      }
4879
4880      @Override
4881      public Base addChild(String name) throws FHIRException {
4882        if (name.equals("type")) {
4883          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.type");
4884        }
4885        else if (name.equals("role")) {
4886          this.role = new CodeableConcept();
4887          return this.role;
4888        }
4889        else
4890          return super.addChild(name);
4891      }
4892
4893      public PlanDefinitionActionParticipantComponent copy() {
4894        PlanDefinitionActionParticipantComponent dst = new PlanDefinitionActionParticipantComponent();
4895        copyValues(dst);
4896        dst.type = type == null ? null : type.copy();
4897        dst.role = role == null ? null : role.copy();
4898        return dst;
4899      }
4900
4901      @Override
4902      public boolean equalsDeep(Base other_) {
4903        if (!super.equalsDeep(other_))
4904          return false;
4905        if (!(other_ instanceof PlanDefinitionActionParticipantComponent))
4906          return false;
4907        PlanDefinitionActionParticipantComponent o = (PlanDefinitionActionParticipantComponent) other_;
4908        return compareDeep(type, o.type, true) && compareDeep(role, o.role, true);
4909      }
4910
4911      @Override
4912      public boolean equalsShallow(Base other_) {
4913        if (!super.equalsShallow(other_))
4914          return false;
4915        if (!(other_ instanceof PlanDefinitionActionParticipantComponent))
4916          return false;
4917        PlanDefinitionActionParticipantComponent o = (PlanDefinitionActionParticipantComponent) other_;
4918        return compareValues(type, o.type, true);
4919      }
4920
4921      public boolean isEmpty() {
4922        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, role);
4923      }
4924
4925  public String fhirType() {
4926    return "PlanDefinition.action.participant";
4927
4928  }
4929
4930  }
4931
4932    @Block()
4933    public static class PlanDefinitionActionDynamicValueComponent extends BackboneElement implements IBaseBackboneElement {
4934        /**
4935         * The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
4936         */
4937        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
4938        @Description(shortDefinition="The path to the element to be set dynamically", formalDefinition="The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression." )
4939        protected StringType path;
4940
4941        /**
4942         * An expression specifying the value of the customized element.
4943         */
4944        @Child(name = "expression", type = {Expression.class}, order=2, min=0, max=1, modifier=false, summary=false)
4945        @Description(shortDefinition="An expression that provides the dynamic value for the customization", formalDefinition="An expression specifying the value of the customized element." )
4946        protected Expression expression;
4947
4948        private static final long serialVersionUID = 1064529082L;
4949
4950    /**
4951     * Constructor
4952     */
4953      public PlanDefinitionActionDynamicValueComponent() {
4954        super();
4955      }
4956
4957        /**
4958         * @return {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
4959         */
4960        public StringType getPathElement() { 
4961          if (this.path == null)
4962            if (Configuration.errorOnAutoCreate())
4963              throw new Error("Attempt to auto-create PlanDefinitionActionDynamicValueComponent.path");
4964            else if (Configuration.doAutoCreate())
4965              this.path = new StringType(); // bb
4966          return this.path;
4967        }
4968
4969        public boolean hasPathElement() { 
4970          return this.path != null && !this.path.isEmpty();
4971        }
4972
4973        public boolean hasPath() { 
4974          return this.path != null && !this.path.isEmpty();
4975        }
4976
4977        /**
4978         * @param value {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
4979         */
4980        public PlanDefinitionActionDynamicValueComponent setPathElement(StringType value) { 
4981          this.path = value;
4982          return this;
4983        }
4984
4985        /**
4986         * @return The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
4987         */
4988        public String getPath() { 
4989          return this.path == null ? null : this.path.getValue();
4990        }
4991
4992        /**
4993         * @param value The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
4994         */
4995        public PlanDefinitionActionDynamicValueComponent setPath(String value) { 
4996          if (Utilities.noString(value))
4997            this.path = null;
4998          else {
4999            if (this.path == null)
5000              this.path = new StringType();
5001            this.path.setValue(value);
5002          }
5003          return this;
5004        }
5005
5006        /**
5007         * @return {@link #expression} (An expression specifying the value of the customized element.)
5008         */
5009        public Expression getExpression() { 
5010          if (this.expression == null)
5011            if (Configuration.errorOnAutoCreate())
5012              throw new Error("Attempt to auto-create PlanDefinitionActionDynamicValueComponent.expression");
5013            else if (Configuration.doAutoCreate())
5014              this.expression = new Expression(); // cc
5015          return this.expression;
5016        }
5017
5018        public boolean hasExpression() { 
5019          return this.expression != null && !this.expression.isEmpty();
5020        }
5021
5022        /**
5023         * @param value {@link #expression} (An expression specifying the value of the customized element.)
5024         */
5025        public PlanDefinitionActionDynamicValueComponent setExpression(Expression value) { 
5026          this.expression = value;
5027          return this;
5028        }
5029
5030        protected void listChildren(List<Property> children) {
5031          super.listChildren(children);
5032          children.add(new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.", 0, 1, path));
5033          children.add(new Property("expression", "Expression", "An expression specifying the value of the customized element.", 0, 1, expression));
5034        }
5035
5036        @Override
5037        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5038          switch (_hash) {
5039          case 3433509: /*path*/  return new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.", 0, 1, path);
5040          case -1795452264: /*expression*/  return new Property("expression", "Expression", "An expression specifying the value of the customized element.", 0, 1, expression);
5041          default: return super.getNamedProperty(_hash, _name, _checkValid);
5042          }
5043
5044        }
5045
5046      @Override
5047      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5048        switch (hash) {
5049        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
5050        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
5051        default: return super.getProperty(hash, name, checkValid);
5052        }
5053
5054      }
5055
5056      @Override
5057      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5058        switch (hash) {
5059        case 3433509: // path
5060          this.path = castToString(value); // StringType
5061          return value;
5062        case -1795452264: // expression
5063          this.expression = castToExpression(value); // Expression
5064          return value;
5065        default: return super.setProperty(hash, name, value);
5066        }
5067
5068      }
5069
5070      @Override
5071      public Base setProperty(String name, Base value) throws FHIRException {
5072        if (name.equals("path")) {
5073          this.path = castToString(value); // StringType
5074        } else if (name.equals("expression")) {
5075          this.expression = castToExpression(value); // Expression
5076        } else
5077          return super.setProperty(name, value);
5078        return value;
5079      }
5080
5081      @Override
5082      public Base makeProperty(int hash, String name) throws FHIRException {
5083        switch (hash) {
5084        case 3433509:  return getPathElement();
5085        case -1795452264:  return getExpression(); 
5086        default: return super.makeProperty(hash, name);
5087        }
5088
5089      }
5090
5091      @Override
5092      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5093        switch (hash) {
5094        case 3433509: /*path*/ return new String[] {"string"};
5095        case -1795452264: /*expression*/ return new String[] {"Expression"};
5096        default: return super.getTypesForProperty(hash, name);
5097        }
5098
5099      }
5100
5101      @Override
5102      public Base addChild(String name) throws FHIRException {
5103        if (name.equals("path")) {
5104          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.path");
5105        }
5106        else if (name.equals("expression")) {
5107          this.expression = new Expression();
5108          return this.expression;
5109        }
5110        else
5111          return super.addChild(name);
5112      }
5113
5114      public PlanDefinitionActionDynamicValueComponent copy() {
5115        PlanDefinitionActionDynamicValueComponent dst = new PlanDefinitionActionDynamicValueComponent();
5116        copyValues(dst);
5117        dst.path = path == null ? null : path.copy();
5118        dst.expression = expression == null ? null : expression.copy();
5119        return dst;
5120      }
5121
5122      @Override
5123      public boolean equalsDeep(Base other_) {
5124        if (!super.equalsDeep(other_))
5125          return false;
5126        if (!(other_ instanceof PlanDefinitionActionDynamicValueComponent))
5127          return false;
5128        PlanDefinitionActionDynamicValueComponent o = (PlanDefinitionActionDynamicValueComponent) other_;
5129        return compareDeep(path, o.path, true) && compareDeep(expression, o.expression, true);
5130      }
5131
5132      @Override
5133      public boolean equalsShallow(Base other_) {
5134        if (!super.equalsShallow(other_))
5135          return false;
5136        if (!(other_ instanceof PlanDefinitionActionDynamicValueComponent))
5137          return false;
5138        PlanDefinitionActionDynamicValueComponent o = (PlanDefinitionActionDynamicValueComponent) other_;
5139        return compareValues(path, o.path, true);
5140      }
5141
5142      public boolean isEmpty() {
5143        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, expression);
5144      }
5145
5146  public String fhirType() {
5147    return "PlanDefinition.action.dynamicValue";
5148
5149  }
5150
5151  }
5152
5153    /**
5154     * A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.
5155     */
5156    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5157    @Description(shortDefinition="Additional identifier for the plan definition", formalDefinition="A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance." )
5158    protected List<Identifier> identifier;
5159
5160    /**
5161     * An explanatory or alternate title for the plan definition giving additional information about its content.
5162     */
5163    @Child(name = "subtitle", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5164    @Description(shortDefinition="Subordinate title of the plan definition", formalDefinition="An explanatory or alternate title for the plan definition giving additional information about its content." )
5165    protected StringType subtitle;
5166
5167    /**
5168     * A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.
5169     */
5170    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
5171    @Description(shortDefinition="order-set | clinical-protocol | eca-rule | workflow-definition", formalDefinition="A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition." )
5172    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/plan-definition-type")
5173    protected CodeableConcept type;
5174
5175    /**
5176     * A code or group definition that describes the intended subject of the plan definition.
5177     */
5178    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=3, min=0, max=1, modifier=false, summary=false)
5179    @Description(shortDefinition="Type of individual the plan definition is focused on", formalDefinition="A code or group definition that describes the intended subject of the plan definition." )
5180    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/subject-type")
5181    protected Type subject;
5182
5183    /**
5184     * Explanation of why this plan definition is needed and why it has been designed as it has.
5185     */
5186    @Child(name = "purpose", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5187    @Description(shortDefinition="Why this plan definition is defined", formalDefinition="Explanation of why this plan definition is needed and why it has been designed as it has." )
5188    protected MarkdownType purpose;
5189
5190    /**
5191     * A detailed description of how the plan definition is used from a clinical perspective.
5192     */
5193    @Child(name = "usage", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
5194    @Description(shortDefinition="Describes the clinical usage of the plan", formalDefinition="A detailed description of how the plan definition is used from a clinical perspective." )
5195    protected StringType usage;
5196
5197    /**
5198     * A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
5199     */
5200    @Child(name = "copyright", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5201    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition." )
5202    protected MarkdownType copyright;
5203
5204    /**
5205     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
5206     */
5207    @Child(name = "approvalDate", type = {DateType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5208    @Description(shortDefinition="When the plan definition was approved by publisher", formalDefinition="The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
5209    protected DateType approvalDate;
5210
5211    /**
5212     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
5213     */
5214    @Child(name = "lastReviewDate", type = {DateType.class}, order=8, min=0, max=1, modifier=false, summary=false)
5215    @Description(shortDefinition="When the plan definition was last reviewed", formalDefinition="The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date." )
5216    protected DateType lastReviewDate;
5217
5218    /**
5219     * The period during which the plan definition content was or is planned to be in active use.
5220     */
5221    @Child(name = "effectivePeriod", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
5222    @Description(shortDefinition="When the plan definition is expected to be used", formalDefinition="The period during which the plan definition content was or is planned to be in active use." )
5223    protected Period effectivePeriod;
5224
5225    /**
5226     * Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.
5227     */
5228    @Child(name = "topic", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5229    @Description(shortDefinition="E.g. Education, Treatment, Assessment", formalDefinition="Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching." )
5230    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/definition-topic")
5231    protected List<CodeableConcept> topic;
5232
5233    /**
5234     * An individiual or organization primarily involved in the creation and maintenance of the content.
5235     */
5236    @Child(name = "author", type = {ContactDetail.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5237    @Description(shortDefinition="Who authored the content", formalDefinition="An individiual or organization primarily involved in the creation and maintenance of the content." )
5238    protected List<ContactDetail> author;
5239
5240    /**
5241     * An individual or organization primarily responsible for internal coherence of the content.
5242     */
5243    @Child(name = "editor", type = {ContactDetail.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5244    @Description(shortDefinition="Who edited the content", formalDefinition="An individual or organization primarily responsible for internal coherence of the content." )
5245    protected List<ContactDetail> editor;
5246
5247    /**
5248     * An individual or organization primarily responsible for review of some aspect of the content.
5249     */
5250    @Child(name = "reviewer", type = {ContactDetail.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5251    @Description(shortDefinition="Who reviewed the content", formalDefinition="An individual or organization primarily responsible for review of some aspect of the content." )
5252    protected List<ContactDetail> reviewer;
5253
5254    /**
5255     * An individual or organization responsible for officially endorsing the content for use in some setting.
5256     */
5257    @Child(name = "endorser", type = {ContactDetail.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5258    @Description(shortDefinition="Who endorsed the content", formalDefinition="An individual or organization responsible for officially endorsing the content for use in some setting." )
5259    protected List<ContactDetail> endorser;
5260
5261    /**
5262     * Related artifacts such as additional documentation, justification, or bibliographic references.
5263     */
5264    @Child(name = "relatedArtifact", type = {RelatedArtifact.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5265    @Description(shortDefinition="Additional documentation, citations", formalDefinition="Related artifacts such as additional documentation, justification, or bibliographic references." )
5266    protected List<RelatedArtifact> relatedArtifact;
5267
5268    /**
5269     * A reference to a Library resource containing any formal logic used by the plan definition.
5270     */
5271    @Child(name = "library", type = {CanonicalType.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5272    @Description(shortDefinition="Logic used by the plan definition", formalDefinition="A reference to a Library resource containing any formal logic used by the plan definition." )
5273    protected List<CanonicalType> library;
5274
5275    /**
5276     * Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.
5277     */
5278    @Child(name = "goal", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5279    @Description(shortDefinition="What the plan is trying to accomplish", formalDefinition="Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc." )
5280    protected List<PlanDefinitionGoalComponent> goal;
5281
5282    /**
5283     * An action or group of actions to be taken as part of the plan.
5284     */
5285    @Child(name = "action", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5286    @Description(shortDefinition="Action defined by the plan", formalDefinition="An action or group of actions to be taken as part of the plan." )
5287    protected List<PlanDefinitionActionComponent> action;
5288
5289    private static final long serialVersionUID = -1725695645L;
5290
5291  /**
5292   * Constructor
5293   */
5294    public PlanDefinition() {
5295      super();
5296    }
5297
5298  /**
5299   * Constructor
5300   */
5301    public PlanDefinition(Enumeration<PublicationStatus> status) {
5302      super();
5303      this.status = status;
5304    }
5305
5306    /**
5307     * @return {@link #url} (An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5308     */
5309    public UriType getUrlElement() { 
5310      if (this.url == null)
5311        if (Configuration.errorOnAutoCreate())
5312          throw new Error("Attempt to auto-create PlanDefinition.url");
5313        else if (Configuration.doAutoCreate())
5314          this.url = new UriType(); // bb
5315      return this.url;
5316    }
5317
5318    public boolean hasUrlElement() { 
5319      return this.url != null && !this.url.isEmpty();
5320    }
5321
5322    public boolean hasUrl() { 
5323      return this.url != null && !this.url.isEmpty();
5324    }
5325
5326    /**
5327     * @param value {@link #url} (An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
5328     */
5329    public PlanDefinition setUrlElement(UriType value) { 
5330      this.url = value;
5331      return this;
5332    }
5333
5334    /**
5335     * @return An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.
5336     */
5337    public String getUrl() { 
5338      return this.url == null ? null : this.url.getValue();
5339    }
5340
5341    /**
5342     * @param value An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.
5343     */
5344    public PlanDefinition setUrl(String value) { 
5345      if (Utilities.noString(value))
5346        this.url = null;
5347      else {
5348        if (this.url == null)
5349          this.url = new UriType();
5350        this.url.setValue(value);
5351      }
5352      return this;
5353    }
5354
5355    /**
5356     * @return {@link #identifier} (A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.)
5357     */
5358    public List<Identifier> getIdentifier() { 
5359      if (this.identifier == null)
5360        this.identifier = new ArrayList<Identifier>();
5361      return this.identifier;
5362    }
5363
5364    /**
5365     * @return Returns a reference to <code>this</code> for easy method chaining
5366     */
5367    public PlanDefinition setIdentifier(List<Identifier> theIdentifier) { 
5368      this.identifier = theIdentifier;
5369      return this;
5370    }
5371
5372    public boolean hasIdentifier() { 
5373      if (this.identifier == null)
5374        return false;
5375      for (Identifier item : this.identifier)
5376        if (!item.isEmpty())
5377          return true;
5378      return false;
5379    }
5380
5381    public Identifier addIdentifier() { //3
5382      Identifier t = new Identifier();
5383      if (this.identifier == null)
5384        this.identifier = new ArrayList<Identifier>();
5385      this.identifier.add(t);
5386      return t;
5387    }
5388
5389    public PlanDefinition addIdentifier(Identifier t) { //3
5390      if (t == null)
5391        return this;
5392      if (this.identifier == null)
5393        this.identifier = new ArrayList<Identifier>();
5394      this.identifier.add(t);
5395      return this;
5396    }
5397
5398    /**
5399     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
5400     */
5401    public Identifier getIdentifierFirstRep() { 
5402      if (getIdentifier().isEmpty()) {
5403        addIdentifier();
5404      }
5405      return getIdentifier().get(0);
5406    }
5407
5408    /**
5409     * @return {@link #version} (The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5410     */
5411    public StringType getVersionElement() { 
5412      if (this.version == null)
5413        if (Configuration.errorOnAutoCreate())
5414          throw new Error("Attempt to auto-create PlanDefinition.version");
5415        else if (Configuration.doAutoCreate())
5416          this.version = new StringType(); // bb
5417      return this.version;
5418    }
5419
5420    public boolean hasVersionElement() { 
5421      return this.version != null && !this.version.isEmpty();
5422    }
5423
5424    public boolean hasVersion() { 
5425      return this.version != null && !this.version.isEmpty();
5426    }
5427
5428    /**
5429     * @param value {@link #version} (The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
5430     */
5431    public PlanDefinition setVersionElement(StringType value) { 
5432      this.version = value;
5433      return this;
5434    }
5435
5436    /**
5437     * @return The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.
5438     */
5439    public String getVersion() { 
5440      return this.version == null ? null : this.version.getValue();
5441    }
5442
5443    /**
5444     * @param value The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.
5445     */
5446    public PlanDefinition setVersion(String value) { 
5447      if (Utilities.noString(value))
5448        this.version = null;
5449      else {
5450        if (this.version == null)
5451          this.version = new StringType();
5452        this.version.setValue(value);
5453      }
5454      return this;
5455    }
5456
5457    /**
5458     * @return {@link #name} (A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5459     */
5460    public StringType getNameElement() { 
5461      if (this.name == null)
5462        if (Configuration.errorOnAutoCreate())
5463          throw new Error("Attempt to auto-create PlanDefinition.name");
5464        else if (Configuration.doAutoCreate())
5465          this.name = new StringType(); // bb
5466      return this.name;
5467    }
5468
5469    public boolean hasNameElement() { 
5470      return this.name != null && !this.name.isEmpty();
5471    }
5472
5473    public boolean hasName() { 
5474      return this.name != null && !this.name.isEmpty();
5475    }
5476
5477    /**
5478     * @param value {@link #name} (A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
5479     */
5480    public PlanDefinition setNameElement(StringType value) { 
5481      this.name = value;
5482      return this;
5483    }
5484
5485    /**
5486     * @return A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5487     */
5488    public String getName() { 
5489      return this.name == null ? null : this.name.getValue();
5490    }
5491
5492    /**
5493     * @param value A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5494     */
5495    public PlanDefinition setName(String value) { 
5496      if (Utilities.noString(value))
5497        this.name = null;
5498      else {
5499        if (this.name == null)
5500          this.name = new StringType();
5501        this.name.setValue(value);
5502      }
5503      return this;
5504    }
5505
5506    /**
5507     * @return {@link #title} (A short, descriptive, user-friendly title for the plan definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5508     */
5509    public StringType getTitleElement() { 
5510      if (this.title == null)
5511        if (Configuration.errorOnAutoCreate())
5512          throw new Error("Attempt to auto-create PlanDefinition.title");
5513        else if (Configuration.doAutoCreate())
5514          this.title = new StringType(); // bb
5515      return this.title;
5516    }
5517
5518    public boolean hasTitleElement() { 
5519      return this.title != null && !this.title.isEmpty();
5520    }
5521
5522    public boolean hasTitle() { 
5523      return this.title != null && !this.title.isEmpty();
5524    }
5525
5526    /**
5527     * @param value {@link #title} (A short, descriptive, user-friendly title for the plan definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
5528     */
5529    public PlanDefinition setTitleElement(StringType value) { 
5530      this.title = value;
5531      return this;
5532    }
5533
5534    /**
5535     * @return A short, descriptive, user-friendly title for the plan definition.
5536     */
5537    public String getTitle() { 
5538      return this.title == null ? null : this.title.getValue();
5539    }
5540
5541    /**
5542     * @param value A short, descriptive, user-friendly title for the plan definition.
5543     */
5544    public PlanDefinition setTitle(String value) { 
5545      if (Utilities.noString(value))
5546        this.title = null;
5547      else {
5548        if (this.title == null)
5549          this.title = new StringType();
5550        this.title.setValue(value);
5551      }
5552      return this;
5553    }
5554
5555    /**
5556     * @return {@link #subtitle} (An explanatory or alternate title for the plan definition giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
5557     */
5558    public StringType getSubtitleElement() { 
5559      if (this.subtitle == null)
5560        if (Configuration.errorOnAutoCreate())
5561          throw new Error("Attempt to auto-create PlanDefinition.subtitle");
5562        else if (Configuration.doAutoCreate())
5563          this.subtitle = new StringType(); // bb
5564      return this.subtitle;
5565    }
5566
5567    public boolean hasSubtitleElement() { 
5568      return this.subtitle != null && !this.subtitle.isEmpty();
5569    }
5570
5571    public boolean hasSubtitle() { 
5572      return this.subtitle != null && !this.subtitle.isEmpty();
5573    }
5574
5575    /**
5576     * @param value {@link #subtitle} (An explanatory or alternate title for the plan definition giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
5577     */
5578    public PlanDefinition setSubtitleElement(StringType value) { 
5579      this.subtitle = value;
5580      return this;
5581    }
5582
5583    /**
5584     * @return An explanatory or alternate title for the plan definition giving additional information about its content.
5585     */
5586    public String getSubtitle() { 
5587      return this.subtitle == null ? null : this.subtitle.getValue();
5588    }
5589
5590    /**
5591     * @param value An explanatory or alternate title for the plan definition giving additional information about its content.
5592     */
5593    public PlanDefinition setSubtitle(String value) { 
5594      if (Utilities.noString(value))
5595        this.subtitle = null;
5596      else {
5597        if (this.subtitle == null)
5598          this.subtitle = new StringType();
5599        this.subtitle.setValue(value);
5600      }
5601      return this;
5602    }
5603
5604    /**
5605     * @return {@link #type} (A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.)
5606     */
5607    public CodeableConcept getType() { 
5608      if (this.type == null)
5609        if (Configuration.errorOnAutoCreate())
5610          throw new Error("Attempt to auto-create PlanDefinition.type");
5611        else if (Configuration.doAutoCreate())
5612          this.type = new CodeableConcept(); // cc
5613      return this.type;
5614    }
5615
5616    public boolean hasType() { 
5617      return this.type != null && !this.type.isEmpty();
5618    }
5619
5620    /**
5621     * @param value {@link #type} (A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.)
5622     */
5623    public PlanDefinition setType(CodeableConcept value) { 
5624      this.type = value;
5625      return this;
5626    }
5627
5628    /**
5629     * @return {@link #status} (The status of this plan definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5630     */
5631    public Enumeration<PublicationStatus> getStatusElement() { 
5632      if (this.status == null)
5633        if (Configuration.errorOnAutoCreate())
5634          throw new Error("Attempt to auto-create PlanDefinition.status");
5635        else if (Configuration.doAutoCreate())
5636          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
5637      return this.status;
5638    }
5639
5640    public boolean hasStatusElement() { 
5641      return this.status != null && !this.status.isEmpty();
5642    }
5643
5644    public boolean hasStatus() { 
5645      return this.status != null && !this.status.isEmpty();
5646    }
5647
5648    /**
5649     * @param value {@link #status} (The status of this plan definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
5650     */
5651    public PlanDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
5652      this.status = value;
5653      return this;
5654    }
5655
5656    /**
5657     * @return The status of this plan definition. Enables tracking the life-cycle of the content.
5658     */
5659    public PublicationStatus getStatus() { 
5660      return this.status == null ? null : this.status.getValue();
5661    }
5662
5663    /**
5664     * @param value The status of this plan definition. Enables tracking the life-cycle of the content.
5665     */
5666    public PlanDefinition setStatus(PublicationStatus value) { 
5667        if (this.status == null)
5668          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
5669        this.status.setValue(value);
5670      return this;
5671    }
5672
5673    /**
5674     * @return {@link #experimental} (A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5675     */
5676    public BooleanType getExperimentalElement() { 
5677      if (this.experimental == null)
5678        if (Configuration.errorOnAutoCreate())
5679          throw new Error("Attempt to auto-create PlanDefinition.experimental");
5680        else if (Configuration.doAutoCreate())
5681          this.experimental = new BooleanType(); // bb
5682      return this.experimental;
5683    }
5684
5685    public boolean hasExperimentalElement() { 
5686      return this.experimental != null && !this.experimental.isEmpty();
5687    }
5688
5689    public boolean hasExperimental() { 
5690      return this.experimental != null && !this.experimental.isEmpty();
5691    }
5692
5693    /**
5694     * @param value {@link #experimental} (A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
5695     */
5696    public PlanDefinition setExperimentalElement(BooleanType value) { 
5697      this.experimental = value;
5698      return this;
5699    }
5700
5701    /**
5702     * @return A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
5703     */
5704    public boolean getExperimental() { 
5705      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
5706    }
5707
5708    /**
5709     * @param value A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
5710     */
5711    public PlanDefinition setExperimental(boolean value) { 
5712        if (this.experimental == null)
5713          this.experimental = new BooleanType();
5714        this.experimental.setValue(value);
5715      return this;
5716    }
5717
5718    /**
5719     * @return {@link #subject} (A code or group definition that describes the intended subject of the plan definition.)
5720     */
5721    public Type getSubject() { 
5722      return this.subject;
5723    }
5724
5725    /**
5726     * @return {@link #subject} (A code or group definition that describes the intended subject of the plan definition.)
5727     */
5728    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
5729      if (this.subject == null)
5730        return null;
5731      if (!(this.subject instanceof CodeableConcept))
5732        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
5733      return (CodeableConcept) this.subject;
5734    }
5735
5736    public boolean hasSubjectCodeableConcept() { 
5737      return this != null && this.subject instanceof CodeableConcept;
5738    }
5739
5740    /**
5741     * @return {@link #subject} (A code or group definition that describes the intended subject of the plan definition.)
5742     */
5743    public Reference getSubjectReference() throws FHIRException { 
5744      if (this.subject == null)
5745        return null;
5746      if (!(this.subject instanceof Reference))
5747        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
5748      return (Reference) this.subject;
5749    }
5750
5751    public boolean hasSubjectReference() { 
5752      return this != null && this.subject instanceof Reference;
5753    }
5754
5755    public boolean hasSubject() { 
5756      return this.subject != null && !this.subject.isEmpty();
5757    }
5758
5759    /**
5760     * @param value {@link #subject} (A code or group definition that describes the intended subject of the plan definition.)
5761     */
5762    public PlanDefinition setSubject(Type value) { 
5763      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
5764        throw new Error("Not the right type for PlanDefinition.subject[x]: "+value.fhirType());
5765      this.subject = value;
5766      return this;
5767    }
5768
5769    /**
5770     * @return {@link #date} (The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5771     */
5772    public DateTimeType getDateElement() { 
5773      if (this.date == null)
5774        if (Configuration.errorOnAutoCreate())
5775          throw new Error("Attempt to auto-create PlanDefinition.date");
5776        else if (Configuration.doAutoCreate())
5777          this.date = new DateTimeType(); // bb
5778      return this.date;
5779    }
5780
5781    public boolean hasDateElement() { 
5782      return this.date != null && !this.date.isEmpty();
5783    }
5784
5785    public boolean hasDate() { 
5786      return this.date != null && !this.date.isEmpty();
5787    }
5788
5789    /**
5790     * @param value {@link #date} (The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
5791     */
5792    public PlanDefinition setDateElement(DateTimeType value) { 
5793      this.date = value;
5794      return this;
5795    }
5796
5797    /**
5798     * @return The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.
5799     */
5800    public Date getDate() { 
5801      return this.date == null ? null : this.date.getValue();
5802    }
5803
5804    /**
5805     * @param value The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.
5806     */
5807    public PlanDefinition setDate(Date value) { 
5808      if (value == null)
5809        this.date = null;
5810      else {
5811        if (this.date == null)
5812          this.date = new DateTimeType();
5813        this.date.setValue(value);
5814      }
5815      return this;
5816    }
5817
5818    /**
5819     * @return {@link #publisher} (The name of the organization or individual that published the plan definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5820     */
5821    public StringType getPublisherElement() { 
5822      if (this.publisher == null)
5823        if (Configuration.errorOnAutoCreate())
5824          throw new Error("Attempt to auto-create PlanDefinition.publisher");
5825        else if (Configuration.doAutoCreate())
5826          this.publisher = new StringType(); // bb
5827      return this.publisher;
5828    }
5829
5830    public boolean hasPublisherElement() { 
5831      return this.publisher != null && !this.publisher.isEmpty();
5832    }
5833
5834    public boolean hasPublisher() { 
5835      return this.publisher != null && !this.publisher.isEmpty();
5836    }
5837
5838    /**
5839     * @param value {@link #publisher} (The name of the organization or individual that published the plan definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
5840     */
5841    public PlanDefinition setPublisherElement(StringType value) { 
5842      this.publisher = value;
5843      return this;
5844    }
5845
5846    /**
5847     * @return The name of the organization or individual that published the plan definition.
5848     */
5849    public String getPublisher() { 
5850      return this.publisher == null ? null : this.publisher.getValue();
5851    }
5852
5853    /**
5854     * @param value The name of the organization or individual that published the plan definition.
5855     */
5856    public PlanDefinition setPublisher(String value) { 
5857      if (Utilities.noString(value))
5858        this.publisher = null;
5859      else {
5860        if (this.publisher == null)
5861          this.publisher = new StringType();
5862        this.publisher.setValue(value);
5863      }
5864      return this;
5865    }
5866
5867    /**
5868     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
5869     */
5870    public List<ContactDetail> getContact() { 
5871      if (this.contact == null)
5872        this.contact = new ArrayList<ContactDetail>();
5873      return this.contact;
5874    }
5875
5876    /**
5877     * @return Returns a reference to <code>this</code> for easy method chaining
5878     */
5879    public PlanDefinition setContact(List<ContactDetail> theContact) { 
5880      this.contact = theContact;
5881      return this;
5882    }
5883
5884    public boolean hasContact() { 
5885      if (this.contact == null)
5886        return false;
5887      for (ContactDetail item : this.contact)
5888        if (!item.isEmpty())
5889          return true;
5890      return false;
5891    }
5892
5893    public ContactDetail addContact() { //3
5894      ContactDetail t = new ContactDetail();
5895      if (this.contact == null)
5896        this.contact = new ArrayList<ContactDetail>();
5897      this.contact.add(t);
5898      return t;
5899    }
5900
5901    public PlanDefinition addContact(ContactDetail t) { //3
5902      if (t == null)
5903        return this;
5904      if (this.contact == null)
5905        this.contact = new ArrayList<ContactDetail>();
5906      this.contact.add(t);
5907      return this;
5908    }
5909
5910    /**
5911     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
5912     */
5913    public ContactDetail getContactFirstRep() { 
5914      if (getContact().isEmpty()) {
5915        addContact();
5916      }
5917      return getContact().get(0);
5918    }
5919
5920    /**
5921     * @return {@link #description} (A free text natural language description of the plan definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5922     */
5923    public MarkdownType getDescriptionElement() { 
5924      if (this.description == null)
5925        if (Configuration.errorOnAutoCreate())
5926          throw new Error("Attempt to auto-create PlanDefinition.description");
5927        else if (Configuration.doAutoCreate())
5928          this.description = new MarkdownType(); // bb
5929      return this.description;
5930    }
5931
5932    public boolean hasDescriptionElement() { 
5933      return this.description != null && !this.description.isEmpty();
5934    }
5935
5936    public boolean hasDescription() { 
5937      return this.description != null && !this.description.isEmpty();
5938    }
5939
5940    /**
5941     * @param value {@link #description} (A free text natural language description of the plan definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5942     */
5943    public PlanDefinition setDescriptionElement(MarkdownType value) { 
5944      this.description = value;
5945      return this;
5946    }
5947
5948    /**
5949     * @return A free text natural language description of the plan definition from a consumer's perspective.
5950     */
5951    public String getDescription() { 
5952      return this.description == null ? null : this.description.getValue();
5953    }
5954
5955    /**
5956     * @param value A free text natural language description of the plan definition from a consumer's perspective.
5957     */
5958    public PlanDefinition setDescription(String value) { 
5959      if (value == null)
5960        this.description = null;
5961      else {
5962        if (this.description == null)
5963          this.description = new MarkdownType();
5964        this.description.setValue(value);
5965      }
5966      return this;
5967    }
5968
5969    /**
5970     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate plan definition instances.)
5971     */
5972    public List<UsageContext> getUseContext() { 
5973      if (this.useContext == null)
5974        this.useContext = new ArrayList<UsageContext>();
5975      return this.useContext;
5976    }
5977
5978    /**
5979     * @return Returns a reference to <code>this</code> for easy method chaining
5980     */
5981    public PlanDefinition setUseContext(List<UsageContext> theUseContext) { 
5982      this.useContext = theUseContext;
5983      return this;
5984    }
5985
5986    public boolean hasUseContext() { 
5987      if (this.useContext == null)
5988        return false;
5989      for (UsageContext item : this.useContext)
5990        if (!item.isEmpty())
5991          return true;
5992      return false;
5993    }
5994
5995    public UsageContext addUseContext() { //3
5996      UsageContext t = new UsageContext();
5997      if (this.useContext == null)
5998        this.useContext = new ArrayList<UsageContext>();
5999      this.useContext.add(t);
6000      return t;
6001    }
6002
6003    public PlanDefinition addUseContext(UsageContext t) { //3
6004      if (t == null)
6005        return this;
6006      if (this.useContext == null)
6007        this.useContext = new ArrayList<UsageContext>();
6008      this.useContext.add(t);
6009      return this;
6010    }
6011
6012    /**
6013     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
6014     */
6015    public UsageContext getUseContextFirstRep() { 
6016      if (getUseContext().isEmpty()) {
6017        addUseContext();
6018      }
6019      return getUseContext().get(0);
6020    }
6021
6022    /**
6023     * @return {@link #jurisdiction} (A legal or geographic region in which the plan definition is intended to be used.)
6024     */
6025    public List<CodeableConcept> getJurisdiction() { 
6026      if (this.jurisdiction == null)
6027        this.jurisdiction = new ArrayList<CodeableConcept>();
6028      return this.jurisdiction;
6029    }
6030
6031    /**
6032     * @return Returns a reference to <code>this</code> for easy method chaining
6033     */
6034    public PlanDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
6035      this.jurisdiction = theJurisdiction;
6036      return this;
6037    }
6038
6039    public boolean hasJurisdiction() { 
6040      if (this.jurisdiction == null)
6041        return false;
6042      for (CodeableConcept item : this.jurisdiction)
6043        if (!item.isEmpty())
6044          return true;
6045      return false;
6046    }
6047
6048    public CodeableConcept addJurisdiction() { //3
6049      CodeableConcept t = new CodeableConcept();
6050      if (this.jurisdiction == null)
6051        this.jurisdiction = new ArrayList<CodeableConcept>();
6052      this.jurisdiction.add(t);
6053      return t;
6054    }
6055
6056    public PlanDefinition addJurisdiction(CodeableConcept t) { //3
6057      if (t == null)
6058        return this;
6059      if (this.jurisdiction == null)
6060        this.jurisdiction = new ArrayList<CodeableConcept>();
6061      this.jurisdiction.add(t);
6062      return this;
6063    }
6064
6065    /**
6066     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
6067     */
6068    public CodeableConcept getJurisdictionFirstRep() { 
6069      if (getJurisdiction().isEmpty()) {
6070        addJurisdiction();
6071      }
6072      return getJurisdiction().get(0);
6073    }
6074
6075    /**
6076     * @return {@link #purpose} (Explanation of why this plan definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
6077     */
6078    public MarkdownType getPurposeElement() { 
6079      if (this.purpose == null)
6080        if (Configuration.errorOnAutoCreate())
6081          throw new Error("Attempt to auto-create PlanDefinition.purpose");
6082        else if (Configuration.doAutoCreate())
6083          this.purpose = new MarkdownType(); // bb
6084      return this.purpose;
6085    }
6086
6087    public boolean hasPurposeElement() { 
6088      return this.purpose != null && !this.purpose.isEmpty();
6089    }
6090
6091    public boolean hasPurpose() { 
6092      return this.purpose != null && !this.purpose.isEmpty();
6093    }
6094
6095    /**
6096     * @param value {@link #purpose} (Explanation of why this plan definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
6097     */
6098    public PlanDefinition setPurposeElement(MarkdownType value) { 
6099      this.purpose = value;
6100      return this;
6101    }
6102
6103    /**
6104     * @return Explanation of why this plan definition is needed and why it has been designed as it has.
6105     */
6106    public String getPurpose() { 
6107      return this.purpose == null ? null : this.purpose.getValue();
6108    }
6109
6110    /**
6111     * @param value Explanation of why this plan definition is needed and why it has been designed as it has.
6112     */
6113    public PlanDefinition setPurpose(String value) { 
6114      if (value == null)
6115        this.purpose = null;
6116      else {
6117        if (this.purpose == null)
6118          this.purpose = new MarkdownType();
6119        this.purpose.setValue(value);
6120      }
6121      return this;
6122    }
6123
6124    /**
6125     * @return {@link #usage} (A detailed description of how the plan definition is used from a clinical perspective.). This is the underlying object with id, value and extensions. The accessor "getUsage" gives direct access to the value
6126     */
6127    public StringType getUsageElement() { 
6128      if (this.usage == null)
6129        if (Configuration.errorOnAutoCreate())
6130          throw new Error("Attempt to auto-create PlanDefinition.usage");
6131        else if (Configuration.doAutoCreate())
6132          this.usage = new StringType(); // bb
6133      return this.usage;
6134    }
6135
6136    public boolean hasUsageElement() { 
6137      return this.usage != null && !this.usage.isEmpty();
6138    }
6139
6140    public boolean hasUsage() { 
6141      return this.usage != null && !this.usage.isEmpty();
6142    }
6143
6144    /**
6145     * @param value {@link #usage} (A detailed description of how the plan definition is used from a clinical perspective.). This is the underlying object with id, value and extensions. The accessor "getUsage" gives direct access to the value
6146     */
6147    public PlanDefinition setUsageElement(StringType value) { 
6148      this.usage = value;
6149      return this;
6150    }
6151
6152    /**
6153     * @return A detailed description of how the plan definition is used from a clinical perspective.
6154     */
6155    public String getUsage() { 
6156      return this.usage == null ? null : this.usage.getValue();
6157    }
6158
6159    /**
6160     * @param value A detailed description of how the plan definition is used from a clinical perspective.
6161     */
6162    public PlanDefinition setUsage(String value) { 
6163      if (Utilities.noString(value))
6164        this.usage = null;
6165      else {
6166        if (this.usage == null)
6167          this.usage = new StringType();
6168        this.usage.setValue(value);
6169      }
6170      return this;
6171    }
6172
6173    /**
6174     * @return {@link #copyright} (A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
6175     */
6176    public MarkdownType getCopyrightElement() { 
6177      if (this.copyright == null)
6178        if (Configuration.errorOnAutoCreate())
6179          throw new Error("Attempt to auto-create PlanDefinition.copyright");
6180        else if (Configuration.doAutoCreate())
6181          this.copyright = new MarkdownType(); // bb
6182      return this.copyright;
6183    }
6184
6185    public boolean hasCopyrightElement() { 
6186      return this.copyright != null && !this.copyright.isEmpty();
6187    }
6188
6189    public boolean hasCopyright() { 
6190      return this.copyright != null && !this.copyright.isEmpty();
6191    }
6192
6193    /**
6194     * @param value {@link #copyright} (A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
6195     */
6196    public PlanDefinition setCopyrightElement(MarkdownType value) { 
6197      this.copyright = value;
6198      return this;
6199    }
6200
6201    /**
6202     * @return A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
6203     */
6204    public String getCopyright() { 
6205      return this.copyright == null ? null : this.copyright.getValue();
6206    }
6207
6208    /**
6209     * @param value A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
6210     */
6211    public PlanDefinition setCopyright(String value) { 
6212      if (value == null)
6213        this.copyright = null;
6214      else {
6215        if (this.copyright == null)
6216          this.copyright = new MarkdownType();
6217        this.copyright.setValue(value);
6218      }
6219      return this;
6220    }
6221
6222    /**
6223     * @return {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
6224     */
6225    public DateType getApprovalDateElement() { 
6226      if (this.approvalDate == null)
6227        if (Configuration.errorOnAutoCreate())
6228          throw new Error("Attempt to auto-create PlanDefinition.approvalDate");
6229        else if (Configuration.doAutoCreate())
6230          this.approvalDate = new DateType(); // bb
6231      return this.approvalDate;
6232    }
6233
6234    public boolean hasApprovalDateElement() { 
6235      return this.approvalDate != null && !this.approvalDate.isEmpty();
6236    }
6237
6238    public boolean hasApprovalDate() { 
6239      return this.approvalDate != null && !this.approvalDate.isEmpty();
6240    }
6241
6242    /**
6243     * @param value {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
6244     */
6245    public PlanDefinition setApprovalDateElement(DateType value) { 
6246      this.approvalDate = value;
6247      return this;
6248    }
6249
6250    /**
6251     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
6252     */
6253    public Date getApprovalDate() { 
6254      return this.approvalDate == null ? null : this.approvalDate.getValue();
6255    }
6256
6257    /**
6258     * @param value The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
6259     */
6260    public PlanDefinition setApprovalDate(Date value) { 
6261      if (value == null)
6262        this.approvalDate = null;
6263      else {
6264        if (this.approvalDate == null)
6265          this.approvalDate = new DateType();
6266        this.approvalDate.setValue(value);
6267      }
6268      return this;
6269    }
6270
6271    /**
6272     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
6273     */
6274    public DateType getLastReviewDateElement() { 
6275      if (this.lastReviewDate == null)
6276        if (Configuration.errorOnAutoCreate())
6277          throw new Error("Attempt to auto-create PlanDefinition.lastReviewDate");
6278        else if (Configuration.doAutoCreate())
6279          this.lastReviewDate = new DateType(); // bb
6280      return this.lastReviewDate;
6281    }
6282
6283    public boolean hasLastReviewDateElement() { 
6284      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
6285    }
6286
6287    public boolean hasLastReviewDate() { 
6288      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
6289    }
6290
6291    /**
6292     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
6293     */
6294    public PlanDefinition setLastReviewDateElement(DateType value) { 
6295      this.lastReviewDate = value;
6296      return this;
6297    }
6298
6299    /**
6300     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
6301     */
6302    public Date getLastReviewDate() { 
6303      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
6304    }
6305
6306    /**
6307     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
6308     */
6309    public PlanDefinition setLastReviewDate(Date value) { 
6310      if (value == null)
6311        this.lastReviewDate = null;
6312      else {
6313        if (this.lastReviewDate == null)
6314          this.lastReviewDate = new DateType();
6315        this.lastReviewDate.setValue(value);
6316      }
6317      return this;
6318    }
6319
6320    /**
6321     * @return {@link #effectivePeriod} (The period during which the plan definition content was or is planned to be in active use.)
6322     */
6323    public Period getEffectivePeriod() { 
6324      if (this.effectivePeriod == null)
6325        if (Configuration.errorOnAutoCreate())
6326          throw new Error("Attempt to auto-create PlanDefinition.effectivePeriod");
6327        else if (Configuration.doAutoCreate())
6328          this.effectivePeriod = new Period(); // cc
6329      return this.effectivePeriod;
6330    }
6331
6332    public boolean hasEffectivePeriod() { 
6333      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
6334    }
6335
6336    /**
6337     * @param value {@link #effectivePeriod} (The period during which the plan definition content was or is planned to be in active use.)
6338     */
6339    public PlanDefinition setEffectivePeriod(Period value) { 
6340      this.effectivePeriod = value;
6341      return this;
6342    }
6343
6344    /**
6345     * @return {@link #topic} (Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.)
6346     */
6347    public List<CodeableConcept> getTopic() { 
6348      if (this.topic == null)
6349        this.topic = new ArrayList<CodeableConcept>();
6350      return this.topic;
6351    }
6352
6353    /**
6354     * @return Returns a reference to <code>this</code> for easy method chaining
6355     */
6356    public PlanDefinition setTopic(List<CodeableConcept> theTopic) { 
6357      this.topic = theTopic;
6358      return this;
6359    }
6360
6361    public boolean hasTopic() { 
6362      if (this.topic == null)
6363        return false;
6364      for (CodeableConcept item : this.topic)
6365        if (!item.isEmpty())
6366          return true;
6367      return false;
6368    }
6369
6370    public CodeableConcept addTopic() { //3
6371      CodeableConcept t = new CodeableConcept();
6372      if (this.topic == null)
6373        this.topic = new ArrayList<CodeableConcept>();
6374      this.topic.add(t);
6375      return t;
6376    }
6377
6378    public PlanDefinition addTopic(CodeableConcept t) { //3
6379      if (t == null)
6380        return this;
6381      if (this.topic == null)
6382        this.topic = new ArrayList<CodeableConcept>();
6383      this.topic.add(t);
6384      return this;
6385    }
6386
6387    /**
6388     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist
6389     */
6390    public CodeableConcept getTopicFirstRep() { 
6391      if (getTopic().isEmpty()) {
6392        addTopic();
6393      }
6394      return getTopic().get(0);
6395    }
6396
6397    /**
6398     * @return {@link #author} (An individiual or organization primarily involved in the creation and maintenance of the content.)
6399     */
6400    public List<ContactDetail> getAuthor() { 
6401      if (this.author == null)
6402        this.author = new ArrayList<ContactDetail>();
6403      return this.author;
6404    }
6405
6406    /**
6407     * @return Returns a reference to <code>this</code> for easy method chaining
6408     */
6409    public PlanDefinition setAuthor(List<ContactDetail> theAuthor) { 
6410      this.author = theAuthor;
6411      return this;
6412    }
6413
6414    public boolean hasAuthor() { 
6415      if (this.author == null)
6416        return false;
6417      for (ContactDetail item : this.author)
6418        if (!item.isEmpty())
6419          return true;
6420      return false;
6421    }
6422
6423    public ContactDetail addAuthor() { //3
6424      ContactDetail t = new ContactDetail();
6425      if (this.author == null)
6426        this.author = new ArrayList<ContactDetail>();
6427      this.author.add(t);
6428      return t;
6429    }
6430
6431    public PlanDefinition addAuthor(ContactDetail t) { //3
6432      if (t == null)
6433        return this;
6434      if (this.author == null)
6435        this.author = new ArrayList<ContactDetail>();
6436      this.author.add(t);
6437      return this;
6438    }
6439
6440    /**
6441     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
6442     */
6443    public ContactDetail getAuthorFirstRep() { 
6444      if (getAuthor().isEmpty()) {
6445        addAuthor();
6446      }
6447      return getAuthor().get(0);
6448    }
6449
6450    /**
6451     * @return {@link #editor} (An individual or organization primarily responsible for internal coherence of the content.)
6452     */
6453    public List<ContactDetail> getEditor() { 
6454      if (this.editor == null)
6455        this.editor = new ArrayList<ContactDetail>();
6456      return this.editor;
6457    }
6458
6459    /**
6460     * @return Returns a reference to <code>this</code> for easy method chaining
6461     */
6462    public PlanDefinition setEditor(List<ContactDetail> theEditor) { 
6463      this.editor = theEditor;
6464      return this;
6465    }
6466
6467    public boolean hasEditor() { 
6468      if (this.editor == null)
6469        return false;
6470      for (ContactDetail item : this.editor)
6471        if (!item.isEmpty())
6472          return true;
6473      return false;
6474    }
6475
6476    public ContactDetail addEditor() { //3
6477      ContactDetail t = new ContactDetail();
6478      if (this.editor == null)
6479        this.editor = new ArrayList<ContactDetail>();
6480      this.editor.add(t);
6481      return t;
6482    }
6483
6484    public PlanDefinition addEditor(ContactDetail t) { //3
6485      if (t == null)
6486        return this;
6487      if (this.editor == null)
6488        this.editor = new ArrayList<ContactDetail>();
6489      this.editor.add(t);
6490      return this;
6491    }
6492
6493    /**
6494     * @return The first repetition of repeating field {@link #editor}, creating it if it does not already exist
6495     */
6496    public ContactDetail getEditorFirstRep() { 
6497      if (getEditor().isEmpty()) {
6498        addEditor();
6499      }
6500      return getEditor().get(0);
6501    }
6502
6503    /**
6504     * @return {@link #reviewer} (An individual or organization primarily responsible for review of some aspect of the content.)
6505     */
6506    public List<ContactDetail> getReviewer() { 
6507      if (this.reviewer == null)
6508        this.reviewer = new ArrayList<ContactDetail>();
6509      return this.reviewer;
6510    }
6511
6512    /**
6513     * @return Returns a reference to <code>this</code> for easy method chaining
6514     */
6515    public PlanDefinition setReviewer(List<ContactDetail> theReviewer) { 
6516      this.reviewer = theReviewer;
6517      return this;
6518    }
6519
6520    public boolean hasReviewer() { 
6521      if (this.reviewer == null)
6522        return false;
6523      for (ContactDetail item : this.reviewer)
6524        if (!item.isEmpty())
6525          return true;
6526      return false;
6527    }
6528
6529    public ContactDetail addReviewer() { //3
6530      ContactDetail t = new ContactDetail();
6531      if (this.reviewer == null)
6532        this.reviewer = new ArrayList<ContactDetail>();
6533      this.reviewer.add(t);
6534      return t;
6535    }
6536
6537    public PlanDefinition addReviewer(ContactDetail t) { //3
6538      if (t == null)
6539        return this;
6540      if (this.reviewer == null)
6541        this.reviewer = new ArrayList<ContactDetail>();
6542      this.reviewer.add(t);
6543      return this;
6544    }
6545
6546    /**
6547     * @return The first repetition of repeating field {@link #reviewer}, creating it if it does not already exist
6548     */
6549    public ContactDetail getReviewerFirstRep() { 
6550      if (getReviewer().isEmpty()) {
6551        addReviewer();
6552      }
6553      return getReviewer().get(0);
6554    }
6555
6556    /**
6557     * @return {@link #endorser} (An individual or organization responsible for officially endorsing the content for use in some setting.)
6558     */
6559    public List<ContactDetail> getEndorser() { 
6560      if (this.endorser == null)
6561        this.endorser = new ArrayList<ContactDetail>();
6562      return this.endorser;
6563    }
6564
6565    /**
6566     * @return Returns a reference to <code>this</code> for easy method chaining
6567     */
6568    public PlanDefinition setEndorser(List<ContactDetail> theEndorser) { 
6569      this.endorser = theEndorser;
6570      return this;
6571    }
6572
6573    public boolean hasEndorser() { 
6574      if (this.endorser == null)
6575        return false;
6576      for (ContactDetail item : this.endorser)
6577        if (!item.isEmpty())
6578          return true;
6579      return false;
6580    }
6581
6582    public ContactDetail addEndorser() { //3
6583      ContactDetail t = new ContactDetail();
6584      if (this.endorser == null)
6585        this.endorser = new ArrayList<ContactDetail>();
6586      this.endorser.add(t);
6587      return t;
6588    }
6589
6590    public PlanDefinition addEndorser(ContactDetail t) { //3
6591      if (t == null)
6592        return this;
6593      if (this.endorser == null)
6594        this.endorser = new ArrayList<ContactDetail>();
6595      this.endorser.add(t);
6596      return this;
6597    }
6598
6599    /**
6600     * @return The first repetition of repeating field {@link #endorser}, creating it if it does not already exist
6601     */
6602    public ContactDetail getEndorserFirstRep() { 
6603      if (getEndorser().isEmpty()) {
6604        addEndorser();
6605      }
6606      return getEndorser().get(0);
6607    }
6608
6609    /**
6610     * @return {@link #relatedArtifact} (Related artifacts such as additional documentation, justification, or bibliographic references.)
6611     */
6612    public List<RelatedArtifact> getRelatedArtifact() { 
6613      if (this.relatedArtifact == null)
6614        this.relatedArtifact = new ArrayList<RelatedArtifact>();
6615      return this.relatedArtifact;
6616    }
6617
6618    /**
6619     * @return Returns a reference to <code>this</code> for easy method chaining
6620     */
6621    public PlanDefinition setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
6622      this.relatedArtifact = theRelatedArtifact;
6623      return this;
6624    }
6625
6626    public boolean hasRelatedArtifact() { 
6627      if (this.relatedArtifact == null)
6628        return false;
6629      for (RelatedArtifact item : this.relatedArtifact)
6630        if (!item.isEmpty())
6631          return true;
6632      return false;
6633    }
6634
6635    public RelatedArtifact addRelatedArtifact() { //3
6636      RelatedArtifact t = new RelatedArtifact();
6637      if (this.relatedArtifact == null)
6638        this.relatedArtifact = new ArrayList<RelatedArtifact>();
6639      this.relatedArtifact.add(t);
6640      return t;
6641    }
6642
6643    public PlanDefinition addRelatedArtifact(RelatedArtifact t) { //3
6644      if (t == null)
6645        return this;
6646      if (this.relatedArtifact == null)
6647        this.relatedArtifact = new ArrayList<RelatedArtifact>();
6648      this.relatedArtifact.add(t);
6649      return this;
6650    }
6651
6652    /**
6653     * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist
6654     */
6655    public RelatedArtifact getRelatedArtifactFirstRep() { 
6656      if (getRelatedArtifact().isEmpty()) {
6657        addRelatedArtifact();
6658      }
6659      return getRelatedArtifact().get(0);
6660    }
6661
6662    /**
6663     * @return {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
6664     */
6665    public List<CanonicalType> getLibrary() { 
6666      if (this.library == null)
6667        this.library = new ArrayList<CanonicalType>();
6668      return this.library;
6669    }
6670
6671    /**
6672     * @return Returns a reference to <code>this</code> for easy method chaining
6673     */
6674    public PlanDefinition setLibrary(List<CanonicalType> theLibrary) { 
6675      this.library = theLibrary;
6676      return this;
6677    }
6678
6679    public boolean hasLibrary() { 
6680      if (this.library == null)
6681        return false;
6682      for (CanonicalType item : this.library)
6683        if (!item.isEmpty())
6684          return true;
6685      return false;
6686    }
6687
6688    /**
6689     * @return {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
6690     */
6691    public CanonicalType addLibraryElement() {//2 
6692      CanonicalType t = new CanonicalType();
6693      if (this.library == null)
6694        this.library = new ArrayList<CanonicalType>();
6695      this.library.add(t);
6696      return t;
6697    }
6698
6699    /**
6700     * @param value {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
6701     */
6702    public PlanDefinition addLibrary(String value) { //1
6703      CanonicalType t = new CanonicalType();
6704      t.setValue(value);
6705      if (this.library == null)
6706        this.library = new ArrayList<CanonicalType>();
6707      this.library.add(t);
6708      return this;
6709    }
6710
6711    /**
6712     * @param value {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
6713     */
6714    public boolean hasLibrary(String value) { 
6715      if (this.library == null)
6716        return false;
6717      for (CanonicalType v : this.library)
6718        if (v.getValue().equals(value)) // canonical(Library)
6719          return true;
6720      return false;
6721    }
6722
6723    /**
6724     * @return {@link #goal} (Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.)
6725     */
6726    public List<PlanDefinitionGoalComponent> getGoal() { 
6727      if (this.goal == null)
6728        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
6729      return this.goal;
6730    }
6731
6732    /**
6733     * @return Returns a reference to <code>this</code> for easy method chaining
6734     */
6735    public PlanDefinition setGoal(List<PlanDefinitionGoalComponent> theGoal) { 
6736      this.goal = theGoal;
6737      return this;
6738    }
6739
6740    public boolean hasGoal() { 
6741      if (this.goal == null)
6742        return false;
6743      for (PlanDefinitionGoalComponent item : this.goal)
6744        if (!item.isEmpty())
6745          return true;
6746      return false;
6747    }
6748
6749    public PlanDefinitionGoalComponent addGoal() { //3
6750      PlanDefinitionGoalComponent t = new PlanDefinitionGoalComponent();
6751      if (this.goal == null)
6752        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
6753      this.goal.add(t);
6754      return t;
6755    }
6756
6757    public PlanDefinition addGoal(PlanDefinitionGoalComponent t) { //3
6758      if (t == null)
6759        return this;
6760      if (this.goal == null)
6761        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
6762      this.goal.add(t);
6763      return this;
6764    }
6765
6766    /**
6767     * @return The first repetition of repeating field {@link #goal}, creating it if it does not already exist
6768     */
6769    public PlanDefinitionGoalComponent getGoalFirstRep() { 
6770      if (getGoal().isEmpty()) {
6771        addGoal();
6772      }
6773      return getGoal().get(0);
6774    }
6775
6776    /**
6777     * @return {@link #action} (An action or group of actions to be taken as part of the plan.)
6778     */
6779    public List<PlanDefinitionActionComponent> getAction() { 
6780      if (this.action == null)
6781        this.action = new ArrayList<PlanDefinitionActionComponent>();
6782      return this.action;
6783    }
6784
6785    /**
6786     * @return Returns a reference to <code>this</code> for easy method chaining
6787     */
6788    public PlanDefinition setAction(List<PlanDefinitionActionComponent> theAction) { 
6789      this.action = theAction;
6790      return this;
6791    }
6792
6793    public boolean hasAction() { 
6794      if (this.action == null)
6795        return false;
6796      for (PlanDefinitionActionComponent item : this.action)
6797        if (!item.isEmpty())
6798          return true;
6799      return false;
6800    }
6801
6802    public PlanDefinitionActionComponent addAction() { //3
6803      PlanDefinitionActionComponent t = new PlanDefinitionActionComponent();
6804      if (this.action == null)
6805        this.action = new ArrayList<PlanDefinitionActionComponent>();
6806      this.action.add(t);
6807      return t;
6808    }
6809
6810    public PlanDefinition addAction(PlanDefinitionActionComponent t) { //3
6811      if (t == null)
6812        return this;
6813      if (this.action == null)
6814        this.action = new ArrayList<PlanDefinitionActionComponent>();
6815      this.action.add(t);
6816      return this;
6817    }
6818
6819    /**
6820     * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
6821     */
6822    public PlanDefinitionActionComponent getActionFirstRep() { 
6823      if (getAction().isEmpty()) {
6824        addAction();
6825      }
6826      return getAction().get(0);
6827    }
6828
6829      protected void listChildren(List<Property> children) {
6830        super.listChildren(children);
6831        children.add(new Property("url", "uri", "An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.", 0, 1, url));
6832        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
6833        children.add(new Property("version", "string", "The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.", 0, 1, version));
6834        children.add(new Property("name", "string", "A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
6835        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the plan definition.", 0, 1, title));
6836        children.add(new Property("subtitle", "string", "An explanatory or alternate title for the plan definition giving additional information about its content.", 0, 1, subtitle));
6837        children.add(new Property("type", "CodeableConcept", "A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.", 0, 1, type));
6838        children.add(new Property("status", "code", "The status of this plan definition. Enables tracking the life-cycle of the content.", 0, 1, status));
6839        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
6840        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of the plan definition.", 0, 1, subject));
6841        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.", 0, 1, date));
6842        children.add(new Property("publisher", "string", "The name of the organization or individual that published the plan definition.", 0, 1, publisher));
6843        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
6844        children.add(new Property("description", "markdown", "A free text natural language description of the plan definition from a consumer's perspective.", 0, 1, description));
6845        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate plan definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
6846        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the plan definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
6847        children.add(new Property("purpose", "markdown", "Explanation of why this plan definition is needed and why it has been designed as it has.", 0, 1, purpose));
6848        children.add(new Property("usage", "string", "A detailed description of how the plan definition is used from a clinical perspective.", 0, 1, usage));
6849        children.add(new Property("copyright", "markdown", "A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.", 0, 1, copyright));
6850        children.add(new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
6851        children.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate));
6852        children.add(new Property("effectivePeriod", "Period", "The period during which the plan definition content was or is planned to be in active use.", 0, 1, effectivePeriod));
6853        children.add(new Property("topic", "CodeableConcept", "Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.", 0, java.lang.Integer.MAX_VALUE, topic));
6854        children.add(new Property("author", "ContactDetail", "An individiual or organization primarily involved in the creation and maintenance of the content.", 0, java.lang.Integer.MAX_VALUE, author));
6855        children.add(new Property("editor", "ContactDetail", "An individual or organization primarily responsible for internal coherence of the content.", 0, java.lang.Integer.MAX_VALUE, editor));
6856        children.add(new Property("reviewer", "ContactDetail", "An individual or organization primarily responsible for review of some aspect of the content.", 0, java.lang.Integer.MAX_VALUE, reviewer));
6857        children.add(new Property("endorser", "ContactDetail", "An individual or organization responsible for officially endorsing the content for use in some setting.", 0, java.lang.Integer.MAX_VALUE, endorser));
6858        children.add(new Property("relatedArtifact", "RelatedArtifact", "Related artifacts such as additional documentation, justification, or bibliographic references.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
6859        children.add(new Property("library", "canonical(Library)", "A reference to a Library resource containing any formal logic used by the plan definition.", 0, java.lang.Integer.MAX_VALUE, library));
6860        children.add(new Property("goal", "", "Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.", 0, java.lang.Integer.MAX_VALUE, goal));
6861        children.add(new Property("action", "", "An action or group of actions to be taken as part of the plan.", 0, java.lang.Integer.MAX_VALUE, action));
6862      }
6863
6864      @Override
6865      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6866        switch (_hash) {
6867        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.", 0, 1, url);
6868        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
6869        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.", 0, 1, version);
6870        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
6871        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the plan definition.", 0, 1, title);
6872        case -2060497896: /*subtitle*/  return new Property("subtitle", "string", "An explanatory or alternate title for the plan definition giving additional information about its content.", 0, 1, subtitle);
6873        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.", 0, 1, type);
6874        case -892481550: /*status*/  return new Property("status", "code", "The status of this plan definition. Enables tracking the life-cycle of the content.", 0, 1, status);
6875        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
6876        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of the plan definition.", 0, 1, subject);
6877        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of the plan definition.", 0, 1, subject);
6878        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of the plan definition.", 0, 1, subject);
6879        case 772938623: /*subjectReference*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of the plan definition.", 0, 1, subject);
6880        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the plan definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.", 0, 1, date);
6881        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the plan definition.", 0, 1, publisher);
6882        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
6883        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the plan definition from a consumer's perspective.", 0, 1, description);
6884        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate plan definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
6885        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the plan definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
6886        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this plan definition is needed and why it has been designed as it has.", 0, 1, purpose);
6887        case 111574433: /*usage*/  return new Property("usage", "string", "A detailed description of how the plan definition is used from a clinical perspective.", 0, 1, usage);
6888        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.", 0, 1, copyright);
6889        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
6890        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate);
6891        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the plan definition content was or is planned to be in active use.", 0, 1, effectivePeriod);
6892        case 110546223: /*topic*/  return new Property("topic", "CodeableConcept", "Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.", 0, java.lang.Integer.MAX_VALUE, topic);
6893        case -1406328437: /*author*/  return new Property("author", "ContactDetail", "An individiual or organization primarily involved in the creation and maintenance of the content.", 0, java.lang.Integer.MAX_VALUE, author);
6894        case -1307827859: /*editor*/  return new Property("editor", "ContactDetail", "An individual or organization primarily responsible for internal coherence of the content.", 0, java.lang.Integer.MAX_VALUE, editor);
6895        case -261190139: /*reviewer*/  return new Property("reviewer", "ContactDetail", "An individual or organization primarily responsible for review of some aspect of the content.", 0, java.lang.Integer.MAX_VALUE, reviewer);
6896        case 1740277666: /*endorser*/  return new Property("endorser", "ContactDetail", "An individual or organization responsible for officially endorsing the content for use in some setting.", 0, java.lang.Integer.MAX_VALUE, endorser);
6897        case 666807069: /*relatedArtifact*/  return new Property("relatedArtifact", "RelatedArtifact", "Related artifacts such as additional documentation, justification, or bibliographic references.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
6898        case 166208699: /*library*/  return new Property("library", "canonical(Library)", "A reference to a Library resource containing any formal logic used by the plan definition.", 0, java.lang.Integer.MAX_VALUE, library);
6899        case 3178259: /*goal*/  return new Property("goal", "", "Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.", 0, java.lang.Integer.MAX_VALUE, goal);
6900        case -1422950858: /*action*/  return new Property("action", "", "An action or group of actions to be taken as part of the plan.", 0, java.lang.Integer.MAX_VALUE, action);
6901        default: return super.getNamedProperty(_hash, _name, _checkValid);
6902        }
6903
6904      }
6905
6906      @Override
6907      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6908        switch (hash) {
6909        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
6910        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
6911        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
6912        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
6913        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
6914        case -2060497896: /*subtitle*/ return this.subtitle == null ? new Base[0] : new Base[] {this.subtitle}; // StringType
6915        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
6916        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
6917        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
6918        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Type
6919        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
6920        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
6921        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
6922        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
6923        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
6924        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
6925        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
6926        case 111574433: /*usage*/ return this.usage == null ? new Base[0] : new Base[] {this.usage}; // StringType
6927        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
6928        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
6929        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
6930        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
6931        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // CodeableConcept
6932        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // ContactDetail
6933        case -1307827859: /*editor*/ return this.editor == null ? new Base[0] : this.editor.toArray(new Base[this.editor.size()]); // ContactDetail
6934        case -261190139: /*reviewer*/ return this.reviewer == null ? new Base[0] : this.reviewer.toArray(new Base[this.reviewer.size()]); // ContactDetail
6935        case 1740277666: /*endorser*/ return this.endorser == null ? new Base[0] : this.endorser.toArray(new Base[this.endorser.size()]); // ContactDetail
6936        case 666807069: /*relatedArtifact*/ return this.relatedArtifact == null ? new Base[0] : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
6937        case 166208699: /*library*/ return this.library == null ? new Base[0] : this.library.toArray(new Base[this.library.size()]); // CanonicalType
6938        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // PlanDefinitionGoalComponent
6939        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // PlanDefinitionActionComponent
6940        default: return super.getProperty(hash, name, checkValid);
6941        }
6942
6943      }
6944
6945      @Override
6946      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6947        switch (hash) {
6948        case 116079: // url
6949          this.url = castToUri(value); // UriType
6950          return value;
6951        case -1618432855: // identifier
6952          this.getIdentifier().add(castToIdentifier(value)); // Identifier
6953          return value;
6954        case 351608024: // version
6955          this.version = castToString(value); // StringType
6956          return value;
6957        case 3373707: // name
6958          this.name = castToString(value); // StringType
6959          return value;
6960        case 110371416: // title
6961          this.title = castToString(value); // StringType
6962          return value;
6963        case -2060497896: // subtitle
6964          this.subtitle = castToString(value); // StringType
6965          return value;
6966        case 3575610: // type
6967          this.type = castToCodeableConcept(value); // CodeableConcept
6968          return value;
6969        case -892481550: // status
6970          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
6971          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
6972          return value;
6973        case -404562712: // experimental
6974          this.experimental = castToBoolean(value); // BooleanType
6975          return value;
6976        case -1867885268: // subject
6977          this.subject = castToType(value); // Type
6978          return value;
6979        case 3076014: // date
6980          this.date = castToDateTime(value); // DateTimeType
6981          return value;
6982        case 1447404028: // publisher
6983          this.publisher = castToString(value); // StringType
6984          return value;
6985        case 951526432: // contact
6986          this.getContact().add(castToContactDetail(value)); // ContactDetail
6987          return value;
6988        case -1724546052: // description
6989          this.description = castToMarkdown(value); // MarkdownType
6990          return value;
6991        case -669707736: // useContext
6992          this.getUseContext().add(castToUsageContext(value)); // UsageContext
6993          return value;
6994        case -507075711: // jurisdiction
6995          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
6996          return value;
6997        case -220463842: // purpose
6998          this.purpose = castToMarkdown(value); // MarkdownType
6999          return value;
7000        case 111574433: // usage
7001          this.usage = castToString(value); // StringType
7002          return value;
7003        case 1522889671: // copyright
7004          this.copyright = castToMarkdown(value); // MarkdownType
7005          return value;
7006        case 223539345: // approvalDate
7007          this.approvalDate = castToDate(value); // DateType
7008          return value;
7009        case -1687512484: // lastReviewDate
7010          this.lastReviewDate = castToDate(value); // DateType
7011          return value;
7012        case -403934648: // effectivePeriod
7013          this.effectivePeriod = castToPeriod(value); // Period
7014          return value;
7015        case 110546223: // topic
7016          this.getTopic().add(castToCodeableConcept(value)); // CodeableConcept
7017          return value;
7018        case -1406328437: // author
7019          this.getAuthor().add(castToContactDetail(value)); // ContactDetail
7020          return value;
7021        case -1307827859: // editor
7022          this.getEditor().add(castToContactDetail(value)); // ContactDetail
7023          return value;
7024        case -261190139: // reviewer
7025          this.getReviewer().add(castToContactDetail(value)); // ContactDetail
7026          return value;
7027        case 1740277666: // endorser
7028          this.getEndorser().add(castToContactDetail(value)); // ContactDetail
7029          return value;
7030        case 666807069: // relatedArtifact
7031          this.getRelatedArtifact().add(castToRelatedArtifact(value)); // RelatedArtifact
7032          return value;
7033        case 166208699: // library
7034          this.getLibrary().add(castToCanonical(value)); // CanonicalType
7035          return value;
7036        case 3178259: // goal
7037          this.getGoal().add((PlanDefinitionGoalComponent) value); // PlanDefinitionGoalComponent
7038          return value;
7039        case -1422950858: // action
7040          this.getAction().add((PlanDefinitionActionComponent) value); // PlanDefinitionActionComponent
7041          return value;
7042        default: return super.setProperty(hash, name, value);
7043        }
7044
7045      }
7046
7047      @Override
7048      public Base setProperty(String name, Base value) throws FHIRException {
7049        if (name.equals("url")) {
7050          this.url = castToUri(value); // UriType
7051        } else if (name.equals("identifier")) {
7052          this.getIdentifier().add(castToIdentifier(value));
7053        } else if (name.equals("version")) {
7054          this.version = castToString(value); // StringType
7055        } else if (name.equals("name")) {
7056          this.name = castToString(value); // StringType
7057        } else if (name.equals("title")) {
7058          this.title = castToString(value); // StringType
7059        } else if (name.equals("subtitle")) {
7060          this.subtitle = castToString(value); // StringType
7061        } else if (name.equals("type")) {
7062          this.type = castToCodeableConcept(value); // CodeableConcept
7063        } else if (name.equals("status")) {
7064          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
7065          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
7066        } else if (name.equals("experimental")) {
7067          this.experimental = castToBoolean(value); // BooleanType
7068        } else if (name.equals("subject[x]")) {
7069          this.subject = castToType(value); // Type
7070        } else if (name.equals("date")) {
7071          this.date = castToDateTime(value); // DateTimeType
7072        } else if (name.equals("publisher")) {
7073          this.publisher = castToString(value); // StringType
7074        } else if (name.equals("contact")) {
7075          this.getContact().add(castToContactDetail(value));
7076        } else if (name.equals("description")) {
7077          this.description = castToMarkdown(value); // MarkdownType
7078        } else if (name.equals("useContext")) {
7079          this.getUseContext().add(castToUsageContext(value));
7080        } else if (name.equals("jurisdiction")) {
7081          this.getJurisdiction().add(castToCodeableConcept(value));
7082        } else if (name.equals("purpose")) {
7083          this.purpose = castToMarkdown(value); // MarkdownType
7084        } else if (name.equals("usage")) {
7085          this.usage = castToString(value); // StringType
7086        } else if (name.equals("copyright")) {
7087          this.copyright = castToMarkdown(value); // MarkdownType
7088        } else if (name.equals("approvalDate")) {
7089          this.approvalDate = castToDate(value); // DateType
7090        } else if (name.equals("lastReviewDate")) {
7091          this.lastReviewDate = castToDate(value); // DateType
7092        } else if (name.equals("effectivePeriod")) {
7093          this.effectivePeriod = castToPeriod(value); // Period
7094        } else if (name.equals("topic")) {
7095          this.getTopic().add(castToCodeableConcept(value));
7096        } else if (name.equals("author")) {
7097          this.getAuthor().add(castToContactDetail(value));
7098        } else if (name.equals("editor")) {
7099          this.getEditor().add(castToContactDetail(value));
7100        } else if (name.equals("reviewer")) {
7101          this.getReviewer().add(castToContactDetail(value));
7102        } else if (name.equals("endorser")) {
7103          this.getEndorser().add(castToContactDetail(value));
7104        } else if (name.equals("relatedArtifact")) {
7105          this.getRelatedArtifact().add(castToRelatedArtifact(value));
7106        } else if (name.equals("library")) {
7107          this.getLibrary().add(castToCanonical(value));
7108        } else if (name.equals("goal")) {
7109          this.getGoal().add((PlanDefinitionGoalComponent) value);
7110        } else if (name.equals("action")) {
7111          this.getAction().add((PlanDefinitionActionComponent) value);
7112        } else
7113          return super.setProperty(name, value);
7114        return value;
7115      }
7116
7117      @Override
7118      public Base makeProperty(int hash, String name) throws FHIRException {
7119        switch (hash) {
7120        case 116079:  return getUrlElement();
7121        case -1618432855:  return addIdentifier(); 
7122        case 351608024:  return getVersionElement();
7123        case 3373707:  return getNameElement();
7124        case 110371416:  return getTitleElement();
7125        case -2060497896:  return getSubtitleElement();
7126        case 3575610:  return getType(); 
7127        case -892481550:  return getStatusElement();
7128        case -404562712:  return getExperimentalElement();
7129        case -573640748:  return getSubject(); 
7130        case -1867885268:  return getSubject(); 
7131        case 3076014:  return getDateElement();
7132        case 1447404028:  return getPublisherElement();
7133        case 951526432:  return addContact(); 
7134        case -1724546052:  return getDescriptionElement();
7135        case -669707736:  return addUseContext(); 
7136        case -507075711:  return addJurisdiction(); 
7137        case -220463842:  return getPurposeElement();
7138        case 111574433:  return getUsageElement();
7139        case 1522889671:  return getCopyrightElement();
7140        case 223539345:  return getApprovalDateElement();
7141        case -1687512484:  return getLastReviewDateElement();
7142        case -403934648:  return getEffectivePeriod(); 
7143        case 110546223:  return addTopic(); 
7144        case -1406328437:  return addAuthor(); 
7145        case -1307827859:  return addEditor(); 
7146        case -261190139:  return addReviewer(); 
7147        case 1740277666:  return addEndorser(); 
7148        case 666807069:  return addRelatedArtifact(); 
7149        case 166208699:  return addLibraryElement();
7150        case 3178259:  return addGoal(); 
7151        case -1422950858:  return addAction(); 
7152        default: return super.makeProperty(hash, name);
7153        }
7154
7155      }
7156
7157      @Override
7158      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7159        switch (hash) {
7160        case 116079: /*url*/ return new String[] {"uri"};
7161        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
7162        case 351608024: /*version*/ return new String[] {"string"};
7163        case 3373707: /*name*/ return new String[] {"string"};
7164        case 110371416: /*title*/ return new String[] {"string"};
7165        case -2060497896: /*subtitle*/ return new String[] {"string"};
7166        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
7167        case -892481550: /*status*/ return new String[] {"code"};
7168        case -404562712: /*experimental*/ return new String[] {"boolean"};
7169        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
7170        case 3076014: /*date*/ return new String[] {"dateTime"};
7171        case 1447404028: /*publisher*/ return new String[] {"string"};
7172        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
7173        case -1724546052: /*description*/ return new String[] {"markdown"};
7174        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
7175        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
7176        case -220463842: /*purpose*/ return new String[] {"markdown"};
7177        case 111574433: /*usage*/ return new String[] {"string"};
7178        case 1522889671: /*copyright*/ return new String[] {"markdown"};
7179        case 223539345: /*approvalDate*/ return new String[] {"date"};
7180        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
7181        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
7182        case 110546223: /*topic*/ return new String[] {"CodeableConcept"};
7183        case -1406328437: /*author*/ return new String[] {"ContactDetail"};
7184        case -1307827859: /*editor*/ return new String[] {"ContactDetail"};
7185        case -261190139: /*reviewer*/ return new String[] {"ContactDetail"};
7186        case 1740277666: /*endorser*/ return new String[] {"ContactDetail"};
7187        case 666807069: /*relatedArtifact*/ return new String[] {"RelatedArtifact"};
7188        case 166208699: /*library*/ return new String[] {"canonical"};
7189        case 3178259: /*goal*/ return new String[] {};
7190        case -1422950858: /*action*/ return new String[] {};
7191        default: return super.getTypesForProperty(hash, name);
7192        }
7193
7194      }
7195
7196      @Override
7197      public Base addChild(String name) throws FHIRException {
7198        if (name.equals("url")) {
7199          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.url");
7200        }
7201        else if (name.equals("identifier")) {
7202          return addIdentifier();
7203        }
7204        else if (name.equals("version")) {
7205          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.version");
7206        }
7207        else if (name.equals("name")) {
7208          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.name");
7209        }
7210        else if (name.equals("title")) {
7211          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.title");
7212        }
7213        else if (name.equals("subtitle")) {
7214          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.subtitle");
7215        }
7216        else if (name.equals("type")) {
7217          this.type = new CodeableConcept();
7218          return this.type;
7219        }
7220        else if (name.equals("status")) {
7221          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.status");
7222        }
7223        else if (name.equals("experimental")) {
7224          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.experimental");
7225        }
7226        else if (name.equals("subjectCodeableConcept")) {
7227          this.subject = new CodeableConcept();
7228          return this.subject;
7229        }
7230        else if (name.equals("subjectReference")) {
7231          this.subject = new Reference();
7232          return this.subject;
7233        }
7234        else if (name.equals("date")) {
7235          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.date");
7236        }
7237        else if (name.equals("publisher")) {
7238          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.publisher");
7239        }
7240        else if (name.equals("contact")) {
7241          return addContact();
7242        }
7243        else if (name.equals("description")) {
7244          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.description");
7245        }
7246        else if (name.equals("useContext")) {
7247          return addUseContext();
7248        }
7249        else if (name.equals("jurisdiction")) {
7250          return addJurisdiction();
7251        }
7252        else if (name.equals("purpose")) {
7253          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.purpose");
7254        }
7255        else if (name.equals("usage")) {
7256          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.usage");
7257        }
7258        else if (name.equals("copyright")) {
7259          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.copyright");
7260        }
7261        else if (name.equals("approvalDate")) {
7262          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.approvalDate");
7263        }
7264        else if (name.equals("lastReviewDate")) {
7265          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.lastReviewDate");
7266        }
7267        else if (name.equals("effectivePeriod")) {
7268          this.effectivePeriod = new Period();
7269          return this.effectivePeriod;
7270        }
7271        else if (name.equals("topic")) {
7272          return addTopic();
7273        }
7274        else if (name.equals("author")) {
7275          return addAuthor();
7276        }
7277        else if (name.equals("editor")) {
7278          return addEditor();
7279        }
7280        else if (name.equals("reviewer")) {
7281          return addReviewer();
7282        }
7283        else if (name.equals("endorser")) {
7284          return addEndorser();
7285        }
7286        else if (name.equals("relatedArtifact")) {
7287          return addRelatedArtifact();
7288        }
7289        else if (name.equals("library")) {
7290          throw new FHIRException("Cannot call addChild on a primitive type PlanDefinition.library");
7291        }
7292        else if (name.equals("goal")) {
7293          return addGoal();
7294        }
7295        else if (name.equals("action")) {
7296          return addAction();
7297        }
7298        else
7299          return super.addChild(name);
7300      }
7301
7302  public String fhirType() {
7303    return "PlanDefinition";
7304
7305  }
7306
7307      public PlanDefinition copy() {
7308        PlanDefinition dst = new PlanDefinition();
7309        copyValues(dst);
7310        dst.url = url == null ? null : url.copy();
7311        if (identifier != null) {
7312          dst.identifier = new ArrayList<Identifier>();
7313          for (Identifier i : identifier)
7314            dst.identifier.add(i.copy());
7315        };
7316        dst.version = version == null ? null : version.copy();
7317        dst.name = name == null ? null : name.copy();
7318        dst.title = title == null ? null : title.copy();
7319        dst.subtitle = subtitle == null ? null : subtitle.copy();
7320        dst.type = type == null ? null : type.copy();
7321        dst.status = status == null ? null : status.copy();
7322        dst.experimental = experimental == null ? null : experimental.copy();
7323        dst.subject = subject == null ? null : subject.copy();
7324        dst.date = date == null ? null : date.copy();
7325        dst.publisher = publisher == null ? null : publisher.copy();
7326        if (contact != null) {
7327          dst.contact = new ArrayList<ContactDetail>();
7328          for (ContactDetail i : contact)
7329            dst.contact.add(i.copy());
7330        };
7331        dst.description = description == null ? null : description.copy();
7332        if (useContext != null) {
7333          dst.useContext = new ArrayList<UsageContext>();
7334          for (UsageContext i : useContext)
7335            dst.useContext.add(i.copy());
7336        };
7337        if (jurisdiction != null) {
7338          dst.jurisdiction = new ArrayList<CodeableConcept>();
7339          for (CodeableConcept i : jurisdiction)
7340            dst.jurisdiction.add(i.copy());
7341        };
7342        dst.purpose = purpose == null ? null : purpose.copy();
7343        dst.usage = usage == null ? null : usage.copy();
7344        dst.copyright = copyright == null ? null : copyright.copy();
7345        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
7346        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
7347        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
7348        if (topic != null) {
7349          dst.topic = new ArrayList<CodeableConcept>();
7350          for (CodeableConcept i : topic)
7351            dst.topic.add(i.copy());
7352        };
7353        if (author != null) {
7354          dst.author = new ArrayList<ContactDetail>();
7355          for (ContactDetail i : author)
7356            dst.author.add(i.copy());
7357        };
7358        if (editor != null) {
7359          dst.editor = new ArrayList<ContactDetail>();
7360          for (ContactDetail i : editor)
7361            dst.editor.add(i.copy());
7362        };
7363        if (reviewer != null) {
7364          dst.reviewer = new ArrayList<ContactDetail>();
7365          for (ContactDetail i : reviewer)
7366            dst.reviewer.add(i.copy());
7367        };
7368        if (endorser != null) {
7369          dst.endorser = new ArrayList<ContactDetail>();
7370          for (ContactDetail i : endorser)
7371            dst.endorser.add(i.copy());
7372        };
7373        if (relatedArtifact != null) {
7374          dst.relatedArtifact = new ArrayList<RelatedArtifact>();
7375          for (RelatedArtifact i : relatedArtifact)
7376            dst.relatedArtifact.add(i.copy());
7377        };
7378        if (library != null) {
7379          dst.library = new ArrayList<CanonicalType>();
7380          for (CanonicalType i : library)
7381            dst.library.add(i.copy());
7382        };
7383        if (goal != null) {
7384          dst.goal = new ArrayList<PlanDefinitionGoalComponent>();
7385          for (PlanDefinitionGoalComponent i : goal)
7386            dst.goal.add(i.copy());
7387        };
7388        if (action != null) {
7389          dst.action = new ArrayList<PlanDefinitionActionComponent>();
7390          for (PlanDefinitionActionComponent i : action)
7391            dst.action.add(i.copy());
7392        };
7393        return dst;
7394      }
7395
7396      protected PlanDefinition typedCopy() {
7397        return copy();
7398      }
7399
7400      @Override
7401      public boolean equalsDeep(Base other_) {
7402        if (!super.equalsDeep(other_))
7403          return false;
7404        if (!(other_ instanceof PlanDefinition))
7405          return false;
7406        PlanDefinition o = (PlanDefinition) other_;
7407        return compareDeep(identifier, o.identifier, true) && compareDeep(subtitle, o.subtitle, true) && compareDeep(type, o.type, true)
7408           && compareDeep(subject, o.subject, true) && compareDeep(purpose, o.purpose, true) && compareDeep(usage, o.usage, true)
7409           && compareDeep(copyright, o.copyright, true) && compareDeep(approvalDate, o.approvalDate, true)
7410           && compareDeep(lastReviewDate, o.lastReviewDate, true) && compareDeep(effectivePeriod, o.effectivePeriod, true)
7411           && compareDeep(topic, o.topic, true) && compareDeep(author, o.author, true) && compareDeep(editor, o.editor, true)
7412           && compareDeep(reviewer, o.reviewer, true) && compareDeep(endorser, o.endorser, true) && compareDeep(relatedArtifact, o.relatedArtifact, true)
7413           && compareDeep(library, o.library, true) && compareDeep(goal, o.goal, true) && compareDeep(action, o.action, true)
7414          ;
7415      }
7416
7417      @Override
7418      public boolean equalsShallow(Base other_) {
7419        if (!super.equalsShallow(other_))
7420          return false;
7421        if (!(other_ instanceof PlanDefinition))
7422          return false;
7423        PlanDefinition o = (PlanDefinition) other_;
7424        return compareValues(subtitle, o.subtitle, true) && compareValues(purpose, o.purpose, true) && compareValues(usage, o.usage, true)
7425           && compareValues(copyright, o.copyright, true) && compareValues(approvalDate, o.approvalDate, true)
7426           && compareValues(lastReviewDate, o.lastReviewDate, true);
7427      }
7428
7429      public boolean isEmpty() {
7430        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subtitle, type
7431          , subject, purpose, usage, copyright, approvalDate, lastReviewDate, effectivePeriod
7432          , topic, author, editor, reviewer, endorser, relatedArtifact, library, goal
7433          , action);
7434      }
7435
7436  @Override
7437  public ResourceType getResourceType() {
7438    return ResourceType.PlanDefinition;
7439   }
7440
7441 /**
7442   * Search parameter: <b>date</b>
7443   * <p>
7444   * Description: <b>The plan definition publication date</b><br>
7445   * Type: <b>date</b><br>
7446   * Path: <b>PlanDefinition.date</b><br>
7447   * </p>
7448   */
7449  @SearchParamDefinition(name="date", path="PlanDefinition.date", description="The plan definition publication date", type="date" )
7450  public static final String SP_DATE = "date";
7451 /**
7452   * <b>Fluent Client</b> search parameter constant for <b>date</b>
7453   * <p>
7454   * Description: <b>The plan definition publication date</b><br>
7455   * Type: <b>date</b><br>
7456   * Path: <b>PlanDefinition.date</b><br>
7457   * </p>
7458   */
7459  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
7460
7461 /**
7462   * Search parameter: <b>identifier</b>
7463   * <p>
7464   * Description: <b>External identifier for the plan definition</b><br>
7465   * Type: <b>token</b><br>
7466   * Path: <b>PlanDefinition.identifier</b><br>
7467   * </p>
7468   */
7469  @SearchParamDefinition(name="identifier", path="PlanDefinition.identifier", description="External identifier for the plan definition", type="token" )
7470  public static final String SP_IDENTIFIER = "identifier";
7471 /**
7472   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
7473   * <p>
7474   * Description: <b>External identifier for the plan definition</b><br>
7475   * Type: <b>token</b><br>
7476   * Path: <b>PlanDefinition.identifier</b><br>
7477   * </p>
7478   */
7479  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
7480
7481 /**
7482   * Search parameter: <b>successor</b>
7483   * <p>
7484   * Description: <b>What resource is being referenced</b><br>
7485   * Type: <b>reference</b><br>
7486   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7487   * </p>
7488   */
7489  @SearchParamDefinition(name="successor", path="PlanDefinition.relatedArtifact.where(type='successor').resource", description="What resource is being referenced", type="reference" )
7490  public static final String SP_SUCCESSOR = "successor";
7491 /**
7492   * <b>Fluent Client</b> search parameter constant for <b>successor</b>
7493   * <p>
7494   * Description: <b>What resource is being referenced</b><br>
7495   * Type: <b>reference</b><br>
7496   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7497   * </p>
7498   */
7499  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUCCESSOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUCCESSOR);
7500
7501/**
7502   * Constant for fluent queries to be used to add include statements. Specifies
7503   * the path value of "<b>PlanDefinition:successor</b>".
7504   */
7505  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUCCESSOR = new ca.uhn.fhir.model.api.Include("PlanDefinition:successor").toLocked();
7506
7507 /**
7508   * Search parameter: <b>context-type-value</b>
7509   * <p>
7510   * Description: <b>A use context type and value assigned to the plan definition</b><br>
7511   * Type: <b>composite</b><br>
7512   * Path: <b></b><br>
7513   * </p>
7514   */
7515  @SearchParamDefinition(name="context-type-value", path="PlanDefinition.useContext", description="A use context type and value assigned to the plan definition", type="composite", compositeOf={"context-type", "context"} )
7516  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
7517 /**
7518   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
7519   * <p>
7520   * Description: <b>A use context type and value assigned to the plan definition</b><br>
7521   * Type: <b>composite</b><br>
7522   * Path: <b></b><br>
7523   * </p>
7524   */
7525  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CONTEXT_TYPE_VALUE);
7526
7527 /**
7528   * Search parameter: <b>jurisdiction</b>
7529   * <p>
7530   * Description: <b>Intended jurisdiction for the plan definition</b><br>
7531   * Type: <b>token</b><br>
7532   * Path: <b>PlanDefinition.jurisdiction</b><br>
7533   * </p>
7534   */
7535  @SearchParamDefinition(name="jurisdiction", path="PlanDefinition.jurisdiction", description="Intended jurisdiction for the plan definition", type="token" )
7536  public static final String SP_JURISDICTION = "jurisdiction";
7537 /**
7538   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
7539   * <p>
7540   * Description: <b>Intended jurisdiction for the plan definition</b><br>
7541   * Type: <b>token</b><br>
7542   * Path: <b>PlanDefinition.jurisdiction</b><br>
7543   * </p>
7544   */
7545  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
7546
7547 /**
7548   * Search parameter: <b>description</b>
7549   * <p>
7550   * Description: <b>The description of the plan definition</b><br>
7551   * Type: <b>string</b><br>
7552   * Path: <b>PlanDefinition.description</b><br>
7553   * </p>
7554   */
7555  @SearchParamDefinition(name="description", path="PlanDefinition.description", description="The description of the plan definition", type="string" )
7556  public static final String SP_DESCRIPTION = "description";
7557 /**
7558   * <b>Fluent Client</b> search parameter constant for <b>description</b>
7559   * <p>
7560   * Description: <b>The description of the plan definition</b><br>
7561   * Type: <b>string</b><br>
7562   * Path: <b>PlanDefinition.description</b><br>
7563   * </p>
7564   */
7565  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
7566
7567 /**
7568   * Search parameter: <b>derived-from</b>
7569   * <p>
7570   * Description: <b>What resource is being referenced</b><br>
7571   * Type: <b>reference</b><br>
7572   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7573   * </p>
7574   */
7575  @SearchParamDefinition(name="derived-from", path="PlanDefinition.relatedArtifact.where(type='derived-from').resource", description="What resource is being referenced", type="reference" )
7576  public static final String SP_DERIVED_FROM = "derived-from";
7577 /**
7578   * <b>Fluent Client</b> search parameter constant for <b>derived-from</b>
7579   * <p>
7580   * Description: <b>What resource is being referenced</b><br>
7581   * Type: <b>reference</b><br>
7582   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7583   * </p>
7584   */
7585  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DERIVED_FROM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DERIVED_FROM);
7586
7587/**
7588   * Constant for fluent queries to be used to add include statements. Specifies
7589   * the path value of "<b>PlanDefinition:derived-from</b>".
7590   */
7591  public static final ca.uhn.fhir.model.api.Include INCLUDE_DERIVED_FROM = new ca.uhn.fhir.model.api.Include("PlanDefinition:derived-from").toLocked();
7592
7593 /**
7594   * Search parameter: <b>context-type</b>
7595   * <p>
7596   * Description: <b>A type of use context assigned to the plan definition</b><br>
7597   * Type: <b>token</b><br>
7598   * Path: <b>PlanDefinition.useContext.code</b><br>
7599   * </p>
7600   */
7601  @SearchParamDefinition(name="context-type", path="PlanDefinition.useContext.code", description="A type of use context assigned to the plan definition", type="token" )
7602  public static final String SP_CONTEXT_TYPE = "context-type";
7603 /**
7604   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
7605   * <p>
7606   * Description: <b>A type of use context assigned to the plan definition</b><br>
7607   * Type: <b>token</b><br>
7608   * Path: <b>PlanDefinition.useContext.code</b><br>
7609   * </p>
7610   */
7611  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
7612
7613 /**
7614   * Search parameter: <b>predecessor</b>
7615   * <p>
7616   * Description: <b>What resource is being referenced</b><br>
7617   * Type: <b>reference</b><br>
7618   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7619   * </p>
7620   */
7621  @SearchParamDefinition(name="predecessor", path="PlanDefinition.relatedArtifact.where(type='predecessor').resource", description="What resource is being referenced", type="reference" )
7622  public static final String SP_PREDECESSOR = "predecessor";
7623 /**
7624   * <b>Fluent Client</b> search parameter constant for <b>predecessor</b>
7625   * <p>
7626   * Description: <b>What resource is being referenced</b><br>
7627   * Type: <b>reference</b><br>
7628   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7629   * </p>
7630   */
7631  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PREDECESSOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PREDECESSOR);
7632
7633/**
7634   * Constant for fluent queries to be used to add include statements. Specifies
7635   * the path value of "<b>PlanDefinition:predecessor</b>".
7636   */
7637  public static final ca.uhn.fhir.model.api.Include INCLUDE_PREDECESSOR = new ca.uhn.fhir.model.api.Include("PlanDefinition:predecessor").toLocked();
7638
7639 /**
7640   * Search parameter: <b>title</b>
7641   * <p>
7642   * Description: <b>The human-friendly name of the plan definition</b><br>
7643   * Type: <b>string</b><br>
7644   * Path: <b>PlanDefinition.title</b><br>
7645   * </p>
7646   */
7647  @SearchParamDefinition(name="title", path="PlanDefinition.title", description="The human-friendly name of the plan definition", type="string" )
7648  public static final String SP_TITLE = "title";
7649 /**
7650   * <b>Fluent Client</b> search parameter constant for <b>title</b>
7651   * <p>
7652   * Description: <b>The human-friendly name of the plan definition</b><br>
7653   * Type: <b>string</b><br>
7654   * Path: <b>PlanDefinition.title</b><br>
7655   * </p>
7656   */
7657  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
7658
7659 /**
7660   * Search parameter: <b>composed-of</b>
7661   * <p>
7662   * Description: <b>What resource is being referenced</b><br>
7663   * Type: <b>reference</b><br>
7664   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7665   * </p>
7666   */
7667  @SearchParamDefinition(name="composed-of", path="PlanDefinition.relatedArtifact.where(type='composed-of').resource", description="What resource is being referenced", type="reference" )
7668  public static final String SP_COMPOSED_OF = "composed-of";
7669 /**
7670   * <b>Fluent Client</b> search parameter constant for <b>composed-of</b>
7671   * <p>
7672   * Description: <b>What resource is being referenced</b><br>
7673   * Type: <b>reference</b><br>
7674   * Path: <b>PlanDefinition.relatedArtifact.resource</b><br>
7675   * </p>
7676   */
7677  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COMPOSED_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COMPOSED_OF);
7678
7679/**
7680   * Constant for fluent queries to be used to add include statements. Specifies
7681   * the path value of "<b>PlanDefinition:composed-of</b>".
7682   */
7683  public static final ca.uhn.fhir.model.api.Include INCLUDE_COMPOSED_OF = new ca.uhn.fhir.model.api.Include("PlanDefinition:composed-of").toLocked();
7684
7685 /**
7686   * Search parameter: <b>type</b>
7687   * <p>
7688   * Description: <b>The type of artifact the plan (e.g. order-set, eca-rule, protocol)</b><br>
7689   * Type: <b>token</b><br>
7690   * Path: <b>PlanDefinition.type</b><br>
7691   * </p>
7692   */
7693  @SearchParamDefinition(name="type", path="PlanDefinition.type", description="The type of artifact the plan (e.g. order-set, eca-rule, protocol)", type="token" )
7694  public static final String SP_TYPE = "type";
7695 /**
7696   * <b>Fluent Client</b> search parameter constant for <b>type</b>
7697   * <p>
7698   * Description: <b>The type of artifact the plan (e.g. order-set, eca-rule, protocol)</b><br>
7699   * Type: <b>token</b><br>
7700   * Path: <b>PlanDefinition.type</b><br>
7701   * </p>
7702   */
7703  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
7704
7705 /**
7706   * Search parameter: <b>version</b>
7707   * <p>
7708   * Description: <b>The business version of the plan definition</b><br>
7709   * Type: <b>token</b><br>
7710   * Path: <b>PlanDefinition.version</b><br>
7711   * </p>
7712   */
7713  @SearchParamDefinition(name="version", path="PlanDefinition.version", description="The business version of the plan definition", type="token" )
7714  public static final String SP_VERSION = "version";
7715 /**
7716   * <b>Fluent Client</b> search parameter constant for <b>version</b>
7717   * <p>
7718   * Description: <b>The business version of the plan definition</b><br>
7719   * Type: <b>token</b><br>
7720   * Path: <b>PlanDefinition.version</b><br>
7721   * </p>
7722   */
7723  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
7724
7725 /**
7726   * Search parameter: <b>url</b>
7727   * <p>
7728   * Description: <b>The uri that identifies the plan definition</b><br>
7729   * Type: <b>uri</b><br>
7730   * Path: <b>PlanDefinition.url</b><br>
7731   * </p>
7732   */
7733  @SearchParamDefinition(name="url", path="PlanDefinition.url", description="The uri that identifies the plan definition", type="uri" )
7734  public static final String SP_URL = "url";
7735 /**
7736   * <b>Fluent Client</b> search parameter constant for <b>url</b>
7737   * <p>
7738   * Description: <b>The uri that identifies the plan definition</b><br>
7739   * Type: <b>uri</b><br>
7740   * Path: <b>PlanDefinition.url</b><br>
7741   * </p>
7742   */
7743  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
7744
7745 /**
7746   * Search parameter: <b>context-quantity</b>
7747   * <p>
7748   * Description: <b>A quantity- or range-valued use context assigned to the plan definition</b><br>
7749   * Type: <b>quantity</b><br>
7750   * Path: <b>PlanDefinition.useContext.valueQuantity, PlanDefinition.useContext.valueRange</b><br>
7751   * </p>
7752   */
7753  @SearchParamDefinition(name="context-quantity", path="(PlanDefinition.useContext.value as Quantity) | (PlanDefinition.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the plan definition", type="quantity" )
7754  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
7755 /**
7756   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
7757   * <p>
7758   * Description: <b>A quantity- or range-valued use context assigned to the plan definition</b><br>
7759   * Type: <b>quantity</b><br>
7760   * Path: <b>PlanDefinition.useContext.valueQuantity, PlanDefinition.useContext.valueRange</b><br>
7761   * </p>
7762   */
7763  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
7764
7765 /**
7766   * Search parameter: <b>effective</b>
7767   * <p>
7768   * Description: <b>The time during which the plan definition is intended to be in use</b><br>
7769   * Type: <b>date</b><br>
7770   * Path: <b>PlanDefinition.effectivePeriod</b><br>
7771   * </p>
7772   */
7773  @SearchParamDefinition(name="effective", path="PlanDefinition.effectivePeriod", description="The time during which the plan definition is intended to be in use", type="date" )
7774  public static final String SP_EFFECTIVE = "effective";
7775 /**
7776   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
7777   * <p>
7778   * Description: <b>The time during which the plan definition is intended to be in use</b><br>
7779   * Type: <b>date</b><br>
7780   * Path: <b>PlanDefinition.effectivePeriod</b><br>
7781   * </p>
7782   */
7783  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
7784
7785 /**
7786   * Search parameter: <b>depends-on</b>
7787   * <p>
7788   * Description: <b>What resource is being referenced</b><br>
7789   * Type: <b>reference</b><br>
7790   * Path: <b>PlanDefinition.relatedArtifact.resource, PlanDefinition.library</b><br>
7791   * </p>
7792   */
7793  @SearchParamDefinition(name="depends-on", path="PlanDefinition.relatedArtifact.where(type='depends-on').resource | PlanDefinition.library", description="What resource is being referenced", type="reference" )
7794  public static final String SP_DEPENDS_ON = "depends-on";
7795 /**
7796   * <b>Fluent Client</b> search parameter constant for <b>depends-on</b>
7797   * <p>
7798   * Description: <b>What resource is being referenced</b><br>
7799   * Type: <b>reference</b><br>
7800   * Path: <b>PlanDefinition.relatedArtifact.resource, PlanDefinition.library</b><br>
7801   * </p>
7802   */
7803  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEPENDS_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEPENDS_ON);
7804
7805/**
7806   * Constant for fluent queries to be used to add include statements. Specifies
7807   * the path value of "<b>PlanDefinition:depends-on</b>".
7808   */
7809  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEPENDS_ON = new ca.uhn.fhir.model.api.Include("PlanDefinition:depends-on").toLocked();
7810
7811 /**
7812   * Search parameter: <b>name</b>
7813   * <p>
7814   * Description: <b>Computationally friendly name of the plan definition</b><br>
7815   * Type: <b>string</b><br>
7816   * Path: <b>PlanDefinition.name</b><br>
7817   * </p>
7818   */
7819  @SearchParamDefinition(name="name", path="PlanDefinition.name", description="Computationally friendly name of the plan definition", type="string" )
7820  public static final String SP_NAME = "name";
7821 /**
7822   * <b>Fluent Client</b> search parameter constant for <b>name</b>
7823   * <p>
7824   * Description: <b>Computationally friendly name of the plan definition</b><br>
7825   * Type: <b>string</b><br>
7826   * Path: <b>PlanDefinition.name</b><br>
7827   * </p>
7828   */
7829  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
7830
7831 /**
7832   * Search parameter: <b>context</b>
7833   * <p>
7834   * Description: <b>A use context assigned to the plan definition</b><br>
7835   * Type: <b>token</b><br>
7836   * Path: <b>PlanDefinition.useContext.valueCodeableConcept</b><br>
7837   * </p>
7838   */
7839  @SearchParamDefinition(name="context", path="(PlanDefinition.useContext.value as CodeableConcept)", description="A use context assigned to the plan definition", type="token" )
7840  public static final String SP_CONTEXT = "context";
7841 /**
7842   * <b>Fluent Client</b> search parameter constant for <b>context</b>
7843   * <p>
7844   * Description: <b>A use context assigned to the plan definition</b><br>
7845   * Type: <b>token</b><br>
7846   * Path: <b>PlanDefinition.useContext.valueCodeableConcept</b><br>
7847   * </p>
7848   */
7849  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
7850
7851 /**
7852   * Search parameter: <b>publisher</b>
7853   * <p>
7854   * Description: <b>Name of the publisher of the plan definition</b><br>
7855   * Type: <b>string</b><br>
7856   * Path: <b>PlanDefinition.publisher</b><br>
7857   * </p>
7858   */
7859  @SearchParamDefinition(name="publisher", path="PlanDefinition.publisher", description="Name of the publisher of the plan definition", type="string" )
7860  public static final String SP_PUBLISHER = "publisher";
7861 /**
7862   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
7863   * <p>
7864   * Description: <b>Name of the publisher of the plan definition</b><br>
7865   * Type: <b>string</b><br>
7866   * Path: <b>PlanDefinition.publisher</b><br>
7867   * </p>
7868   */
7869  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
7870
7871 /**
7872   * Search parameter: <b>topic</b>
7873   * <p>
7874   * Description: <b>Topics associated with the module</b><br>
7875   * Type: <b>token</b><br>
7876   * Path: <b>PlanDefinition.topic</b><br>
7877   * </p>
7878   */
7879  @SearchParamDefinition(name="topic", path="PlanDefinition.topic", description="Topics associated with the module", type="token" )
7880  public static final String SP_TOPIC = "topic";
7881 /**
7882   * <b>Fluent Client</b> search parameter constant for <b>topic</b>
7883   * <p>
7884   * Description: <b>Topics associated with the module</b><br>
7885   * Type: <b>token</b><br>
7886   * Path: <b>PlanDefinition.topic</b><br>
7887   * </p>
7888   */
7889  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TOPIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TOPIC);
7890
7891 /**
7892   * Search parameter: <b>definition</b>
7893   * <p>
7894   * Description: <b>Activity or plan definitions used by plan definition</b><br>
7895   * Type: <b>reference</b><br>
7896   * Path: <b>PlanDefinition.action.definition</b><br>
7897   * </p>
7898   */
7899  @SearchParamDefinition(name="definition", path="PlanDefinition.action.definition", description="Activity or plan definitions used by plan definition", type="reference", target={ActivityDefinition.class, PlanDefinition.class, Questionnaire.class } )
7900  public static final String SP_DEFINITION = "definition";
7901 /**
7902   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
7903   * <p>
7904   * Description: <b>Activity or plan definitions used by plan definition</b><br>
7905   * Type: <b>reference</b><br>
7906   * Path: <b>PlanDefinition.action.definition</b><br>
7907   * </p>
7908   */
7909  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEFINITION);
7910
7911/**
7912   * Constant for fluent queries to be used to add include statements. Specifies
7913   * the path value of "<b>PlanDefinition:definition</b>".
7914   */
7915  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEFINITION = new ca.uhn.fhir.model.api.Include("PlanDefinition:definition").toLocked();
7916
7917 /**
7918   * Search parameter: <b>context-type-quantity</b>
7919   * <p>
7920   * Description: <b>A use context type and quantity- or range-based value assigned to the plan definition</b><br>
7921   * Type: <b>composite</b><br>
7922   * Path: <b></b><br>
7923   * </p>
7924   */
7925  @SearchParamDefinition(name="context-type-quantity", path="PlanDefinition.useContext", description="A use context type and quantity- or range-based value assigned to the plan definition", type="composite", compositeOf={"context-type", "context-quantity"} )
7926  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
7927 /**
7928   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
7929   * <p>
7930   * Description: <b>A use context type and quantity- or range-based value assigned to the plan definition</b><br>
7931   * Type: <b>composite</b><br>
7932   * Path: <b></b><br>
7933   * </p>
7934   */
7935  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CONTEXT_TYPE_QUANTITY);
7936
7937 /**
7938   * Search parameter: <b>status</b>
7939   * <p>
7940   * Description: <b>The current status of the plan definition</b><br>
7941   * Type: <b>token</b><br>
7942   * Path: <b>PlanDefinition.status</b><br>
7943   * </p>
7944   */
7945  @SearchParamDefinition(name="status", path="PlanDefinition.status", description="The current status of the plan definition", type="token" )
7946  public static final String SP_STATUS = "status";
7947 /**
7948   * <b>Fluent Client</b> search parameter constant for <b>status</b>
7949   * <p>
7950   * Description: <b>The current status of the plan definition</b><br>
7951   * Type: <b>token</b><br>
7952   * Path: <b>PlanDefinition.status</b><br>
7953   * </p>
7954   */
7955  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
7956
7957
7958}
7959