001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * 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.
050 */
051@ResourceDef(name="Provenance", profile="http://hl7.org/fhir/StructureDefinition/Provenance")
052public class Provenance extends DomainResource {
053
054    public enum ProvenanceEntityRole {
055        /**
056         * A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity.
057         */
058        DERIVATION, 
059        /**
060         * A derivation for which the resulting entity is a revised version of some original.
061         */
062        REVISION, 
063        /**
064         * The repeat of (some or all of) an entity, such as text or image, by someone who might or might not be its original author.
065         */
066        QUOTATION, 
067        /**
068         * A primary source for a topic refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight.
069         */
070        SOURCE, 
071        /**
072         * A derivation for which the entity is removed from accessibility usually through the use of the Delete operation.
073         */
074        REMOVAL, 
075        /**
076         * added to help the parsers with the generic types
077         */
078        NULL;
079        public static ProvenanceEntityRole fromCode(String codeString) throws FHIRException {
080            if (codeString == null || "".equals(codeString))
081                return null;
082        if ("derivation".equals(codeString))
083          return DERIVATION;
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 ("removal".equals(codeString))
091          return REMOVAL;
092        if (Configuration.isAcceptInvalidEnums())
093          return null;
094        else
095          throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'");
096        }
097        public String toCode() {
098          switch (this) {
099            case DERIVATION: return "derivation";
100            case REVISION: return "revision";
101            case QUOTATION: return "quotation";
102            case SOURCE: return "source";
103            case REMOVAL: return "removal";
104            case NULL: return null;
105            default: return "?";
106          }
107        }
108        public String getSystem() {
109          switch (this) {
110            case DERIVATION: return "http://hl7.org/fhir/provenance-entity-role";
111            case REVISION: return "http://hl7.org/fhir/provenance-entity-role";
112            case QUOTATION: return "http://hl7.org/fhir/provenance-entity-role";
113            case SOURCE: return "http://hl7.org/fhir/provenance-entity-role";
114            case REMOVAL: return "http://hl7.org/fhir/provenance-entity-role";
115            case NULL: return null;
116            default: return "?";
117          }
118        }
119        public String getDefinition() {
120          switch (this) {
121            case DERIVATION: return "A transformation of an entity into another, an update of an entity resulting in a new one, or the construction of a new entity based on a pre-existing entity.";
122            case REVISION: return "A derivation for which the resulting entity is a revised version of some original.";
123            case QUOTATION: return "The repeat of (some or all of) an entity, such as text or image, by someone who might or might not be its original author.";
124            case SOURCE: return "A primary source for a topic refers to something produced by some agent with direct experience and knowledge about the topic, at the time of the topic's study, without benefit from hindsight.";
125            case REMOVAL: return "A derivation for which the entity is removed from accessibility usually through the use of the Delete operation.";
126            case NULL: return null;
127            default: return "?";
128          }
129        }
130        public String getDisplay() {
131          switch (this) {
132            case DERIVATION: return "Derivation";
133            case REVISION: return "Revision";
134            case QUOTATION: return "Quotation";
135            case SOURCE: return "Source";
136            case REMOVAL: return "Removal";
137            case NULL: return null;
138            default: return "?";
139          }
140        }
141    }
142
143  public static class ProvenanceEntityRoleEnumFactory implements EnumFactory<ProvenanceEntityRole> {
144    public ProvenanceEntityRole fromCode(String codeString) throws IllegalArgumentException {
145      if (codeString == null || "".equals(codeString))
146            if (codeString == null || "".equals(codeString))
147                return null;
148        if ("derivation".equals(codeString))
149          return ProvenanceEntityRole.DERIVATION;
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 ("removal".equals(codeString))
157          return ProvenanceEntityRole.REMOVAL;
158        throw new IllegalArgumentException("Unknown ProvenanceEntityRole code '"+codeString+"'");
159        }
160        public Enumeration<ProvenanceEntityRole> fromType(Base code) throws FHIRException {
161          if (code == null)
162            return null;
163          if (code.isEmpty())
164            return new Enumeration<ProvenanceEntityRole>(this);
165          String codeString = ((PrimitiveType) code).asStringValue();
166          if (codeString == null || "".equals(codeString))
167            return null;
168        if ("derivation".equals(codeString))
169          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.DERIVATION);
170        if ("revision".equals(codeString))
171          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.REVISION);
172        if ("quotation".equals(codeString))
173          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.QUOTATION);
174        if ("source".equals(codeString))
175          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.SOURCE);
176        if ("removal".equals(codeString))
177          return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.REMOVAL);
178        throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'");
179        }
180    public String toCode(ProvenanceEntityRole code) {
181      if (code == ProvenanceEntityRole.DERIVATION)
182        return "derivation";
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.REMOVAL)
190        return "removal";
191      return "?";
192      }
193    public String toSystem(ProvenanceEntityRole code) {
194      return code.getSystem();
195      }
196    }
197
198    @Block()
199    public static class ProvenanceAgentComponent extends BackboneElement implements IBaseBackboneElement {
200        /**
201         * The participation the agent had with respect to the activity.
202         */
203        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
204        @Description(shortDefinition="How the agent participated", formalDefinition="The participation the agent had with respect to the activity." )
205        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-agent-type")
206        protected CodeableConcept type;
207
208        /**
209         * The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity.
210         */
211        @Child(name = "role", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
212        @Description(shortDefinition="What the agents role was", formalDefinition="The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity." )
213        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-role-type")
214        protected List<CodeableConcept> role;
215
216        /**
217         * The individual, device or organization that participated in the event.
218         */
219        @Child(name = "who", type = {Practitioner.class, PractitionerRole.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=3, min=1, max=1, modifier=false, summary=true)
220        @Description(shortDefinition="Who participated", formalDefinition="The individual, device or organization that participated in the event." )
221        protected Reference who;
222
223        /**
224         * The actual object that is the target of the reference (The individual, device or organization that participated in the event.)
225         */
226        protected Resource whoTarget;
227
228        /**
229         * The individual, device, or organization for whom the change was made.
230         */
231        @Child(name = "onBehalfOf", type = {Practitioner.class, PractitionerRole.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
232        @Description(shortDefinition="Who the agent is representing", formalDefinition="The individual, device, or organization for whom the change was made." )
233        protected Reference onBehalfOf;
234
235        /**
236         * The actual object that is the target of the reference (The individual, device, or organization for whom the change was made.)
237         */
238        protected Resource onBehalfOfTarget;
239
240        private static final long serialVersionUID = -1363252586L;
241
242    /**
243     * Constructor
244     */
245      public ProvenanceAgentComponent() {
246        super();
247      }
248
249    /**
250     * Constructor
251     */
252      public ProvenanceAgentComponent(Reference who) {
253        super();
254        this.who = who;
255      }
256
257        /**
258         * @return {@link #type} (The participation the agent had with respect to the activity.)
259         */
260        public CodeableConcept getType() { 
261          if (this.type == null)
262            if (Configuration.errorOnAutoCreate())
263              throw new Error("Attempt to auto-create ProvenanceAgentComponent.type");
264            else if (Configuration.doAutoCreate())
265              this.type = new CodeableConcept(); // cc
266          return this.type;
267        }
268
269        public boolean hasType() { 
270          return this.type != null && !this.type.isEmpty();
271        }
272
273        /**
274         * @param value {@link #type} (The participation the agent had with respect to the activity.)
275         */
276        public ProvenanceAgentComponent setType(CodeableConcept value) { 
277          this.type = value;
278          return this;
279        }
280
281        /**
282         * @return {@link #role} (The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity.)
283         */
284        public List<CodeableConcept> getRole() { 
285          if (this.role == null)
286            this.role = new ArrayList<CodeableConcept>();
287          return this.role;
288        }
289
290        /**
291         * @return Returns a reference to <code>this</code> for easy method chaining
292         */
293        public ProvenanceAgentComponent setRole(List<CodeableConcept> theRole) { 
294          this.role = theRole;
295          return this;
296        }
297
298        public boolean hasRole() { 
299          if (this.role == null)
300            return false;
301          for (CodeableConcept item : this.role)
302            if (!item.isEmpty())
303              return true;
304          return false;
305        }
306
307        public CodeableConcept addRole() { //3
308          CodeableConcept t = new CodeableConcept();
309          if (this.role == null)
310            this.role = new ArrayList<CodeableConcept>();
311          this.role.add(t);
312          return t;
313        }
314
315        public ProvenanceAgentComponent addRole(CodeableConcept t) { //3
316          if (t == null)
317            return this;
318          if (this.role == null)
319            this.role = new ArrayList<CodeableConcept>();
320          this.role.add(t);
321          return this;
322        }
323
324        /**
325         * @return The first repetition of repeating field {@link #role}, creating it if it does not already exist
326         */
327        public CodeableConcept getRoleFirstRep() { 
328          if (getRole().isEmpty()) {
329            addRole();
330          }
331          return getRole().get(0);
332        }
333
334        /**
335         * @return {@link #who} (The individual, device or organization that participated in the event.)
336         */
337        public Reference getWho() { 
338          if (this.who == null)
339            if (Configuration.errorOnAutoCreate())
340              throw new Error("Attempt to auto-create ProvenanceAgentComponent.who");
341            else if (Configuration.doAutoCreate())
342              this.who = new Reference(); // cc
343          return this.who;
344        }
345
346        public boolean hasWho() { 
347          return this.who != null && !this.who.isEmpty();
348        }
349
350        /**
351         * @param value {@link #who} (The individual, device or organization that participated in the event.)
352         */
353        public ProvenanceAgentComponent setWho(Reference value) { 
354          this.who = value;
355          return this;
356        }
357
358        /**
359         * @return {@link #who} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual, device or organization that participated in the event.)
360         */
361        public Resource getWhoTarget() { 
362          return this.whoTarget;
363        }
364
365        /**
366         * @param value {@link #who} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual, device or organization that participated in the event.)
367         */
368        public ProvenanceAgentComponent setWhoTarget(Resource value) { 
369          this.whoTarget = value;
370          return this;
371        }
372
373        /**
374         * @return {@link #onBehalfOf} (The individual, device, or organization for whom the change was made.)
375         */
376        public Reference getOnBehalfOf() { 
377          if (this.onBehalfOf == null)
378            if (Configuration.errorOnAutoCreate())
379              throw new Error("Attempt to auto-create ProvenanceAgentComponent.onBehalfOf");
380            else if (Configuration.doAutoCreate())
381              this.onBehalfOf = new Reference(); // cc
382          return this.onBehalfOf;
383        }
384
385        public boolean hasOnBehalfOf() { 
386          return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
387        }
388
389        /**
390         * @param value {@link #onBehalfOf} (The individual, device, or organization for whom the change was made.)
391         */
392        public ProvenanceAgentComponent setOnBehalfOf(Reference value) { 
393          this.onBehalfOf = value;
394          return this;
395        }
396
397        /**
398         * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual, device, or organization for whom the change was made.)
399         */
400        public Resource getOnBehalfOfTarget() { 
401          return this.onBehalfOfTarget;
402        }
403
404        /**
405         * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual, device, or organization for whom the change was made.)
406         */
407        public ProvenanceAgentComponent setOnBehalfOfTarget(Resource value) { 
408          this.onBehalfOfTarget = value;
409          return this;
410        }
411
412        protected void listChildren(List<Property> children) {
413          super.listChildren(children);
414          children.add(new Property("type", "CodeableConcept", "The participation the agent had with respect to the activity.", 0, 1, type));
415          children.add(new Property("role", "CodeableConcept", "The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role));
416          children.add(new Property("who", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "The individual, device or organization that participated in the event.", 0, 1, who));
417          children.add(new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "The individual, device, or organization for whom the change was made.", 0, 1, onBehalfOf));
418        }
419
420        @Override
421        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
422          switch (_hash) {
423          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The participation the agent had with respect to the activity.", 0, 1, type);
424          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role);
425          case 117694: /*who*/  return new Property("who", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "The individual, device or organization that participated in the event.", 0, 1, who);
426          case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "The individual, device, or organization for whom the change was made.", 0, 1, onBehalfOf);
427          default: return super.getNamedProperty(_hash, _name, _checkValid);
428          }
429
430        }
431
432      @Override
433      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
434        switch (hash) {
435        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
436        case 3506294: /*role*/ return this.role == null ? new Base[0] : this.role.toArray(new Base[this.role.size()]); // CodeableConcept
437        case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Reference
438        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
439        default: return super.getProperty(hash, name, checkValid);
440        }
441
442      }
443
444      @Override
445      public Base setProperty(int hash, String name, Base value) throws FHIRException {
446        switch (hash) {
447        case 3575610: // type
448          this.type = castToCodeableConcept(value); // CodeableConcept
449          return value;
450        case 3506294: // role
451          this.getRole().add(castToCodeableConcept(value)); // CodeableConcept
452          return value;
453        case 117694: // who
454          this.who = castToReference(value); // Reference
455          return value;
456        case -14402964: // onBehalfOf
457          this.onBehalfOf = castToReference(value); // Reference
458          return value;
459        default: return super.setProperty(hash, name, value);
460        }
461
462      }
463
464      @Override
465      public Base setProperty(String name, Base value) throws FHIRException {
466        if (name.equals("type")) {
467          this.type = castToCodeableConcept(value); // CodeableConcept
468        } else if (name.equals("role")) {
469          this.getRole().add(castToCodeableConcept(value));
470        } else if (name.equals("who")) {
471          this.who = castToReference(value); // Reference
472        } else if (name.equals("onBehalfOf")) {
473          this.onBehalfOf = castToReference(value); // Reference
474        } else
475          return super.setProperty(name, value);
476        return value;
477      }
478
479      @Override
480      public Base makeProperty(int hash, String name) throws FHIRException {
481        switch (hash) {
482        case 3575610:  return getType(); 
483        case 3506294:  return addRole(); 
484        case 117694:  return getWho(); 
485        case -14402964:  return getOnBehalfOf(); 
486        default: return super.makeProperty(hash, name);
487        }
488
489      }
490
491      @Override
492      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
493        switch (hash) {
494        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
495        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
496        case 117694: /*who*/ return new String[] {"Reference"};
497        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
498        default: return super.getTypesForProperty(hash, name);
499        }
500
501      }
502
503      @Override
504      public Base addChild(String name) throws FHIRException {
505        if (name.equals("type")) {
506          this.type = new CodeableConcept();
507          return this.type;
508        }
509        else if (name.equals("role")) {
510          return addRole();
511        }
512        else if (name.equals("who")) {
513          this.who = new Reference();
514          return this.who;
515        }
516        else if (name.equals("onBehalfOf")) {
517          this.onBehalfOf = new Reference();
518          return this.onBehalfOf;
519        }
520        else
521          return super.addChild(name);
522      }
523
524      public ProvenanceAgentComponent copy() {
525        ProvenanceAgentComponent dst = new ProvenanceAgentComponent();
526        copyValues(dst);
527        return dst;
528      }
529
530      public void copyValues(ProvenanceAgentComponent dst) {
531        super.copyValues(dst);
532        dst.type = type == null ? null : type.copy();
533        if (role != null) {
534          dst.role = new ArrayList<CodeableConcept>();
535          for (CodeableConcept i : role)
536            dst.role.add(i.copy());
537        };
538        dst.who = who == null ? null : who.copy();
539        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
540      }
541
542      @Override
543      public boolean equalsDeep(Base other_) {
544        if (!super.equalsDeep(other_))
545          return false;
546        if (!(other_ instanceof ProvenanceAgentComponent))
547          return false;
548        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
549        return compareDeep(type, o.type, true) && compareDeep(role, o.role, true) && compareDeep(who, o.who, true)
550           && compareDeep(onBehalfOf, o.onBehalfOf, true);
551      }
552
553      @Override
554      public boolean equalsShallow(Base other_) {
555        if (!super.equalsShallow(other_))
556          return false;
557        if (!(other_ instanceof ProvenanceAgentComponent))
558          return false;
559        ProvenanceAgentComponent o = (ProvenanceAgentComponent) other_;
560        return true;
561      }
562
563      public boolean isEmpty() {
564        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, role, who, onBehalfOf
565          );
566      }
567
568  public String fhirType() {
569    return "Provenance.agent";
570
571  }
572
573  }
574
575    @Block()
576    public static class ProvenanceEntityComponent extends BackboneElement implements IBaseBackboneElement {
577        /**
578         * How the entity was used during the activity.
579         */
580        @Child(name = "role", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
581        @Description(shortDefinition="derivation | revision | quotation | source | removal", formalDefinition="How the entity was used during the activity." )
582        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-entity-role")
583        protected Enumeration<ProvenanceEntityRole> role;
584
585        /**
586         * Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.
587         */
588        @Child(name = "what", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true)
589        @Description(shortDefinition="Identity of entity", formalDefinition="Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative." )
590        protected Reference what;
591
592        /**
593         * The actual object that is the target of the reference (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
594         */
595        protected Resource whatTarget;
596
597        /**
598         * 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 generated the entity.
599         */
600        @Child(name = "agent", type = {ProvenanceAgentComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
601        @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 generated the entity." )
602        protected List<ProvenanceAgentComponent> agent;
603
604        private static final long serialVersionUID = 144967401L;
605
606    /**
607     * Constructor
608     */
609      public ProvenanceEntityComponent() {
610        super();
611      }
612
613    /**
614     * Constructor
615     */
616      public ProvenanceEntityComponent(Enumeration<ProvenanceEntityRole> role, Reference what) {
617        super();
618        this.role = role;
619        this.what = what;
620      }
621
622        /**
623         * @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
624         */
625        public Enumeration<ProvenanceEntityRole> getRoleElement() { 
626          if (this.role == null)
627            if (Configuration.errorOnAutoCreate())
628              throw new Error("Attempt to auto-create ProvenanceEntityComponent.role");
629            else if (Configuration.doAutoCreate())
630              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory()); // bb
631          return this.role;
632        }
633
634        public boolean hasRoleElement() { 
635          return this.role != null && !this.role.isEmpty();
636        }
637
638        public boolean hasRole() { 
639          return this.role != null && !this.role.isEmpty();
640        }
641
642        /**
643         * @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
644         */
645        public ProvenanceEntityComponent setRoleElement(Enumeration<ProvenanceEntityRole> value) { 
646          this.role = value;
647          return this;
648        }
649
650        /**
651         * @return How the entity was used during the activity.
652         */
653        public ProvenanceEntityRole getRole() { 
654          return this.role == null ? null : this.role.getValue();
655        }
656
657        /**
658         * @param value How the entity was used during the activity.
659         */
660        public ProvenanceEntityComponent setRole(ProvenanceEntityRole value) { 
661            if (this.role == null)
662              this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory());
663            this.role.setValue(value);
664          return this;
665        }
666
667        /**
668         * @return {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
669         */
670        public Reference getWhat() { 
671          if (this.what == null)
672            if (Configuration.errorOnAutoCreate())
673              throw new Error("Attempt to auto-create ProvenanceEntityComponent.what");
674            else if (Configuration.doAutoCreate())
675              this.what = new Reference(); // cc
676          return this.what;
677        }
678
679        public boolean hasWhat() { 
680          return this.what != null && !this.what.isEmpty();
681        }
682
683        /**
684         * @param value {@link #what} (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
685         */
686        public ProvenanceEntityComponent setWhat(Reference value) { 
687          this.what = value;
688          return this;
689        }
690
691        /**
692         * @return {@link #what} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
693         */
694        public Resource getWhatTarget() { 
695          return this.whatTarget;
696        }
697
698        /**
699         * @param value {@link #what} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.)
700         */
701        public ProvenanceEntityComponent setWhatTarget(Resource value) { 
702          this.whatTarget = value;
703          return this;
704        }
705
706        /**
707         * @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 generated the entity.)
708         */
709        public List<ProvenanceAgentComponent> getAgent() { 
710          if (this.agent == null)
711            this.agent = new ArrayList<ProvenanceAgentComponent>();
712          return this.agent;
713        }
714
715        /**
716         * @return Returns a reference to <code>this</code> for easy method chaining
717         */
718        public ProvenanceEntityComponent setAgent(List<ProvenanceAgentComponent> theAgent) { 
719          this.agent = theAgent;
720          return this;
721        }
722
723        public boolean hasAgent() { 
724          if (this.agent == null)
725            return false;
726          for (ProvenanceAgentComponent item : this.agent)
727            if (!item.isEmpty())
728              return true;
729          return false;
730        }
731
732        public ProvenanceAgentComponent addAgent() { //3
733          ProvenanceAgentComponent t = new ProvenanceAgentComponent();
734          if (this.agent == null)
735            this.agent = new ArrayList<ProvenanceAgentComponent>();
736          this.agent.add(t);
737          return t;
738        }
739
740        public ProvenanceEntityComponent addAgent(ProvenanceAgentComponent t) { //3
741          if (t == null)
742            return this;
743          if (this.agent == null)
744            this.agent = new ArrayList<ProvenanceAgentComponent>();
745          this.agent.add(t);
746          return this;
747        }
748
749        /**
750         * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
751         */
752        public ProvenanceAgentComponent getAgentFirstRep() { 
753          if (getAgent().isEmpty()) {
754            addAgent();
755          }
756          return getAgent().get(0);
757        }
758
759        protected void listChildren(List<Property> children) {
760          super.listChildren(children);
761          children.add(new Property("role", "code", "How the entity was used during the activity.", 0, 1, role));
762          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));
763          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 generated the entity.", 0, java.lang.Integer.MAX_VALUE, agent));
764        }
765
766        @Override
767        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
768          switch (_hash) {
769          case 3506294: /*role*/  return new Property("role", "code", "How the entity was used during the activity.", 0, 1, role);
770          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);
771          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 generated the entity.", 0, java.lang.Integer.MAX_VALUE, agent);
772          default: return super.getNamedProperty(_hash, _name, _checkValid);
773          }
774
775        }
776
777      @Override
778      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
779        switch (hash) {
780        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // Enumeration<ProvenanceEntityRole>
781        case 3648196: /*what*/ return this.what == null ? new Base[0] : new Base[] {this.what}; // Reference
782        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
783        default: return super.getProperty(hash, name, checkValid);
784        }
785
786      }
787
788      @Override
789      public Base setProperty(int hash, String name, Base value) throws FHIRException {
790        switch (hash) {
791        case 3506294: // role
792          value = new ProvenanceEntityRoleEnumFactory().fromType(castToCode(value));
793          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
794          return value;
795        case 3648196: // what
796          this.what = castToReference(value); // Reference
797          return value;
798        case 92750597: // agent
799          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
800          return value;
801        default: return super.setProperty(hash, name, value);
802        }
803
804      }
805
806      @Override
807      public Base setProperty(String name, Base value) throws FHIRException {
808        if (name.equals("role")) {
809          value = new ProvenanceEntityRoleEnumFactory().fromType(castToCode(value));
810          this.role = (Enumeration) value; // Enumeration<ProvenanceEntityRole>
811        } else if (name.equals("what")) {
812          this.what = castToReference(value); // Reference
813        } else if (name.equals("agent")) {
814          this.getAgent().add((ProvenanceAgentComponent) value);
815        } else
816          return super.setProperty(name, value);
817        return value;
818      }
819
820      @Override
821      public Base makeProperty(int hash, String name) throws FHIRException {
822        switch (hash) {
823        case 3506294:  return getRoleElement();
824        case 3648196:  return getWhat(); 
825        case 92750597:  return addAgent(); 
826        default: return super.makeProperty(hash, name);
827        }
828
829      }
830
831      @Override
832      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
833        switch (hash) {
834        case 3506294: /*role*/ return new String[] {"code"};
835        case 3648196: /*what*/ return new String[] {"Reference"};
836        case 92750597: /*agent*/ return new String[] {"@Provenance.agent"};
837        default: return super.getTypesForProperty(hash, name);
838        }
839
840      }
841
842      @Override
843      public Base addChild(String name) throws FHIRException {
844        if (name.equals("role")) {
845          throw new FHIRException("Cannot call addChild on a primitive type Provenance.role");
846        }
847        else if (name.equals("what")) {
848          this.what = new Reference();
849          return this.what;
850        }
851        else if (name.equals("agent")) {
852          return addAgent();
853        }
854        else
855          return super.addChild(name);
856      }
857
858      public ProvenanceEntityComponent copy() {
859        ProvenanceEntityComponent dst = new ProvenanceEntityComponent();
860        copyValues(dst);
861        return dst;
862      }
863
864      public void copyValues(ProvenanceEntityComponent dst) {
865        super.copyValues(dst);
866        dst.role = role == null ? null : role.copy();
867        dst.what = what == null ? null : what.copy();
868        if (agent != null) {
869          dst.agent = new ArrayList<ProvenanceAgentComponent>();
870          for (ProvenanceAgentComponent i : agent)
871            dst.agent.add(i.copy());
872        };
873      }
874
875      @Override
876      public boolean equalsDeep(Base other_) {
877        if (!super.equalsDeep(other_))
878          return false;
879        if (!(other_ instanceof ProvenanceEntityComponent))
880          return false;
881        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
882        return compareDeep(role, o.role, true) && compareDeep(what, o.what, true) && compareDeep(agent, o.agent, true)
883          ;
884      }
885
886      @Override
887      public boolean equalsShallow(Base other_) {
888        if (!super.equalsShallow(other_))
889          return false;
890        if (!(other_ instanceof ProvenanceEntityComponent))
891          return false;
892        ProvenanceEntityComponent o = (ProvenanceEntityComponent) other_;
893        return compareValues(role, o.role, true);
894      }
895
896      public boolean isEmpty() {
897        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, what, agent);
898      }
899
900  public String fhirType() {
901    return "Provenance.entity";
902
903  }
904
905  }
906
907    /**
908     * 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.
909     */
910    @Child(name = "target", type = {Reference.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
911    @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." )
912    protected List<Reference> target;
913    /**
914     * The actual objects that are the target of the reference (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.)
915     */
916    protected List<Resource> targetTarget;
917
918
919    /**
920     * The period during which the activity occurred.
921     */
922    @Child(name = "occurred", type = {Period.class, DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
923    @Description(shortDefinition="When the activity occurred", formalDefinition="The period during which the activity occurred." )
924    protected Type occurred;
925
926    /**
927     * The instant of time at which the activity was recorded.
928     */
929    @Child(name = "recorded", type = {InstantType.class}, order=2, min=1, max=1, modifier=false, summary=true)
930    @Description(shortDefinition="When the activity was recorded / updated", formalDefinition="The instant of time at which the activity was recorded." )
931    protected InstantType recorded;
932
933    /**
934     * 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.
935     */
936    @Child(name = "policy", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
937    @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." )
938    protected List<UriType> policy;
939
940    /**
941     * Where the activity occurred, if relevant.
942     */
943    @Child(name = "location", type = {Location.class}, order=4, min=0, max=1, modifier=false, summary=false)
944    @Description(shortDefinition="Where the activity occurred, if relevant", formalDefinition="Where the activity occurred, if relevant." )
945    protected Reference location;
946
947    /**
948     * The actual object that is the target of the reference (Where the activity occurred, if relevant.)
949     */
950    protected Location locationTarget;
951
952    /**
953     * The reason that the activity was taking place.
954     */
955    @Child(name = "reason", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
956    @Description(shortDefinition="Reason the activity is occurring", formalDefinition="The reason that the activity was taking place." )
957    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-PurposeOfUse")
958    protected List<CodeableConcept> reason;
959
960    /**
961     * 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.
962     */
963    @Child(name = "activity", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
964    @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." )
965    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/provenance-activity-type")
966    protected CodeableConcept activity;
967
968    /**
969     * An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.
970     */
971    @Child(name = "agent", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
972    @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." )
973    protected List<ProvenanceAgentComponent> agent;
974
975    /**
976     * An entity used in this activity.
977     */
978    @Child(name = "entity", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
979    @Description(shortDefinition="An entity used in this activity", formalDefinition="An entity used in this activity." )
980    protected List<ProvenanceEntityComponent> entity;
981
982    /**
983     * A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.
984     */
985    @Child(name = "signature", type = {Signature.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
986    @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." )
987    protected List<Signature> signature;
988
989    private static final long serialVersionUID = -1991881518L;
990
991  /**
992   * Constructor
993   */
994    public Provenance() {
995      super();
996    }
997
998  /**
999   * Constructor
1000   */
1001    public Provenance(InstantType recorded) {
1002      super();
1003      this.recorded = recorded;
1004    }
1005
1006    /**
1007     * @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.)
1008     */
1009    public List<Reference> getTarget() { 
1010      if (this.target == null)
1011        this.target = new ArrayList<Reference>();
1012      return this.target;
1013    }
1014
1015    /**
1016     * @return Returns a reference to <code>this</code> for easy method chaining
1017     */
1018    public Provenance setTarget(List<Reference> theTarget) { 
1019      this.target = theTarget;
1020      return this;
1021    }
1022
1023    public boolean hasTarget() { 
1024      if (this.target == null)
1025        return false;
1026      for (Reference item : this.target)
1027        if (!item.isEmpty())
1028          return true;
1029      return false;
1030    }
1031
1032    public Reference addTarget() { //3
1033      Reference t = new Reference();
1034      if (this.target == null)
1035        this.target = new ArrayList<Reference>();
1036      this.target.add(t);
1037      return t;
1038    }
1039
1040    public Provenance addTarget(Reference t) { //3
1041      if (t == null)
1042        return this;
1043      if (this.target == null)
1044        this.target = new ArrayList<Reference>();
1045      this.target.add(t);
1046      return this;
1047    }
1048
1049    /**
1050     * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
1051     */
1052    public Reference getTargetFirstRep() { 
1053      if (getTarget().isEmpty()) {
1054        addTarget();
1055      }
1056      return getTarget().get(0);
1057    }
1058
1059    /**
1060     * @deprecated Use Reference#setResource(IBaseResource) instead
1061     */
1062    @Deprecated
1063    public List<Resource> getTargetTarget() { 
1064      if (this.targetTarget == null)
1065        this.targetTarget = new ArrayList<Resource>();
1066      return this.targetTarget;
1067    }
1068
1069    /**
1070     * @return {@link #occurred} (The period during which the activity occurred.)
1071     */
1072    public Type getOccurred() { 
1073      return this.occurred;
1074    }
1075
1076    /**
1077     * @return {@link #occurred} (The period during which the activity occurred.)
1078     */
1079    public Period getOccurredPeriod() throws FHIRException { 
1080      if (this.occurred == null)
1081        this.occurred = new Period();
1082      if (!(this.occurred instanceof Period))
1083        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurred.getClass().getName()+" was encountered");
1084      return (Period) this.occurred;
1085    }
1086
1087    public boolean hasOccurredPeriod() { 
1088      return this != null && this.occurred instanceof Period;
1089    }
1090
1091    /**
1092     * @return {@link #occurred} (The period during which the activity occurred.)
1093     */
1094    public DateTimeType getOccurredDateTimeType() throws FHIRException { 
1095      if (this.occurred == null)
1096        this.occurred = new DateTimeType();
1097      if (!(this.occurred instanceof DateTimeType))
1098        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurred.getClass().getName()+" was encountered");
1099      return (DateTimeType) this.occurred;
1100    }
1101
1102    public boolean hasOccurredDateTimeType() { 
1103      return this != null && this.occurred instanceof DateTimeType;
1104    }
1105
1106    public boolean hasOccurred() { 
1107      return this.occurred != null && !this.occurred.isEmpty();
1108    }
1109
1110    /**
1111     * @param value {@link #occurred} (The period during which the activity occurred.)
1112     */
1113    public Provenance setOccurred(Type value) { 
1114      if (value != null && !(value instanceof Period || value instanceof DateTimeType))
1115        throw new Error("Not the right type for Provenance.occurred[x]: "+value.fhirType());
1116      this.occurred = value;
1117      return this;
1118    }
1119
1120    /**
1121     * @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
1122     */
1123    public InstantType getRecordedElement() { 
1124      if (this.recorded == null)
1125        if (Configuration.errorOnAutoCreate())
1126          throw new Error("Attempt to auto-create Provenance.recorded");
1127        else if (Configuration.doAutoCreate())
1128          this.recorded = new InstantType(); // bb
1129      return this.recorded;
1130    }
1131
1132    public boolean hasRecordedElement() { 
1133      return this.recorded != null && !this.recorded.isEmpty();
1134    }
1135
1136    public boolean hasRecorded() { 
1137      return this.recorded != null && !this.recorded.isEmpty();
1138    }
1139
1140    /**
1141     * @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
1142     */
1143    public Provenance setRecordedElement(InstantType value) { 
1144      this.recorded = value;
1145      return this;
1146    }
1147
1148    /**
1149     * @return The instant of time at which the activity was recorded.
1150     */
1151    public Date getRecorded() { 
1152      return this.recorded == null ? null : this.recorded.getValue();
1153    }
1154
1155    /**
1156     * @param value The instant of time at which the activity was recorded.
1157     */
1158    public Provenance setRecorded(Date value) { 
1159        if (this.recorded == null)
1160          this.recorded = new InstantType();
1161        this.recorded.setValue(value);
1162      return this;
1163    }
1164
1165    /**
1166     * @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.)
1167     */
1168    public List<UriType> getPolicy() { 
1169      if (this.policy == null)
1170        this.policy = new ArrayList<UriType>();
1171      return this.policy;
1172    }
1173
1174    /**
1175     * @return Returns a reference to <code>this</code> for easy method chaining
1176     */
1177    public Provenance setPolicy(List<UriType> thePolicy) { 
1178      this.policy = thePolicy;
1179      return this;
1180    }
1181
1182    public boolean hasPolicy() { 
1183      if (this.policy == null)
1184        return false;
1185      for (UriType item : this.policy)
1186        if (!item.isEmpty())
1187          return true;
1188      return false;
1189    }
1190
1191    /**
1192     * @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.)
1193     */
1194    public UriType addPolicyElement() {//2 
1195      UriType t = new UriType();
1196      if (this.policy == null)
1197        this.policy = new ArrayList<UriType>();
1198      this.policy.add(t);
1199      return t;
1200    }
1201
1202    /**
1203     * @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.)
1204     */
1205    public Provenance addPolicy(String value) { //1
1206      UriType t = new UriType();
1207      t.setValue(value);
1208      if (this.policy == null)
1209        this.policy = new ArrayList<UriType>();
1210      this.policy.add(t);
1211      return this;
1212    }
1213
1214    /**
1215     * @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.)
1216     */
1217    public boolean hasPolicy(String value) { 
1218      if (this.policy == null)
1219        return false;
1220      for (UriType v : this.policy)
1221        if (v.getValue().equals(value)) // uri
1222          return true;
1223      return false;
1224    }
1225
1226    /**
1227     * @return {@link #location} (Where the activity occurred, if relevant.)
1228     */
1229    public Reference getLocation() { 
1230      if (this.location == null)
1231        if (Configuration.errorOnAutoCreate())
1232          throw new Error("Attempt to auto-create Provenance.location");
1233        else if (Configuration.doAutoCreate())
1234          this.location = new Reference(); // cc
1235      return this.location;
1236    }
1237
1238    public boolean hasLocation() { 
1239      return this.location != null && !this.location.isEmpty();
1240    }
1241
1242    /**
1243     * @param value {@link #location} (Where the activity occurred, if relevant.)
1244     */
1245    public Provenance setLocation(Reference value) { 
1246      this.location = value;
1247      return this;
1248    }
1249
1250    /**
1251     * @return {@link #location} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Where the activity occurred, if relevant.)
1252     */
1253    public Location getLocationTarget() { 
1254      if (this.locationTarget == null)
1255        if (Configuration.errorOnAutoCreate())
1256          throw new Error("Attempt to auto-create Provenance.location");
1257        else if (Configuration.doAutoCreate())
1258          this.locationTarget = new Location(); // aa
1259      return this.locationTarget;
1260    }
1261
1262    /**
1263     * @param value {@link #location} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Where the activity occurred, if relevant.)
1264     */
1265    public Provenance setLocationTarget(Location value) { 
1266      this.locationTarget = value;
1267      return this;
1268    }
1269
1270    /**
1271     * @return {@link #reason} (The reason that the activity was taking place.)
1272     */
1273    public List<CodeableConcept> getReason() { 
1274      if (this.reason == null)
1275        this.reason = new ArrayList<CodeableConcept>();
1276      return this.reason;
1277    }
1278
1279    /**
1280     * @return Returns a reference to <code>this</code> for easy method chaining
1281     */
1282    public Provenance setReason(List<CodeableConcept> theReason) { 
1283      this.reason = theReason;
1284      return this;
1285    }
1286
1287    public boolean hasReason() { 
1288      if (this.reason == null)
1289        return false;
1290      for (CodeableConcept item : this.reason)
1291        if (!item.isEmpty())
1292          return true;
1293      return false;
1294    }
1295
1296    public CodeableConcept addReason() { //3
1297      CodeableConcept t = new CodeableConcept();
1298      if (this.reason == null)
1299        this.reason = new ArrayList<CodeableConcept>();
1300      this.reason.add(t);
1301      return t;
1302    }
1303
1304    public Provenance addReason(CodeableConcept t) { //3
1305      if (t == null)
1306        return this;
1307      if (this.reason == null)
1308        this.reason = new ArrayList<CodeableConcept>();
1309      this.reason.add(t);
1310      return this;
1311    }
1312
1313    /**
1314     * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist
1315     */
1316    public CodeableConcept getReasonFirstRep() { 
1317      if (getReason().isEmpty()) {
1318        addReason();
1319      }
1320      return getReason().get(0);
1321    }
1322
1323    /**
1324     * @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.)
1325     */
1326    public CodeableConcept getActivity() { 
1327      if (this.activity == null)
1328        if (Configuration.errorOnAutoCreate())
1329          throw new Error("Attempt to auto-create Provenance.activity");
1330        else if (Configuration.doAutoCreate())
1331          this.activity = new CodeableConcept(); // cc
1332      return this.activity;
1333    }
1334
1335    public boolean hasActivity() { 
1336      return this.activity != null && !this.activity.isEmpty();
1337    }
1338
1339    /**
1340     * @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.)
1341     */
1342    public Provenance setActivity(CodeableConcept value) { 
1343      this.activity = value;
1344      return this;
1345    }
1346
1347    /**
1348     * @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.)
1349     */
1350    public List<ProvenanceAgentComponent> getAgent() { 
1351      if (this.agent == null)
1352        this.agent = new ArrayList<ProvenanceAgentComponent>();
1353      return this.agent;
1354    }
1355
1356    /**
1357     * @return Returns a reference to <code>this</code> for easy method chaining
1358     */
1359    public Provenance setAgent(List<ProvenanceAgentComponent> theAgent) { 
1360      this.agent = theAgent;
1361      return this;
1362    }
1363
1364    public boolean hasAgent() { 
1365      if (this.agent == null)
1366        return false;
1367      for (ProvenanceAgentComponent item : this.agent)
1368        if (!item.isEmpty())
1369          return true;
1370      return false;
1371    }
1372
1373    public ProvenanceAgentComponent addAgent() { //3
1374      ProvenanceAgentComponent t = new ProvenanceAgentComponent();
1375      if (this.agent == null)
1376        this.agent = new ArrayList<ProvenanceAgentComponent>();
1377      this.agent.add(t);
1378      return t;
1379    }
1380
1381    public Provenance addAgent(ProvenanceAgentComponent t) { //3
1382      if (t == null)
1383        return this;
1384      if (this.agent == null)
1385        this.agent = new ArrayList<ProvenanceAgentComponent>();
1386      this.agent.add(t);
1387      return this;
1388    }
1389
1390    /**
1391     * @return The first repetition of repeating field {@link #agent}, creating it if it does not already exist
1392     */
1393    public ProvenanceAgentComponent getAgentFirstRep() { 
1394      if (getAgent().isEmpty()) {
1395        addAgent();
1396      }
1397      return getAgent().get(0);
1398    }
1399
1400    /**
1401     * @return {@link #entity} (An entity used in this activity.)
1402     */
1403    public List<ProvenanceEntityComponent> getEntity() { 
1404      if (this.entity == null)
1405        this.entity = new ArrayList<ProvenanceEntityComponent>();
1406      return this.entity;
1407    }
1408
1409    /**
1410     * @return Returns a reference to <code>this</code> for easy method chaining
1411     */
1412    public Provenance setEntity(List<ProvenanceEntityComponent> theEntity) { 
1413      this.entity = theEntity;
1414      return this;
1415    }
1416
1417    public boolean hasEntity() { 
1418      if (this.entity == null)
1419        return false;
1420      for (ProvenanceEntityComponent item : this.entity)
1421        if (!item.isEmpty())
1422          return true;
1423      return false;
1424    }
1425
1426    public ProvenanceEntityComponent addEntity() { //3
1427      ProvenanceEntityComponent t = new ProvenanceEntityComponent();
1428      if (this.entity == null)
1429        this.entity = new ArrayList<ProvenanceEntityComponent>();
1430      this.entity.add(t);
1431      return t;
1432    }
1433
1434    public Provenance addEntity(ProvenanceEntityComponent t) { //3
1435      if (t == null)
1436        return this;
1437      if (this.entity == null)
1438        this.entity = new ArrayList<ProvenanceEntityComponent>();
1439      this.entity.add(t);
1440      return this;
1441    }
1442
1443    /**
1444     * @return The first repetition of repeating field {@link #entity}, creating it if it does not already exist
1445     */
1446    public ProvenanceEntityComponent getEntityFirstRep() { 
1447      if (getEntity().isEmpty()) {
1448        addEntity();
1449      }
1450      return getEntity().get(0);
1451    }
1452
1453    /**
1454     * @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.)
1455     */
1456    public List<Signature> getSignature() { 
1457      if (this.signature == null)
1458        this.signature = new ArrayList<Signature>();
1459      return this.signature;
1460    }
1461
1462    /**
1463     * @return Returns a reference to <code>this</code> for easy method chaining
1464     */
1465    public Provenance setSignature(List<Signature> theSignature) { 
1466      this.signature = theSignature;
1467      return this;
1468    }
1469
1470    public boolean hasSignature() { 
1471      if (this.signature == null)
1472        return false;
1473      for (Signature item : this.signature)
1474        if (!item.isEmpty())
1475          return true;
1476      return false;
1477    }
1478
1479    public Signature addSignature() { //3
1480      Signature t = new Signature();
1481      if (this.signature == null)
1482        this.signature = new ArrayList<Signature>();
1483      this.signature.add(t);
1484      return t;
1485    }
1486
1487    public Provenance addSignature(Signature t) { //3
1488      if (t == null)
1489        return this;
1490      if (this.signature == null)
1491        this.signature = new ArrayList<Signature>();
1492      this.signature.add(t);
1493      return this;
1494    }
1495
1496    /**
1497     * @return The first repetition of repeating field {@link #signature}, creating it if it does not already exist
1498     */
1499    public Signature getSignatureFirstRep() { 
1500      if (getSignature().isEmpty()) {
1501        addSignature();
1502      }
1503      return getSignature().get(0);
1504    }
1505
1506      protected void listChildren(List<Property> children) {
1507        super.listChildren(children);
1508        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));
1509        children.add(new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred));
1510        children.add(new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded));
1511        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));
1512        children.add(new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location));
1513        children.add(new Property("reason", "CodeableConcept", "The reason that the activity was taking place.", 0, java.lang.Integer.MAX_VALUE, reason));
1514        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));
1515        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));
1516        children.add(new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity));
1517        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));
1518      }
1519
1520      @Override
1521      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1522        switch (_hash) {
1523        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);
1524        case 784181563: /*occurred[x]*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1525        case 792816933: /*occurred*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1526        case 894082886: /*occurredPeriod*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1527        case 1579027424: /*occurredDateTime*/  return new Property("occurred[x]", "Period|dateTime", "The period during which the activity occurred.", 0, 1, occurred);
1528        case -799233872: /*recorded*/  return new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, 1, recorded);
1529        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);
1530        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, 1, location);
1531        case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "The reason that the activity was taking place.", 0, java.lang.Integer.MAX_VALUE, reason);
1532        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);
1533        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);
1534        case -1298275357: /*entity*/  return new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity);
1535        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);
1536        default: return super.getNamedProperty(_hash, _name, _checkValid);
1537        }
1538
1539      }
1540
1541      @Override
1542      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1543        switch (hash) {
1544        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // Reference
1545        case 792816933: /*occurred*/ return this.occurred == null ? new Base[0] : new Base[] {this.occurred}; // Type
1546        case -799233872: /*recorded*/ return this.recorded == null ? new Base[0] : new Base[] {this.recorded}; // InstantType
1547        case -982670030: /*policy*/ return this.policy == null ? new Base[0] : this.policy.toArray(new Base[this.policy.size()]); // UriType
1548        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
1549        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
1550        case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : new Base[] {this.activity}; // CodeableConcept
1551        case 92750597: /*agent*/ return this.agent == null ? new Base[0] : this.agent.toArray(new Base[this.agent.size()]); // ProvenanceAgentComponent
1552        case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : this.entity.toArray(new Base[this.entity.size()]); // ProvenanceEntityComponent
1553        case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : this.signature.toArray(new Base[this.signature.size()]); // Signature
1554        default: return super.getProperty(hash, name, checkValid);
1555        }
1556
1557      }
1558
1559      @Override
1560      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1561        switch (hash) {
1562        case -880905839: // target
1563          this.getTarget().add(castToReference(value)); // Reference
1564          return value;
1565        case 792816933: // occurred
1566          this.occurred = castToType(value); // Type
1567          return value;
1568        case -799233872: // recorded
1569          this.recorded = castToInstant(value); // InstantType
1570          return value;
1571        case -982670030: // policy
1572          this.getPolicy().add(castToUri(value)); // UriType
1573          return value;
1574        case 1901043637: // location
1575          this.location = castToReference(value); // Reference
1576          return value;
1577        case -934964668: // reason
1578          this.getReason().add(castToCodeableConcept(value)); // CodeableConcept
1579          return value;
1580        case -1655966961: // activity
1581          this.activity = castToCodeableConcept(value); // CodeableConcept
1582          return value;
1583        case 92750597: // agent
1584          this.getAgent().add((ProvenanceAgentComponent) value); // ProvenanceAgentComponent
1585          return value;
1586        case -1298275357: // entity
1587          this.getEntity().add((ProvenanceEntityComponent) value); // ProvenanceEntityComponent
1588          return value;
1589        case 1073584312: // signature
1590          this.getSignature().add(castToSignature(value)); // Signature
1591          return value;
1592        default: return super.setProperty(hash, name, value);
1593        }
1594
1595      }
1596
1597      @Override
1598      public Base setProperty(String name, Base value) throws FHIRException {
1599        if (name.equals("target")) {
1600          this.getTarget().add(castToReference(value));
1601        } else if (name.equals("occurred[x]")) {
1602          this.occurred = castToType(value); // Type
1603        } else if (name.equals("recorded")) {
1604          this.recorded = castToInstant(value); // InstantType
1605        } else if (name.equals("policy")) {
1606          this.getPolicy().add(castToUri(value));
1607        } else if (name.equals("location")) {
1608          this.location = castToReference(value); // Reference
1609        } else if (name.equals("reason")) {
1610          this.getReason().add(castToCodeableConcept(value));
1611        } else if (name.equals("activity")) {
1612          this.activity = castToCodeableConcept(value); // CodeableConcept
1613        } else if (name.equals("agent")) {
1614          this.getAgent().add((ProvenanceAgentComponent) value);
1615        } else if (name.equals("entity")) {
1616          this.getEntity().add((ProvenanceEntityComponent) value);
1617        } else if (name.equals("signature")) {
1618          this.getSignature().add(castToSignature(value));
1619        } else
1620          return super.setProperty(name, value);
1621        return value;
1622      }
1623
1624      @Override
1625      public Base makeProperty(int hash, String name) throws FHIRException {
1626        switch (hash) {
1627        case -880905839:  return addTarget(); 
1628        case 784181563:  return getOccurred(); 
1629        case 792816933:  return getOccurred(); 
1630        case -799233872:  return getRecordedElement();
1631        case -982670030:  return addPolicyElement();
1632        case 1901043637:  return getLocation(); 
1633        case -934964668:  return addReason(); 
1634        case -1655966961:  return getActivity(); 
1635        case 92750597:  return addAgent(); 
1636        case -1298275357:  return addEntity(); 
1637        case 1073584312:  return addSignature(); 
1638        default: return super.makeProperty(hash, name);
1639        }
1640
1641      }
1642
1643      @Override
1644      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1645        switch (hash) {
1646        case -880905839: /*target*/ return new String[] {"Reference"};
1647        case 792816933: /*occurred*/ return new String[] {"Period", "dateTime"};
1648        case -799233872: /*recorded*/ return new String[] {"instant"};
1649        case -982670030: /*policy*/ return new String[] {"uri"};
1650        case 1901043637: /*location*/ return new String[] {"Reference"};
1651        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
1652        case -1655966961: /*activity*/ return new String[] {"CodeableConcept"};
1653        case 92750597: /*agent*/ return new String[] {};
1654        case -1298275357: /*entity*/ return new String[] {};
1655        case 1073584312: /*signature*/ return new String[] {"Signature"};
1656        default: return super.getTypesForProperty(hash, name);
1657        }
1658
1659      }
1660
1661      @Override
1662      public Base addChild(String name) throws FHIRException {
1663        if (name.equals("target")) {
1664          return addTarget();
1665        }
1666        else if (name.equals("occurredPeriod")) {
1667          this.occurred = new Period();
1668          return this.occurred;
1669        }
1670        else if (name.equals("occurredDateTime")) {
1671          this.occurred = new DateTimeType();
1672          return this.occurred;
1673        }
1674        else if (name.equals("recorded")) {
1675          throw new FHIRException("Cannot call addChild on a primitive type Provenance.recorded");
1676        }
1677        else if (name.equals("policy")) {
1678          throw new FHIRException("Cannot call addChild on a primitive type Provenance.policy");
1679        }
1680        else if (name.equals("location")) {
1681          this.location = new Reference();
1682          return this.location;
1683        }
1684        else if (name.equals("reason")) {
1685          return addReason();
1686        }
1687        else if (name.equals("activity")) {
1688          this.activity = new CodeableConcept();
1689          return this.activity;
1690        }
1691        else if (name.equals("agent")) {
1692          return addAgent();
1693        }
1694        else if (name.equals("entity")) {
1695          return addEntity();
1696        }
1697        else if (name.equals("signature")) {
1698          return addSignature();
1699        }
1700        else
1701          return super.addChild(name);
1702      }
1703
1704  public String fhirType() {
1705    return "Provenance";
1706
1707  }
1708
1709      public Provenance copy() {
1710        Provenance dst = new Provenance();
1711        copyValues(dst);
1712        return dst;
1713      }
1714
1715      public void copyValues(Provenance dst) {
1716        super.copyValues(dst);
1717        if (target != null) {
1718          dst.target = new ArrayList<Reference>();
1719          for (Reference i : target)
1720            dst.target.add(i.copy());
1721        };
1722        dst.occurred = occurred == null ? null : occurred.copy();
1723        dst.recorded = recorded == null ? null : recorded.copy();
1724        if (policy != null) {
1725          dst.policy = new ArrayList<UriType>();
1726          for (UriType i : policy)
1727            dst.policy.add(i.copy());
1728        };
1729        dst.location = location == null ? null : location.copy();
1730        if (reason != null) {
1731          dst.reason = new ArrayList<CodeableConcept>();
1732          for (CodeableConcept i : reason)
1733            dst.reason.add(i.copy());
1734        };
1735        dst.activity = activity == null ? null : activity.copy();
1736        if (agent != null) {
1737          dst.agent = new ArrayList<ProvenanceAgentComponent>();
1738          for (ProvenanceAgentComponent i : agent)
1739            dst.agent.add(i.copy());
1740        };
1741        if (entity != null) {
1742          dst.entity = new ArrayList<ProvenanceEntityComponent>();
1743          for (ProvenanceEntityComponent i : entity)
1744            dst.entity.add(i.copy());
1745        };
1746        if (signature != null) {
1747          dst.signature = new ArrayList<Signature>();
1748          for (Signature i : signature)
1749            dst.signature.add(i.copy());
1750        };
1751      }
1752
1753      protected Provenance typedCopy() {
1754        return copy();
1755      }
1756
1757      @Override
1758      public boolean equalsDeep(Base other_) {
1759        if (!super.equalsDeep(other_))
1760          return false;
1761        if (!(other_ instanceof Provenance))
1762          return false;
1763        Provenance o = (Provenance) other_;
1764        return compareDeep(target, o.target, true) && compareDeep(occurred, o.occurred, true) && compareDeep(recorded, o.recorded, true)
1765           && compareDeep(policy, o.policy, true) && compareDeep(location, o.location, true) && compareDeep(reason, o.reason, true)
1766           && compareDeep(activity, o.activity, true) && compareDeep(agent, o.agent, true) && compareDeep(entity, o.entity, true)
1767           && compareDeep(signature, o.signature, true);
1768      }
1769
1770      @Override
1771      public boolean equalsShallow(Base other_) {
1772        if (!super.equalsShallow(other_))
1773          return false;
1774        if (!(other_ instanceof Provenance))
1775          return false;
1776        Provenance o = (Provenance) other_;
1777        return compareValues(recorded, o.recorded, true) && compareValues(policy, o.policy, true);
1778      }
1779
1780      public boolean isEmpty() {
1781        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, occurred, recorded
1782          , policy, location, reason, activity, agent, entity, signature);
1783      }
1784
1785  @Override
1786  public ResourceType getResourceType() {
1787    return ResourceType.Provenance;
1788   }
1789
1790 /**
1791   * Search parameter: <b>agent-type</b>
1792   * <p>
1793   * Description: <b>How the agent participated</b><br>
1794   * Type: <b>token</b><br>
1795   * Path: <b>Provenance.agent.type</b><br>
1796   * </p>
1797   */
1798  @SearchParamDefinition(name="agent-type", path="Provenance.agent.type", description="How the agent participated", type="token" )
1799  public static final String SP_AGENT_TYPE = "agent-type";
1800 /**
1801   * <b>Fluent Client</b> search parameter constant for <b>agent-type</b>
1802   * <p>
1803   * Description: <b>How the agent participated</b><br>
1804   * Type: <b>token</b><br>
1805   * Path: <b>Provenance.agent.type</b><br>
1806   * </p>
1807   */
1808  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_TYPE);
1809
1810 /**
1811   * Search parameter: <b>agent</b>
1812   * <p>
1813   * Description: <b>Who participated</b><br>
1814   * Type: <b>reference</b><br>
1815   * Path: <b>Provenance.agent.who</b><br>
1816   * </p>
1817   */
1818  @SearchParamDefinition(name="agent", path="Provenance.agent.who", description="Who participated", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
1819  public static final String SP_AGENT = "agent";
1820 /**
1821   * <b>Fluent Client</b> search parameter constant for <b>agent</b>
1822   * <p>
1823   * Description: <b>Who participated</b><br>
1824   * Type: <b>reference</b><br>
1825   * Path: <b>Provenance.agent.who</b><br>
1826   * </p>
1827   */
1828  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AGENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AGENT);
1829
1830/**
1831   * Constant for fluent queries to be used to add include statements. Specifies
1832   * the path value of "<b>Provenance:agent</b>".
1833   */
1834  public static final ca.uhn.fhir.model.api.Include INCLUDE_AGENT = new ca.uhn.fhir.model.api.Include("Provenance:agent").toLocked();
1835
1836 /**
1837   * Search parameter: <b>signature-type</b>
1838   * <p>
1839   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
1840   * Type: <b>token</b><br>
1841   * Path: <b>Provenance.signature.type</b><br>
1842   * </p>
1843   */
1844  @SearchParamDefinition(name="signature-type", path="Provenance.signature.type", description="Indication of the reason the entity signed the object(s)", type="token" )
1845  public static final String SP_SIGNATURE_TYPE = "signature-type";
1846 /**
1847   * <b>Fluent Client</b> search parameter constant for <b>signature-type</b>
1848   * <p>
1849   * Description: <b>Indication of the reason the entity signed the object(s)</b><br>
1850   * Type: <b>token</b><br>
1851   * Path: <b>Provenance.signature.type</b><br>
1852   * </p>
1853   */
1854  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SIGNATURE_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SIGNATURE_TYPE);
1855
1856 /**
1857   * Search parameter: <b>patient</b>
1858   * <p>
1859   * Description: <b>Target Reference(s) (usually version specific)</b><br>
1860   * Type: <b>reference</b><br>
1861   * Path: <b>Provenance.target</b><br>
1862   * </p>
1863   */
1864  @SearchParamDefinition(name="patient", path="Provenance.target.where(resolve() is Patient)", description="Target Reference(s) (usually version specific)", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
1865  public static final String SP_PATIENT = "patient";
1866 /**
1867   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1868   * <p>
1869   * Description: <b>Target Reference(s) (usually version specific)</b><br>
1870   * Type: <b>reference</b><br>
1871   * Path: <b>Provenance.target</b><br>
1872   * </p>
1873   */
1874  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1875
1876/**
1877   * Constant for fluent queries to be used to add include statements. Specifies
1878   * the path value of "<b>Provenance:patient</b>".
1879   */
1880  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Provenance:patient").toLocked();
1881
1882 /**
1883   * Search parameter: <b>location</b>
1884   * <p>
1885   * Description: <b>Where the activity occurred, if relevant</b><br>
1886   * Type: <b>reference</b><br>
1887   * Path: <b>Provenance.location</b><br>
1888   * </p>
1889   */
1890  @SearchParamDefinition(name="location", path="Provenance.location", description="Where the activity occurred, if relevant", type="reference", target={Location.class } )
1891  public static final String SP_LOCATION = "location";
1892 /**
1893   * <b>Fluent Client</b> search parameter constant for <b>location</b>
1894   * <p>
1895   * Description: <b>Where the activity occurred, if relevant</b><br>
1896   * Type: <b>reference</b><br>
1897   * Path: <b>Provenance.location</b><br>
1898   * </p>
1899   */
1900  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
1901
1902/**
1903   * Constant for fluent queries to be used to add include statements. Specifies
1904   * the path value of "<b>Provenance:location</b>".
1905   */
1906  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Provenance:location").toLocked();
1907
1908 /**
1909   * Search parameter: <b>recorded</b>
1910   * <p>
1911   * Description: <b>When the activity was recorded / updated</b><br>
1912   * Type: <b>date</b><br>
1913   * Path: <b>Provenance.recorded</b><br>
1914   * </p>
1915   */
1916  @SearchParamDefinition(name="recorded", path="Provenance.recorded", description="When the activity was recorded / updated", type="date" )
1917  public static final String SP_RECORDED = "recorded";
1918 /**
1919   * <b>Fluent Client</b> search parameter constant for <b>recorded</b>
1920   * <p>
1921   * Description: <b>When the activity was recorded / updated</b><br>
1922   * Type: <b>date</b><br>
1923   * Path: <b>Provenance.recorded</b><br>
1924   * </p>
1925   */
1926  public static final ca.uhn.fhir.rest.gclient.DateClientParam RECORDED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_RECORDED);
1927
1928 /**
1929   * Search parameter: <b>agent-role</b>
1930   * <p>
1931   * Description: <b>What the agents role was</b><br>
1932   * Type: <b>token</b><br>
1933   * Path: <b>Provenance.agent.role</b><br>
1934   * </p>
1935   */
1936  @SearchParamDefinition(name="agent-role", path="Provenance.agent.role", description="What the agents role was", type="token" )
1937  public static final String SP_AGENT_ROLE = "agent-role";
1938 /**
1939   * <b>Fluent Client</b> search parameter constant for <b>agent-role</b>
1940   * <p>
1941   * Description: <b>What the agents role was</b><br>
1942   * Type: <b>token</b><br>
1943   * Path: <b>Provenance.agent.role</b><br>
1944   * </p>
1945   */
1946  public static final ca.uhn.fhir.rest.gclient.TokenClientParam AGENT_ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_AGENT_ROLE);
1947
1948 /**
1949   * Search parameter: <b>when</b>
1950   * <p>
1951   * Description: <b>When the activity occurred</b><br>
1952   * Type: <b>date</b><br>
1953   * Path: <b>Provenance.occurredDateTime</b><br>
1954   * </p>
1955   */
1956  @SearchParamDefinition(name="when", path="(Provenance.occurred as dateTime)", description="When the activity occurred", type="date" )
1957  public static final String SP_WHEN = "when";
1958 /**
1959   * <b>Fluent Client</b> search parameter constant for <b>when</b>
1960   * <p>
1961   * Description: <b>When the activity occurred</b><br>
1962   * Type: <b>date</b><br>
1963   * Path: <b>Provenance.occurredDateTime</b><br>
1964   * </p>
1965   */
1966  public static final ca.uhn.fhir.rest.gclient.DateClientParam WHEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHEN);
1967
1968 /**
1969   * Search parameter: <b>entity</b>
1970   * <p>
1971   * Description: <b>Identity of entity</b><br>
1972   * Type: <b>reference</b><br>
1973   * Path: <b>Provenance.entity.what</b><br>
1974   * </p>
1975   */
1976  @SearchParamDefinition(name="entity", path="Provenance.entity.what", description="Identity of entity", type="reference" )
1977  public static final String SP_ENTITY = "entity";
1978 /**
1979   * <b>Fluent Client</b> search parameter constant for <b>entity</b>
1980   * <p>
1981   * Description: <b>Identity of entity</b><br>
1982   * Type: <b>reference</b><br>
1983   * Path: <b>Provenance.entity.what</b><br>
1984   * </p>
1985   */
1986  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTITY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTITY);
1987
1988/**
1989   * Constant for fluent queries to be used to add include statements. Specifies
1990   * the path value of "<b>Provenance:entity</b>".
1991   */
1992  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTITY = new ca.uhn.fhir.model.api.Include("Provenance:entity").toLocked();
1993
1994 /**
1995   * Search parameter: <b>target</b>
1996   * <p>
1997   * Description: <b>Target Reference(s) (usually version specific)</b><br>
1998   * Type: <b>reference</b><br>
1999   * Path: <b>Provenance.target</b><br>
2000   * </p>
2001   */
2002  @SearchParamDefinition(name="target", path="Provenance.target", description="Target Reference(s) (usually version specific)", type="reference" )
2003  public static final String SP_TARGET = "target";
2004 /**
2005   * <b>Fluent Client</b> search parameter constant for <b>target</b>
2006   * <p>
2007   * Description: <b>Target Reference(s) (usually version specific)</b><br>
2008   * Type: <b>reference</b><br>
2009   * Path: <b>Provenance.target</b><br>
2010   * </p>
2011   */
2012  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TARGET);
2013
2014/**
2015   * Constant for fluent queries to be used to add include statements. Specifies
2016   * the path value of "<b>Provenance:target</b>".
2017   */
2018  public static final ca.uhn.fhir.model.api.Include INCLUDE_TARGET = new ca.uhn.fhir.model.api.Include("Provenance:target").toLocked();
2019
2020
2021}