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