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