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