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