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