001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.DatatypeDef;
047import ca.uhn.fhir.model.api.annotation.Description;
048/**
049 * The definition of an action to be performed. Some aspects of the definition are specified statically, and some aspects can be specified dynamically by referencing logic defined in a library.
050 */
051@DatatypeDef(name="ActionDefinition")
052public class ActionDefinition extends Type implements ICompositeType {
053
054    public enum ActionRelationshipType {
055        /**
056         * The action must be performed before the related action
057         */
058        BEFORE, 
059        /**
060         * The action must be performed after the related action
061         */
062        AFTER, 
063        /**
064         * added to help the parsers
065         */
066        NULL;
067        public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("before".equals(codeString))
071          return BEFORE;
072        if ("after".equals(codeString))
073          return AFTER;
074        throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
075        }
076        public String toCode() {
077          switch (this) {
078            case BEFORE: return "before";
079            case AFTER: return "after";
080            case NULL: return null;
081            default: return "?";
082          }
083        }
084        public String getSystem() {
085          switch (this) {
086            case BEFORE: return "http://hl7.org/fhir/action-relationship-type";
087            case AFTER: return "http://hl7.org/fhir/action-relationship-type";
088            case NULL: return null;
089            default: return "?";
090          }
091        }
092        public String getDefinition() {
093          switch (this) {
094            case BEFORE: return "The action must be performed before the related action";
095            case AFTER: return "The action must be performed after the related action";
096            case NULL: return null;
097            default: return "?";
098          }
099        }
100        public String getDisplay() {
101          switch (this) {
102            case BEFORE: return "Before";
103            case AFTER: return "After";
104            case NULL: return null;
105            default: return "?";
106          }
107        }
108    }
109
110  public static class ActionRelationshipTypeEnumFactory implements EnumFactory<ActionRelationshipType> {
111    public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
112      if (codeString == null || "".equals(codeString))
113            if (codeString == null || "".equals(codeString))
114                return null;
115        if ("before".equals(codeString))
116          return ActionRelationshipType.BEFORE;
117        if ("after".equals(codeString))
118          return ActionRelationshipType.AFTER;
119        throw new IllegalArgumentException("Unknown ActionRelationshipType code '"+codeString+"'");
120        }
121        public Enumeration<ActionRelationshipType> fromType(Base code) throws FHIRException {
122          if (code == null || code.isEmpty())
123            return null;
124          String codeString = ((PrimitiveType) code).asStringValue();
125          if (codeString == null || "".equals(codeString))
126            return null;
127        if ("before".equals(codeString))
128          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFORE);
129        if ("after".equals(codeString))
130          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTER);
131        throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
132        }
133    public String toCode(ActionRelationshipType code) {
134      if (code == ActionRelationshipType.BEFORE)
135        return "before";
136      if (code == ActionRelationshipType.AFTER)
137        return "after";
138      return "?";
139      }
140    public String toSystem(ActionRelationshipType code) {
141      return code.getSystem();
142      }
143    }
144
145    public enum ActionRelationshipAnchor {
146        /**
147         * The action relationship is anchored to the start of the related action
148         */
149        START, 
150        /**
151         * The action relationship is anchored to the end of the related action
152         */
153        END, 
154        /**
155         * added to help the parsers
156         */
157        NULL;
158        public static ActionRelationshipAnchor fromCode(String codeString) throws FHIRException {
159            if (codeString == null || "".equals(codeString))
160                return null;
161        if ("start".equals(codeString))
162          return START;
163        if ("end".equals(codeString))
164          return END;
165        throw new FHIRException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
166        }
167        public String toCode() {
168          switch (this) {
169            case START: return "start";
170            case END: return "end";
171            case NULL: return null;
172            default: return "?";
173          }
174        }
175        public String getSystem() {
176          switch (this) {
177            case START: return "http://hl7.org/fhir/action-relationship-anchor";
178            case END: return "http://hl7.org/fhir/action-relationship-anchor";
179            case NULL: return null;
180            default: return "?";
181          }
182        }
183        public String getDefinition() {
184          switch (this) {
185            case START: return "The action relationship is anchored to the start of the related action";
186            case END: return "The action relationship is anchored to the end of the related action";
187            case NULL: return null;
188            default: return "?";
189          }
190        }
191        public String getDisplay() {
192          switch (this) {
193            case START: return "Start";
194            case END: return "End";
195            case NULL: return null;
196            default: return "?";
197          }
198        }
199    }
200
201  public static class ActionRelationshipAnchorEnumFactory implements EnumFactory<ActionRelationshipAnchor> {
202    public ActionRelationshipAnchor fromCode(String codeString) throws IllegalArgumentException {
203      if (codeString == null || "".equals(codeString))
204            if (codeString == null || "".equals(codeString))
205                return null;
206        if ("start".equals(codeString))
207          return ActionRelationshipAnchor.START;
208        if ("end".equals(codeString))
209          return ActionRelationshipAnchor.END;
210        throw new IllegalArgumentException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
211        }
212        public Enumeration<ActionRelationshipAnchor> fromType(Base code) throws FHIRException {
213          if (code == null || code.isEmpty())
214            return null;
215          String codeString = ((PrimitiveType) code).asStringValue();
216          if (codeString == null || "".equals(codeString))
217            return null;
218        if ("start".equals(codeString))
219          return new Enumeration<ActionRelationshipAnchor>(this, ActionRelationshipAnchor.START);
220        if ("end".equals(codeString))
221          return new Enumeration<ActionRelationshipAnchor>(this, ActionRelationshipAnchor.END);
222        throw new FHIRException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
223        }
224    public String toCode(ActionRelationshipAnchor code) {
225      if (code == ActionRelationshipAnchor.START)
226        return "start";
227      if (code == ActionRelationshipAnchor.END)
228        return "end";
229      return "?";
230      }
231    public String toSystem(ActionRelationshipAnchor code) {
232      return code.getSystem();
233      }
234    }
235
236    public enum ParticipantType {
237        /**
238         * The participant is the patient under evaluation
239         */
240        PATIENT, 
241        /**
242         * The participant is a practitioner involved in the patient's care
243         */
244        PRACTITIONER, 
245        /**
246         * The participant is a person related to the patient
247         */
248        RELATEDPERSON, 
249        /**
250         * added to help the parsers
251         */
252        NULL;
253        public static ParticipantType fromCode(String codeString) throws FHIRException {
254            if (codeString == null || "".equals(codeString))
255                return null;
256        if ("patient".equals(codeString))
257          return PATIENT;
258        if ("practitioner".equals(codeString))
259          return PRACTITIONER;
260        if ("related-person".equals(codeString))
261          return RELATEDPERSON;
262        throw new FHIRException("Unknown ParticipantType code '"+codeString+"'");
263        }
264        public String toCode() {
265          switch (this) {
266            case PATIENT: return "patient";
267            case PRACTITIONER: return "practitioner";
268            case RELATEDPERSON: return "related-person";
269            case NULL: return null;
270            default: return "?";
271          }
272        }
273        public String getSystem() {
274          switch (this) {
275            case PATIENT: return "http://hl7.org/fhir/action-participant-type";
276            case PRACTITIONER: return "http://hl7.org/fhir/action-participant-type";
277            case RELATEDPERSON: return "http://hl7.org/fhir/action-participant-type";
278            case NULL: return null;
279            default: return "?";
280          }
281        }
282        public String getDefinition() {
283          switch (this) {
284            case PATIENT: return "The participant is the patient under evaluation";
285            case PRACTITIONER: return "The participant is a practitioner involved in the patient's care";
286            case RELATEDPERSON: return "The participant is a person related to the patient";
287            case NULL: return null;
288            default: return "?";
289          }
290        }
291        public String getDisplay() {
292          switch (this) {
293            case PATIENT: return "Patient";
294            case PRACTITIONER: return "Practitioner";
295            case RELATEDPERSON: return "Related Person";
296            case NULL: return null;
297            default: return "?";
298          }
299        }
300    }
301
302  public static class ParticipantTypeEnumFactory implements EnumFactory<ParticipantType> {
303    public ParticipantType fromCode(String codeString) throws IllegalArgumentException {
304      if (codeString == null || "".equals(codeString))
305            if (codeString == null || "".equals(codeString))
306                return null;
307        if ("patient".equals(codeString))
308          return ParticipantType.PATIENT;
309        if ("practitioner".equals(codeString))
310          return ParticipantType.PRACTITIONER;
311        if ("related-person".equals(codeString))
312          return ParticipantType.RELATEDPERSON;
313        throw new IllegalArgumentException("Unknown ParticipantType code '"+codeString+"'");
314        }
315        public Enumeration<ParticipantType> fromType(Base code) throws FHIRException {
316          if (code == null || code.isEmpty())
317            return null;
318          String codeString = ((PrimitiveType) code).asStringValue();
319          if (codeString == null || "".equals(codeString))
320            return null;
321        if ("patient".equals(codeString))
322          return new Enumeration<ParticipantType>(this, ParticipantType.PATIENT);
323        if ("practitioner".equals(codeString))
324          return new Enumeration<ParticipantType>(this, ParticipantType.PRACTITIONER);
325        if ("related-person".equals(codeString))
326          return new Enumeration<ParticipantType>(this, ParticipantType.RELATEDPERSON);
327        throw new FHIRException("Unknown ParticipantType code '"+codeString+"'");
328        }
329    public String toCode(ParticipantType code) {
330      if (code == ParticipantType.PATIENT)
331        return "patient";
332      if (code == ParticipantType.PRACTITIONER)
333        return "practitioner";
334      if (code == ParticipantType.RELATEDPERSON)
335        return "related-person";
336      return "?";
337      }
338    public String toSystem(ParticipantType code) {
339      return code.getSystem();
340      }
341    }
342
343    public enum ActionType {
344        /**
345         * The action is to create a new resource
346         */
347        CREATE, 
348        /**
349         * The action is to update an existing resource
350         */
351        UPDATE, 
352        /**
353         * The action is to remove an existing resource
354         */
355        REMOVE, 
356        /**
357         * The action is to fire a specific event
358         */
359        FIREEVENT, 
360        /**
361         * added to help the parsers
362         */
363        NULL;
364        public static ActionType fromCode(String codeString) throws FHIRException {
365            if (codeString == null || "".equals(codeString))
366                return null;
367        if ("create".equals(codeString))
368          return CREATE;
369        if ("update".equals(codeString))
370          return UPDATE;
371        if ("remove".equals(codeString))
372          return REMOVE;
373        if ("fire-event".equals(codeString))
374          return FIREEVENT;
375        throw new FHIRException("Unknown ActionType code '"+codeString+"'");
376        }
377        public String toCode() {
378          switch (this) {
379            case CREATE: return "create";
380            case UPDATE: return "update";
381            case REMOVE: return "remove";
382            case FIREEVENT: return "fire-event";
383            case NULL: return null;
384            default: return "?";
385          }
386        }
387        public String getSystem() {
388          switch (this) {
389            case CREATE: return "http://hl7.org/fhir/action-type";
390            case UPDATE: return "http://hl7.org/fhir/action-type";
391            case REMOVE: return "http://hl7.org/fhir/action-type";
392            case FIREEVENT: return "http://hl7.org/fhir/action-type";
393            case NULL: return null;
394            default: return "?";
395          }
396        }
397        public String getDefinition() {
398          switch (this) {
399            case CREATE: return "The action is to create a new resource";
400            case UPDATE: return "The action is to update an existing resource";
401            case REMOVE: return "The action is to remove an existing resource";
402            case FIREEVENT: return "The action is to fire a specific event";
403            case NULL: return null;
404            default: return "?";
405          }
406        }
407        public String getDisplay() {
408          switch (this) {
409            case CREATE: return "Create";
410            case UPDATE: return "Update";
411            case REMOVE: return "Remove";
412            case FIREEVENT: return "Fire Event";
413            case NULL: return null;
414            default: return "?";
415          }
416        }
417    }
418
419  public static class ActionTypeEnumFactory implements EnumFactory<ActionType> {
420    public ActionType fromCode(String codeString) throws IllegalArgumentException {
421      if (codeString == null || "".equals(codeString))
422            if (codeString == null || "".equals(codeString))
423                return null;
424        if ("create".equals(codeString))
425          return ActionType.CREATE;
426        if ("update".equals(codeString))
427          return ActionType.UPDATE;
428        if ("remove".equals(codeString))
429          return ActionType.REMOVE;
430        if ("fire-event".equals(codeString))
431          return ActionType.FIREEVENT;
432        throw new IllegalArgumentException("Unknown ActionType code '"+codeString+"'");
433        }
434        public Enumeration<ActionType> fromType(Base code) throws FHIRException {
435          if (code == null || code.isEmpty())
436            return null;
437          String codeString = ((PrimitiveType) code).asStringValue();
438          if (codeString == null || "".equals(codeString))
439            return null;
440        if ("create".equals(codeString))
441          return new Enumeration<ActionType>(this, ActionType.CREATE);
442        if ("update".equals(codeString))
443          return new Enumeration<ActionType>(this, ActionType.UPDATE);
444        if ("remove".equals(codeString))
445          return new Enumeration<ActionType>(this, ActionType.REMOVE);
446        if ("fire-event".equals(codeString))
447          return new Enumeration<ActionType>(this, ActionType.FIREEVENT);
448        throw new FHIRException("Unknown ActionType code '"+codeString+"'");
449        }
450    public String toCode(ActionType code) {
451      if (code == ActionType.CREATE)
452        return "create";
453      if (code == ActionType.UPDATE)
454        return "update";
455      if (code == ActionType.REMOVE)
456        return "remove";
457      if (code == ActionType.FIREEVENT)
458        return "fire-event";
459      return "?";
460      }
461    public String toSystem(ActionType code) {
462      return code.getSystem();
463      }
464    }
465
466    @Block()
467    public static class ActionDefinitionRelatedActionComponent extends Element implements IBaseDatatypeElement {
468        /**
469         * The unique identifier of the related action.
470         */
471        @Child(name = "actionIdentifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
472        @Description(shortDefinition="Identifier of the related action", formalDefinition="The unique identifier of the related action." )
473        protected Identifier actionIdentifier;
474
475        /**
476         * The relationship of this action to the related action.
477         */
478        @Child(name = "relationship", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
479        @Description(shortDefinition="before | after", formalDefinition="The relationship of this action to the related action." )
480        protected Enumeration<ActionRelationshipType> relationship;
481
482        /**
483         * A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.
484         */
485        @Child(name = "offset", type = {Duration.class, Range.class}, order=3, min=0, max=1, modifier=false, summary=true)
486        @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." )
487        protected Type offset;
488
489        /**
490         * An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
491         */
492        @Child(name = "anchor", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
493        @Description(shortDefinition="start | end", formalDefinition="An optional indicator for how the relationship is anchored to the related action. For example \"before the start\" or \"before the end\" of the related action." )
494        protected Enumeration<ActionRelationshipAnchor> anchor;
495
496        private static final long serialVersionUID = 451097227L;
497
498    /**
499     * Constructor
500     */
501      public ActionDefinitionRelatedActionComponent() {
502        super();
503      }
504
505    /**
506     * Constructor
507     */
508      public ActionDefinitionRelatedActionComponent(Identifier actionIdentifier, Enumeration<ActionRelationshipType> relationship) {
509        super();
510        this.actionIdentifier = actionIdentifier;
511        this.relationship = relationship;
512      }
513
514        /**
515         * @return {@link #actionIdentifier} (The unique identifier of the related action.)
516         */
517        public Identifier getActionIdentifier() { 
518          if (this.actionIdentifier == null)
519            if (Configuration.errorOnAutoCreate())
520              throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.actionIdentifier");
521            else if (Configuration.doAutoCreate())
522              this.actionIdentifier = new Identifier(); // cc
523          return this.actionIdentifier;
524        }
525
526        public boolean hasActionIdentifier() { 
527          return this.actionIdentifier != null && !this.actionIdentifier.isEmpty();
528        }
529
530        /**
531         * @param value {@link #actionIdentifier} (The unique identifier of the related action.)
532         */
533        public ActionDefinitionRelatedActionComponent setActionIdentifier(Identifier value) { 
534          this.actionIdentifier = value;
535          return this;
536        }
537
538        /**
539         * @return {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
540         */
541        public Enumeration<ActionRelationshipType> getRelationshipElement() { 
542          if (this.relationship == null)
543            if (Configuration.errorOnAutoCreate())
544              throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.relationship");
545            else if (Configuration.doAutoCreate())
546              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory()); // bb
547          return this.relationship;
548        }
549
550        public boolean hasRelationshipElement() { 
551          return this.relationship != null && !this.relationship.isEmpty();
552        }
553
554        public boolean hasRelationship() { 
555          return this.relationship != null && !this.relationship.isEmpty();
556        }
557
558        /**
559         * @param value {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
560         */
561        public ActionDefinitionRelatedActionComponent setRelationshipElement(Enumeration<ActionRelationshipType> value) { 
562          this.relationship = value;
563          return this;
564        }
565
566        /**
567         * @return The relationship of this action to the related action.
568         */
569        public ActionRelationshipType getRelationship() { 
570          return this.relationship == null ? null : this.relationship.getValue();
571        }
572
573        /**
574         * @param value The relationship of this action to the related action.
575         */
576        public ActionDefinitionRelatedActionComponent setRelationship(ActionRelationshipType value) { 
577            if (this.relationship == null)
578              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory());
579            this.relationship.setValue(value);
580          return this;
581        }
582
583        /**
584         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
585         */
586        public Type getOffset() { 
587          return this.offset;
588        }
589
590        /**
591         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
592         */
593        public Duration getOffsetDuration() throws FHIRException { 
594          if (!(this.offset instanceof Duration))
595            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.offset.getClass().getName()+" was encountered");
596          return (Duration) this.offset;
597        }
598
599        public boolean hasOffsetDuration() { 
600          return this.offset instanceof Duration;
601        }
602
603        /**
604         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
605         */
606        public Range getOffsetRange() throws FHIRException { 
607          if (!(this.offset instanceof Range))
608            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.offset.getClass().getName()+" was encountered");
609          return (Range) this.offset;
610        }
611
612        public boolean hasOffsetRange() { 
613          return this.offset instanceof Range;
614        }
615
616        public boolean hasOffset() { 
617          return this.offset != null && !this.offset.isEmpty();
618        }
619
620        /**
621         * @param value {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
622         */
623        public ActionDefinitionRelatedActionComponent setOffset(Type value) { 
624          this.offset = value;
625          return this;
626        }
627
628        /**
629         * @return {@link #anchor} (An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.). This is the underlying object with id, value and extensions. The accessor "getAnchor" gives direct access to the value
630         */
631        public Enumeration<ActionRelationshipAnchor> getAnchorElement() { 
632          if (this.anchor == null)
633            if (Configuration.errorOnAutoCreate())
634              throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.anchor");
635            else if (Configuration.doAutoCreate())
636              this.anchor = new Enumeration<ActionRelationshipAnchor>(new ActionRelationshipAnchorEnumFactory()); // bb
637          return this.anchor;
638        }
639
640        public boolean hasAnchorElement() { 
641          return this.anchor != null && !this.anchor.isEmpty();
642        }
643
644        public boolean hasAnchor() { 
645          return this.anchor != null && !this.anchor.isEmpty();
646        }
647
648        /**
649         * @param value {@link #anchor} (An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.). This is the underlying object with id, value and extensions. The accessor "getAnchor" gives direct access to the value
650         */
651        public ActionDefinitionRelatedActionComponent setAnchorElement(Enumeration<ActionRelationshipAnchor> value) { 
652          this.anchor = value;
653          return this;
654        }
655
656        /**
657         * @return An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
658         */
659        public ActionRelationshipAnchor getAnchor() { 
660          return this.anchor == null ? null : this.anchor.getValue();
661        }
662
663        /**
664         * @param value An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
665         */
666        public ActionDefinitionRelatedActionComponent setAnchor(ActionRelationshipAnchor value) { 
667          if (value == null)
668            this.anchor = null;
669          else {
670            if (this.anchor == null)
671              this.anchor = new Enumeration<ActionRelationshipAnchor>(new ActionRelationshipAnchorEnumFactory());
672            this.anchor.setValue(value);
673          }
674          return this;
675        }
676
677        protected void listChildren(List<Property> childrenList) {
678          super.listChildren(childrenList);
679          childrenList.add(new Property("actionIdentifier", "Identifier", "The unique identifier of the related action.", 0, java.lang.Integer.MAX_VALUE, actionIdentifier));
680          childrenList.add(new Property("relationship", "code", "The relationship of this action to the related action.", 0, java.lang.Integer.MAX_VALUE, relationship));
681          childrenList.add(new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, java.lang.Integer.MAX_VALUE, offset));
682          childrenList.add(new Property("anchor", "code", "An optional indicator for how the relationship is anchored to the related action. For example \"before the start\" or \"before the end\" of the related action.", 0, java.lang.Integer.MAX_VALUE, anchor));
683        }
684
685      @Override
686      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
687        switch (hash) {
688        case -889046145: /*actionIdentifier*/ return this.actionIdentifier == null ? new Base[0] : new Base[] {this.actionIdentifier}; // Identifier
689        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Enumeration<ActionRelationshipType>
690        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // Type
691        case -1413299531: /*anchor*/ return this.anchor == null ? new Base[0] : new Base[] {this.anchor}; // Enumeration<ActionRelationshipAnchor>
692        default: return super.getProperty(hash, name, checkValid);
693        }
694
695      }
696
697      @Override
698      public void setProperty(int hash, String name, Base value) throws FHIRException {
699        switch (hash) {
700        case -889046145: // actionIdentifier
701          this.actionIdentifier = castToIdentifier(value); // Identifier
702          break;
703        case -261851592: // relationship
704          this.relationship = new ActionRelationshipTypeEnumFactory().fromType(value); // Enumeration<ActionRelationshipType>
705          break;
706        case -1019779949: // offset
707          this.offset = (Type) value; // Type
708          break;
709        case -1413299531: // anchor
710          this.anchor = new ActionRelationshipAnchorEnumFactory().fromType(value); // Enumeration<ActionRelationshipAnchor>
711          break;
712        default: super.setProperty(hash, name, value);
713        }
714
715      }
716
717      @Override
718      public void setProperty(String name, Base value) throws FHIRException {
719        if (name.equals("actionIdentifier"))
720          this.actionIdentifier = castToIdentifier(value); // Identifier
721        else if (name.equals("relationship"))
722          this.relationship = new ActionRelationshipTypeEnumFactory().fromType(value); // Enumeration<ActionRelationshipType>
723        else if (name.equals("offset[x]"))
724          this.offset = (Type) value; // Type
725        else if (name.equals("anchor"))
726          this.anchor = new ActionRelationshipAnchorEnumFactory().fromType(value); // Enumeration<ActionRelationshipAnchor>
727        else
728          super.setProperty(name, value);
729      }
730
731      @Override
732      public Base makeProperty(int hash, String name) throws FHIRException {
733        switch (hash) {
734        case -889046145:  return getActionIdentifier(); // Identifier
735        case -261851592: throw new FHIRException("Cannot make property relationship as it is not a complex type"); // Enumeration<ActionRelationshipType>
736        case -1960684787:  return getOffset(); // Type
737        case -1413299531: throw new FHIRException("Cannot make property anchor as it is not a complex type"); // Enumeration<ActionRelationshipAnchor>
738        default: return super.makeProperty(hash, name);
739        }
740
741      }
742
743      @Override
744      public Base addChild(String name) throws FHIRException {
745        if (name.equals("actionIdentifier")) {
746          this.actionIdentifier = new Identifier();
747          return this.actionIdentifier;
748        }
749        else if (name.equals("relationship")) {
750          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.relationship");
751        }
752        else if (name.equals("offsetDuration")) {
753          this.offset = new Duration();
754          return this.offset;
755        }
756        else if (name.equals("offsetRange")) {
757          this.offset = new Range();
758          return this.offset;
759        }
760        else if (name.equals("anchor")) {
761          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.anchor");
762        }
763        else
764          return super.addChild(name);
765      }
766
767      public ActionDefinitionRelatedActionComponent copy() {
768        ActionDefinitionRelatedActionComponent dst = new ActionDefinitionRelatedActionComponent();
769        copyValues(dst);
770        dst.actionIdentifier = actionIdentifier == null ? null : actionIdentifier.copy();
771        dst.relationship = relationship == null ? null : relationship.copy();
772        dst.offset = offset == null ? null : offset.copy();
773        dst.anchor = anchor == null ? null : anchor.copy();
774        return dst;
775      }
776
777      @Override
778      public boolean equalsDeep(Base other) {
779        if (!super.equalsDeep(other))
780          return false;
781        if (!(other instanceof ActionDefinitionRelatedActionComponent))
782          return false;
783        ActionDefinitionRelatedActionComponent o = (ActionDefinitionRelatedActionComponent) other;
784        return compareDeep(actionIdentifier, o.actionIdentifier, true) && compareDeep(relationship, o.relationship, true)
785           && compareDeep(offset, o.offset, true) && compareDeep(anchor, o.anchor, true);
786      }
787
788      @Override
789      public boolean equalsShallow(Base other) {
790        if (!super.equalsShallow(other))
791          return false;
792        if (!(other instanceof ActionDefinitionRelatedActionComponent))
793          return false;
794        ActionDefinitionRelatedActionComponent o = (ActionDefinitionRelatedActionComponent) other;
795        return compareValues(relationship, o.relationship, true) && compareValues(anchor, o.anchor, true);
796      }
797
798      public boolean isEmpty() {
799        return super.isEmpty() && (actionIdentifier == null || actionIdentifier.isEmpty()) && (relationship == null || relationship.isEmpty())
800           && (offset == null || offset.isEmpty()) && (anchor == null || anchor.isEmpty());
801      }
802
803  public String fhirType() {
804    return "ActionDefinition.relatedAction";
805
806  }
807
808  }
809
810    @Block()
811    public static class ActionDefinitionBehaviorComponent extends Element implements IBaseDatatypeElement {
812        /**
813         * The type of the behavior to be described, such as grouping, visual, or selection behaviors.
814         */
815        @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
816        @Description(shortDefinition="The type of behavior (grouping, precheck, selection, cardinality, etc)", formalDefinition="The type of the behavior to be described, such as grouping, visual, or selection behaviors." )
817        protected Coding type;
818
819        /**
820         * The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.
821         */
822        @Child(name = "value", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
823        @Description(shortDefinition="Specific behavior (e.g. required, at-most-one, single, etc)", formalDefinition="The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset." )
824        protected Coding value;
825
826        private static final long serialVersionUID = -1054119695L;
827
828    /**
829     * Constructor
830     */
831      public ActionDefinitionBehaviorComponent() {
832        super();
833      }
834
835    /**
836     * Constructor
837     */
838      public ActionDefinitionBehaviorComponent(Coding type, Coding value) {
839        super();
840        this.type = type;
841        this.value = value;
842      }
843
844        /**
845         * @return {@link #type} (The type of the behavior to be described, such as grouping, visual, or selection behaviors.)
846         */
847        public Coding getType() { 
848          if (this.type == null)
849            if (Configuration.errorOnAutoCreate())
850              throw new Error("Attempt to auto-create ActionDefinitionBehaviorComponent.type");
851            else if (Configuration.doAutoCreate())
852              this.type = new Coding(); // cc
853          return this.type;
854        }
855
856        public boolean hasType() { 
857          return this.type != null && !this.type.isEmpty();
858        }
859
860        /**
861         * @param value {@link #type} (The type of the behavior to be described, such as grouping, visual, or selection behaviors.)
862         */
863        public ActionDefinitionBehaviorComponent setType(Coding value) { 
864          this.type = value;
865          return this;
866        }
867
868        /**
869         * @return {@link #value} (The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.)
870         */
871        public Coding getValue() { 
872          if (this.value == null)
873            if (Configuration.errorOnAutoCreate())
874              throw new Error("Attempt to auto-create ActionDefinitionBehaviorComponent.value");
875            else if (Configuration.doAutoCreate())
876              this.value = new Coding(); // cc
877          return this.value;
878        }
879
880        public boolean hasValue() { 
881          return this.value != null && !this.value.isEmpty();
882        }
883
884        /**
885         * @param value {@link #value} (The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.)
886         */
887        public ActionDefinitionBehaviorComponent setValue(Coding value) { 
888          this.value = value;
889          return this;
890        }
891
892        protected void listChildren(List<Property> childrenList) {
893          super.listChildren(childrenList);
894          childrenList.add(new Property("type", "Coding", "The type of the behavior to be described, such as grouping, visual, or selection behaviors.", 0, java.lang.Integer.MAX_VALUE, type));
895          childrenList.add(new Property("value", "Coding", "The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.", 0, java.lang.Integer.MAX_VALUE, value));
896        }
897
898      @Override
899      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
900        switch (hash) {
901        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
902        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Coding
903        default: return super.getProperty(hash, name, checkValid);
904        }
905
906      }
907
908      @Override
909      public void setProperty(int hash, String name, Base value) throws FHIRException {
910        switch (hash) {
911        case 3575610: // type
912          this.type = castToCoding(value); // Coding
913          break;
914        case 111972721: // value
915          this.value = castToCoding(value); // Coding
916          break;
917        default: super.setProperty(hash, name, value);
918        }
919
920      }
921
922      @Override
923      public void setProperty(String name, Base value) throws FHIRException {
924        if (name.equals("type"))
925          this.type = castToCoding(value); // Coding
926        else if (name.equals("value"))
927          this.value = castToCoding(value); // Coding
928        else
929          super.setProperty(name, value);
930      }
931
932      @Override
933      public Base makeProperty(int hash, String name) throws FHIRException {
934        switch (hash) {
935        case 3575610:  return getType(); // Coding
936        case 111972721:  return getValue(); // Coding
937        default: return super.makeProperty(hash, name);
938        }
939
940      }
941
942      @Override
943      public Base addChild(String name) throws FHIRException {
944        if (name.equals("type")) {
945          this.type = new Coding();
946          return this.type;
947        }
948        else if (name.equals("value")) {
949          this.value = new Coding();
950          return this.value;
951        }
952        else
953          return super.addChild(name);
954      }
955
956      public ActionDefinitionBehaviorComponent copy() {
957        ActionDefinitionBehaviorComponent dst = new ActionDefinitionBehaviorComponent();
958        copyValues(dst);
959        dst.type = type == null ? null : type.copy();
960        dst.value = value == null ? null : value.copy();
961        return dst;
962      }
963
964      @Override
965      public boolean equalsDeep(Base other) {
966        if (!super.equalsDeep(other))
967          return false;
968        if (!(other instanceof ActionDefinitionBehaviorComponent))
969          return false;
970        ActionDefinitionBehaviorComponent o = (ActionDefinitionBehaviorComponent) other;
971        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
972      }
973
974      @Override
975      public boolean equalsShallow(Base other) {
976        if (!super.equalsShallow(other))
977          return false;
978        if (!(other instanceof ActionDefinitionBehaviorComponent))
979          return false;
980        ActionDefinitionBehaviorComponent o = (ActionDefinitionBehaviorComponent) other;
981        return true;
982      }
983
984      public boolean isEmpty() {
985        return super.isEmpty() && (type == null || type.isEmpty()) && (value == null || value.isEmpty())
986          ;
987      }
988
989  public String fhirType() {
990    return "ActionDefinition.behavior";
991
992  }
993
994  }
995
996    @Block()
997    public static class ActionDefinitionCustomizationComponent extends Element implements IBaseDatatypeElement {
998        /**
999         * 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.
1000         */
1001        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1002        @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." )
1003        protected StringType path;
1004
1005        /**
1006         * An expression specifying the value of the customized element.
1007         */
1008        @Child(name = "expression", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1009        @Description(shortDefinition="An expression that provides the dynamic value for the customization", formalDefinition="An expression specifying the value of the customized element." )
1010        protected StringType expression;
1011
1012        private static final long serialVersionUID = -252690483L;
1013
1014    /**
1015     * Constructor
1016     */
1017      public ActionDefinitionCustomizationComponent() {
1018        super();
1019      }
1020
1021    /**
1022     * Constructor
1023     */
1024      public ActionDefinitionCustomizationComponent(StringType path, StringType expression) {
1025        super();
1026        this.path = path;
1027        this.expression = expression;
1028      }
1029
1030        /**
1031         * @return {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1032         */
1033        public StringType getPathElement() { 
1034          if (this.path == null)
1035            if (Configuration.errorOnAutoCreate())
1036              throw new Error("Attempt to auto-create ActionDefinitionCustomizationComponent.path");
1037            else if (Configuration.doAutoCreate())
1038              this.path = new StringType(); // bb
1039          return this.path;
1040        }
1041
1042        public boolean hasPathElement() { 
1043          return this.path != null && !this.path.isEmpty();
1044        }
1045
1046        public boolean hasPath() { 
1047          return this.path != null && !this.path.isEmpty();
1048        }
1049
1050        /**
1051         * @param value {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1052         */
1053        public ActionDefinitionCustomizationComponent setPathElement(StringType value) { 
1054          this.path = value;
1055          return this;
1056        }
1057
1058        /**
1059         * @return The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
1060         */
1061        public String getPath() { 
1062          return this.path == null ? null : this.path.getValue();
1063        }
1064
1065        /**
1066         * @param value The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
1067         */
1068        public ActionDefinitionCustomizationComponent setPath(String value) { 
1069            if (this.path == null)
1070              this.path = new StringType();
1071            this.path.setValue(value);
1072          return this;
1073        }
1074
1075        /**
1076         * @return {@link #expression} (An expression specifying the value of the customized element.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
1077         */
1078        public StringType getExpressionElement() { 
1079          if (this.expression == null)
1080            if (Configuration.errorOnAutoCreate())
1081              throw new Error("Attempt to auto-create ActionDefinitionCustomizationComponent.expression");
1082            else if (Configuration.doAutoCreate())
1083              this.expression = new StringType(); // bb
1084          return this.expression;
1085        }
1086
1087        public boolean hasExpressionElement() { 
1088          return this.expression != null && !this.expression.isEmpty();
1089        }
1090
1091        public boolean hasExpression() { 
1092          return this.expression != null && !this.expression.isEmpty();
1093        }
1094
1095        /**
1096         * @param value {@link #expression} (An expression specifying the value of the customized element.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
1097         */
1098        public ActionDefinitionCustomizationComponent setExpressionElement(StringType value) { 
1099          this.expression = value;
1100          return this;
1101        }
1102
1103        /**
1104         * @return An expression specifying the value of the customized element.
1105         */
1106        public String getExpression() { 
1107          return this.expression == null ? null : this.expression.getValue();
1108        }
1109
1110        /**
1111         * @param value An expression specifying the value of the customized element.
1112         */
1113        public ActionDefinitionCustomizationComponent setExpression(String value) { 
1114            if (this.expression == null)
1115              this.expression = new StringType();
1116            this.expression.setValue(value);
1117          return this;
1118        }
1119
1120        protected void listChildren(List<Property> childrenList) {
1121          super.listChildren(childrenList);
1122          childrenList.add(new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.", 0, java.lang.Integer.MAX_VALUE, path));
1123          childrenList.add(new Property("expression", "string", "An expression specifying the value of the customized element.", 0, java.lang.Integer.MAX_VALUE, expression));
1124        }
1125
1126      @Override
1127      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1128        switch (hash) {
1129        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1130        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
1131        default: return super.getProperty(hash, name, checkValid);
1132        }
1133
1134      }
1135
1136      @Override
1137      public void setProperty(int hash, String name, Base value) throws FHIRException {
1138        switch (hash) {
1139        case 3433509: // path
1140          this.path = castToString(value); // StringType
1141          break;
1142        case -1795452264: // expression
1143          this.expression = castToString(value); // StringType
1144          break;
1145        default: super.setProperty(hash, name, value);
1146        }
1147
1148      }
1149
1150      @Override
1151      public void setProperty(String name, Base value) throws FHIRException {
1152        if (name.equals("path"))
1153          this.path = castToString(value); // StringType
1154        else if (name.equals("expression"))
1155          this.expression = castToString(value); // StringType
1156        else
1157          super.setProperty(name, value);
1158      }
1159
1160      @Override
1161      public Base makeProperty(int hash, String name) throws FHIRException {
1162        switch (hash) {
1163        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
1164        case -1795452264: throw new FHIRException("Cannot make property expression as it is not a complex type"); // StringType
1165        default: return super.makeProperty(hash, name);
1166        }
1167
1168      }
1169
1170      @Override
1171      public Base addChild(String name) throws FHIRException {
1172        if (name.equals("path")) {
1173          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.path");
1174        }
1175        else if (name.equals("expression")) {
1176          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.expression");
1177        }
1178        else
1179          return super.addChild(name);
1180      }
1181
1182      public ActionDefinitionCustomizationComponent copy() {
1183        ActionDefinitionCustomizationComponent dst = new ActionDefinitionCustomizationComponent();
1184        copyValues(dst);
1185        dst.path = path == null ? null : path.copy();
1186        dst.expression = expression == null ? null : expression.copy();
1187        return dst;
1188      }
1189
1190      @Override
1191      public boolean equalsDeep(Base other) {
1192        if (!super.equalsDeep(other))
1193          return false;
1194        if (!(other instanceof ActionDefinitionCustomizationComponent))
1195          return false;
1196        ActionDefinitionCustomizationComponent o = (ActionDefinitionCustomizationComponent) other;
1197        return compareDeep(path, o.path, true) && compareDeep(expression, o.expression, true);
1198      }
1199
1200      @Override
1201      public boolean equalsShallow(Base other) {
1202        if (!super.equalsShallow(other))
1203          return false;
1204        if (!(other instanceof ActionDefinitionCustomizationComponent))
1205          return false;
1206        ActionDefinitionCustomizationComponent o = (ActionDefinitionCustomizationComponent) other;
1207        return compareValues(path, o.path, true) && compareValues(expression, o.expression, true);
1208      }
1209
1210      public boolean isEmpty() {
1211        return super.isEmpty() && (path == null || path.isEmpty()) && (expression == null || expression.isEmpty())
1212          ;
1213      }
1214
1215  public String fhirType() {
1216    return "ActionDefinition.customization";
1217
1218  }
1219
1220  }
1221
1222    /**
1223     * A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.
1224     */
1225    @Child(name = "actionIdentifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1226    @Description(shortDefinition="Unique identifier", formalDefinition="A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique." )
1227    protected Identifier actionIdentifier;
1228
1229    /**
1230     * A user-visible label for the action.
1231     */
1232    @Child(name = "label", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1233    @Description(shortDefinition="User-visible label for the action (e.g. 1. or A.)", formalDefinition="A user-visible label for the action." )
1234    protected StringType label;
1235
1236    /**
1237     * The title of the action displayed to a user.
1238     */
1239    @Child(name = "title", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1240    @Description(shortDefinition="User-visible title", formalDefinition="The title of the action displayed to a user." )
1241    protected StringType title;
1242
1243    /**
1244     * A short description of the action used to provide a summary to display to the user.
1245     */
1246    @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1247    @Description(shortDefinition="Short description of the action", formalDefinition="A short description of the action used to provide a summary to display to the user." )
1248    protected StringType description;
1249
1250    /**
1251     * A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
1252     */
1253    @Child(name = "textEquivalent", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1254    @Description(shortDefinition="Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system", formalDefinition="A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically." )
1255    protected StringType textEquivalent;
1256
1257    /**
1258     * The concept represented by this action or its sub-actions.
1259     */
1260    @Child(name = "concept", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1261    @Description(shortDefinition="The meaning of the action or its sub-actions", formalDefinition="The concept represented by this action or its sub-actions." )
1262    protected List<CodeableConcept> concept;
1263
1264    /**
1265     * The evidence grade and the sources of evidence for this action.
1266     */
1267    @Child(name = "supportingEvidence", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1268    @Description(shortDefinition="Evidence that supports taking the action", formalDefinition="The evidence grade and the sources of evidence for this action." )
1269    protected List<Attachment> supportingEvidence;
1270
1271    /**
1272     * 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.
1273     */
1274    @Child(name = "documentation", type = {Attachment.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1275    @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." )
1276    protected List<Attachment> documentation;
1277
1278    /**
1279     * A relationship to another action such as "before" or "30-60 minutes after start of".
1280     */
1281    @Child(name = "relatedAction", type = {}, order=8, min=0, max=1, modifier=false, summary=true)
1282    @Description(shortDefinition="Relationship to another action", formalDefinition="A relationship to another action such as \"before\" or \"30-60 minutes after start of\"." )
1283    protected ActionDefinitionRelatedActionComponent relatedAction;
1284
1285    /**
1286     * The type of participant in the action.
1287     */
1288    @Child(name = "participantType", type = {CodeType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1289    @Description(shortDefinition="patient | practitioner | related-person", formalDefinition="The type of participant in the action." )
1290    protected List<Enumeration<ParticipantType>> participantType;
1291
1292    /**
1293     * The type of action to perform (create, update, remove).
1294     */
1295    @Child(name = "type", type = {CodeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1296    @Description(shortDefinition="create | update | remove | fire-event", formalDefinition="The type of action to perform (create, update, remove)." )
1297    protected Enumeration<ActionType> type;
1298
1299    /**
1300     * A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.
1301     */
1302    @Child(name = "behavior", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1303    @Description(shortDefinition="Defines behaviors such as selection and grouping", formalDefinition="A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment." )
1304    protected List<ActionDefinitionBehaviorComponent> behavior;
1305
1306    /**
1307     * The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).
1308     */
1309    @Child(name = "resource", type = {}, order=12, min=0, max=1, modifier=false, summary=true)
1310    @Description(shortDefinition="Static portion of the action definition", formalDefinition="The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition)." )
1311    protected Reference resource;
1312
1313    /**
1314     * The actual object that is the target of the reference (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
1315     */
1316    protected Resource resourceTarget;
1317
1318    /**
1319     * 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.
1320     */
1321    @Child(name = "customization", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1322    @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." )
1323    protected List<ActionDefinitionCustomizationComponent> customization;
1324
1325    /**
1326     * 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.
1327     */
1328    @Child(name = "action", type = {ActionDefinition.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1329    @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." )
1330    protected List<ActionDefinition> action;
1331
1332    private static final long serialVersionUID = -1659761573L;
1333
1334  /**
1335   * Constructor
1336   */
1337    public ActionDefinition() {
1338      super();
1339    }
1340
1341    /**
1342     * @return {@link #actionIdentifier} (A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.)
1343     */
1344    public Identifier getActionIdentifier() { 
1345      if (this.actionIdentifier == null)
1346        if (Configuration.errorOnAutoCreate())
1347          throw new Error("Attempt to auto-create ActionDefinition.actionIdentifier");
1348        else if (Configuration.doAutoCreate())
1349          this.actionIdentifier = new Identifier(); // cc
1350      return this.actionIdentifier;
1351    }
1352
1353    public boolean hasActionIdentifier() { 
1354      return this.actionIdentifier != null && !this.actionIdentifier.isEmpty();
1355    }
1356
1357    /**
1358     * @param value {@link #actionIdentifier} (A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.)
1359     */
1360    public ActionDefinition setActionIdentifier(Identifier value) { 
1361      this.actionIdentifier = value;
1362      return this;
1363    }
1364
1365    /**
1366     * @return {@link #label} (A user-visible label for the action.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
1367     */
1368    public StringType getLabelElement() { 
1369      if (this.label == null)
1370        if (Configuration.errorOnAutoCreate())
1371          throw new Error("Attempt to auto-create ActionDefinition.label");
1372        else if (Configuration.doAutoCreate())
1373          this.label = new StringType(); // bb
1374      return this.label;
1375    }
1376
1377    public boolean hasLabelElement() { 
1378      return this.label != null && !this.label.isEmpty();
1379    }
1380
1381    public boolean hasLabel() { 
1382      return this.label != null && !this.label.isEmpty();
1383    }
1384
1385    /**
1386     * @param value {@link #label} (A user-visible label for the action.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
1387     */
1388    public ActionDefinition setLabelElement(StringType value) { 
1389      this.label = value;
1390      return this;
1391    }
1392
1393    /**
1394     * @return A user-visible label for the action.
1395     */
1396    public String getLabel() { 
1397      return this.label == null ? null : this.label.getValue();
1398    }
1399
1400    /**
1401     * @param value A user-visible label for the action.
1402     */
1403    public ActionDefinition setLabel(String value) { 
1404      if (Utilities.noString(value))
1405        this.label = null;
1406      else {
1407        if (this.label == null)
1408          this.label = new StringType();
1409        this.label.setValue(value);
1410      }
1411      return this;
1412    }
1413
1414    /**
1415     * @return {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1416     */
1417    public StringType getTitleElement() { 
1418      if (this.title == null)
1419        if (Configuration.errorOnAutoCreate())
1420          throw new Error("Attempt to auto-create ActionDefinition.title");
1421        else if (Configuration.doAutoCreate())
1422          this.title = new StringType(); // bb
1423      return this.title;
1424    }
1425
1426    public boolean hasTitleElement() { 
1427      return this.title != null && !this.title.isEmpty();
1428    }
1429
1430    public boolean hasTitle() { 
1431      return this.title != null && !this.title.isEmpty();
1432    }
1433
1434    /**
1435     * @param value {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1436     */
1437    public ActionDefinition setTitleElement(StringType value) { 
1438      this.title = value;
1439      return this;
1440    }
1441
1442    /**
1443     * @return The title of the action displayed to a user.
1444     */
1445    public String getTitle() { 
1446      return this.title == null ? null : this.title.getValue();
1447    }
1448
1449    /**
1450     * @param value The title of the action displayed to a user.
1451     */
1452    public ActionDefinition setTitle(String value) { 
1453      if (Utilities.noString(value))
1454        this.title = null;
1455      else {
1456        if (this.title == null)
1457          this.title = new StringType();
1458        this.title.setValue(value);
1459      }
1460      return this;
1461    }
1462
1463    /**
1464     * @return {@link #description} (A short description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1465     */
1466    public StringType getDescriptionElement() { 
1467      if (this.description == null)
1468        if (Configuration.errorOnAutoCreate())
1469          throw new Error("Attempt to auto-create ActionDefinition.description");
1470        else if (Configuration.doAutoCreate())
1471          this.description = new StringType(); // bb
1472      return this.description;
1473    }
1474
1475    public boolean hasDescriptionElement() { 
1476      return this.description != null && !this.description.isEmpty();
1477    }
1478
1479    public boolean hasDescription() { 
1480      return this.description != null && !this.description.isEmpty();
1481    }
1482
1483    /**
1484     * @param value {@link #description} (A short description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1485     */
1486    public ActionDefinition setDescriptionElement(StringType value) { 
1487      this.description = value;
1488      return this;
1489    }
1490
1491    /**
1492     * @return A short description of the action used to provide a summary to display to the user.
1493     */
1494    public String getDescription() { 
1495      return this.description == null ? null : this.description.getValue();
1496    }
1497
1498    /**
1499     * @param value A short description of the action used to provide a summary to display to the user.
1500     */
1501    public ActionDefinition setDescription(String value) { 
1502      if (Utilities.noString(value))
1503        this.description = null;
1504      else {
1505        if (this.description == null)
1506          this.description = new StringType();
1507        this.description.setValue(value);
1508      }
1509      return this;
1510    }
1511
1512    /**
1513     * @return {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
1514     */
1515    public StringType getTextEquivalentElement() { 
1516      if (this.textEquivalent == null)
1517        if (Configuration.errorOnAutoCreate())
1518          throw new Error("Attempt to auto-create ActionDefinition.textEquivalent");
1519        else if (Configuration.doAutoCreate())
1520          this.textEquivalent = new StringType(); // bb
1521      return this.textEquivalent;
1522    }
1523
1524    public boolean hasTextEquivalentElement() { 
1525      return this.textEquivalent != null && !this.textEquivalent.isEmpty();
1526    }
1527
1528    public boolean hasTextEquivalent() { 
1529      return this.textEquivalent != null && !this.textEquivalent.isEmpty();
1530    }
1531
1532    /**
1533     * @param value {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
1534     */
1535    public ActionDefinition setTextEquivalentElement(StringType value) { 
1536      this.textEquivalent = value;
1537      return this;
1538    }
1539
1540    /**
1541     * @return A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
1542     */
1543    public String getTextEquivalent() { 
1544      return this.textEquivalent == null ? null : this.textEquivalent.getValue();
1545    }
1546
1547    /**
1548     * @param value A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
1549     */
1550    public ActionDefinition setTextEquivalent(String value) { 
1551      if (Utilities.noString(value))
1552        this.textEquivalent = null;
1553      else {
1554        if (this.textEquivalent == null)
1555          this.textEquivalent = new StringType();
1556        this.textEquivalent.setValue(value);
1557      }
1558      return this;
1559    }
1560
1561    /**
1562     * @return {@link #concept} (The concept represented by this action or its sub-actions.)
1563     */
1564    public List<CodeableConcept> getConcept() { 
1565      if (this.concept == null)
1566        this.concept = new ArrayList<CodeableConcept>();
1567      return this.concept;
1568    }
1569
1570    public boolean hasConcept() { 
1571      if (this.concept == null)
1572        return false;
1573      for (CodeableConcept item : this.concept)
1574        if (!item.isEmpty())
1575          return true;
1576      return false;
1577    }
1578
1579    /**
1580     * @return {@link #concept} (The concept represented by this action or its sub-actions.)
1581     */
1582    // syntactic sugar
1583    public CodeableConcept addConcept() { //3
1584      CodeableConcept t = new CodeableConcept();
1585      if (this.concept == null)
1586        this.concept = new ArrayList<CodeableConcept>();
1587      this.concept.add(t);
1588      return t;
1589    }
1590
1591    // syntactic sugar
1592    public ActionDefinition addConcept(CodeableConcept t) { //3
1593      if (t == null)
1594        return this;
1595      if (this.concept == null)
1596        this.concept = new ArrayList<CodeableConcept>();
1597      this.concept.add(t);
1598      return this;
1599    }
1600
1601    /**
1602     * @return {@link #supportingEvidence} (The evidence grade and the sources of evidence for this action.)
1603     */
1604    public List<Attachment> getSupportingEvidence() { 
1605      if (this.supportingEvidence == null)
1606        this.supportingEvidence = new ArrayList<Attachment>();
1607      return this.supportingEvidence;
1608    }
1609
1610    public boolean hasSupportingEvidence() { 
1611      if (this.supportingEvidence == null)
1612        return false;
1613      for (Attachment item : this.supportingEvidence)
1614        if (!item.isEmpty())
1615          return true;
1616      return false;
1617    }
1618
1619    /**
1620     * @return {@link #supportingEvidence} (The evidence grade and the sources of evidence for this action.)
1621     */
1622    // syntactic sugar
1623    public Attachment addSupportingEvidence() { //3
1624      Attachment t = new Attachment();
1625      if (this.supportingEvidence == null)
1626        this.supportingEvidence = new ArrayList<Attachment>();
1627      this.supportingEvidence.add(t);
1628      return t;
1629    }
1630
1631    // syntactic sugar
1632    public ActionDefinition addSupportingEvidence(Attachment t) { //3
1633      if (t == null)
1634        return this;
1635      if (this.supportingEvidence == null)
1636        this.supportingEvidence = new ArrayList<Attachment>();
1637      this.supportingEvidence.add(t);
1638      return this;
1639    }
1640
1641    /**
1642     * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
1643     */
1644    public List<Attachment> getDocumentation() { 
1645      if (this.documentation == null)
1646        this.documentation = new ArrayList<Attachment>();
1647      return this.documentation;
1648    }
1649
1650    public boolean hasDocumentation() { 
1651      if (this.documentation == null)
1652        return false;
1653      for (Attachment item : this.documentation)
1654        if (!item.isEmpty())
1655          return true;
1656      return false;
1657    }
1658
1659    /**
1660     * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
1661     */
1662    // syntactic sugar
1663    public Attachment addDocumentation() { //3
1664      Attachment t = new Attachment();
1665      if (this.documentation == null)
1666        this.documentation = new ArrayList<Attachment>();
1667      this.documentation.add(t);
1668      return t;
1669    }
1670
1671    // syntactic sugar
1672    public ActionDefinition addDocumentation(Attachment t) { //3
1673      if (t == null)
1674        return this;
1675      if (this.documentation == null)
1676        this.documentation = new ArrayList<Attachment>();
1677      this.documentation.add(t);
1678      return this;
1679    }
1680
1681    /**
1682     * @return {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
1683     */
1684    public ActionDefinitionRelatedActionComponent getRelatedAction() { 
1685      if (this.relatedAction == null)
1686        if (Configuration.errorOnAutoCreate())
1687          throw new Error("Attempt to auto-create ActionDefinition.relatedAction");
1688        else if (Configuration.doAutoCreate())
1689          this.relatedAction = new ActionDefinitionRelatedActionComponent(); // cc
1690      return this.relatedAction;
1691    }
1692
1693    public boolean hasRelatedAction() { 
1694      return this.relatedAction != null && !this.relatedAction.isEmpty();
1695    }
1696
1697    /**
1698     * @param value {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
1699     */
1700    public ActionDefinition setRelatedAction(ActionDefinitionRelatedActionComponent value) { 
1701      this.relatedAction = value;
1702      return this;
1703    }
1704
1705    /**
1706     * @return {@link #participantType} (The type of participant in the action.)
1707     */
1708    public List<Enumeration<ParticipantType>> getParticipantType() { 
1709      if (this.participantType == null)
1710        this.participantType = new ArrayList<Enumeration<ParticipantType>>();
1711      return this.participantType;
1712    }
1713
1714    public boolean hasParticipantType() { 
1715      if (this.participantType == null)
1716        return false;
1717      for (Enumeration<ParticipantType> item : this.participantType)
1718        if (!item.isEmpty())
1719          return true;
1720      return false;
1721    }
1722
1723    /**
1724     * @return {@link #participantType} (The type of participant in the action.)
1725     */
1726    // syntactic sugar
1727    public Enumeration<ParticipantType> addParticipantTypeElement() {//2 
1728      Enumeration<ParticipantType> t = new Enumeration<ParticipantType>(new ParticipantTypeEnumFactory());
1729      if (this.participantType == null)
1730        this.participantType = new ArrayList<Enumeration<ParticipantType>>();
1731      this.participantType.add(t);
1732      return t;
1733    }
1734
1735    /**
1736     * @param value {@link #participantType} (The type of participant in the action.)
1737     */
1738    public ActionDefinition addParticipantType(ParticipantType value) { //1
1739      Enumeration<ParticipantType> t = new Enumeration<ParticipantType>(new ParticipantTypeEnumFactory());
1740      t.setValue(value);
1741      if (this.participantType == null)
1742        this.participantType = new ArrayList<Enumeration<ParticipantType>>();
1743      this.participantType.add(t);
1744      return this;
1745    }
1746
1747    /**
1748     * @param value {@link #participantType} (The type of participant in the action.)
1749     */
1750    public boolean hasParticipantType(ParticipantType value) { 
1751      if (this.participantType == null)
1752        return false;
1753      for (Enumeration<ParticipantType> v : this.participantType)
1754        if (v.getValue().equals(value)) // code
1755          return true;
1756      return false;
1757    }
1758
1759    /**
1760     * @return {@link #type} (The type of action to perform (create, update, remove).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1761     */
1762    public Enumeration<ActionType> getTypeElement() { 
1763      if (this.type == null)
1764        if (Configuration.errorOnAutoCreate())
1765          throw new Error("Attempt to auto-create ActionDefinition.type");
1766        else if (Configuration.doAutoCreate())
1767          this.type = new Enumeration<ActionType>(new ActionTypeEnumFactory()); // bb
1768      return this.type;
1769    }
1770
1771    public boolean hasTypeElement() { 
1772      return this.type != null && !this.type.isEmpty();
1773    }
1774
1775    public boolean hasType() { 
1776      return this.type != null && !this.type.isEmpty();
1777    }
1778
1779    /**
1780     * @param value {@link #type} (The type of action to perform (create, update, remove).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1781     */
1782    public ActionDefinition setTypeElement(Enumeration<ActionType> value) { 
1783      this.type = value;
1784      return this;
1785    }
1786
1787    /**
1788     * @return The type of action to perform (create, update, remove).
1789     */
1790    public ActionType getType() { 
1791      return this.type == null ? null : this.type.getValue();
1792    }
1793
1794    /**
1795     * @param value The type of action to perform (create, update, remove).
1796     */
1797    public ActionDefinition setType(ActionType value) { 
1798      if (value == null)
1799        this.type = null;
1800      else {
1801        if (this.type == null)
1802          this.type = new Enumeration<ActionType>(new ActionTypeEnumFactory());
1803        this.type.setValue(value);
1804      }
1805      return this;
1806    }
1807
1808    /**
1809     * @return {@link #behavior} (A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.)
1810     */
1811    public List<ActionDefinitionBehaviorComponent> getBehavior() { 
1812      if (this.behavior == null)
1813        this.behavior = new ArrayList<ActionDefinitionBehaviorComponent>();
1814      return this.behavior;
1815    }
1816
1817    public boolean hasBehavior() { 
1818      if (this.behavior == null)
1819        return false;
1820      for (ActionDefinitionBehaviorComponent item : this.behavior)
1821        if (!item.isEmpty())
1822          return true;
1823      return false;
1824    }
1825
1826    /**
1827     * @return {@link #behavior} (A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.)
1828     */
1829    // syntactic sugar
1830    public ActionDefinitionBehaviorComponent addBehavior() { //3
1831      ActionDefinitionBehaviorComponent t = new ActionDefinitionBehaviorComponent();
1832      if (this.behavior == null)
1833        this.behavior = new ArrayList<ActionDefinitionBehaviorComponent>();
1834      this.behavior.add(t);
1835      return t;
1836    }
1837
1838    // syntactic sugar
1839    public ActionDefinition addBehavior(ActionDefinitionBehaviorComponent t) { //3
1840      if (t == null)
1841        return this;
1842      if (this.behavior == null)
1843        this.behavior = new ArrayList<ActionDefinitionBehaviorComponent>();
1844      this.behavior.add(t);
1845      return this;
1846    }
1847
1848    /**
1849     * @return {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
1850     */
1851    public Reference getResource() { 
1852      if (this.resource == null)
1853        if (Configuration.errorOnAutoCreate())
1854          throw new Error("Attempt to auto-create ActionDefinition.resource");
1855        else if (Configuration.doAutoCreate())
1856          this.resource = new Reference(); // cc
1857      return this.resource;
1858    }
1859
1860    public boolean hasResource() { 
1861      return this.resource != null && !this.resource.isEmpty();
1862    }
1863
1864    /**
1865     * @param value {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
1866     */
1867    public ActionDefinition setResource(Reference value) { 
1868      this.resource = value;
1869      return this;
1870    }
1871
1872    /**
1873     * @return {@link #resource} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
1874     */
1875    public Resource getResourceTarget() { 
1876      return this.resourceTarget;
1877    }
1878
1879    /**
1880     * @param value {@link #resource} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
1881     */
1882    public ActionDefinition setResourceTarget(Resource value) { 
1883      this.resourceTarget = value;
1884      return this;
1885    }
1886
1887    /**
1888     * @return {@link #customization} (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.)
1889     */
1890    public List<ActionDefinitionCustomizationComponent> getCustomization() { 
1891      if (this.customization == null)
1892        this.customization = new ArrayList<ActionDefinitionCustomizationComponent>();
1893      return this.customization;
1894    }
1895
1896    public boolean hasCustomization() { 
1897      if (this.customization == null)
1898        return false;
1899      for (ActionDefinitionCustomizationComponent item : this.customization)
1900        if (!item.isEmpty())
1901          return true;
1902      return false;
1903    }
1904
1905    /**
1906     * @return {@link #customization} (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.)
1907     */
1908    // syntactic sugar
1909    public ActionDefinitionCustomizationComponent addCustomization() { //3
1910      ActionDefinitionCustomizationComponent t = new ActionDefinitionCustomizationComponent();
1911      if (this.customization == null)
1912        this.customization = new ArrayList<ActionDefinitionCustomizationComponent>();
1913      this.customization.add(t);
1914      return t;
1915    }
1916
1917    // syntactic sugar
1918    public ActionDefinition addCustomization(ActionDefinitionCustomizationComponent t) { //3
1919      if (t == null)
1920        return this;
1921      if (this.customization == null)
1922        this.customization = new ArrayList<ActionDefinitionCustomizationComponent>();
1923      this.customization.add(t);
1924      return this;
1925    }
1926
1927    /**
1928     * @return {@link #action} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
1929     */
1930    public List<ActionDefinition> getAction() { 
1931      if (this.action == null)
1932        this.action = new ArrayList<ActionDefinition>();
1933      return this.action;
1934    }
1935
1936    public boolean hasAction() { 
1937      if (this.action == null)
1938        return false;
1939      for (ActionDefinition item : this.action)
1940        if (!item.isEmpty())
1941          return true;
1942      return false;
1943    }
1944
1945    /**
1946     * @return {@link #action} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
1947     */
1948    // syntactic sugar
1949    public ActionDefinition addAction() { //3
1950      ActionDefinition t = new ActionDefinition();
1951      if (this.action == null)
1952        this.action = new ArrayList<ActionDefinition>();
1953      this.action.add(t);
1954      return t;
1955    }
1956
1957    // syntactic sugar
1958    public ActionDefinition addAction(ActionDefinition t) { //3
1959      if (t == null)
1960        return this;
1961      if (this.action == null)
1962        this.action = new ArrayList<ActionDefinition>();
1963      this.action.add(t);
1964      return this;
1965    }
1966
1967      protected void listChildren(List<Property> childrenList) {
1968        super.listChildren(childrenList);
1969        childrenList.add(new Property("actionIdentifier", "Identifier", "A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.", 0, java.lang.Integer.MAX_VALUE, actionIdentifier));
1970        childrenList.add(new Property("label", "string", "A user-visible label for the action.", 0, java.lang.Integer.MAX_VALUE, label));
1971        childrenList.add(new Property("title", "string", "The title of the action displayed to a user.", 0, java.lang.Integer.MAX_VALUE, title));
1972        childrenList.add(new Property("description", "string", "A short description of the action used to provide a summary to display to the user.", 0, java.lang.Integer.MAX_VALUE, description));
1973        childrenList.add(new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.", 0, java.lang.Integer.MAX_VALUE, textEquivalent));
1974        childrenList.add(new Property("concept", "CodeableConcept", "The concept represented by this action or its sub-actions.", 0, java.lang.Integer.MAX_VALUE, concept));
1975        childrenList.add(new Property("supportingEvidence", "Attachment", "The evidence grade and the sources of evidence for this action.", 0, java.lang.Integer.MAX_VALUE, supportingEvidence));
1976        childrenList.add(new Property("documentation", "Attachment", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
1977        childrenList.add(new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction));
1978        childrenList.add(new Property("participantType", "code", "The type of participant in the action.", 0, java.lang.Integer.MAX_VALUE, participantType));
1979        childrenList.add(new Property("type", "code", "The type of action to perform (create, update, remove).", 0, java.lang.Integer.MAX_VALUE, type));
1980        childrenList.add(new Property("behavior", "", "A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.", 0, java.lang.Integer.MAX_VALUE, behavior));
1981        childrenList.add(new Property("resource", "Reference(Any)", "The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).", 0, java.lang.Integer.MAX_VALUE, resource));
1982        childrenList.add(new Property("customization", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, customization));
1983        childrenList.add(new Property("action", "ActionDefinition", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action));
1984      }
1985
1986      @Override
1987      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1988        switch (hash) {
1989        case -889046145: /*actionIdentifier*/ return this.actionIdentifier == null ? new Base[0] : new Base[] {this.actionIdentifier}; // Identifier
1990        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
1991        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1992        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1993        case -900391049: /*textEquivalent*/ return this.textEquivalent == null ? new Base[0] : new Base[] {this.textEquivalent}; // StringType
1994        case 951024232: /*concept*/ return this.concept == null ? new Base[0] : this.concept.toArray(new Base[this.concept.size()]); // CodeableConcept
1995        case -1735429846: /*supportingEvidence*/ return this.supportingEvidence == null ? new Base[0] : this.supportingEvidence.toArray(new Base[this.supportingEvidence.size()]); // Attachment
1996        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // Attachment
1997        case -384107967: /*relatedAction*/ return this.relatedAction == null ? new Base[0] : new Base[] {this.relatedAction}; // ActionDefinitionRelatedActionComponent
1998        case 841294093: /*participantType*/ return this.participantType == null ? new Base[0] : this.participantType.toArray(new Base[this.participantType.size()]); // Enumeration<ParticipantType>
1999        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ActionType>
2000        case 1510912594: /*behavior*/ return this.behavior == null ? new Base[0] : this.behavior.toArray(new Base[this.behavior.size()]); // ActionDefinitionBehaviorComponent
2001        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference
2002        case 1637263315: /*customization*/ return this.customization == null ? new Base[0] : this.customization.toArray(new Base[this.customization.size()]); // ActionDefinitionCustomizationComponent
2003        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionDefinition
2004        default: return super.getProperty(hash, name, checkValid);
2005        }
2006
2007      }
2008
2009      @Override
2010      public void setProperty(int hash, String name, Base value) throws FHIRException {
2011        switch (hash) {
2012        case -889046145: // actionIdentifier
2013          this.actionIdentifier = castToIdentifier(value); // Identifier
2014          break;
2015        case 102727412: // label
2016          this.label = castToString(value); // StringType
2017          break;
2018        case 110371416: // title
2019          this.title = castToString(value); // StringType
2020          break;
2021        case -1724546052: // description
2022          this.description = castToString(value); // StringType
2023          break;
2024        case -900391049: // textEquivalent
2025          this.textEquivalent = castToString(value); // StringType
2026          break;
2027        case 951024232: // concept
2028          this.getConcept().add(castToCodeableConcept(value)); // CodeableConcept
2029          break;
2030        case -1735429846: // supportingEvidence
2031          this.getSupportingEvidence().add(castToAttachment(value)); // Attachment
2032          break;
2033        case 1587405498: // documentation
2034          this.getDocumentation().add(castToAttachment(value)); // Attachment
2035          break;
2036        case -384107967: // relatedAction
2037          this.relatedAction = (ActionDefinitionRelatedActionComponent) value; // ActionDefinitionRelatedActionComponent
2038          break;
2039        case 841294093: // participantType
2040          this.getParticipantType().add(new ParticipantTypeEnumFactory().fromType(value)); // Enumeration<ParticipantType>
2041          break;
2042        case 3575610: // type
2043          this.type = new ActionTypeEnumFactory().fromType(value); // Enumeration<ActionType>
2044          break;
2045        case 1510912594: // behavior
2046          this.getBehavior().add((ActionDefinitionBehaviorComponent) value); // ActionDefinitionBehaviorComponent
2047          break;
2048        case -341064690: // resource
2049          this.resource = castToReference(value); // Reference
2050          break;
2051        case 1637263315: // customization
2052          this.getCustomization().add((ActionDefinitionCustomizationComponent) value); // ActionDefinitionCustomizationComponent
2053          break;
2054        case -1422950858: // action
2055          this.getAction().add(castToActionDefinition(value)); // ActionDefinition
2056          break;
2057        default: super.setProperty(hash, name, value);
2058        }
2059
2060      }
2061
2062      @Override
2063      public void setProperty(String name, Base value) throws FHIRException {
2064        if (name.equals("actionIdentifier"))
2065          this.actionIdentifier = castToIdentifier(value); // Identifier
2066        else if (name.equals("label"))
2067          this.label = castToString(value); // StringType
2068        else if (name.equals("title"))
2069          this.title = castToString(value); // StringType
2070        else if (name.equals("description"))
2071          this.description = castToString(value); // StringType
2072        else if (name.equals("textEquivalent"))
2073          this.textEquivalent = castToString(value); // StringType
2074        else if (name.equals("concept"))
2075          this.getConcept().add(castToCodeableConcept(value));
2076        else if (name.equals("supportingEvidence"))
2077          this.getSupportingEvidence().add(castToAttachment(value));
2078        else if (name.equals("documentation"))
2079          this.getDocumentation().add(castToAttachment(value));
2080        else if (name.equals("relatedAction"))
2081          this.relatedAction = (ActionDefinitionRelatedActionComponent) value; // ActionDefinitionRelatedActionComponent
2082        else if (name.equals("participantType"))
2083          this.getParticipantType().add(new ParticipantTypeEnumFactory().fromType(value));
2084        else if (name.equals("type"))
2085          this.type = new ActionTypeEnumFactory().fromType(value); // Enumeration<ActionType>
2086        else if (name.equals("behavior"))
2087          this.getBehavior().add((ActionDefinitionBehaviorComponent) value);
2088        else if (name.equals("resource"))
2089          this.resource = castToReference(value); // Reference
2090        else if (name.equals("customization"))
2091          this.getCustomization().add((ActionDefinitionCustomizationComponent) value);
2092        else if (name.equals("action"))
2093          this.getAction().add(castToActionDefinition(value));
2094        else
2095          super.setProperty(name, value);
2096      }
2097
2098      @Override
2099      public Base makeProperty(int hash, String name) throws FHIRException {
2100        switch (hash) {
2101        case -889046145:  return getActionIdentifier(); // Identifier
2102        case 102727412: throw new FHIRException("Cannot make property label as it is not a complex type"); // StringType
2103        case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
2104        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
2105        case -900391049: throw new FHIRException("Cannot make property textEquivalent as it is not a complex type"); // StringType
2106        case 951024232:  return addConcept(); // CodeableConcept
2107        case -1735429846:  return addSupportingEvidence(); // Attachment
2108        case 1587405498:  return addDocumentation(); // Attachment
2109        case -384107967:  return getRelatedAction(); // ActionDefinitionRelatedActionComponent
2110        case 841294093: throw new FHIRException("Cannot make property participantType as it is not a complex type"); // Enumeration<ParticipantType>
2111        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration<ActionType>
2112        case 1510912594:  return addBehavior(); // ActionDefinitionBehaviorComponent
2113        case -341064690:  return getResource(); // Reference
2114        case 1637263315:  return addCustomization(); // ActionDefinitionCustomizationComponent
2115        case -1422950858:  return addAction(); // ActionDefinition
2116        default: return super.makeProperty(hash, name);
2117        }
2118
2119      }
2120
2121      @Override
2122      public Base addChild(String name) throws FHIRException {
2123        if (name.equals("actionIdentifier")) {
2124          this.actionIdentifier = new Identifier();
2125          return this.actionIdentifier;
2126        }
2127        else if (name.equals("label")) {
2128          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.label");
2129        }
2130        else if (name.equals("title")) {
2131          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.title");
2132        }
2133        else if (name.equals("description")) {
2134          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.description");
2135        }
2136        else if (name.equals("textEquivalent")) {
2137          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.textEquivalent");
2138        }
2139        else if (name.equals("concept")) {
2140          return addConcept();
2141        }
2142        else if (name.equals("supportingEvidence")) {
2143          return addSupportingEvidence();
2144        }
2145        else if (name.equals("documentation")) {
2146          return addDocumentation();
2147        }
2148        else if (name.equals("relatedAction")) {
2149          this.relatedAction = new ActionDefinitionRelatedActionComponent();
2150          return this.relatedAction;
2151        }
2152        else if (name.equals("participantType")) {
2153          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.participantType");
2154        }
2155        else if (name.equals("type")) {
2156          throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.type");
2157        }
2158        else if (name.equals("behavior")) {
2159          return addBehavior();
2160        }
2161        else if (name.equals("resource")) {
2162          this.resource = new Reference();
2163          return this.resource;
2164        }
2165        else if (name.equals("customization")) {
2166          return addCustomization();
2167        }
2168        else if (name.equals("action")) {
2169          return addAction();
2170        }
2171        else
2172          return super.addChild(name);
2173      }
2174
2175  public String fhirType() {
2176    return "ActionDefinition";
2177
2178  }
2179
2180      public ActionDefinition copy() {
2181        ActionDefinition dst = new ActionDefinition();
2182        copyValues(dst);
2183        dst.actionIdentifier = actionIdentifier == null ? null : actionIdentifier.copy();
2184        dst.label = label == null ? null : label.copy();
2185        dst.title = title == null ? null : title.copy();
2186        dst.description = description == null ? null : description.copy();
2187        dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
2188        if (concept != null) {
2189          dst.concept = new ArrayList<CodeableConcept>();
2190          for (CodeableConcept i : concept)
2191            dst.concept.add(i.copy());
2192        };
2193        if (supportingEvidence != null) {
2194          dst.supportingEvidence = new ArrayList<Attachment>();
2195          for (Attachment i : supportingEvidence)
2196            dst.supportingEvidence.add(i.copy());
2197        };
2198        if (documentation != null) {
2199          dst.documentation = new ArrayList<Attachment>();
2200          for (Attachment i : documentation)
2201            dst.documentation.add(i.copy());
2202        };
2203        dst.relatedAction = relatedAction == null ? null : relatedAction.copy();
2204        if (participantType != null) {
2205          dst.participantType = new ArrayList<Enumeration<ParticipantType>>();
2206          for (Enumeration<ParticipantType> i : participantType)
2207            dst.participantType.add(i.copy());
2208        };
2209        dst.type = type == null ? null : type.copy();
2210        if (behavior != null) {
2211          dst.behavior = new ArrayList<ActionDefinitionBehaviorComponent>();
2212          for (ActionDefinitionBehaviorComponent i : behavior)
2213            dst.behavior.add(i.copy());
2214        };
2215        dst.resource = resource == null ? null : resource.copy();
2216        if (customization != null) {
2217          dst.customization = new ArrayList<ActionDefinitionCustomizationComponent>();
2218          for (ActionDefinitionCustomizationComponent i : customization)
2219            dst.customization.add(i.copy());
2220        };
2221        if (action != null) {
2222          dst.action = new ArrayList<ActionDefinition>();
2223          for (ActionDefinition i : action)
2224            dst.action.add(i.copy());
2225        };
2226        return dst;
2227      }
2228
2229      protected ActionDefinition typedCopy() {
2230        return copy();
2231      }
2232
2233      @Override
2234      public boolean equalsDeep(Base other) {
2235        if (!super.equalsDeep(other))
2236          return false;
2237        if (!(other instanceof ActionDefinition))
2238          return false;
2239        ActionDefinition o = (ActionDefinition) other;
2240        return compareDeep(actionIdentifier, o.actionIdentifier, true) && compareDeep(label, o.label, true)
2241           && compareDeep(title, o.title, true) && compareDeep(description, o.description, true) && compareDeep(textEquivalent, o.textEquivalent, true)
2242           && compareDeep(concept, o.concept, true) && compareDeep(supportingEvidence, o.supportingEvidence, true)
2243           && compareDeep(documentation, o.documentation, true) && compareDeep(relatedAction, o.relatedAction, true)
2244           && compareDeep(participantType, o.participantType, true) && compareDeep(type, o.type, true) && compareDeep(behavior, o.behavior, true)
2245           && compareDeep(resource, o.resource, true) && compareDeep(customization, o.customization, true)
2246           && compareDeep(action, o.action, true);
2247      }
2248
2249      @Override
2250      public boolean equalsShallow(Base other) {
2251        if (!super.equalsShallow(other))
2252          return false;
2253        if (!(other instanceof ActionDefinition))
2254          return false;
2255        ActionDefinition o = (ActionDefinition) other;
2256        return compareValues(label, o.label, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
2257           && compareValues(textEquivalent, o.textEquivalent, true) && compareValues(participantType, o.participantType, true)
2258           && compareValues(type, o.type, true);
2259      }
2260
2261      public boolean isEmpty() {
2262        return super.isEmpty() && (actionIdentifier == null || actionIdentifier.isEmpty()) && (label == null || label.isEmpty())
2263           && (title == null || title.isEmpty()) && (description == null || description.isEmpty()) && (textEquivalent == null || textEquivalent.isEmpty())
2264           && (concept == null || concept.isEmpty()) && (supportingEvidence == null || supportingEvidence.isEmpty())
2265           && (documentation == null || documentation.isEmpty()) && (relatedAction == null || relatedAction.isEmpty())
2266           && (participantType == null || participantType.isEmpty()) && (type == null || type.isEmpty())
2267           && (behavior == null || behavior.isEmpty()) && (resource == null || resource.isEmpty()) && (customization == null || customization.isEmpty())
2268           && (action == null || action.isEmpty());
2269      }
2270
2271
2272}