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