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