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