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