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