001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A record of an event relevant for purposes such as operations, privacy, security, maintenance, and performance analysis.
052 */
053@ResourceDef(name="AuditEvent", profile="http://hl7.org/fhir/StructureDefinition/AuditEvent")
054public class AuditEvent extends DomainResource {
055
056    public enum AuditEventAction {
057        /**
058         * Create a new database object, such as placing an order.
059         */
060        C, 
061        /**
062         * Read data, such as to print or display to a doctor.
063         */
064        R, 
065        /**
066         * Update data, such as revise patient information.
067         */
068        U, 
069        /**
070         * Delete items, such as a doctor master file record.
071         */
072        D, 
073        /**
074         * Perform a system or application function such as log-on, program execution or use of an object's method, or perform a query/search operation.
075         */
076        E, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static AuditEventAction fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("C".equals(codeString))
085          return C;
086        if ("R".equals(codeString))
087          return R;
088        if ("U".equals(codeString))
089          return U;
090        if ("D".equals(codeString))
091          return D;
092        if ("E".equals(codeString))
093          return E;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown AuditEventAction code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case C: return "C";
102            case R: return "R";
103            case U: return "U";
104            case D: return "D";
105            case E: return "E";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getSystem() {
111          switch (this) {
112            case C: return "http://hl7.org/fhir/audit-event-action";
113            case R: return "http://hl7.org/fhir/audit-event-action";
114            case U: return "http://hl7.org/fhir/audit-event-action";
115            case D: return "http://hl7.org/fhir/audit-event-action";
116            case E: return "http://hl7.org/fhir/audit-event-action";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case C: return "Create a new database object, such as placing an order.";
124            case R: return "Read data, such as to print or display to a doctor.";
125            case U: return "Update data, such as revise patient information.";
126            case D: return "Delete items, such as a doctor master file record.";
127            case E: return "Perform a system or application function such as log-on, program execution or use of an object's method, or perform a query/search operation.";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132        public String getDisplay() {
133          switch (this) {
134            case C: return "Create";
135            case R: return "Read";
136            case U: return "Update";
137            case D: return "Delete";
138            case E: return "Execute";
139            case NULL: return null;
140            default: return "?";
141          }
142        }
143    }
144
145  public static class AuditEventActionEnumFactory implements EnumFactory<AuditEventAction> {
146    public AuditEventAction fromCode(String codeString) throws IllegalArgumentException {
147      if (codeString == null || "".equals(codeString))
148            if (codeString == null || "".equals(codeString))
149                return null;
150        if ("C".equals(codeString))
151          return AuditEventAction.C;
152        if ("R".equals(codeString))
153          return AuditEventAction.R;
154        if ("U".equals(codeString))
155          return AuditEventAction.U;
156        if ("D".equals(codeString))
157          return AuditEventAction.D;
158        if ("E".equals(codeString))
159          return AuditEventAction.E;
160        throw new IllegalArgumentException("Unknown AuditEventAction code '"+codeString+"'");
161        }
162        public Enumeration<AuditEventAction> fromType(PrimitiveType<?> code) throws FHIRException {
163          if (code == null)
164            return null;
165          if (code.isEmpty())
166            return new Enumeration<AuditEventAction>(this, AuditEventAction.NULL, code);
167          String codeString = ((PrimitiveType) code).asStringValue();
168          if (codeString == null || "".equals(codeString))
169            return new Enumeration<AuditEventAction>(this, AuditEventAction.NULL, code);
170        if ("C".equals(codeString))
171          return new Enumeration<AuditEventAction>(this, AuditEventAction.C, code);
172        if ("R".equals(codeString))
173          return new Enumeration<AuditEventAction>(this, AuditEventAction.R, code);
174        if ("U".equals(codeString))
175          return new Enumeration<AuditEventAction>(this, AuditEventAction.U, code);
176        if ("D".equals(codeString))
177          return new Enumeration<AuditEventAction>(this, AuditEventAction.D, code);
178        if ("E".equals(codeString))
179          return new Enumeration<AuditEventAction>(this, AuditEventAction.E, code);
180        throw new FHIRException("Unknown AuditEventAction code '"+codeString+"'");
181        }
182    public String toCode(AuditEventAction code) {
183      if (code == AuditEventAction.C)
184        return "C";
185      if (code == AuditEventAction.R)
186        return "R";
187      if (code == AuditEventAction.U)
188        return "U";
189      if (code == AuditEventAction.D)
190        return "D";
191      if (code == AuditEventAction.E)
192        return "E";
193      return "?";
194      }
195    public String toSystem(AuditEventAction code) {
196      return code.getSystem();
197      }
198    }
199
200    public enum AuditEventSeverity {
201        /**
202         * System is unusable. e.g., This level should only be reported by infrastructure and should not be used by applications.
203         */
204        EMERGENCY, 
205        /**
206         * Notification should be sent to trigger action be taken. e.g., Loss of the primary network connection needing attention.
207         */
208        ALERT, 
209        /**
210         * Critical conditions. e.g., A failure in the system's primary application that will reset automatically.
211         */
212        CRITICAL, 
213        /**
214         * Error conditions. e.g., An application has exceeded its file storage limit and attempts to write are failing. 
215         */
216        ERROR, 
217        /**
218         * Warning conditions. May indicate that an error will occur if action is not taken. e.g., A non-root file system has only 2GB remaining.
219         */
220        WARNING, 
221        /**
222         * Notice messages. Normal but significant condition. Events that are unusual, but not error conditions.
223         */
224        NOTICE, 
225        /**
226         * Normal operational messages that require no action. e.g., An application has started, paused, or ended successfully.
227         */
228        INFORMATIONAL, 
229        /**
230         * Debug-level messages. Information useful to developers for debugging the application.
231         */
232        DEBUG, 
233        /**
234         * added to help the parsers with the generic types
235         */
236        NULL;
237        public static AuditEventSeverity fromCode(String codeString) throws FHIRException {
238            if (codeString == null || "".equals(codeString))
239                return null;
240        if ("emergency".equals(codeString))
241          return EMERGENCY;
242        if ("alert".equals(codeString))
243          return ALERT;
244        if ("critical".equals(codeString))
245          return CRITICAL;
246        if ("error".equals(codeString))
247          return ERROR;
248        if ("warning".equals(codeString))
249          return WARNING;
250        if ("notice".equals(codeString))
251          return NOTICE;
252        if ("informational".equals(codeString))
253          return INFORMATIONAL;
254        if ("debug".equals(codeString))
255          return DEBUG;
256        if (Configuration.isAcceptInvalidEnums())
257          return null;
258        else
259          throw new FHIRException("Unknown AuditEventSeverity code '"+codeString+"'");
260        }
261        public String toCode() {
262          switch (this) {
263            case EMERGENCY: return "emergency";
264            case ALERT: return "alert";
265            case CRITICAL: return "critical";
266            case ERROR: return "error";
267            case WARNING: return "warning";
268            case NOTICE: return "notice";
269            case INFORMATIONAL: return "informational";
270            case DEBUG: return "debug";
271            case NULL: return null;
272            default: return "?";
273          }
274        }
275        public String getSystem() {
276          switch (this) {
277            case EMERGENCY: return "http://hl7.org/fhir/audit-event-severity";
278            case ALERT: return "http://hl7.org/fhir/audit-event-severity";
279            case CRITICAL: return "http://hl7.org/fhir/audit-event-severity";
280            case ERROR: return "http://hl7.org/fhir/audit-event-severity";
281            case WARNING: return "http://hl7.org/fhir/audit-event-severity";
282            case NOTICE: return "http://hl7.org/fhir/audit-event-severity";
283            case INFORMATIONAL: return "http://hl7.org/fhir/audit-event-severity";
284            case DEBUG: return "http://hl7.org/fhir/audit-event-severity";
285            case NULL: return null;
286            default: return "?";
287          }
288        }
289        public String getDefinition() {
290          switch (this) {
291            case EMERGENCY: return "System is unusable. e.g., This level should only be reported by infrastructure and should not be used by applications.";
292            case ALERT: return "Notification should be sent to trigger action be taken. e.g., Loss of the primary network connection needing attention.";
293            case CRITICAL: return "Critical conditions. e.g., A failure in the system's primary application that will reset automatically.";
294            case ERROR: return "Error conditions. e.g., An application has exceeded its file storage limit and attempts to write are failing. ";
295            case WARNING: return "Warning conditions. May indicate that an error will occur if action is not taken. e.g., A non-root file system has only 2GB remaining.";
296            case NOTICE: return "Notice messages. Normal but significant condition. Events that are unusual, but not error conditions.";
297            case INFORMATIONAL: return "Normal operational messages that require no action. e.g., An application has started, paused, or ended successfully.";
298            case DEBUG: return "Debug-level messages. Information useful to developers for debugging the application.";
299            case NULL: return null;
300            default: return "?";
301          }
302        }
303        public String getDisplay() {
304          switch (this) {
305            case EMERGENCY: return "Emergency";
306            case ALERT: return "Alert";
307            case CRITICAL: return "Critical";
308            case ERROR: return "Error";
309            case WARNING: return "Warning";
310            case NOTICE: return "Notice";
311            case INFORMATIONAL: return "Informational";
312            case DEBUG: return "Debug";
313            case NULL: return null;
314            default: return "?";
315          }
316        }
317    }
318
319  public static class AuditEventSeverityEnumFactory implements EnumFactory<AuditEventSeverity> {
320    public AuditEventSeverity fromCode(String codeString) throws IllegalArgumentException {
321      if (codeString == null || "".equals(codeString))
322            if (codeString == null || "".equals(codeString))
323                return null;
324        if ("emergency".equals(codeString))
325          return AuditEventSeverity.EMERGENCY;
326        if ("alert".equals(codeString))
327          return AuditEventSeverity.ALERT;
328        if ("critical".equals(codeString))
329          return AuditEventSeverity.CRITICAL;
330        if ("error".equals(codeString))
331          return AuditEventSeverity.ERROR;
332        if ("warning".equals(codeString))
333          return AuditEventSeverity.WARNING;
334        if ("notice".equals(codeString))
335          return AuditEventSeverity.NOTICE;
336        if ("informational".equals(codeString))
337          return AuditEventSeverity.INFORMATIONAL;
338        if ("debug".equals(codeString))
339          return AuditEventSeverity.DEBUG;
340        throw new IllegalArgumentException("Unknown AuditEventSeverity code '"+codeString+"'");
341        }
342        public Enumeration<AuditEventSeverity> fromType(PrimitiveType<?> code) throws FHIRException {
343          if (code == null)
344            return null;
345          if (code.isEmpty())
346            return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.NULL, code);
347          String codeString = ((PrimitiveType) code).asStringValue();
348          if (codeString == null || "".equals(codeString))
349            return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.NULL, code);
350        if ("emergency".equals(codeString))
351          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.EMERGENCY, code);
352        if ("alert".equals(codeString))
353          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.ALERT, code);
354        if ("critical".equals(codeString))
355          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.CRITICAL, code);
356        if ("error".equals(codeString))
357          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.ERROR, code);
358        if ("warning".equals(codeString))
359          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.WARNING, code);
360        if ("notice".equals(codeString))
361          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.NOTICE, code);
362        if ("informational".equals(codeString))
363          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.INFORMATIONAL, code);
364        if ("debug".equals(codeString))
365          return new Enumeration<AuditEventSeverity>(this, AuditEventSeverity.DEBUG, code);
366        throw new FHIRException("Unknown AuditEventSeverity code '"+codeString+"'");
367        }
368    public String toCode(AuditEventSeverity code) {
369      if (code == AuditEventSeverity.EMERGENCY)
370        return "emergency";
371      if (code == AuditEventSeverity.ALERT)
372        return "alert";
373      if (code == AuditEventSeverity.CRITICAL)
374        return "critical";
375      if (code == AuditEventSeverity.ERROR)
376        return "error";
377      if (code == AuditEventSeverity.WARNING)
378        return "warning";
379      if (code == AuditEventSeverity.NOTICE)
380        return "notice";
381      if (code == AuditEventSeverity.INFORMATIONAL)
382        return "informational";
383      if (code == AuditEventSeverity.DEBUG)
384        return "debug";
385      return "?";
386      }
387    public String toSystem(AuditEventSeverity code) {
388      return code.getSystem();
389      }
390    }
391
392    @Block()
393    public static class AuditEventOutcomeComponent extends BackboneElement implements IBaseBackboneElement {
394        /**
395         * Indicates whether the event succeeded or failed.
396         */
397        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
398        @Description(shortDefinition="Whether the event succeeded or failed", formalDefinition="Indicates whether the event succeeded or failed." )
399        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-outcome")
400        protected Coding code;
401
402        /**
403         * Additional details about the error. This may be a text description of the error or a system code that identifies the error.
404         */
405        @Child(name = "detail", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
406        @Description(shortDefinition="Additional outcome detail", formalDefinition="Additional details about the error. This may be a text description of the error or a system code that identifies the error." )
407        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-outcome-detail")
408        protected List<CodeableConcept> detail;
409
410        private static final long serialVersionUID = -1108329559L;
411
412    /**
413     * Constructor
414     */
415      public AuditEventOutcomeComponent() {
416        super();
417      }
418
419    /**
420     * Constructor
421     */
422      public AuditEventOutcomeComponent(Coding code) {
423        super();
424        this.setCode(code);
425      }
426
427        /**
428         * @return {@link #code} (Indicates whether the event succeeded or failed.)
429         */
430        public Coding getCode() { 
431          if (this.code == null)
432            if (Configuration.errorOnAutoCreate())
433              throw new Error("Attempt to auto-create AuditEventOutcomeComponent.code");
434            else if (Configuration.doAutoCreate())
435              this.code = new Coding(); // cc
436          return this.code;
437        }
438
439        public boolean hasCode() { 
440          return this.code != null && !this.code.isEmpty();
441        }
442
443        /**
444         * @param value {@link #code} (Indicates whether the event succeeded or failed.)
445         */
446        public AuditEventOutcomeComponent setCode(Coding value) { 
447          this.code = value;
448          return this;
449        }
450
451        /**
452         * @return {@link #detail} (Additional details about the error. This may be a text description of the error or a system code that identifies the error.)
453         */
454        public List<CodeableConcept> getDetail() { 
455          if (this.detail == null)
456            this.detail = new ArrayList<CodeableConcept>();
457          return this.detail;
458        }
459
460        /**
461         * @return Returns a reference to <code>this</code> for easy method chaining
462         */
463        public AuditEventOutcomeComponent setDetail(List<CodeableConcept> theDetail) { 
464          this.detail = theDetail;
465          return this;
466        }
467
468        public boolean hasDetail() { 
469          if (this.detail == null)
470            return false;
471          for (CodeableConcept item : this.detail)
472            if (!item.isEmpty())
473              return true;
474          return false;
475        }
476
477        public CodeableConcept addDetail() { //3
478          CodeableConcept t = new CodeableConcept();
479          if (this.detail == null)
480            this.detail = new ArrayList<CodeableConcept>();
481          this.detail.add(t);
482          return t;
483        }
484
485        public AuditEventOutcomeComponent addDetail(CodeableConcept t) { //3
486          if (t == null)
487            return this;
488          if (this.detail == null)
489            this.detail = new ArrayList<CodeableConcept>();
490          this.detail.add(t);
491          return this;
492        }
493
494        /**
495         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
496         */
497        public CodeableConcept getDetailFirstRep() { 
498          if (getDetail().isEmpty()) {
499            addDetail();
500          }
501          return getDetail().get(0);
502        }
503
504        protected void listChildren(List<Property> children) {
505          super.listChildren(children);
506          children.add(new Property("code", "Coding", "Indicates whether the event succeeded or failed.", 0, 1, code));
507          children.add(new Property("detail", "CodeableConcept", "Additional details about the error. This may be a text description of the error or a system code that identifies the error.", 0, java.lang.Integer.MAX_VALUE, detail));
508        }
509
510        @Override
511        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
512          switch (_hash) {
513          case 3059181: /*code*/  return new Property("code", "Coding", "Indicates whether the event succeeded or failed.", 0, 1, code);
514          case -1335224239: /*detail*/  return new Property("detail", "CodeableConcept", "Additional details about the error. This may be a text description of the error or a system code that identifies the error.", 0, java.lang.Integer.MAX_VALUE, detail);
515          default: return super.getNamedProperty(_hash, _name, _checkValid);
516          }
517
518        }
519
520      @Override
521      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
522        switch (hash) {
523        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Coding
524        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // CodeableConcept
525        default: return super.getProperty(hash, name, checkValid);
526        }
527
528      }
529
530      @Override
531      public Base setProperty(int hash, String name, Base value) throws FHIRException {
532        switch (hash) {
533        case 3059181: // code
534          this.code = TypeConvertor.castToCoding(value); // Coding
535          return value;
536        case -1335224239: // detail
537          this.getDetail().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
538          return value;
539        default: return super.setProperty(hash, name, value);
540        }
541
542      }
543
544      @Override
545      public Base setProperty(String name, Base value) throws FHIRException {
546        if (name.equals("code")) {
547          this.code = TypeConvertor.castToCoding(value); // Coding
548        } else if (name.equals("detail")) {
549          this.getDetail().add(TypeConvertor.castToCodeableConcept(value));
550        } else
551          return super.setProperty(name, value);
552        return value;
553      }
554
555      @Override
556      public Base makeProperty(int hash, String name) throws FHIRException {
557        switch (hash) {
558        case 3059181:  return getCode();
559        case -1335224239:  return addDetail(); 
560        default: return super.makeProperty(hash, name);
561        }
562
563      }
564
565      @Override
566      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
567        switch (hash) {
568        case 3059181: /*code*/ return new String[] {"Coding"};
569        case -1335224239: /*detail*/ return new String[] {"CodeableConcept"};
570        default: return super.getTypesForProperty(hash, name);
571        }
572
573      }
574
575      @Override
576      public Base addChild(String name) throws FHIRException {
577        if (name.equals("code")) {
578          this.code = new Coding();
579          return this.code;
580        }
581        else if (name.equals("detail")) {
582          return addDetail();
583        }
584        else
585          return super.addChild(name);
586      }
587
588      public AuditEventOutcomeComponent copy() {
589        AuditEventOutcomeComponent dst = new AuditEventOutcomeComponent();
590        copyValues(dst);
591        return dst;
592      }
593
594      public void copyValues(AuditEventOutcomeComponent dst) {
595        super.copyValues(dst);
596        dst.code = code == null ? null : code.copy();
597        if (detail != null) {
598          dst.detail = new ArrayList<CodeableConcept>();
599          for (CodeableConcept i : detail)
600            dst.detail.add(i.copy());
601        };
602      }
603
604      @Override
605      public boolean equalsDeep(Base other_) {
606        if (!super.equalsDeep(other_))
607          return false;
608        if (!(other_ instanceof AuditEventOutcomeComponent))
609          return false;
610        AuditEventOutcomeComponent o = (AuditEventOutcomeComponent) other_;
611        return compareDeep(code, o.code, true) && compareDeep(detail, o.detail, true);
612      }
613
614      @Override
615      public boolean equalsShallow(Base other_) {
616        if (!super.equalsShallow(other_))
617          return false;
618        if (!(other_ instanceof AuditEventOutcomeComponent))
619          return false;
620        AuditEventOutcomeComponent o = (AuditEventOutcomeComponent) other_;
621        return true;
622      }
623
624      public boolean isEmpty() {
625        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, detail);
626      }
627
628  public String fhirType() {
629    return "AuditEvent.outcome";
630
631  }
632
633  }
634
635    @Block()
636    public static class AuditEventAgentComponent extends BackboneElement implements IBaseBackboneElement {
637        /**
638         * The Functional Role of the user when performing the event.
639         */
640        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
641        @Description(shortDefinition="How agent participated", formalDefinition="The Functional Role of the user when performing the event." )
642        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participation-role-type")
643        protected CodeableConcept type;
644
645        /**
646         * The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.
647         */
648        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
649        @Description(shortDefinition="Agent role in the event", formalDefinition="The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity." )
650        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-role-type")
651        protected List<CodeableConcept> role;
652
653        /**
654         * Reference to who this agent is that was involved in the event.
655         */
656        @Child(name = "who", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=3, min=1, max=1, modifier=false, summary=true)
657        @Description(shortDefinition="Identifier of who", formalDefinition="Reference to who this agent is that was involved in the event." )
658        protected Reference who;
659
660        /**
661         * Indicator that the user is or is not the requestor, or initiator, for the event being audited.
662         */
663        @Child(name = "requestor", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
664        @Description(shortDefinition="Whether user is initiator", formalDefinition="Indicator that the user is or is not the requestor, or initiator, for the event being audited." )
665        protected BooleanType requestor;
666
667        /**
668         * Where the agent location is known, the agent location when the event occurred.
669         */
670        @Child(name = "location", type = {Location.class}, order=5, min=0, max=1, modifier=false, summary=false)
671        @Description(shortDefinition="The agent location when the event occurred", formalDefinition="Where the agent location is known, the agent location when the event occurred." )
672        protected Reference location;
673
674        /**
675         * Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.
676         */
677        @Child(name = "policy", type = {UriType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
678        @Description(shortDefinition="Policy that authorized the agent participation in the event", formalDefinition="Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used." )
679        protected List<UriType> policy;
680
681        /**
682         * When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.
683         */
684        @Child(name = "network", type = {Endpoint.class, UriType.class, StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
685        @Description(shortDefinition="This agent network location for the activity", formalDefinition="When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details." )
686        protected DataType network;
687
688        /**
689         * The authorization (e.g., PurposeOfUse) that was used during the event being recorded.
690         */
691        @Child(name = "authorization", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
692        @Description(shortDefinition="Allowable authorization for this agent", formalDefinition="The authorization (e.g., PurposeOfUse) that was used during the event being recorded." )
693        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
694        protected List<CodeableConcept> authorization;
695
696        private static final long serialVersionUID = 509129255L;
697
698    /**
699     * Constructor
700     */
701      public AuditEventAgentComponent() {
702        super();
703      }
704
705    /**
706     * Constructor
707     */
708      public AuditEventAgentComponent(Reference who) {
709        super();
710        this.setWho(who);
711      }
712
713        /**
714         * @return {@link #type} (The Functional Role of the user when performing the event.)
715         */
716        public CodeableConcept getType() { 
717          if (this.type == null)
718            if (Configuration.errorOnAutoCreate())
719              throw new Error("Attempt to auto-create AuditEventAgentComponent.type");
720            else if (Configuration.doAutoCreate())
721              this.type = new CodeableConcept(); // cc
722          return this.type;
723        }
724
725        public boolean hasType() { 
726          return this.type != null && !this.type.isEmpty();
727        }
728
729        /**
730         * @param value {@link #type} (The Functional Role of the user when performing the event.)
731         */
732        public AuditEventAgentComponent setType(CodeableConcept value) { 
733          this.type = value;
734          return this;
735        }
736
737        /**
738         * @return {@link #role} (The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.)
739         */
740        public List<CodeableConcept> getRole() { 
741          if (this.role == null)
742            this.role = new ArrayList<CodeableConcept>();
743          return this.role;
744        }
745
746        /**
747         * @return Returns a reference to <code>this</code> for easy method chaining
748         */
749        public AuditEventAgentComponent setRole(List<CodeableConcept> theRole) { 
750          this.role = theRole;
751          return this;
752        }
753
754        public boolean hasRole() { 
755          if (this.role == null)
756            return false;
757          for (CodeableConcept item : this.role)
758            if (!item.isEmpty())
759              return true;
760          return false;
761        }
762
763        public CodeableConcept addRole() { //3
764          CodeableConcept t = new CodeableConcept();
765          if (this.role == null)
766            this.role = new ArrayList<CodeableConcept>();
767          this.role.add(t);
768          return t;
769        }
770
771        public AuditEventAgentComponent addRole(CodeableConcept t) { //3
772          if (t == null)
773            return this;
774          if (this.role == null)
775            this.role = new ArrayList<CodeableConcept>();
776          this.role.add(t);
777          return this;
778        }
779
780        /**
781         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist {3}
782         */
783        public CodeableConcept getRoleFirstRep() { 
784          if (getRole().isEmpty()) {
785            addRole();
786          }
787          return getRole().get(0);
788        }
789
790        /**
791         * @return {@link #who} (Reference to who this agent is that was involved in the event.)
792         */
793        public Reference getWho() { 
794          if (this.who == null)
795            if (Configuration.errorOnAutoCreate())
796              throw new Error("Attempt to auto-create AuditEventAgentComponent.who");
797            else if (Configuration.doAutoCreate())
798              this.who = new Reference(); // cc
799          return this.who;
800        }
801
802        public boolean hasWho() { 
803          return this.who != null && !this.who.isEmpty();
804        }
805
806        /**
807         * @param value {@link #who} (Reference to who this agent is that was involved in the event.)
808         */
809        public AuditEventAgentComponent setWho(Reference value) { 
810          this.who = value;
811          return this;
812        }
813
814        /**
815         * @return {@link #requestor} (Indicator that the user is or is not the requestor, or initiator, for the event being audited.). This is the underlying object with id, value and extensions. The accessor "getRequestor" gives direct access to the value
816         */
817        public BooleanType getRequestorElement() { 
818          if (this.requestor == null)
819            if (Configuration.errorOnAutoCreate())
820              throw new Error("Attempt to auto-create AuditEventAgentComponent.requestor");
821            else if (Configuration.doAutoCreate())
822              this.requestor = new BooleanType(); // bb
823          return this.requestor;
824        }
825
826        public boolean hasRequestorElement() { 
827          return this.requestor != null && !this.requestor.isEmpty();
828        }
829
830        public boolean hasRequestor() { 
831          return this.requestor != null && !this.requestor.isEmpty();
832        }
833
834        /**
835         * @param value {@link #requestor} (Indicator that the user is or is not the requestor, or initiator, for the event being audited.). This is the underlying object with id, value and extensions. The accessor "getRequestor" gives direct access to the value
836         */
837        public AuditEventAgentComponent setRequestorElement(BooleanType value) { 
838          this.requestor = value;
839          return this;
840        }
841
842        /**
843         * @return Indicator that the user is or is not the requestor, or initiator, for the event being audited.
844         */
845        public boolean getRequestor() { 
846          return this.requestor == null || this.requestor.isEmpty() ? false : this.requestor.getValue();
847        }
848
849        /**
850         * @param value Indicator that the user is or is not the requestor, or initiator, for the event being audited.
851         */
852        public AuditEventAgentComponent setRequestor(boolean value) { 
853            if (this.requestor == null)
854              this.requestor = new BooleanType();
855            this.requestor.setValue(value);
856          return this;
857        }
858
859        /**
860         * @return {@link #location} (Where the agent location is known, the agent location when the event occurred.)
861         */
862        public Reference getLocation() { 
863          if (this.location == null)
864            if (Configuration.errorOnAutoCreate())
865              throw new Error("Attempt to auto-create AuditEventAgentComponent.location");
866            else if (Configuration.doAutoCreate())
867              this.location = new Reference(); // cc
868          return this.location;
869        }
870
871        public boolean hasLocation() { 
872          return this.location != null && !this.location.isEmpty();
873        }
874
875        /**
876         * @param value {@link #location} (Where the agent location is known, the agent location when the event occurred.)
877         */
878        public AuditEventAgentComponent setLocation(Reference value) { 
879          this.location = value;
880          return this;
881        }
882
883        /**
884         * @return {@link #policy} (Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.)
885         */
886        public List<UriType> getPolicy() { 
887          if (this.policy == null)
888            this.policy = new ArrayList<UriType>();
889          return this.policy;
890        }
891
892        /**
893         * @return Returns a reference to <code>this</code> for easy method chaining
894         */
895        public AuditEventAgentComponent setPolicy(List<UriType> thePolicy) { 
896          this.policy = thePolicy;
897          return this;
898        }
899
900        public boolean hasPolicy() { 
901          if (this.policy == null)
902            return false;
903          for (UriType item : this.policy)
904            if (!item.isEmpty())
905              return true;
906          return false;
907        }
908
909        /**
910         * @return {@link #policy} (Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.)
911         */
912        public UriType addPolicyElement() {//2 
913          UriType t = new UriType();
914          if (this.policy == null)
915            this.policy = new ArrayList<UriType>();
916          this.policy.add(t);
917          return t;
918        }
919
920        /**
921         * @param value {@link #policy} (Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.)
922         */
923        public AuditEventAgentComponent addPolicy(String value) { //1
924          UriType t = new UriType();
925          t.setValue(value);
926          if (this.policy == null)
927            this.policy = new ArrayList<UriType>();
928          this.policy.add(t);
929          return this;
930        }
931
932        /**
933         * @param value {@link #policy} (Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.)
934         */
935        public boolean hasPolicy(String value) { 
936          if (this.policy == null)
937            return false;
938          for (UriType v : this.policy)
939            if (v.getValue().equals(value)) // uri
940              return true;
941          return false;
942        }
943
944        /**
945         * @return {@link #network} (When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.)
946         */
947        public DataType getNetwork() { 
948          return this.network;
949        }
950
951        /**
952         * @return {@link #network} (When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.)
953         */
954        public Reference getNetworkReference() throws FHIRException { 
955          if (this.network == null)
956            this.network = new Reference();
957          if (!(this.network instanceof Reference))
958            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.network.getClass().getName()+" was encountered");
959          return (Reference) this.network;
960        }
961
962        public boolean hasNetworkReference() { 
963          return this != null && this.network instanceof Reference;
964        }
965
966        /**
967         * @return {@link #network} (When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.)
968         */
969        public UriType getNetworkUriType() throws FHIRException { 
970          if (this.network == null)
971            this.network = new UriType();
972          if (!(this.network instanceof UriType))
973            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.network.getClass().getName()+" was encountered");
974          return (UriType) this.network;
975        }
976
977        public boolean hasNetworkUriType() { 
978          return this != null && this.network instanceof UriType;
979        }
980
981        /**
982         * @return {@link #network} (When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.)
983         */
984        public StringType getNetworkStringType() throws FHIRException { 
985          if (this.network == null)
986            this.network = new StringType();
987          if (!(this.network instanceof StringType))
988            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.network.getClass().getName()+" was encountered");
989          return (StringType) this.network;
990        }
991
992        public boolean hasNetworkStringType() { 
993          return this != null && this.network instanceof StringType;
994        }
995
996        public boolean hasNetwork() { 
997          return this.network != null && !this.network.isEmpty();
998        }
999
1000        /**
1001         * @param value {@link #network} (When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.)
1002         */
1003        public AuditEventAgentComponent setNetwork(DataType value) { 
1004          if (value != null && !(value instanceof Reference || value instanceof UriType || value instanceof StringType))
1005            throw new FHIRException("Not the right type for AuditEvent.agent.network[x]: "+value.fhirType());
1006          this.network = value;
1007          return this;
1008        }
1009
1010        /**
1011         * @return {@link #authorization} (The authorization (e.g., PurposeOfUse) that was used during the event being recorded.)
1012         */
1013        public List<CodeableConcept> getAuthorization() { 
1014          if (this.authorization == null)
1015            this.authorization = new ArrayList<CodeableConcept>();
1016          return this.authorization;
1017        }
1018
1019        /**
1020         * @return Returns a reference to <code>this</code> for easy method chaining
1021         */
1022        public AuditEventAgentComponent setAuthorization(List<CodeableConcept> theAuthorization) { 
1023          this.authorization = theAuthorization;
1024          return this;
1025        }
1026
1027        public boolean hasAuthorization() { 
1028          if (this.authorization == null)
1029            return false;
1030          for (CodeableConcept item : this.authorization)
1031            if (!item.isEmpty())
1032              return true;
1033          return false;
1034        }
1035
1036        public CodeableConcept addAuthorization() { //3
1037          CodeableConcept t = new CodeableConcept();
1038          if (this.authorization == null)
1039            this.authorization = new ArrayList<CodeableConcept>();
1040          this.authorization.add(t);
1041          return t;
1042        }
1043
1044        public AuditEventAgentComponent addAuthorization(CodeableConcept t) { //3
1045          if (t == null)
1046            return this;
1047          if (this.authorization == null)
1048            this.authorization = new ArrayList<CodeableConcept>();
1049          this.authorization.add(t);
1050          return this;
1051        }
1052
1053        /**
1054         * @return The first repetition of repeating field {@link #authorization}, creating it if it does not already exist {3}
1055         */
1056        public CodeableConcept getAuthorizationFirstRep() { 
1057          if (getAuthorization().isEmpty()) {
1058            addAuthorization();
1059          }
1060          return getAuthorization().get(0);
1061        }
1062
1063        protected void listChildren(List<Property> children) {
1064          super.listChildren(children);
1065          children.add(new Property("type", "CodeableConcept", "The Functional Role of the user when performing the event.", 0, 1, type));
1066          children.add(new Property("role", "CodeableConcept", "The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role));
1067          children.add(new Property("who", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Reference to who this agent is that was involved in the event.", 0, 1, who));
1068          children.add(new Property("requestor", "boolean", "Indicator that the user is or is not the requestor, or initiator, for the event being audited.", 0, 1, requestor));
1069          children.add(new Property("location", "Reference(Location)", "Where the agent location is known, the agent location when the event occurred.", 0, 1, location));
1070          children.add(new Property("policy", "uri", "Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.", 0, java.lang.Integer.MAX_VALUE, policy));
1071          children.add(new Property("network[x]", "Reference(Endpoint)|uri|string", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network));
1072          children.add(new Property("authorization", "CodeableConcept", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization));
1073        }
1074
1075        @Override
1076        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1077          switch (_hash) {
1078          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The Functional Role of the user when performing the event.", 0, 1, type);
1079          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role);
1080          case 117694: /*who*/  return new Property("who", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Reference to who this agent is that was involved in the event.", 0, 1, who);
1081          case 693934258: /*requestor*/  return new Property("requestor", "boolean", "Indicator that the user is or is not the requestor, or initiator, for the event being audited.", 0, 1, requestor);
1082          case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Where the agent location is known, the agent location when the event occurred.", 0, 1, location);
1083          case -982670030: /*policy*/  return new Property("policy", "uri", "Where the policy(ies) are known that authorized the agent participation in the event. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.", 0, java.lang.Integer.MAX_VALUE, policy);
1084          case -478235758: /*network[x]*/  return new Property("network[x]", "Reference(Endpoint)|uri|string", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network);
1085          case 1843485230: /*network*/  return new Property("network[x]", "Reference(Endpoint)|uri|string", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network);
1086          case -1769760579: /*networkReference*/  return new Property("network[x]", "Reference(Endpoint)", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network);
1087          case -478241698: /*networkUri*/  return new Property("network[x]", "uri", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network);
1088          case -946943009: /*networkString*/  return new Property("network[x]", "string", "When the event utilizes a network there should be an agent describing the local system, and an agent describing remote system, with the network interface details.", 0, 1, network);
1089          case -1385570183: /*authorization*/  return new Property("authorization", "CodeableConcept", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization);
1090          default: return super.getNamedProperty(_hash, _name, _checkValid);
1091          }
1092
1093        }
1094
1095      @Override
1096      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1097        switch (hash) {
1098        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1099        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
1100        case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Reference
1101        case 693934258: /*requestor*/ return this.requestor == null ? new Base[0] : new Base[] {this.requestor}; // BooleanType
1102        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1103        case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // UriType
1104        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // DataType
1105        case -1385570183: /*authorization*/ return this.authorization == null ? new Base[0] : this.authorization.toArray(new Base[this.authorization.size()]); // CodeableConcept
1106        default: return super.getProperty(hash, name, checkValid);
1107        }
1108
1109      }
1110
1111      @Override
1112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1113        switch (hash) {
1114        case 3575610: // type
1115          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1116          return value;
1117        case 3506294: // role
1118          this.getRole().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1119          return value;
1120        case 117694: // who
1121          this.who = TypeConvertor.castToReference(value); // Reference
1122          return value;
1123        case 693934258: // requestor
1124          this.requestor = TypeConvertor.castToBoolean(value); // BooleanType
1125          return value;
1126        case 1901043637: // location
1127          this.location = TypeConvertor.castToReference(value); // Reference
1128          return value;
1129        case -982670030: // policy
1130          this.getPolicy().add(TypeConvertor.castToUri(value)); // UriType
1131          return value;
1132        case 1843485230: // network
1133          this.network = TypeConvertor.castToType(value); // DataType
1134          return value;
1135        case -1385570183: // authorization
1136          this.getAuthorization().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1137          return value;
1138        default: return super.setProperty(hash, name, value);
1139        }
1140
1141      }
1142
1143      @Override
1144      public Base setProperty(String name, Base value) throws FHIRException {
1145        if (name.equals("type")) {
1146          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1147        } else if (name.equals("role")) {
1148          this.getRole().add(TypeConvertor.castToCodeableConcept(value));
1149        } else if (name.equals("who")) {
1150          this.who = TypeConvertor.castToReference(value); // Reference
1151        } else if (name.equals("requestor")) {
1152          this.requestor = TypeConvertor.castToBoolean(value); // BooleanType
1153        } else if (name.equals("location")) {
1154          this.location = TypeConvertor.castToReference(value); // Reference
1155        } else if (name.equals("policy")) {
1156          this.getPolicy().add(TypeConvertor.castToUri(value));
1157        } else if (name.equals("network[x]")) {
1158          this.network = TypeConvertor.castToType(value); // DataType
1159        } else if (name.equals("authorization")) {
1160          this.getAuthorization().add(TypeConvertor.castToCodeableConcept(value));
1161        } else
1162          return super.setProperty(name, value);
1163        return value;
1164      }
1165
1166      @Override
1167      public Base makeProperty(int hash, String name) throws FHIRException {
1168        switch (hash) {
1169        case 3575610:  return getType();
1170        case 3506294:  return addRole(); 
1171        case 117694:  return getWho();
1172        case 693934258:  return getRequestorElement();
1173        case 1901043637:  return getLocation();
1174        case -982670030:  return addPolicyElement();
1175        case -478235758:  return getNetwork();
1176        case 1843485230:  return getNetwork();
1177        case -1385570183:  return addAuthorization(); 
1178        default: return super.makeProperty(hash, name);
1179        }
1180
1181      }
1182
1183      @Override
1184      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1185        switch (hash) {
1186        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1187        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1188        case 117694: /*who*/ return new String[] {"Reference"};
1189        case 693934258: /*requestor*/ return new String[] {"boolean"};
1190        case 1901043637: /*location*/ return new String[] {"Reference"};
1191        case -982670030: /*policy*/ return new String[] {"uri"};
1192        case 1843485230: /*network*/ return new String[] {"Reference", "uri", "string"};
1193        case -1385570183: /*authorization*/ return new String[] {"CodeableConcept"};
1194        default: return super.getTypesForProperty(hash, name);
1195        }
1196
1197      }
1198
1199      @Override
1200      public Base addChild(String name) throws FHIRException {
1201        if (name.equals("type")) {
1202          this.type = new CodeableConcept();
1203          return this.type;
1204        }
1205        else if (name.equals("role")) {
1206          return addRole();
1207        }
1208        else if (name.equals("who")) {
1209          this.who = new Reference();
1210          return this.who;
1211        }
1212        else if (name.equals("requestor")) {
1213          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.agent.requestor");
1214        }
1215        else if (name.equals("location")) {
1216          this.location = new Reference();
1217          return this.location;
1218        }
1219        else if (name.equals("policy")) {
1220          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.agent.policy");
1221        }
1222        else if (name.equals("networkReference")) {
1223          this.network = new Reference();
1224          return this.network;
1225        }
1226        else if (name.equals("networkUri")) {
1227          this.network = new UriType();
1228          return this.network;
1229        }
1230        else if (name.equals("networkString")) {
1231          this.network = new StringType();
1232          return this.network;
1233        }
1234        else if (name.equals("authorization")) {
1235          return addAuthorization();
1236        }
1237        else
1238          return super.addChild(name);
1239      }
1240
1241      public AuditEventAgentComponent copy() {
1242        AuditEventAgentComponent dst = new AuditEventAgentComponent();
1243        copyValues(dst);
1244        return dst;
1245      }
1246
1247      public void copyValues(AuditEventAgentComponent dst) {
1248        super.copyValues(dst);
1249        dst.type = type == null ? null : type.copy();
1250        if (role != null) {
1251          dst.role = new ArrayList<CodeableConcept>();
1252          for (CodeableConcept i : role)
1253            dst.role.add(i.copy());
1254        };
1255        dst.who = who == null ? null : who.copy();
1256        dst.requestor = requestor == null ? null : requestor.copy();
1257        dst.location = location == null ? null : location.copy();
1258        if (policy != null) {
1259          dst.policy = new ArrayList<UriType>();
1260          for (UriType i : policy)
1261            dst.policy.add(i.copy());
1262        };
1263        dst.network = network == null ? null : network.copy();
1264        if (authorization != null) {
1265          dst.authorization = new ArrayList<CodeableConcept>();
1266          for (CodeableConcept i : authorization)
1267            dst.authorization.add(i.copy());
1268        };
1269      }
1270
1271      @Override
1272      public boolean equalsDeep(Base other_) {
1273        if (!super.equalsDeep(other_))
1274          return false;
1275        if (!(other_ instanceof AuditEventAgentComponent))
1276          return false;
1277        AuditEventAgentComponent o = (AuditEventAgentComponent) other_;
1278        return compareDeep(type, o.type, true) && compareDeep(role, o.role, true) && compareDeep(who, o.who, true)
1279           && compareDeep(requestor, o.requestor, true) && compareDeep(location, o.location, true) && compareDeep(policy, o.policy, true)
1280           && compareDeep(network, o.network, true) && compareDeep(authorization, o.authorization, true);
1281      }
1282
1283      @Override
1284      public boolean equalsShallow(Base other_) {
1285        if (!super.equalsShallow(other_))
1286          return false;
1287        if (!(other_ instanceof AuditEventAgentComponent))
1288          return false;
1289        AuditEventAgentComponent o = (AuditEventAgentComponent) other_;
1290        return compareValues(requestor, o.requestor, true) && compareValues(policy, o.policy, true);
1291      }
1292
1293      public boolean isEmpty() {
1294        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, role, who, requestor
1295          , location, policy, network, authorization);
1296      }
1297
1298  public String fhirType() {
1299    return "AuditEvent.agent";
1300
1301  }
1302
1303  }
1304
1305    @Block()
1306    public static class AuditEventSourceComponent extends BackboneElement implements IBaseBackboneElement {
1307        /**
1308         * Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.
1309         */
1310        @Child(name = "site", type = {Location.class}, order=1, min=0, max=1, modifier=false, summary=false)
1311        @Description(shortDefinition="Logical source location within the enterprise", formalDefinition="Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group." )
1312        protected Reference site;
1313
1314        /**
1315         * Identifier of the source where the event was detected.
1316         */
1317        @Child(name = "observer", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=true)
1318        @Description(shortDefinition="The identity of source detecting the event", formalDefinition="Identifier of the source where the event was detected." )
1319        protected Reference observer;
1320
1321        /**
1322         * Code specifying the type of source where event originated.
1323         */
1324        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1325        @Description(shortDefinition="The type of source where event originated", formalDefinition="Code specifying the type of source where event originated." )
1326        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-source-type")
1327        protected List<CodeableConcept> type;
1328
1329        private static final long serialVersionUID = -140005578L;
1330
1331    /**
1332     * Constructor
1333     */
1334      public AuditEventSourceComponent() {
1335        super();
1336      }
1337
1338    /**
1339     * Constructor
1340     */
1341      public AuditEventSourceComponent(Reference observer) {
1342        super();
1343        this.setObserver(observer);
1344      }
1345
1346        /**
1347         * @return {@link #site} (Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.)
1348         */
1349        public Reference getSite() { 
1350          if (this.site == null)
1351            if (Configuration.errorOnAutoCreate())
1352              throw new Error("Attempt to auto-create AuditEventSourceComponent.site");
1353            else if (Configuration.doAutoCreate())
1354              this.site = new Reference(); // cc
1355          return this.site;
1356        }
1357
1358        public boolean hasSite() { 
1359          return this.site != null && !this.site.isEmpty();
1360        }
1361
1362        /**
1363         * @param value {@link #site} (Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.)
1364         */
1365        public AuditEventSourceComponent setSite(Reference value) { 
1366          this.site = value;
1367          return this;
1368        }
1369
1370        /**
1371         * @return {@link #observer} (Identifier of the source where the event was detected.)
1372         */
1373        public Reference getObserver() { 
1374          if (this.observer == null)
1375            if (Configuration.errorOnAutoCreate())
1376              throw new Error("Attempt to auto-create AuditEventSourceComponent.observer");
1377            else if (Configuration.doAutoCreate())
1378              this.observer = new Reference(); // cc
1379          return this.observer;
1380        }
1381
1382        public boolean hasObserver() { 
1383          return this.observer != null && !this.observer.isEmpty();
1384        }
1385
1386        /**
1387         * @param value {@link #observer} (Identifier of the source where the event was detected.)
1388         */
1389        public AuditEventSourceComponent setObserver(Reference value) { 
1390          this.observer = value;
1391          return this;
1392        }
1393
1394        /**
1395         * @return {@link #type} (Code specifying the type of source where event originated.)
1396         */
1397        public List<CodeableConcept> getType() { 
1398          if (this.type == null)
1399            this.type = new ArrayList<CodeableConcept>();
1400          return this.type;
1401        }
1402
1403        /**
1404         * @return Returns a reference to <code>this</code> for easy method chaining
1405         */
1406        public AuditEventSourceComponent setType(List<CodeableConcept> theType) { 
1407          this.type = theType;
1408          return this;
1409        }
1410
1411        public boolean hasType() { 
1412          if (this.type == null)
1413            return false;
1414          for (CodeableConcept item : this.type)
1415            if (!item.isEmpty())
1416              return true;
1417          return false;
1418        }
1419
1420        public CodeableConcept addType() { //3
1421          CodeableConcept t = new CodeableConcept();
1422          if (this.type == null)
1423            this.type = new ArrayList<CodeableConcept>();
1424          this.type.add(t);
1425          return t;
1426        }
1427
1428        public AuditEventSourceComponent addType(CodeableConcept t) { //3
1429          if (t == null)
1430            return this;
1431          if (this.type == null)
1432            this.type = new ArrayList<CodeableConcept>();
1433          this.type.add(t);
1434          return this;
1435        }
1436
1437        /**
1438         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
1439         */
1440        public CodeableConcept getTypeFirstRep() { 
1441          if (getType().isEmpty()) {
1442            addType();
1443          }
1444          return getType().get(0);
1445        }
1446
1447        protected void listChildren(List<Property> children) {
1448          super.listChildren(children);
1449          children.add(new Property("site", "Reference(Location)", "Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.", 0, 1, site));
1450          children.add(new Property("observer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Identifier of the source where the event was detected.", 0, 1, observer));
1451          children.add(new Property("type", "CodeableConcept", "Code specifying the type of source where event originated.", 0, java.lang.Integer.MAX_VALUE, type));
1452        }
1453
1454        @Override
1455        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1456          switch (_hash) {
1457          case 3530567: /*site*/  return new Property("site", "Reference(Location)", "Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.", 0, 1, site);
1458          case 348607190: /*observer*/  return new Property("observer", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Identifier of the source where the event was detected.", 0, 1, observer);
1459          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code specifying the type of source where event originated.", 0, java.lang.Integer.MAX_VALUE, type);
1460          default: return super.getNamedProperty(_hash, _name, _checkValid);
1461          }
1462
1463        }
1464
1465      @Override
1466      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1467        switch (hash) {
1468        case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // Reference
1469        case 348607190: /*observer*/ return this.observer == null ? new Base[0] : new Base[] {this.observer}; // Reference
1470        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1471        default: return super.getProperty(hash, name, checkValid);
1472        }
1473
1474      }
1475
1476      @Override
1477      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1478        switch (hash) {
1479        case 3530567: // site
1480          this.site = TypeConvertor.castToReference(value); // Reference
1481          return value;
1482        case 348607190: // observer
1483          this.observer = TypeConvertor.castToReference(value); // Reference
1484          return value;
1485        case 3575610: // type
1486          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1487          return value;
1488        default: return super.setProperty(hash, name, value);
1489        }
1490
1491      }
1492
1493      @Override
1494      public Base setProperty(String name, Base value) throws FHIRException {
1495        if (name.equals("site")) {
1496          this.site = TypeConvertor.castToReference(value); // Reference
1497        } else if (name.equals("observer")) {
1498          this.observer = TypeConvertor.castToReference(value); // Reference
1499        } else if (name.equals("type")) {
1500          this.getType().add(TypeConvertor.castToCodeableConcept(value));
1501        } else
1502          return super.setProperty(name, value);
1503        return value;
1504      }
1505
1506      @Override
1507      public Base makeProperty(int hash, String name) throws FHIRException {
1508        switch (hash) {
1509        case 3530567:  return getSite();
1510        case 348607190:  return getObserver();
1511        case 3575610:  return addType(); 
1512        default: return super.makeProperty(hash, name);
1513        }
1514
1515      }
1516
1517      @Override
1518      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1519        switch (hash) {
1520        case 3530567: /*site*/ return new String[] {"Reference"};
1521        case 348607190: /*observer*/ return new String[] {"Reference"};
1522        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1523        default: return super.getTypesForProperty(hash, name);
1524        }
1525
1526      }
1527
1528      @Override
1529      public Base addChild(String name) throws FHIRException {
1530        if (name.equals("site")) {
1531          this.site = new Reference();
1532          return this.site;
1533        }
1534        else if (name.equals("observer")) {
1535          this.observer = new Reference();
1536          return this.observer;
1537        }
1538        else if (name.equals("type")) {
1539          return addType();
1540        }
1541        else
1542          return super.addChild(name);
1543      }
1544
1545      public AuditEventSourceComponent copy() {
1546        AuditEventSourceComponent dst = new AuditEventSourceComponent();
1547        copyValues(dst);
1548        return dst;
1549      }
1550
1551      public void copyValues(AuditEventSourceComponent dst) {
1552        super.copyValues(dst);
1553        dst.site = site == null ? null : site.copy();
1554        dst.observer = observer == null ? null : observer.copy();
1555        if (type != null) {
1556          dst.type = new ArrayList<CodeableConcept>();
1557          for (CodeableConcept i : type)
1558            dst.type.add(i.copy());
1559        };
1560      }
1561
1562      @Override
1563      public boolean equalsDeep(Base other_) {
1564        if (!super.equalsDeep(other_))
1565          return false;
1566        if (!(other_ instanceof AuditEventSourceComponent))
1567          return false;
1568        AuditEventSourceComponent o = (AuditEventSourceComponent) other_;
1569        return compareDeep(site, o.site, true) && compareDeep(observer, o.observer, true) && compareDeep(type, o.type, true)
1570          ;
1571      }
1572
1573      @Override
1574      public boolean equalsShallow(Base other_) {
1575        if (!super.equalsShallow(other_))
1576          return false;
1577        if (!(other_ instanceof AuditEventSourceComponent))
1578          return false;
1579        AuditEventSourceComponent o = (AuditEventSourceComponent) other_;
1580        return true;
1581      }
1582
1583      public boolean isEmpty() {
1584        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(site, observer, type);
1585      }
1586
1587  public String fhirType() {
1588    return "AuditEvent.source";
1589
1590  }
1591
1592  }
1593
1594    @Block()
1595    public static class AuditEventEntityComponent extends BackboneElement implements IBaseBackboneElement {
1596        /**
1597         * Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.
1598         */
1599        @Child(name = "what", type = {Reference.class}, order=1, min=0, max=1, modifier=false, summary=true)
1600        @Description(shortDefinition="Specific instance of resource", formalDefinition="Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource." )
1601        protected Reference what;
1602
1603        /**
1604         * Code representing the role the entity played in the event being audited.
1605         */
1606        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1607        @Description(shortDefinition="What role the entity played", formalDefinition="Code representing the role the entity played in the event being audited." )
1608        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/object-role")
1609        protected CodeableConcept role;
1610
1611        /**
1612         * Security labels for the identified entity.
1613         */
1614        @Child(name = "securityLabel", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1615        @Description(shortDefinition="Security labels on the entity", formalDefinition="Security labels for the identified entity." )
1616        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-label-examples")
1617        protected List<CodeableConcept> securityLabel;
1618
1619        /**
1620         * The query parameters for a query-type entities.
1621         */
1622        @Child(name = "query", type = {Base64BinaryType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1623        @Description(shortDefinition="Query parameters", formalDefinition="The query parameters for a query-type entities." )
1624        protected Base64BinaryType query;
1625
1626        /**
1627         * Tagged value pairs for conveying additional information about the entity.
1628         */
1629        @Child(name = "detail", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1630        @Description(shortDefinition="Additional Information about the entity", formalDefinition="Tagged value pairs for conveying additional information about the entity." )
1631        protected List<AuditEventEntityDetailComponent> detail;
1632
1633        /**
1634         * The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent.
1635         */
1636        @Child(name = "agent", type = {AuditEventAgentComponent.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1637        @Description(shortDefinition="Entity is attributed to this agent", formalDefinition="The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent." )
1638        protected List<AuditEventAgentComponent> agent;
1639
1640        private static final long serialVersionUID = -711898650L;
1641
1642    /**
1643     * Constructor
1644     */
1645      public AuditEventEntityComponent() {
1646        super();
1647      }
1648
1649        /**
1650         * @return {@link #what} (Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.)
1651         */
1652        public Reference getWhat() { 
1653          if (this.what == null)
1654            if (Configuration.errorOnAutoCreate())
1655              throw new Error("Attempt to auto-create AuditEventEntityComponent.what");
1656            else if (Configuration.doAutoCreate())
1657              this.what = new Reference(); // cc
1658          return this.what;
1659        }
1660
1661        public boolean hasWhat() { 
1662          return this.what != null && !this.what.isEmpty();
1663        }
1664
1665        /**
1666         * @param value {@link #what} (Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.)
1667         */
1668        public AuditEventEntityComponent setWhat(Reference value) { 
1669          this.what = value;
1670          return this;
1671        }
1672
1673        /**
1674         * @return {@link #role} (Code representing the role the entity played in the event being audited.)
1675         */
1676        public CodeableConcept getRole() { 
1677          if (this.role == null)
1678            if (Configuration.errorOnAutoCreate())
1679              throw new Error("Attempt to auto-create AuditEventEntityComponent.role");
1680            else if (Configuration.doAutoCreate())
1681              this.role = new CodeableConcept(); // cc
1682          return this.role;
1683        }
1684
1685        public boolean hasRole() { 
1686          return this.role != null && !this.role.isEmpty();
1687        }
1688
1689        /**
1690         * @param value {@link #role} (Code representing the role the entity played in the event being audited.)
1691         */
1692        public AuditEventEntityComponent setRole(CodeableConcept value) { 
1693          this.role = value;
1694          return this;
1695        }
1696
1697        /**
1698         * @return {@link #securityLabel} (Security labels for the identified entity.)
1699         */
1700        public List<CodeableConcept> getSecurityLabel() { 
1701          if (this.securityLabel == null)
1702            this.securityLabel = new ArrayList<CodeableConcept>();
1703          return this.securityLabel;
1704        }
1705
1706        /**
1707         * @return Returns a reference to <code>this</code> for easy method chaining
1708         */
1709        public AuditEventEntityComponent setSecurityLabel(List<CodeableConcept> theSecurityLabel) { 
1710          this.securityLabel = theSecurityLabel;
1711          return this;
1712        }
1713
1714        public boolean hasSecurityLabel() { 
1715          if (this.securityLabel == null)
1716            return false;
1717          for (CodeableConcept item : this.securityLabel)
1718            if (!item.isEmpty())
1719              return true;
1720          return false;
1721        }
1722
1723        public CodeableConcept addSecurityLabel() { //3
1724          CodeableConcept t = new CodeableConcept();
1725          if (this.securityLabel == null)
1726            this.securityLabel = new ArrayList<CodeableConcept>();
1727          this.securityLabel.add(t);
1728          return t;
1729        }
1730
1731        public AuditEventEntityComponent addSecurityLabel(CodeableConcept t) { //3
1732          if (t == null)
1733            return this;
1734          if (this.securityLabel == null)
1735            this.securityLabel = new ArrayList<CodeableConcept>();
1736          this.securityLabel.add(t);
1737          return this;
1738        }
1739
1740        /**
1741         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist {3}
1742         */
1743        public CodeableConcept getSecurityLabelFirstRep() { 
1744          if (getSecurityLabel().isEmpty()) {
1745            addSecurityLabel();
1746          }
1747          return getSecurityLabel().get(0);
1748        }
1749
1750        /**
1751         * @return {@link #query} (The query parameters for a query-type entities.). This is the underlying object with id, value and extensions. The accessor "getQuery" gives direct access to the value
1752         */
1753        public Base64BinaryType getQueryElement() { 
1754          if (this.query == null)
1755            if (Configuration.errorOnAutoCreate())
1756              throw new Error("Attempt to auto-create AuditEventEntityComponent.query");
1757            else if (Configuration.doAutoCreate())
1758              this.query = new Base64BinaryType(); // bb
1759          return this.query;
1760        }
1761
1762        public boolean hasQueryElement() { 
1763          return this.query != null && !this.query.isEmpty();
1764        }
1765
1766        public boolean hasQuery() { 
1767          return this.query != null && !this.query.isEmpty();
1768        }
1769
1770        /**
1771         * @param value {@link #query} (The query parameters for a query-type entities.). This is the underlying object with id, value and extensions. The accessor "getQuery" gives direct access to the value
1772         */
1773        public AuditEventEntityComponent setQueryElement(Base64BinaryType value) { 
1774          this.query = value;
1775          return this;
1776        }
1777
1778        /**
1779         * @return The query parameters for a query-type entities.
1780         */
1781        public byte[] getQuery() { 
1782          return this.query == null ? null : this.query.getValue();
1783        }
1784
1785        /**
1786         * @param value The query parameters for a query-type entities.
1787         */
1788        public AuditEventEntityComponent setQuery(byte[] value) { 
1789          if (value == null)
1790            this.query = null;
1791          else {
1792            if (this.query == null)
1793              this.query = new Base64BinaryType();
1794            this.query.setValue(value);
1795          }
1796          return this;
1797        }
1798
1799        /**
1800         * @return {@link #detail} (Tagged value pairs for conveying additional information about the entity.)
1801         */
1802        public List<AuditEventEntityDetailComponent> getDetail() { 
1803          if (this.detail == null)
1804            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
1805          return this.detail;
1806        }
1807
1808        /**
1809         * @return Returns a reference to <code>this</code> for easy method chaining
1810         */
1811        public AuditEventEntityComponent setDetail(List<AuditEventEntityDetailComponent> theDetail) { 
1812          this.detail = theDetail;
1813          return this;
1814        }
1815
1816        public boolean hasDetail() { 
1817          if (this.detail == null)
1818            return false;
1819          for (AuditEventEntityDetailComponent item : this.detail)
1820            if (!item.isEmpty())
1821              return true;
1822          return false;
1823        }
1824
1825        public AuditEventEntityDetailComponent addDetail() { //3
1826          AuditEventEntityDetailComponent t = new AuditEventEntityDetailComponent();
1827          if (this.detail == null)
1828            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
1829          this.detail.add(t);
1830          return t;
1831        }
1832
1833        public AuditEventEntityComponent addDetail(AuditEventEntityDetailComponent t) { //3
1834          if (t == null)
1835            return this;
1836          if (this.detail == null)
1837            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
1838          this.detail.add(t);
1839          return this;
1840        }
1841
1842        /**
1843         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist {3}
1844         */
1845        public AuditEventEntityDetailComponent getDetailFirstRep() { 
1846          if (getDetail().isEmpty()) {
1847            addDetail();
1848          }
1849          return getDetail().get(0);
1850        }
1851
1852        /**
1853         * @return {@link #agent} (The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent.)
1854         */
1855        public List<AuditEventAgentComponent> getAgent() { 
1856          if (this.agent == null)
1857            this.agent = new ArrayList<AuditEventAgentComponent>();
1858          return this.agent;
1859        }
1860
1861        /**
1862         * @return Returns a reference to <code>this</code> for easy method chaining
1863         */
1864        public AuditEventEntityComponent setAgent(List<AuditEventAgentComponent> theAgent) { 
1865          this.agent = theAgent;
1866          return this;
1867        }
1868
1869        public boolean hasAgent() { 
1870          if (this.agent == null)
1871            return false;
1872          for (AuditEventAgentComponent item : this.agent)
1873            if (!item.isEmpty())
1874              return true;
1875          return false;
1876        }
1877
1878        public AuditEventAgentComponent addAgent() { //3
1879          AuditEventAgentComponent t = new AuditEventAgentComponent();
1880          if (this.agent == null)
1881            this.agent = new ArrayList<AuditEventAgentComponent>();
1882          this.agent.add(t);
1883          return t;
1884        }
1885
1886        public AuditEventEntityComponent addAgent(AuditEventAgentComponent t) { //3
1887          if (t == null)
1888            return this;
1889          if (this.agent == null)
1890            this.agent = new ArrayList<AuditEventAgentComponent>();
1891          this.agent.add(t);
1892          return this;
1893        }
1894
1895        /**
1896         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
1897         */
1898        public AuditEventAgentComponent getAgentFirstRep() { 
1899          if (getAgent().isEmpty()) {
1900            addAgent();
1901          }
1902          return getAgent().get(0);
1903        }
1904
1905        protected void listChildren(List<Property> children) {
1906          super.listChildren(children);
1907          children.add(new Property("what", "Reference(Any)", "Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.", 0, 1, what));
1908          children.add(new Property("role", "CodeableConcept", "Code representing the role the entity played in the event being audited.", 0, 1, role));
1909          children.add(new Property("securityLabel", "CodeableConcept", "Security labels for the identified entity.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
1910          children.add(new Property("query", "base64Binary", "The query parameters for a query-type entities.", 0, 1, query));
1911          children.add(new Property("detail", "", "Tagged value pairs for conveying additional information about the entity.", 0, java.lang.Integer.MAX_VALUE, detail));
1912          children.add(new Property("agent", "@AuditEvent.agent", "The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent.", 0, java.lang.Integer.MAX_VALUE, agent));
1913        }
1914
1915        @Override
1916        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1917          switch (_hash) {
1918          case 3648196: /*what*/  return new Property("what", "Reference(Any)", "Identifies a specific instance of the entity. The reference should be version specific. This is allowed to be a Parameters resource.", 0, 1, what);
1919          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Code representing the role the entity played in the event being audited.", 0, 1, role);
1920          case -722296940: /*securityLabel*/  return new Property("securityLabel", "CodeableConcept", "Security labels for the identified entity.", 0, java.lang.Integer.MAX_VALUE, securityLabel);
1921          case 107944136: /*query*/  return new Property("query", "base64Binary", "The query parameters for a query-type entities.", 0, 1, query);
1922          case -1335224239: /*detail*/  return new Property("detail", "", "Tagged value pairs for conveying additional information about the entity.", 0, java.lang.Integer.MAX_VALUE, detail);
1923          case 92750597: /*agent*/  return new Property("agent", "@AuditEvent.agent", "The entity is attributed to an agent to express the agent's responsibility for that entity in the activity. This is most used to indicate when persistence media (the entity) are used by an agent. For example when importing data from a device, the device would be described in an entity, and the user importing data from that media would be indicated as the entity.agent.", 0, java.lang.Integer.MAX_VALUE, agent);
1924          default: return super.getNamedProperty(_hash, _name, _checkValid);
1925          }
1926
1927        }
1928
1929      @Override
1930      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1931        switch (hash) {
1932        case 3648196: /*what*/ return this.what == null ? new Base[0] : new Base[] {this.what}; // Reference
1933        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1934        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // CodeableConcept
1935        case 107944136: /*query*/ return this.query == null ? new Base[0] : new Base[] {this.query}; // Base64BinaryType
1936        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AuditEventEntityDetailComponent
1937        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // AuditEventAgentComponent
1938        default: return super.getProperty(hash, name, checkValid);
1939        }
1940
1941      }
1942
1943      @Override
1944      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1945        switch (hash) {
1946        case 3648196: // what
1947          this.what = TypeConvertor.castToReference(value); // Reference
1948          return value;
1949        case 3506294: // role
1950          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1951          return value;
1952        case -722296940: // securityLabel
1953          this.getSecurityLabel().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1954          return value;
1955        case 107944136: // query
1956          this.query = TypeConvertor.castToBase64Binary(value); // Base64BinaryType
1957          return value;
1958        case -1335224239: // detail
1959          this.getDetail().add((AuditEventEntityDetailComponent) value); // AuditEventEntityDetailComponent
1960          return value;
1961        case 92750597: // agent
1962          this.getAgent().add((AuditEventAgentComponent) value); // AuditEventAgentComponent
1963          return value;
1964        default: return super.setProperty(hash, name, value);
1965        }
1966
1967      }
1968
1969      @Override
1970      public Base setProperty(String name, Base value) throws FHIRException {
1971        if (name.equals("what")) {
1972          this.what = TypeConvertor.castToReference(value); // Reference
1973        } else if (name.equals("role")) {
1974          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1975        } else if (name.equals("securityLabel")) {
1976          this.getSecurityLabel().add(TypeConvertor.castToCodeableConcept(value));
1977        } else if (name.equals("query")) {
1978          this.query = TypeConvertor.castToBase64Binary(value); // Base64BinaryType
1979        } else if (name.equals("detail")) {
1980          this.getDetail().add((AuditEventEntityDetailComponent) value);
1981        } else if (name.equals("agent")) {
1982          this.getAgent().add((AuditEventAgentComponent) value);
1983        } else
1984          return super.setProperty(name, value);
1985        return value;
1986      }
1987
1988      @Override
1989      public Base makeProperty(int hash, String name) throws FHIRException {
1990        switch (hash) {
1991        case 3648196:  return getWhat();
1992        case 3506294:  return getRole();
1993        case -722296940:  return addSecurityLabel(); 
1994        case 107944136:  return getQueryElement();
1995        case -1335224239:  return addDetail(); 
1996        case 92750597:  return addAgent(); 
1997        default: return super.makeProperty(hash, name);
1998        }
1999
2000      }
2001
2002      @Override
2003      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2004        switch (hash) {
2005        case 3648196: /*what*/ return new String[] {"Reference"};
2006        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2007        case -722296940: /*securityLabel*/ return new String[] {"CodeableConcept"};
2008        case 107944136: /*query*/ return new String[] {"base64Binary"};
2009        case -1335224239: /*detail*/ return new String[] {};
2010        case 92750597: /*agent*/ return new String[] {"@AuditEvent.agent"};
2011        default: return super.getTypesForProperty(hash, name);
2012        }
2013
2014      }
2015
2016      @Override
2017      public Base addChild(String name) throws FHIRException {
2018        if (name.equals("what")) {
2019          this.what = new Reference();
2020          return this.what;
2021        }
2022        else if (name.equals("role")) {
2023          this.role = new CodeableConcept();
2024          return this.role;
2025        }
2026        else if (name.equals("securityLabel")) {
2027          return addSecurityLabel();
2028        }
2029        else if (name.equals("query")) {
2030          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.entity.query");
2031        }
2032        else if (name.equals("detail")) {
2033          return addDetail();
2034        }
2035        else if (name.equals("agent")) {
2036          return addAgent();
2037        }
2038        else
2039          return super.addChild(name);
2040      }
2041
2042      public AuditEventEntityComponent copy() {
2043        AuditEventEntityComponent dst = new AuditEventEntityComponent();
2044        copyValues(dst);
2045        return dst;
2046      }
2047
2048      public void copyValues(AuditEventEntityComponent dst) {
2049        super.copyValues(dst);
2050        dst.what = what == null ? null : what.copy();
2051        dst.role = role == null ? null : role.copy();
2052        if (securityLabel != null) {
2053          dst.securityLabel = new ArrayList<CodeableConcept>();
2054          for (CodeableConcept i : securityLabel)
2055            dst.securityLabel.add(i.copy());
2056        };
2057        dst.query = query == null ? null : query.copy();
2058        if (detail != null) {
2059          dst.detail = new ArrayList<AuditEventEntityDetailComponent>();
2060          for (AuditEventEntityDetailComponent i : detail)
2061            dst.detail.add(i.copy());
2062        };
2063        if (agent != null) {
2064          dst.agent = new ArrayList<AuditEventAgentComponent>();
2065          for (AuditEventAgentComponent i : agent)
2066            dst.agent.add(i.copy());
2067        };
2068      }
2069
2070      @Override
2071      public boolean equalsDeep(Base other_) {
2072        if (!super.equalsDeep(other_))
2073          return false;
2074        if (!(other_ instanceof AuditEventEntityComponent))
2075          return false;
2076        AuditEventEntityComponent o = (AuditEventEntityComponent) other_;
2077        return compareDeep(what, o.what, true) && compareDeep(role, o.role, true) && compareDeep(securityLabel, o.securityLabel, true)
2078           && compareDeep(query, o.query, true) && compareDeep(detail, o.detail, true) && compareDeep(agent, o.agent, true)
2079          ;
2080      }
2081
2082      @Override
2083      public boolean equalsShallow(Base other_) {
2084        if (!super.equalsShallow(other_))
2085          return false;
2086        if (!(other_ instanceof AuditEventEntityComponent))
2087          return false;
2088        AuditEventEntityComponent o = (AuditEventEntityComponent) other_;
2089        return compareValues(query, o.query, true);
2090      }
2091
2092      public boolean isEmpty() {
2093        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(what, role, securityLabel
2094          , query, detail, agent);
2095      }
2096
2097  public String fhirType() {
2098    return "AuditEvent.entity";
2099
2100  }
2101
2102  }
2103
2104    @Block()
2105    public static class AuditEventEntityDetailComponent extends BackboneElement implements IBaseBackboneElement {
2106        /**
2107         * The type of extra detail provided in the value.
2108         */
2109        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
2110        @Description(shortDefinition="Name of the property", formalDefinition="The type of extra detail provided in the value." )
2111        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-type")
2112        protected CodeableConcept type;
2113
2114        /**
2115         * The  value of the extra detail.
2116         */
2117        @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Range.class, Ratio.class, TimeType.class, DateTimeType.class, Period.class, Base64BinaryType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2118        @Description(shortDefinition="Property value", formalDefinition="The  value of the extra detail." )
2119        protected DataType value;
2120
2121        private static final long serialVersionUID = -1659186716L;
2122
2123    /**
2124     * Constructor
2125     */
2126      public AuditEventEntityDetailComponent() {
2127        super();
2128      }
2129
2130    /**
2131     * Constructor
2132     */
2133      public AuditEventEntityDetailComponent(CodeableConcept type, DataType value) {
2134        super();
2135        this.setType(type);
2136        this.setValue(value);
2137      }
2138
2139        /**
2140         * @return {@link #type} (The type of extra detail provided in the value.)
2141         */
2142        public CodeableConcept getType() { 
2143          if (this.type == null)
2144            if (Configuration.errorOnAutoCreate())
2145              throw new Error("Attempt to auto-create AuditEventEntityDetailComponent.type");
2146            else if (Configuration.doAutoCreate())
2147              this.type = new CodeableConcept(); // cc
2148          return this.type;
2149        }
2150
2151        public boolean hasType() { 
2152          return this.type != null && !this.type.isEmpty();
2153        }
2154
2155        /**
2156         * @param value {@link #type} (The type of extra detail provided in the value.)
2157         */
2158        public AuditEventEntityDetailComponent setType(CodeableConcept value) { 
2159          this.type = value;
2160          return this;
2161        }
2162
2163        /**
2164         * @return {@link #value} (The  value of the extra detail.)
2165         */
2166        public DataType getValue() { 
2167          return this.value;
2168        }
2169
2170        /**
2171         * @return {@link #value} (The  value of the extra detail.)
2172         */
2173        public Quantity getValueQuantity() throws FHIRException { 
2174          if (this.value == null)
2175            this.value = new Quantity();
2176          if (!(this.value instanceof Quantity))
2177            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
2178          return (Quantity) this.value;
2179        }
2180
2181        public boolean hasValueQuantity() { 
2182          return this != null && this.value instanceof Quantity;
2183        }
2184
2185        /**
2186         * @return {@link #value} (The  value of the extra detail.)
2187         */
2188        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
2189          if (this.value == null)
2190            this.value = new CodeableConcept();
2191          if (!(this.value instanceof CodeableConcept))
2192            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
2193          return (CodeableConcept) this.value;
2194        }
2195
2196        public boolean hasValueCodeableConcept() { 
2197          return this != null && this.value instanceof CodeableConcept;
2198        }
2199
2200        /**
2201         * @return {@link #value} (The  value of the extra detail.)
2202         */
2203        public StringType getValueStringType() throws FHIRException { 
2204          if (this.value == null)
2205            this.value = new StringType();
2206          if (!(this.value instanceof StringType))
2207            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2208          return (StringType) this.value;
2209        }
2210
2211        public boolean hasValueStringType() { 
2212          return this != null && this.value instanceof StringType;
2213        }
2214
2215        /**
2216         * @return {@link #value} (The  value of the extra detail.)
2217         */
2218        public BooleanType getValueBooleanType() throws FHIRException { 
2219          if (this.value == null)
2220            this.value = new BooleanType();
2221          if (!(this.value instanceof BooleanType))
2222            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2223          return (BooleanType) this.value;
2224        }
2225
2226        public boolean hasValueBooleanType() { 
2227          return this != null && this.value instanceof BooleanType;
2228        }
2229
2230        /**
2231         * @return {@link #value} (The  value of the extra detail.)
2232         */
2233        public IntegerType getValueIntegerType() throws FHIRException { 
2234          if (this.value == null)
2235            this.value = new IntegerType();
2236          if (!(this.value instanceof IntegerType))
2237            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2238          return (IntegerType) this.value;
2239        }
2240
2241        public boolean hasValueIntegerType() { 
2242          return this != null && this.value instanceof IntegerType;
2243        }
2244
2245        /**
2246         * @return {@link #value} (The  value of the extra detail.)
2247         */
2248        public Range getValueRange() throws FHIRException { 
2249          if (this.value == null)
2250            this.value = new Range();
2251          if (!(this.value instanceof Range))
2252            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
2253          return (Range) this.value;
2254        }
2255
2256        public boolean hasValueRange() { 
2257          return this != null && this.value instanceof Range;
2258        }
2259
2260        /**
2261         * @return {@link #value} (The  value of the extra detail.)
2262         */
2263        public Ratio getValueRatio() throws FHIRException { 
2264          if (this.value == null)
2265            this.value = new Ratio();
2266          if (!(this.value instanceof Ratio))
2267            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
2268          return (Ratio) this.value;
2269        }
2270
2271        public boolean hasValueRatio() { 
2272          return this != null && this.value instanceof Ratio;
2273        }
2274
2275        /**
2276         * @return {@link #value} (The  value of the extra detail.)
2277         */
2278        public TimeType getValueTimeType() throws FHIRException { 
2279          if (this.value == null)
2280            this.value = new TimeType();
2281          if (!(this.value instanceof TimeType))
2282            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2283          return (TimeType) this.value;
2284        }
2285
2286        public boolean hasValueTimeType() { 
2287          return this != null && this.value instanceof TimeType;
2288        }
2289
2290        /**
2291         * @return {@link #value} (The  value of the extra detail.)
2292         */
2293        public DateTimeType getValueDateTimeType() throws FHIRException { 
2294          if (this.value == null)
2295            this.value = new DateTimeType();
2296          if (!(this.value instanceof DateTimeType))
2297            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2298          return (DateTimeType) this.value;
2299        }
2300
2301        public boolean hasValueDateTimeType() { 
2302          return this != null && this.value instanceof DateTimeType;
2303        }
2304
2305        /**
2306         * @return {@link #value} (The  value of the extra detail.)
2307         */
2308        public Period getValuePeriod() throws FHIRException { 
2309          if (this.value == null)
2310            this.value = new Period();
2311          if (!(this.value instanceof Period))
2312            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
2313          return (Period) this.value;
2314        }
2315
2316        public boolean hasValuePeriod() { 
2317          return this != null && this.value instanceof Period;
2318        }
2319
2320        /**
2321         * @return {@link #value} (The  value of the extra detail.)
2322         */
2323        public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
2324          if (this.value == null)
2325            this.value = new Base64BinaryType();
2326          if (!(this.value instanceof Base64BinaryType))
2327            throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
2328          return (Base64BinaryType) this.value;
2329        }
2330
2331        public boolean hasValueBase64BinaryType() { 
2332          return this != null && this.value instanceof Base64BinaryType;
2333        }
2334
2335        public boolean hasValue() { 
2336          return this.value != null && !this.value.isEmpty();
2337        }
2338
2339        /**
2340         * @param value {@link #value} (The  value of the extra detail.)
2341         */
2342        public AuditEventEntityDetailComponent setValue(DataType value) { 
2343          if (value != null && !(value instanceof Quantity || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Range || value instanceof Ratio || value instanceof TimeType || value instanceof DateTimeType || value instanceof Period || value instanceof Base64BinaryType))
2344            throw new FHIRException("Not the right type for AuditEvent.entity.detail.value[x]: "+value.fhirType());
2345          this.value = value;
2346          return this;
2347        }
2348
2349        protected void listChildren(List<Property> children) {
2350          super.listChildren(children);
2351          children.add(new Property("type", "CodeableConcept", "The type of extra detail provided in the value.", 0, 1, type));
2352          children.add(new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Ratio|time|dateTime|Period|base64Binary", "The  value of the extra detail.", 0, 1, value));
2353        }
2354
2355        @Override
2356        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2357          switch (_hash) {
2358          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of extra detail provided in the value.", 0, 1, type);
2359          case -1410166417: /*value[x]*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Ratio|time|dateTime|Period|base64Binary", "The  value of the extra detail.", 0, 1, value);
2360          case 111972721: /*value*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Ratio|time|dateTime|Period|base64Binary", "The  value of the extra detail.", 0, 1, value);
2361          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "The  value of the extra detail.", 0, 1, value);
2362          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "The  value of the extra detail.", 0, 1, value);
2363          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "The  value of the extra detail.", 0, 1, value);
2364          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "The  value of the extra detail.", 0, 1, value);
2365          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "The  value of the extra detail.", 0, 1, value);
2366          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "The  value of the extra detail.", 0, 1, value);
2367          case 2030767386: /*valueRatio*/  return new Property("value[x]", "Ratio", "The  value of the extra detail.", 0, 1, value);
2368          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "The  value of the extra detail.", 0, 1, value);
2369          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The  value of the extra detail.", 0, 1, value);
2370          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "The  value of the extra detail.", 0, 1, value);
2371          case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "base64Binary", "The  value of the extra detail.", 0, 1, value);
2372          default: return super.getNamedProperty(_hash, _name, _checkValid);
2373          }
2374
2375        }
2376
2377      @Override
2378      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2379        switch (hash) {
2380        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2381        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
2382        default: return super.getProperty(hash, name, checkValid);
2383        }
2384
2385      }
2386
2387      @Override
2388      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2389        switch (hash) {
2390        case 3575610: // type
2391          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2392          return value;
2393        case 111972721: // value
2394          this.value = TypeConvertor.castToType(value); // DataType
2395          return value;
2396        default: return super.setProperty(hash, name, value);
2397        }
2398
2399      }
2400
2401      @Override
2402      public Base setProperty(String name, Base value) throws FHIRException {
2403        if (name.equals("type")) {
2404          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2405        } else if (name.equals("value[x]")) {
2406          this.value = TypeConvertor.castToType(value); // DataType
2407        } else
2408          return super.setProperty(name, value);
2409        return value;
2410      }
2411
2412      @Override
2413      public Base makeProperty(int hash, String name) throws FHIRException {
2414        switch (hash) {
2415        case 3575610:  return getType();
2416        case -1410166417:  return getValue();
2417        case 111972721:  return getValue();
2418        default: return super.makeProperty(hash, name);
2419        }
2420
2421      }
2422
2423      @Override
2424      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2425        switch (hash) {
2426        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2427        case 111972721: /*value*/ return new String[] {"Quantity", "CodeableConcept", "string", "boolean", "integer", "Range", "Ratio", "time", "dateTime", "Period", "base64Binary"};
2428        default: return super.getTypesForProperty(hash, name);
2429        }
2430
2431      }
2432
2433      @Override
2434      public Base addChild(String name) throws FHIRException {
2435        if (name.equals("type")) {
2436          this.type = new CodeableConcept();
2437          return this.type;
2438        }
2439        else if (name.equals("valueQuantity")) {
2440          this.value = new Quantity();
2441          return this.value;
2442        }
2443        else if (name.equals("valueCodeableConcept")) {
2444          this.value = new CodeableConcept();
2445          return this.value;
2446        }
2447        else if (name.equals("valueString")) {
2448          this.value = new StringType();
2449          return this.value;
2450        }
2451        else if (name.equals("valueBoolean")) {
2452          this.value = new BooleanType();
2453          return this.value;
2454        }
2455        else if (name.equals("valueInteger")) {
2456          this.value = new IntegerType();
2457          return this.value;
2458        }
2459        else if (name.equals("valueRange")) {
2460          this.value = new Range();
2461          return this.value;
2462        }
2463        else if (name.equals("valueRatio")) {
2464          this.value = new Ratio();
2465          return this.value;
2466        }
2467        else if (name.equals("valueTime")) {
2468          this.value = new TimeType();
2469          return this.value;
2470        }
2471        else if (name.equals("valueDateTime")) {
2472          this.value = new DateTimeType();
2473          return this.value;
2474        }
2475        else if (name.equals("valuePeriod")) {
2476          this.value = new Period();
2477          return this.value;
2478        }
2479        else if (name.equals("valueBase64Binary")) {
2480          this.value = new Base64BinaryType();
2481          return this.value;
2482        }
2483        else
2484          return super.addChild(name);
2485      }
2486
2487      public AuditEventEntityDetailComponent copy() {
2488        AuditEventEntityDetailComponent dst = new AuditEventEntityDetailComponent();
2489        copyValues(dst);
2490        return dst;
2491      }
2492
2493      public void copyValues(AuditEventEntityDetailComponent dst) {
2494        super.copyValues(dst);
2495        dst.type = type == null ? null : type.copy();
2496        dst.value = value == null ? null : value.copy();
2497      }
2498
2499      @Override
2500      public boolean equalsDeep(Base other_) {
2501        if (!super.equalsDeep(other_))
2502          return false;
2503        if (!(other_ instanceof AuditEventEntityDetailComponent))
2504          return false;
2505        AuditEventEntityDetailComponent o = (AuditEventEntityDetailComponent) other_;
2506        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
2507      }
2508
2509      @Override
2510      public boolean equalsShallow(Base other_) {
2511        if (!super.equalsShallow(other_))
2512          return false;
2513        if (!(other_ instanceof AuditEventEntityDetailComponent))
2514          return false;
2515        AuditEventEntityDetailComponent o = (AuditEventEntityDetailComponent) other_;
2516        return true;
2517      }
2518
2519      public boolean isEmpty() {
2520        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
2521      }
2522
2523  public String fhirType() {
2524    return "AuditEvent.entity.detail";
2525
2526  }
2527
2528  }
2529
2530    /**
2531     * Classification of the type of event.
2532     */
2533    @Child(name = "category", type = {CodeableConcept.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2534    @Description(shortDefinition="Type/identifier of event", formalDefinition="Classification of the type of event." )
2535    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-type")
2536    protected List<CodeableConcept> category;
2537
2538    /**
2539     * Describes what happened. The most specific code for the event.
2540     */
2541    @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
2542    @Description(shortDefinition="Specific type of event", formalDefinition="Describes what happened. The most specific code for the event." )
2543    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-sub-type")
2544    protected CodeableConcept code;
2545
2546    /**
2547     * Indicator for type of action performed during the event that generated the audit.
2548     */
2549    @Child(name = "action", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2550    @Description(shortDefinition="Type of action performed during the event", formalDefinition="Indicator for type of action performed during the event that generated the audit." )
2551    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-action")
2552    protected Enumeration<AuditEventAction> action;
2553
2554    /**
2555     * Indicates and enables segmentation of various severity including debugging from critical.
2556     */
2557    @Child(name = "severity", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2558    @Description(shortDefinition="emergency | alert | critical | error | warning | notice | informational | debug", formalDefinition="Indicates and enables segmentation of various severity including debugging from critical." )
2559    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-severity")
2560    protected Enumeration<AuditEventSeverity> severity;
2561
2562    /**
2563     * The time or period during which the activity occurred.
2564     */
2565    @Child(name = "occurred", type = {Period.class, DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2566    @Description(shortDefinition="When the activity occurred", formalDefinition="The time or period during which the activity occurred." )
2567    protected DataType occurred;
2568
2569    /**
2570     * The time when the event was recorded.
2571     */
2572    @Child(name = "recorded", type = {InstantType.class}, order=5, min=1, max=1, modifier=false, summary=true)
2573    @Description(shortDefinition="Time when the event was recorded", formalDefinition="The time when the event was recorded." )
2574    protected InstantType recorded;
2575
2576    /**
2577     * Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.
2578     */
2579    @Child(name = "outcome", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
2580    @Description(shortDefinition="Whether the event succeeded or failed", formalDefinition="Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text." )
2581    protected AuditEventOutcomeComponent outcome;
2582
2583    /**
2584     * The authorization (e.g., PurposeOfUse) that was used during the event being recorded.
2585     */
2586    @Child(name = "authorization", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2587    @Description(shortDefinition="Authorization related to the event", formalDefinition="The authorization (e.g., PurposeOfUse) that was used during the event being recorded." )
2588    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
2589    protected List<CodeableConcept> authorization;
2590
2591    /**
2592     * Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.
2593     */
2594    @Child(name = "basedOn", type = {CarePlan.class, DeviceRequest.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class, ServiceRequest.class, Task.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2595    @Description(shortDefinition="Workflow authorization within which this event occurred", formalDefinition="Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon." )
2596    protected List<Reference> basedOn;
2597
2598    /**
2599     * The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.
2600     */
2601    @Child(name = "patient", type = {Patient.class}, order=9, min=0, max=1, modifier=false, summary=false)
2602    @Description(shortDefinition="The patient is the subject of the data used/created/updated/deleted during the activity", formalDefinition="The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity." )
2603    protected Reference patient;
2604
2605    /**
2606     * This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).
2607     */
2608    @Child(name = "encounter", type = {Encounter.class}, order=10, min=0, max=1, modifier=false, summary=false)
2609    @Description(shortDefinition="Encounter within which this event occurred or which the event is tightly associated", formalDefinition="This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests)." )
2610    protected Reference encounter;
2611
2612    /**
2613     * An actor taking an active role in the event or activity that is logged.
2614     */
2615    @Child(name = "agent", type = {}, order=11, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2616    @Description(shortDefinition="Actor involved in the event", formalDefinition="An actor taking an active role in the event or activity that is logged." )
2617    protected List<AuditEventAgentComponent> agent;
2618
2619    /**
2620     * The actor that is reporting the event.
2621     */
2622    @Child(name = "source", type = {}, order=12, min=1, max=1, modifier=false, summary=true)
2623    @Description(shortDefinition="Audit Event Reporter", formalDefinition="The actor that is reporting the event." )
2624    protected AuditEventSourceComponent source;
2625
2626    /**
2627     * Specific instances of data or objects that have been accessed.
2628     */
2629    @Child(name = "entity", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2630    @Description(shortDefinition="Data or objects used", formalDefinition="Specific instances of data or objects that have been accessed." )
2631    protected List<AuditEventEntityComponent> entity;
2632
2633    private static final long serialVersionUID = -1335832480L;
2634
2635  /**
2636   * Constructor
2637   */
2638    public AuditEvent() {
2639      super();
2640    }
2641
2642  /**
2643   * Constructor
2644   */
2645    public AuditEvent(CodeableConcept code, Date recorded, AuditEventAgentComponent agent, AuditEventSourceComponent source) {
2646      super();
2647      this.setCode(code);
2648      this.setRecorded(recorded);
2649      this.addAgent(agent);
2650      this.setSource(source);
2651    }
2652
2653    /**
2654     * @return {@link #category} (Classification of the type of event.)
2655     */
2656    public List<CodeableConcept> getCategory() { 
2657      if (this.category == null)
2658        this.category = new ArrayList<CodeableConcept>();
2659      return this.category;
2660    }
2661
2662    /**
2663     * @return Returns a reference to <code>this</code> for easy method chaining
2664     */
2665    public AuditEvent setCategory(List<CodeableConcept> theCategory) { 
2666      this.category = theCategory;
2667      return this;
2668    }
2669
2670    public boolean hasCategory() { 
2671      if (this.category == null)
2672        return false;
2673      for (CodeableConcept item : this.category)
2674        if (!item.isEmpty())
2675          return true;
2676      return false;
2677    }
2678
2679    public CodeableConcept addCategory() { //3
2680      CodeableConcept t = new CodeableConcept();
2681      if (this.category == null)
2682        this.category = new ArrayList<CodeableConcept>();
2683      this.category.add(t);
2684      return t;
2685    }
2686
2687    public AuditEvent addCategory(CodeableConcept t) { //3
2688      if (t == null)
2689        return this;
2690      if (this.category == null)
2691        this.category = new ArrayList<CodeableConcept>();
2692      this.category.add(t);
2693      return this;
2694    }
2695
2696    /**
2697     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2698     */
2699    public CodeableConcept getCategoryFirstRep() { 
2700      if (getCategory().isEmpty()) {
2701        addCategory();
2702      }
2703      return getCategory().get(0);
2704    }
2705
2706    /**
2707     * @return {@link #code} (Describes what happened. The most specific code for the event.)
2708     */
2709    public CodeableConcept getCode() { 
2710      if (this.code == null)
2711        if (Configuration.errorOnAutoCreate())
2712          throw new Error("Attempt to auto-create AuditEvent.code");
2713        else if (Configuration.doAutoCreate())
2714          this.code = new CodeableConcept(); // cc
2715      return this.code;
2716    }
2717
2718    public boolean hasCode() { 
2719      return this.code != null && !this.code.isEmpty();
2720    }
2721
2722    /**
2723     * @param value {@link #code} (Describes what happened. The most specific code for the event.)
2724     */
2725    public AuditEvent setCode(CodeableConcept value) { 
2726      this.code = value;
2727      return this;
2728    }
2729
2730    /**
2731     * @return {@link #action} (Indicator for type of action performed during the event that generated the audit.). This is the underlying object with id, value and extensions. The accessor "getAction" gives direct access to the value
2732     */
2733    public Enumeration<AuditEventAction> getActionElement() { 
2734      if (this.action == null)
2735        if (Configuration.errorOnAutoCreate())
2736          throw new Error("Attempt to auto-create AuditEvent.action");
2737        else if (Configuration.doAutoCreate())
2738          this.action = new Enumeration<AuditEventAction>(new AuditEventActionEnumFactory()); // bb
2739      return this.action;
2740    }
2741
2742    public boolean hasActionElement() { 
2743      return this.action != null && !this.action.isEmpty();
2744    }
2745
2746    public boolean hasAction() { 
2747      return this.action != null && !this.action.isEmpty();
2748    }
2749
2750    /**
2751     * @param value {@link #action} (Indicator for type of action performed during the event that generated the audit.). This is the underlying object with id, value and extensions. The accessor "getAction" gives direct access to the value
2752     */
2753    public AuditEvent setActionElement(Enumeration<AuditEventAction> value) { 
2754      this.action = value;
2755      return this;
2756    }
2757
2758    /**
2759     * @return Indicator for type of action performed during the event that generated the audit.
2760     */
2761    public AuditEventAction getAction() { 
2762      return this.action == null ? null : this.action.getValue();
2763    }
2764
2765    /**
2766     * @param value Indicator for type of action performed during the event that generated the audit.
2767     */
2768    public AuditEvent setAction(AuditEventAction value) { 
2769      if (value == null)
2770        this.action = null;
2771      else {
2772        if (this.action == null)
2773          this.action = new Enumeration<AuditEventAction>(new AuditEventActionEnumFactory());
2774        this.action.setValue(value);
2775      }
2776      return this;
2777    }
2778
2779    /**
2780     * @return {@link #severity} (Indicates and enables segmentation of various severity including debugging from critical.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
2781     */
2782    public Enumeration<AuditEventSeverity> getSeverityElement() { 
2783      if (this.severity == null)
2784        if (Configuration.errorOnAutoCreate())
2785          throw new Error("Attempt to auto-create AuditEvent.severity");
2786        else if (Configuration.doAutoCreate())
2787          this.severity = new Enumeration<AuditEventSeverity>(new AuditEventSeverityEnumFactory()); // bb
2788      return this.severity;
2789    }
2790
2791    public boolean hasSeverityElement() { 
2792      return this.severity != null && !this.severity.isEmpty();
2793    }
2794
2795    public boolean hasSeverity() { 
2796      return this.severity != null && !this.severity.isEmpty();
2797    }
2798
2799    /**
2800     * @param value {@link #severity} (Indicates and enables segmentation of various severity including debugging from critical.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
2801     */
2802    public AuditEvent setSeverityElement(Enumeration<AuditEventSeverity> value) { 
2803      this.severity = value;
2804      return this;
2805    }
2806
2807    /**
2808     * @return Indicates and enables segmentation of various severity including debugging from critical.
2809     */
2810    public AuditEventSeverity getSeverity() { 
2811      return this.severity == null ? null : this.severity.getValue();
2812    }
2813
2814    /**
2815     * @param value Indicates and enables segmentation of various severity including debugging from critical.
2816     */
2817    public AuditEvent setSeverity(AuditEventSeverity value) { 
2818      if (value == null)
2819        this.severity = null;
2820      else {
2821        if (this.severity == null)
2822          this.severity = new Enumeration<AuditEventSeverity>(new AuditEventSeverityEnumFactory());
2823        this.severity.setValue(value);
2824      }
2825      return this;
2826    }
2827
2828    /**
2829     * @return {@link #occurred} (The time or period during which the activity occurred.)
2830     */
2831    public DataType getOccurred() { 
2832      return this.occurred;
2833    }
2834
2835    /**
2836     * @return {@link #occurred} (The time or period during which the activity occurred.)
2837     */
2838    public Period getOccurredPeriod() throws FHIRException { 
2839      if (this.occurred == null)
2840        this.occurred = new Period();
2841      if (!(this.occurred instanceof Period))
2842        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurred.getClass().getName()+" was encountered");
2843      return (Period) this.occurred;
2844    }
2845
2846    public boolean hasOccurredPeriod() { 
2847      return this != null && this.occurred instanceof Period;
2848    }
2849
2850    /**
2851     * @return {@link #occurred} (The time or period during which the activity occurred.)
2852     */
2853    public DateTimeType getOccurredDateTimeType() throws FHIRException { 
2854      if (this.occurred == null)
2855        this.occurred = new DateTimeType();
2856      if (!(this.occurred instanceof DateTimeType))
2857        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurred.getClass().getName()+" was encountered");
2858      return (DateTimeType) this.occurred;
2859    }
2860
2861    public boolean hasOccurredDateTimeType() { 
2862      return this != null && this.occurred instanceof DateTimeType;
2863    }
2864
2865    public boolean hasOccurred() { 
2866      return this.occurred != null && !this.occurred.isEmpty();
2867    }
2868
2869    /**
2870     * @param value {@link #occurred} (The time or period during which the activity occurred.)
2871     */
2872    public AuditEvent setOccurred(DataType value) { 
2873      if (value != null && !(value instanceof Period || value instanceof DateTimeType))
2874        throw new FHIRException("Not the right type for AuditEvent.occurred[x]: "+value.fhirType());
2875      this.occurred = value;
2876      return this;
2877    }
2878
2879    /**
2880     * @return {@link #recorded} (The time when the event was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
2881     */
2882    public InstantType getRecordedElement() { 
2883      if (this.recorded == null)
2884        if (Configuration.errorOnAutoCreate())
2885          throw new Error("Attempt to auto-create AuditEvent.recorded");
2886        else if (Configuration.doAutoCreate())
2887          this.recorded = new InstantType(); // bb
2888      return this.recorded;
2889    }
2890
2891    public boolean hasRecordedElement() { 
2892      return this.recorded != null && !this.recorded.isEmpty();
2893    }
2894
2895    public boolean hasRecorded() { 
2896      return this.recorded != null && !this.recorded.isEmpty();
2897    }
2898
2899    /**
2900     * @param value {@link #recorded} (The time when the event was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
2901     */
2902    public AuditEvent setRecordedElement(InstantType value) { 
2903      this.recorded = value;
2904      return this;
2905    }
2906
2907    /**
2908     * @return The time when the event was recorded.
2909     */
2910    public Date getRecorded() { 
2911      return this.recorded == null ? null : this.recorded.getValue();
2912    }
2913
2914    /**
2915     * @param value The time when the event was recorded.
2916     */
2917    public AuditEvent setRecorded(Date value) { 
2918        if (this.recorded == null)
2919          this.recorded = new InstantType();
2920        this.recorded.setValue(value);
2921      return this;
2922    }
2923
2924    /**
2925     * @return {@link #outcome} (Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.)
2926     */
2927    public AuditEventOutcomeComponent getOutcome() { 
2928      if (this.outcome == null)
2929        if (Configuration.errorOnAutoCreate())
2930          throw new Error("Attempt to auto-create AuditEvent.outcome");
2931        else if (Configuration.doAutoCreate())
2932          this.outcome = new AuditEventOutcomeComponent(); // cc
2933      return this.outcome;
2934    }
2935
2936    public boolean hasOutcome() { 
2937      return this.outcome != null && !this.outcome.isEmpty();
2938    }
2939
2940    /**
2941     * @param value {@link #outcome} (Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.)
2942     */
2943    public AuditEvent setOutcome(AuditEventOutcomeComponent value) { 
2944      this.outcome = value;
2945      return this;
2946    }
2947
2948    /**
2949     * @return {@link #authorization} (The authorization (e.g., PurposeOfUse) that was used during the event being recorded.)
2950     */
2951    public List<CodeableConcept> getAuthorization() { 
2952      if (this.authorization == null)
2953        this.authorization = new ArrayList<CodeableConcept>();
2954      return this.authorization;
2955    }
2956
2957    /**
2958     * @return Returns a reference to <code>this</code> for easy method chaining
2959     */
2960    public AuditEvent setAuthorization(List<CodeableConcept> theAuthorization) { 
2961      this.authorization = theAuthorization;
2962      return this;
2963    }
2964
2965    public boolean hasAuthorization() { 
2966      if (this.authorization == null)
2967        return false;
2968      for (CodeableConcept item : this.authorization)
2969        if (!item.isEmpty())
2970          return true;
2971      return false;
2972    }
2973
2974    public CodeableConcept addAuthorization() { //3
2975      CodeableConcept t = new CodeableConcept();
2976      if (this.authorization == null)
2977        this.authorization = new ArrayList<CodeableConcept>();
2978      this.authorization.add(t);
2979      return t;
2980    }
2981
2982    public AuditEvent addAuthorization(CodeableConcept t) { //3
2983      if (t == null)
2984        return this;
2985      if (this.authorization == null)
2986        this.authorization = new ArrayList<CodeableConcept>();
2987      this.authorization.add(t);
2988      return this;
2989    }
2990
2991    /**
2992     * @return The first repetition of repeating field {@link #authorization}, creating it if it does not already exist {3}
2993     */
2994    public CodeableConcept getAuthorizationFirstRep() { 
2995      if (getAuthorization().isEmpty()) {
2996        addAuthorization();
2997      }
2998      return getAuthorization().get(0);
2999    }
3000
3001    /**
3002     * @return {@link #basedOn} (Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.)
3003     */
3004    public List<Reference> getBasedOn() { 
3005      if (this.basedOn == null)
3006        this.basedOn = new ArrayList<Reference>();
3007      return this.basedOn;
3008    }
3009
3010    /**
3011     * @return Returns a reference to <code>this</code> for easy method chaining
3012     */
3013    public AuditEvent setBasedOn(List<Reference> theBasedOn) { 
3014      this.basedOn = theBasedOn;
3015      return this;
3016    }
3017
3018    public boolean hasBasedOn() { 
3019      if (this.basedOn == null)
3020        return false;
3021      for (Reference item : this.basedOn)
3022        if (!item.isEmpty())
3023          return true;
3024      return false;
3025    }
3026
3027    public Reference addBasedOn() { //3
3028      Reference t = new Reference();
3029      if (this.basedOn == null)
3030        this.basedOn = new ArrayList<Reference>();
3031      this.basedOn.add(t);
3032      return t;
3033    }
3034
3035    public AuditEvent addBasedOn(Reference t) { //3
3036      if (t == null)
3037        return this;
3038      if (this.basedOn == null)
3039        this.basedOn = new ArrayList<Reference>();
3040      this.basedOn.add(t);
3041      return this;
3042    }
3043
3044    /**
3045     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
3046     */
3047    public Reference getBasedOnFirstRep() { 
3048      if (getBasedOn().isEmpty()) {
3049        addBasedOn();
3050      }
3051      return getBasedOn().get(0);
3052    }
3053
3054    /**
3055     * @return {@link #patient} (The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.)
3056     */
3057    public Reference getPatient() { 
3058      if (this.patient == null)
3059        if (Configuration.errorOnAutoCreate())
3060          throw new Error("Attempt to auto-create AuditEvent.patient");
3061        else if (Configuration.doAutoCreate())
3062          this.patient = new Reference(); // cc
3063      return this.patient;
3064    }
3065
3066    public boolean hasPatient() { 
3067      return this.patient != null && !this.patient.isEmpty();
3068    }
3069
3070    /**
3071     * @param value {@link #patient} (The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.)
3072     */
3073    public AuditEvent setPatient(Reference value) { 
3074      this.patient = value;
3075      return this;
3076    }
3077
3078    /**
3079     * @return {@link #encounter} (This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).)
3080     */
3081    public Reference getEncounter() { 
3082      if (this.encounter == null)
3083        if (Configuration.errorOnAutoCreate())
3084          throw new Error("Attempt to auto-create AuditEvent.encounter");
3085        else if (Configuration.doAutoCreate())
3086          this.encounter = new Reference(); // cc
3087      return this.encounter;
3088    }
3089
3090    public boolean hasEncounter() { 
3091      return this.encounter != null && !this.encounter.isEmpty();
3092    }
3093
3094    /**
3095     * @param value {@link #encounter} (This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).)
3096     */
3097    public AuditEvent setEncounter(Reference value) { 
3098      this.encounter = value;
3099      return this;
3100    }
3101
3102    /**
3103     * @return {@link #agent} (An actor taking an active role in the event or activity that is logged.)
3104     */
3105    public List<AuditEventAgentComponent> getAgent() { 
3106      if (this.agent == null)
3107        this.agent = new ArrayList<AuditEventAgentComponent>();
3108      return this.agent;
3109    }
3110
3111    /**
3112     * @return Returns a reference to <code>this</code> for easy method chaining
3113     */
3114    public AuditEvent setAgent(List<AuditEventAgentComponent> theAgent) { 
3115      this.agent = theAgent;
3116      return this;
3117    }
3118
3119    public boolean hasAgent() { 
3120      if (this.agent == null)
3121        return false;
3122      for (AuditEventAgentComponent item : this.agent)
3123        if (!item.isEmpty())
3124          return true;
3125      return false;
3126    }
3127
3128    public AuditEventAgentComponent addAgent() { //3
3129      AuditEventAgentComponent t = new AuditEventAgentComponent();
3130      if (this.agent == null)
3131        this.agent = new ArrayList<AuditEventAgentComponent>();
3132      this.agent.add(t);
3133      return t;
3134    }
3135
3136    public AuditEvent addAgent(AuditEventAgentComponent t) { //3
3137      if (t == null)
3138        return this;
3139      if (this.agent == null)
3140        this.agent = new ArrayList<AuditEventAgentComponent>();
3141      this.agent.add(t);
3142      return this;
3143    }
3144
3145    /**
3146     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
3147     */
3148    public AuditEventAgentComponent getAgentFirstRep() { 
3149      if (getAgent().isEmpty()) {
3150        addAgent();
3151      }
3152      return getAgent().get(0);
3153    }
3154
3155    /**
3156     * @return {@link #source} (The actor that is reporting the event.)
3157     */
3158    public AuditEventSourceComponent getSource() { 
3159      if (this.source == null)
3160        if (Configuration.errorOnAutoCreate())
3161          throw new Error("Attempt to auto-create AuditEvent.source");
3162        else if (Configuration.doAutoCreate())
3163          this.source = new AuditEventSourceComponent(); // cc
3164      return this.source;
3165    }
3166
3167    public boolean hasSource() { 
3168      return this.source != null && !this.source.isEmpty();
3169    }
3170
3171    /**
3172     * @param value {@link #source} (The actor that is reporting the event.)
3173     */
3174    public AuditEvent setSource(AuditEventSourceComponent value) { 
3175      this.source = value;
3176      return this;
3177    }
3178
3179    /**
3180     * @return {@link #entity} (Specific instances of data or objects that have been accessed.)
3181     */
3182    public List<AuditEventEntityComponent> getEntity() { 
3183      if (this.entity == null)
3184        this.entity = new ArrayList<AuditEventEntityComponent>();
3185      return this.entity;
3186    }
3187
3188    /**
3189     * @return Returns a reference to <code>this</code> for easy method chaining
3190     */
3191    public AuditEvent setEntity(List<AuditEventEntityComponent> theEntity) { 
3192      this.entity = theEntity;
3193      return this;
3194    }
3195
3196    public boolean hasEntity() { 
3197      if (this.entity == null)
3198        return false;
3199      for (AuditEventEntityComponent item : this.entity)
3200        if (!item.isEmpty())
3201          return true;
3202      return false;
3203    }
3204
3205    public AuditEventEntityComponent addEntity() { //3
3206      AuditEventEntityComponent t = new AuditEventEntityComponent();
3207      if (this.entity == null)
3208        this.entity = new ArrayList<AuditEventEntityComponent>();
3209      this.entity.add(t);
3210      return t;
3211    }
3212
3213    public AuditEvent addEntity(AuditEventEntityComponent t) { //3
3214      if (t == null)
3215        return this;
3216      if (this.entity == null)
3217        this.entity = new ArrayList<AuditEventEntityComponent>();
3218      this.entity.add(t);
3219      return this;
3220    }
3221
3222    /**
3223     * @return The first repetition of repeating field {@link #entity}, creating it if it does not already exist {3}
3224     */
3225    public AuditEventEntityComponent getEntityFirstRep() { 
3226      if (getEntity().isEmpty()) {
3227        addEntity();
3228      }
3229      return getEntity().get(0);
3230    }
3231
3232      protected void listChildren(List<Property> children) {
3233        super.listChildren(children);
3234        children.add(new Property("category", "CodeableConcept", "Classification of the type of event.", 0, java.lang.Integer.MAX_VALUE, category));
3235        children.add(new Property("code", "CodeableConcept", "Describes what happened. The most specific code for the event.", 0, 1, code));
3236        children.add(new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, 1, action));
3237        children.add(new Property("severity", "code", "Indicates and enables segmentation of various severity including debugging from critical.", 0, 1, severity));
3238        children.add(new Property("occurred[x]", "Period|dateTime", "The time or period during which the activity occurred.", 0, 1, occurred));
3239        children.add(new Property("recorded", "instant", "The time when the event was recorded.", 0, 1, recorded));
3240        children.add(new Property("outcome", "", "Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.", 0, 1, outcome));
3241        children.add(new Property("authorization", "CodeableConcept", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization));
3242        children.add(new Property("basedOn", "Reference(CarePlan|DeviceRequest|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest|Task)", "Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.", 0, java.lang.Integer.MAX_VALUE, basedOn));
3243        children.add(new Property("patient", "Reference(Patient)", "The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.", 0, 1, patient));
3244        children.add(new Property("encounter", "Reference(Encounter)", "This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).", 0, 1, encounter));
3245        children.add(new Property("agent", "", "An actor taking an active role in the event or activity that is logged.", 0, java.lang.Integer.MAX_VALUE, agent));
3246        children.add(new Property("source", "", "The actor that is reporting the event.", 0, 1, source));
3247        children.add(new Property("entity", "", "Specific instances of data or objects that have been accessed.", 0, java.lang.Integer.MAX_VALUE, entity));
3248      }
3249
3250      @Override
3251      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3252        switch (_hash) {
3253        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Classification of the type of event.", 0, java.lang.Integer.MAX_VALUE, category);
3254        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Describes what happened. The most specific code for the event.", 0, 1, code);
3255        case -1422950858: /*action*/  return new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, 1, action);
3256        case 1478300413: /*severity*/  return new Property("severity", "code", "Indicates and enables segmentation of various severity including debugging from critical.", 0, 1, severity);
3257        case 784181563: /*occurred[x]*/  return new Property("occurred[x]", "Period|dateTime", "The time or period during which the activity occurred.", 0, 1, occurred);
3258        case 792816933: /*occurred*/  return new Property("occurred[x]", "Period|dateTime", "The time or period during which the activity occurred.", 0, 1, occurred);
3259        case 894082886: /*occurredPeriod*/  return new Property("occurred[x]", "Period", "The time or period during which the activity occurred.", 0, 1, occurred);
3260        case 1579027424: /*occurredDateTime*/  return new Property("occurred[x]", "dateTime", "The time or period during which the activity occurred.", 0, 1, occurred);
3261        case -799233872: /*recorded*/  return new Property("recorded", "instant", "The time when the event was recorded.", 0, 1, recorded);
3262        case -1106507950: /*outcome*/  return new Property("outcome", "", "Indicates whether the event succeeded or failed. A free text descripiton can be given in outcome.text.", 0, 1, outcome);
3263        case -1385570183: /*authorization*/  return new Property("authorization", "CodeableConcept", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization);
3264        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|DeviceRequest|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest|Task)", "Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.", 0, java.lang.Integer.MAX_VALUE, basedOn);
3265        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.", 0, 1, patient);
3266        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).", 0, 1, encounter);
3267        case 92750597: /*agent*/  return new Property("agent", "", "An actor taking an active role in the event or activity that is logged.", 0, java.lang.Integer.MAX_VALUE, agent);
3268        case -896505829: /*source*/  return new Property("source", "", "The actor that is reporting the event.", 0, 1, source);
3269        case -1298275357: /*entity*/  return new Property("entity", "", "Specific instances of data or objects that have been accessed.", 0, java.lang.Integer.MAX_VALUE, entity);
3270        default: return super.getNamedProperty(_hash, _name, _checkValid);
3271        }
3272
3273      }
3274
3275      @Override
3276      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3277        switch (hash) {
3278        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3279        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3280        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // Enumeration<AuditEventAction>
3281        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<AuditEventSeverity>
3282        case 792816933: /*occurred*/ return this.occurred == null ? new Base[0] : new Base[] {this.occurred}; // DataType
3283        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // InstantType
3284        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // AuditEventOutcomeComponent
3285        case -1385570183: /*authorization*/ return this.authorization == null ? new Base[0] : this.authorization.toArray(new Base[this.authorization.size()]); // CodeableConcept
3286        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
3287        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3288        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3289        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // AuditEventAgentComponent
3290        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // AuditEventSourceComponent
3291        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : this.entity.toArray(new Base[this.entity.size()]); // AuditEventEntityComponent
3292        default: return super.getProperty(hash, name, checkValid);
3293        }
3294
3295      }
3296
3297      @Override
3298      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3299        switch (hash) {
3300        case 50511102: // category
3301          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3302          return value;
3303        case 3059181: // code
3304          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3305          return value;
3306        case -1422950858: // action
3307          value = new AuditEventActionEnumFactory().fromType(TypeConvertor.castToCode(value));
3308          this.action = (Enumeration) value; // Enumeration<AuditEventAction>
3309          return value;
3310        case 1478300413: // severity
3311          value = new AuditEventSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
3312          this.severity = (Enumeration) value; // Enumeration<AuditEventSeverity>
3313          return value;
3314        case 792816933: // occurred
3315          this.occurred = TypeConvertor.castToType(value); // DataType
3316          return value;
3317        case -799233872: // recorded
3318          this.recorded = TypeConvertor.castToInstant(value); // InstantType
3319          return value;
3320        case -1106507950: // outcome
3321          this.outcome = (AuditEventOutcomeComponent) value; // AuditEventOutcomeComponent
3322          return value;
3323        case -1385570183: // authorization
3324          this.getAuthorization().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3325          return value;
3326        case -332612366: // basedOn
3327          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
3328          return value;
3329        case -791418107: // patient
3330          this.patient = TypeConvertor.castToReference(value); // Reference
3331          return value;
3332        case 1524132147: // encounter
3333          this.encounter = TypeConvertor.castToReference(value); // Reference
3334          return value;
3335        case 92750597: // agent
3336          this.getAgent().add((AuditEventAgentComponent) value); // AuditEventAgentComponent
3337          return value;
3338        case -896505829: // source
3339          this.source = (AuditEventSourceComponent) value; // AuditEventSourceComponent
3340          return value;
3341        case -1298275357: // entity
3342          this.getEntity().add((AuditEventEntityComponent) value); // AuditEventEntityComponent
3343          return value;
3344        default: return super.setProperty(hash, name, value);
3345        }
3346
3347      }
3348
3349      @Override
3350      public Base setProperty(String name, Base value) throws FHIRException {
3351        if (name.equals("category")) {
3352          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3353        } else if (name.equals("code")) {
3354          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3355        } else if (name.equals("action")) {
3356          value = new AuditEventActionEnumFactory().fromType(TypeConvertor.castToCode(value));
3357          this.action = (Enumeration) value; // Enumeration<AuditEventAction>
3358        } else if (name.equals("severity")) {
3359          value = new AuditEventSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
3360          this.severity = (Enumeration) value; // Enumeration<AuditEventSeverity>
3361        } else if (name.equals("occurred[x]")) {
3362          this.occurred = TypeConvertor.castToType(value); // DataType
3363        } else if (name.equals("recorded")) {
3364          this.recorded = TypeConvertor.castToInstant(value); // InstantType
3365        } else if (name.equals("outcome")) {
3366          this.outcome = (AuditEventOutcomeComponent) value; // AuditEventOutcomeComponent
3367        } else if (name.equals("authorization")) {
3368          this.getAuthorization().add(TypeConvertor.castToCodeableConcept(value));
3369        } else if (name.equals("basedOn")) {
3370          this.getBasedOn().add(TypeConvertor.castToReference(value));
3371        } else if (name.equals("patient")) {
3372          this.patient = TypeConvertor.castToReference(value); // Reference
3373        } else if (name.equals("encounter")) {
3374          this.encounter = TypeConvertor.castToReference(value); // Reference
3375        } else if (name.equals("agent")) {
3376          this.getAgent().add((AuditEventAgentComponent) value);
3377        } else if (name.equals("source")) {
3378          this.source = (AuditEventSourceComponent) value; // AuditEventSourceComponent
3379        } else if (name.equals("entity")) {
3380          this.getEntity().add((AuditEventEntityComponent) value);
3381        } else
3382          return super.setProperty(name, value);
3383        return value;
3384      }
3385
3386      @Override
3387      public Base makeProperty(int hash, String name) throws FHIRException {
3388        switch (hash) {
3389        case 50511102:  return addCategory(); 
3390        case 3059181:  return getCode();
3391        case -1422950858:  return getActionElement();
3392        case 1478300413:  return getSeverityElement();
3393        case 784181563:  return getOccurred();
3394        case 792816933:  return getOccurred();
3395        case -799233872:  return getRecordedElement();
3396        case -1106507950:  return getOutcome();
3397        case -1385570183:  return addAuthorization(); 
3398        case -332612366:  return addBasedOn(); 
3399        case -791418107:  return getPatient();
3400        case 1524132147:  return getEncounter();
3401        case 92750597:  return addAgent(); 
3402        case -896505829:  return getSource();
3403        case -1298275357:  return addEntity(); 
3404        default: return super.makeProperty(hash, name);
3405        }
3406
3407      }
3408
3409      @Override
3410      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3411        switch (hash) {
3412        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
3413        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3414        case -1422950858: /*action*/ return new String[] {"code"};
3415        case 1478300413: /*severity*/ return new String[] {"code"};
3416        case 792816933: /*occurred*/ return new String[] {"Period", "dateTime"};
3417        case -799233872: /*recorded*/ return new String[] {"instant"};
3418        case -1106507950: /*outcome*/ return new String[] {};
3419        case -1385570183: /*authorization*/ return new String[] {"CodeableConcept"};
3420        case -332612366: /*basedOn*/ return new String[] {"Reference"};
3421        case -791418107: /*patient*/ return new String[] {"Reference"};
3422        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3423        case 92750597: /*agent*/ return new String[] {};
3424        case -896505829: /*source*/ return new String[] {};
3425        case -1298275357: /*entity*/ return new String[] {};
3426        default: return super.getTypesForProperty(hash, name);
3427        }
3428
3429      }
3430
3431      @Override
3432      public Base addChild(String name) throws FHIRException {
3433        if (name.equals("category")) {
3434          return addCategory();
3435        }
3436        else if (name.equals("code")) {
3437          this.code = new CodeableConcept();
3438          return this.code;
3439        }
3440        else if (name.equals("action")) {
3441          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.action");
3442        }
3443        else if (name.equals("severity")) {
3444          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.severity");
3445        }
3446        else if (name.equals("occurredPeriod")) {
3447          this.occurred = new Period();
3448          return this.occurred;
3449        }
3450        else if (name.equals("occurredDateTime")) {
3451          this.occurred = new DateTimeType();
3452          return this.occurred;
3453        }
3454        else if (name.equals("recorded")) {
3455          throw new FHIRException("Cannot call addChild on a singleton property AuditEvent.recorded");
3456        }
3457        else if (name.equals("outcome")) {
3458          this.outcome = new AuditEventOutcomeComponent();
3459          return this.outcome;
3460        }
3461        else if (name.equals("authorization")) {
3462          return addAuthorization();
3463        }
3464        else if (name.equals("basedOn")) {
3465          return addBasedOn();
3466        }
3467        else if (name.equals("patient")) {
3468          this.patient = new Reference();
3469          return this.patient;
3470        }
3471        else if (name.equals("encounter")) {
3472          this.encounter = new Reference();
3473          return this.encounter;
3474        }
3475        else if (name.equals("agent")) {
3476          return addAgent();
3477        }
3478        else if (name.equals("source")) {
3479          this.source = new AuditEventSourceComponent();
3480          return this.source;
3481        }
3482        else if (name.equals("entity")) {
3483          return addEntity();
3484        }
3485        else
3486          return super.addChild(name);
3487      }
3488
3489  public String fhirType() {
3490    return "AuditEvent";
3491
3492  }
3493
3494      public AuditEvent copy() {
3495        AuditEvent dst = new AuditEvent();
3496        copyValues(dst);
3497        return dst;
3498      }
3499
3500      public void copyValues(AuditEvent dst) {
3501        super.copyValues(dst);
3502        if (category != null) {
3503          dst.category = new ArrayList<CodeableConcept>();
3504          for (CodeableConcept i : category)
3505            dst.category.add(i.copy());
3506        };
3507        dst.code = code == null ? null : code.copy();
3508        dst.action = action == null ? null : action.copy();
3509        dst.severity = severity == null ? null : severity.copy();
3510        dst.occurred = occurred == null ? null : occurred.copy();
3511        dst.recorded = recorded == null ? null : recorded.copy();
3512        dst.outcome = outcome == null ? null : outcome.copy();
3513        if (authorization != null) {
3514          dst.authorization = new ArrayList<CodeableConcept>();
3515          for (CodeableConcept i : authorization)
3516            dst.authorization.add(i.copy());
3517        };
3518        if (basedOn != null) {
3519          dst.basedOn = new ArrayList<Reference>();
3520          for (Reference i : basedOn)
3521            dst.basedOn.add(i.copy());
3522        };
3523        dst.patient = patient == null ? null : patient.copy();
3524        dst.encounter = encounter == null ? null : encounter.copy();
3525        if (agent != null) {
3526          dst.agent = new ArrayList<AuditEventAgentComponent>();
3527          for (AuditEventAgentComponent i : agent)
3528            dst.agent.add(i.copy());
3529        };
3530        dst.source = source == null ? null : source.copy();
3531        if (entity != null) {
3532          dst.entity = new ArrayList<AuditEventEntityComponent>();
3533          for (AuditEventEntityComponent i : entity)
3534            dst.entity.add(i.copy());
3535        };
3536      }
3537
3538      protected AuditEvent typedCopy() {
3539        return copy();
3540      }
3541
3542      @Override
3543      public boolean equalsDeep(Base other_) {
3544        if (!super.equalsDeep(other_))
3545          return false;
3546        if (!(other_ instanceof AuditEvent))
3547          return false;
3548        AuditEvent o = (AuditEvent) other_;
3549        return compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(action, o.action, true)
3550           && compareDeep(severity, o.severity, true) && compareDeep(occurred, o.occurred, true) && compareDeep(recorded, o.recorded, true)
3551           && compareDeep(outcome, o.outcome, true) && compareDeep(authorization, o.authorization, true) && compareDeep(basedOn, o.basedOn, true)
3552           && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true) && compareDeep(agent, o.agent, true)
3553           && compareDeep(source, o.source, true) && compareDeep(entity, o.entity, true);
3554      }
3555
3556      @Override
3557      public boolean equalsShallow(Base other_) {
3558        if (!super.equalsShallow(other_))
3559          return false;
3560        if (!(other_ instanceof AuditEvent))
3561          return false;
3562        AuditEvent o = (AuditEvent) other_;
3563        return compareValues(action, o.action, true) && compareValues(severity, o.severity, true) && compareValues(recorded, o.recorded, true)
3564          ;
3565      }
3566
3567      public boolean isEmpty() {
3568        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, code, action, severity
3569          , occurred, recorded, outcome, authorization, basedOn, patient, encounter, agent
3570          , source, entity);
3571      }
3572
3573  @Override
3574  public ResourceType getResourceType() {
3575    return ResourceType.AuditEvent;
3576   }
3577
3578 /**
3579   * Search parameter: <b>action</b>
3580   * <p>
3581   * Description: <b>Type of action performed during the event</b><br>
3582   * Type: <b>token</b><br>
3583   * Path: <b>AuditEvent.action</b><br>
3584   * </p>
3585   */
3586  @SearchParamDefinition(name="action", path="AuditEvent.action", description="Type of action performed during the event", type="token" )
3587  public static final String SP_ACTION = "action";
3588 /**
3589   * <b>Fluent Client</b> search parameter constant for <b>action</b>
3590   * <p>
3591   * Description: <b>Type of action performed during the event</b><br>
3592   * Type: <b>token</b><br>
3593   * Path: <b>AuditEvent.action</b><br>
3594   * </p>
3595   */
3596  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTION);
3597
3598 /**
3599   * Search parameter: <b>agent-role</b>
3600   * <p>
3601   * Description: <b>Agent role in the event</b><br>
3602   * Type: <b>token</b><br>
3603   * Path: <b>AuditEvent.agent.role</b><br>
3604   * </p>
3605   */
3606  @SearchParamDefinition(name="agent-role", path="AuditEvent.agent.role", description="Agent role in the event", type="token" )
3607  public static final String SP_AGENT_ROLE = "agent-role";
3608 /**
3609   * <b>Fluent Client</b> search parameter constant for <b>agent-role</b>
3610   * <p>
3611   * Description: <b>Agent role in the event</b><br>
3612   * Type: <b>token</b><br>
3613   * Path: <b>AuditEvent.agent.role</b><br>
3614   * </p>
3615   */
3616  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_ROLE);
3617
3618 /**
3619   * Search parameter: <b>agent</b>
3620   * <p>
3621   * Description: <b>Identifier of who</b><br>
3622   * Type: <b>reference</b><br>
3623   * Path: <b>AuditEvent.agent.who</b><br>
3624   * </p>
3625   */
3626  @SearchParamDefinition(name="agent", path="AuditEvent.agent.who", description="Identifier of who", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3627  public static final String SP_AGENT = "agent";
3628 /**
3629   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
3630   * <p>
3631   * Description: <b>Identifier of who</b><br>
3632   * Type: <b>reference</b><br>
3633   * Path: <b>AuditEvent.agent.who</b><br>
3634   * </p>
3635   */
3636  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
3637
3638/**
3639   * Constant for fluent queries to be used to add include statements. Specifies
3640   * the path value of "<b>AuditEvent:agent</b>".
3641   */
3642  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("AuditEvent:agent").toLocked();
3643
3644 /**
3645   * Search parameter: <b>based-on</b>
3646   * <p>
3647   * Description: <b>Reference to the service request.</b><br>
3648   * Type: <b>reference</b><br>
3649   * Path: <b>AuditEvent.basedOn</b><br>
3650   * </p>
3651   */
3652  @SearchParamDefinition(name="based-on", path="AuditEvent.basedOn", description="Reference to the service request.", type="reference", target={CarePlan.class, DeviceRequest.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class, ServiceRequest.class, Task.class } )
3653  public static final String SP_BASED_ON = "based-on";
3654 /**
3655   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
3656   * <p>
3657   * Description: <b>Reference to the service request.</b><br>
3658   * Type: <b>reference</b><br>
3659   * Path: <b>AuditEvent.basedOn</b><br>
3660   * </p>
3661   */
3662  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
3663
3664/**
3665   * Constant for fluent queries to be used to add include statements. Specifies
3666   * the path value of "<b>AuditEvent:based-on</b>".
3667   */
3668  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("AuditEvent:based-on").toLocked();
3669
3670 /**
3671   * Search parameter: <b>category</b>
3672   * <p>
3673   * Description: <b>Category of event</b><br>
3674   * Type: <b>token</b><br>
3675   * Path: <b>AuditEvent.category</b><br>
3676   * </p>
3677   */
3678  @SearchParamDefinition(name="category", path="AuditEvent.category", description="Category of event", type="token" )
3679  public static final String SP_CATEGORY = "category";
3680 /**
3681   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3682   * <p>
3683   * Description: <b>Category of event</b><br>
3684   * Type: <b>token</b><br>
3685   * Path: <b>AuditEvent.category</b><br>
3686   * </p>
3687   */
3688  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3689
3690 /**
3691   * Search parameter: <b>entity-role</b>
3692   * <p>
3693   * Description: <b>What role the entity played</b><br>
3694   * Type: <b>token</b><br>
3695   * Path: <b>AuditEvent.entity.role</b><br>
3696   * </p>
3697   */
3698  @SearchParamDefinition(name="entity-role", path="AuditEvent.entity.role", description="What role the entity played", type="token" )
3699  public static final String SP_ENTITY_ROLE = "entity-role";
3700 /**
3701   * <b>Fluent Client</b> search parameter constant for <b>entity-role</b>
3702   * <p>
3703   * Description: <b>What role the entity played</b><br>
3704   * Type: <b>token</b><br>
3705   * Path: <b>AuditEvent.entity.role</b><br>
3706   * </p>
3707   */
3708  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ENTITY_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ENTITY_ROLE);
3709
3710 /**
3711   * Search parameter: <b>entity</b>
3712   * <p>
3713   * Description: <b>Specific instance of resource</b><br>
3714   * Type: <b>reference</b><br>
3715   * Path: <b>AuditEvent.entity.what</b><br>
3716   * </p>
3717   */
3718  @SearchParamDefinition(name="entity", path="AuditEvent.entity.what", description="Specific instance of resource", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BiologicallyDerivedProductDispense.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceAssociation.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentReference.class, Encounter.class, EncounterHistory.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryItem.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Parameters.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestPlan.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
3719  public static final String SP_ENTITY = "entity";
3720 /**
3721   * <b>Fluent Client</b> search parameter constant for <b>entity</b>
3722   * <p>
3723   * Description: <b>Specific instance of resource</b><br>
3724   * Type: <b>reference</b><br>
3725   * Path: <b>AuditEvent.entity.what</b><br>
3726   * </p>
3727   */
3728  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTITY);
3729
3730/**
3731   * Constant for fluent queries to be used to add include statements. Specifies
3732   * the path value of "<b>AuditEvent:entity</b>".
3733   */
3734  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTITY = new ca.uhn.fhir.model.api.Include("AuditEvent:entity").toLocked();
3735
3736 /**
3737   * Search parameter: <b>outcome</b>
3738   * <p>
3739   * Description: <b>Whether the event succeeded or failed</b><br>
3740   * Type: <b>token</b><br>
3741   * Path: <b>AuditEvent.outcome.code</b><br>
3742   * </p>
3743   */
3744  @SearchParamDefinition(name="outcome", path="AuditEvent.outcome.code", description="Whether the event succeeded or failed", type="token" )
3745  public static final String SP_OUTCOME = "outcome";
3746 /**
3747   * <b>Fluent Client</b> search parameter constant for <b>outcome</b>
3748   * <p>
3749   * Description: <b>Whether the event succeeded or failed</b><br>
3750   * Type: <b>token</b><br>
3751   * Path: <b>AuditEvent.outcome.code</b><br>
3752   * </p>
3753   */
3754  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OUTCOME = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OUTCOME);
3755
3756 /**
3757   * Search parameter: <b>policy</b>
3758   * <p>
3759   * Description: <b>Policy that authorized event</b><br>
3760   * Type: <b>uri</b><br>
3761   * Path: <b>AuditEvent.agent.policy</b><br>
3762   * </p>
3763   */
3764  @SearchParamDefinition(name="policy", path="AuditEvent.agent.policy", description="Policy that authorized event", type="uri" )
3765  public static final String SP_POLICY = "policy";
3766 /**
3767   * <b>Fluent Client</b> search parameter constant for <b>policy</b>
3768   * <p>
3769   * Description: <b>Policy that authorized event</b><br>
3770   * Type: <b>uri</b><br>
3771   * Path: <b>AuditEvent.agent.policy</b><br>
3772   * </p>
3773   */
3774  public static final ca.uhn.fhir.rest.gclient.UriClientParam POLICY = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_POLICY);
3775
3776 /**
3777   * Search parameter: <b>purpose</b>
3778   * <p>
3779   * Description: <b>The authorization (purposeOfUse) of the event</b><br>
3780   * Type: <b>token</b><br>
3781   * Path: <b>AuditEvent.authorization | AuditEvent.agent.authorization</b><br>
3782   * </p>
3783   */
3784  @SearchParamDefinition(name="purpose", path="AuditEvent.authorization | AuditEvent.agent.authorization", description="The authorization (purposeOfUse) of the event", type="token" )
3785  public static final String SP_PURPOSE = "purpose";
3786 /**
3787   * <b>Fluent Client</b> search parameter constant for <b>purpose</b>
3788   * <p>
3789   * Description: <b>The authorization (purposeOfUse) of the event</b><br>
3790   * Type: <b>token</b><br>
3791   * Path: <b>AuditEvent.authorization | AuditEvent.agent.authorization</b><br>
3792   * </p>
3793   */
3794  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PURPOSE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PURPOSE);
3795
3796 /**
3797   * Search parameter: <b>source</b>
3798   * <p>
3799   * Description: <b>The identity of source detecting the event</b><br>
3800   * Type: <b>reference</b><br>
3801   * Path: <b>AuditEvent.source.observer</b><br>
3802   * </p>
3803   */
3804  @SearchParamDefinition(name="source", path="AuditEvent.source.observer", description="The identity of source detecting the event", type="reference", target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3805  public static final String SP_SOURCE = "source";
3806 /**
3807   * <b>Fluent Client</b> search parameter constant for <b>source</b>
3808   * <p>
3809   * Description: <b>The identity of source detecting the event</b><br>
3810   * Type: <b>reference</b><br>
3811   * Path: <b>AuditEvent.source.observer</b><br>
3812   * </p>
3813   */
3814  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
3815
3816/**
3817   * Constant for fluent queries to be used to add include statements. Specifies
3818   * the path value of "<b>AuditEvent:source</b>".
3819   */
3820  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("AuditEvent:source").toLocked();
3821
3822 /**
3823   * Search parameter: <b>code</b>
3824   * <p>
3825   * Description: <b>Multiple Resources: 
3826
3827* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted
3828* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
3829* [AuditEvent](auditevent.html): More specific code for the event
3830* [Basic](basic.html): Kind of Resource
3831* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code
3832* [Condition](condition.html): Code for the condition
3833* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.
3834* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
3835* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
3836* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
3837* [ImagingSelection](imagingselection.html): The imaging selection status
3838* [List](list.html): What the purpose of this list is
3839* [Medication](medication.html): Returns medications for a specific code
3840* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3841* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3842* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3843* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3844* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake
3845* [Observation](observation.html): The code of the observation type
3846* [Procedure](procedure.html): A code to identify a  procedure
3847* [RequestOrchestration](requestorchestration.html): The code of the request orchestration
3848* [Task](task.html): Search by task code
3849</b><br>
3850   * Type: <b>token</b><br>
3851   * Path: <b>AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code</b><br>
3852   * </p>
3853   */
3854  @SearchParamDefinition(name="code", path="AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code", description="Multiple Resources: \r\n\r\n* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted\r\n* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance\r\n* [AuditEvent](auditevent.html): More specific code for the event\r\n* [Basic](basic.html): Kind of Resource\r\n* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code\r\n* [Condition](condition.html): Code for the condition\r\n* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.\r\n* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered\r\n* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code\r\n* [ImagingSelection](imagingselection.html): The imaging selection status\r\n* [List](list.html): What the purpose of this list is\r\n* [Medication](medication.html): Returns medications for a specific code\r\n* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code\r\n* [MedicationStatement](medicationstatement.html): Return statements of this medication code\r\n* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake\r\n* [Observation](observation.html): The code of the observation type\r\n* [Procedure](procedure.html): A code to identify a  procedure\r\n* [RequestOrchestration](requestorchestration.html): The code of the request orchestration\r\n* [Task](task.html): Search by task code\r\n", type="token" )
3855  public static final String SP_CODE = "code";
3856 /**
3857   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3858   * <p>
3859   * Description: <b>Multiple Resources: 
3860
3861* [AdverseEvent](adverseevent.html): Event or incident that occurred or was averted
3862* [AllergyIntolerance](allergyintolerance.html): Code that identifies the allergy or intolerance
3863* [AuditEvent](auditevent.html): More specific code for the event
3864* [Basic](basic.html): Kind of Resource
3865* [ChargeItem](chargeitem.html): A code that identifies the charge, like a billing code
3866* [Condition](condition.html): Code for the condition
3867* [DetectedIssue](detectedissue.html): Issue Type, e.g. drug-drug, duplicate therapy, etc.
3868* [DeviceRequest](devicerequest.html): Code for what is being requested/ordered
3869* [DiagnosticReport](diagnosticreport.html): The code for the report, as opposed to codes for the atomic results, which are the names on the observation resource referred to from the result
3870* [FamilyMemberHistory](familymemberhistory.html): A search by a condition code
3871* [ImagingSelection](imagingselection.html): The imaging selection status
3872* [List](list.html): What the purpose of this list is
3873* [Medication](medication.html): Returns medications for a specific code
3874* [MedicationAdministration](medicationadministration.html): Return administrations of this medication code
3875* [MedicationDispense](medicationdispense.html): Returns dispenses of this medicine code
3876* [MedicationRequest](medicationrequest.html): Return prescriptions of this medication code
3877* [MedicationStatement](medicationstatement.html): Return statements of this medication code
3878* [NutritionIntake](nutritionintake.html): Returns statements of this code of NutritionIntake
3879* [Observation](observation.html): The code of the observation type
3880* [Procedure](procedure.html): A code to identify a  procedure
3881* [RequestOrchestration](requestorchestration.html): The code of the request orchestration
3882* [Task](task.html): Search by task code
3883</b><br>
3884   * Type: <b>token</b><br>
3885   * Path: <b>AdverseEvent.code | AllergyIntolerance.code | AllergyIntolerance.reaction.substance | AuditEvent.code | Basic.code | ChargeItem.code | Condition.code | DetectedIssue.code | DeviceRequest.code.concept | DiagnosticReport.code | FamilyMemberHistory.condition.code | ImagingSelection.status | List.code | Medication.code | MedicationAdministration.medication.concept | MedicationDispense.medication.concept | MedicationRequest.medication.concept | MedicationStatement.medication.concept | NutritionIntake.code | Observation.code | Procedure.code | RequestOrchestration.code | Task.code</b><br>
3886   * </p>
3887   */
3888  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3889
3890 /**
3891   * Search parameter: <b>date</b>
3892   * <p>
3893   * Description: <b>Multiple Resources: 
3894
3895* [AdverseEvent](adverseevent.html): When the event occurred
3896* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded
3897* [Appointment](appointment.html): Appointment date/time.
3898* [AuditEvent](auditevent.html): Time when the event was recorded
3899* [CarePlan](careplan.html): Time period plan covers
3900* [CareTeam](careteam.html): A date within the coverage time period.
3901* [ClinicalImpression](clinicalimpression.html): When the assessment was documented
3902* [Composition](composition.html): Composition editing time
3903* [Consent](consent.html): When consent was agreed to
3904* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report
3905* [DocumentReference](documentreference.html): When this document reference was created
3906* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted
3907* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period
3908* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated
3909* [Flag](flag.html): Time period when flag is active
3910* [Immunization](immunization.html): Vaccination  (non)-Administration Date
3911* [ImmunizationEvaluation](immunizationevaluation.html): Date the evaluation was generated
3912* [ImmunizationRecommendation](immunizationrecommendation.html): Date recommendation(s) created
3913* [Invoice](invoice.html): Invoice date / posting date
3914* [List](list.html): When the list was prepared
3915* [MeasureReport](measurereport.html): The date of the measure report
3916* [NutritionIntake](nutritionintake.html): Date when patient was taking (or not taking) the medication
3917* [Observation](observation.html): Clinically relevant time/time-period for observation
3918* [Procedure](procedure.html): When the procedure occurred or is occurring
3919* [ResearchSubject](researchsubject.html): Start and end of participation
3920* [RiskAssessment](riskassessment.html): When was assessment made?
3921* [SupplyRequest](supplyrequest.html): When the request was made
3922</b><br>
3923   * Type: <b>date</b><br>
3924   * Path: <b>AdverseEvent.occurrence.ofType(dateTime) | AdverseEvent.occurrence.ofType(Period) | AdverseEvent.occurrence.ofType(Timing) | AllergyIntolerance.recordedDate | (start | requestedPeriod.start).first() | AuditEvent.recorded | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.ofType(dateTime) | DiagnosticReport.effective.ofType(Period) | DocumentReference.date | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence.ofType(dateTime)) | ImmunizationEvaluation.date | ImmunizationRecommendation.date | Invoice.date | List.date | MeasureReport.date | NutritionIntake.occurrence.ofType(dateTime) | NutritionIntake.occurrence.ofType(Period) | Observation.effective.ofType(dateTime) | Observation.effective.ofType(Period) | Observation.effective.ofType(Timing) | Observation.effective.ofType(instant) | Procedure.occurrence.ofType(dateTime) | Procedure.occurrence.ofType(Period) | Procedure.occurrence.ofType(Timing) | ResearchSubject.period | (RiskAssessment.occurrence.ofType(dateTime)) | SupplyRequest.authoredOn</b><br>
3925   * </p>
3926   */
3927  @SearchParamDefinition(name="date", path="AdverseEvent.occurrence.ofType(dateTime) | AdverseEvent.occurrence.ofType(Period) | AdverseEvent.occurrence.ofType(Timing) | AllergyIntolerance.recordedDate | (start | requestedPeriod.start).first() | AuditEvent.recorded | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.ofType(dateTime) | DiagnosticReport.effective.ofType(Period) | DocumentReference.date | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence.ofType(dateTime)) | ImmunizationEvaluation.date | ImmunizationRecommendation.date | Invoice.date | List.date | MeasureReport.date | NutritionIntake.occurrence.ofType(dateTime) | NutritionIntake.occurrence.ofType(Period) | Observation.effective.ofType(dateTime) | Observation.effective.ofType(Period) | Observation.effective.ofType(Timing) | Observation.effective.ofType(instant) | Procedure.occurrence.ofType(dateTime) | Procedure.occurrence.ofType(Period) | Procedure.occurrence.ofType(Timing) | ResearchSubject.period | (RiskAssessment.occurrence.ofType(dateTime)) | SupplyRequest.authoredOn", description="Multiple Resources: \r\n\r\n* [AdverseEvent](adverseevent.html): When the event occurred\r\n* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded\r\n* [Appointment](appointment.html): Appointment date/time.\r\n* [AuditEvent](auditevent.html): Time when the event was recorded\r\n* [CarePlan](careplan.html): Time period plan covers\r\n* [CareTeam](careteam.html): A date within the coverage time period.\r\n* [ClinicalImpression](clinicalimpression.html): When the assessment was documented\r\n* [Composition](composition.html): Composition editing time\r\n* [Consent](consent.html): When consent was agreed to\r\n* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report\r\n* [DocumentReference](documentreference.html): When this document reference was created\r\n* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted\r\n* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period\r\n* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated\r\n* [Flag](flag.html): Time period when flag is active\r\n* [Immunization](immunization.html): Vaccination  (non)-Administration Date\r\n* [ImmunizationEvaluation](immunizationevaluation.html): Date the evaluation was generated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Date recommendation(s) created\r\n* [Invoice](invoice.html): Invoice date / posting date\r\n* [List](list.html): When the list was prepared\r\n* [MeasureReport](measurereport.html): The date of the measure report\r\n* [NutritionIntake](nutritionintake.html): Date when patient was taking (or not taking) the medication\r\n* [Observation](observation.html): Clinically relevant time/time-period for observation\r\n* [Procedure](procedure.html): When the procedure occurred or is occurring\r\n* [ResearchSubject](researchsubject.html): Start and end of participation\r\n* [RiskAssessment](riskassessment.html): When was assessment made?\r\n* [SupplyRequest](supplyrequest.html): When the request was made\r\n", type="date" )
3928  public static final String SP_DATE = "date";
3929 /**
3930   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3931   * <p>
3932   * Description: <b>Multiple Resources: 
3933
3934* [AdverseEvent](adverseevent.html): When the event occurred
3935* [AllergyIntolerance](allergyintolerance.html): Date first version of the resource instance was recorded
3936* [Appointment](appointment.html): Appointment date/time.
3937* [AuditEvent](auditevent.html): Time when the event was recorded
3938* [CarePlan](careplan.html): Time period plan covers
3939* [CareTeam](careteam.html): A date within the coverage time period.
3940* [ClinicalImpression](clinicalimpression.html): When the assessment was documented
3941* [Composition](composition.html): Composition editing time
3942* [Consent](consent.html): When consent was agreed to
3943* [DiagnosticReport](diagnosticreport.html): The clinically relevant time of the report
3944* [DocumentReference](documentreference.html): When this document reference was created
3945* [Encounter](encounter.html): A date within the actualPeriod the Encounter lasted
3946* [EpisodeOfCare](episodeofcare.html): The provided date search value falls within the episode of care's period
3947* [FamilyMemberHistory](familymemberhistory.html): When history was recorded or last updated
3948* [Flag](flag.html): Time period when flag is active
3949* [Immunization](immunization.html): Vaccination  (non)-Administration Date
3950* [ImmunizationEvaluation](immunizationevaluation.html): Date the evaluation was generated
3951* [ImmunizationRecommendation](immunizationrecommendation.html): Date recommendation(s) created
3952* [Invoice](invoice.html): Invoice date / posting date
3953* [List](list.html): When the list was prepared
3954* [MeasureReport](measurereport.html): The date of the measure report
3955* [NutritionIntake](nutritionintake.html): Date when patient was taking (or not taking) the medication
3956* [Observation](observation.html): Clinically relevant time/time-period for observation
3957* [Procedure](procedure.html): When the procedure occurred or is occurring
3958* [ResearchSubject](researchsubject.html): Start and end of participation
3959* [RiskAssessment](riskassessment.html): When was assessment made?
3960* [SupplyRequest](supplyrequest.html): When the request was made
3961</b><br>
3962   * Type: <b>date</b><br>
3963   * Path: <b>AdverseEvent.occurrence.ofType(dateTime) | AdverseEvent.occurrence.ofType(Period) | AdverseEvent.occurrence.ofType(Timing) | AllergyIntolerance.recordedDate | (start | requestedPeriod.start).first() | AuditEvent.recorded | CarePlan.period | ClinicalImpression.date | Composition.date | Consent.date | DiagnosticReport.effective.ofType(dateTime) | DiagnosticReport.effective.ofType(Period) | DocumentReference.date | Encounter.actualPeriod | EpisodeOfCare.period | FamilyMemberHistory.date | Flag.period | (Immunization.occurrence.ofType(dateTime)) | ImmunizationEvaluation.date | ImmunizationRecommendation.date | Invoice.date | List.date | MeasureReport.date | NutritionIntake.occurrence.ofType(dateTime) | NutritionIntake.occurrence.ofType(Period) | Observation.effective.ofType(dateTime) | Observation.effective.ofType(Period) | Observation.effective.ofType(Timing) | Observation.effective.ofType(instant) | Procedure.occurrence.ofType(dateTime) | Procedure.occurrence.ofType(Period) | Procedure.occurrence.ofType(Timing) | ResearchSubject.period | (RiskAssessment.occurrence.ofType(dateTime)) | SupplyRequest.authoredOn</b><br>
3964   * </p>
3965   */
3966  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3967
3968 /**
3969   * Search parameter: <b>encounter</b>
3970   * <p>
3971   * Description: <b>Multiple Resources: 
3972
3973* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
3974* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
3975* [ChargeItem](chargeitem.html): Encounter associated with event
3976* [Claim](claim.html): Encounters associated with a billed line item
3977* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
3978* [Communication](communication.html): The Encounter during which this Communication was created
3979* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
3980* [Composition](composition.html): Context of the Composition
3981* [Condition](condition.html): The Encounter during which this Condition was created
3982* [DeviceRequest](devicerequest.html): Encounter during which request was created
3983* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
3984* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
3985* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
3986* [Flag](flag.html): Alert relevant during encounter
3987* [ImagingStudy](imagingstudy.html): The context of the study
3988* [List](list.html): Context in which list created
3989* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
3990* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
3991* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
3992* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
3993* [Observation](observation.html): Encounter related to the observation
3994* [Procedure](procedure.html): The Encounter during which this Procedure was created
3995* [Provenance](provenance.html): Encounter related to the Provenance
3996* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
3997* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
3998* [RiskAssessment](riskassessment.html): Where was assessment performed?
3999* [ServiceRequest](servicerequest.html): An encounter in which this request is made
4000* [Task](task.html): Search by encounter
4001* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
4002</b><br>
4003   * Type: <b>reference</b><br>
4004   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
4005   * </p>
4006   */
4007  @SearchParamDefinition(name="encounter", path="AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent\r\n* [CarePlan](careplan.html): The Encounter during which this CarePlan was created\r\n* [ChargeItem](chargeitem.html): Encounter associated with event\r\n* [Claim](claim.html): Encounters associated with a billed line item\r\n* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created\r\n* [Communication](communication.html): The Encounter during which this Communication was created\r\n* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created\r\n* [Composition](composition.html): Context of the Composition\r\n* [Condition](condition.html): The Encounter during which this Condition was created\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values\r\n* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [ImagingStudy](imagingstudy.html): The context of the study\r\n* [List](list.html): Context in which list created\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [Provenance](provenance.html): Encounter related to the Provenance\r\n* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response\r\n* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [Task](task.html): Search by encounter\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", target={Encounter.class } )
4008  public static final String SP_ENCOUNTER = "encounter";
4009 /**
4010   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
4011   * <p>
4012   * Description: <b>Multiple Resources: 
4013
4014* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
4015* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
4016* [ChargeItem](chargeitem.html): Encounter associated with event
4017* [Claim](claim.html): Encounters associated with a billed line item
4018* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
4019* [Communication](communication.html): The Encounter during which this Communication was created
4020* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
4021* [Composition](composition.html): Context of the Composition
4022* [Condition](condition.html): The Encounter during which this Condition was created
4023* [DeviceRequest](devicerequest.html): Encounter during which request was created
4024* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
4025* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
4026* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
4027* [Flag](flag.html): Alert relevant during encounter
4028* [ImagingStudy](imagingstudy.html): The context of the study
4029* [List](list.html): Context in which list created
4030* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
4031* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
4032* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
4033* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
4034* [Observation](observation.html): Encounter related to the observation
4035* [Procedure](procedure.html): The Encounter during which this Procedure was created
4036* [Provenance](provenance.html): Encounter related to the Provenance
4037* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
4038* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
4039* [RiskAssessment](riskassessment.html): Where was assessment performed?
4040* [ServiceRequest](servicerequest.html): An encounter in which this request is made
4041* [Task](task.html): Search by encounter
4042* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
4043</b><br>
4044   * Type: <b>reference</b><br>
4045   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
4046   * </p>
4047   */
4048  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
4049
4050/**
4051   * Constant for fluent queries to be used to add include statements. Specifies
4052   * the path value of "<b>AuditEvent:encounter</b>".
4053   */
4054  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("AuditEvent:encounter").toLocked();
4055
4056 /**
4057   * Search parameter: <b>patient</b>
4058   * <p>
4059   * Description: <b>Multiple Resources: 
4060
4061* [Account](account.html): The entity that caused the expenses
4062* [AdverseEvent](adverseevent.html): Subject impacted by event
4063* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4064* [Appointment](appointment.html): One of the individuals of the appointment is this patient
4065* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
4066* [AuditEvent](auditevent.html): Where the activity involved patient data
4067* [Basic](basic.html): Identifies the focus of this resource
4068* [BodyStructure](bodystructure.html): Who this is about
4069* [CarePlan](careplan.html): Who the care plan is for
4070* [CareTeam](careteam.html): Who care team is for
4071* [ChargeItem](chargeitem.html): Individual service was done for/to
4072* [Claim](claim.html): Patient receiving the products or services
4073* [ClaimResponse](claimresponse.html): The subject of care
4074* [ClinicalImpression](clinicalimpression.html): Patient assessed
4075* [Communication](communication.html): Focus of message
4076* [CommunicationRequest](communicationrequest.html): Focus of message
4077* [Composition](composition.html): Who and/or what the composition is about
4078* [Condition](condition.html): Who has the condition?
4079* [Consent](consent.html): Who the consent applies to
4080* [Contract](contract.html): The identity of the subject of the contract (if a patient)
4081* [Coverage](coverage.html): Retrieve coverages for a patient
4082* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
4083* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
4084* [DetectedIssue](detectedissue.html): Associated patient
4085* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4086* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4087* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4088* [DocumentReference](documentreference.html): Who/what is the subject of the document
4089* [Encounter](encounter.html): The patient present at the encounter
4090* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
4091* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4092* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
4093* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4094* [Flag](flag.html): The identity of a subject to list flags for
4095* [Goal](goal.html): Who this goal is intended for
4096* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
4097* [ImagingSelection](imagingselection.html): Who the study is about
4098* [ImagingStudy](imagingstudy.html): Who the study is about
4099* [Immunization](immunization.html): The patient for the vaccination record
4100* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
4101* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
4102* [Invoice](invoice.html): Recipient(s) of goods and services
4103* [List](list.html): If all resources have the same subject
4104* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
4105* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4106* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4107* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4108* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
4109* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
4110* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
4111* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
4112* [Observation](observation.html): The subject that the observation is about (if patient)
4113* [Person](person.html): The Person links to this Patient
4114* [Procedure](procedure.html): Search by subject - a patient
4115* [Provenance](provenance.html): Where the activity involved patient data
4116* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
4117* [RelatedPerson](relatedperson.html): The patient this related person is related to
4118* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
4119* [ResearchSubject](researchsubject.html): Who or what is part of study
4120* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4121* [ServiceRequest](servicerequest.html): Search by subject - a patient
4122* [Specimen](specimen.html): The patient the specimen comes from
4123* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4124* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
4125* [Task](task.html): Search by patient
4126* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4127</b><br>
4128   * Type: <b>reference</b><br>
4129   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
4130   * </p>
4131   */
4132  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [Account](account.html): The entity that caused the expenses\r\n* [AdverseEvent](adverseevent.html): Subject impacted by event\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [Appointment](appointment.html): One of the individuals of the appointment is this patient\r\n* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient\r\n* [AuditEvent](auditevent.html): Where the activity involved patient data\r\n* [Basic](basic.html): Identifies the focus of this resource\r\n* [BodyStructure](bodystructure.html): Who this is about\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ChargeItem](chargeitem.html): Individual service was done for/to\r\n* [Claim](claim.html): Patient receiving the products or services\r\n* [ClaimResponse](claimresponse.html): The subject of care\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Communication](communication.html): Focus of message\r\n* [CommunicationRequest](communicationrequest.html): Focus of message\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [Contract](contract.html): The identity of the subject of the contract (if a patient)\r\n* [Coverage](coverage.html): Retrieve coverages for a patient\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results\r\n* [ImagingSelection](imagingselection.html): Who the study is about\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for\r\n* [Invoice](invoice.html): Recipient(s) of goods and services\r\n* [List](list.html): If all resources have the same subject\r\n* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [MolecularSequence](molecularsequence.html): The subject that the sequence is about\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Person](person.html): The Person links to this Patient\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [Provenance](provenance.html): Where the activity involved patient data\r\n* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response\r\n* [RelatedPerson](relatedperson.html): The patient this related person is related to\r\n* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations\r\n* [ResearchSubject](researchsubject.html): Who or what is part of study\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [Specimen](specimen.html): The patient the specimen comes from\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [Task](task.html): Search by patient\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
4133  public static final String SP_PATIENT = "patient";
4134 /**
4135   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4136   * <p>
4137   * Description: <b>Multiple Resources: 
4138
4139* [Account](account.html): The entity that caused the expenses
4140* [AdverseEvent](adverseevent.html): Subject impacted by event
4141* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
4142* [Appointment](appointment.html): One of the individuals of the appointment is this patient
4143* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
4144* [AuditEvent](auditevent.html): Where the activity involved patient data
4145* [Basic](basic.html): Identifies the focus of this resource
4146* [BodyStructure](bodystructure.html): Who this is about
4147* [CarePlan](careplan.html): Who the care plan is for
4148* [CareTeam](careteam.html): Who care team is for
4149* [ChargeItem](chargeitem.html): Individual service was done for/to
4150* [Claim](claim.html): Patient receiving the products or services
4151* [ClaimResponse](claimresponse.html): The subject of care
4152* [ClinicalImpression](clinicalimpression.html): Patient assessed
4153* [Communication](communication.html): Focus of message
4154* [CommunicationRequest](communicationrequest.html): Focus of message
4155* [Composition](composition.html): Who and/or what the composition is about
4156* [Condition](condition.html): Who has the condition?
4157* [Consent](consent.html): Who the consent applies to
4158* [Contract](contract.html): The identity of the subject of the contract (if a patient)
4159* [Coverage](coverage.html): Retrieve coverages for a patient
4160* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
4161* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
4162* [DetectedIssue](detectedissue.html): Associated patient
4163* [DeviceRequest](devicerequest.html): Individual the service is ordered for
4164* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
4165* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
4166* [DocumentReference](documentreference.html): Who/what is the subject of the document
4167* [Encounter](encounter.html): The patient present at the encounter
4168* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
4169* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
4170* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
4171* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
4172* [Flag](flag.html): The identity of a subject to list flags for
4173* [Goal](goal.html): Who this goal is intended for
4174* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
4175* [ImagingSelection](imagingselection.html): Who the study is about
4176* [ImagingStudy](imagingstudy.html): Who the study is about
4177* [Immunization](immunization.html): The patient for the vaccination record
4178* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
4179* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
4180* [Invoice](invoice.html): Recipient(s) of goods and services
4181* [List](list.html): If all resources have the same subject
4182* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
4183* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
4184* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
4185* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
4186* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
4187* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
4188* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
4189* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
4190* [Observation](observation.html): The subject that the observation is about (if patient)
4191* [Person](person.html): The Person links to this Patient
4192* [Procedure](procedure.html): Search by subject - a patient
4193* [Provenance](provenance.html): Where the activity involved patient data
4194* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
4195* [RelatedPerson](relatedperson.html): The patient this related person is related to
4196* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
4197* [ResearchSubject](researchsubject.html): Who or what is part of study
4198* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
4199* [ServiceRequest](servicerequest.html): Search by subject - a patient
4200* [Specimen](specimen.html): The patient the specimen comes from
4201* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
4202* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
4203* [Task](task.html): Search by patient
4204* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
4205</b><br>
4206   * Type: <b>reference</b><br>
4207   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
4208   * </p>
4209   */
4210  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4211
4212/**
4213   * Constant for fluent queries to be used to add include statements. Specifies
4214   * the path value of "<b>AuditEvent:patient</b>".
4215   */
4216  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AuditEvent:patient").toLocked();
4217
4218
4219}
4220