001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Provenance of a resource is a record that describes entities and processes involved in producing and delivering or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become important records with their own provenance. Provenance statement indicates clinical significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust policies.
052 */
053@ResourceDef(name="Provenance", profile="http://hl7.org/fhir/StructureDefinition/Provenance")
054public class Provenance extends DomainResource {
055
056    public enum ProvenanceEntityRole {
057        /**
058         * An entity that is used by the activity to produce a new version of that entity.
059         */
060        REVISION, 
061        /**
062         * An entity that is copied in full or part by an agent that is not the author of the entity.
063         */
064        QUOTATION, 
065        /**
066         * An entity that is used as input to the activity that produced the target.
067         */
068        SOURCE, 
069        /**
070         * The record resulting from this event adheres to the protocol, guideline, order set or other definition represented by this entity.
071         */
072        INSTANTIATES, 
073        /**
074         * An entity that is removed from accessibility, usually through the DELETE operator.
075         */
076        REMOVAL, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static ProvenanceEntityRole fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("revision".equals(codeString))
085          return REVISION;
086        if ("quotation".equals(codeString))
087          return QUOTATION;
088        if ("source".equals(codeString))
089          return SOURCE;
090        if ("instantiates".equals(codeString))
091          return INSTANTIATES;
092        if ("removal".equals(codeString))
093          return REMOVAL;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case REVISION: return "revision";
102            case QUOTATION: return "quotation";
103            case SOURCE: return "source";
104            case INSTANTIATES: return "instantiates";
105            case REMOVAL: return "removal";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getSystem() {
111          switch (this) {
112            case REVISION: return "http://hl7.org/fhir/provenance-entity-role";
113            case QUOTATION: return "http://hl7.org/fhir/provenance-entity-role";
114            case SOURCE: return "http://hl7.org/fhir/provenance-entity-role";
115            case INSTANTIATES: return "http://hl7.org/fhir/provenance-entity-role";
116            case REMOVAL: return "http://hl7.org/fhir/provenance-entity-role";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case REVISION: return "An entity that is used by the activity to produce a new version of that entity.";
124            case QUOTATION: return "An entity that is copied in full or part by an agent that is not the author of the entity.";
125            case SOURCE: return "An entity that is used as input to the activity that produced the target.";
126            case INSTANTIATES: return "The record resulting from this event adheres to the protocol, guideline, order set or other definition represented by this entity.";
127            case REMOVAL: return "An entity that is removed from accessibility, usually through the DELETE operator.";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132        public String getDisplay() {
133          switch (this) {
134            case REVISION: return "Revision";
135            case QUOTATION: return "Quotation";
136            case SOURCE: return "Source";
137            case INSTANTIATES: return "Instantiates";
138            case REMOVAL: return "Removal";
139            case NULL: return null;
140            default: return "?";
141          }
142        }
143    }
144
145  public static class ProvenanceEntityRoleEnumFactory implements EnumFactory<ProvenanceEntityRole> {
146    public ProvenanceEntityRole fromCode(String codeString) throws IllegalArgumentException {
147      if (codeString == null || "".equals(codeString))
148            if (codeString == null || "".equals(codeString))
149                return null;
150        if ("revision".equals(codeString))
151          return ProvenanceEntityRole.REVISION;
152        if ("quotation".equals(codeString))
153          return ProvenanceEntityRole.QUOTATION;
154        if ("source".equals(codeString))
155          return ProvenanceEntityRole.SOURCE;
156        if ("instantiates".equals(codeString))
157          return ProvenanceEntityRole.INSTANTIATES;
158        if ("removal".equals(codeString))
159          return ProvenanceEntityRole.REMOVAL;
160        throw new IllegalArgumentException("Unknown ProvenanceEntityRole code '"+codeString+"'");
161        }
162        public Enumeration<ProvenanceEntityRole> fromType(PrimitiveType<?> code) throws FHIRException {
163          if (code == null)
164            return null;
165          if (code.isEmpty())
166            return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.NULL, code);
167          String codeString = ((PrimitiveType) code).asStringValue();
168          if (codeString == null || "".equals(codeString))
169            return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.NULL, code);
170        if ("revision".equals(codeString))
171          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.REVISION, code);
172        if ("quotation".equals(codeString))
173          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.QUOTATION, code);
174        if ("source".equals(codeString))
175          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.SOURCE, code);
176        if ("instantiates".equals(codeString))
177          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.INSTANTIATES, code);
178        if ("removal".equals(codeString))
179          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.REMOVAL, code);
180        throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'");
181        }
182    public String toCode(ProvenanceEntityRole code) {
183      if (code == ProvenanceEntityRole.REVISION)
184        return "revision";
185      if (code == ProvenanceEntityRole.QUOTATION)
186        return "quotation";
187      if (code == ProvenanceEntityRole.SOURCE)
188        return "source";
189      if (code == ProvenanceEntityRole.INSTANTIATES)
190        return "instantiates";
191      if (code == ProvenanceEntityRole.REMOVAL)
192        return "removal";
193      return "?";
194      }
195    public String toSystem(ProvenanceEntityRole code) {
196      return code.getSystem();
197      }
198    }
199
200    @Block()
201    public static class ProvenanceAgentComponent extends BackboneElement implements IBaseBackboneElement {
202        /**
203         * The Functional Role of the agent with respect to the activity.
204         */
205        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
206        @Description(shortDefinition="How the agent participated", formalDefinition="The Functional Role of the agent with respect to the activity." )
207        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participation-role-type")
208        protected CodeableConcept type;
209
210        /**
211         * The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.
212         */
213        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
214        @Description(shortDefinition="What the agents role was", formalDefinition="The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity." )
215        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-role-type")
216        protected List<CodeableConcept> role;
217
218        /**
219         * Indicates who or what performed in the event.
220         */
221        @Child(name = "who", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=3, min=1, max=1, modifier=false, summary=true)
222        @Description(shortDefinition="The agent that participated in the event", formalDefinition="Indicates who or what performed in the event." )
223        protected Reference who;
224
225        /**
226         * The agent that delegated authority to perform the activity performed by the agent.who element.
227         */
228        @Child(name = "onBehalfOf", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class}, order=4, min=0, max=1, modifier=false, summary=false)
229        @Description(shortDefinition="The agent that delegated", formalDefinition="The agent that delegated authority to perform the activity performed by the agent.who element." )
230        protected Reference onBehalfOf;
231
232        private static final long serialVersionUID = 642650054L;
233
234    /**
235     * Constructor
236     */
237      public ProvenanceAgentComponent() {
238        super();
239      }
240
241    /**
242     * Constructor
243     */
244      public ProvenanceAgentComponent(Reference who) {
245        super();
246        this.setWho(who);
247      }
248
249        /**
250         * @return {@link #type} (The Functional Role of the agent with respect to the activity.)
251         */
252        public CodeableConcept getType() { 
253          if (this.type == null)
254            if (Configuration.errorOnAutoCreate())
255              throw new Error("Attempt to auto-create ProvenanceAgentComponent.type");
256            else if (Configuration.doAutoCreate())
257              this.type = new CodeableConcept(); // cc
258          return this.type;
259        }
260
261        public boolean hasType() { 
262          return this.type != null && !this.type.isEmpty();
263        }
264
265        /**
266         * @param value {@link #type} (The Functional Role of the agent with respect to the activity.)
267         */
268        public ProvenanceAgentComponent setType(CodeableConcept value) { 
269          this.type = value;
270          return this;
271        }
272
273        /**
274         * @return {@link #role} (The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.)
275         */
276        public List<CodeableConcept> getRole() { 
277          if (this.role == null)
278            this.role = new ArrayList<CodeableConcept>();
279          return this.role;
280        }
281
282        /**
283         * @return Returns a reference to <code>this</code> for easy method chaining
284         */
285        public ProvenanceAgentComponent setRole(List<CodeableConcept> theRole) { 
286          this.role = theRole;
287          return this;
288        }
289
290        public boolean hasRole() { 
291          if (this.role == null)
292            return false;
293          for (CodeableConcept item : this.role)
294            if (!item.isEmpty())
295              return true;
296          return false;
297        }
298
299        public CodeableConcept addRole() { //3
300          CodeableConcept t = new CodeableConcept();
301          if (this.role == null)
302            this.role = new ArrayList<CodeableConcept>();
303          this.role.add(t);
304          return t;
305        }
306
307        public ProvenanceAgentComponent addRole(CodeableConcept t) { //3
308          if (t == null)
309            return this;
310          if (this.role == null)
311            this.role = new ArrayList<CodeableConcept>();
312          this.role.add(t);
313          return this;
314        }
315
316        /**
317         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist {3}
318         */
319        public CodeableConcept getRoleFirstRep() { 
320          if (getRole().isEmpty()) {
321            addRole();
322          }
323          return getRole().get(0);
324        }
325
326        /**
327         * @return {@link #who} (Indicates who or what performed in the event.)
328         */
329        public Reference getWho() { 
330          if (this.who == null)
331            if (Configuration.errorOnAutoCreate())
332              throw new Error("Attempt to auto-create ProvenanceAgentComponent.who");
333            else if (Configuration.doAutoCreate())
334              this.who = new Reference(); // cc
335          return this.who;
336        }
337
338        public boolean hasWho() { 
339          return this.who != null && !this.who.isEmpty();
340        }
341
342        /**
343         * @param value {@link #who} (Indicates who or what performed in the event.)
344         */
345        public ProvenanceAgentComponent setWho(Reference value) { 
346          this.who = value;
347          return this;
348        }
349
350        /**
351         * @return {@link #onBehalfOf} (The agent that delegated authority to perform the activity performed by the agent.who element.)
352         */
353        public Reference getOnBehalfOf() { 
354          if (this.onBehalfOf == null)
355            if (Configuration.errorOnAutoCreate())
356              throw new Error("Attempt to auto-create ProvenanceAgentComponent.onBehalfOf");
357            else if (Configuration.doAutoCreate())
358              this.onBehalfOf = new Reference(); // cc
359          return this.onBehalfOf;
360        }
361
362        public boolean hasOnBehalfOf() { 
363          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
364        }
365
366        /**
367         * @param value {@link #onBehalfOf} (The agent that delegated authority to perform the activity performed by the agent.who element.)
368         */
369        public ProvenanceAgentComponent setOnBehalfOf(Reference value) { 
370          this.onBehalfOf = value;
371          return this;
372        }
373
374        protected void listChildren(List<Property> children) {
375          super.listChildren(children);
376          children.add(new Property("type", "CodeableConcept", "The Functional Role of the agent with respect to the activity.", 0, 1, type));
377          children.add(new Property("role", "CodeableConcept", "The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role));
378          children.add(new Property("who", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what performed in the event.", 0, 1, who));
379          children.add(new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient)", "The agent that delegated authority to perform the activity performed by the agent.who element.", 0, 1, onBehalfOf));
380        }
381
382        @Override
383        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
384          switch (_hash) {
385          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The Functional Role of the agent with respect to the activity.", 0, 1, type);
386          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The structural roles of the agent indicating the agent's competency. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role);
387          case 117694: /*who*/  return new Property("who", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what performed in the event.", 0, 1, who);
388          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient)", "The agent that delegated authority to perform the activity performed by the agent.who element.", 0, 1, onBehalfOf);
389          default: return super.getNamedProperty(_hash, _name, _checkValid);
390          }
391
392        }
393
394      @Override
395      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
396        switch (hash) {
397        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
398        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
399        case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Reference
400        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
401        default: return super.getProperty(hash, name, checkValid);
402        }
403
404      }
405
406      @Override
407      public Base setProperty(int hash, String name, Base value) throws FHIRException {
408        switch (hash) {
409        case 3575610: // type
410          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
411          return value;
412        case 3506294: // role
413          this.getRole().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
414          return value;
415        case 117694: // who
416          this.who = TypeConvertor.castToReference(value); // Reference
417          return value;
418        case -14402964: // onBehalfOf
419          this.onBehalfOf = TypeConvertor.castToReference(value); // Reference
420          return value;
421        default: return super.setProperty(hash, name, value);
422        }
423
424      }
425
426      @Override
427      public Base setProperty(String name, Base value) throws FHIRException {
428        if (name.equals("type")) {
429          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
430        } else if (name.equals("role")) {
431          this.getRole().add(TypeConvertor.castToCodeableConcept(value));
432        } else if (name.equals("who")) {
433          this.who = TypeConvertor.castToReference(value); // Reference
434        } else if (name.equals("onBehalfOf")) {
435          this.onBehalfOf = TypeConvertor.castToReference(value); // Reference
436        } else
437          return super.setProperty(name, value);
438        return value;
439      }
440
441      @Override
442      public Base makeProperty(int hash, String name) throws FHIRException {
443        switch (hash) {
444        case 3575610:  return getType();
445        case 3506294:  return addRole(); 
446        case 117694:  return getWho();
447        case -14402964:  return getOnBehalfOf();
448        default: return super.makeProperty(hash, name);
449        }
450
451      }
452
453      @Override
454      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
455        switch (hash) {
456        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
457        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
458        case 117694: /*who*/ return new String[] {"Reference"};
459        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
460        default: return super.getTypesForProperty(hash, name);
461        }
462
463      }
464
465      @Override
466      public Base addChild(String name) throws FHIRException {
467        if (name.equals("type")) {
468          this.type = new CodeableConcept();
469          return this.type;
470        }
471        else if (name.equals("role")) {
472          return addRole();
473        }
474        else if (name.equals("who")) {
475          this.who = new Reference();
476          return this.who;
477        }
478        else if (name.equals("onBehalfOf")) {
479          this.onBehalfOf = new Reference();
480          return this.onBehalfOf;
481        }
482        else
483          return super.addChild(name);
484      }
485
486      public ProvenanceAgentComponent copy() {
487        ProvenanceAgentComponent dst = new ProvenanceAgentComponent();
488        copyValues(dst);
489        return dst;
490      }
491
492      public void copyValues(ProvenanceAgentComponent dst) {
493        super.copyValues(dst);
494        dst.type = type == null ? null : type.copy();
495        if (role != null) {
496          dst.role = new ArrayList<CodeableConcept>();
497          for (CodeableConcept i : role)
498            dst.role.add(i.copy());
499        };
500        dst.who = who == null ? null : who.copy();
501        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
502      }
503
504      @Override
505      public boolean equalsDeep(Base other_) {
506        if (!super.equalsDeep(other_))
507          return false;
508        if (!(other_ instanceof ProvenanceAgentComponent))
509          return false;
510        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
511        return compareDeep(type, o.type, true) && compareDeep(role, o.role, true) && compareDeep(who, o.who, true)
512           && compareDeep(onBehalfOf, o.onBehalfOf, true);
513      }
514
515      @Override
516      public boolean equalsShallow(Base other_) {
517        if (!super.equalsShallow(other_))
518          return false;
519        if (!(other_ instanceof ProvenanceAgentComponent))
520          return false;
521        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
522        return true;
523      }
524
525      public boolean isEmpty() {
526        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, role, who, onBehalfOf
527          );
528      }
529
530  public String fhirType() {
531    return "Provenance.agent";
532
533  }
534
535  }
536
537    @Block()
538    public static class ProvenanceEntityComponent extends BackboneElement implements IBaseBackboneElement {
539        /**
540         * How the entity was used during the activity.
541         */
542        @Child(name = "role", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
543        @Description(shortDefinition="revision | quotation | source | instantiates | removal", formalDefinition="How the entity was used during the activity." )
544        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-entity-role")
545        protected Enumeration<ProvenanceEntityRole> role;
546
547        /**
548         * Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.
549         */
550        @Child(name = "what", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true)
551        @Description(shortDefinition="Identity of entity", formalDefinition="Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative." )
552        protected Reference what;
553
554        /**
555         * The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which used the entity.
556         */
557        @Child(name = "agent", type = {ProvenanceAgentComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
558        @Description(shortDefinition="Entity is attributed to this agent", formalDefinition="The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which used the entity." )
559        protected List<ProvenanceAgentComponent> agent;
560
561        private static final long serialVersionUID = 211110220L;
562
563    /**
564     * Constructor
565     */
566      public ProvenanceEntityComponent() {
567        super();
568      }
569
570    /**
571     * Constructor
572     */
573      public ProvenanceEntityComponent(ProvenanceEntityRole role, Reference what) {
574        super();
575        this.setRole(role);
576        this.setWhat(what);
577      }
578
579        /**
580         * @return {@link #role} (How the entity was used during the activity.). This is the underlying object with id, value and extensions. The accessor "getRole" gives direct access to the value
581         */
582        public Enumeration<ProvenanceEntityRole> getRoleElement() { 
583          if (this.role == null)
584            if (Configuration.errorOnAutoCreate())
585              throw new Error("Attempt to auto-create ProvenanceEntityComponent.role");
586            else if (Configuration.doAutoCreate())
587              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory()); // bb
588          return this.role;
589        }
590
591        public boolean hasRoleElement() { 
592          return this.role != null && !this.role.isEmpty();
593        }
594
595        public boolean hasRole() { 
596          return this.role != null && !this.role.isEmpty();
597        }
598
599        /**
600         * @param value {@link #role} (How the entity was used during the activity.). This is the underlying object with id, value and extensions. The accessor "getRole" gives direct access to the value
601         */
602        public ProvenanceEntityComponent setRoleElement(Enumeration<ProvenanceEntityRole> value) { 
603          this.role = value;
604          return this;
605        }
606
607        /**
608         * @return How the entity was used during the activity.
609         */
610        public ProvenanceEntityRole getRole() { 
611          return this.role == null ? null : this.role.getValue();
612        }
613
614        /**
615         * @param value How the entity was used during the activity.
616         */
617        public ProvenanceEntityComponent setRole(ProvenanceEntityRole value) { 
618            if (this.role == null)
619              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory());
620            this.role.setValue(value);
621          return this;
622        }
623
624        /**
625         * @return {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
626         */
627        public Reference getWhat() { 
628          if (this.what == null)
629            if (Configuration.errorOnAutoCreate())
630              throw new Error("Attempt to auto-create ProvenanceEntityComponent.what");
631            else if (Configuration.doAutoCreate())
632              this.what = new Reference(); // cc
633          return this.what;
634        }
635
636        public boolean hasWhat() { 
637          return this.what != null && !this.what.isEmpty();
638        }
639
640        /**
641         * @param value {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
642         */
643        public ProvenanceEntityComponent setWhat(Reference value) { 
644          this.what = value;
645          return this;
646        }
647
648        /**
649         * @return {@link #agent} (The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which used the entity.)
650         */
651        public List<ProvenanceAgentComponent> getAgent() { 
652          if (this.agent == null)
653            this.agent = new ArrayList<ProvenanceAgentComponent>();
654          return this.agent;
655        }
656
657        /**
658         * @return Returns a reference to <code>this</code> for easy method chaining
659         */
660        public ProvenanceEntityComponent setAgent(List<ProvenanceAgentComponent> theAgent) { 
661          this.agent = theAgent;
662          return this;
663        }
664
665        public boolean hasAgent() { 
666          if (this.agent == null)
667            return false;
668          for (ProvenanceAgentComponent item : this.agent)
669            if (!item.isEmpty())
670              return true;
671          return false;
672        }
673
674        public ProvenanceAgentComponent addAgent() { //3
675          ProvenanceAgentComponent t = new ProvenanceAgentComponent();
676          if (this.agent == null)
677            this.agent = new ArrayList<ProvenanceAgentComponent>();
678          this.agent.add(t);
679          return t;
680        }
681
682        public ProvenanceEntityComponent addAgent(ProvenanceAgentComponent t) { //3
683          if (t == null)
684            return this;
685          if (this.agent == null)
686            this.agent = new ArrayList<ProvenanceAgentComponent>();
687          this.agent.add(t);
688          return this;
689        }
690
691        /**
692         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
693         */
694        public ProvenanceAgentComponent getAgentFirstRep() { 
695          if (getAgent().isEmpty()) {
696            addAgent();
697          }
698          return getAgent().get(0);
699        }
700
701        protected void listChildren(List<Property> children) {
702          super.listChildren(children);
703          children.add(new Property("role", "code", "How the entity was used during the activity.", 0, 1, role));
704          children.add(new Property("what", "Reference(Any)", "Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.", 0, 1, what));
705          children.add(new Property("agent", "@Provenance.agent", "The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which used the entity.", 0, java.lang.Integer.MAX_VALUE, agent));
706        }
707
708        @Override
709        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
710          switch (_hash) {
711          case 3506294: /*role*/  return new Property("role", "code", "How the entity was used during the activity.", 0, 1, role);
712          case 3648196: /*what*/  return new Property("what", "Reference(Any)", "Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.", 0, 1, what);
713          case 92750597: /*agent*/  return new Property("agent", "@Provenance.agent", "The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which used the entity.", 0, java.lang.Integer.MAX_VALUE, agent);
714          default: return super.getNamedProperty(_hash, _name, _checkValid);
715          }
716
717        }
718
719      @Override
720      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
721        switch (hash) {
722        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // Enumeration<ProvenanceEntityRole>
723        case 3648196: /*what*/ return this.what == null ? new Base[0] : new Base[] {this.what}; // Reference
724        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
725        default: return super.getProperty(hash, name, checkValid);
726        }
727
728      }
729
730      @Override
731      public Base setProperty(int hash, String name, Base value) throws FHIRException {
732        switch (hash) {
733        case 3506294: // role
734          value = new ProvenanceEntityRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
735          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
736          return value;
737        case 3648196: // what
738          this.what = TypeConvertor.castToReference(value); // Reference
739          return value;
740        case 92750597: // agent
741          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
742          return value;
743        default: return super.setProperty(hash, name, value);
744        }
745
746      }
747
748      @Override
749      public Base setProperty(String name, Base value) throws FHIRException {
750        if (name.equals("role")) {
751          value = new ProvenanceEntityRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
752          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
753        } else if (name.equals("what")) {
754          this.what = TypeConvertor.castToReference(value); // Reference
755        } else if (name.equals("agent")) {
756          this.getAgent().add((ProvenanceAgentComponent) value);
757        } else
758          return super.setProperty(name, value);
759        return value;
760      }
761
762      @Override
763      public Base makeProperty(int hash, String name) throws FHIRException {
764        switch (hash) {
765        case 3506294:  return getRoleElement();
766        case 3648196:  return getWhat();
767        case 92750597:  return addAgent(); 
768        default: return super.makeProperty(hash, name);
769        }
770
771      }
772
773      @Override
774      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
775        switch (hash) {
776        case 3506294: /*role*/ return new String[] {"code"};
777        case 3648196: /*what*/ return new String[] {"Reference"};
778        case 92750597: /*agent*/ return new String[] {"@Provenance.agent"};
779        default: return super.getTypesForProperty(hash, name);
780        }
781
782      }
783
784      @Override
785      public Base addChild(String name) throws FHIRException {
786        if (name.equals("role")) {
787          throw new FHIRException("Cannot call addChild on a singleton property Provenance.entity.role");
788        }
789        else if (name.equals("what")) {
790          this.what = new Reference();
791          return this.what;
792        }
793        else if (name.equals("agent")) {
794          return addAgent();
795        }
796        else
797          return super.addChild(name);
798      }
799
800      public ProvenanceEntityComponent copy() {
801        ProvenanceEntityComponent dst = new ProvenanceEntityComponent();
802        copyValues(dst);
803        return dst;
804      }
805
806      public void copyValues(ProvenanceEntityComponent dst) {
807        super.copyValues(dst);
808        dst.role = role == null ? null : role.copy();
809        dst.what = what == null ? null : what.copy();
810        if (agent != null) {
811          dst.agent = new ArrayList<ProvenanceAgentComponent>();
812          for (ProvenanceAgentComponent i : agent)
813            dst.agent.add(i.copy());
814        };
815      }
816
817      @Override
818      public boolean equalsDeep(Base other_) {
819        if (!super.equalsDeep(other_))
820          return false;
821        if (!(other_ instanceof ProvenanceEntityComponent))
822          return false;
823        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
824        return compareDeep(role, o.role, true) && compareDeep(what, o.what, true) && compareDeep(agent, o.agent, true)
825          ;
826      }
827
828      @Override
829      public boolean equalsShallow(Base other_) {
830        if (!super.equalsShallow(other_))
831          return false;
832        if (!(other_ instanceof ProvenanceEntityComponent))
833          return false;
834        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
835        return compareValues(role, o.role, true);
836      }
837
838      public boolean isEmpty() {
839        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, what, agent);
840      }
841
842  public String fhirType() {
843    return "Provenance.entity";
844
845  }
846
847  }
848
849    /**
850     * The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.
851     */
852    @Child(name = "target", type = {Reference.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
853    @Description(shortDefinition="Target Reference(s) (usually version specific)", formalDefinition="The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity." )
854    protected List<Reference> target;
855
856    /**
857     * The period during which the activity occurred.
858     */
859    @Child(name = "occurred", type = {Period.class, DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
860    @Description(shortDefinition="When the activity occurred", formalDefinition="The period during which the activity occurred." )
861    protected DataType occurred;
862
863    /**
864     * The instant of time at which the activity was recorded.
865     */
866    @Child(name = "recorded", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true)
867    @Description(shortDefinition="When the activity was recorded / updated", formalDefinition="The instant of time at which the activity was recorded." )
868    protected InstantType recorded;
869
870    /**
871     * Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.
872     */
873    @Child(name = "policy", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
874    @Description(shortDefinition="Policy or plan the activity was defined by", formalDefinition="Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc." )
875    protected List<UriType> policy;
876
877    /**
878     * Where the activity occurred, if relevant.
879     */
880    @Child(name = "location", type = {Location.class}, order=4, min=0, max=1, modifier=false, summary=false)
881    @Description(shortDefinition="Where the activity occurred, if relevant", formalDefinition="Where the activity occurred, if relevant." )
882    protected Reference location;
883
884    /**
885     * The authorization (e.g., PurposeOfUse) that was used during the event being recorded.
886     */
887    @Child(name = "authorization", type = {CodeableReference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
888    @Description(shortDefinition="Authorization (purposeOfUse) related to the event", formalDefinition="The authorization (e.g., PurposeOfUse) that was used during the event being recorded." )
889    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
890    protected List<CodeableReference> authorization;
891
892    /**
893     * An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.
894     */
895    @Child(name = "activity", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
896    @Description(shortDefinition="Activity that occurred", formalDefinition="An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities." )
897    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-activity-type")
898    protected CodeableConcept activity;
899
900    /**
901     * Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.
902     */
903    @Child(name = "basedOn", type = {CarePlan.class, DeviceRequest.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class, ServiceRequest.class, Task.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
904    @Description(shortDefinition="Workflow authorization within which this event occurred", formalDefinition="Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon." )
905    protected List<Reference> basedOn;
906
907    /**
908     * The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.
909     */
910    @Child(name = "patient", type = {Patient.class}, order=8, min=0, max=1, modifier=false, summary=false)
911    @Description(shortDefinition="The patient is the subject of the data created/updated (.target) by the activity", formalDefinition="The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity." )
912    protected Reference patient;
913
914    /**
915     * This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).
916     */
917    @Child(name = "encounter", type = {Encounter.class}, order=9, min=0, max=1, modifier=false, summary=false)
918    @Description(shortDefinition="Encounter within which this event occurred or which the event is tightly associated", formalDefinition="This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests)." )
919    protected Reference encounter;
920
921    /**
922     * An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.
923     */
924    @Child(name = "agent", type = {}, order=10, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
925    @Description(shortDefinition="Actor involved", formalDefinition="An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place." )
926    protected List<ProvenanceAgentComponent> agent;
927
928    /**
929     * An entity used in this activity.
930     */
931    @Child(name = "entity", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
932    @Description(shortDefinition="An entity used in this activity", formalDefinition="An entity used in this activity." )
933    protected List<ProvenanceEntityComponent> entity;
934
935    /**
936     * A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.
937     */
938    @Child(name = "signature", type = {Signature.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
939    @Description(shortDefinition="Signature on target", formalDefinition="A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated." )
940    protected List<Signature> signature;
941
942    private static final long serialVersionUID = 2001521682L;
943
944  /**
945   * Constructor
946   */
947    public Provenance() {
948      super();
949    }
950
951  /**
952   * Constructor
953   */
954    public Provenance(Reference target, ProvenanceAgentComponent agent) {
955      super();
956      this.addTarget(target);
957      this.addAgent(agent);
958    }
959
960    /**
961     * @return {@link #target} (The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.)
962     */
963    public List<Reference> getTarget() { 
964      if (this.target == null)
965        this.target = new ArrayList<Reference>();
966      return this.target;
967    }
968
969    /**
970     * @return Returns a reference to <code>this</code> for easy method chaining
971     */
972    public Provenance setTarget(List<Reference> theTarget) { 
973      this.target = theTarget;
974      return this;
975    }
976
977    public boolean hasTarget() { 
978      if (this.target == null)
979        return false;
980      for (Reference item : this.target)
981        if (!item.isEmpty())
982          return true;
983      return false;
984    }
985
986    public Reference addTarget() { //3
987      Reference t = new Reference();
988      if (this.target == null)
989        this.target = new ArrayList<Reference>();
990      this.target.add(t);
991      return t;
992    }
993
994    public Provenance addTarget(Reference t) { //3
995      if (t == null)
996        return this;
997      if (this.target == null)
998        this.target = new ArrayList<Reference>();
999      this.target.add(t);
1000      return this;
1001    }
1002
1003    /**
1004     * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist {3}
1005     */
1006    public Reference getTargetFirstRep() { 
1007      if (getTarget().isEmpty()) {
1008        addTarget();
1009      }
1010      return getTarget().get(0);
1011    }
1012
1013    /**
1014     * @return {@link #occurred} (The period during which the activity occurred.)
1015     */
1016    public DataType getOccurred() { 
1017      return this.occurred;
1018    }
1019
1020    /**
1021     * @return {@link #occurred} (The period during which the activity occurred.)
1022     */
1023    public Period getOccurredPeriod() throws FHIRException { 
1024      if (this.occurred == null)
1025        this.occurred = new Period();
1026      if (!(this.occurred instanceof Period))
1027        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurred.getClass().getName()+" was encountered");
1028      return (Period) this.occurred;
1029    }
1030
1031    public boolean hasOccurredPeriod() { 
1032      return this != null && this.occurred instanceof Period;
1033    }
1034
1035    /**
1036     * @return {@link #occurred} (The period during which the activity occurred.)
1037     */
1038    public DateTimeType getOccurredDateTimeType() throws FHIRException { 
1039      if (this.occurred == null)
1040        this.occurred = new DateTimeType();
1041      if (!(this.occurred instanceof DateTimeType))
1042        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurred.getClass().getName()+" was encountered");
1043      return (DateTimeType) this.occurred;
1044    }
1045
1046    public boolean hasOccurredDateTimeType() { 
1047      return this != null && this.occurred instanceof DateTimeType;
1048    }
1049
1050    public boolean hasOccurred() { 
1051      return this.occurred != null && !this.occurred.isEmpty();
1052    }
1053
1054    /**
1055     * @param value {@link #occurred} (The period during which the activity occurred.)
1056     */
1057    public Provenance setOccurred(DataType value) { 
1058      if (value != null && !(value instanceof Period || value instanceof DateTimeType))
1059        throw new FHIRException("Not the right type for Provenance.occurred[x]: "+value.fhirType());
1060      this.occurred = value;
1061      return this;
1062    }
1063
1064    /**
1065     * @return {@link #recorded} (The instant of time at which the activity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1066     */
1067    public InstantType getRecordedElement() { 
1068      if (this.recorded == null)
1069        if (Configuration.errorOnAutoCreate())
1070          throw new Error("Attempt to auto-create Provenance.recorded");
1071        else if (Configuration.doAutoCreate())
1072          this.recorded = new InstantType(); // bb
1073      return this.recorded;
1074    }
1075
1076    public boolean hasRecordedElement() { 
1077      return this.recorded != null && !this.recorded.isEmpty();
1078    }
1079
1080    public boolean hasRecorded() { 
1081      return this.recorded != null && !this.recorded.isEmpty();
1082    }
1083
1084    /**
1085     * @param value {@link #recorded} (The instant of time at which the activity was recorded.). This is the underlying object with id, value and extensions. The accessor "getRecorded" gives direct access to the value
1086     */
1087    public Provenance setRecordedElement(InstantType value) { 
1088      this.recorded = value;
1089      return this;
1090    }
1091
1092    /**
1093     * @return The instant of time at which the activity was recorded.
1094     */
1095    public Date getRecorded() { 
1096      return this.recorded == null ? null : this.recorded.getValue();
1097    }
1098
1099    /**
1100     * @param value The instant of time at which the activity was recorded.
1101     */
1102    public Provenance setRecorded(Date value) { 
1103      if (value == null)
1104        this.recorded = null;
1105      else {
1106        if (this.recorded == null)
1107          this.recorded = new InstantType();
1108        this.recorded.setValue(value);
1109      }
1110      return this;
1111    }
1112
1113    /**
1114     * @return {@link #policy} (Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.)
1115     */
1116    public List<UriType> getPolicy() { 
1117      if (this.policy == null)
1118        this.policy = new ArrayList<UriType>();
1119      return this.policy;
1120    }
1121
1122    /**
1123     * @return Returns a reference to <code>this</code> for easy method chaining
1124     */
1125    public Provenance setPolicy(List<UriType> thePolicy) { 
1126      this.policy = thePolicy;
1127      return this;
1128    }
1129
1130    public boolean hasPolicy() { 
1131      if (this.policy == null)
1132        return false;
1133      for (UriType item : this.policy)
1134        if (!item.isEmpty())
1135          return true;
1136      return false;
1137    }
1138
1139    /**
1140     * @return {@link #policy} (Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.)
1141     */
1142    public UriType addPolicyElement() {//2 
1143      UriType t = new UriType();
1144      if (this.policy == null)
1145        this.policy = new ArrayList<UriType>();
1146      this.policy.add(t);
1147      return t;
1148    }
1149
1150    /**
1151     * @param value {@link #policy} (Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.)
1152     */
1153    public Provenance addPolicy(String value) { //1
1154      UriType t = new UriType();
1155      t.setValue(value);
1156      if (this.policy == null)
1157        this.policy = new ArrayList<UriType>();
1158      this.policy.add(t);
1159      return this;
1160    }
1161
1162    /**
1163     * @param value {@link #policy} (Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.)
1164     */
1165    public boolean hasPolicy(String value) { 
1166      if (this.policy == null)
1167        return false;
1168      for (UriType v : this.policy)
1169        if (v.getValue().equals(value)) // uri
1170          return true;
1171      return false;
1172    }
1173
1174    /**
1175     * @return {@link #location} (Where the activity occurred, if relevant.)
1176     */
1177    public Reference getLocation() { 
1178      if (this.location == null)
1179        if (Configuration.errorOnAutoCreate())
1180          throw new Error("Attempt to auto-create Provenance.location");
1181        else if (Configuration.doAutoCreate())
1182          this.location = new Reference(); // cc
1183      return this.location;
1184    }
1185
1186    public boolean hasLocation() { 
1187      return this.location != null && !this.location.isEmpty();
1188    }
1189
1190    /**
1191     * @param value {@link #location} (Where the activity occurred, if relevant.)
1192     */
1193    public Provenance setLocation(Reference value) { 
1194      this.location = value;
1195      return this;
1196    }
1197
1198    /**
1199     * @return {@link #authorization} (The authorization (e.g., PurposeOfUse) that was used during the event being recorded.)
1200     */
1201    public List<CodeableReference> getAuthorization() { 
1202      if (this.authorization == null)
1203        this.authorization = new ArrayList<CodeableReference>();
1204      return this.authorization;
1205    }
1206
1207    /**
1208     * @return Returns a reference to <code>this</code> for easy method chaining
1209     */
1210    public Provenance setAuthorization(List<CodeableReference> theAuthorization) { 
1211      this.authorization = theAuthorization;
1212      return this;
1213    }
1214
1215    public boolean hasAuthorization() { 
1216      if (this.authorization == null)
1217        return false;
1218      for (CodeableReference item : this.authorization)
1219        if (!item.isEmpty())
1220          return true;
1221      return false;
1222    }
1223
1224    public CodeableReference addAuthorization() { //3
1225      CodeableReference t = new CodeableReference();
1226      if (this.authorization == null)
1227        this.authorization = new ArrayList<CodeableReference>();
1228      this.authorization.add(t);
1229      return t;
1230    }
1231
1232    public Provenance addAuthorization(CodeableReference t) { //3
1233      if (t == null)
1234        return this;
1235      if (this.authorization == null)
1236        this.authorization = new ArrayList<CodeableReference>();
1237      this.authorization.add(t);
1238      return this;
1239    }
1240
1241    /**
1242     * @return The first repetition of repeating field {@link #authorization}, creating it if it does not already exist {3}
1243     */
1244    public CodeableReference getAuthorizationFirstRep() { 
1245      if (getAuthorization().isEmpty()) {
1246        addAuthorization();
1247      }
1248      return getAuthorization().get(0);
1249    }
1250
1251    /**
1252     * @return {@link #activity} (An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.)
1253     */
1254    public CodeableConcept getActivity() { 
1255      if (this.activity == null)
1256        if (Configuration.errorOnAutoCreate())
1257          throw new Error("Attempt to auto-create Provenance.activity");
1258        else if (Configuration.doAutoCreate())
1259          this.activity = new CodeableConcept(); // cc
1260      return this.activity;
1261    }
1262
1263    public boolean hasActivity() { 
1264      return this.activity != null && !this.activity.isEmpty();
1265    }
1266
1267    /**
1268     * @param value {@link #activity} (An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.)
1269     */
1270    public Provenance setActivity(CodeableConcept value) { 
1271      this.activity = value;
1272      return this;
1273    }
1274
1275    /**
1276     * @return {@link #basedOn} (Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.)
1277     */
1278    public List<Reference> getBasedOn() { 
1279      if (this.basedOn == null)
1280        this.basedOn = new ArrayList<Reference>();
1281      return this.basedOn;
1282    }
1283
1284    /**
1285     * @return Returns a reference to <code>this</code> for easy method chaining
1286     */
1287    public Provenance setBasedOn(List<Reference> theBasedOn) { 
1288      this.basedOn = theBasedOn;
1289      return this;
1290    }
1291
1292    public boolean hasBasedOn() { 
1293      if (this.basedOn == null)
1294        return false;
1295      for (Reference item : this.basedOn)
1296        if (!item.isEmpty())
1297          return true;
1298      return false;
1299    }
1300
1301    public Reference addBasedOn() { //3
1302      Reference t = new Reference();
1303      if (this.basedOn == null)
1304        this.basedOn = new ArrayList<Reference>();
1305      this.basedOn.add(t);
1306      return t;
1307    }
1308
1309    public Provenance addBasedOn(Reference t) { //3
1310      if (t == null)
1311        return this;
1312      if (this.basedOn == null)
1313        this.basedOn = new ArrayList<Reference>();
1314      this.basedOn.add(t);
1315      return this;
1316    }
1317
1318    /**
1319     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
1320     */
1321    public Reference getBasedOnFirstRep() { 
1322      if (getBasedOn().isEmpty()) {
1323        addBasedOn();
1324      }
1325      return getBasedOn().get(0);
1326    }
1327
1328    /**
1329     * @return {@link #patient} (The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.)
1330     */
1331    public Reference getPatient() { 
1332      if (this.patient == null)
1333        if (Configuration.errorOnAutoCreate())
1334          throw new Error("Attempt to auto-create Provenance.patient");
1335        else if (Configuration.doAutoCreate())
1336          this.patient = new Reference(); // cc
1337      return this.patient;
1338    }
1339
1340    public boolean hasPatient() { 
1341      return this.patient != null && !this.patient.isEmpty();
1342    }
1343
1344    /**
1345     * @param value {@link #patient} (The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.)
1346     */
1347    public Provenance setPatient(Reference value) { 
1348      this.patient = value;
1349      return this;
1350    }
1351
1352    /**
1353     * @return {@link #encounter} (This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).)
1354     */
1355    public Reference getEncounter() { 
1356      if (this.encounter == null)
1357        if (Configuration.errorOnAutoCreate())
1358          throw new Error("Attempt to auto-create Provenance.encounter");
1359        else if (Configuration.doAutoCreate())
1360          this.encounter = new Reference(); // cc
1361      return this.encounter;
1362    }
1363
1364    public boolean hasEncounter() { 
1365      return this.encounter != null && !this.encounter.isEmpty();
1366    }
1367
1368    /**
1369     * @param value {@link #encounter} (This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).)
1370     */
1371    public Provenance setEncounter(Reference value) { 
1372      this.encounter = value;
1373      return this;
1374    }
1375
1376    /**
1377     * @return {@link #agent} (An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.)
1378     */
1379    public List<ProvenanceAgentComponent> getAgent() { 
1380      if (this.agent == null)
1381        this.agent = new ArrayList<ProvenanceAgentComponent>();
1382      return this.agent;
1383    }
1384
1385    /**
1386     * @return Returns a reference to <code>this</code> for easy method chaining
1387     */
1388    public Provenance setAgent(List<ProvenanceAgentComponent> theAgent) { 
1389      this.agent = theAgent;
1390      return this;
1391    }
1392
1393    public boolean hasAgent() { 
1394      if (this.agent == null)
1395        return false;
1396      for (ProvenanceAgentComponent item : this.agent)
1397        if (!item.isEmpty())
1398          return true;
1399      return false;
1400    }
1401
1402    public ProvenanceAgentComponent addAgent() { //3
1403      ProvenanceAgentComponent t = new ProvenanceAgentComponent();
1404      if (this.agent == null)
1405        this.agent = new ArrayList<ProvenanceAgentComponent>();
1406      this.agent.add(t);
1407      return t;
1408    }
1409
1410    public Provenance addAgent(ProvenanceAgentComponent t) { //3
1411      if (t == null)
1412        return this;
1413      if (this.agent == null)
1414        this.agent = new ArrayList<ProvenanceAgentComponent>();
1415      this.agent.add(t);
1416      return this;
1417    }
1418
1419    /**
1420     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
1421     */
1422    public ProvenanceAgentComponent getAgentFirstRep() { 
1423      if (getAgent().isEmpty()) {
1424        addAgent();
1425      }
1426      return getAgent().get(0);
1427    }
1428
1429    /**
1430     * @return {@link #entity} (An entity used in this activity.)
1431     */
1432    public List<ProvenanceEntityComponent> getEntity() { 
1433      if (this.entity == null)
1434        this.entity = new ArrayList<ProvenanceEntityComponent>();
1435      return this.entity;
1436    }
1437
1438    /**
1439     * @return Returns a reference to <code>this</code> for easy method chaining
1440     */
1441    public Provenance setEntity(List<ProvenanceEntityComponent> theEntity) { 
1442      this.entity = theEntity;
1443      return this;
1444    }
1445
1446    public boolean hasEntity() { 
1447      if (this.entity == null)
1448        return false;
1449      for (ProvenanceEntityComponent item : this.entity)
1450        if (!item.isEmpty())
1451          return true;
1452      return false;
1453    }
1454
1455    public ProvenanceEntityComponent addEntity() { //3
1456      ProvenanceEntityComponent t = new ProvenanceEntityComponent();
1457      if (this.entity == null)
1458        this.entity = new ArrayList<ProvenanceEntityComponent>();
1459      this.entity.add(t);
1460      return t;
1461    }
1462
1463    public Provenance addEntity(ProvenanceEntityComponent t) { //3
1464      if (t == null)
1465        return this;
1466      if (this.entity == null)
1467        this.entity = new ArrayList<ProvenanceEntityComponent>();
1468      this.entity.add(t);
1469      return this;
1470    }
1471
1472    /**
1473     * @return The first repetition of repeating field {@link #entity}, creating it if it does not already exist {3}
1474     */
1475    public ProvenanceEntityComponent getEntityFirstRep() { 
1476      if (getEntity().isEmpty()) {
1477        addEntity();
1478      }
1479      return getEntity().get(0);
1480    }
1481
1482    /**
1483     * @return {@link #signature} (A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.)
1484     */
1485    public List<Signature> getSignature() { 
1486      if (this.signature == null)
1487        this.signature = new ArrayList<Signature>();
1488      return this.signature;
1489    }
1490
1491    /**
1492     * @return Returns a reference to <code>this</code> for easy method chaining
1493     */
1494    public Provenance setSignature(List<Signature> theSignature) { 
1495      this.signature = theSignature;
1496      return this;
1497    }
1498
1499    public boolean hasSignature() { 
1500      if (this.signature == null)
1501        return false;
1502      for (Signature item : this.signature)
1503        if (!item.isEmpty())
1504          return true;
1505      return false;
1506    }
1507
1508    public Signature addSignature() { //3
1509      Signature t = new Signature();
1510      if (this.signature == null)
1511        this.signature = new ArrayList<Signature>();
1512      this.signature.add(t);
1513      return t;
1514    }
1515
1516    public Provenance addSignature(Signature t) { //3
1517      if (t == null)
1518        return this;
1519      if (this.signature == null)
1520        this.signature = new ArrayList<Signature>();
1521      this.signature.add(t);
1522      return this;
1523    }
1524
1525    /**
1526     * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist {3}
1527     */
1528    public Signature getSignatureFirstRep() { 
1529      if (getSignature().isEmpty()) {
1530        addSignature();
1531      }
1532      return getSignature().get(0);
1533    }
1534
1535      protected void listChildren(List<Property> children) {
1536        super.listChildren(children);
1537        children.add(new Property("target", "Reference(Any)", "The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.", 0, java.lang.Integer.MAX_VALUE, target));
1538        children.add(new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred));
1539        children.add(new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded));
1540        children.add(new Property("policy", "uri", "Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.", 0, java.lang.Integer.MAX_VALUE, policy));
1541        children.add(new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location));
1542        children.add(new Property("authorization", "CodeableReference", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization));
1543        children.add(new Property("activity", "CodeableConcept", "An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.", 0, 1, activity));
1544        children.add(new Property("basedOn", "Reference(CarePlan|DeviceRequest|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest|Task)", "Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.", 0, java.lang.Integer.MAX_VALUE, basedOn));
1545        children.add(new Property("patient", "Reference(Patient)", "The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.", 0, 1, patient));
1546        children.add(new Property("encounter", "Reference(Encounter)", "This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).", 0, 1, encounter));
1547        children.add(new Property("agent", "", "An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent));
1548        children.add(new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity));
1549        children.add(new Property("signature", "Signature", "A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.", 0, java.lang.Integer.MAX_VALUE, signature));
1550      }
1551
1552      @Override
1553      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1554        switch (_hash) {
1555        case -880905839: /*target*/  return new Property("target", "Reference(Any)", "The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.", 0, java.lang.Integer.MAX_VALUE, target);
1556        case 784181563: /*occurred[x]*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1557        case 792816933: /*occurred*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1558        case 894082886: /*occurredPeriod*/  return new Property("occurred[x]", "Period", "The period during which the activity occurred.", 0, 1, occurred);
1559        case 1579027424: /*occurredDateTime*/  return new Property("occurred[x]", "dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1560        case -799233872: /*recorded*/  return new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded);
1561        case -982670030: /*policy*/  return new Property("policy", "uri", "Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.", 0, java.lang.Integer.MAX_VALUE, policy);
1562        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location);
1563        case -1385570183: /*authorization*/  return new Property("authorization", "CodeableReference", "The authorization (e.g., PurposeOfUse) that was used during the event being recorded.", 0, java.lang.Integer.MAX_VALUE, authorization);
1564        case -1655966961: /*activity*/  return new Property("activity", "CodeableConcept", "An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.", 0, 1, activity);
1565        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|DeviceRequest|ImmunizationRecommendation|MedicationRequest|NutritionOrder|ServiceRequest|Task)", "Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.", 0, java.lang.Integer.MAX_VALUE, basedOn);
1566        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The patient element is available to enable deterministic tracking of activities that involve the patient as the subject of the data used in an activity.", 0, 1, patient);
1567        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "This will typically be the encounter the event occurred, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission lab tests).", 0, 1, encounter);
1568        case 92750597: /*agent*/  return new Property("agent", "", "An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.", 0, java.lang.Integer.MAX_VALUE, agent);
1569        case -1298275357: /*entity*/  return new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity);
1570        case 1073584312: /*signature*/  return new Property("signature", "Signature", "A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.", 0, java.lang.Integer.MAX_VALUE, signature);
1571        default: return super.getNamedProperty(_hash, _name, _checkValid);
1572        }
1573
1574      }
1575
1576      @Override
1577      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1578        switch (hash) {
1579        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // Reference
1580        case 792816933: /*occurred*/ return this.occurred == null ? new Base[0] : new Base[] {this.occurred}; // DataType
1581        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // InstantType
1582        case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // UriType
1583        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1584        case -1385570183: /*authorization*/ return this.authorization == null ? new Base[0] : this.authorization.toArray(new Base[this.authorization.size()]); // CodeableReference
1585        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : new Base[] {this.activity}; // CodeableConcept
1586        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1587        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1588        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1589        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
1590        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : this.entity.toArray(new Base[this.entity.size()]); // ProvenanceEntityComponent
1591        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
1592        default: return super.getProperty(hash, name, checkValid);
1593        }
1594
1595      }
1596
1597      @Override
1598      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1599        switch (hash) {
1600        case -880905839: // target
1601          this.getTarget().add(TypeConvertor.castToReference(value)); // Reference
1602          return value;
1603        case 792816933: // occurred
1604          this.occurred = TypeConvertor.castToType(value); // DataType
1605          return value;
1606        case -799233872: // recorded
1607          this.recorded = TypeConvertor.castToInstant(value); // InstantType
1608          return value;
1609        case -982670030: // policy
1610          this.getPolicy().add(TypeConvertor.castToUri(value)); // UriType
1611          return value;
1612        case 1901043637: // location
1613          this.location = TypeConvertor.castToReference(value); // Reference
1614          return value;
1615        case -1385570183: // authorization
1616          this.getAuthorization().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
1617          return value;
1618        case -1655966961: // activity
1619          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1620          return value;
1621        case -332612366: // basedOn
1622          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
1623          return value;
1624        case -791418107: // patient
1625          this.patient = TypeConvertor.castToReference(value); // Reference
1626          return value;
1627        case 1524132147: // encounter
1628          this.encounter = TypeConvertor.castToReference(value); // Reference
1629          return value;
1630        case 92750597: // agent
1631          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
1632          return value;
1633        case -1298275357: // entity
1634          this.getEntity().add((ProvenanceEntityComponent) value); // ProvenanceEntityComponent
1635          return value;
1636        case 1073584312: // signature
1637          this.getSignature().add(TypeConvertor.castToSignature(value)); // Signature
1638          return value;
1639        default: return super.setProperty(hash, name, value);
1640        }
1641
1642      }
1643
1644      @Override
1645      public Base setProperty(String name, Base value) throws FHIRException {
1646        if (name.equals("target")) {
1647          this.getTarget().add(TypeConvertor.castToReference(value));
1648        } else if (name.equals("occurred[x]")) {
1649          this.occurred = TypeConvertor.castToType(value); // DataType
1650        } else if (name.equals("recorded")) {
1651          this.recorded = TypeConvertor.castToInstant(value); // InstantType
1652        } else if (name.equals("policy")) {
1653          this.getPolicy().add(TypeConvertor.castToUri(value));
1654        } else if (name.equals("location")) {
1655          this.location = TypeConvertor.castToReference(value); // Reference
1656        } else if (name.equals("authorization")) {
1657          this.getAuthorization().add(TypeConvertor.castToCodeableReference(value));
1658        } else if (name.equals("activity")) {
1659          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1660        } else if (name.equals("basedOn")) {
1661          this.getBasedOn().add(TypeConvertor.castToReference(value));
1662        } else if (name.equals("patient")) {
1663          this.patient = TypeConvertor.castToReference(value); // Reference
1664        } else if (name.equals("encounter")) {
1665          this.encounter = TypeConvertor.castToReference(value); // Reference
1666        } else if (name.equals("agent")) {
1667          this.getAgent().add((ProvenanceAgentComponent) value);
1668        } else if (name.equals("entity")) {
1669          this.getEntity().add((ProvenanceEntityComponent) value);
1670        } else if (name.equals("signature")) {
1671          this.getSignature().add(TypeConvertor.castToSignature(value));
1672        } else
1673          return super.setProperty(name, value);
1674        return value;
1675      }
1676
1677      @Override
1678      public Base makeProperty(int hash, String name) throws FHIRException {
1679        switch (hash) {
1680        case -880905839:  return addTarget(); 
1681        case 784181563:  return getOccurred();
1682        case 792816933:  return getOccurred();
1683        case -799233872:  return getRecordedElement();
1684        case -982670030:  return addPolicyElement();
1685        case 1901043637:  return getLocation();
1686        case -1385570183:  return addAuthorization(); 
1687        case -1655966961:  return getActivity();
1688        case -332612366:  return addBasedOn(); 
1689        case -791418107:  return getPatient();
1690        case 1524132147:  return getEncounter();
1691        case 92750597:  return addAgent(); 
1692        case -1298275357:  return addEntity(); 
1693        case 1073584312:  return addSignature(); 
1694        default: return super.makeProperty(hash, name);
1695        }
1696
1697      }
1698
1699      @Override
1700      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1701        switch (hash) {
1702        case -880905839: /*target*/ return new String[] {"Reference"};
1703        case 792816933: /*occurred*/ return new String[] {"Period", "dateTime"};
1704        case -799233872: /*recorded*/ return new String[] {"instant"};
1705        case -982670030: /*policy*/ return new String[] {"uri"};
1706        case 1901043637: /*location*/ return new String[] {"Reference"};
1707        case -1385570183: /*authorization*/ return new String[] {"CodeableReference"};
1708        case -1655966961: /*activity*/ return new String[] {"CodeableConcept"};
1709        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1710        case -791418107: /*patient*/ return new String[] {"Reference"};
1711        case 1524132147: /*encounter*/ return new String[] {"Reference"};
1712        case 92750597: /*agent*/ return new String[] {};
1713        case -1298275357: /*entity*/ return new String[] {};
1714        case 1073584312: /*signature*/ return new String[] {"Signature"};
1715        default: return super.getTypesForProperty(hash, name);
1716        }
1717
1718      }
1719
1720      @Override
1721      public Base addChild(String name) throws FHIRException {
1722        if (name.equals("target")) {
1723          return addTarget();
1724        }
1725        else if (name.equals("occurredPeriod")) {
1726          this.occurred = new Period();
1727          return this.occurred;
1728        }
1729        else if (name.equals("occurredDateTime")) {
1730          this.occurred = new DateTimeType();
1731          return this.occurred;
1732        }
1733        else if (name.equals("recorded")) {
1734          throw new FHIRException("Cannot call addChild on a singleton property Provenance.recorded");
1735        }
1736        else if (name.equals("policy")) {
1737          throw new FHIRException("Cannot call addChild on a singleton property Provenance.policy");
1738        }
1739        else if (name.equals("location")) {
1740          this.location = new Reference();
1741          return this.location;
1742        }
1743        else if (name.equals("authorization")) {
1744          return addAuthorization();
1745        }
1746        else if (name.equals("activity")) {
1747          this.activity = new CodeableConcept();
1748          return this.activity;
1749        }
1750        else if (name.equals("basedOn")) {
1751          return addBasedOn();
1752        }
1753        else if (name.equals("patient")) {
1754          this.patient = new Reference();
1755          return this.patient;
1756        }
1757        else if (name.equals("encounter")) {
1758          this.encounter = new Reference();
1759          return this.encounter;
1760        }
1761        else if (name.equals("agent")) {
1762          return addAgent();
1763        }
1764        else if (name.equals("entity")) {
1765          return addEntity();
1766        }
1767        else if (name.equals("signature")) {
1768          return addSignature();
1769        }
1770        else
1771          return super.addChild(name);
1772      }
1773
1774  public String fhirType() {
1775    return "Provenance";
1776
1777  }
1778
1779      public Provenance copy() {
1780        Provenance dst = new Provenance();
1781        copyValues(dst);
1782        return dst;
1783      }
1784
1785      public void copyValues(Provenance dst) {
1786        super.copyValues(dst);
1787        if (target != null) {
1788          dst.target = new ArrayList<Reference>();
1789          for (Reference i : target)
1790            dst.target.add(i.copy());
1791        };
1792        dst.occurred = occurred == null ? null : occurred.copy();
1793        dst.recorded = recorded == null ? null : recorded.copy();
1794        if (policy != null) {
1795          dst.policy = new ArrayList<UriType>();
1796          for (UriType i : policy)
1797            dst.policy.add(i.copy());
1798        };
1799        dst.location = location == null ? null : location.copy();
1800        if (authorization != null) {
1801          dst.authorization = new ArrayList<CodeableReference>();
1802          for (CodeableReference i : authorization)
1803            dst.authorization.add(i.copy());
1804        };
1805        dst.activity = activity == null ? null : activity.copy();
1806        if (basedOn != null) {
1807          dst.basedOn = new ArrayList<Reference>();
1808          for (Reference i : basedOn)
1809            dst.basedOn.add(i.copy());
1810        };
1811        dst.patient = patient == null ? null : patient.copy();
1812        dst.encounter = encounter == null ? null : encounter.copy();
1813        if (agent != null) {
1814          dst.agent = new ArrayList<ProvenanceAgentComponent>();
1815          for (ProvenanceAgentComponent i : agent)
1816            dst.agent.add(i.copy());
1817        };
1818        if (entity != null) {
1819          dst.entity = new ArrayList<ProvenanceEntityComponent>();
1820          for (ProvenanceEntityComponent i : entity)
1821            dst.entity.add(i.copy());
1822        };
1823        if (signature != null) {
1824          dst.signature = new ArrayList<Signature>();
1825          for (Signature i : signature)
1826            dst.signature.add(i.copy());
1827        };
1828      }
1829
1830      protected Provenance typedCopy() {
1831        return copy();
1832      }
1833
1834      @Override
1835      public boolean equalsDeep(Base other_) {
1836        if (!super.equalsDeep(other_))
1837          return false;
1838        if (!(other_ instanceof Provenance))
1839          return false;
1840        Provenance o = (Provenance) other_;
1841        return compareDeep(target, o.target, true) && compareDeep(occurred, o.occurred, true) && compareDeep(recorded, o.recorded, true)
1842           && compareDeep(policy, o.policy, true) && compareDeep(location, o.location, true) && compareDeep(authorization, o.authorization, true)
1843           && compareDeep(activity, o.activity, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(patient, o.patient, true)
1844           && compareDeep(encounter, o.encounter, true) && compareDeep(agent, o.agent, true) && compareDeep(entity, o.entity, true)
1845           && compareDeep(signature, o.signature, true);
1846      }
1847
1848      @Override
1849      public boolean equalsShallow(Base other_) {
1850        if (!super.equalsShallow(other_))
1851          return false;
1852        if (!(other_ instanceof Provenance))
1853          return false;
1854        Provenance o = (Provenance) other_;
1855        return compareValues(recorded, o.recorded, true) && compareValues(policy, o.policy, true);
1856      }
1857
1858      public boolean isEmpty() {
1859        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, occurred, recorded
1860          , policy, location, authorization, activity, basedOn, patient, encounter, agent
1861          , entity, signature);
1862      }
1863
1864  @Override
1865  public ResourceType getResourceType() {
1866    return ResourceType.Provenance;
1867   }
1868
1869 /**
1870   * Search parameter: <b>activity</b>
1871   * <p>
1872   * Description: <b>Activity that occurred</b><br>
1873   * Type: <b>token</b><br>
1874   * Path: <b>Provenance.activity</b><br>
1875   * </p>
1876   */
1877  @SearchParamDefinition(name="activity", path="Provenance.activity", description="Activity that occurred", type="token" )
1878  public static final String SP_ACTIVITY = "activity";
1879 /**
1880   * <b>Fluent Client</b> search parameter constant for <b>activity</b>
1881   * <p>
1882   * Description: <b>Activity that occurred</b><br>
1883   * Type: <b>token</b><br>
1884   * Path: <b>Provenance.activity</b><br>
1885   * </p>
1886   */
1887  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVITY);
1888
1889 /**
1890   * Search parameter: <b>agent-role</b>
1891   * <p>
1892   * Description: <b>What the agents role was</b><br>
1893   * Type: <b>token</b><br>
1894   * Path: <b>Provenance.agent.role</b><br>
1895   * </p>
1896   */
1897  @SearchParamDefinition(name="agent-role", path="Provenance.agent.role", description="What the agents role was", type="token" )
1898  public static final String SP_AGENT_ROLE = "agent-role";
1899 /**
1900   * <b>Fluent Client</b> search parameter constant for <b>agent-role</b>
1901   * <p>
1902   * Description: <b>What the agents role was</b><br>
1903   * Type: <b>token</b><br>
1904   * Path: <b>Provenance.agent.role</b><br>
1905   * </p>
1906   */
1907  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_ROLE);
1908
1909 /**
1910   * Search parameter: <b>agent-type</b>
1911   * <p>
1912   * Description: <b>How the agent participated</b><br>
1913   * Type: <b>token</b><br>
1914   * Path: <b>Provenance.agent.type</b><br>
1915   * </p>
1916   */
1917  @SearchParamDefinition(name="agent-type", path="Provenance.agent.type", description="How the agent participated", type="token" )
1918  public static final String SP_AGENT_TYPE = "agent-type";
1919 /**
1920   * <b>Fluent Client</b> search parameter constant for <b>agent-type</b>
1921   * <p>
1922   * Description: <b>How the agent participated</b><br>
1923   * Type: <b>token</b><br>
1924   * Path: <b>Provenance.agent.type</b><br>
1925   * </p>
1926   */
1927  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_TYPE);
1928
1929 /**
1930   * Search parameter: <b>agent</b>
1931   * <p>
1932   * Description: <b>Who participated</b><br>
1933   * Type: <b>reference</b><br>
1934   * Path: <b>Provenance.agent.who</b><br>
1935   * </p>
1936   */
1937  @SearchParamDefinition(name="agent", path="Provenance.agent.who", description="Who participated", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
1938  public static final String SP_AGENT = "agent";
1939 /**
1940   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
1941   * <p>
1942   * Description: <b>Who participated</b><br>
1943   * Type: <b>reference</b><br>
1944   * Path: <b>Provenance.agent.who</b><br>
1945   * </p>
1946   */
1947  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
1948
1949/**
1950   * Constant for fluent queries to be used to add include statements. Specifies
1951   * the path value of "<b>Provenance:agent</b>".
1952   */
1953  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("Provenance:agent").toLocked();
1954
1955 /**
1956   * Search parameter: <b>based-on</b>
1957   * <p>
1958   * Description: <b>Reference to the service request.</b><br>
1959   * Type: <b>reference</b><br>
1960   * Path: <b>Provenance.basedOn</b><br>
1961   * </p>
1962   */
1963  @SearchParamDefinition(name="based-on", path="Provenance.basedOn", description="Reference to the service request.", type="reference", target={CarePlan.class, DeviceRequest.class, ImmunizationRecommendation.class, MedicationRequest.class, NutritionOrder.class, ServiceRequest.class, Task.class } )
1964  public static final String SP_BASED_ON = "based-on";
1965 /**
1966   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
1967   * <p>
1968   * Description: <b>Reference to the service request.</b><br>
1969   * Type: <b>reference</b><br>
1970   * Path: <b>Provenance.basedOn</b><br>
1971   * </p>
1972   */
1973  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
1974
1975/**
1976   * Constant for fluent queries to be used to add include statements. Specifies
1977   * the path value of "<b>Provenance:based-on</b>".
1978   */
1979  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Provenance:based-on").toLocked();
1980
1981 /**
1982   * Search parameter: <b>entity</b>
1983   * <p>
1984   * Description: <b>Identity of entity</b><br>
1985   * Type: <b>reference</b><br>
1986   * Path: <b>Provenance.entity.what</b><br>
1987   * </p>
1988   */
1989  @SearchParamDefinition(name="entity", path="Provenance.entity.what", description="Identity of entity", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BiologicallyDerivedProductDispense.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceAssociation.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentReference.class, Encounter.class, EncounterHistory.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryItem.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Parameters.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestPlan.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
1990  public static final String SP_ENTITY = "entity";
1991 /**
1992   * <b>Fluent Client</b> search parameter constant for <b>entity</b>
1993   * <p>
1994   * Description: <b>Identity of entity</b><br>
1995   * Type: <b>reference</b><br>
1996   * Path: <b>Provenance.entity.what</b><br>
1997   * </p>
1998   */
1999  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTITY);
2000
2001/**
2002   * Constant for fluent queries to be used to add include statements. Specifies
2003   * the path value of "<b>Provenance:entity</b>".
2004   */
2005  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTITY = new ca.uhn.fhir.model.api.Include("Provenance:entity").toLocked();
2006
2007 /**
2008   * Search parameter: <b>location</b>
2009   * <p>
2010   * Description: <b>Where the activity occurred, if relevant</b><br>
2011   * Type: <b>reference</b><br>
2012   * Path: <b>Provenance.location</b><br>
2013   * </p>
2014   */
2015  @SearchParamDefinition(name="location", path="Provenance.location", description="Where the activity occurred, if relevant", type="reference", target={Location.class } )
2016  public static final String SP_LOCATION = "location";
2017 /**
2018   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2019   * <p>
2020   * Description: <b>Where the activity occurred, if relevant</b><br>
2021   * Type: <b>reference</b><br>
2022   * Path: <b>Provenance.location</b><br>
2023   * </p>
2024   */
2025  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2026
2027/**
2028   * Constant for fluent queries to be used to add include statements. Specifies
2029   * the path value of "<b>Provenance:location</b>".
2030   */
2031  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Provenance:location").toLocked();
2032
2033 /**
2034   * Search parameter: <b>recorded</b>
2035   * <p>
2036   * Description: <b>When the activity was recorded / updated</b><br>
2037   * Type: <b>date</b><br>
2038   * Path: <b>Provenance.recorded</b><br>
2039   * </p>
2040   */
2041  @SearchParamDefinition(name="recorded", path="Provenance.recorded", description="When the activity was recorded / updated", type="date" )
2042  public static final String SP_RECORDED = "recorded";
2043 /**
2044   * <b>Fluent Client</b> search parameter constant for <b>recorded</b>
2045   * <p>
2046   * Description: <b>When the activity was recorded / updated</b><br>
2047   * Type: <b>date</b><br>
2048   * Path: <b>Provenance.recorded</b><br>
2049   * </p>
2050   */
2051  public static final ca.uhn.fhir.rest.gclient.DateClientParam RECORDED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_RECORDED);
2052
2053 /**
2054   * Search parameter: <b>signature-type</b>
2055   * <p>
2056   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
2057   * Type: <b>token</b><br>
2058   * Path: <b>Provenance.signature.type</b><br>
2059   * </p>
2060   */
2061  @SearchParamDefinition(name="signature-type", path="Provenance.signature.type", description="Indication of the reason the entity signed the object(s)", type="token" )
2062  public static final String SP_SIGNATURE_TYPE = "signature-type";
2063 /**
2064   * <b>Fluent Client</b> search parameter constant for <b>signature-type</b>
2065   * <p>
2066   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
2067   * Type: <b>token</b><br>
2068   * Path: <b>Provenance.signature.type</b><br>
2069   * </p>
2070   */
2071  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SIGNATURE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SIGNATURE_TYPE);
2072
2073 /**
2074   * Search parameter: <b>target</b>
2075   * <p>
2076   * Description: <b>Target Reference(s) (usually version specific)</b><br>
2077   * Type: <b>reference</b><br>
2078   * Path: <b>Provenance.target</b><br>
2079   * </p>
2080   */
2081  @SearchParamDefinition(name="target", path="Provenance.target", description="Target Reference(s) (usually version specific)", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BiologicallyDerivedProductDispense.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceAssociation.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentReference.class, Encounter.class, EncounterHistory.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryItem.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Parameters.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestPlan.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } )
2082  public static final String SP_TARGET = "target";
2083 /**
2084   * <b>Fluent Client</b> search parameter constant for <b>target</b>
2085   * <p>
2086   * Description: <b>Target Reference(s) (usually version specific)</b><br>
2087   * Type: <b>reference</b><br>
2088   * Path: <b>Provenance.target</b><br>
2089   * </p>
2090   */
2091  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TARGET);
2092
2093/**
2094   * Constant for fluent queries to be used to add include statements. Specifies
2095   * the path value of "<b>Provenance:target</b>".
2096   */
2097  public static final ca.uhn.fhir.model.api.Include INCLUDE_TARGET = new ca.uhn.fhir.model.api.Include("Provenance:target").toLocked();
2098
2099 /**
2100   * Search parameter: <b>when</b>
2101   * <p>
2102   * Description: <b>When the activity occurred</b><br>
2103   * Type: <b>date</b><br>
2104   * Path: <b>(Provenance.occurred.ofType(dateTime))</b><br>
2105   * </p>
2106   */
2107  @SearchParamDefinition(name="when", path="(Provenance.occurred.ofType(dateTime))", description="When the activity occurred", type="date" )
2108  public static final String SP_WHEN = "when";
2109 /**
2110   * <b>Fluent Client</b> search parameter constant for <b>when</b>
2111   * <p>
2112   * Description: <b>When the activity occurred</b><br>
2113   * Type: <b>date</b><br>
2114   * Path: <b>(Provenance.occurred.ofType(dateTime))</b><br>
2115   * </p>
2116   */
2117  public static final ca.uhn.fhir.rest.gclient.DateClientParam WHEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHEN);
2118
2119 /**
2120   * Search parameter: <b>encounter</b>
2121   * <p>
2122   * Description: <b>Multiple Resources: 
2123
2124* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
2125* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
2126* [ChargeItem](chargeitem.html): Encounter associated with event
2127* [Claim](claim.html): Encounters associated with a billed line item
2128* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
2129* [Communication](communication.html): The Encounter during which this Communication was created
2130* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
2131* [Composition](composition.html): Context of the Composition
2132* [Condition](condition.html): The Encounter during which this Condition was created
2133* [DeviceRequest](devicerequest.html): Encounter during which request was created
2134* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2135* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
2136* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
2137* [Flag](flag.html): Alert relevant during encounter
2138* [ImagingStudy](imagingstudy.html): The context of the study
2139* [List](list.html): Context in which list created
2140* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
2141* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
2142* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
2143* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2144* [Observation](observation.html): Encounter related to the observation
2145* [Procedure](procedure.html): The Encounter during which this Procedure was created
2146* [Provenance](provenance.html): Encounter related to the Provenance
2147* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
2148* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
2149* [RiskAssessment](riskassessment.html): Where was assessment performed?
2150* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2151* [Task](task.html): Search by encounter
2152* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2153</b><br>
2154   * Type: <b>reference</b><br>
2155   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
2156   * </p>
2157   */
2158  @SearchParamDefinition(name="encounter", path="AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent\r\n* [CarePlan](careplan.html): The Encounter during which this CarePlan was created\r\n* [ChargeItem](chargeitem.html): Encounter associated with event\r\n* [Claim](claim.html): Encounters associated with a billed line item\r\n* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created\r\n* [Communication](communication.html): The Encounter during which this Communication was created\r\n* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created\r\n* [Composition](composition.html): Context of the Composition\r\n* [Condition](condition.html): The Encounter during which this Condition was created\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values\r\n* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [ImagingStudy](imagingstudy.html): The context of the study\r\n* [List](list.html): Context in which list created\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [Provenance](provenance.html): Encounter related to the Provenance\r\n* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response\r\n* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [Task](task.html): Search by encounter\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", target={Encounter.class } )
2159  public static final String SP_ENCOUNTER = "encounter";
2160 /**
2161   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2162   * <p>
2163   * Description: <b>Multiple Resources: 
2164
2165* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
2166* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
2167* [ChargeItem](chargeitem.html): Encounter associated with event
2168* [Claim](claim.html): Encounters associated with a billed line item
2169* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
2170* [Communication](communication.html): The Encounter during which this Communication was created
2171* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
2172* [Composition](composition.html): Context of the Composition
2173* [Condition](condition.html): The Encounter during which this Condition was created
2174* [DeviceRequest](devicerequest.html): Encounter during which request was created
2175* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2176* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
2177* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
2178* [Flag](flag.html): Alert relevant during encounter
2179* [ImagingStudy](imagingstudy.html): The context of the study
2180* [List](list.html): Context in which list created
2181* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
2182* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
2183* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
2184* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2185* [Observation](observation.html): Encounter related to the observation
2186* [Procedure](procedure.html): The Encounter during which this Procedure was created
2187* [Provenance](provenance.html): Encounter related to the Provenance
2188* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
2189* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
2190* [RiskAssessment](riskassessment.html): Where was assessment performed?
2191* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2192* [Task](task.html): Search by encounter
2193* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2194</b><br>
2195   * Type: <b>reference</b><br>
2196   * Path: <b>AuditEvent.encounter | CarePlan.encounter | ChargeItem.encounter | Claim.item.encounter | ClinicalImpression.encounter | Communication.encounter | CommunicationRequest.encounter | Composition.encounter | Condition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | EncounterHistory.encounter | ExplanationOfBenefit.item.encounter | Flag.encounter | ImagingStudy.encounter | List.encounter | MedicationDispense.encounter | MedicationStatement.encounter | NutritionIntake.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | Provenance.encounter | QuestionnaireResponse.encounter | RequestOrchestration.encounter | RiskAssessment.encounter | ServiceRequest.encounter | Task.encounter | VisionPrescription.encounter</b><br>
2197   * </p>
2198   */
2199  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2200
2201/**
2202   * Constant for fluent queries to be used to add include statements. Specifies
2203   * the path value of "<b>Provenance:encounter</b>".
2204   */
2205  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Provenance:encounter").toLocked();
2206
2207 /**
2208   * Search parameter: <b>patient</b>
2209   * <p>
2210   * Description: <b>Multiple Resources: 
2211
2212* [Account](account.html): The entity that caused the expenses
2213* [AdverseEvent](adverseevent.html): Subject impacted by event
2214* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2215* [Appointment](appointment.html): One of the individuals of the appointment is this patient
2216* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
2217* [AuditEvent](auditevent.html): Where the activity involved patient data
2218* [Basic](basic.html): Identifies the focus of this resource
2219* [BodyStructure](bodystructure.html): Who this is about
2220* [CarePlan](careplan.html): Who the care plan is for
2221* [CareTeam](careteam.html): Who care team is for
2222* [ChargeItem](chargeitem.html): Individual service was done for/to
2223* [Claim](claim.html): Patient receiving the products or services
2224* [ClaimResponse](claimresponse.html): The subject of care
2225* [ClinicalImpression](clinicalimpression.html): Patient assessed
2226* [Communication](communication.html): Focus of message
2227* [CommunicationRequest](communicationrequest.html): Focus of message
2228* [Composition](composition.html): Who and/or what the composition is about
2229* [Condition](condition.html): Who has the condition?
2230* [Consent](consent.html): Who the consent applies to
2231* [Contract](contract.html): The identity of the subject of the contract (if a patient)
2232* [Coverage](coverage.html): Retrieve coverages for a patient
2233* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
2234* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
2235* [DetectedIssue](detectedissue.html): Associated patient
2236* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2237* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2238* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2239* [DocumentReference](documentreference.html): Who/what is the subject of the document
2240* [Encounter](encounter.html): The patient present at the encounter
2241* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
2242* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2243* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
2244* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2245* [Flag](flag.html): The identity of a subject to list flags for
2246* [Goal](goal.html): Who this goal is intended for
2247* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
2248* [ImagingSelection](imagingselection.html): Who the study is about
2249* [ImagingStudy](imagingstudy.html): Who the study is about
2250* [Immunization](immunization.html): The patient for the vaccination record
2251* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
2252* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
2253* [Invoice](invoice.html): Recipient(s) of goods and services
2254* [List](list.html): If all resources have the same subject
2255* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
2256* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2257* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2258* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2259* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2260* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
2261* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
2262* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
2263* [Observation](observation.html): The subject that the observation is about (if patient)
2264* [Person](person.html): The Person links to this Patient
2265* [Procedure](procedure.html): Search by subject - a patient
2266* [Provenance](provenance.html): Where the activity involved patient data
2267* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
2268* [RelatedPerson](relatedperson.html): The patient this related person is related to
2269* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
2270* [ResearchSubject](researchsubject.html): Who or what is part of study
2271* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2272* [ServiceRequest](servicerequest.html): Search by subject - a patient
2273* [Specimen](specimen.html): The patient the specimen comes from
2274* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2275* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
2276* [Task](task.html): Search by patient
2277* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2278</b><br>
2279   * Type: <b>reference</b><br>
2280   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
2281   * </p>
2282   */
2283  @SearchParamDefinition(name="patient", path="Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [Account](account.html): The entity that caused the expenses\r\n* [AdverseEvent](adverseevent.html): Subject impacted by event\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [Appointment](appointment.html): One of the individuals of the appointment is this patient\r\n* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient\r\n* [AuditEvent](auditevent.html): Where the activity involved patient data\r\n* [Basic](basic.html): Identifies the focus of this resource\r\n* [BodyStructure](bodystructure.html): Who this is about\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ChargeItem](chargeitem.html): Individual service was done for/to\r\n* [Claim](claim.html): Patient receiving the products or services\r\n* [ClaimResponse](claimresponse.html): The subject of care\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Communication](communication.html): Focus of message\r\n* [CommunicationRequest](communicationrequest.html): Focus of message\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [Contract](contract.html): The identity of the subject of the contract (if a patient)\r\n* [Coverage](coverage.html): Retrieve coverages for a patient\r\n* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient\r\n* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results\r\n* [ImagingSelection](imagingselection.html): Who the study is about\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated\r\n* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for\r\n* [Invoice](invoice.html): Recipient(s) of goods and services\r\n* [List](list.html): If all resources have the same subject\r\n* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.\r\n* [MolecularSequence](molecularsequence.html): The subject that the sequence is about\r\n* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Person](person.html): The Person links to this Patient\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [Provenance](provenance.html): Where the activity involved patient data\r\n* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response\r\n* [RelatedPerson](relatedperson.html): The patient this related person is related to\r\n* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations\r\n* [ResearchSubject](researchsubject.html): Who or what is part of study\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [Specimen](specimen.html): The patient the specimen comes from\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined\r\n* [Task](task.html): Search by patient\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
2284  public static final String SP_PATIENT = "patient";
2285 /**
2286   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2287   * <p>
2288   * Description: <b>Multiple Resources: 
2289
2290* [Account](account.html): The entity that caused the expenses
2291* [AdverseEvent](adverseevent.html): Subject impacted by event
2292* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2293* [Appointment](appointment.html): One of the individuals of the appointment is this patient
2294* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
2295* [AuditEvent](auditevent.html): Where the activity involved patient data
2296* [Basic](basic.html): Identifies the focus of this resource
2297* [BodyStructure](bodystructure.html): Who this is about
2298* [CarePlan](careplan.html): Who the care plan is for
2299* [CareTeam](careteam.html): Who care team is for
2300* [ChargeItem](chargeitem.html): Individual service was done for/to
2301* [Claim](claim.html): Patient receiving the products or services
2302* [ClaimResponse](claimresponse.html): The subject of care
2303* [ClinicalImpression](clinicalimpression.html): Patient assessed
2304* [Communication](communication.html): Focus of message
2305* [CommunicationRequest](communicationrequest.html): Focus of message
2306* [Composition](composition.html): Who and/or what the composition is about
2307* [Condition](condition.html): Who has the condition?
2308* [Consent](consent.html): Who the consent applies to
2309* [Contract](contract.html): The identity of the subject of the contract (if a patient)
2310* [Coverage](coverage.html): Retrieve coverages for a patient
2311* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
2312* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
2313* [DetectedIssue](detectedissue.html): Associated patient
2314* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2315* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2316* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2317* [DocumentReference](documentreference.html): Who/what is the subject of the document
2318* [Encounter](encounter.html): The patient present at the encounter
2319* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
2320* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2321* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
2322* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2323* [Flag](flag.html): The identity of a subject to list flags for
2324* [Goal](goal.html): Who this goal is intended for
2325* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
2326* [ImagingSelection](imagingselection.html): Who the study is about
2327* [ImagingStudy](imagingstudy.html): Who the study is about
2328* [Immunization](immunization.html): The patient for the vaccination record
2329* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
2330* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
2331* [Invoice](invoice.html): Recipient(s) of goods and services
2332* [List](list.html): If all resources have the same subject
2333* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
2334* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2335* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2336* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2337* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2338* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
2339* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
2340* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
2341* [Observation](observation.html): The subject that the observation is about (if patient)
2342* [Person](person.html): The Person links to this Patient
2343* [Procedure](procedure.html): Search by subject - a patient
2344* [Provenance](provenance.html): Where the activity involved patient data
2345* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
2346* [RelatedPerson](relatedperson.html): The patient this related person is related to
2347* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
2348* [ResearchSubject](researchsubject.html): Who or what is part of study
2349* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2350* [ServiceRequest](servicerequest.html): Search by subject - a patient
2351* [Specimen](specimen.html): The patient the specimen comes from
2352* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2353* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
2354* [Task](task.html): Search by patient
2355* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2356</b><br>
2357   * Type: <b>reference</b><br>
2358   * Path: <b>Account.subject.where(resolve() is Patient) | AdverseEvent.subject.where(resolve() is Patient) | AllergyIntolerance.patient | Appointment.participant.actor.where(resolve() is Patient) | Appointment.subject.where(resolve() is Patient) | AppointmentResponse.actor.where(resolve() is Patient) | AuditEvent.patient | Basic.subject.where(resolve() is Patient) | BodyStructure.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ChargeItem.subject.where(resolve() is Patient) | Claim.patient | ClaimResponse.patient | ClinicalImpression.subject.where(resolve() is Patient) | Communication.subject.where(resolve() is Patient) | CommunicationRequest.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | Contract.subject.where(resolve() is Patient) | Coverage.beneficiary | CoverageEligibilityRequest.patient | CoverageEligibilityResponse.patient | DetectedIssue.subject.where(resolve() is Patient) | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EnrollmentRequest.candidate | EpisodeOfCare.patient | ExplanationOfBenefit.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | GuidanceResponse.subject.where(resolve() is Patient) | ImagingSelection.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | ImmunizationEvaluation.patient | ImmunizationRecommendation.patient | Invoice.subject.where(resolve() is Patient) | List.subject.where(resolve() is Patient) | MeasureReport.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationStatement.subject.where(resolve() is Patient) | MolecularSequence.subject.where(resolve() is Patient) | NutritionIntake.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Person.link.target.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | Provenance.patient | QuestionnaireResponse.subject.where(resolve() is Patient) | RelatedPerson.patient | RequestOrchestration.subject.where(resolve() is Patient) | ResearchSubject.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | Specimen.subject.where(resolve() is Patient) | SupplyDelivery.patient | SupplyRequest.deliverFor | Task.for.where(resolve() is Patient) | VisionPrescription.patient</b><br>
2359   * </p>
2360   */
2361  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2362
2363/**
2364   * Constant for fluent queries to be used to add include statements. Specifies
2365   * the path value of "<b>Provenance:patient</b>".
2366   */
2367  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Provenance:patient").toLocked();
2368
2369
2370}
2371