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