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