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