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