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