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