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