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