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