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