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