001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.
048 */
049@ResourceDef(name="AuditEvent", profile="http://hl7.org/fhir/Profile/AuditEvent")
050public class AuditEvent extends DomainResource {
051
052    public enum AuditEventAction {
053        /**
054         * Create a new database object, such as placing an order.
055         */
056        C, 
057        /**
058         * Display or print data, such as a doctor census.
059         */
060        R, 
061        /**
062         * Update data, such as revise patient information.
063         */
064        U, 
065        /**
066         * Delete items, such as a doctor master file record.
067         */
068        D, 
069        /**
070         * 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.
071         */
072        E, 
073        /**
074         * added to help the parsers with the generic types
075         */
076        NULL;
077        public static AuditEventAction fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("C".equals(codeString))
081          return C;
082        if ("R".equals(codeString))
083          return R;
084        if ("U".equals(codeString))
085          return U;
086        if ("D".equals(codeString))
087          return D;
088        if ("E".equals(codeString))
089          return E;
090        if (Configuration.isAcceptInvalidEnums())
091          return null;
092        else
093          throw new FHIRException("Unknown AuditEventAction code '"+codeString+"'");
094        }
095        public String toCode() {
096          switch (this) {
097            case C: return "C";
098            case R: return "R";
099            case U: return "U";
100            case D: return "D";
101            case E: return "E";
102            default: return "?";
103          }
104        }
105        public String getSystem() {
106          switch (this) {
107            case C: return "http://hl7.org/fhir/audit-event-action";
108            case R: return "http://hl7.org/fhir/audit-event-action";
109            case U: return "http://hl7.org/fhir/audit-event-action";
110            case D: return "http://hl7.org/fhir/audit-event-action";
111            case E: return "http://hl7.org/fhir/audit-event-action";
112            default: return "?";
113          }
114        }
115        public String getDefinition() {
116          switch (this) {
117            case C: return "Create a new database object, such as placing an order.";
118            case R: return "Display or print data, such as a doctor census.";
119            case U: return "Update data, such as revise patient information.";
120            case D: return "Delete items, such as a doctor master file record.";
121            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.";
122            default: return "?";
123          }
124        }
125        public String getDisplay() {
126          switch (this) {
127            case C: return "Create";
128            case R: return "Read/View/Print";
129            case U: return "Update";
130            case D: return "Delete";
131            case E: return "Execute";
132            default: return "?";
133          }
134        }
135    }
136
137  public static class AuditEventActionEnumFactory implements EnumFactory<AuditEventAction> {
138    public AuditEventAction fromCode(String codeString) throws IllegalArgumentException {
139      if (codeString == null || "".equals(codeString))
140            if (codeString == null || "".equals(codeString))
141                return null;
142        if ("C".equals(codeString))
143          return AuditEventAction.C;
144        if ("R".equals(codeString))
145          return AuditEventAction.R;
146        if ("U".equals(codeString))
147          return AuditEventAction.U;
148        if ("D".equals(codeString))
149          return AuditEventAction.D;
150        if ("E".equals(codeString))
151          return AuditEventAction.E;
152        throw new IllegalArgumentException("Unknown AuditEventAction code '"+codeString+"'");
153        }
154        public Enumeration<AuditEventAction> fromType(Base code) throws FHIRException {
155          if (code == null)
156            return null;
157          if (code.isEmpty())
158            return new Enumeration<AuditEventAction>(this);
159          String codeString = ((PrimitiveType) code).asStringValue();
160          if (codeString == null || "".equals(codeString))
161            return null;
162        if ("C".equals(codeString))
163          return new Enumeration<AuditEventAction>(this, AuditEventAction.C);
164        if ("R".equals(codeString))
165          return new Enumeration<AuditEventAction>(this, AuditEventAction.R);
166        if ("U".equals(codeString))
167          return new Enumeration<AuditEventAction>(this, AuditEventAction.U);
168        if ("D".equals(codeString))
169          return new Enumeration<AuditEventAction>(this, AuditEventAction.D);
170        if ("E".equals(codeString))
171          return new Enumeration<AuditEventAction>(this, AuditEventAction.E);
172        throw new FHIRException("Unknown AuditEventAction code '"+codeString+"'");
173        }
174    public String toCode(AuditEventAction code) {
175      if (code == AuditEventAction.C)
176        return "C";
177      if (code == AuditEventAction.R)
178        return "R";
179      if (code == AuditEventAction.U)
180        return "U";
181      if (code == AuditEventAction.D)
182        return "D";
183      if (code == AuditEventAction.E)
184        return "E";
185      return "?";
186      }
187    public String toSystem(AuditEventAction code) {
188      return code.getSystem();
189      }
190    }
191
192    public enum AuditEventOutcome {
193        /**
194         * The operation completed successfully (whether with warnings or not).
195         */
196        _0, 
197        /**
198         * The action was not successful due to some kind of catered for error (often equivalent to an HTTP 400 response).
199         */
200        _4, 
201        /**
202         * The action was not successful due to some kind of unexpected error (often equivalent to an HTTP 500 response).
203         */
204        _8, 
205        /**
206         * An error of such magnitude occurred that the system is no longer available for use (i.e. the system died).
207         */
208        _12, 
209        /**
210         * added to help the parsers with the generic types
211         */
212        NULL;
213        public static AuditEventOutcome fromCode(String codeString) throws FHIRException {
214            if (codeString == null || "".equals(codeString))
215                return null;
216        if ("0".equals(codeString))
217          return _0;
218        if ("4".equals(codeString))
219          return _4;
220        if ("8".equals(codeString))
221          return _8;
222        if ("12".equals(codeString))
223          return _12;
224        if (Configuration.isAcceptInvalidEnums())
225          return null;
226        else
227          throw new FHIRException("Unknown AuditEventOutcome code '"+codeString+"'");
228        }
229        public String toCode() {
230          switch (this) {
231            case _0: return "0";
232            case _4: return "4";
233            case _8: return "8";
234            case _12: return "12";
235            default: return "?";
236          }
237        }
238        public String getSystem() {
239          switch (this) {
240            case _0: return "http://hl7.org/fhir/audit-event-outcome";
241            case _4: return "http://hl7.org/fhir/audit-event-outcome";
242            case _8: return "http://hl7.org/fhir/audit-event-outcome";
243            case _12: return "http://hl7.org/fhir/audit-event-outcome";
244            default: return "?";
245          }
246        }
247        public String getDefinition() {
248          switch (this) {
249            case _0: return "The operation completed successfully (whether with warnings or not).";
250            case _4: return "The action was not successful due to some kind of catered for error (often equivalent to an HTTP 400 response).";
251            case _8: return "The action was not successful due to some kind of unexpected error (often equivalent to an HTTP 500 response).";
252            case _12: return "An error of such magnitude occurred that the system is no longer available for use (i.e. the system died).";
253            default: return "?";
254          }
255        }
256        public String getDisplay() {
257          switch (this) {
258            case _0: return "Success";
259            case _4: return "Minor failure";
260            case _8: return "Serious failure";
261            case _12: return "Major failure";
262            default: return "?";
263          }
264        }
265    }
266
267  public static class AuditEventOutcomeEnumFactory implements EnumFactory<AuditEventOutcome> {
268    public AuditEventOutcome fromCode(String codeString) throws IllegalArgumentException {
269      if (codeString == null || "".equals(codeString))
270            if (codeString == null || "".equals(codeString))
271                return null;
272        if ("0".equals(codeString))
273          return AuditEventOutcome._0;
274        if ("4".equals(codeString))
275          return AuditEventOutcome._4;
276        if ("8".equals(codeString))
277          return AuditEventOutcome._8;
278        if ("12".equals(codeString))
279          return AuditEventOutcome._12;
280        throw new IllegalArgumentException("Unknown AuditEventOutcome code '"+codeString+"'");
281        }
282        public Enumeration<AuditEventOutcome> fromType(Base code) throws FHIRException {
283          if (code == null)
284            return null;
285          if (code.isEmpty())
286            return new Enumeration<AuditEventOutcome>(this);
287          String codeString = ((PrimitiveType) code).asStringValue();
288          if (codeString == null || "".equals(codeString))
289            return null;
290        if ("0".equals(codeString))
291          return new Enumeration<AuditEventOutcome>(this, AuditEventOutcome._0);
292        if ("4".equals(codeString))
293          return new Enumeration<AuditEventOutcome>(this, AuditEventOutcome._4);
294        if ("8".equals(codeString))
295          return new Enumeration<AuditEventOutcome>(this, AuditEventOutcome._8);
296        if ("12".equals(codeString))
297          return new Enumeration<AuditEventOutcome>(this, AuditEventOutcome._12);
298        throw new FHIRException("Unknown AuditEventOutcome code '"+codeString+"'");
299        }
300    public String toCode(AuditEventOutcome code) {
301      if (code == AuditEventOutcome._0)
302        return "0";
303      if (code == AuditEventOutcome._4)
304        return "4";
305      if (code == AuditEventOutcome._8)
306        return "8";
307      if (code == AuditEventOutcome._12)
308        return "12";
309      return "?";
310      }
311    public String toSystem(AuditEventOutcome code) {
312      return code.getSystem();
313      }
314    }
315
316    public enum AuditEventAgentNetworkType {
317        /**
318         * The machine name, including DNS name.
319         */
320        _1, 
321        /**
322         * The assigned Internet Protocol (IP) address.
323         */
324        _2, 
325        /**
326         * The assigned telephone number.
327         */
328        _3, 
329        /**
330         * The assigned email address.
331         */
332        _4, 
333        /**
334         * URI (User directory, HTTP-PUT, ftp, etc.).
335         */
336        _5, 
337        /**
338         * added to help the parsers with the generic types
339         */
340        NULL;
341        public static AuditEventAgentNetworkType fromCode(String codeString) throws FHIRException {
342            if (codeString == null || "".equals(codeString))
343                return null;
344        if ("1".equals(codeString))
345          return _1;
346        if ("2".equals(codeString))
347          return _2;
348        if ("3".equals(codeString))
349          return _3;
350        if ("4".equals(codeString))
351          return _4;
352        if ("5".equals(codeString))
353          return _5;
354        if (Configuration.isAcceptInvalidEnums())
355          return null;
356        else
357          throw new FHIRException("Unknown AuditEventAgentNetworkType code '"+codeString+"'");
358        }
359        public String toCode() {
360          switch (this) {
361            case _1: return "1";
362            case _2: return "2";
363            case _3: return "3";
364            case _4: return "4";
365            case _5: return "5";
366            default: return "?";
367          }
368        }
369        public String getSystem() {
370          switch (this) {
371            case _1: return "http://hl7.org/fhir/network-type";
372            case _2: return "http://hl7.org/fhir/network-type";
373            case _3: return "http://hl7.org/fhir/network-type";
374            case _4: return "http://hl7.org/fhir/network-type";
375            case _5: return "http://hl7.org/fhir/network-type";
376            default: return "?";
377          }
378        }
379        public String getDefinition() {
380          switch (this) {
381            case _1: return "The machine name, including DNS name.";
382            case _2: return "The assigned Internet Protocol (IP) address.";
383            case _3: return "The assigned telephone number.";
384            case _4: return "The assigned email address.";
385            case _5: return "URI (User directory, HTTP-PUT, ftp, etc.).";
386            default: return "?";
387          }
388        }
389        public String getDisplay() {
390          switch (this) {
391            case _1: return "Machine Name";
392            case _2: return "IP Address";
393            case _3: return "Telephone Number";
394            case _4: return "Email address";
395            case _5: return "URI";
396            default: return "?";
397          }
398        }
399    }
400
401  public static class AuditEventAgentNetworkTypeEnumFactory implements EnumFactory<AuditEventAgentNetworkType> {
402    public AuditEventAgentNetworkType fromCode(String codeString) throws IllegalArgumentException {
403      if (codeString == null || "".equals(codeString))
404            if (codeString == null || "".equals(codeString))
405                return null;
406        if ("1".equals(codeString))
407          return AuditEventAgentNetworkType._1;
408        if ("2".equals(codeString))
409          return AuditEventAgentNetworkType._2;
410        if ("3".equals(codeString))
411          return AuditEventAgentNetworkType._3;
412        if ("4".equals(codeString))
413          return AuditEventAgentNetworkType._4;
414        if ("5".equals(codeString))
415          return AuditEventAgentNetworkType._5;
416        throw new IllegalArgumentException("Unknown AuditEventAgentNetworkType code '"+codeString+"'");
417        }
418        public Enumeration<AuditEventAgentNetworkType> fromType(Base code) throws FHIRException {
419          if (code == null)
420            return null;
421          if (code.isEmpty())
422            return new Enumeration<AuditEventAgentNetworkType>(this);
423          String codeString = ((PrimitiveType) code).asStringValue();
424          if (codeString == null || "".equals(codeString))
425            return null;
426        if ("1".equals(codeString))
427          return new Enumeration<AuditEventAgentNetworkType>(this, AuditEventAgentNetworkType._1);
428        if ("2".equals(codeString))
429          return new Enumeration<AuditEventAgentNetworkType>(this, AuditEventAgentNetworkType._2);
430        if ("3".equals(codeString))
431          return new Enumeration<AuditEventAgentNetworkType>(this, AuditEventAgentNetworkType._3);
432        if ("4".equals(codeString))
433          return new Enumeration<AuditEventAgentNetworkType>(this, AuditEventAgentNetworkType._4);
434        if ("5".equals(codeString))
435          return new Enumeration<AuditEventAgentNetworkType>(this, AuditEventAgentNetworkType._5);
436        throw new FHIRException("Unknown AuditEventAgentNetworkType code '"+codeString+"'");
437        }
438    public String toCode(AuditEventAgentNetworkType code) {
439      if (code == AuditEventAgentNetworkType._1)
440        return "1";
441      if (code == AuditEventAgentNetworkType._2)
442        return "2";
443      if (code == AuditEventAgentNetworkType._3)
444        return "3";
445      if (code == AuditEventAgentNetworkType._4)
446        return "4";
447      if (code == AuditEventAgentNetworkType._5)
448        return "5";
449      return "?";
450      }
451    public String toSystem(AuditEventAgentNetworkType code) {
452      return code.getSystem();
453      }
454    }
455
456    @Block()
457    public static class AuditEventAgentComponent extends BackboneElement implements IBaseBackboneElement {
458        /**
459         * The security role that the user was acting under, that come from local codes defined by the access control security system (e.g. RBAC, ABAC) used in the local context.
460         */
461        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
462        @Description(shortDefinition="Agent role in the event", formalDefinition="The security role that the user was acting under, that come from local codes defined by the access control security system (e.g. RBAC, ABAC) used in the local context." )
463        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-role-type")
464        protected List<CodeableConcept> role;
465
466        /**
467         * Direct reference to a resource that identifies the agent.
468         */
469        @Child(name = "reference", type = {Practitioner.class, Organization.class, Device.class, Patient.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=true)
470        @Description(shortDefinition="Direct reference to resource", formalDefinition="Direct reference to a resource that identifies the agent." )
471        protected Reference reference;
472
473        /**
474         * The actual object that is the target of the reference (Direct reference to a resource that identifies the agent.)
475         */
476        protected Resource referenceTarget;
477
478        /**
479         * Unique identifier for the user actively participating in the event.
480         */
481        @Child(name = "userId", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
482        @Description(shortDefinition="Unique identifier for the user", formalDefinition="Unique identifier for the user actively participating in the event." )
483        protected Identifier userId;
484
485        /**
486         * Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.
487         */
488        @Child(name = "altId", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
489        @Description(shortDefinition="Alternative User id e.g. authentication", formalDefinition="Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available." )
490        protected StringType altId;
491
492        /**
493         * Human-meaningful name for the agent.
494         */
495        @Child(name = "name", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
496        @Description(shortDefinition="Human-meaningful name for the agent", formalDefinition="Human-meaningful name for the agent." )
497        protected StringType name;
498
499        /**
500         * Indicator that the user is or is not the requestor, or initiator, for the event being audited.
501         */
502        @Child(name = "requestor", type = {BooleanType.class}, order=6, min=1, max=1, modifier=false, summary=false)
503        @Description(shortDefinition="Whether user is initiator", formalDefinition="Indicator that the user is or is not the requestor, or initiator, for the event being audited." )
504        protected BooleanType requestor;
505
506        /**
507         * Where the event occurred.
508         */
509        @Child(name = "location", type = {Location.class}, order=7, min=0, max=1, modifier=false, summary=false)
510        @Description(shortDefinition="Where", formalDefinition="Where the event occurred." )
511        protected Reference location;
512
513        /**
514         * The actual object that is the target of the reference (Where the event occurred.)
515         */
516        protected Location locationTarget;
517
518        /**
519         * The policy or plan that authorized the activity being recorded. 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.
520         */
521        @Child(name = "policy", type = {UriType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
522        @Description(shortDefinition="Policy that authorized event", formalDefinition="The policy or plan that authorized the activity being recorded. 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." )
523        protected List<UriType> policy;
524
525        /**
526         * Type of media involved. Used when the event is about exporting/importing onto media.
527         */
528        @Child(name = "media", type = {Coding.class}, order=9, min=0, max=1, modifier=false, summary=false)
529        @Description(shortDefinition="Type of media", formalDefinition="Type of media involved. Used when the event is about exporting/importing onto media." )
530        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/dicm-405-mediatype")
531        protected Coding media;
532
533        /**
534         * Logical network location for application activity, if the activity has a network location.
535         */
536        @Child(name = "network", type = {}, order=10, min=0, max=1, modifier=false, summary=false)
537        @Description(shortDefinition="Logical network location for application activity", formalDefinition="Logical network location for application activity, if the activity has a network location." )
538        protected AuditEventAgentNetworkComponent network;
539
540        /**
541         * The reason (purpose of use), specific to this agent, that was used during the event being recorded.
542         */
543        @Child(name = "purposeOfUse", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
544        @Description(shortDefinition="Reason given for this user", formalDefinition="The reason (purpose of use), specific to this agent, that was used during the event being recorded." )
545        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
546        protected List<CodeableConcept> purposeOfUse;
547
548        private static final long serialVersionUID = 1205071410L;
549
550    /**
551     * Constructor
552     */
553      public AuditEventAgentComponent() {
554        super();
555      }
556
557    /**
558     * Constructor
559     */
560      public AuditEventAgentComponent(BooleanType requestor) {
561        super();
562        this.requestor = requestor;
563      }
564
565        /**
566         * @return {@link #role} (The security role that the user was acting under, that come from local codes defined by the access control security system (e.g. RBAC, ABAC) used in the local context.)
567         */
568        public List<CodeableConcept> getRole() { 
569          if (this.role == null)
570            this.role = new ArrayList<CodeableConcept>();
571          return this.role;
572        }
573
574        /**
575         * @return Returns a reference to <code>this</code> for easy method chaining
576         */
577        public AuditEventAgentComponent setRole(List<CodeableConcept> theRole) { 
578          this.role = theRole;
579          return this;
580        }
581
582        public boolean hasRole() { 
583          if (this.role == null)
584            return false;
585          for (CodeableConcept item : this.role)
586            if (!item.isEmpty())
587              return true;
588          return false;
589        }
590
591        public CodeableConcept addRole() { //3
592          CodeableConcept t = new CodeableConcept();
593          if (this.role == null)
594            this.role = new ArrayList<CodeableConcept>();
595          this.role.add(t);
596          return t;
597        }
598
599        public AuditEventAgentComponent addRole(CodeableConcept t) { //3
600          if (t == null)
601            return this;
602          if (this.role == null)
603            this.role = new ArrayList<CodeableConcept>();
604          this.role.add(t);
605          return this;
606        }
607
608        /**
609         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
610         */
611        public CodeableConcept getRoleFirstRep() { 
612          if (getRole().isEmpty()) {
613            addRole();
614          }
615          return getRole().get(0);
616        }
617
618        /**
619         * @return {@link #reference} (Direct reference to a resource that identifies the agent.)
620         */
621        public Reference getReference() { 
622          if (this.reference == null)
623            if (Configuration.errorOnAutoCreate())
624              throw new Error("Attempt to auto-create AuditEventAgentComponent.reference");
625            else if (Configuration.doAutoCreate())
626              this.reference = new Reference(); // cc
627          return this.reference;
628        }
629
630        public boolean hasReference() { 
631          return this.reference != null && !this.reference.isEmpty();
632        }
633
634        /**
635         * @param value {@link #reference} (Direct reference to a resource that identifies the agent.)
636         */
637        public AuditEventAgentComponent setReference(Reference value) { 
638          this.reference = value;
639          return this;
640        }
641
642        /**
643         * @return {@link #reference} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Direct reference to a resource that identifies the agent.)
644         */
645        public Resource getReferenceTarget() { 
646          return this.referenceTarget;
647        }
648
649        /**
650         * @param value {@link #reference} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Direct reference to a resource that identifies the agent.)
651         */
652        public AuditEventAgentComponent setReferenceTarget(Resource value) { 
653          this.referenceTarget = value;
654          return this;
655        }
656
657        /**
658         * @return {@link #userId} (Unique identifier for the user actively participating in the event.)
659         */
660        public Identifier getUserId() { 
661          if (this.userId == null)
662            if (Configuration.errorOnAutoCreate())
663              throw new Error("Attempt to auto-create AuditEventAgentComponent.userId");
664            else if (Configuration.doAutoCreate())
665              this.userId = new Identifier(); // cc
666          return this.userId;
667        }
668
669        public boolean hasUserId() { 
670          return this.userId != null && !this.userId.isEmpty();
671        }
672
673        /**
674         * @param value {@link #userId} (Unique identifier for the user actively participating in the event.)
675         */
676        public AuditEventAgentComponent setUserId(Identifier value) { 
677          this.userId = value;
678          return this;
679        }
680
681        /**
682         * @return {@link #altId} (Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.). This is the underlying object with id, value and extensions. The accessor "getAltId" gives direct access to the value
683         */
684        public StringType getAltIdElement() { 
685          if (this.altId == null)
686            if (Configuration.errorOnAutoCreate())
687              throw new Error("Attempt to auto-create AuditEventAgentComponent.altId");
688            else if (Configuration.doAutoCreate())
689              this.altId = new StringType(); // bb
690          return this.altId;
691        }
692
693        public boolean hasAltIdElement() { 
694          return this.altId != null && !this.altId.isEmpty();
695        }
696
697        public boolean hasAltId() { 
698          return this.altId != null && !this.altId.isEmpty();
699        }
700
701        /**
702         * @param value {@link #altId} (Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.). This is the underlying object with id, value and extensions. The accessor "getAltId" gives direct access to the value
703         */
704        public AuditEventAgentComponent setAltIdElement(StringType value) { 
705          this.altId = value;
706          return this;
707        }
708
709        /**
710         * @return Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.
711         */
712        public String getAltId() { 
713          return this.altId == null ? null : this.altId.getValue();
714        }
715
716        /**
717         * @param value Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.
718         */
719        public AuditEventAgentComponent setAltId(String value) { 
720          if (Utilities.noString(value))
721            this.altId = null;
722          else {
723            if (this.altId == null)
724              this.altId = new StringType();
725            this.altId.setValue(value);
726          }
727          return this;
728        }
729
730        /**
731         * @return {@link #name} (Human-meaningful name for the agent.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
732         */
733        public StringType getNameElement() { 
734          if (this.name == null)
735            if (Configuration.errorOnAutoCreate())
736              throw new Error("Attempt to auto-create AuditEventAgentComponent.name");
737            else if (Configuration.doAutoCreate())
738              this.name = new StringType(); // bb
739          return this.name;
740        }
741
742        public boolean hasNameElement() { 
743          return this.name != null && !this.name.isEmpty();
744        }
745
746        public boolean hasName() { 
747          return this.name != null && !this.name.isEmpty();
748        }
749
750        /**
751         * @param value {@link #name} (Human-meaningful name for the agent.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
752         */
753        public AuditEventAgentComponent setNameElement(StringType value) { 
754          this.name = value;
755          return this;
756        }
757
758        /**
759         * @return Human-meaningful name for the agent.
760         */
761        public String getName() { 
762          return this.name == null ? null : this.name.getValue();
763        }
764
765        /**
766         * @param value Human-meaningful name for the agent.
767         */
768        public AuditEventAgentComponent setName(String value) { 
769          if (Utilities.noString(value))
770            this.name = null;
771          else {
772            if (this.name == null)
773              this.name = new StringType();
774            this.name.setValue(value);
775          }
776          return this;
777        }
778
779        /**
780         * @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
781         */
782        public BooleanType getRequestorElement() { 
783          if (this.requestor == null)
784            if (Configuration.errorOnAutoCreate())
785              throw new Error("Attempt to auto-create AuditEventAgentComponent.requestor");
786            else if (Configuration.doAutoCreate())
787              this.requestor = new BooleanType(); // bb
788          return this.requestor;
789        }
790
791        public boolean hasRequestorElement() { 
792          return this.requestor != null && !this.requestor.isEmpty();
793        }
794
795        public boolean hasRequestor() { 
796          return this.requestor != null && !this.requestor.isEmpty();
797        }
798
799        /**
800         * @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
801         */
802        public AuditEventAgentComponent setRequestorElement(BooleanType value) { 
803          this.requestor = value;
804          return this;
805        }
806
807        /**
808         * @return Indicator that the user is or is not the requestor, or initiator, for the event being audited.
809         */
810        public boolean getRequestor() { 
811          return this.requestor == null || this.requestor.isEmpty() ? false : this.requestor.getValue();
812        }
813
814        /**
815         * @param value Indicator that the user is or is not the requestor, or initiator, for the event being audited.
816         */
817        public AuditEventAgentComponent setRequestor(boolean value) { 
818            if (this.requestor == null)
819              this.requestor = new BooleanType();
820            this.requestor.setValue(value);
821          return this;
822        }
823
824        /**
825         * @return {@link #location} (Where the event occurred.)
826         */
827        public Reference getLocation() { 
828          if (this.location == null)
829            if (Configuration.errorOnAutoCreate())
830              throw new Error("Attempt to auto-create AuditEventAgentComponent.location");
831            else if (Configuration.doAutoCreate())
832              this.location = new Reference(); // cc
833          return this.location;
834        }
835
836        public boolean hasLocation() { 
837          return this.location != null && !this.location.isEmpty();
838        }
839
840        /**
841         * @param value {@link #location} (Where the event occurred.)
842         */
843        public AuditEventAgentComponent setLocation(Reference value) { 
844          this.location = value;
845          return this;
846        }
847
848        /**
849         * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Where the event occurred.)
850         */
851        public Location getLocationTarget() { 
852          if (this.locationTarget == null)
853            if (Configuration.errorOnAutoCreate())
854              throw new Error("Attempt to auto-create AuditEventAgentComponent.location");
855            else if (Configuration.doAutoCreate())
856              this.locationTarget = new Location(); // aa
857          return this.locationTarget;
858        }
859
860        /**
861         * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Where the event occurred.)
862         */
863        public AuditEventAgentComponent setLocationTarget(Location value) { 
864          this.locationTarget = value;
865          return this;
866        }
867
868        /**
869         * @return {@link #policy} (The policy or plan that authorized the activity being recorded. 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.)
870         */
871        public List<UriType> getPolicy() { 
872          if (this.policy == null)
873            this.policy = new ArrayList<UriType>();
874          return this.policy;
875        }
876
877        /**
878         * @return Returns a reference to <code>this</code> for easy method chaining
879         */
880        public AuditEventAgentComponent setPolicy(List<UriType> thePolicy) { 
881          this.policy = thePolicy;
882          return this;
883        }
884
885        public boolean hasPolicy() { 
886          if (this.policy == null)
887            return false;
888          for (UriType item : this.policy)
889            if (!item.isEmpty())
890              return true;
891          return false;
892        }
893
894        /**
895         * @return {@link #policy} (The policy or plan that authorized the activity being recorded. 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.)
896         */
897        public UriType addPolicyElement() {//2 
898          UriType t = new UriType();
899          if (this.policy == null)
900            this.policy = new ArrayList<UriType>();
901          this.policy.add(t);
902          return t;
903        }
904
905        /**
906         * @param value {@link #policy} (The policy or plan that authorized the activity being recorded. 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.)
907         */
908        public AuditEventAgentComponent addPolicy(String value) { //1
909          UriType t = new UriType();
910          t.setValue(value);
911          if (this.policy == null)
912            this.policy = new ArrayList<UriType>();
913          this.policy.add(t);
914          return this;
915        }
916
917        /**
918         * @param value {@link #policy} (The policy or plan that authorized the activity being recorded. 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.)
919         */
920        public boolean hasPolicy(String value) { 
921          if (this.policy == null)
922            return false;
923          for (UriType v : this.policy)
924            if (v.equals(value)) // uri
925              return true;
926          return false;
927        }
928
929        /**
930         * @return {@link #media} (Type of media involved. Used when the event is about exporting/importing onto media.)
931         */
932        public Coding getMedia() { 
933          if (this.media == null)
934            if (Configuration.errorOnAutoCreate())
935              throw new Error("Attempt to auto-create AuditEventAgentComponent.media");
936            else if (Configuration.doAutoCreate())
937              this.media = new Coding(); // cc
938          return this.media;
939        }
940
941        public boolean hasMedia() { 
942          return this.media != null && !this.media.isEmpty();
943        }
944
945        /**
946         * @param value {@link #media} (Type of media involved. Used when the event is about exporting/importing onto media.)
947         */
948        public AuditEventAgentComponent setMedia(Coding value) { 
949          this.media = value;
950          return this;
951        }
952
953        /**
954         * @return {@link #network} (Logical network location for application activity, if the activity has a network location.)
955         */
956        public AuditEventAgentNetworkComponent getNetwork() { 
957          if (this.network == null)
958            if (Configuration.errorOnAutoCreate())
959              throw new Error("Attempt to auto-create AuditEventAgentComponent.network");
960            else if (Configuration.doAutoCreate())
961              this.network = new AuditEventAgentNetworkComponent(); // cc
962          return this.network;
963        }
964
965        public boolean hasNetwork() { 
966          return this.network != null && !this.network.isEmpty();
967        }
968
969        /**
970         * @param value {@link #network} (Logical network location for application activity, if the activity has a network location.)
971         */
972        public AuditEventAgentComponent setNetwork(AuditEventAgentNetworkComponent value) { 
973          this.network = value;
974          return this;
975        }
976
977        /**
978         * @return {@link #purposeOfUse} (The reason (purpose of use), specific to this agent, that was used during the event being recorded.)
979         */
980        public List<CodeableConcept> getPurposeOfUse() { 
981          if (this.purposeOfUse == null)
982            this.purposeOfUse = new ArrayList<CodeableConcept>();
983          return this.purposeOfUse;
984        }
985
986        /**
987         * @return Returns a reference to <code>this</code> for easy method chaining
988         */
989        public AuditEventAgentComponent setPurposeOfUse(List<CodeableConcept> thePurposeOfUse) { 
990          this.purposeOfUse = thePurposeOfUse;
991          return this;
992        }
993
994        public boolean hasPurposeOfUse() { 
995          if (this.purposeOfUse == null)
996            return false;
997          for (CodeableConcept item : this.purposeOfUse)
998            if (!item.isEmpty())
999              return true;
1000          return false;
1001        }
1002
1003        public CodeableConcept addPurposeOfUse() { //3
1004          CodeableConcept t = new CodeableConcept();
1005          if (this.purposeOfUse == null)
1006            this.purposeOfUse = new ArrayList<CodeableConcept>();
1007          this.purposeOfUse.add(t);
1008          return t;
1009        }
1010
1011        public AuditEventAgentComponent addPurposeOfUse(CodeableConcept t) { //3
1012          if (t == null)
1013            return this;
1014          if (this.purposeOfUse == null)
1015            this.purposeOfUse = new ArrayList<CodeableConcept>();
1016          this.purposeOfUse.add(t);
1017          return this;
1018        }
1019
1020        /**
1021         * @return The first repetition of repeating field {@link #purposeOfUse}, creating it if it does not already exist
1022         */
1023        public CodeableConcept getPurposeOfUseFirstRep() { 
1024          if (getPurposeOfUse().isEmpty()) {
1025            addPurposeOfUse();
1026          }
1027          return getPurposeOfUse().get(0);
1028        }
1029
1030        protected void listChildren(List<Property> childrenList) {
1031          super.listChildren(childrenList);
1032          childrenList.add(new Property("role", "CodeableConcept", "The security role that the user was acting under, that come from local codes defined by the access control security system (e.g. RBAC, ABAC) used in the local context.", 0, java.lang.Integer.MAX_VALUE, role));
1033          childrenList.add(new Property("reference", "Reference(Practitioner|Organization|Device|Patient|RelatedPerson)", "Direct reference to a resource that identifies the agent.", 0, java.lang.Integer.MAX_VALUE, reference));
1034          childrenList.add(new Property("userId", "Identifier", "Unique identifier for the user actively participating in the event.", 0, java.lang.Integer.MAX_VALUE, userId));
1035          childrenList.add(new Property("altId", "string", "Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.", 0, java.lang.Integer.MAX_VALUE, altId));
1036          childrenList.add(new Property("name", "string", "Human-meaningful name for the agent.", 0, java.lang.Integer.MAX_VALUE, name));
1037          childrenList.add(new Property("requestor", "boolean", "Indicator that the user is or is not the requestor, or initiator, for the event being audited.", 0, java.lang.Integer.MAX_VALUE, requestor));
1038          childrenList.add(new Property("location", "Reference(Location)", "Where the event occurred.", 0, java.lang.Integer.MAX_VALUE, location));
1039          childrenList.add(new Property("policy", "uri", "The policy or plan that authorized the activity being recorded. 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));
1040          childrenList.add(new Property("media", "Coding", "Type of media involved. Used when the event is about exporting/importing onto media.", 0, java.lang.Integer.MAX_VALUE, media));
1041          childrenList.add(new Property("network", "", "Logical network location for application activity, if the activity has a network location.", 0, java.lang.Integer.MAX_VALUE, network));
1042          childrenList.add(new Property("purposeOfUse", "CodeableConcept", "The reason (purpose of use), specific to this agent, that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, purposeOfUse));
1043        }
1044
1045      @Override
1046      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1047        switch (hash) {
1048        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
1049        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
1050        case -836030906: /*userId*/ return this.userId == null ? new Base[0] : new Base[] {this.userId}; // Identifier
1051        case 92912804: /*altId*/ return this.altId == null ? new Base[0] : new Base[] {this.altId}; // StringType
1052        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1053        case 693934258: /*requestor*/ return this.requestor == null ? new Base[0] : new Base[] {this.requestor}; // BooleanType
1054        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1055        case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // UriType
1056        case 103772132: /*media*/ return this.media == null ? new Base[0] : new Base[] {this.media}; // Coding
1057        case 1843485230: /*network*/ return this.network == null ? new Base[0] : new Base[] {this.network}; // AuditEventAgentNetworkComponent
1058        case -1881902670: /*purposeOfUse*/ return this.purposeOfUse == null ? new Base[0] : this.purposeOfUse.toArray(new Base[this.purposeOfUse.size()]); // CodeableConcept
1059        default: return super.getProperty(hash, name, checkValid);
1060        }
1061
1062      }
1063
1064      @Override
1065      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1066        switch (hash) {
1067        case 3506294: // role
1068          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
1069          return value;
1070        case -925155509: // reference
1071          this.reference = castToReference(value); // Reference
1072          return value;
1073        case -836030906: // userId
1074          this.userId = castToIdentifier(value); // Identifier
1075          return value;
1076        case 92912804: // altId
1077          this.altId = castToString(value); // StringType
1078          return value;
1079        case 3373707: // name
1080          this.name = castToString(value); // StringType
1081          return value;
1082        case 693934258: // requestor
1083          this.requestor = castToBoolean(value); // BooleanType
1084          return value;
1085        case 1901043637: // location
1086          this.location = castToReference(value); // Reference
1087          return value;
1088        case -982670030: // policy
1089          this.getPolicy().add(castToUri(value)); // UriType
1090          return value;
1091        case 103772132: // media
1092          this.media = castToCoding(value); // Coding
1093          return value;
1094        case 1843485230: // network
1095          this.network = (AuditEventAgentNetworkComponent) value; // AuditEventAgentNetworkComponent
1096          return value;
1097        case -1881902670: // purposeOfUse
1098          this.getPurposeOfUse().add(castToCodeableConcept(value)); // CodeableConcept
1099          return value;
1100        default: return super.setProperty(hash, name, value);
1101        }
1102
1103      }
1104
1105      @Override
1106      public Base setProperty(String name, Base value) throws FHIRException {
1107        if (name.equals("role")) {
1108          this.getRole().add(castToCodeableConcept(value));
1109        } else if (name.equals("reference")) {
1110          this.reference = castToReference(value); // Reference
1111        } else if (name.equals("userId")) {
1112          this.userId = castToIdentifier(value); // Identifier
1113        } else if (name.equals("altId")) {
1114          this.altId = castToString(value); // StringType
1115        } else if (name.equals("name")) {
1116          this.name = castToString(value); // StringType
1117        } else if (name.equals("requestor")) {
1118          this.requestor = castToBoolean(value); // BooleanType
1119        } else if (name.equals("location")) {
1120          this.location = castToReference(value); // Reference
1121        } else if (name.equals("policy")) {
1122          this.getPolicy().add(castToUri(value));
1123        } else if (name.equals("media")) {
1124          this.media = castToCoding(value); // Coding
1125        } else if (name.equals("network")) {
1126          this.network = (AuditEventAgentNetworkComponent) value; // AuditEventAgentNetworkComponent
1127        } else if (name.equals("purposeOfUse")) {
1128          this.getPurposeOfUse().add(castToCodeableConcept(value));
1129        } else
1130          return super.setProperty(name, value);
1131        return value;
1132      }
1133
1134      @Override
1135      public Base makeProperty(int hash, String name) throws FHIRException {
1136        switch (hash) {
1137        case 3506294:  return addRole(); 
1138        case -925155509:  return getReference(); 
1139        case -836030906:  return getUserId(); 
1140        case 92912804:  return getAltIdElement();
1141        case 3373707:  return getNameElement();
1142        case 693934258:  return getRequestorElement();
1143        case 1901043637:  return getLocation(); 
1144        case -982670030:  return addPolicyElement();
1145        case 103772132:  return getMedia(); 
1146        case 1843485230:  return getNetwork(); 
1147        case -1881902670:  return addPurposeOfUse(); 
1148        default: return super.makeProperty(hash, name);
1149        }
1150
1151      }
1152
1153      @Override
1154      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1155        switch (hash) {
1156        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1157        case -925155509: /*reference*/ return new String[] {"Reference"};
1158        case -836030906: /*userId*/ return new String[] {"Identifier"};
1159        case 92912804: /*altId*/ return new String[] {"string"};
1160        case 3373707: /*name*/ return new String[] {"string"};
1161        case 693934258: /*requestor*/ return new String[] {"boolean"};
1162        case 1901043637: /*location*/ return new String[] {"Reference"};
1163        case -982670030: /*policy*/ return new String[] {"uri"};
1164        case 103772132: /*media*/ return new String[] {"Coding"};
1165        case 1843485230: /*network*/ return new String[] {};
1166        case -1881902670: /*purposeOfUse*/ return new String[] {"CodeableConcept"};
1167        default: return super.getTypesForProperty(hash, name);
1168        }
1169
1170      }
1171
1172      @Override
1173      public Base addChild(String name) throws FHIRException {
1174        if (name.equals("role")) {
1175          return addRole();
1176        }
1177        else if (name.equals("reference")) {
1178          this.reference = new Reference();
1179          return this.reference;
1180        }
1181        else if (name.equals("userId")) {
1182          this.userId = new Identifier();
1183          return this.userId;
1184        }
1185        else if (name.equals("altId")) {
1186          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.altId");
1187        }
1188        else if (name.equals("name")) {
1189          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.name");
1190        }
1191        else if (name.equals("requestor")) {
1192          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.requestor");
1193        }
1194        else if (name.equals("location")) {
1195          this.location = new Reference();
1196          return this.location;
1197        }
1198        else if (name.equals("policy")) {
1199          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.policy");
1200        }
1201        else if (name.equals("media")) {
1202          this.media = new Coding();
1203          return this.media;
1204        }
1205        else if (name.equals("network")) {
1206          this.network = new AuditEventAgentNetworkComponent();
1207          return this.network;
1208        }
1209        else if (name.equals("purposeOfUse")) {
1210          return addPurposeOfUse();
1211        }
1212        else
1213          return super.addChild(name);
1214      }
1215
1216      public AuditEventAgentComponent copy() {
1217        AuditEventAgentComponent dst = new AuditEventAgentComponent();
1218        copyValues(dst);
1219        if (role != null) {
1220          dst.role = new ArrayList<CodeableConcept>();
1221          for (CodeableConcept i : role)
1222            dst.role.add(i.copy());
1223        };
1224        dst.reference = reference == null ? null : reference.copy();
1225        dst.userId = userId == null ? null : userId.copy();
1226        dst.altId = altId == null ? null : altId.copy();
1227        dst.name = name == null ? null : name.copy();
1228        dst.requestor = requestor == null ? null : requestor.copy();
1229        dst.location = location == null ? null : location.copy();
1230        if (policy != null) {
1231          dst.policy = new ArrayList<UriType>();
1232          for (UriType i : policy)
1233            dst.policy.add(i.copy());
1234        };
1235        dst.media = media == null ? null : media.copy();
1236        dst.network = network == null ? null : network.copy();
1237        if (purposeOfUse != null) {
1238          dst.purposeOfUse = new ArrayList<CodeableConcept>();
1239          for (CodeableConcept i : purposeOfUse)
1240            dst.purposeOfUse.add(i.copy());
1241        };
1242        return dst;
1243      }
1244
1245      @Override
1246      public boolean equalsDeep(Base other) {
1247        if (!super.equalsDeep(other))
1248          return false;
1249        if (!(other instanceof AuditEventAgentComponent))
1250          return false;
1251        AuditEventAgentComponent o = (AuditEventAgentComponent) other;
1252        return compareDeep(role, o.role, true) && compareDeep(reference, o.reference, true) && compareDeep(userId, o.userId, true)
1253           && compareDeep(altId, o.altId, true) && compareDeep(name, o.name, true) && compareDeep(requestor, o.requestor, true)
1254           && compareDeep(location, o.location, true) && compareDeep(policy, o.policy, true) && compareDeep(media, o.media, true)
1255           && compareDeep(network, o.network, true) && compareDeep(purposeOfUse, o.purposeOfUse, true);
1256      }
1257
1258      @Override
1259      public boolean equalsShallow(Base other) {
1260        if (!super.equalsShallow(other))
1261          return false;
1262        if (!(other instanceof AuditEventAgentComponent))
1263          return false;
1264        AuditEventAgentComponent o = (AuditEventAgentComponent) other;
1265        return compareValues(altId, o.altId, true) && compareValues(name, o.name, true) && compareValues(requestor, o.requestor, true)
1266           && compareValues(policy, o.policy, true);
1267      }
1268
1269      public boolean isEmpty() {
1270        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, reference, userId
1271          , altId, name, requestor, location, policy, media, network, purposeOfUse);
1272      }
1273
1274  public String fhirType() {
1275    return "AuditEvent.agent";
1276
1277  }
1278
1279  }
1280
1281    @Block()
1282    public static class AuditEventAgentNetworkComponent extends BackboneElement implements IBaseBackboneElement {
1283        /**
1284         * An identifier for the network access point of the user device for the audit event.
1285         */
1286        @Child(name = "address", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1287        @Description(shortDefinition="Identifier for the network access point of the user device", formalDefinition="An identifier for the network access point of the user device for the audit event." )
1288        protected StringType address;
1289
1290        /**
1291         * An identifier for the type of network access point that originated the audit event.
1292         */
1293        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1294        @Description(shortDefinition="The type of network access point", formalDefinition="An identifier for the type of network access point that originated the audit event." )
1295        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/network-type")
1296        protected Enumeration<AuditEventAgentNetworkType> type;
1297
1298        private static final long serialVersionUID = -160715924L;
1299
1300    /**
1301     * Constructor
1302     */
1303      public AuditEventAgentNetworkComponent() {
1304        super();
1305      }
1306
1307        /**
1308         * @return {@link #address} (An identifier for the network access point of the user device for the audit event.). This is the underlying object with id, value and extensions. The accessor "getAddress" gives direct access to the value
1309         */
1310        public StringType getAddressElement() { 
1311          if (this.address == null)
1312            if (Configuration.errorOnAutoCreate())
1313              throw new Error("Attempt to auto-create AuditEventAgentNetworkComponent.address");
1314            else if (Configuration.doAutoCreate())
1315              this.address = new StringType(); // bb
1316          return this.address;
1317        }
1318
1319        public boolean hasAddressElement() { 
1320          return this.address != null && !this.address.isEmpty();
1321        }
1322
1323        public boolean hasAddress() { 
1324          return this.address != null && !this.address.isEmpty();
1325        }
1326
1327        /**
1328         * @param value {@link #address} (An identifier for the network access point of the user device for the audit event.). This is the underlying object with id, value and extensions. The accessor "getAddress" gives direct access to the value
1329         */
1330        public AuditEventAgentNetworkComponent setAddressElement(StringType value) { 
1331          this.address = value;
1332          return this;
1333        }
1334
1335        /**
1336         * @return An identifier for the network access point of the user device for the audit event.
1337         */
1338        public String getAddress() { 
1339          return this.address == null ? null : this.address.getValue();
1340        }
1341
1342        /**
1343         * @param value An identifier for the network access point of the user device for the audit event.
1344         */
1345        public AuditEventAgentNetworkComponent setAddress(String value) { 
1346          if (Utilities.noString(value))
1347            this.address = null;
1348          else {
1349            if (this.address == null)
1350              this.address = new StringType();
1351            this.address.setValue(value);
1352          }
1353          return this;
1354        }
1355
1356        /**
1357         * @return {@link #type} (An identifier for the type of network access point that originated the audit event.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1358         */
1359        public Enumeration<AuditEventAgentNetworkType> getTypeElement() { 
1360          if (this.type == null)
1361            if (Configuration.errorOnAutoCreate())
1362              throw new Error("Attempt to auto-create AuditEventAgentNetworkComponent.type");
1363            else if (Configuration.doAutoCreate())
1364              this.type = new Enumeration<AuditEventAgentNetworkType>(new AuditEventAgentNetworkTypeEnumFactory()); // bb
1365          return this.type;
1366        }
1367
1368        public boolean hasTypeElement() { 
1369          return this.type != null && !this.type.isEmpty();
1370        }
1371
1372        public boolean hasType() { 
1373          return this.type != null && !this.type.isEmpty();
1374        }
1375
1376        /**
1377         * @param value {@link #type} (An identifier for the type of network access point that originated the audit event.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1378         */
1379        public AuditEventAgentNetworkComponent setTypeElement(Enumeration<AuditEventAgentNetworkType> value) { 
1380          this.type = value;
1381          return this;
1382        }
1383
1384        /**
1385         * @return An identifier for the type of network access point that originated the audit event.
1386         */
1387        public AuditEventAgentNetworkType getType() { 
1388          return this.type == null ? null : this.type.getValue();
1389        }
1390
1391        /**
1392         * @param value An identifier for the type of network access point that originated the audit event.
1393         */
1394        public AuditEventAgentNetworkComponent setType(AuditEventAgentNetworkType value) { 
1395          if (value == null)
1396            this.type = null;
1397          else {
1398            if (this.type == null)
1399              this.type = new Enumeration<AuditEventAgentNetworkType>(new AuditEventAgentNetworkTypeEnumFactory());
1400            this.type.setValue(value);
1401          }
1402          return this;
1403        }
1404
1405        protected void listChildren(List<Property> childrenList) {
1406          super.listChildren(childrenList);
1407          childrenList.add(new Property("address", "string", "An identifier for the network access point of the user device for the audit event.", 0, java.lang.Integer.MAX_VALUE, address));
1408          childrenList.add(new Property("type", "code", "An identifier for the type of network access point that originated the audit event.", 0, java.lang.Integer.MAX_VALUE, type));
1409        }
1410
1411      @Override
1412      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1413        switch (hash) {
1414        case -1147692044: /*address*/ return this.address == null ? new Base[0] : new Base[] {this.address}; // StringType
1415        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<AuditEventAgentNetworkType>
1416        default: return super.getProperty(hash, name, checkValid);
1417        }
1418
1419      }
1420
1421      @Override
1422      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1423        switch (hash) {
1424        case -1147692044: // address
1425          this.address = castToString(value); // StringType
1426          return value;
1427        case 3575610: // type
1428          value = new AuditEventAgentNetworkTypeEnumFactory().fromType(castToCode(value));
1429          this.type = (Enumeration) value; // Enumeration<AuditEventAgentNetworkType>
1430          return value;
1431        default: return super.setProperty(hash, name, value);
1432        }
1433
1434      }
1435
1436      @Override
1437      public Base setProperty(String name, Base value) throws FHIRException {
1438        if (name.equals("address")) {
1439          this.address = castToString(value); // StringType
1440        } else if (name.equals("type")) {
1441          value = new AuditEventAgentNetworkTypeEnumFactory().fromType(castToCode(value));
1442          this.type = (Enumeration) value; // Enumeration<AuditEventAgentNetworkType>
1443        } else
1444          return super.setProperty(name, value);
1445        return value;
1446      }
1447
1448      @Override
1449      public Base makeProperty(int hash, String name) throws FHIRException {
1450        switch (hash) {
1451        case -1147692044:  return getAddressElement();
1452        case 3575610:  return getTypeElement();
1453        default: return super.makeProperty(hash, name);
1454        }
1455
1456      }
1457
1458      @Override
1459      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1460        switch (hash) {
1461        case -1147692044: /*address*/ return new String[] {"string"};
1462        case 3575610: /*type*/ return new String[] {"code"};
1463        default: return super.getTypesForProperty(hash, name);
1464        }
1465
1466      }
1467
1468      @Override
1469      public Base addChild(String name) throws FHIRException {
1470        if (name.equals("address")) {
1471          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.address");
1472        }
1473        else if (name.equals("type")) {
1474          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.type");
1475        }
1476        else
1477          return super.addChild(name);
1478      }
1479
1480      public AuditEventAgentNetworkComponent copy() {
1481        AuditEventAgentNetworkComponent dst = new AuditEventAgentNetworkComponent();
1482        copyValues(dst);
1483        dst.address = address == null ? null : address.copy();
1484        dst.type = type == null ? null : type.copy();
1485        return dst;
1486      }
1487
1488      @Override
1489      public boolean equalsDeep(Base other) {
1490        if (!super.equalsDeep(other))
1491          return false;
1492        if (!(other instanceof AuditEventAgentNetworkComponent))
1493          return false;
1494        AuditEventAgentNetworkComponent o = (AuditEventAgentNetworkComponent) other;
1495        return compareDeep(address, o.address, true) && compareDeep(type, o.type, true);
1496      }
1497
1498      @Override
1499      public boolean equalsShallow(Base other) {
1500        if (!super.equalsShallow(other))
1501          return false;
1502        if (!(other instanceof AuditEventAgentNetworkComponent))
1503          return false;
1504        AuditEventAgentNetworkComponent o = (AuditEventAgentNetworkComponent) other;
1505        return compareValues(address, o.address, true) && compareValues(type, o.type, true);
1506      }
1507
1508      public boolean isEmpty() {
1509        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(address, type);
1510      }
1511
1512  public String fhirType() {
1513    return "AuditEvent.agent.network";
1514
1515  }
1516
1517  }
1518
1519    @Block()
1520    public static class AuditEventSourceComponent extends BackboneElement implements IBaseBackboneElement {
1521        /**
1522         * Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.
1523         */
1524        @Child(name = "site", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1525        @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." )
1526        protected StringType site;
1527
1528        /**
1529         * Identifier of the source where the event was detected.
1530         */
1531        @Child(name = "identifier", type = {Identifier.class}, order=2, min=1, max=1, modifier=false, summary=true)
1532        @Description(shortDefinition="The identity of source detecting the event", formalDefinition="Identifier of the source where the event was detected." )
1533        protected Identifier identifier;
1534
1535        /**
1536         * Code specifying the type of source where event originated.
1537         */
1538        @Child(name = "type", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1539        @Description(shortDefinition="The type of source where event originated", formalDefinition="Code specifying the type of source where event originated." )
1540        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-source-type")
1541        protected List<Coding> type;
1542
1543        private static final long serialVersionUID = -1562673890L;
1544
1545    /**
1546     * Constructor
1547     */
1548      public AuditEventSourceComponent() {
1549        super();
1550      }
1551
1552    /**
1553     * Constructor
1554     */
1555      public AuditEventSourceComponent(Identifier identifier) {
1556        super();
1557        this.identifier = identifier;
1558      }
1559
1560        /**
1561         * @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.). This is the underlying object with id, value and extensions. The accessor "getSite" gives direct access to the value
1562         */
1563        public StringType getSiteElement() { 
1564          if (this.site == null)
1565            if (Configuration.errorOnAutoCreate())
1566              throw new Error("Attempt to auto-create AuditEventSourceComponent.site");
1567            else if (Configuration.doAutoCreate())
1568              this.site = new StringType(); // bb
1569          return this.site;
1570        }
1571
1572        public boolean hasSiteElement() { 
1573          return this.site != null && !this.site.isEmpty();
1574        }
1575
1576        public boolean hasSite() { 
1577          return this.site != null && !this.site.isEmpty();
1578        }
1579
1580        /**
1581         * @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.). This is the underlying object with id, value and extensions. The accessor "getSite" gives direct access to the value
1582         */
1583        public AuditEventSourceComponent setSiteElement(StringType value) { 
1584          this.site = value;
1585          return this;
1586        }
1587
1588        /**
1589         * @return Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.
1590         */
1591        public String getSite() { 
1592          return this.site == null ? null : this.site.getValue();
1593        }
1594
1595        /**
1596         * @param value Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.
1597         */
1598        public AuditEventSourceComponent setSite(String value) { 
1599          if (Utilities.noString(value))
1600            this.site = null;
1601          else {
1602            if (this.site == null)
1603              this.site = new StringType();
1604            this.site.setValue(value);
1605          }
1606          return this;
1607        }
1608
1609        /**
1610         * @return {@link #identifier} (Identifier of the source where the event was detected.)
1611         */
1612        public Identifier getIdentifier() { 
1613          if (this.identifier == null)
1614            if (Configuration.errorOnAutoCreate())
1615              throw new Error("Attempt to auto-create AuditEventSourceComponent.identifier");
1616            else if (Configuration.doAutoCreate())
1617              this.identifier = new Identifier(); // cc
1618          return this.identifier;
1619        }
1620
1621        public boolean hasIdentifier() { 
1622          return this.identifier != null && !this.identifier.isEmpty();
1623        }
1624
1625        /**
1626         * @param value {@link #identifier} (Identifier of the source where the event was detected.)
1627         */
1628        public AuditEventSourceComponent setIdentifier(Identifier value) { 
1629          this.identifier = value;
1630          return this;
1631        }
1632
1633        /**
1634         * @return {@link #type} (Code specifying the type of source where event originated.)
1635         */
1636        public List<Coding> getType() { 
1637          if (this.type == null)
1638            this.type = new ArrayList<Coding>();
1639          return this.type;
1640        }
1641
1642        /**
1643         * @return Returns a reference to <code>this</code> for easy method chaining
1644         */
1645        public AuditEventSourceComponent setType(List<Coding> theType) { 
1646          this.type = theType;
1647          return this;
1648        }
1649
1650        public boolean hasType() { 
1651          if (this.type == null)
1652            return false;
1653          for (Coding item : this.type)
1654            if (!item.isEmpty())
1655              return true;
1656          return false;
1657        }
1658
1659        public Coding addType() { //3
1660          Coding t = new Coding();
1661          if (this.type == null)
1662            this.type = new ArrayList<Coding>();
1663          this.type.add(t);
1664          return t;
1665        }
1666
1667        public AuditEventSourceComponent addType(Coding t) { //3
1668          if (t == null)
1669            return this;
1670          if (this.type == null)
1671            this.type = new ArrayList<Coding>();
1672          this.type.add(t);
1673          return this;
1674        }
1675
1676        /**
1677         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1678         */
1679        public Coding getTypeFirstRep() { 
1680          if (getType().isEmpty()) {
1681            addType();
1682          }
1683          return getType().get(0);
1684        }
1685
1686        protected void listChildren(List<Property> childrenList) {
1687          super.listChildren(childrenList);
1688          childrenList.add(new Property("site", "string", "Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.", 0, java.lang.Integer.MAX_VALUE, site));
1689          childrenList.add(new Property("identifier", "Identifier", "Identifier of the source where the event was detected.", 0, java.lang.Integer.MAX_VALUE, identifier));
1690          childrenList.add(new Property("type", "Coding", "Code specifying the type of source where event originated.", 0, java.lang.Integer.MAX_VALUE, type));
1691        }
1692
1693      @Override
1694      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1695        switch (hash) {
1696        case 3530567: /*site*/ return this.site == null ? new Base[0] : new Base[] {this.site}; // StringType
1697        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1698        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // Coding
1699        default: return super.getProperty(hash, name, checkValid);
1700        }
1701
1702      }
1703
1704      @Override
1705      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1706        switch (hash) {
1707        case 3530567: // site
1708          this.site = castToString(value); // StringType
1709          return value;
1710        case -1618432855: // identifier
1711          this.identifier = castToIdentifier(value); // Identifier
1712          return value;
1713        case 3575610: // type
1714          this.getType().add(castToCoding(value)); // Coding
1715          return value;
1716        default: return super.setProperty(hash, name, value);
1717        }
1718
1719      }
1720
1721      @Override
1722      public Base setProperty(String name, Base value) throws FHIRException {
1723        if (name.equals("site")) {
1724          this.site = castToString(value); // StringType
1725        } else if (name.equals("identifier")) {
1726          this.identifier = castToIdentifier(value); // Identifier
1727        } else if (name.equals("type")) {
1728          this.getType().add(castToCoding(value));
1729        } else
1730          return super.setProperty(name, value);
1731        return value;
1732      }
1733
1734      @Override
1735      public Base makeProperty(int hash, String name) throws FHIRException {
1736        switch (hash) {
1737        case 3530567:  return getSiteElement();
1738        case -1618432855:  return getIdentifier(); 
1739        case 3575610:  return addType(); 
1740        default: return super.makeProperty(hash, name);
1741        }
1742
1743      }
1744
1745      @Override
1746      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1747        switch (hash) {
1748        case 3530567: /*site*/ return new String[] {"string"};
1749        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1750        case 3575610: /*type*/ return new String[] {"Coding"};
1751        default: return super.getTypesForProperty(hash, name);
1752        }
1753
1754      }
1755
1756      @Override
1757      public Base addChild(String name) throws FHIRException {
1758        if (name.equals("site")) {
1759          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.site");
1760        }
1761        else if (name.equals("identifier")) {
1762          this.identifier = new Identifier();
1763          return this.identifier;
1764        }
1765        else if (name.equals("type")) {
1766          return addType();
1767        }
1768        else
1769          return super.addChild(name);
1770      }
1771
1772      public AuditEventSourceComponent copy() {
1773        AuditEventSourceComponent dst = new AuditEventSourceComponent();
1774        copyValues(dst);
1775        dst.site = site == null ? null : site.copy();
1776        dst.identifier = identifier == null ? null : identifier.copy();
1777        if (type != null) {
1778          dst.type = new ArrayList<Coding>();
1779          for (Coding i : type)
1780            dst.type.add(i.copy());
1781        };
1782        return dst;
1783      }
1784
1785      @Override
1786      public boolean equalsDeep(Base other) {
1787        if (!super.equalsDeep(other))
1788          return false;
1789        if (!(other instanceof AuditEventSourceComponent))
1790          return false;
1791        AuditEventSourceComponent o = (AuditEventSourceComponent) other;
1792        return compareDeep(site, o.site, true) && compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true)
1793          ;
1794      }
1795
1796      @Override
1797      public boolean equalsShallow(Base other) {
1798        if (!super.equalsShallow(other))
1799          return false;
1800        if (!(other instanceof AuditEventSourceComponent))
1801          return false;
1802        AuditEventSourceComponent o = (AuditEventSourceComponent) other;
1803        return compareValues(site, o.site, true);
1804      }
1805
1806      public boolean isEmpty() {
1807        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(site, identifier, type);
1808      }
1809
1810  public String fhirType() {
1811    return "AuditEvent.source";
1812
1813  }
1814
1815  }
1816
1817    @Block()
1818    public static class AuditEventEntityComponent extends BackboneElement implements IBaseBackboneElement {
1819        /**
1820         * Identifies a specific instance of the entity. The reference should always be version specific.
1821         */
1822        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1823        @Description(shortDefinition="Specific instance of object", formalDefinition="Identifies a specific instance of the entity. The reference should always be version specific." )
1824        protected Identifier identifier;
1825
1826        /**
1827         * Identifies a specific instance of the entity. The reference should be version specific.
1828         */
1829        @Child(name = "reference", type = {Reference.class}, order=2, min=0, max=1, modifier=false, summary=true)
1830        @Description(shortDefinition="Specific instance of resource", formalDefinition="Identifies a specific instance of the entity. The reference should be version specific." )
1831        protected Reference reference;
1832
1833        /**
1834         * The actual object that is the target of the reference (Identifies a specific instance of the entity. The reference should be version specific.)
1835         */
1836        protected Resource referenceTarget;
1837
1838        /**
1839         * The type of the object that was involved in this audit event.
1840         */
1841        @Child(name = "type", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=false)
1842        @Description(shortDefinition="Type of entity involved", formalDefinition="The type of the object that was involved in this audit event." )
1843        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-entity-type")
1844        protected Coding type;
1845
1846        /**
1847         * Code representing the role the entity played in the event being audited.
1848         */
1849        @Child(name = "role", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=false)
1850        @Description(shortDefinition="What role the entity played", formalDefinition="Code representing the role the entity played in the event being audited." )
1851        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/object-role")
1852        protected Coding role;
1853
1854        /**
1855         * Identifier for the data life-cycle stage for the entity.
1856         */
1857        @Child(name = "lifecycle", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=false)
1858        @Description(shortDefinition="Life-cycle stage for the entity", formalDefinition="Identifier for the data life-cycle stage for the entity." )
1859        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/object-lifecycle-events")
1860        protected Coding lifecycle;
1861
1862        /**
1863         * Security labels for the identified entity.
1864         */
1865        @Child(name = "securityLabel", type = {Coding.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1866        @Description(shortDefinition="Security labels on the entity", formalDefinition="Security labels for the identified entity." )
1867        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
1868        protected List<Coding> securityLabel;
1869
1870        /**
1871         * A name of the entity in the audit event.
1872         */
1873        @Child(name = "name", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1874        @Description(shortDefinition="Descriptor for entity", formalDefinition="A name of the entity in the audit event." )
1875        protected StringType name;
1876
1877        /**
1878         * Text that describes the entity in more detail.
1879         */
1880        @Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
1881        @Description(shortDefinition="Descriptive text", formalDefinition="Text that describes the entity in more detail." )
1882        protected StringType description;
1883
1884        /**
1885         * The query parameters for a query-type entities.
1886         */
1887        @Child(name = "query", type = {Base64BinaryType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1888        @Description(shortDefinition="Query parameters", formalDefinition="The query parameters for a query-type entities." )
1889        protected Base64BinaryType query;
1890
1891        /**
1892         * Tagged value pairs for conveying additional information about the entity.
1893         */
1894        @Child(name = "detail", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1895        @Description(shortDefinition="Additional Information about the entity", formalDefinition="Tagged value pairs for conveying additional information about the entity." )
1896        protected List<AuditEventEntityDetailComponent> detail;
1897
1898        private static final long serialVersionUID = -1393424632L;
1899
1900    /**
1901     * Constructor
1902     */
1903      public AuditEventEntityComponent() {
1904        super();
1905      }
1906
1907        /**
1908         * @return {@link #identifier} (Identifies a specific instance of the entity. The reference should always be version specific.)
1909         */
1910        public Identifier getIdentifier() { 
1911          if (this.identifier == null)
1912            if (Configuration.errorOnAutoCreate())
1913              throw new Error("Attempt to auto-create AuditEventEntityComponent.identifier");
1914            else if (Configuration.doAutoCreate())
1915              this.identifier = new Identifier(); // cc
1916          return this.identifier;
1917        }
1918
1919        public boolean hasIdentifier() { 
1920          return this.identifier != null && !this.identifier.isEmpty();
1921        }
1922
1923        /**
1924         * @param value {@link #identifier} (Identifies a specific instance of the entity. The reference should always be version specific.)
1925         */
1926        public AuditEventEntityComponent setIdentifier(Identifier value) { 
1927          this.identifier = value;
1928          return this;
1929        }
1930
1931        /**
1932         * @return {@link #reference} (Identifies a specific instance of the entity. The reference should be version specific.)
1933         */
1934        public Reference getReference() { 
1935          if (this.reference == null)
1936            if (Configuration.errorOnAutoCreate())
1937              throw new Error("Attempt to auto-create AuditEventEntityComponent.reference");
1938            else if (Configuration.doAutoCreate())
1939              this.reference = new Reference(); // cc
1940          return this.reference;
1941        }
1942
1943        public boolean hasReference() { 
1944          return this.reference != null && !this.reference.isEmpty();
1945        }
1946
1947        /**
1948         * @param value {@link #reference} (Identifies a specific instance of the entity. The reference should be version specific.)
1949         */
1950        public AuditEventEntityComponent setReference(Reference value) { 
1951          this.reference = value;
1952          return this;
1953        }
1954
1955        /**
1956         * @return {@link #reference} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies a specific instance of the entity. The reference should be version specific.)
1957         */
1958        public Resource getReferenceTarget() { 
1959          return this.referenceTarget;
1960        }
1961
1962        /**
1963         * @param value {@link #reference} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies a specific instance of the entity. The reference should be version specific.)
1964         */
1965        public AuditEventEntityComponent setReferenceTarget(Resource value) { 
1966          this.referenceTarget = value;
1967          return this;
1968        }
1969
1970        /**
1971         * @return {@link #type} (The type of the object that was involved in this audit event.)
1972         */
1973        public Coding getType() { 
1974          if (this.type == null)
1975            if (Configuration.errorOnAutoCreate())
1976              throw new Error("Attempt to auto-create AuditEventEntityComponent.type");
1977            else if (Configuration.doAutoCreate())
1978              this.type = new Coding(); // cc
1979          return this.type;
1980        }
1981
1982        public boolean hasType() { 
1983          return this.type != null && !this.type.isEmpty();
1984        }
1985
1986        /**
1987         * @param value {@link #type} (The type of the object that was involved in this audit event.)
1988         */
1989        public AuditEventEntityComponent setType(Coding value) { 
1990          this.type = value;
1991          return this;
1992        }
1993
1994        /**
1995         * @return {@link #role} (Code representing the role the entity played in the event being audited.)
1996         */
1997        public Coding getRole() { 
1998          if (this.role == null)
1999            if (Configuration.errorOnAutoCreate())
2000              throw new Error("Attempt to auto-create AuditEventEntityComponent.role");
2001            else if (Configuration.doAutoCreate())
2002              this.role = new Coding(); // cc
2003          return this.role;
2004        }
2005
2006        public boolean hasRole() { 
2007          return this.role != null && !this.role.isEmpty();
2008        }
2009
2010        /**
2011         * @param value {@link #role} (Code representing the role the entity played in the event being audited.)
2012         */
2013        public AuditEventEntityComponent setRole(Coding value) { 
2014          this.role = value;
2015          return this;
2016        }
2017
2018        /**
2019         * @return {@link #lifecycle} (Identifier for the data life-cycle stage for the entity.)
2020         */
2021        public Coding getLifecycle() { 
2022          if (this.lifecycle == null)
2023            if (Configuration.errorOnAutoCreate())
2024              throw new Error("Attempt to auto-create AuditEventEntityComponent.lifecycle");
2025            else if (Configuration.doAutoCreate())
2026              this.lifecycle = new Coding(); // cc
2027          return this.lifecycle;
2028        }
2029
2030        public boolean hasLifecycle() { 
2031          return this.lifecycle != null && !this.lifecycle.isEmpty();
2032        }
2033
2034        /**
2035         * @param value {@link #lifecycle} (Identifier for the data life-cycle stage for the entity.)
2036         */
2037        public AuditEventEntityComponent setLifecycle(Coding value) { 
2038          this.lifecycle = value;
2039          return this;
2040        }
2041
2042        /**
2043         * @return {@link #securityLabel} (Security labels for the identified entity.)
2044         */
2045        public List<Coding> getSecurityLabel() { 
2046          if (this.securityLabel == null)
2047            this.securityLabel = new ArrayList<Coding>();
2048          return this.securityLabel;
2049        }
2050
2051        /**
2052         * @return Returns a reference to <code>this</code> for easy method chaining
2053         */
2054        public AuditEventEntityComponent setSecurityLabel(List<Coding> theSecurityLabel) { 
2055          this.securityLabel = theSecurityLabel;
2056          return this;
2057        }
2058
2059        public boolean hasSecurityLabel() { 
2060          if (this.securityLabel == null)
2061            return false;
2062          for (Coding item : this.securityLabel)
2063            if (!item.isEmpty())
2064              return true;
2065          return false;
2066        }
2067
2068        public Coding addSecurityLabel() { //3
2069          Coding t = new Coding();
2070          if (this.securityLabel == null)
2071            this.securityLabel = new ArrayList<Coding>();
2072          this.securityLabel.add(t);
2073          return t;
2074        }
2075
2076        public AuditEventEntityComponent addSecurityLabel(Coding t) { //3
2077          if (t == null)
2078            return this;
2079          if (this.securityLabel == null)
2080            this.securityLabel = new ArrayList<Coding>();
2081          this.securityLabel.add(t);
2082          return this;
2083        }
2084
2085        /**
2086         * @return The first repetition of repeating field {@link #securityLabel}, creating it if it does not already exist
2087         */
2088        public Coding getSecurityLabelFirstRep() { 
2089          if (getSecurityLabel().isEmpty()) {
2090            addSecurityLabel();
2091          }
2092          return getSecurityLabel().get(0);
2093        }
2094
2095        /**
2096         * @return {@link #name} (A name of the entity in the audit event.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2097         */
2098        public StringType getNameElement() { 
2099          if (this.name == null)
2100            if (Configuration.errorOnAutoCreate())
2101              throw new Error("Attempt to auto-create AuditEventEntityComponent.name");
2102            else if (Configuration.doAutoCreate())
2103              this.name = new StringType(); // bb
2104          return this.name;
2105        }
2106
2107        public boolean hasNameElement() { 
2108          return this.name != null && !this.name.isEmpty();
2109        }
2110
2111        public boolean hasName() { 
2112          return this.name != null && !this.name.isEmpty();
2113        }
2114
2115        /**
2116         * @param value {@link #name} (A name of the entity in the audit event.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2117         */
2118        public AuditEventEntityComponent setNameElement(StringType value) { 
2119          this.name = value;
2120          return this;
2121        }
2122
2123        /**
2124         * @return A name of the entity in the audit event.
2125         */
2126        public String getName() { 
2127          return this.name == null ? null : this.name.getValue();
2128        }
2129
2130        /**
2131         * @param value A name of the entity in the audit event.
2132         */
2133        public AuditEventEntityComponent setName(String value) { 
2134          if (Utilities.noString(value))
2135            this.name = null;
2136          else {
2137            if (this.name == null)
2138              this.name = new StringType();
2139            this.name.setValue(value);
2140          }
2141          return this;
2142        }
2143
2144        /**
2145         * @return {@link #description} (Text that describes the entity in more detail.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2146         */
2147        public StringType getDescriptionElement() { 
2148          if (this.description == null)
2149            if (Configuration.errorOnAutoCreate())
2150              throw new Error("Attempt to auto-create AuditEventEntityComponent.description");
2151            else if (Configuration.doAutoCreate())
2152              this.description = new StringType(); // bb
2153          return this.description;
2154        }
2155
2156        public boolean hasDescriptionElement() { 
2157          return this.description != null && !this.description.isEmpty();
2158        }
2159
2160        public boolean hasDescription() { 
2161          return this.description != null && !this.description.isEmpty();
2162        }
2163
2164        /**
2165         * @param value {@link #description} (Text that describes the entity in more detail.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2166         */
2167        public AuditEventEntityComponent setDescriptionElement(StringType value) { 
2168          this.description = value;
2169          return this;
2170        }
2171
2172        /**
2173         * @return Text that describes the entity in more detail.
2174         */
2175        public String getDescription() { 
2176          return this.description == null ? null : this.description.getValue();
2177        }
2178
2179        /**
2180         * @param value Text that describes the entity in more detail.
2181         */
2182        public AuditEventEntityComponent setDescription(String value) { 
2183          if (Utilities.noString(value))
2184            this.description = null;
2185          else {
2186            if (this.description == null)
2187              this.description = new StringType();
2188            this.description.setValue(value);
2189          }
2190          return this;
2191        }
2192
2193        /**
2194         * @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
2195         */
2196        public Base64BinaryType getQueryElement() { 
2197          if (this.query == null)
2198            if (Configuration.errorOnAutoCreate())
2199              throw new Error("Attempt to auto-create AuditEventEntityComponent.query");
2200            else if (Configuration.doAutoCreate())
2201              this.query = new Base64BinaryType(); // bb
2202          return this.query;
2203        }
2204
2205        public boolean hasQueryElement() { 
2206          return this.query != null && !this.query.isEmpty();
2207        }
2208
2209        public boolean hasQuery() { 
2210          return this.query != null && !this.query.isEmpty();
2211        }
2212
2213        /**
2214         * @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
2215         */
2216        public AuditEventEntityComponent setQueryElement(Base64BinaryType value) { 
2217          this.query = value;
2218          return this;
2219        }
2220
2221        /**
2222         * @return The query parameters for a query-type entities.
2223         */
2224        public byte[] getQuery() { 
2225          return this.query == null ? null : this.query.getValue();
2226        }
2227
2228        /**
2229         * @param value The query parameters for a query-type entities.
2230         */
2231        public AuditEventEntityComponent setQuery(byte[] value) { 
2232          if (value == null)
2233            this.query = null;
2234          else {
2235            if (this.query == null)
2236              this.query = new Base64BinaryType();
2237            this.query.setValue(value);
2238          }
2239          return this;
2240        }
2241
2242        /**
2243         * @return {@link #detail} (Tagged value pairs for conveying additional information about the entity.)
2244         */
2245        public List<AuditEventEntityDetailComponent> getDetail() { 
2246          if (this.detail == null)
2247            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
2248          return this.detail;
2249        }
2250
2251        /**
2252         * @return Returns a reference to <code>this</code> for easy method chaining
2253         */
2254        public AuditEventEntityComponent setDetail(List<AuditEventEntityDetailComponent> theDetail) { 
2255          this.detail = theDetail;
2256          return this;
2257        }
2258
2259        public boolean hasDetail() { 
2260          if (this.detail == null)
2261            return false;
2262          for (AuditEventEntityDetailComponent item : this.detail)
2263            if (!item.isEmpty())
2264              return true;
2265          return false;
2266        }
2267
2268        public AuditEventEntityDetailComponent addDetail() { //3
2269          AuditEventEntityDetailComponent t = new AuditEventEntityDetailComponent();
2270          if (this.detail == null)
2271            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
2272          this.detail.add(t);
2273          return t;
2274        }
2275
2276        public AuditEventEntityComponent addDetail(AuditEventEntityDetailComponent t) { //3
2277          if (t == null)
2278            return this;
2279          if (this.detail == null)
2280            this.detail = new ArrayList<AuditEventEntityDetailComponent>();
2281          this.detail.add(t);
2282          return this;
2283        }
2284
2285        /**
2286         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
2287         */
2288        public AuditEventEntityDetailComponent getDetailFirstRep() { 
2289          if (getDetail().isEmpty()) {
2290            addDetail();
2291          }
2292          return getDetail().get(0);
2293        }
2294
2295        protected void listChildren(List<Property> childrenList) {
2296          super.listChildren(childrenList);
2297          childrenList.add(new Property("identifier", "Identifier", "Identifies a specific instance of the entity. The reference should always be version specific.", 0, java.lang.Integer.MAX_VALUE, identifier));
2298          childrenList.add(new Property("reference", "Reference(Any)", "Identifies a specific instance of the entity. The reference should be version specific.", 0, java.lang.Integer.MAX_VALUE, reference));
2299          childrenList.add(new Property("type", "Coding", "The type of the object that was involved in this audit event.", 0, java.lang.Integer.MAX_VALUE, type));
2300          childrenList.add(new Property("role", "Coding", "Code representing the role the entity played in the event being audited.", 0, java.lang.Integer.MAX_VALUE, role));
2301          childrenList.add(new Property("lifecycle", "Coding", "Identifier for the data life-cycle stage for the entity.", 0, java.lang.Integer.MAX_VALUE, lifecycle));
2302          childrenList.add(new Property("securityLabel", "Coding", "Security labels for the identified entity.", 0, java.lang.Integer.MAX_VALUE, securityLabel));
2303          childrenList.add(new Property("name", "string", "A name of the entity in the audit event.", 0, java.lang.Integer.MAX_VALUE, name));
2304          childrenList.add(new Property("description", "string", "Text that describes the entity in more detail.", 0, java.lang.Integer.MAX_VALUE, description));
2305          childrenList.add(new Property("query", "base64Binary", "The query parameters for a query-type entities.", 0, java.lang.Integer.MAX_VALUE, query));
2306          childrenList.add(new Property("detail", "", "Tagged value pairs for conveying additional information about the entity.", 0, java.lang.Integer.MAX_VALUE, detail));
2307        }
2308
2309      @Override
2310      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2311        switch (hash) {
2312        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2313        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
2314        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
2315        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // Coding
2316        case -302323862: /*lifecycle*/ return this.lifecycle == null ? new Base[0] : new Base[] {this.lifecycle}; // Coding
2317        case -722296940: /*securityLabel*/ return this.securityLabel == null ? new Base[0] : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // Coding
2318        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2319        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2320        case 107944136: /*query*/ return this.query == null ? new Base[0] : new Base[] {this.query}; // Base64BinaryType
2321        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AuditEventEntityDetailComponent
2322        default: return super.getProperty(hash, name, checkValid);
2323        }
2324
2325      }
2326
2327      @Override
2328      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2329        switch (hash) {
2330        case -1618432855: // identifier
2331          this.identifier = castToIdentifier(value); // Identifier
2332          return value;
2333        case -925155509: // reference
2334          this.reference = castToReference(value); // Reference
2335          return value;
2336        case 3575610: // type
2337          this.type = castToCoding(value); // Coding
2338          return value;
2339        case 3506294: // role
2340          this.role = castToCoding(value); // Coding
2341          return value;
2342        case -302323862: // lifecycle
2343          this.lifecycle = castToCoding(value); // Coding
2344          return value;
2345        case -722296940: // securityLabel
2346          this.getSecurityLabel().add(castToCoding(value)); // Coding
2347          return value;
2348        case 3373707: // name
2349          this.name = castToString(value); // StringType
2350          return value;
2351        case -1724546052: // description
2352          this.description = castToString(value); // StringType
2353          return value;
2354        case 107944136: // query
2355          this.query = castToBase64Binary(value); // Base64BinaryType
2356          return value;
2357        case -1335224239: // detail
2358          this.getDetail().add((AuditEventEntityDetailComponent) value); // AuditEventEntityDetailComponent
2359          return value;
2360        default: return super.setProperty(hash, name, value);
2361        }
2362
2363      }
2364
2365      @Override
2366      public Base setProperty(String name, Base value) throws FHIRException {
2367        if (name.equals("identifier")) {
2368          this.identifier = castToIdentifier(value); // Identifier
2369        } else if (name.equals("reference")) {
2370          this.reference = castToReference(value); // Reference
2371        } else if (name.equals("type")) {
2372          this.type = castToCoding(value); // Coding
2373        } else if (name.equals("role")) {
2374          this.role = castToCoding(value); // Coding
2375        } else if (name.equals("lifecycle")) {
2376          this.lifecycle = castToCoding(value); // Coding
2377        } else if (name.equals("securityLabel")) {
2378          this.getSecurityLabel().add(castToCoding(value));
2379        } else if (name.equals("name")) {
2380          this.name = castToString(value); // StringType
2381        } else if (name.equals("description")) {
2382          this.description = castToString(value); // StringType
2383        } else if (name.equals("query")) {
2384          this.query = castToBase64Binary(value); // Base64BinaryType
2385        } else if (name.equals("detail")) {
2386          this.getDetail().add((AuditEventEntityDetailComponent) value);
2387        } else
2388          return super.setProperty(name, value);
2389        return value;
2390      }
2391
2392      @Override
2393      public Base makeProperty(int hash, String name) throws FHIRException {
2394        switch (hash) {
2395        case -1618432855:  return getIdentifier(); 
2396        case -925155509:  return getReference(); 
2397        case 3575610:  return getType(); 
2398        case 3506294:  return getRole(); 
2399        case -302323862:  return getLifecycle(); 
2400        case -722296940:  return addSecurityLabel(); 
2401        case 3373707:  return getNameElement();
2402        case -1724546052:  return getDescriptionElement();
2403        case 107944136:  return getQueryElement();
2404        case -1335224239:  return addDetail(); 
2405        default: return super.makeProperty(hash, name);
2406        }
2407
2408      }
2409
2410      @Override
2411      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2412        switch (hash) {
2413        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2414        case -925155509: /*reference*/ return new String[] {"Reference"};
2415        case 3575610: /*type*/ return new String[] {"Coding"};
2416        case 3506294: /*role*/ return new String[] {"Coding"};
2417        case -302323862: /*lifecycle*/ return new String[] {"Coding"};
2418        case -722296940: /*securityLabel*/ return new String[] {"Coding"};
2419        case 3373707: /*name*/ return new String[] {"string"};
2420        case -1724546052: /*description*/ return new String[] {"string"};
2421        case 107944136: /*query*/ return new String[] {"base64Binary"};
2422        case -1335224239: /*detail*/ return new String[] {};
2423        default: return super.getTypesForProperty(hash, name);
2424        }
2425
2426      }
2427
2428      @Override
2429      public Base addChild(String name) throws FHIRException {
2430        if (name.equals("identifier")) {
2431          this.identifier = new Identifier();
2432          return this.identifier;
2433        }
2434        else if (name.equals("reference")) {
2435          this.reference = new Reference();
2436          return this.reference;
2437        }
2438        else if (name.equals("type")) {
2439          this.type = new Coding();
2440          return this.type;
2441        }
2442        else if (name.equals("role")) {
2443          this.role = new Coding();
2444          return this.role;
2445        }
2446        else if (name.equals("lifecycle")) {
2447          this.lifecycle = new Coding();
2448          return this.lifecycle;
2449        }
2450        else if (name.equals("securityLabel")) {
2451          return addSecurityLabel();
2452        }
2453        else if (name.equals("name")) {
2454          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.name");
2455        }
2456        else if (name.equals("description")) {
2457          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.description");
2458        }
2459        else if (name.equals("query")) {
2460          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.query");
2461        }
2462        else if (name.equals("detail")) {
2463          return addDetail();
2464        }
2465        else
2466          return super.addChild(name);
2467      }
2468
2469      public AuditEventEntityComponent copy() {
2470        AuditEventEntityComponent dst = new AuditEventEntityComponent();
2471        copyValues(dst);
2472        dst.identifier = identifier == null ? null : identifier.copy();
2473        dst.reference = reference == null ? null : reference.copy();
2474        dst.type = type == null ? null : type.copy();
2475        dst.role = role == null ? null : role.copy();
2476        dst.lifecycle = lifecycle == null ? null : lifecycle.copy();
2477        if (securityLabel != null) {
2478          dst.securityLabel = new ArrayList<Coding>();
2479          for (Coding i : securityLabel)
2480            dst.securityLabel.add(i.copy());
2481        };
2482        dst.name = name == null ? null : name.copy();
2483        dst.description = description == null ? null : description.copy();
2484        dst.query = query == null ? null : query.copy();
2485        if (detail != null) {
2486          dst.detail = new ArrayList<AuditEventEntityDetailComponent>();
2487          for (AuditEventEntityDetailComponent i : detail)
2488            dst.detail.add(i.copy());
2489        };
2490        return dst;
2491      }
2492
2493      @Override
2494      public boolean equalsDeep(Base other) {
2495        if (!super.equalsDeep(other))
2496          return false;
2497        if (!(other instanceof AuditEventEntityComponent))
2498          return false;
2499        AuditEventEntityComponent o = (AuditEventEntityComponent) other;
2500        return compareDeep(identifier, o.identifier, true) && compareDeep(reference, o.reference, true)
2501           && compareDeep(type, o.type, true) && compareDeep(role, o.role, true) && compareDeep(lifecycle, o.lifecycle, true)
2502           && compareDeep(securityLabel, o.securityLabel, true) && compareDeep(name, o.name, true) && compareDeep(description, o.description, true)
2503           && compareDeep(query, o.query, true) && compareDeep(detail, o.detail, true);
2504      }
2505
2506      @Override
2507      public boolean equalsShallow(Base other) {
2508        if (!super.equalsShallow(other))
2509          return false;
2510        if (!(other instanceof AuditEventEntityComponent))
2511          return false;
2512        AuditEventEntityComponent o = (AuditEventEntityComponent) other;
2513        return compareValues(name, o.name, true) && compareValues(description, o.description, true) && compareValues(query, o.query, true)
2514          ;
2515      }
2516
2517      public boolean isEmpty() {
2518        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, reference, type
2519          , role, lifecycle, securityLabel, name, description, query, detail);
2520      }
2521
2522  public String fhirType() {
2523    return "AuditEvent.entity";
2524
2525  }
2526
2527  }
2528
2529    @Block()
2530    public static class AuditEventEntityDetailComponent extends BackboneElement implements IBaseBackboneElement {
2531        /**
2532         * The type of extra detail provided in the value.
2533         */
2534        @Child(name = "type", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2535        @Description(shortDefinition="Name of the property", formalDefinition="The type of extra detail provided in the value." )
2536        protected StringType type;
2537
2538        /**
2539         * The details, base64 encoded. Used to carry bulk information.
2540         */
2541        @Child(name = "value", type = {Base64BinaryType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2542        @Description(shortDefinition="Property value", formalDefinition="The details, base64 encoded. Used to carry bulk information." )
2543        protected Base64BinaryType value;
2544
2545        private static final long serialVersionUID = 11139504L;
2546
2547    /**
2548     * Constructor
2549     */
2550      public AuditEventEntityDetailComponent() {
2551        super();
2552      }
2553
2554    /**
2555     * Constructor
2556     */
2557      public AuditEventEntityDetailComponent(StringType type, Base64BinaryType value) {
2558        super();
2559        this.type = type;
2560        this.value = value;
2561      }
2562
2563        /**
2564         * @return {@link #type} (The type of extra detail provided in the value.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2565         */
2566        public StringType getTypeElement() { 
2567          if (this.type == null)
2568            if (Configuration.errorOnAutoCreate())
2569              throw new Error("Attempt to auto-create AuditEventEntityDetailComponent.type");
2570            else if (Configuration.doAutoCreate())
2571              this.type = new StringType(); // bb
2572          return this.type;
2573        }
2574
2575        public boolean hasTypeElement() { 
2576          return this.type != null && !this.type.isEmpty();
2577        }
2578
2579        public boolean hasType() { 
2580          return this.type != null && !this.type.isEmpty();
2581        }
2582
2583        /**
2584         * @param value {@link #type} (The type of extra detail provided in the value.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2585         */
2586        public AuditEventEntityDetailComponent setTypeElement(StringType value) { 
2587          this.type = value;
2588          return this;
2589        }
2590
2591        /**
2592         * @return The type of extra detail provided in the value.
2593         */
2594        public String getType() { 
2595          return this.type == null ? null : this.type.getValue();
2596        }
2597
2598        /**
2599         * @param value The type of extra detail provided in the value.
2600         */
2601        public AuditEventEntityDetailComponent setType(String value) { 
2602            if (this.type == null)
2603              this.type = new StringType();
2604            this.type.setValue(value);
2605          return this;
2606        }
2607
2608        /**
2609         * @return {@link #value} (The details, base64 encoded. Used to carry bulk information.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
2610         */
2611        public Base64BinaryType getValueElement() { 
2612          if (this.value == null)
2613            if (Configuration.errorOnAutoCreate())
2614              throw new Error("Attempt to auto-create AuditEventEntityDetailComponent.value");
2615            else if (Configuration.doAutoCreate())
2616              this.value = new Base64BinaryType(); // bb
2617          return this.value;
2618        }
2619
2620        public boolean hasValueElement() { 
2621          return this.value != null && !this.value.isEmpty();
2622        }
2623
2624        public boolean hasValue() { 
2625          return this.value != null && !this.value.isEmpty();
2626        }
2627
2628        /**
2629         * @param value {@link #value} (The details, base64 encoded. Used to carry bulk information.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
2630         */
2631        public AuditEventEntityDetailComponent setValueElement(Base64BinaryType value) { 
2632          this.value = value;
2633          return this;
2634        }
2635
2636        /**
2637         * @return The details, base64 encoded. Used to carry bulk information.
2638         */
2639        public byte[] getValue() { 
2640          return this.value == null ? null : this.value.getValue();
2641        }
2642
2643        /**
2644         * @param value The details, base64 encoded. Used to carry bulk information.
2645         */
2646        public AuditEventEntityDetailComponent setValue(byte[] value) { 
2647            if (this.value == null)
2648              this.value = new Base64BinaryType();
2649            this.value.setValue(value);
2650          return this;
2651        }
2652
2653        protected void listChildren(List<Property> childrenList) {
2654          super.listChildren(childrenList);
2655          childrenList.add(new Property("type", "string", "The type of extra detail provided in the value.", 0, java.lang.Integer.MAX_VALUE, type));
2656          childrenList.add(new Property("value", "base64Binary", "The details, base64 encoded. Used to carry bulk information.", 0, java.lang.Integer.MAX_VALUE, value));
2657        }
2658
2659      @Override
2660      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2661        switch (hash) {
2662        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // StringType
2663        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Base64BinaryType
2664        default: return super.getProperty(hash, name, checkValid);
2665        }
2666
2667      }
2668
2669      @Override
2670      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2671        switch (hash) {
2672        case 3575610: // type
2673          this.type = castToString(value); // StringType
2674          return value;
2675        case 111972721: // value
2676          this.value = castToBase64Binary(value); // Base64BinaryType
2677          return value;
2678        default: return super.setProperty(hash, name, value);
2679        }
2680
2681      }
2682
2683      @Override
2684      public Base setProperty(String name, Base value) throws FHIRException {
2685        if (name.equals("type")) {
2686          this.type = castToString(value); // StringType
2687        } else if (name.equals("value")) {
2688          this.value = castToBase64Binary(value); // Base64BinaryType
2689        } else
2690          return super.setProperty(name, value);
2691        return value;
2692      }
2693
2694      @Override
2695      public Base makeProperty(int hash, String name) throws FHIRException {
2696        switch (hash) {
2697        case 3575610:  return getTypeElement();
2698        case 111972721:  return getValueElement();
2699        default: return super.makeProperty(hash, name);
2700        }
2701
2702      }
2703
2704      @Override
2705      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2706        switch (hash) {
2707        case 3575610: /*type*/ return new String[] {"string"};
2708        case 111972721: /*value*/ return new String[] {"base64Binary"};
2709        default: return super.getTypesForProperty(hash, name);
2710        }
2711
2712      }
2713
2714      @Override
2715      public Base addChild(String name) throws FHIRException {
2716        if (name.equals("type")) {
2717          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.type");
2718        }
2719        else if (name.equals("value")) {
2720          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.value");
2721        }
2722        else
2723          return super.addChild(name);
2724      }
2725
2726      public AuditEventEntityDetailComponent copy() {
2727        AuditEventEntityDetailComponent dst = new AuditEventEntityDetailComponent();
2728        copyValues(dst);
2729        dst.type = type == null ? null : type.copy();
2730        dst.value = value == null ? null : value.copy();
2731        return dst;
2732      }
2733
2734      @Override
2735      public boolean equalsDeep(Base other) {
2736        if (!super.equalsDeep(other))
2737          return false;
2738        if (!(other instanceof AuditEventEntityDetailComponent))
2739          return false;
2740        AuditEventEntityDetailComponent o = (AuditEventEntityDetailComponent) other;
2741        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
2742      }
2743
2744      @Override
2745      public boolean equalsShallow(Base other) {
2746        if (!super.equalsShallow(other))
2747          return false;
2748        if (!(other instanceof AuditEventEntityDetailComponent))
2749          return false;
2750        AuditEventEntityDetailComponent o = (AuditEventEntityDetailComponent) other;
2751        return compareValues(type, o.type, true) && compareValues(value, o.value, true);
2752      }
2753
2754      public boolean isEmpty() {
2755        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
2756      }
2757
2758  public String fhirType() {
2759    return "AuditEvent.entity.detail";
2760
2761  }
2762
2763  }
2764
2765    /**
2766     * Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.
2767     */
2768    @Child(name = "type", type = {Coding.class}, order=0, min=1, max=1, modifier=false, summary=true)
2769    @Description(shortDefinition="Type/identifier of event", formalDefinition="Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function." )
2770    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-type")
2771    protected Coding type;
2772
2773    /**
2774     * Identifier for the category of event.
2775     */
2776    @Child(name = "subtype", type = {Coding.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2777    @Description(shortDefinition="More specific type/id for the event", formalDefinition="Identifier for the category of event." )
2778    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-sub-type")
2779    protected List<Coding> subtype;
2780
2781    /**
2782     * Indicator for type of action performed during the event that generated the audit.
2783     */
2784    @Child(name = "action", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2785    @Description(shortDefinition="Type of action performed during the event", formalDefinition="Indicator for type of action performed during the event that generated the audit." )
2786    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-action")
2787    protected Enumeration<AuditEventAction> action;
2788
2789    /**
2790     * The time when the event occurred on the source.
2791     */
2792    @Child(name = "recorded", type = {InstantType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2793    @Description(shortDefinition="Time when the event occurred on source", formalDefinition="The time when the event occurred on the source." )
2794    protected InstantType recorded;
2795
2796    /**
2797     * Indicates whether the event succeeded or failed.
2798     */
2799    @Child(name = "outcome", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2800    @Description(shortDefinition="Whether the event succeeded or failed", formalDefinition="Indicates whether the event succeeded or failed." )
2801    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/audit-event-outcome")
2802    protected Enumeration<AuditEventOutcome> outcome;
2803
2804    /**
2805     * A free text description of the outcome of the event.
2806     */
2807    @Child(name = "outcomeDesc", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
2808    @Description(shortDefinition="Description of the event outcome", formalDefinition="A free text description of the outcome of the event." )
2809    protected StringType outcomeDesc;
2810
2811    /**
2812     * The purposeOfUse (reason) that was used during the event being recorded.
2813     */
2814    @Child(name = "purposeOfEvent", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2815    @Description(shortDefinition="The purposeOfUse of the event", formalDefinition="The purposeOfUse (reason) that was used during the event being recorded." )
2816    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-PurposeOfUse")
2817    protected List<CodeableConcept> purposeOfEvent;
2818
2819    /**
2820     * An actor taking an active role in the event or activity that is logged.
2821     */
2822    @Child(name = "agent", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2823    @Description(shortDefinition="Actor involved in the event", formalDefinition="An actor taking an active role in the event or activity that is logged." )
2824    protected List<AuditEventAgentComponent> agent;
2825
2826    /**
2827     * The system that is reporting the event.
2828     */
2829    @Child(name = "source", type = {}, order=8, min=1, max=1, modifier=false, summary=false)
2830    @Description(shortDefinition="Audit Event Reporter", formalDefinition="The system that is reporting the event." )
2831    protected AuditEventSourceComponent source;
2832
2833    /**
2834     * Specific instances of data or objects that have been accessed.
2835     */
2836    @Child(name = "entity", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2837    @Description(shortDefinition="Data or objects used", formalDefinition="Specific instances of data or objects that have been accessed." )
2838    protected List<AuditEventEntityComponent> entity;
2839
2840    private static final long serialVersionUID = 2102955199L;
2841
2842  /**
2843   * Constructor
2844   */
2845    public AuditEvent() {
2846      super();
2847    }
2848
2849  /**
2850   * Constructor
2851   */
2852    public AuditEvent(Coding type, InstantType recorded, AuditEventSourceComponent source) {
2853      super();
2854      this.type = type;
2855      this.recorded = recorded;
2856      this.source = source;
2857    }
2858
2859    /**
2860     * @return {@link #type} (Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.)
2861     */
2862    public Coding getType() { 
2863      if (this.type == null)
2864        if (Configuration.errorOnAutoCreate())
2865          throw new Error("Attempt to auto-create AuditEvent.type");
2866        else if (Configuration.doAutoCreate())
2867          this.type = new Coding(); // cc
2868      return this.type;
2869    }
2870
2871    public boolean hasType() { 
2872      return this.type != null && !this.type.isEmpty();
2873    }
2874
2875    /**
2876     * @param value {@link #type} (Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.)
2877     */
2878    public AuditEvent setType(Coding value) { 
2879      this.type = value;
2880      return this;
2881    }
2882
2883    /**
2884     * @return {@link #subtype} (Identifier for the category of event.)
2885     */
2886    public List<Coding> getSubtype() { 
2887      if (this.subtype == null)
2888        this.subtype = new ArrayList<Coding>();
2889      return this.subtype;
2890    }
2891
2892    /**
2893     * @return Returns a reference to <code>this</code> for easy method chaining
2894     */
2895    public AuditEvent setSubtype(List<Coding> theSubtype) { 
2896      this.subtype = theSubtype;
2897      return this;
2898    }
2899
2900    public boolean hasSubtype() { 
2901      if (this.subtype == null)
2902        return false;
2903      for (Coding item : this.subtype)
2904        if (!item.isEmpty())
2905          return true;
2906      return false;
2907    }
2908
2909    public Coding addSubtype() { //3
2910      Coding t = new Coding();
2911      if (this.subtype == null)
2912        this.subtype = new ArrayList<Coding>();
2913      this.subtype.add(t);
2914      return t;
2915    }
2916
2917    public AuditEvent addSubtype(Coding t) { //3
2918      if (t == null)
2919        return this;
2920      if (this.subtype == null)
2921        this.subtype = new ArrayList<Coding>();
2922      this.subtype.add(t);
2923      return this;
2924    }
2925
2926    /**
2927     * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist
2928     */
2929    public Coding getSubtypeFirstRep() { 
2930      if (getSubtype().isEmpty()) {
2931        addSubtype();
2932      }
2933      return getSubtype().get(0);
2934    }
2935
2936    /**
2937     * @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
2938     */
2939    public Enumeration<AuditEventAction> getActionElement() { 
2940      if (this.action == null)
2941        if (Configuration.errorOnAutoCreate())
2942          throw new Error("Attempt to auto-create AuditEvent.action");
2943        else if (Configuration.doAutoCreate())
2944          this.action = new Enumeration<AuditEventAction>(new AuditEventActionEnumFactory()); // bb
2945      return this.action;
2946    }
2947
2948    public boolean hasActionElement() { 
2949      return this.action != null && !this.action.isEmpty();
2950    }
2951
2952    public boolean hasAction() { 
2953      return this.action != null && !this.action.isEmpty();
2954    }
2955
2956    /**
2957     * @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
2958     */
2959    public AuditEvent setActionElement(Enumeration<AuditEventAction> value) { 
2960      this.action = value;
2961      return this;
2962    }
2963
2964    /**
2965     * @return Indicator for type of action performed during the event that generated the audit.
2966     */
2967    public AuditEventAction getAction() { 
2968      return this.action == null ? null : this.action.getValue();
2969    }
2970
2971    /**
2972     * @param value Indicator for type of action performed during the event that generated the audit.
2973     */
2974    public AuditEvent setAction(AuditEventAction value) { 
2975      if (value == null)
2976        this.action = null;
2977      else {
2978        if (this.action == null)
2979          this.action = new Enumeration<AuditEventAction>(new AuditEventActionEnumFactory());
2980        this.action.setValue(value);
2981      }
2982      return this;
2983    }
2984
2985    /**
2986     * @return {@link #recorded} (The time when the event occurred on the source.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
2987     */
2988    public InstantType getRecordedElement() { 
2989      if (this.recorded == null)
2990        if (Configuration.errorOnAutoCreate())
2991          throw new Error("Attempt to auto-create AuditEvent.recorded");
2992        else if (Configuration.doAutoCreate())
2993          this.recorded = new InstantType(); // bb
2994      return this.recorded;
2995    }
2996
2997    public boolean hasRecordedElement() { 
2998      return this.recorded != null && !this.recorded.isEmpty();
2999    }
3000
3001    public boolean hasRecorded() { 
3002      return this.recorded != null && !this.recorded.isEmpty();
3003    }
3004
3005    /**
3006     * @param value {@link #recorded} (The time when the event occurred on the source.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
3007     */
3008    public AuditEvent setRecordedElement(InstantType value) { 
3009      this.recorded = value;
3010      return this;
3011    }
3012
3013    /**
3014     * @return The time when the event occurred on the source.
3015     */
3016    public Date getRecorded() { 
3017      return this.recorded == null ? null : this.recorded.getValue();
3018    }
3019
3020    /**
3021     * @param value The time when the event occurred on the source.
3022     */
3023    public AuditEvent setRecorded(Date value) { 
3024        if (this.recorded == null)
3025          this.recorded = new InstantType();
3026        this.recorded.setValue(value);
3027      return this;
3028    }
3029
3030    /**
3031     * @return {@link #outcome} (Indicates whether the event succeeded or failed.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
3032     */
3033    public Enumeration<AuditEventOutcome> getOutcomeElement() { 
3034      if (this.outcome == null)
3035        if (Configuration.errorOnAutoCreate())
3036          throw new Error("Attempt to auto-create AuditEvent.outcome");
3037        else if (Configuration.doAutoCreate())
3038          this.outcome = new Enumeration<AuditEventOutcome>(new AuditEventOutcomeEnumFactory()); // bb
3039      return this.outcome;
3040    }
3041
3042    public boolean hasOutcomeElement() { 
3043      return this.outcome != null && !this.outcome.isEmpty();
3044    }
3045
3046    public boolean hasOutcome() { 
3047      return this.outcome != null && !this.outcome.isEmpty();
3048    }
3049
3050    /**
3051     * @param value {@link #outcome} (Indicates whether the event succeeded or failed.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
3052     */
3053    public AuditEvent setOutcomeElement(Enumeration<AuditEventOutcome> value) { 
3054      this.outcome = value;
3055      return this;
3056    }
3057
3058    /**
3059     * @return Indicates whether the event succeeded or failed.
3060     */
3061    public AuditEventOutcome getOutcome() { 
3062      return this.outcome == null ? null : this.outcome.getValue();
3063    }
3064
3065    /**
3066     * @param value Indicates whether the event succeeded or failed.
3067     */
3068    public AuditEvent setOutcome(AuditEventOutcome value) { 
3069      if (value == null)
3070        this.outcome = null;
3071      else {
3072        if (this.outcome == null)
3073          this.outcome = new Enumeration<AuditEventOutcome>(new AuditEventOutcomeEnumFactory());
3074        this.outcome.setValue(value);
3075      }
3076      return this;
3077    }
3078
3079    /**
3080     * @return {@link #outcomeDesc} (A free text description of the outcome of the event.). This is the underlying object with id, value and extensions. The accessor "getOutcomeDesc" gives direct access to the value
3081     */
3082    public StringType getOutcomeDescElement() { 
3083      if (this.outcomeDesc == null)
3084        if (Configuration.errorOnAutoCreate())
3085          throw new Error("Attempt to auto-create AuditEvent.outcomeDesc");
3086        else if (Configuration.doAutoCreate())
3087          this.outcomeDesc = new StringType(); // bb
3088      return this.outcomeDesc;
3089    }
3090
3091    public boolean hasOutcomeDescElement() { 
3092      return this.outcomeDesc != null && !this.outcomeDesc.isEmpty();
3093    }
3094
3095    public boolean hasOutcomeDesc() { 
3096      return this.outcomeDesc != null && !this.outcomeDesc.isEmpty();
3097    }
3098
3099    /**
3100     * @param value {@link #outcomeDesc} (A free text description of the outcome of the event.). This is the underlying object with id, value and extensions. The accessor "getOutcomeDesc" gives direct access to the value
3101     */
3102    public AuditEvent setOutcomeDescElement(StringType value) { 
3103      this.outcomeDesc = value;
3104      return this;
3105    }
3106
3107    /**
3108     * @return A free text description of the outcome of the event.
3109     */
3110    public String getOutcomeDesc() { 
3111      return this.outcomeDesc == null ? null : this.outcomeDesc.getValue();
3112    }
3113
3114    /**
3115     * @param value A free text description of the outcome of the event.
3116     */
3117    public AuditEvent setOutcomeDesc(String value) { 
3118      if (Utilities.noString(value))
3119        this.outcomeDesc = null;
3120      else {
3121        if (this.outcomeDesc == null)
3122          this.outcomeDesc = new StringType();
3123        this.outcomeDesc.setValue(value);
3124      }
3125      return this;
3126    }
3127
3128    /**
3129     * @return {@link #purposeOfEvent} (The purposeOfUse (reason) that was used during the event being recorded.)
3130     */
3131    public List<CodeableConcept> getPurposeOfEvent() { 
3132      if (this.purposeOfEvent == null)
3133        this.purposeOfEvent = new ArrayList<CodeableConcept>();
3134      return this.purposeOfEvent;
3135    }
3136
3137    /**
3138     * @return Returns a reference to <code>this</code> for easy method chaining
3139     */
3140    public AuditEvent setPurposeOfEvent(List<CodeableConcept> thePurposeOfEvent) { 
3141      this.purposeOfEvent = thePurposeOfEvent;
3142      return this;
3143    }
3144
3145    public boolean hasPurposeOfEvent() { 
3146      if (this.purposeOfEvent == null)
3147        return false;
3148      for (CodeableConcept item : this.purposeOfEvent)
3149        if (!item.isEmpty())
3150          return true;
3151      return false;
3152    }
3153
3154    public CodeableConcept addPurposeOfEvent() { //3
3155      CodeableConcept t = new CodeableConcept();
3156      if (this.purposeOfEvent == null)
3157        this.purposeOfEvent = new ArrayList<CodeableConcept>();
3158      this.purposeOfEvent.add(t);
3159      return t;
3160    }
3161
3162    public AuditEvent addPurposeOfEvent(CodeableConcept t) { //3
3163      if (t == null)
3164        return this;
3165      if (this.purposeOfEvent == null)
3166        this.purposeOfEvent = new ArrayList<CodeableConcept>();
3167      this.purposeOfEvent.add(t);
3168      return this;
3169    }
3170
3171    /**
3172     * @return The first repetition of repeating field {@link #purposeOfEvent}, creating it if it does not already exist
3173     */
3174    public CodeableConcept getPurposeOfEventFirstRep() { 
3175      if (getPurposeOfEvent().isEmpty()) {
3176        addPurposeOfEvent();
3177      }
3178      return getPurposeOfEvent().get(0);
3179    }
3180
3181    /**
3182     * @return {@link #agent} (An actor taking an active role in the event or activity that is logged.)
3183     */
3184    public List<AuditEventAgentComponent> getAgent() { 
3185      if (this.agent == null)
3186        this.agent = new ArrayList<AuditEventAgentComponent>();
3187      return this.agent;
3188    }
3189
3190    /**
3191     * @return Returns a reference to <code>this</code> for easy method chaining
3192     */
3193    public AuditEvent setAgent(List<AuditEventAgentComponent> theAgent) { 
3194      this.agent = theAgent;
3195      return this;
3196    }
3197
3198    public boolean hasAgent() { 
3199      if (this.agent == null)
3200        return false;
3201      for (AuditEventAgentComponent item : this.agent)
3202        if (!item.isEmpty())
3203          return true;
3204      return false;
3205    }
3206
3207    public AuditEventAgentComponent addAgent() { //3
3208      AuditEventAgentComponent t = new AuditEventAgentComponent();
3209      if (this.agent == null)
3210        this.agent = new ArrayList<AuditEventAgentComponent>();
3211      this.agent.add(t);
3212      return t;
3213    }
3214
3215    public AuditEvent addAgent(AuditEventAgentComponent t) { //3
3216      if (t == null)
3217        return this;
3218      if (this.agent == null)
3219        this.agent = new ArrayList<AuditEventAgentComponent>();
3220      this.agent.add(t);
3221      return this;
3222    }
3223
3224    /**
3225     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
3226     */
3227    public AuditEventAgentComponent getAgentFirstRep() { 
3228      if (getAgent().isEmpty()) {
3229        addAgent();
3230      }
3231      return getAgent().get(0);
3232    }
3233
3234    /**
3235     * @return {@link #source} (The system that is reporting the event.)
3236     */
3237    public AuditEventSourceComponent getSource() { 
3238      if (this.source == null)
3239        if (Configuration.errorOnAutoCreate())
3240          throw new Error("Attempt to auto-create AuditEvent.source");
3241        else if (Configuration.doAutoCreate())
3242          this.source = new AuditEventSourceComponent(); // cc
3243      return this.source;
3244    }
3245
3246    public boolean hasSource() { 
3247      return this.source != null && !this.source.isEmpty();
3248    }
3249
3250    /**
3251     * @param value {@link #source} (The system that is reporting the event.)
3252     */
3253    public AuditEvent setSource(AuditEventSourceComponent value) { 
3254      this.source = value;
3255      return this;
3256    }
3257
3258    /**
3259     * @return {@link #entity} (Specific instances of data or objects that have been accessed.)
3260     */
3261    public List<AuditEventEntityComponent> getEntity() { 
3262      if (this.entity == null)
3263        this.entity = new ArrayList<AuditEventEntityComponent>();
3264      return this.entity;
3265    }
3266
3267    /**
3268     * @return Returns a reference to <code>this</code> for easy method chaining
3269     */
3270    public AuditEvent setEntity(List<AuditEventEntityComponent> theEntity) { 
3271      this.entity = theEntity;
3272      return this;
3273    }
3274
3275    public boolean hasEntity() { 
3276      if (this.entity == null)
3277        return false;
3278      for (AuditEventEntityComponent item : this.entity)
3279        if (!item.isEmpty())
3280          return true;
3281      return false;
3282    }
3283
3284    public AuditEventEntityComponent addEntity() { //3
3285      AuditEventEntityComponent t = new AuditEventEntityComponent();
3286      if (this.entity == null)
3287        this.entity = new ArrayList<AuditEventEntityComponent>();
3288      this.entity.add(t);
3289      return t;
3290    }
3291
3292    public AuditEvent addEntity(AuditEventEntityComponent t) { //3
3293      if (t == null)
3294        return this;
3295      if (this.entity == null)
3296        this.entity = new ArrayList<AuditEventEntityComponent>();
3297      this.entity.add(t);
3298      return this;
3299    }
3300
3301    /**
3302     * @return The first repetition of repeating field {@link #entity}, creating it if it does not already exist
3303     */
3304    public AuditEventEntityComponent getEntityFirstRep() { 
3305      if (getEntity().isEmpty()) {
3306        addEntity();
3307      }
3308      return getEntity().get(0);
3309    }
3310
3311      protected void listChildren(List<Property> childrenList) {
3312        super.listChildren(childrenList);
3313        childrenList.add(new Property("type", "Coding", "Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.", 0, java.lang.Integer.MAX_VALUE, type));
3314        childrenList.add(new Property("subtype", "Coding", "Identifier for the category of event.", 0, java.lang.Integer.MAX_VALUE, subtype));
3315        childrenList.add(new Property("action", "code", "Indicator for type of action performed during the event that generated the audit.", 0, java.lang.Integer.MAX_VALUE, action));
3316        childrenList.add(new Property("recorded", "instant", "The time when the event occurred on the source.", 0, java.lang.Integer.MAX_VALUE, recorded));
3317        childrenList.add(new Property("outcome", "code", "Indicates whether the event succeeded or failed.", 0, java.lang.Integer.MAX_VALUE, outcome));
3318        childrenList.add(new Property("outcomeDesc", "string", "A free text description of the outcome of the event.", 0, java.lang.Integer.MAX_VALUE, outcomeDesc));
3319        childrenList.add(new Property("purposeOfEvent", "CodeableConcept", "The purposeOfUse (reason) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, purposeOfEvent));
3320        childrenList.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));
3321        childrenList.add(new Property("source", "", "The system that is reporting the event.", 0, java.lang.Integer.MAX_VALUE, source));
3322        childrenList.add(new Property("entity", "", "Specific instances of data or objects that have been accessed.", 0, java.lang.Integer.MAX_VALUE, entity));
3323      }
3324
3325      @Override
3326      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3327        switch (hash) {
3328        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
3329        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // Coding
3330        case -1422950858: /*action*/ return this.action == null ? new Base[0] : new Base[] {this.action}; // Enumeration<AuditEventAction>
3331        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // InstantType
3332        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<AuditEventOutcome>
3333        case 1062502659: /*outcomeDesc*/ return this.outcomeDesc == null ? new Base[0] : new Base[] {this.outcomeDesc}; // StringType
3334        case -341917691: /*purposeOfEvent*/ return this.purposeOfEvent == null ? new Base[0] : this.purposeOfEvent.toArray(new Base[this.purposeOfEvent.size()]); // CodeableConcept
3335        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // AuditEventAgentComponent
3336        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // AuditEventSourceComponent
3337        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : this.entity.toArray(new Base[this.entity.size()]); // AuditEventEntityComponent
3338        default: return super.getProperty(hash, name, checkValid);
3339        }
3340
3341      }
3342
3343      @Override
3344      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3345        switch (hash) {
3346        case 3575610: // type
3347          this.type = castToCoding(value); // Coding
3348          return value;
3349        case -1867567750: // subtype
3350          this.getSubtype().add(castToCoding(value)); // Coding
3351          return value;
3352        case -1422950858: // action
3353          value = new AuditEventActionEnumFactory().fromType(castToCode(value));
3354          this.action = (Enumeration) value; // Enumeration<AuditEventAction>
3355          return value;
3356        case -799233872: // recorded
3357          this.recorded = castToInstant(value); // InstantType
3358          return value;
3359        case -1106507950: // outcome
3360          value = new AuditEventOutcomeEnumFactory().fromType(castToCode(value));
3361          this.outcome = (Enumeration) value; // Enumeration<AuditEventOutcome>
3362          return value;
3363        case 1062502659: // outcomeDesc
3364          this.outcomeDesc = castToString(value); // StringType
3365          return value;
3366        case -341917691: // purposeOfEvent
3367          this.getPurposeOfEvent().add(castToCodeableConcept(value)); // CodeableConcept
3368          return value;
3369        case 92750597: // agent
3370          this.getAgent().add((AuditEventAgentComponent) value); // AuditEventAgentComponent
3371          return value;
3372        case -896505829: // source
3373          this.source = (AuditEventSourceComponent) value; // AuditEventSourceComponent
3374          return value;
3375        case -1298275357: // entity
3376          this.getEntity().add((AuditEventEntityComponent) value); // AuditEventEntityComponent
3377          return value;
3378        default: return super.setProperty(hash, name, value);
3379        }
3380
3381      }
3382
3383      @Override
3384      public Base setProperty(String name, Base value) throws FHIRException {
3385        if (name.equals("type")) {
3386          this.type = castToCoding(value); // Coding
3387        } else if (name.equals("subtype")) {
3388          this.getSubtype().add(castToCoding(value));
3389        } else if (name.equals("action")) {
3390          value = new AuditEventActionEnumFactory().fromType(castToCode(value));
3391          this.action = (Enumeration) value; // Enumeration<AuditEventAction>
3392        } else if (name.equals("recorded")) {
3393          this.recorded = castToInstant(value); // InstantType
3394        } else if (name.equals("outcome")) {
3395          value = new AuditEventOutcomeEnumFactory().fromType(castToCode(value));
3396          this.outcome = (Enumeration) value; // Enumeration<AuditEventOutcome>
3397        } else if (name.equals("outcomeDesc")) {
3398          this.outcomeDesc = castToString(value); // StringType
3399        } else if (name.equals("purposeOfEvent")) {
3400          this.getPurposeOfEvent().add(castToCodeableConcept(value));
3401        } else if (name.equals("agent")) {
3402          this.getAgent().add((AuditEventAgentComponent) value);
3403        } else if (name.equals("source")) {
3404          this.source = (AuditEventSourceComponent) value; // AuditEventSourceComponent
3405        } else if (name.equals("entity")) {
3406          this.getEntity().add((AuditEventEntityComponent) value);
3407        } else
3408          return super.setProperty(name, value);
3409        return value;
3410      }
3411
3412      @Override
3413      public Base makeProperty(int hash, String name) throws FHIRException {
3414        switch (hash) {
3415        case 3575610:  return getType(); 
3416        case -1867567750:  return addSubtype(); 
3417        case -1422950858:  return getActionElement();
3418        case -799233872:  return getRecordedElement();
3419        case -1106507950:  return getOutcomeElement();
3420        case 1062502659:  return getOutcomeDescElement();
3421        case -341917691:  return addPurposeOfEvent(); 
3422        case 92750597:  return addAgent(); 
3423        case -896505829:  return getSource(); 
3424        case -1298275357:  return addEntity(); 
3425        default: return super.makeProperty(hash, name);
3426        }
3427
3428      }
3429
3430      @Override
3431      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3432        switch (hash) {
3433        case 3575610: /*type*/ return new String[] {"Coding"};
3434        case -1867567750: /*subtype*/ return new String[] {"Coding"};
3435        case -1422950858: /*action*/ return new String[] {"code"};
3436        case -799233872: /*recorded*/ return new String[] {"instant"};
3437        case -1106507950: /*outcome*/ return new String[] {"code"};
3438        case 1062502659: /*outcomeDesc*/ return new String[] {"string"};
3439        case -341917691: /*purposeOfEvent*/ return new String[] {"CodeableConcept"};
3440        case 92750597: /*agent*/ return new String[] {};
3441        case -896505829: /*source*/ return new String[] {};
3442        case -1298275357: /*entity*/ return new String[] {};
3443        default: return super.getTypesForProperty(hash, name);
3444        }
3445
3446      }
3447
3448      @Override
3449      public Base addChild(String name) throws FHIRException {
3450        if (name.equals("type")) {
3451          this.type = new Coding();
3452          return this.type;
3453        }
3454        else if (name.equals("subtype")) {
3455          return addSubtype();
3456        }
3457        else if (name.equals("action")) {
3458          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.action");
3459        }
3460        else if (name.equals("recorded")) {
3461          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.recorded");
3462        }
3463        else if (name.equals("outcome")) {
3464          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.outcome");
3465        }
3466        else if (name.equals("outcomeDesc")) {
3467          throw new FHIRException("Cannot call addChild on a primitive type AuditEvent.outcomeDesc");
3468        }
3469        else if (name.equals("purposeOfEvent")) {
3470          return addPurposeOfEvent();
3471        }
3472        else if (name.equals("agent")) {
3473          return addAgent();
3474        }
3475        else if (name.equals("source")) {
3476          this.source = new AuditEventSourceComponent();
3477          return this.source;
3478        }
3479        else if (name.equals("entity")) {
3480          return addEntity();
3481        }
3482        else
3483          return super.addChild(name);
3484      }
3485
3486  public String fhirType() {
3487    return "AuditEvent";
3488
3489  }
3490
3491      public AuditEvent copy() {
3492        AuditEvent dst = new AuditEvent();
3493        copyValues(dst);
3494        dst.type = type == null ? null : type.copy();
3495        if (subtype != null) {
3496          dst.subtype = new ArrayList<Coding>();
3497          for (Coding i : subtype)
3498            dst.subtype.add(i.copy());
3499        };
3500        dst.action = action == null ? null : action.copy();
3501        dst.recorded = recorded == null ? null : recorded.copy();
3502        dst.outcome = outcome == null ? null : outcome.copy();
3503        dst.outcomeDesc = outcomeDesc == null ? null : outcomeDesc.copy();
3504        if (purposeOfEvent != null) {
3505          dst.purposeOfEvent = new ArrayList<CodeableConcept>();
3506          for (CodeableConcept i : purposeOfEvent)
3507            dst.purposeOfEvent.add(i.copy());
3508        };
3509        if (agent != null) {
3510          dst.agent = new ArrayList<AuditEventAgentComponent>();
3511          for (AuditEventAgentComponent i : agent)
3512            dst.agent.add(i.copy());
3513        };
3514        dst.source = source == null ? null : source.copy();
3515        if (entity != null) {
3516          dst.entity = new ArrayList<AuditEventEntityComponent>();
3517          for (AuditEventEntityComponent i : entity)
3518            dst.entity.add(i.copy());
3519        };
3520        return dst;
3521      }
3522
3523      protected AuditEvent typedCopy() {
3524        return copy();
3525      }
3526
3527      @Override
3528      public boolean equalsDeep(Base other) {
3529        if (!super.equalsDeep(other))
3530          return false;
3531        if (!(other instanceof AuditEvent))
3532          return false;
3533        AuditEvent o = (AuditEvent) other;
3534        return compareDeep(type, o.type, true) && compareDeep(subtype, o.subtype, true) && compareDeep(action, o.action, true)
3535           && compareDeep(recorded, o.recorded, true) && compareDeep(outcome, o.outcome, true) && compareDeep(outcomeDesc, o.outcomeDesc, true)
3536           && compareDeep(purposeOfEvent, o.purposeOfEvent, true) && compareDeep(agent, o.agent, true) && compareDeep(source, o.source, true)
3537           && compareDeep(entity, o.entity, true);
3538      }
3539
3540      @Override
3541      public boolean equalsShallow(Base other) {
3542        if (!super.equalsShallow(other))
3543          return false;
3544        if (!(other instanceof AuditEvent))
3545          return false;
3546        AuditEvent o = (AuditEvent) other;
3547        return compareValues(action, o.action, true) && compareValues(recorded, o.recorded, true) && compareValues(outcome, o.outcome, true)
3548           && compareValues(outcomeDesc, o.outcomeDesc, true);
3549      }
3550
3551      public boolean isEmpty() {
3552        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, subtype, action, recorded
3553          , outcome, outcomeDesc, purposeOfEvent, agent, source, entity);
3554      }
3555
3556  @Override
3557  public ResourceType getResourceType() {
3558    return ResourceType.AuditEvent;
3559   }
3560
3561 /**
3562   * Search parameter: <b>date</b>
3563   * <p>
3564   * Description: <b>Time when the event occurred on source</b><br>
3565   * Type: <b>date</b><br>
3566   * Path: <b>AuditEvent.recorded</b><br>
3567   * </p>
3568   */
3569  @SearchParamDefinition(name="date", path="AuditEvent.recorded", description="Time when the event occurred on source", type="date" )
3570  public static final String SP_DATE = "date";
3571 /**
3572   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3573   * <p>
3574   * Description: <b>Time when the event occurred on source</b><br>
3575   * Type: <b>date</b><br>
3576   * Path: <b>AuditEvent.recorded</b><br>
3577   * </p>
3578   */
3579  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3580
3581 /**
3582   * Search parameter: <b>entity-type</b>
3583   * <p>
3584   * Description: <b>Type of entity involved</b><br>
3585   * Type: <b>token</b><br>
3586   * Path: <b>AuditEvent.entity.type</b><br>
3587   * </p>
3588   */
3589  @SearchParamDefinition(name="entity-type", path="AuditEvent.entity.type", description="Type of entity involved", type="token" )
3590  public static final String SP_ENTITY_TYPE = "entity-type";
3591 /**
3592   * <b>Fluent Client</b> search parameter constant for <b>entity-type</b>
3593   * <p>
3594   * Description: <b>Type of entity involved</b><br>
3595   * Type: <b>token</b><br>
3596   * Path: <b>AuditEvent.entity.type</b><br>
3597   * </p>
3598   */
3599  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ENTITY_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ENTITY_TYPE);
3600
3601 /**
3602   * Search parameter: <b>agent</b>
3603   * <p>
3604   * Description: <b>Direct reference to resource</b><br>
3605   * Type: <b>reference</b><br>
3606   * Path: <b>AuditEvent.agent.reference</b><br>
3607   * </p>
3608   */
3609  @SearchParamDefinition(name="agent", path="AuditEvent.agent.reference", description="Direct reference to resource", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3610  public static final String SP_AGENT = "agent";
3611 /**
3612   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
3613   * <p>
3614   * Description: <b>Direct reference to resource</b><br>
3615   * Type: <b>reference</b><br>
3616   * Path: <b>AuditEvent.agent.reference</b><br>
3617   * </p>
3618   */
3619  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
3620
3621/**
3622   * Constant for fluent queries to be used to add include statements. Specifies
3623   * the path value of "<b>AuditEvent:agent</b>".
3624   */
3625  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("AuditEvent:agent").toLocked();
3626
3627 /**
3628   * Search parameter: <b>address</b>
3629   * <p>
3630   * Description: <b>Identifier for the network access point of the user device</b><br>
3631   * Type: <b>string</b><br>
3632   * Path: <b>AuditEvent.agent.network.address</b><br>
3633   * </p>
3634   */
3635  @SearchParamDefinition(name="address", path="AuditEvent.agent.network.address", description="Identifier for the network access point of the user device", type="string" )
3636  public static final String SP_ADDRESS = "address";
3637 /**
3638   * <b>Fluent Client</b> search parameter constant for <b>address</b>
3639   * <p>
3640   * Description: <b>Identifier for the network access point of the user device</b><br>
3641   * Type: <b>string</b><br>
3642   * Path: <b>AuditEvent.agent.network.address</b><br>
3643   * </p>
3644   */
3645  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
3646
3647 /**
3648   * Search parameter: <b>entity-role</b>
3649   * <p>
3650   * Description: <b>What role the entity played</b><br>
3651   * Type: <b>token</b><br>
3652   * Path: <b>AuditEvent.entity.role</b><br>
3653   * </p>
3654   */
3655  @SearchParamDefinition(name="entity-role", path="AuditEvent.entity.role", description="What role the entity played", type="token" )
3656  public static final String SP_ENTITY_ROLE = "entity-role";
3657 /**
3658   * <b>Fluent Client</b> search parameter constant for <b>entity-role</b>
3659   * <p>
3660   * Description: <b>What role the entity played</b><br>
3661   * Type: <b>token</b><br>
3662   * Path: <b>AuditEvent.entity.role</b><br>
3663   * </p>
3664   */
3665  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ENTITY_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ENTITY_ROLE);
3666
3667 /**
3668   * Search parameter: <b>source</b>
3669   * <p>
3670   * Description: <b>The identity of source detecting the event</b><br>
3671   * Type: <b>token</b><br>
3672   * Path: <b>AuditEvent.source.identifier</b><br>
3673   * </p>
3674   */
3675  @SearchParamDefinition(name="source", path="AuditEvent.source.identifier", description="The identity of source detecting the event", type="token" )
3676  public static final String SP_SOURCE = "source";
3677 /**
3678   * <b>Fluent Client</b> search parameter constant for <b>source</b>
3679   * <p>
3680   * Description: <b>The identity of source detecting the event</b><br>
3681   * Type: <b>token</b><br>
3682   * Path: <b>AuditEvent.source.identifier</b><br>
3683   * </p>
3684   */
3685  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SOURCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SOURCE);
3686
3687 /**
3688   * Search parameter: <b>type</b>
3689   * <p>
3690   * Description: <b>Type/identifier of event</b><br>
3691   * Type: <b>token</b><br>
3692   * Path: <b>AuditEvent.type</b><br>
3693   * </p>
3694   */
3695  @SearchParamDefinition(name="type", path="AuditEvent.type", description="Type/identifier of event", type="token" )
3696  public static final String SP_TYPE = "type";
3697 /**
3698   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3699   * <p>
3700   * Description: <b>Type/identifier of event</b><br>
3701   * Type: <b>token</b><br>
3702   * Path: <b>AuditEvent.type</b><br>
3703   * </p>
3704   */
3705  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3706
3707 /**
3708   * Search parameter: <b>altid</b>
3709   * <p>
3710   * Description: <b>Alternative User id e.g. authentication</b><br>
3711   * Type: <b>token</b><br>
3712   * Path: <b>AuditEvent.agent.altId</b><br>
3713   * </p>
3714   */
3715  @SearchParamDefinition(name="altid", path="AuditEvent.agent.altId", description="Alternative User id e.g. authentication", type="token" )
3716  public static final String SP_ALTID = "altid";
3717 /**
3718   * <b>Fluent Client</b> search parameter constant for <b>altid</b>
3719   * <p>
3720   * Description: <b>Alternative User id e.g. authentication</b><br>
3721   * Type: <b>token</b><br>
3722   * Path: <b>AuditEvent.agent.altId</b><br>
3723   * </p>
3724   */
3725  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ALTID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ALTID);
3726
3727 /**
3728   * Search parameter: <b>site</b>
3729   * <p>
3730   * Description: <b>Logical source location within the enterprise</b><br>
3731   * Type: <b>token</b><br>
3732   * Path: <b>AuditEvent.source.site</b><br>
3733   * </p>
3734   */
3735  @SearchParamDefinition(name="site", path="AuditEvent.source.site", description="Logical source location within the enterprise", type="token" )
3736  public static final String SP_SITE = "site";
3737 /**
3738   * <b>Fluent Client</b> search parameter constant for <b>site</b>
3739   * <p>
3740   * Description: <b>Logical source location within the enterprise</b><br>
3741   * Type: <b>token</b><br>
3742   * Path: <b>AuditEvent.source.site</b><br>
3743   * </p>
3744   */
3745  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SITE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SITE);
3746
3747 /**
3748   * Search parameter: <b>agent-name</b>
3749   * <p>
3750   * Description: <b>Human-meaningful name for the agent</b><br>
3751   * Type: <b>string</b><br>
3752   * Path: <b>AuditEvent.agent.name</b><br>
3753   * </p>
3754   */
3755  @SearchParamDefinition(name="agent-name", path="AuditEvent.agent.name", description="Human-meaningful name for the agent", type="string" )
3756  public static final String SP_AGENT_NAME = "agent-name";
3757 /**
3758   * <b>Fluent Client</b> search parameter constant for <b>agent-name</b>
3759   * <p>
3760   * Description: <b>Human-meaningful name for the agent</b><br>
3761   * Type: <b>string</b><br>
3762   * Path: <b>AuditEvent.agent.name</b><br>
3763   * </p>
3764   */
3765  public static final ca.uhn.fhir.rest.gclient.StringClientParam AGENT_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_AGENT_NAME);
3766
3767 /**
3768   * Search parameter: <b>entity-name</b>
3769   * <p>
3770   * Description: <b>Descriptor for entity</b><br>
3771   * Type: <b>string</b><br>
3772   * Path: <b>AuditEvent.entity.name</b><br>
3773   * </p>
3774   */
3775  @SearchParamDefinition(name="entity-name", path="AuditEvent.entity.name", description="Descriptor for entity", type="string" )
3776  public static final String SP_ENTITY_NAME = "entity-name";
3777 /**
3778   * <b>Fluent Client</b> search parameter constant for <b>entity-name</b>
3779   * <p>
3780   * Description: <b>Descriptor for entity</b><br>
3781   * Type: <b>string</b><br>
3782   * Path: <b>AuditEvent.entity.name</b><br>
3783   * </p>
3784   */
3785  public static final ca.uhn.fhir.rest.gclient.StringClientParam ENTITY_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ENTITY_NAME);
3786
3787 /**
3788   * Search parameter: <b>subtype</b>
3789   * <p>
3790   * Description: <b>More specific type/id for the event</b><br>
3791   * Type: <b>token</b><br>
3792   * Path: <b>AuditEvent.subtype</b><br>
3793   * </p>
3794   */
3795  @SearchParamDefinition(name="subtype", path="AuditEvent.subtype", description="More specific type/id for the event", type="token" )
3796  public static final String SP_SUBTYPE = "subtype";
3797 /**
3798   * <b>Fluent Client</b> search parameter constant for <b>subtype</b>
3799   * <p>
3800   * Description: <b>More specific type/id for the event</b><br>
3801   * Type: <b>token</b><br>
3802   * Path: <b>AuditEvent.subtype</b><br>
3803   * </p>
3804   */
3805  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBTYPE);
3806
3807 /**
3808   * Search parameter: <b>patient</b>
3809   * <p>
3810   * Description: <b>Direct reference to resource</b><br>
3811   * Type: <b>reference</b><br>
3812   * Path: <b>AuditEvent.agent.reference, AuditEvent.entity.reference</b><br>
3813   * </p>
3814   */
3815  @SearchParamDefinition(name="patient", path="AuditEvent.agent.reference | AuditEvent.entity.reference", description="Direct reference to resource", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
3816  public static final String SP_PATIENT = "patient";
3817 /**
3818   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3819   * <p>
3820   * Description: <b>Direct reference to resource</b><br>
3821   * Type: <b>reference</b><br>
3822   * Path: <b>AuditEvent.agent.reference, AuditEvent.entity.reference</b><br>
3823   * </p>
3824   */
3825  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3826
3827/**
3828   * Constant for fluent queries to be used to add include statements. Specifies
3829   * the path value of "<b>AuditEvent:patient</b>".
3830   */
3831  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AuditEvent:patient").toLocked();
3832
3833 /**
3834   * Search parameter: <b>action</b>
3835   * <p>
3836   * Description: <b>Type of action performed during the event</b><br>
3837   * Type: <b>token</b><br>
3838   * Path: <b>AuditEvent.action</b><br>
3839   * </p>
3840   */
3841  @SearchParamDefinition(name="action", path="AuditEvent.action", description="Type of action performed during the event", type="token" )
3842  public static final String SP_ACTION = "action";
3843 /**
3844   * <b>Fluent Client</b> search parameter constant for <b>action</b>
3845   * <p>
3846   * Description: <b>Type of action performed during the event</b><br>
3847   * Type: <b>token</b><br>
3848   * Path: <b>AuditEvent.action</b><br>
3849   * </p>
3850   */
3851  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTION);
3852
3853 /**
3854   * Search parameter: <b>agent-role</b>
3855   * <p>
3856   * Description: <b>Agent role in the event</b><br>
3857   * Type: <b>token</b><br>
3858   * Path: <b>AuditEvent.agent.role</b><br>
3859   * </p>
3860   */
3861  @SearchParamDefinition(name="agent-role", path="AuditEvent.agent.role", description="Agent role in the event", type="token" )
3862  public static final String SP_AGENT_ROLE = "agent-role";
3863 /**
3864   * <b>Fluent Client</b> search parameter constant for <b>agent-role</b>
3865   * <p>
3866   * Description: <b>Agent role in the event</b><br>
3867   * Type: <b>token</b><br>
3868   * Path: <b>AuditEvent.agent.role</b><br>
3869   * </p>
3870   */
3871  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_ROLE);
3872
3873 /**
3874   * Search parameter: <b>user</b>
3875   * <p>
3876   * Description: <b>Unique identifier for the user</b><br>
3877   * Type: <b>token</b><br>
3878   * Path: <b>AuditEvent.agent.userId</b><br>
3879   * </p>
3880   */
3881  @SearchParamDefinition(name="user", path="AuditEvent.agent.userId", description="Unique identifier for the user", type="token" )
3882  public static final String SP_USER = "user";
3883 /**
3884   * <b>Fluent Client</b> search parameter constant for <b>user</b>
3885   * <p>
3886   * Description: <b>Unique identifier for the user</b><br>
3887   * Type: <b>token</b><br>
3888   * Path: <b>AuditEvent.agent.userId</b><br>
3889   * </p>
3890   */
3891  public static final ca.uhn.fhir.rest.gclient.TokenClientParam USER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_USER);
3892
3893 /**
3894   * Search parameter: <b>entity</b>
3895   * <p>
3896   * Description: <b>Specific instance of resource</b><br>
3897   * Type: <b>reference</b><br>
3898   * Path: <b>AuditEvent.entity.reference</b><br>
3899   * </p>
3900   */
3901  @SearchParamDefinition(name="entity", path="AuditEvent.entity.reference", description="Specific instance of resource", type="reference" )
3902  public static final String SP_ENTITY = "entity";
3903 /**
3904   * <b>Fluent Client</b> search parameter constant for <b>entity</b>
3905   * <p>
3906   * Description: <b>Specific instance of resource</b><br>
3907   * Type: <b>reference</b><br>
3908   * Path: <b>AuditEvent.entity.reference</b><br>
3909   * </p>
3910   */
3911  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTITY);
3912
3913/**
3914   * Constant for fluent queries to be used to add include statements. Specifies
3915   * the path value of "<b>AuditEvent:entity</b>".
3916   */
3917  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTITY = new ca.uhn.fhir.model.api.Include("AuditEvent:entity").toLocked();
3918
3919 /**
3920   * Search parameter: <b>entity-id</b>
3921   * <p>
3922   * Description: <b>Specific instance of object</b><br>
3923   * Type: <b>token</b><br>
3924   * Path: <b>AuditEvent.entity.identifier</b><br>
3925   * </p>
3926   */
3927  @SearchParamDefinition(name="entity-id", path="AuditEvent.entity.identifier", description="Specific instance of object", type="token" )
3928  public static final String SP_ENTITY_ID = "entity-id";
3929 /**
3930   * <b>Fluent Client</b> search parameter constant for <b>entity-id</b>
3931   * <p>
3932   * Description: <b>Specific instance of object</b><br>
3933   * Type: <b>token</b><br>
3934   * Path: <b>AuditEvent.entity.identifier</b><br>
3935   * </p>
3936   */
3937  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ENTITY_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ENTITY_ID);
3938
3939 /**
3940   * Search parameter: <b>outcome</b>
3941   * <p>
3942   * Description: <b>Whether the event succeeded or failed</b><br>
3943   * Type: <b>token</b><br>
3944   * Path: <b>AuditEvent.outcome</b><br>
3945   * </p>
3946   */
3947  @SearchParamDefinition(name="outcome", path="AuditEvent.outcome", description="Whether the event succeeded or failed", type="token" )
3948  public static final String SP_OUTCOME = "outcome";
3949 /**
3950   * <b>Fluent Client</b> search parameter constant for <b>outcome</b>
3951   * <p>
3952   * Description: <b>Whether the event succeeded or failed</b><br>
3953   * Type: <b>token</b><br>
3954   * Path: <b>AuditEvent.outcome</b><br>
3955   * </p>
3956   */
3957  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OUTCOME = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OUTCOME);
3958
3959 /**
3960   * Search parameter: <b>policy</b>
3961   * <p>
3962   * Description: <b>Policy that authorized event</b><br>
3963   * Type: <b>uri</b><br>
3964   * Path: <b>AuditEvent.agent.policy</b><br>
3965   * </p>
3966   */
3967  @SearchParamDefinition(name="policy", path="AuditEvent.agent.policy", description="Policy that authorized event", type="uri" )
3968  public static final String SP_POLICY = "policy";
3969 /**
3970   * <b>Fluent Client</b> search parameter constant for <b>policy</b>
3971   * <p>
3972   * Description: <b>Policy that authorized event</b><br>
3973   * Type: <b>uri</b><br>
3974   * Path: <b>AuditEvent.agent.policy</b><br>
3975   * </p>
3976   */
3977  public static final ca.uhn.fhir.rest.gclient.UriClientParam POLICY = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_POLICY);
3978
3979
3980}
3981