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 void removeChild(String name, Base value) throws FHIRException {
443        if (name.equals("type")) {
444          this.type = null;
445        } else if (name.equals("role")) {
446          this.getRole().remove(value);
447        } else if (name.equals("who")) {
448          this.who = null;
449        } else if (name.equals("onBehalfOf")) {
450          this.onBehalfOf = null;
451        } else
452          super.removeChild(name, value);
453        
454      }
455
456      @Override
457      public Base makeProperty(int hash, String name) throws FHIRException {
458        switch (hash) {
459        case 3575610:  return getType();
460        case 3506294:  return addRole(); 
461        case 117694:  return getWho();
462        case -14402964:  return getOnBehalfOf();
463        default: return super.makeProperty(hash, name);
464        }
465
466      }
467
468      @Override
469      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
470        switch (hash) {
471        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
472        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
473        case 117694: /*who*/ return new String[] {"Reference"};
474        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
475        default: return super.getTypesForProperty(hash, name);
476        }
477
478      }
479
480      @Override
481      public Base addChild(String name) throws FHIRException {
482        if (name.equals("type")) {
483          this.type = new CodeableConcept();
484          return this.type;
485        }
486        else if (name.equals("role")) {
487          return addRole();
488        }
489        else if (name.equals("who")) {
490          this.who = new Reference();
491          return this.who;
492        }
493        else if (name.equals("onBehalfOf")) {
494          this.onBehalfOf = new Reference();
495          return this.onBehalfOf;
496        }
497        else
498          return super.addChild(name);
499      }
500
501      public ProvenanceAgentComponent copy() {
502        ProvenanceAgentComponent dst = new ProvenanceAgentComponent();
503        copyValues(dst);
504        return dst;
505      }
506
507      public void copyValues(ProvenanceAgentComponent dst) {
508        super.copyValues(dst);
509        dst.type = type == null ? null : type.copy();
510        if (role != null) {
511          dst.role = new ArrayList<CodeableConcept>();
512          for (CodeableConcept i : role)
513            dst.role.add(i.copy());
514        };
515        dst.who = who == null ? null : who.copy();
516        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
517      }
518
519      @Override
520      public boolean equalsDeep(Base other_) {
521        if (!super.equalsDeep(other_))
522          return false;
523        if (!(other_ instanceof ProvenanceAgentComponent))
524          return false;
525        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
526        return compareDeep(type, o.type, true) && compareDeep(role, o.role, true) && compareDeep(who, o.who, true)
527           && compareDeep(onBehalfOf, o.onBehalfOf, true);
528      }
529
530      @Override
531      public boolean equalsShallow(Base other_) {
532        if (!super.equalsShallow(other_))
533          return false;
534        if (!(other_ instanceof ProvenanceAgentComponent))
535          return false;
536        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
537        return true;
538      }
539
540      public boolean isEmpty() {
541        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, role, who, onBehalfOf
542          );
543      }
544
545  public String fhirType() {
546    return "Provenance.agent";
547
548  }
549
550  }
551
552    @Block()
553    public static class ProvenanceEntityComponent extends BackboneElement implements IBaseBackboneElement {
554        /**
555         * How the entity was used during the activity.
556         */
557        @Child(name = "role", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
558        @Description(shortDefinition="revision | quotation | source | instantiates | removal", formalDefinition="How the entity was used during the activity." )
559        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-entity-role")
560        protected Enumeration<ProvenanceEntityRole> role;
561
562        /**
563         * Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.
564         */
565        @Child(name = "what", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true)
566        @Description(shortDefinition="Identity of entity", formalDefinition="Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative." )
567        protected Reference what;
568
569        /**
570         * 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.
571         */
572        @Child(name = "agent", type = {ProvenanceAgentComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
573        @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." )
574        protected List<ProvenanceAgentComponent> agent;
575
576        private static final long serialVersionUID = 211110220L;
577
578    /**
579     * Constructor
580     */
581      public ProvenanceEntityComponent() {
582        super();
583      }
584
585    /**
586     * Constructor
587     */
588      public ProvenanceEntityComponent(ProvenanceEntityRole role, Reference what) {
589        super();
590        this.setRole(role);
591        this.setWhat(what);
592      }
593
594        /**
595         * @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
596         */
597        public Enumeration<ProvenanceEntityRole> getRoleElement() { 
598          if (this.role == null)
599            if (Configuration.errorOnAutoCreate())
600              throw new Error("Attempt to auto-create ProvenanceEntityComponent.role");
601            else if (Configuration.doAutoCreate())
602              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory()); // bb
603          return this.role;
604        }
605
606        public boolean hasRoleElement() { 
607          return this.role != null && !this.role.isEmpty();
608        }
609
610        public boolean hasRole() { 
611          return this.role != null && !this.role.isEmpty();
612        }
613
614        /**
615         * @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
616         */
617        public ProvenanceEntityComponent setRoleElement(Enumeration<ProvenanceEntityRole> value) { 
618          this.role = value;
619          return this;
620        }
621
622        /**
623         * @return How the entity was used during the activity.
624         */
625        public ProvenanceEntityRole getRole() { 
626          return this.role == null ? null : this.role.getValue();
627        }
628
629        /**
630         * @param value How the entity was used during the activity.
631         */
632        public ProvenanceEntityComponent setRole(ProvenanceEntityRole value) { 
633            if (this.role == null)
634              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory());
635            this.role.setValue(value);
636          return this;
637        }
638
639        /**
640         * @return {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
641         */
642        public Reference getWhat() { 
643          if (this.what == null)
644            if (Configuration.errorOnAutoCreate())
645              throw new Error("Attempt to auto-create ProvenanceEntityComponent.what");
646            else if (Configuration.doAutoCreate())
647              this.what = new Reference(); // cc
648          return this.what;
649        }
650
651        public boolean hasWhat() { 
652          return this.what != null && !this.what.isEmpty();
653        }
654
655        /**
656         * @param value {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
657         */
658        public ProvenanceEntityComponent setWhat(Reference value) { 
659          this.what = value;
660          return this;
661        }
662
663        /**
664         * @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.)
665         */
666        public List<ProvenanceAgentComponent> getAgent() { 
667          if (this.agent == null)
668            this.agent = new ArrayList<ProvenanceAgentComponent>();
669          return this.agent;
670        }
671
672        /**
673         * @return Returns a reference to <code>this</code> for easy method chaining
674         */
675        public ProvenanceEntityComponent setAgent(List<ProvenanceAgentComponent> theAgent) { 
676          this.agent = theAgent;
677          return this;
678        }
679
680        public boolean hasAgent() { 
681          if (this.agent == null)
682            return false;
683          for (ProvenanceAgentComponent item : this.agent)
684            if (!item.isEmpty())
685              return true;
686          return false;
687        }
688
689        public ProvenanceAgentComponent addAgent() { //3
690          ProvenanceAgentComponent t = new ProvenanceAgentComponent();
691          if (this.agent == null)
692            this.agent = new ArrayList<ProvenanceAgentComponent>();
693          this.agent.add(t);
694          return t;
695        }
696
697        public ProvenanceEntityComponent addAgent(ProvenanceAgentComponent t) { //3
698          if (t == null)
699            return this;
700          if (this.agent == null)
701            this.agent = new ArrayList<ProvenanceAgentComponent>();
702          this.agent.add(t);
703          return this;
704        }
705
706        /**
707         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
708         */
709        public ProvenanceAgentComponent getAgentFirstRep() { 
710          if (getAgent().isEmpty()) {
711            addAgent();
712          }
713          return getAgent().get(0);
714        }
715
716        protected void listChildren(List<Property> children) {
717          super.listChildren(children);
718          children.add(new Property("role", "code", "How the entity was used during the activity.", 0, 1, role));
719          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));
720          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));
721        }
722
723        @Override
724        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
725          switch (_hash) {
726          case 3506294: /*role*/  return new Property("role", "code", "How the entity was used during the activity.", 0, 1, role);
727          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);
728          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);
729          default: return super.getNamedProperty(_hash, _name, _checkValid);
730          }
731
732        }
733
734      @Override
735      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
736        switch (hash) {
737        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // Enumeration<ProvenanceEntityRole>
738        case 3648196: /*what*/ return this.what == null ? new Base[0] : new Base[] {this.what}; // Reference
739        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
740        default: return super.getProperty(hash, name, checkValid);
741        }
742
743      }
744
745      @Override
746      public Base setProperty(int hash, String name, Base value) throws FHIRException {
747        switch (hash) {
748        case 3506294: // role
749          value = new ProvenanceEntityRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
750          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
751          return value;
752        case 3648196: // what
753          this.what = TypeConvertor.castToReference(value); // Reference
754          return value;
755        case 92750597: // agent
756          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
757          return value;
758        default: return super.setProperty(hash, name, value);
759        }
760
761      }
762
763      @Override
764      public Base setProperty(String name, Base value) throws FHIRException {
765        if (name.equals("role")) {
766          value = new ProvenanceEntityRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
767          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
768        } else if (name.equals("what")) {
769          this.what = TypeConvertor.castToReference(value); // Reference
770        } else if (name.equals("agent")) {
771          this.getAgent().add((ProvenanceAgentComponent) value);
772        } else
773          return super.setProperty(name, value);
774        return value;
775      }
776
777  @Override
778  public void removeChild(String name, Base value) throws FHIRException {
779        if (name.equals("role")) {
780          value = new ProvenanceEntityRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
781          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
782        } else if (name.equals("what")) {
783          this.what = null;
784        } else if (name.equals("agent")) {
785          this.getAgent().remove((ProvenanceAgentComponent) value);
786        } else
787          super.removeChild(name, value);
788        
789      }
790
791      @Override
792      public Base makeProperty(int hash, String name) throws FHIRException {
793        switch (hash) {
794        case 3506294:  return getRoleElement();
795        case 3648196:  return getWhat();
796        case 92750597:  return addAgent(); 
797        default: return super.makeProperty(hash, name);
798        }
799
800      }
801
802      @Override
803      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
804        switch (hash) {
805        case 3506294: /*role*/ return new String[] {"code"};
806        case 3648196: /*what*/ return new String[] {"Reference"};
807        case 92750597: /*agent*/ return new String[] {"@Provenance.agent"};
808        default: return super.getTypesForProperty(hash, name);
809        }
810
811      }
812
813      @Override
814      public Base addChild(String name) throws FHIRException {
815        if (name.equals("role")) {
816          throw new FHIRException("Cannot call addChild on a singleton property Provenance.entity.role");
817        }
818        else if (name.equals("what")) {
819          this.what = new Reference();
820          return this.what;
821        }
822        else if (name.equals("agent")) {
823          return addAgent();
824        }
825        else
826          return super.addChild(name);
827      }
828
829      public ProvenanceEntityComponent copy() {
830        ProvenanceEntityComponent dst = new ProvenanceEntityComponent();
831        copyValues(dst);
832        return dst;
833      }
834
835      public void copyValues(ProvenanceEntityComponent dst) {
836        super.copyValues(dst);
837        dst.role = role == null ? null : role.copy();
838        dst.what = what == null ? null : what.copy();
839        if (agent != null) {
840          dst.agent = new ArrayList<ProvenanceAgentComponent>();
841          for (ProvenanceAgentComponent i : agent)
842            dst.agent.add(i.copy());
843        };
844      }
845
846      @Override
847      public boolean equalsDeep(Base other_) {
848        if (!super.equalsDeep(other_))
849          return false;
850        if (!(other_ instanceof ProvenanceEntityComponent))
851          return false;
852        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
853        return compareDeep(role, o.role, true) && compareDeep(what, o.what, true) && compareDeep(agent, o.agent, true)
854          ;
855      }
856
857      @Override
858      public boolean equalsShallow(Base other_) {
859        if (!super.equalsShallow(other_))
860          return false;
861        if (!(other_ instanceof ProvenanceEntityComponent))
862          return false;
863        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
864        return compareValues(role, o.role, true);
865      }
866
867      public boolean isEmpty() {
868        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, what, agent);
869      }
870
871  public String fhirType() {
872    return "Provenance.entity";
873
874  }
875
876  }
877
878    /**
879     * 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.
880     */
881    @Child(name = "target", type = {Reference.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
882    @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." )
883    protected List<Reference> target;
884
885    /**
886     * The period during which the activity occurred.
887     */
888    @Child(name = "occurred", type = {Period.class, DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
889    @Description(shortDefinition="When the activity occurred", formalDefinition="The period during which the activity occurred." )
890    protected DataType occurred;
891
892    /**
893     * The instant of time at which the activity was recorded.
894     */
895    @Child(name = "recorded", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true)
896    @Description(shortDefinition="When the activity was recorded / updated", formalDefinition="The instant of time at which the activity was recorded." )
897    protected InstantType recorded;
898
899    /**
900     * 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.
901     */
902    @Child(name = "policy", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
903    @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." )
904    protected List<UriType> policy;
905
906    /**
907     * Where the activity occurred, if relevant.
908     */
909    @Child(name = "location", type = {Location.class}, order=4, min=0, max=1, modifier=false, summary=false)
910    @Description(shortDefinition="Where the activity occurred, if relevant", formalDefinition="Where the activity occurred, if relevant." )
911    protected Reference location;
912
913    /**
914     * The authorization (e.g., PurposeOfUse) that was used during the event being recorded.
915     */
916    @Child(name = "authorization", type = {CodeableReference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
917    @Description(shortDefinition="Authorization (purposeOfUse) related to the event", formalDefinition="The authorization (e.g., PurposeOfUse) that was used during the event being recorded." )
918    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
919    protected List<CodeableReference> authorization;
920
921    /**
922     * 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.
923     */
924    @Child(name = "activity", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
925    @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." )
926    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-activity-type")
927    protected CodeableConcept activity;
928
929    /**
930     * Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.
931     */
932    @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)
933    @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." )
934    protected List<Reference> basedOn;
935
936    /**
937     * 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.
938     */
939    @Child(name = "patient", type = {Patient.class}, order=8, min=0, max=1, modifier=false, summary=false)
940    @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." )
941    protected Reference patient;
942
943    /**
944     * 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).
945     */
946    @Child(name = "encounter", type = {Encounter.class}, order=9, min=0, max=1, modifier=false, summary=false)
947    @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)." )
948    protected Reference encounter;
949
950    /**
951     * An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.
952     */
953    @Child(name = "agent", type = {}, order=10, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
954    @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." )
955    protected List<ProvenanceAgentComponent> agent;
956
957    /**
958     * An entity used in this activity.
959     */
960    @Child(name = "entity", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
961    @Description(shortDefinition="An entity used in this activity", formalDefinition="An entity used in this activity." )
962    protected List<ProvenanceEntityComponent> entity;
963
964    /**
965     * A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.
966     */
967    @Child(name = "signature", type = {Signature.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
968    @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." )
969    protected List<Signature> signature;
970
971    private static final long serialVersionUID = 2001521682L;
972
973  /**
974   * Constructor
975   */
976    public Provenance() {
977      super();
978    }
979
980  /**
981   * Constructor
982   */
983    public Provenance(Reference target, ProvenanceAgentComponent agent) {
984      super();
985      this.addTarget(target);
986      this.addAgent(agent);
987    }
988
989    /**
990     * @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.)
991     */
992    public List<Reference> getTarget() { 
993      if (this.target == null)
994        this.target = new ArrayList<Reference>();
995      return this.target;
996    }
997
998    /**
999     * @return Returns a reference to <code>this</code> for easy method chaining
1000     */
1001    public Provenance setTarget(List<Reference> theTarget) { 
1002      this.target = theTarget;
1003      return this;
1004    }
1005
1006    public boolean hasTarget() { 
1007      if (this.target == null)
1008        return false;
1009      for (Reference item : this.target)
1010        if (!item.isEmpty())
1011          return true;
1012      return false;
1013    }
1014
1015    public Reference addTarget() { //3
1016      Reference t = new Reference();
1017      if (this.target == null)
1018        this.target = new ArrayList<Reference>();
1019      this.target.add(t);
1020      return t;
1021    }
1022
1023    public Provenance addTarget(Reference t) { //3
1024      if (t == null)
1025        return this;
1026      if (this.target == null)
1027        this.target = new ArrayList<Reference>();
1028      this.target.add(t);
1029      return this;
1030    }
1031
1032    /**
1033     * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist {3}
1034     */
1035    public Reference getTargetFirstRep() { 
1036      if (getTarget().isEmpty()) {
1037        addTarget();
1038      }
1039      return getTarget().get(0);
1040    }
1041
1042    /**
1043     * @return {@link #occurred} (The period during which the activity occurred.)
1044     */
1045    public DataType getOccurred() { 
1046      return this.occurred;
1047    }
1048
1049    /**
1050     * @return {@link #occurred} (The period during which the activity occurred.)
1051     */
1052    public Period getOccurredPeriod() throws FHIRException { 
1053      if (this.occurred == null)
1054        this.occurred = new Period();
1055      if (!(this.occurred instanceof Period))
1056        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurred.getClass().getName()+" was encountered");
1057      return (Period) this.occurred;
1058    }
1059
1060    public boolean hasOccurredPeriod() { 
1061      return this != null && this.occurred instanceof Period;
1062    }
1063
1064    /**
1065     * @return {@link #occurred} (The period during which the activity occurred.)
1066     */
1067    public DateTimeType getOccurredDateTimeType() throws FHIRException { 
1068      if (this.occurred == null)
1069        this.occurred = new DateTimeType();
1070      if (!(this.occurred instanceof DateTimeType))
1071        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurred.getClass().getName()+" was encountered");
1072      return (DateTimeType) this.occurred;
1073    }
1074
1075    public boolean hasOccurredDateTimeType() { 
1076      return this != null && this.occurred instanceof DateTimeType;
1077    }
1078
1079    public boolean hasOccurred() { 
1080      return this.occurred != null && !this.occurred.isEmpty();
1081    }
1082
1083    /**
1084     * @param value {@link #occurred} (The period during which the activity occurred.)
1085     */
1086    public Provenance setOccurred(DataType value) { 
1087      if (value != null && !(value instanceof Period || value instanceof DateTimeType))
1088        throw new FHIRException("Not the right type for Provenance.occurred[x]: "+value.fhirType());
1089      this.occurred = value;
1090      return this;
1091    }
1092
1093    /**
1094     * @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
1095     */
1096    public InstantType getRecordedElement() { 
1097      if (this.recorded == null)
1098        if (Configuration.errorOnAutoCreate())
1099          throw new Error("Attempt to auto-create Provenance.recorded");
1100        else if (Configuration.doAutoCreate())
1101          this.recorded = new InstantType(); // bb
1102      return this.recorded;
1103    }
1104
1105    public boolean hasRecordedElement() { 
1106      return this.recorded != null && !this.recorded.isEmpty();
1107    }
1108
1109    public boolean hasRecorded() { 
1110      return this.recorded != null && !this.recorded.isEmpty();
1111    }
1112
1113    /**
1114     * @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
1115     */
1116    public Provenance setRecordedElement(InstantType value) { 
1117      this.recorded = value;
1118      return this;
1119    }
1120
1121    /**
1122     * @return The instant of time at which the activity was recorded.
1123     */
1124    public Date getRecorded() { 
1125      return this.recorded == null ? null : this.recorded.getValue();
1126    }
1127
1128    /**
1129     * @param value The instant of time at which the activity was recorded.
1130     */
1131    public Provenance setRecorded(Date value) { 
1132      if (value == null)
1133        this.recorded = null;
1134      else {
1135        if (this.recorded == null)
1136          this.recorded = new InstantType();
1137        this.recorded.setValue(value);
1138      }
1139      return this;
1140    }
1141
1142    /**
1143     * @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.)
1144     */
1145    public List<UriType> getPolicy() { 
1146      if (this.policy == null)
1147        this.policy = new ArrayList<UriType>();
1148      return this.policy;
1149    }
1150
1151    /**
1152     * @return Returns a reference to <code>this</code> for easy method chaining
1153     */
1154    public Provenance setPolicy(List<UriType> thePolicy) { 
1155      this.policy = thePolicy;
1156      return this;
1157    }
1158
1159    public boolean hasPolicy() { 
1160      if (this.policy == null)
1161        return false;
1162      for (UriType item : this.policy)
1163        if (!item.isEmpty())
1164          return true;
1165      return false;
1166    }
1167
1168    /**
1169     * @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.)
1170     */
1171    public UriType addPolicyElement() {//2 
1172      UriType t = new UriType();
1173      if (this.policy == null)
1174        this.policy = new ArrayList<UriType>();
1175      this.policy.add(t);
1176      return t;
1177    }
1178
1179    /**
1180     * @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.)
1181     */
1182    public Provenance addPolicy(String value) { //1
1183      UriType t = new UriType();
1184      t.setValue(value);
1185      if (this.policy == null)
1186        this.policy = new ArrayList<UriType>();
1187      this.policy.add(t);
1188      return this;
1189    }
1190
1191    /**
1192     * @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.)
1193     */
1194    public boolean hasPolicy(String value) { 
1195      if (this.policy == null)
1196        return false;
1197      for (UriType v : this.policy)
1198        if (v.getValue().equals(value)) // uri
1199          return true;
1200      return false;
1201    }
1202
1203    /**
1204     * @return {@link #location} (Where the activity occurred, if relevant.)
1205     */
1206    public Reference getLocation() { 
1207      if (this.location == null)
1208        if (Configuration.errorOnAutoCreate())
1209          throw new Error("Attempt to auto-create Provenance.location");
1210        else if (Configuration.doAutoCreate())
1211          this.location = new Reference(); // cc
1212      return this.location;
1213    }
1214
1215    public boolean hasLocation() { 
1216      return this.location != null && !this.location.isEmpty();
1217    }
1218
1219    /**
1220     * @param value {@link #location} (Where the activity occurred, if relevant.)
1221     */
1222    public Provenance setLocation(Reference value) { 
1223      this.location = value;
1224      return this;
1225    }
1226
1227    /**
1228     * @return {@link #authorization} (The authorization (e.g., PurposeOfUse) that was used during the event being recorded.)
1229     */
1230    public List<CodeableReference> getAuthorization() { 
1231      if (this.authorization == null)
1232        this.authorization = new ArrayList<CodeableReference>();
1233      return this.authorization;
1234    }
1235
1236    /**
1237     * @return Returns a reference to <code>this</code> for easy method chaining
1238     */
1239    public Provenance setAuthorization(List<CodeableReference> theAuthorization) { 
1240      this.authorization = theAuthorization;
1241      return this;
1242    }
1243
1244    public boolean hasAuthorization() { 
1245      if (this.authorization == null)
1246        return false;
1247      for (CodeableReference item : this.authorization)
1248        if (!item.isEmpty())
1249          return true;
1250      return false;
1251    }
1252
1253    public CodeableReference addAuthorization() { //3
1254      CodeableReference t = new CodeableReference();
1255      if (this.authorization == null)
1256        this.authorization = new ArrayList<CodeableReference>();
1257      this.authorization.add(t);
1258      return t;
1259    }
1260
1261    public Provenance addAuthorization(CodeableReference t) { //3
1262      if (t == null)
1263        return this;
1264      if (this.authorization == null)
1265        this.authorization = new ArrayList<CodeableReference>();
1266      this.authorization.add(t);
1267      return this;
1268    }
1269
1270    /**
1271     * @return The first repetition of repeating field {@link #authorization}, creating it if it does not already exist {3}
1272     */
1273    public CodeableReference getAuthorizationFirstRep() { 
1274      if (getAuthorization().isEmpty()) {
1275        addAuthorization();
1276      }
1277      return getAuthorization().get(0);
1278    }
1279
1280    /**
1281     * @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.)
1282     */
1283    public CodeableConcept getActivity() { 
1284      if (this.activity == null)
1285        if (Configuration.errorOnAutoCreate())
1286          throw new Error("Attempt to auto-create Provenance.activity");
1287        else if (Configuration.doAutoCreate())
1288          this.activity = new CodeableConcept(); // cc
1289      return this.activity;
1290    }
1291
1292    public boolean hasActivity() { 
1293      return this.activity != null && !this.activity.isEmpty();
1294    }
1295
1296    /**
1297     * @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.)
1298     */
1299    public Provenance setActivity(CodeableConcept value) { 
1300      this.activity = value;
1301      return this;
1302    }
1303
1304    /**
1305     * @return {@link #basedOn} (Allows tracing of authorizatino for the events and tracking whether proposals/recommendations were acted upon.)
1306     */
1307    public List<Reference> getBasedOn() { 
1308      if (this.basedOn == null)
1309        this.basedOn = new ArrayList<Reference>();
1310      return this.basedOn;
1311    }
1312
1313    /**
1314     * @return Returns a reference to <code>this</code> for easy method chaining
1315     */
1316    public Provenance setBasedOn(List<Reference> theBasedOn) { 
1317      this.basedOn = theBasedOn;
1318      return this;
1319    }
1320
1321    public boolean hasBasedOn() { 
1322      if (this.basedOn == null)
1323        return false;
1324      for (Reference item : this.basedOn)
1325        if (!item.isEmpty())
1326          return true;
1327      return false;
1328    }
1329
1330    public Reference addBasedOn() { //3
1331      Reference t = new Reference();
1332      if (this.basedOn == null)
1333        this.basedOn = new ArrayList<Reference>();
1334      this.basedOn.add(t);
1335      return t;
1336    }
1337
1338    public Provenance addBasedOn(Reference t) { //3
1339      if (t == null)
1340        return this;
1341      if (this.basedOn == null)
1342        this.basedOn = new ArrayList<Reference>();
1343      this.basedOn.add(t);
1344      return this;
1345    }
1346
1347    /**
1348     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
1349     */
1350    public Reference getBasedOnFirstRep() { 
1351      if (getBasedOn().isEmpty()) {
1352        addBasedOn();
1353      }
1354      return getBasedOn().get(0);
1355    }
1356
1357    /**
1358     * @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.)
1359     */
1360    public Reference getPatient() { 
1361      if (this.patient == null)
1362        if (Configuration.errorOnAutoCreate())
1363          throw new Error("Attempt to auto-create Provenance.patient");
1364        else if (Configuration.doAutoCreate())
1365          this.patient = new Reference(); // cc
1366      return this.patient;
1367    }
1368
1369    public boolean hasPatient() { 
1370      return this.patient != null && !this.patient.isEmpty();
1371    }
1372
1373    /**
1374     * @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.)
1375     */
1376    public Provenance setPatient(Reference value) { 
1377      this.patient = value;
1378      return this;
1379    }
1380
1381    /**
1382     * @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).)
1383     */
1384    public Reference getEncounter() { 
1385      if (this.encounter == null)
1386        if (Configuration.errorOnAutoCreate())
1387          throw new Error("Attempt to auto-create Provenance.encounter");
1388        else if (Configuration.doAutoCreate())
1389          this.encounter = new Reference(); // cc
1390      return this.encounter;
1391    }
1392
1393    public boolean hasEncounter() { 
1394      return this.encounter != null && !this.encounter.isEmpty();
1395    }
1396
1397    /**
1398     * @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).)
1399     */
1400    public Provenance setEncounter(Reference value) { 
1401      this.encounter = value;
1402      return this;
1403    }
1404
1405    /**
1406     * @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.)
1407     */
1408    public List<ProvenanceAgentComponent> getAgent() { 
1409      if (this.agent == null)
1410        this.agent = new ArrayList<ProvenanceAgentComponent>();
1411      return this.agent;
1412    }
1413
1414    /**
1415     * @return Returns a reference to <code>this</code> for easy method chaining
1416     */
1417    public Provenance setAgent(List<ProvenanceAgentComponent> theAgent) { 
1418      this.agent = theAgent;
1419      return this;
1420    }
1421
1422    public boolean hasAgent() { 
1423      if (this.agent == null)
1424        return false;
1425      for (ProvenanceAgentComponent item : this.agent)
1426        if (!item.isEmpty())
1427          return true;
1428      return false;
1429    }
1430
1431    public ProvenanceAgentComponent addAgent() { //3
1432      ProvenanceAgentComponent t = new ProvenanceAgentComponent();
1433      if (this.agent == null)
1434        this.agent = new ArrayList<ProvenanceAgentComponent>();
1435      this.agent.add(t);
1436      return t;
1437    }
1438
1439    public Provenance addAgent(ProvenanceAgentComponent t) { //3
1440      if (t == null)
1441        return this;
1442      if (this.agent == null)
1443        this.agent = new ArrayList<ProvenanceAgentComponent>();
1444      this.agent.add(t);
1445      return this;
1446    }
1447
1448    /**
1449     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist {3}
1450     */
1451    public ProvenanceAgentComponent getAgentFirstRep() { 
1452      if (getAgent().isEmpty()) {
1453        addAgent();
1454      }
1455      return getAgent().get(0);
1456    }
1457
1458    /**
1459     * @return {@link #entity} (An entity used in this activity.)
1460     */
1461    public List<ProvenanceEntityComponent> getEntity() { 
1462      if (this.entity == null)
1463        this.entity = new ArrayList<ProvenanceEntityComponent>();
1464      return this.entity;
1465    }
1466
1467    /**
1468     * @return Returns a reference to <code>this</code> for easy method chaining
1469     */
1470    public Provenance setEntity(List<ProvenanceEntityComponent> theEntity) { 
1471      this.entity = theEntity;
1472      return this;
1473    }
1474
1475    public boolean hasEntity() { 
1476      if (this.entity == null)
1477        return false;
1478      for (ProvenanceEntityComponent item : this.entity)
1479        if (!item.isEmpty())
1480          return true;
1481      return false;
1482    }
1483
1484    public ProvenanceEntityComponent addEntity() { //3
1485      ProvenanceEntityComponent t = new ProvenanceEntityComponent();
1486      if (this.entity == null)
1487        this.entity = new ArrayList<ProvenanceEntityComponent>();
1488      this.entity.add(t);
1489      return t;
1490    }
1491
1492    public Provenance addEntity(ProvenanceEntityComponent t) { //3
1493      if (t == null)
1494        return this;
1495      if (this.entity == null)
1496        this.entity = new ArrayList<ProvenanceEntityComponent>();
1497      this.entity.add(t);
1498      return this;
1499    }
1500
1501    /**
1502     * @return The first repetition of repeating field {@link #entity}, creating it if it does not already exist {3}
1503     */
1504    public ProvenanceEntityComponent getEntityFirstRep() { 
1505      if (getEntity().isEmpty()) {
1506        addEntity();
1507      }
1508      return getEntity().get(0);
1509    }
1510
1511    /**
1512     * @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.)
1513     */
1514    public List<Signature> getSignature() { 
1515      if (this.signature == null)
1516        this.signature = new ArrayList<Signature>();
1517      return this.signature;
1518    }
1519
1520    /**
1521     * @return Returns a reference to <code>this</code> for easy method chaining
1522     */
1523    public Provenance setSignature(List<Signature> theSignature) { 
1524      this.signature = theSignature;
1525      return this;
1526    }
1527
1528    public boolean hasSignature() { 
1529      if (this.signature == null)
1530        return false;
1531      for (Signature item : this.signature)
1532        if (!item.isEmpty())
1533          return true;
1534      return false;
1535    }
1536
1537    public Signature addSignature() { //3
1538      Signature t = new Signature();
1539      if (this.signature == null)
1540        this.signature = new ArrayList<Signature>();
1541      this.signature.add(t);
1542      return t;
1543    }
1544
1545    public Provenance addSignature(Signature t) { //3
1546      if (t == null)
1547        return this;
1548      if (this.signature == null)
1549        this.signature = new ArrayList<Signature>();
1550      this.signature.add(t);
1551      return this;
1552    }
1553
1554    /**
1555     * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist {3}
1556     */
1557    public Signature getSignatureFirstRep() { 
1558      if (getSignature().isEmpty()) {
1559        addSignature();
1560      }
1561      return getSignature().get(0);
1562    }
1563
1564      protected void listChildren(List<Property> children) {
1565        super.listChildren(children);
1566        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));
1567        children.add(new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred));
1568        children.add(new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded));
1569        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));
1570        children.add(new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location));
1571        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));
1572        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));
1573        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));
1574        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));
1575        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));
1576        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));
1577        children.add(new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity));
1578        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));
1579      }
1580
1581      @Override
1582      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1583        switch (_hash) {
1584        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);
1585        case 784181563: /*occurred[x]*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1586        case 792816933: /*occurred*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1587        case 894082886: /*occurredPeriod*/  return new Property("occurred[x]", "Period", "The period during which the activity occurred.", 0, 1, occurred);
1588        case 1579027424: /*occurredDateTime*/  return new Property("occurred[x]", "dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1589        case -799233872: /*recorded*/  return new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded);
1590        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);
1591        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location);
1592        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);
1593        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);
1594        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);
1595        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);
1596        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);
1597        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);
1598        case -1298275357: /*entity*/  return new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity);
1599        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);
1600        default: return super.getNamedProperty(_hash, _name, _checkValid);
1601        }
1602
1603      }
1604
1605      @Override
1606      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1607        switch (hash) {
1608        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // Reference
1609        case 792816933: /*occurred*/ return this.occurred == null ? new Base[0] : new Base[] {this.occurred}; // DataType
1610        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // InstantType
1611        case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // UriType
1612        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1613        case -1385570183: /*authorization*/ return this.authorization == null ? new Base[0] : this.authorization.toArray(new Base[this.authorization.size()]); // CodeableReference
1614        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : new Base[] {this.activity}; // CodeableConcept
1615        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
1616        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1617        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1618        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
1619        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : this.entity.toArray(new Base[this.entity.size()]); // ProvenanceEntityComponent
1620        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
1621        default: return super.getProperty(hash, name, checkValid);
1622        }
1623
1624      }
1625
1626      @Override
1627      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1628        switch (hash) {
1629        case -880905839: // target
1630          this.getTarget().add(TypeConvertor.castToReference(value)); // Reference
1631          return value;
1632        case 792816933: // occurred
1633          this.occurred = TypeConvertor.castToType(value); // DataType
1634          return value;
1635        case -799233872: // recorded
1636          this.recorded = TypeConvertor.castToInstant(value); // InstantType
1637          return value;
1638        case -982670030: // policy
1639          this.getPolicy().add(TypeConvertor.castToUri(value)); // UriType
1640          return value;
1641        case 1901043637: // location
1642          this.location = TypeConvertor.castToReference(value); // Reference
1643          return value;
1644        case -1385570183: // authorization
1645          this.getAuthorization().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
1646          return value;
1647        case -1655966961: // activity
1648          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1649          return value;
1650        case -332612366: // basedOn
1651          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
1652          return value;
1653        case -791418107: // patient
1654          this.patient = TypeConvertor.castToReference(value); // Reference
1655          return value;
1656        case 1524132147: // encounter
1657          this.encounter = TypeConvertor.castToReference(value); // Reference
1658          return value;
1659        case 92750597: // agent
1660          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
1661          return value;
1662        case -1298275357: // entity
1663          this.getEntity().add((ProvenanceEntityComponent) value); // ProvenanceEntityComponent
1664          return value;
1665        case 1073584312: // signature
1666          this.getSignature().add(TypeConvertor.castToSignature(value)); // Signature
1667          return value;
1668        default: return super.setProperty(hash, name, value);
1669        }
1670
1671      }
1672
1673      @Override
1674      public Base setProperty(String name, Base value) throws FHIRException {
1675        if (name.equals("target")) {
1676          this.getTarget().add(TypeConvertor.castToReference(value));
1677        } else if (name.equals("occurred[x]")) {
1678          this.occurred = TypeConvertor.castToType(value); // DataType
1679        } else if (name.equals("recorded")) {
1680          this.recorded = TypeConvertor.castToInstant(value); // InstantType
1681        } else if (name.equals("policy")) {
1682          this.getPolicy().add(TypeConvertor.castToUri(value));
1683        } else if (name.equals("location")) {
1684          this.location = TypeConvertor.castToReference(value); // Reference
1685        } else if (name.equals("authorization")) {
1686          this.getAuthorization().add(TypeConvertor.castToCodeableReference(value));
1687        } else if (name.equals("activity")) {
1688          this.activity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1689        } else if (name.equals("basedOn")) {
1690          this.getBasedOn().add(TypeConvertor.castToReference(value));
1691        } else if (name.equals("patient")) {
1692          this.patient = TypeConvertor.castToReference(value); // Reference
1693        } else if (name.equals("encounter")) {
1694          this.encounter = TypeConvertor.castToReference(value); // Reference
1695        } else if (name.equals("agent")) {
1696          this.getAgent().add((ProvenanceAgentComponent) value);
1697        } else if (name.equals("entity")) {
1698          this.getEntity().add((ProvenanceEntityComponent) value);
1699        } else if (name.equals("signature")) {
1700          this.getSignature().add(TypeConvertor.castToSignature(value));
1701        } else
1702          return super.setProperty(name, value);
1703        return value;
1704      }
1705
1706  @Override
1707  public void removeChild(String name, Base value) throws FHIRException {
1708        if (name.equals("target")) {
1709          this.getTarget().remove(value);
1710        } else if (name.equals("occurred[x]")) {
1711          this.occurred = null;
1712        } else if (name.equals("recorded")) {
1713          this.recorded = null;
1714        } else if (name.equals("policy")) {
1715          this.getPolicy().remove(value);
1716        } else if (name.equals("location")) {
1717          this.location = null;
1718        } else if (name.equals("authorization")) {
1719          this.getAuthorization().remove(value);
1720        } else if (name.equals("activity")) {
1721          this.activity = null;
1722        } else if (name.equals("basedOn")) {
1723          this.getBasedOn().remove(value);
1724        } else if (name.equals("patient")) {
1725          this.patient = null;
1726        } else if (name.equals("encounter")) {
1727          this.encounter = null;
1728        } else if (name.equals("agent")) {
1729          this.getAgent().remove((ProvenanceAgentComponent) value);
1730        } else if (name.equals("entity")) {
1731          this.getEntity().remove((ProvenanceEntityComponent) value);
1732        } else if (name.equals("signature")) {
1733          this.getSignature().remove(value);
1734        } else
1735          super.removeChild(name, value);
1736        
1737      }
1738
1739      @Override
1740      public Base makeProperty(int hash, String name) throws FHIRException {
1741        switch (hash) {
1742        case -880905839:  return addTarget(); 
1743        case 784181563:  return getOccurred();
1744        case 792816933:  return getOccurred();
1745        case -799233872:  return getRecordedElement();
1746        case -982670030:  return addPolicyElement();
1747        case 1901043637:  return getLocation();
1748        case -1385570183:  return addAuthorization(); 
1749        case -1655966961:  return getActivity();
1750        case -332612366:  return addBasedOn(); 
1751        case -791418107:  return getPatient();
1752        case 1524132147:  return getEncounter();
1753        case 92750597:  return addAgent(); 
1754        case -1298275357:  return addEntity(); 
1755        case 1073584312:  return addSignature(); 
1756        default: return super.makeProperty(hash, name);
1757        }
1758
1759      }
1760
1761      @Override
1762      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1763        switch (hash) {
1764        case -880905839: /*target*/ return new String[] {"Reference"};
1765        case 792816933: /*occurred*/ return new String[] {"Period", "dateTime"};
1766        case -799233872: /*recorded*/ return new String[] {"instant"};
1767        case -982670030: /*policy*/ return new String[] {"uri"};
1768        case 1901043637: /*location*/ return new String[] {"Reference"};
1769        case -1385570183: /*authorization*/ return new String[] {"CodeableReference"};
1770        case -1655966961: /*activity*/ return new String[] {"CodeableConcept"};
1771        case -332612366: /*basedOn*/ return new String[] {"Reference"};
1772        case -791418107: /*patient*/ return new String[] {"Reference"};
1773        case 1524132147: /*encounter*/ return new String[] {"Reference"};
1774        case 92750597: /*agent*/ return new String[] {};
1775        case -1298275357: /*entity*/ return new String[] {};
1776        case 1073584312: /*signature*/ return new String[] {"Signature"};
1777        default: return super.getTypesForProperty(hash, name);
1778        }
1779
1780      }
1781
1782      @Override
1783      public Base addChild(String name) throws FHIRException {
1784        if (name.equals("target")) {
1785          return addTarget();
1786        }
1787        else if (name.equals("occurredPeriod")) {
1788          this.occurred = new Period();
1789          return this.occurred;
1790        }
1791        else if (name.equals("occurredDateTime")) {
1792          this.occurred = new DateTimeType();
1793          return this.occurred;
1794        }
1795        else if (name.equals("recorded")) {
1796          throw new FHIRException("Cannot call addChild on a singleton property Provenance.recorded");
1797        }
1798        else if (name.equals("policy")) {
1799          throw new FHIRException("Cannot call addChild on a singleton property Provenance.policy");
1800        }
1801        else if (name.equals("location")) {
1802          this.location = new Reference();
1803          return this.location;
1804        }
1805        else if (name.equals("authorization")) {
1806          return addAuthorization();
1807        }
1808        else if (name.equals("activity")) {
1809          this.activity = new CodeableConcept();
1810          return this.activity;
1811        }
1812        else if (name.equals("basedOn")) {
1813          return addBasedOn();
1814        }
1815        else if (name.equals("patient")) {
1816          this.patient = new Reference();
1817          return this.patient;
1818        }
1819        else if (name.equals("encounter")) {
1820          this.encounter = new Reference();
1821          return this.encounter;
1822        }
1823        else if (name.equals("agent")) {
1824          return addAgent();
1825        }
1826        else if (name.equals("entity")) {
1827          return addEntity();
1828        }
1829        else if (name.equals("signature")) {
1830          return addSignature();
1831        }
1832        else
1833          return super.addChild(name);
1834      }
1835
1836  public String fhirType() {
1837    return "Provenance";
1838
1839  }
1840
1841      public Provenance copy() {
1842        Provenance dst = new Provenance();
1843        copyValues(dst);
1844        return dst;
1845      }
1846
1847      public void copyValues(Provenance dst) {
1848        super.copyValues(dst);
1849        if (target != null) {
1850          dst.target = new ArrayList<Reference>();
1851          for (Reference i : target)
1852            dst.target.add(i.copy());
1853        };
1854        dst.occurred = occurred == null ? null : occurred.copy();
1855        dst.recorded = recorded == null ? null : recorded.copy();
1856        if (policy != null) {
1857          dst.policy = new ArrayList<UriType>();
1858          for (UriType i : policy)
1859            dst.policy.add(i.copy());
1860        };
1861        dst.location = location == null ? null : location.copy();
1862        if (authorization != null) {
1863          dst.authorization = new ArrayList<CodeableReference>();
1864          for (CodeableReference i : authorization)
1865            dst.authorization.add(i.copy());
1866        };
1867        dst.activity = activity == null ? null : activity.copy();
1868        if (basedOn != null) {
1869          dst.basedOn = new ArrayList<Reference>();
1870          for (Reference i : basedOn)
1871            dst.basedOn.add(i.copy());
1872        };
1873        dst.patient = patient == null ? null : patient.copy();
1874        dst.encounter = encounter == null ? null : encounter.copy();
1875        if (agent != null) {
1876          dst.agent = new ArrayList<ProvenanceAgentComponent>();
1877          for (ProvenanceAgentComponent i : agent)
1878            dst.agent.add(i.copy());
1879        };
1880        if (entity != null) {
1881          dst.entity = new ArrayList<ProvenanceEntityComponent>();
1882          for (ProvenanceEntityComponent i : entity)
1883            dst.entity.add(i.copy());
1884        };
1885        if (signature != null) {
1886          dst.signature = new ArrayList<Signature>();
1887          for (Signature i : signature)
1888            dst.signature.add(i.copy());
1889        };
1890      }
1891
1892      protected Provenance typedCopy() {
1893        return copy();
1894      }
1895
1896      @Override
1897      public boolean equalsDeep(Base other_) {
1898        if (!super.equalsDeep(other_))
1899          return false;
1900        if (!(other_ instanceof Provenance))
1901          return false;
1902        Provenance o = (Provenance) other_;
1903        return compareDeep(target, o.target, true) && compareDeep(occurred, o.occurred, true) && compareDeep(recorded, o.recorded, true)
1904           && compareDeep(policy, o.policy, true) && compareDeep(location, o.location, true) && compareDeep(authorization, o.authorization, true)
1905           && compareDeep(activity, o.activity, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(patient, o.patient, true)
1906           && compareDeep(encounter, o.encounter, true) && compareDeep(agent, o.agent, true) && compareDeep(entity, o.entity, true)
1907           && compareDeep(signature, o.signature, true);
1908      }
1909
1910      @Override
1911      public boolean equalsShallow(Base other_) {
1912        if (!super.equalsShallow(other_))
1913          return false;
1914        if (!(other_ instanceof Provenance))
1915          return false;
1916        Provenance o = (Provenance) other_;
1917        return compareValues(recorded, o.recorded, true) && compareValues(policy, o.policy, true);
1918      }
1919
1920      public boolean isEmpty() {
1921        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, occurred, recorded
1922          , policy, location, authorization, activity, basedOn, patient, encounter, agent
1923          , entity, signature);
1924      }
1925
1926  @Override
1927  public ResourceType getResourceType() {
1928    return ResourceType.Provenance;
1929   }
1930
1931 /**
1932   * Search parameter: <b>activity</b>
1933   * <p>
1934   * Description: <b>Activity that occurred</b><br>
1935   * Type: <b>token</b><br>
1936   * Path: <b>Provenance.activity</b><br>
1937   * </p>
1938   */
1939  @SearchParamDefinition(name="activity", path="Provenance.activity", description="Activity that occurred", type="token" )
1940  public static final String SP_ACTIVITY = "activity";
1941 /**
1942   * <b>Fluent Client</b> search parameter constant for <b>activity</b>
1943   * <p>
1944   * Description: <b>Activity that occurred</b><br>
1945   * Type: <b>token</b><br>
1946   * Path: <b>Provenance.activity</b><br>
1947   * </p>
1948   */
1949  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVITY);
1950
1951 /**
1952   * Search parameter: <b>agent-role</b>
1953   * <p>
1954   * Description: <b>What the agents role was</b><br>
1955   * Type: <b>token</b><br>
1956   * Path: <b>Provenance.agent.role</b><br>
1957   * </p>
1958   */
1959  @SearchParamDefinition(name="agent-role", path="Provenance.agent.role", description="What the agents role was", type="token" )
1960  public static final String SP_AGENT_ROLE = "agent-role";
1961 /**
1962   * <b>Fluent Client</b> search parameter constant for <b>agent-role</b>
1963   * <p>
1964   * Description: <b>What the agents role was</b><br>
1965   * Type: <b>token</b><br>
1966   * Path: <b>Provenance.agent.role</b><br>
1967   * </p>
1968   */
1969  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_ROLE);
1970
1971 /**
1972   * Search parameter: <b>agent-type</b>
1973   * <p>
1974   * Description: <b>How the agent participated</b><br>
1975   * Type: <b>token</b><br>
1976   * Path: <b>Provenance.agent.type</b><br>
1977   * </p>
1978   */
1979  @SearchParamDefinition(name="agent-type", path="Provenance.agent.type", description="How the agent participated", type="token" )
1980  public static final String SP_AGENT_TYPE = "agent-type";
1981 /**
1982   * <b>Fluent Client</b> search parameter constant for <b>agent-type</b>
1983   * <p>
1984   * Description: <b>How the agent participated</b><br>
1985   * Type: <b>token</b><br>
1986   * Path: <b>Provenance.agent.type</b><br>
1987   * </p>
1988   */
1989  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_TYPE);
1990
1991 /**
1992   * Search parameter: <b>agent</b>
1993   * <p>
1994   * Description: <b>Who participated</b><br>
1995   * Type: <b>reference</b><br>
1996   * Path: <b>Provenance.agent.who</b><br>
1997   * </p>
1998   */
1999  @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 } )
2000  public static final String SP_AGENT = "agent";
2001 /**
2002   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
2003   * <p>
2004   * Description: <b>Who participated</b><br>
2005   * Type: <b>reference</b><br>
2006   * Path: <b>Provenance.agent.who</b><br>
2007   * </p>
2008   */
2009  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
2010
2011/**
2012   * Constant for fluent queries to be used to add include statements. Specifies
2013   * the path value of "<b>Provenance:agent</b>".
2014   */
2015  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("Provenance:agent").toLocked();
2016
2017 /**
2018   * Search parameter: <b>based-on</b>
2019   * <p>
2020   * Description: <b>Reference to the service request.</b><br>
2021   * Type: <b>reference</b><br>
2022   * Path: <b>Provenance.basedOn</b><br>
2023   * </p>
2024   */
2025  @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 } )
2026  public static final String SP_BASED_ON = "based-on";
2027 /**
2028   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2029   * <p>
2030   * Description: <b>Reference to the service request.</b><br>
2031   * Type: <b>reference</b><br>
2032   * Path: <b>Provenance.basedOn</b><br>
2033   * </p>
2034   */
2035  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_BASED_ON);
2036
2037/**
2038   * Constant for fluent queries to be used to add include statements. Specifies
2039   * the path value of "<b>Provenance:based-on</b>".
2040   */
2041  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include("Provenance:based-on").toLocked();
2042
2043 /**
2044   * Search parameter: <b>entity</b>
2045   * <p>
2046   * Description: <b>Identity of entity</b><br>
2047   * Type: <b>reference</b><br>
2048   * Path: <b>Provenance.entity.what</b><br>
2049   * </p>
2050   */
2051  @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 } )
2052  public static final String SP_ENTITY = "entity";
2053 /**
2054   * <b>Fluent Client</b> search parameter constant for <b>entity</b>
2055   * <p>
2056   * Description: <b>Identity of entity</b><br>
2057   * Type: <b>reference</b><br>
2058   * Path: <b>Provenance.entity.what</b><br>
2059   * </p>
2060   */
2061  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTITY);
2062
2063/**
2064   * Constant for fluent queries to be used to add include statements. Specifies
2065   * the path value of "<b>Provenance:entity</b>".
2066   */
2067  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTITY = new ca.uhn.fhir.model.api.Include("Provenance:entity").toLocked();
2068
2069 /**
2070   * Search parameter: <b>location</b>
2071   * <p>
2072   * Description: <b>Where the activity occurred, if relevant</b><br>
2073   * Type: <b>reference</b><br>
2074   * Path: <b>Provenance.location</b><br>
2075   * </p>
2076   */
2077  @SearchParamDefinition(name="location", path="Provenance.location", description="Where the activity occurred, if relevant", type="reference", target={Location.class } )
2078  public static final String SP_LOCATION = "location";
2079 /**
2080   * <b>Fluent Client</b> search parameter constant for <b>location</b>
2081   * <p>
2082   * Description: <b>Where the activity occurred, if relevant</b><br>
2083   * Type: <b>reference</b><br>
2084   * Path: <b>Provenance.location</b><br>
2085   * </p>
2086   */
2087  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
2088
2089/**
2090   * Constant for fluent queries to be used to add include statements. Specifies
2091   * the path value of "<b>Provenance:location</b>".
2092   */
2093  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Provenance:location").toLocked();
2094
2095 /**
2096   * Search parameter: <b>recorded</b>
2097   * <p>
2098   * Description: <b>When the activity was recorded / updated</b><br>
2099   * Type: <b>date</b><br>
2100   * Path: <b>Provenance.recorded</b><br>
2101   * </p>
2102   */
2103  @SearchParamDefinition(name="recorded", path="Provenance.recorded", description="When the activity was recorded / updated", type="date" )
2104  public static final String SP_RECORDED = "recorded";
2105 /**
2106   * <b>Fluent Client</b> search parameter constant for <b>recorded</b>
2107   * <p>
2108   * Description: <b>When the activity was recorded / updated</b><br>
2109   * Type: <b>date</b><br>
2110   * Path: <b>Provenance.recorded</b><br>
2111   * </p>
2112   */
2113  public static final ca.uhn.fhir.rest.gclient.DateClientParam RECORDED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_RECORDED);
2114
2115 /**
2116   * Search parameter: <b>signature-type</b>
2117   * <p>
2118   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
2119   * Type: <b>token</b><br>
2120   * Path: <b>Provenance.signature.type</b><br>
2121   * </p>
2122   */
2123  @SearchParamDefinition(name="signature-type", path="Provenance.signature.type", description="Indication of the reason the entity signed the object(s)", type="token" )
2124  public static final String SP_SIGNATURE_TYPE = "signature-type";
2125 /**
2126   * <b>Fluent Client</b> search parameter constant for <b>signature-type</b>
2127   * <p>
2128   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
2129   * Type: <b>token</b><br>
2130   * Path: <b>Provenance.signature.type</b><br>
2131   * </p>
2132   */
2133  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SIGNATURE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SIGNATURE_TYPE);
2134
2135 /**
2136   * Search parameter: <b>target</b>
2137   * <p>
2138   * Description: <b>Target Reference(s) (usually version specific)</b><br>
2139   * Type: <b>reference</b><br>
2140   * Path: <b>Provenance.target</b><br>
2141   * </p>
2142   */
2143  @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 } )
2144  public static final String SP_TARGET = "target";
2145 /**
2146   * <b>Fluent Client</b> search parameter constant for <b>target</b>
2147   * <p>
2148   * Description: <b>Target Reference(s) (usually version specific)</b><br>
2149   * Type: <b>reference</b><br>
2150   * Path: <b>Provenance.target</b><br>
2151   * </p>
2152   */
2153  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TARGET);
2154
2155/**
2156   * Constant for fluent queries to be used to add include statements. Specifies
2157   * the path value of "<b>Provenance:target</b>".
2158   */
2159  public static final ca.uhn.fhir.model.api.Include INCLUDE_TARGET = new ca.uhn.fhir.model.api.Include("Provenance:target").toLocked();
2160
2161 /**
2162   * Search parameter: <b>when</b>
2163   * <p>
2164   * Description: <b>When the activity occurred</b><br>
2165   * Type: <b>date</b><br>
2166   * Path: <b>(Provenance.occurred.ofType(dateTime))</b><br>
2167   * </p>
2168   */
2169  @SearchParamDefinition(name="when", path="(Provenance.occurred.ofType(dateTime))", description="When the activity occurred", type="date" )
2170  public static final String SP_WHEN = "when";
2171 /**
2172   * <b>Fluent Client</b> search parameter constant for <b>when</b>
2173   * <p>
2174   * Description: <b>When the activity occurred</b><br>
2175   * Type: <b>date</b><br>
2176   * Path: <b>(Provenance.occurred.ofType(dateTime))</b><br>
2177   * </p>
2178   */
2179  public static final ca.uhn.fhir.rest.gclient.DateClientParam WHEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHEN);
2180
2181 /**
2182   * Search parameter: <b>encounter</b>
2183   * <p>
2184   * Description: <b>Multiple Resources: 
2185
2186* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
2187* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
2188* [ChargeItem](chargeitem.html): Encounter associated with event
2189* [Claim](claim.html): Encounters associated with a billed line item
2190* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
2191* [Communication](communication.html): The Encounter during which this Communication was created
2192* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
2193* [Composition](composition.html): Context of the Composition
2194* [Condition](condition.html): The Encounter during which this Condition was created
2195* [DeviceRequest](devicerequest.html): Encounter during which request was created
2196* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2197* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
2198* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
2199* [Flag](flag.html): Alert relevant during encounter
2200* [ImagingStudy](imagingstudy.html): The context of the study
2201* [List](list.html): Context in which list created
2202* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
2203* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
2204* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
2205* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2206* [Observation](observation.html): Encounter related to the observation
2207* [Procedure](procedure.html): The Encounter during which this Procedure was created
2208* [Provenance](provenance.html): Encounter related to the Provenance
2209* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
2210* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
2211* [RiskAssessment](riskassessment.html): Where was assessment performed?
2212* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2213* [Task](task.html): Search by encounter
2214* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2215</b><br>
2216   * Type: <b>reference</b><br>
2217   * 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>
2218   * </p>
2219   */
2220  @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 } )
2221  public static final String SP_ENCOUNTER = "encounter";
2222 /**
2223   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2224   * <p>
2225   * Description: <b>Multiple Resources: 
2226
2227* [AuditEvent](auditevent.html): Encounter related to the activity recorded in the AuditEvent
2228* [CarePlan](careplan.html): The Encounter during which this CarePlan was created
2229* [ChargeItem](chargeitem.html): Encounter associated with event
2230* [Claim](claim.html): Encounters associated with a billed line item
2231* [ClinicalImpression](clinicalimpression.html): The Encounter during which this ClinicalImpression was created
2232* [Communication](communication.html): The Encounter during which this Communication was created
2233* [CommunicationRequest](communicationrequest.html): The Encounter during which this CommunicationRequest was created
2234* [Composition](composition.html): Context of the Composition
2235* [Condition](condition.html): The Encounter during which this Condition was created
2236* [DeviceRequest](devicerequest.html): Encounter during which request was created
2237* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
2238* [EncounterHistory](encounterhistory.html): The Encounter associated with this set of history values
2239* [ExplanationOfBenefit](explanationofbenefit.html): Encounters associated with a billed line item
2240* [Flag](flag.html): Alert relevant during encounter
2241* [ImagingStudy](imagingstudy.html): The context of the study
2242* [List](list.html): Context in which list created
2243* [MedicationDispense](medicationdispense.html): Returns dispenses with a specific encounter
2244* [MedicationStatement](medicationstatement.html): Returns statements for a specific encounter
2245* [NutritionIntake](nutritionintake.html): Returns statements for a specific encounter
2246* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
2247* [Observation](observation.html): Encounter related to the observation
2248* [Procedure](procedure.html): The Encounter during which this Procedure was created
2249* [Provenance](provenance.html): Encounter related to the Provenance
2250* [QuestionnaireResponse](questionnaireresponse.html): Encounter associated with the questionnaire response
2251* [RequestOrchestration](requestorchestration.html): The encounter the request orchestration applies to
2252* [RiskAssessment](riskassessment.html): Where was assessment performed?
2253* [ServiceRequest](servicerequest.html): An encounter in which this request is made
2254* [Task](task.html): Search by encounter
2255* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
2256</b><br>
2257   * Type: <b>reference</b><br>
2258   * 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>
2259   * </p>
2260   */
2261  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2262
2263/**
2264   * Constant for fluent queries to be used to add include statements. Specifies
2265   * the path value of "<b>Provenance:encounter</b>".
2266   */
2267  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Provenance:encounter").toLocked();
2268
2269 /**
2270   * Search parameter: <b>patient</b>
2271   * <p>
2272   * Description: <b>Multiple Resources: 
2273
2274* [Account](account.html): The entity that caused the expenses
2275* [AdverseEvent](adverseevent.html): Subject impacted by event
2276* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2277* [Appointment](appointment.html): One of the individuals of the appointment is this patient
2278* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
2279* [AuditEvent](auditevent.html): Where the activity involved patient data
2280* [Basic](basic.html): Identifies the focus of this resource
2281* [BodyStructure](bodystructure.html): Who this is about
2282* [CarePlan](careplan.html): Who the care plan is for
2283* [CareTeam](careteam.html): Who care team is for
2284* [ChargeItem](chargeitem.html): Individual service was done for/to
2285* [Claim](claim.html): Patient receiving the products or services
2286* [ClaimResponse](claimresponse.html): The subject of care
2287* [ClinicalImpression](clinicalimpression.html): Patient assessed
2288* [Communication](communication.html): Focus of message
2289* [CommunicationRequest](communicationrequest.html): Focus of message
2290* [Composition](composition.html): Who and/or what the composition is about
2291* [Condition](condition.html): Who has the condition?
2292* [Consent](consent.html): Who the consent applies to
2293* [Contract](contract.html): The identity of the subject of the contract (if a patient)
2294* [Coverage](coverage.html): Retrieve coverages for a patient
2295* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
2296* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
2297* [DetectedIssue](detectedissue.html): Associated patient
2298* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2299* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2300* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2301* [DocumentReference](documentreference.html): Who/what is the subject of the document
2302* [Encounter](encounter.html): The patient present at the encounter
2303* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
2304* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2305* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
2306* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2307* [Flag](flag.html): The identity of a subject to list flags for
2308* [Goal](goal.html): Who this goal is intended for
2309* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
2310* [ImagingSelection](imagingselection.html): Who the study is about
2311* [ImagingStudy](imagingstudy.html): Who the study is about
2312* [Immunization](immunization.html): The patient for the vaccination record
2313* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
2314* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
2315* [Invoice](invoice.html): Recipient(s) of goods and services
2316* [List](list.html): If all resources have the same subject
2317* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
2318* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2319* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2320* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2321* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2322* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
2323* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
2324* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
2325* [Observation](observation.html): The subject that the observation is about (if patient)
2326* [Person](person.html): The Person links to this Patient
2327* [Procedure](procedure.html): Search by subject - a patient
2328* [Provenance](provenance.html): Where the activity involved patient data
2329* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
2330* [RelatedPerson](relatedperson.html): The patient this related person is related to
2331* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
2332* [ResearchSubject](researchsubject.html): Who or what is part of study
2333* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2334* [ServiceRequest](servicerequest.html): Search by subject - a patient
2335* [Specimen](specimen.html): The patient the specimen comes from
2336* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2337* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
2338* [Task](task.html): Search by patient
2339* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2340</b><br>
2341   * Type: <b>reference</b><br>
2342   * 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>
2343   * </p>
2344   */
2345  @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 } )
2346  public static final String SP_PATIENT = "patient";
2347 /**
2348   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2349   * <p>
2350   * Description: <b>Multiple Resources: 
2351
2352* [Account](account.html): The entity that caused the expenses
2353* [AdverseEvent](adverseevent.html): Subject impacted by event
2354* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
2355* [Appointment](appointment.html): One of the individuals of the appointment is this patient
2356* [AppointmentResponse](appointmentresponse.html): This Response is for this Patient
2357* [AuditEvent](auditevent.html): Where the activity involved patient data
2358* [Basic](basic.html): Identifies the focus of this resource
2359* [BodyStructure](bodystructure.html): Who this is about
2360* [CarePlan](careplan.html): Who the care plan is for
2361* [CareTeam](careteam.html): Who care team is for
2362* [ChargeItem](chargeitem.html): Individual service was done for/to
2363* [Claim](claim.html): Patient receiving the products or services
2364* [ClaimResponse](claimresponse.html): The subject of care
2365* [ClinicalImpression](clinicalimpression.html): Patient assessed
2366* [Communication](communication.html): Focus of message
2367* [CommunicationRequest](communicationrequest.html): Focus of message
2368* [Composition](composition.html): Who and/or what the composition is about
2369* [Condition](condition.html): Who has the condition?
2370* [Consent](consent.html): Who the consent applies to
2371* [Contract](contract.html): The identity of the subject of the contract (if a patient)
2372* [Coverage](coverage.html): Retrieve coverages for a patient
2373* [CoverageEligibilityRequest](coverageeligibilityrequest.html): The reference to the patient
2374* [CoverageEligibilityResponse](coverageeligibilityresponse.html): The reference to the patient
2375* [DetectedIssue](detectedissue.html): Associated patient
2376* [DeviceRequest](devicerequest.html): Individual the service is ordered for
2377* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
2378* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
2379* [DocumentReference](documentreference.html): Who/what is the subject of the document
2380* [Encounter](encounter.html): The patient present at the encounter
2381* [EnrollmentRequest](enrollmentrequest.html): The party to be enrolled
2382* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
2383* [ExplanationOfBenefit](explanationofbenefit.html): The reference to the patient
2384* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
2385* [Flag](flag.html): The identity of a subject to list flags for
2386* [Goal](goal.html): Who this goal is intended for
2387* [GuidanceResponse](guidanceresponse.html): The identity of a patient to search for guidance response results
2388* [ImagingSelection](imagingselection.html): Who the study is about
2389* [ImagingStudy](imagingstudy.html): Who the study is about
2390* [Immunization](immunization.html): The patient for the vaccination record
2391* [ImmunizationEvaluation](immunizationevaluation.html): The patient being evaluated
2392* [ImmunizationRecommendation](immunizationrecommendation.html): Who this profile is for
2393* [Invoice](invoice.html): Recipient(s) of goods and services
2394* [List](list.html): If all resources have the same subject
2395* [MeasureReport](measurereport.html): The identity of a patient to search for individual measure report results for
2396* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
2397* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
2398* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
2399* [MedicationStatement](medicationstatement.html): Returns statements for a specific patient.
2400* [MolecularSequence](molecularsequence.html): The subject that the sequence is about
2401* [NutritionIntake](nutritionintake.html): Returns statements for a specific patient.
2402* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
2403* [Observation](observation.html): The subject that the observation is about (if patient)
2404* [Person](person.html): The Person links to this Patient
2405* [Procedure](procedure.html): Search by subject - a patient
2406* [Provenance](provenance.html): Where the activity involved patient data
2407* [QuestionnaireResponse](questionnaireresponse.html): The patient that is the subject of the questionnaire response
2408* [RelatedPerson](relatedperson.html): The patient this related person is related to
2409* [RequestOrchestration](requestorchestration.html): The identity of a patient to search for request orchestrations
2410* [ResearchSubject](researchsubject.html): Who or what is part of study
2411* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
2412* [ServiceRequest](servicerequest.html): Search by subject - a patient
2413* [Specimen](specimen.html): The patient the specimen comes from
2414* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
2415* [SupplyRequest](supplyrequest.html): The patient or subject for whom the supply is destined
2416* [Task](task.html): Search by patient
2417* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
2418</b><br>
2419   * Type: <b>reference</b><br>
2420   * 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>
2421   * </p>
2422   */
2423  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2424
2425/**
2426   * Constant for fluent queries to be used to add include statements. Specifies
2427   * the path value of "<b>Provenance:patient</b>".
2428   */
2429  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Provenance:patient").toLocked();
2430
2431
2432}
2433