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