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