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