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