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