001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 045import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 046import org.hl7.fhir.exceptions.FHIRException; 047import org.hl7.fhir.utilities.Utilities; 048/** 049 * 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. 050 */ 051@ResourceDef(name="Provenance", profile="http://hl7.org/fhir/Profile/Provenance") 052public class Provenance extends DomainResource { 053 054 public enum ProvenanceEntityRole { 055 /** 056 * 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 preexisting entity. 057 */ 058 DERIVATION, 059 /** 060 * A derivation for which the resulting entity is a revised version of some original. 061 */ 062 REVISION, 063 /** 064 * The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author. 065 */ 066 QUOTATION, 067 /** 068 * 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. 069 */ 070 SOURCE, 071 /** 072 * added to help the parsers 073 */ 074 NULL; 075 public static ProvenanceEntityRole fromCode(String codeString) throws FHIRException { 076 if (codeString == null || "".equals(codeString)) 077 return null; 078 if ("derivation".equals(codeString)) 079 return DERIVATION; 080 if ("revision".equals(codeString)) 081 return REVISION; 082 if ("quotation".equals(codeString)) 083 return QUOTATION; 084 if ("source".equals(codeString)) 085 return SOURCE; 086 throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'"); 087 } 088 public String toCode() { 089 switch (this) { 090 case DERIVATION: return "derivation"; 091 case REVISION: return "revision"; 092 case QUOTATION: return "quotation"; 093 case SOURCE: return "source"; 094 case NULL: return null; 095 default: return "?"; 096 } 097 } 098 public String getSystem() { 099 switch (this) { 100 case DERIVATION: return "http://hl7.org/fhir/provenance-entity-role"; 101 case REVISION: return "http://hl7.org/fhir/provenance-entity-role"; 102 case QUOTATION: return "http://hl7.org/fhir/provenance-entity-role"; 103 case SOURCE: return "http://hl7.org/fhir/provenance-entity-role"; 104 case NULL: return null; 105 default: return "?"; 106 } 107 } 108 public String getDefinition() { 109 switch (this) { 110 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 preexisting entity."; 111 case REVISION: return "A derivation for which the resulting entity is a revised version of some original."; 112 case QUOTATION: return "The repeat of (some or all of) an entity, such as text or image, by someone who may or may not be its original author."; 113 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."; 114 case NULL: return null; 115 default: return "?"; 116 } 117 } 118 public String getDisplay() { 119 switch (this) { 120 case DERIVATION: return "Derivation"; 121 case REVISION: return "Revision"; 122 case QUOTATION: return "Quotation"; 123 case SOURCE: return "Source"; 124 case NULL: return null; 125 default: return "?"; 126 } 127 } 128 } 129 130 public static class ProvenanceEntityRoleEnumFactory implements EnumFactory<ProvenanceEntityRole> { 131 public ProvenanceEntityRole fromCode(String codeString) throws IllegalArgumentException { 132 if (codeString == null || "".equals(codeString)) 133 if (codeString == null || "".equals(codeString)) 134 return null; 135 if ("derivation".equals(codeString)) 136 return ProvenanceEntityRole.DERIVATION; 137 if ("revision".equals(codeString)) 138 return ProvenanceEntityRole.REVISION; 139 if ("quotation".equals(codeString)) 140 return ProvenanceEntityRole.QUOTATION; 141 if ("source".equals(codeString)) 142 return ProvenanceEntityRole.SOURCE; 143 throw new IllegalArgumentException("Unknown ProvenanceEntityRole code '"+codeString+"'"); 144 } 145 public Enumeration<ProvenanceEntityRole> fromType(Base code) throws FHIRException { 146 if (code == null || code.isEmpty()) 147 return null; 148 String codeString = ((PrimitiveType) code).asStringValue(); 149 if (codeString == null || "".equals(codeString)) 150 return null; 151 if ("derivation".equals(codeString)) 152 return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.DERIVATION); 153 if ("revision".equals(codeString)) 154 return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.REVISION); 155 if ("quotation".equals(codeString)) 156 return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.QUOTATION); 157 if ("source".equals(codeString)) 158 return new Enumeration<ProvenanceEntityRole>(this, ProvenanceEntityRole.SOURCE); 159 throw new FHIRException("Unknown ProvenanceEntityRole code '"+codeString+"'"); 160 } 161 public String toCode(ProvenanceEntityRole code) { 162 if (code == ProvenanceEntityRole.DERIVATION) 163 return "derivation"; 164 if (code == ProvenanceEntityRole.REVISION) 165 return "revision"; 166 if (code == ProvenanceEntityRole.QUOTATION) 167 return "quotation"; 168 if (code == ProvenanceEntityRole.SOURCE) 169 return "source"; 170 return "?"; 171 } 172 } 173 174 @Block() 175 public static class ProvenanceAgentComponent extends BackboneElement implements IBaseBackboneElement { 176 /** 177 * The function of the agent with respect to the activity. 178 */ 179 @Child(name = "role", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true) 180 @Description(shortDefinition="What the agents involvement was", formalDefinition="The function of the agent with respect to the activity." ) 181 protected Coding role; 182 183 /** 184 * The individual, device or organization that participated in the event. 185 */ 186 @Child(name = "actor", type = {Practitioner.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=2, min=0, max=1, modifier=false, summary=true) 187 @Description(shortDefinition="Individual, device or organization playing role", formalDefinition="The individual, device or organization that participated in the event." ) 188 protected Reference actor; 189 190 /** 191 * The actual object that is the target of the reference (The individual, device or organization that participated in the event.) 192 */ 193 protected Resource actorTarget; 194 195 /** 196 * The identity of the agent as known by the authorization system. 197 */ 198 @Child(name = "userId", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true) 199 @Description(shortDefinition="Authorization-system identifier for the agent", formalDefinition="The identity of the agent as known by the authorization system." ) 200 protected Identifier userId; 201 202 /** 203 * A relationship between two the agents referenced in this resource. This is defined to allow for explicit description of the delegation between agents. For example, this human author used this device, or one person acted on another's behest. 204 */ 205 @Child(name = "relatedAgent", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 206 @Description(shortDefinition="Track delegation between agents", formalDefinition="A relationship between two the agents referenced in this resource. This is defined to allow for explicit description of the delegation between agents. For example, this human author used this device, or one person acted on another's behest." ) 207 protected List<ProvenanceAgentRelatedAgentComponent> relatedAgent; 208 209 private static final long serialVersionUID = 1792758952L; 210 211 /* 212 * Constructor 213 */ 214 public ProvenanceAgentComponent() { 215 super(); 216 } 217 218 /* 219 * Constructor 220 */ 221 public ProvenanceAgentComponent(Coding role) { 222 super(); 223 this.role = role; 224 } 225 226 /** 227 * @return {@link #role} (The function of the agent with respect to the activity.) 228 */ 229 public Coding getRole() { 230 if (this.role == null) 231 if (Configuration.errorOnAutoCreate()) 232 throw new Error("Attempt to auto-create ProvenanceAgentComponent.role"); 233 else if (Configuration.doAutoCreate()) 234 this.role = new Coding(); // cc 235 return this.role; 236 } 237 238 public boolean hasRole() { 239 return this.role != null && !this.role.isEmpty(); 240 } 241 242 /** 243 * @param value {@link #role} (The function of the agent with respect to the activity.) 244 */ 245 public ProvenanceAgentComponent setRole(Coding value) { 246 this.role = value; 247 return this; 248 } 249 250 /** 251 * @return {@link #actor} (The individual, device or organization that participated in the event.) 252 */ 253 public Reference getActor() { 254 if (this.actor == null) 255 if (Configuration.errorOnAutoCreate()) 256 throw new Error("Attempt to auto-create ProvenanceAgentComponent.actor"); 257 else if (Configuration.doAutoCreate()) 258 this.actor = new Reference(); // cc 259 return this.actor; 260 } 261 262 public boolean hasActor() { 263 return this.actor != null && !this.actor.isEmpty(); 264 } 265 266 /** 267 * @param value {@link #actor} (The individual, device or organization that participated in the event.) 268 */ 269 public ProvenanceAgentComponent setActor(Reference value) { 270 this.actor = value; 271 return this; 272 } 273 274 /** 275 * @return {@link #actor} 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.) 276 */ 277 public Resource getActorTarget() { 278 return this.actorTarget; 279 } 280 281 /** 282 * @param value {@link #actor} 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.) 283 */ 284 public ProvenanceAgentComponent setActorTarget(Resource value) { 285 this.actorTarget = value; 286 return this; 287 } 288 289 /** 290 * @return {@link #userId} (The identity of the agent as known by the authorization system.) 291 */ 292 public Identifier getUserId() { 293 if (this.userId == null) 294 if (Configuration.errorOnAutoCreate()) 295 throw new Error("Attempt to auto-create ProvenanceAgentComponent.userId"); 296 else if (Configuration.doAutoCreate()) 297 this.userId = new Identifier(); // cc 298 return this.userId; 299 } 300 301 public boolean hasUserId() { 302 return this.userId != null && !this.userId.isEmpty(); 303 } 304 305 /** 306 * @param value {@link #userId} (The identity of the agent as known by the authorization system.) 307 */ 308 public ProvenanceAgentComponent setUserId(Identifier value) { 309 this.userId = value; 310 return this; 311 } 312 313 /** 314 * @return {@link #relatedAgent} (A relationship between two the agents referenced in this resource. This is defined to allow for explicit description of the delegation between agents. For example, this human author used this device, or one person acted on another's behest.) 315 */ 316 public List<ProvenanceAgentRelatedAgentComponent> getRelatedAgent() { 317 if (this.relatedAgent == null) 318 this.relatedAgent = new ArrayList<ProvenanceAgentRelatedAgentComponent>(); 319 return this.relatedAgent; 320 } 321 322 public boolean hasRelatedAgent() { 323 if (this.relatedAgent == null) 324 return false; 325 for (ProvenanceAgentRelatedAgentComponent item : this.relatedAgent) 326 if (!item.isEmpty()) 327 return true; 328 return false; 329 } 330 331 /** 332 * @return {@link #relatedAgent} (A relationship between two the agents referenced in this resource. This is defined to allow for explicit description of the delegation between agents. For example, this human author used this device, or one person acted on another's behest.) 333 */ 334 // syntactic sugar 335 public ProvenanceAgentRelatedAgentComponent addRelatedAgent() { //3 336 ProvenanceAgentRelatedAgentComponent t = new ProvenanceAgentRelatedAgentComponent(); 337 if (this.relatedAgent == null) 338 this.relatedAgent = new ArrayList<ProvenanceAgentRelatedAgentComponent>(); 339 this.relatedAgent.add(t); 340 return t; 341 } 342 343 // syntactic sugar 344 public ProvenanceAgentComponent addRelatedAgent(ProvenanceAgentRelatedAgentComponent t) { //3 345 if (t == null) 346 return this; 347 if (this.relatedAgent == null) 348 this.relatedAgent = new ArrayList<ProvenanceAgentRelatedAgentComponent>(); 349 this.relatedAgent.add(t); 350 return this; 351 } 352 353 protected void listChildren(List<Property> childrenList) { 354 super.listChildren(childrenList); 355 childrenList.add(new Property("role", "Coding", "The function of the agent with respect to the activity.", 0, java.lang.Integer.MAX_VALUE, role)); 356 childrenList.add(new Property("actor", "Reference(Practitioner|RelatedPerson|Patient|Device|Organization)", "The individual, device or organization that participated in the event.", 0, java.lang.Integer.MAX_VALUE, actor)); 357 childrenList.add(new Property("userId", "Identifier", "The identity of the agent as known by the authorization system.", 0, java.lang.Integer.MAX_VALUE, userId)); 358 childrenList.add(new Property("relatedAgent", "", "A relationship between two the agents referenced in this resource. This is defined to allow for explicit description of the delegation between agents. For example, this human author used this device, or one person acted on another's behest.", 0, java.lang.Integer.MAX_VALUE, relatedAgent)); 359 } 360 361 @Override 362 public void setProperty(String name, Base value) throws FHIRException { 363 if (name.equals("role")) 364 this.role = castToCoding(value); // Coding 365 else if (name.equals("actor")) 366 this.actor = castToReference(value); // Reference 367 else if (name.equals("userId")) 368 this.userId = castToIdentifier(value); // Identifier 369 else if (name.equals("relatedAgent")) 370 this.getRelatedAgent().add((ProvenanceAgentRelatedAgentComponent) value); 371 else 372 super.setProperty(name, value); 373 } 374 375 @Override 376 public Base addChild(String name) throws FHIRException { 377 if (name.equals("role")) { 378 this.role = new Coding(); 379 return this.role; 380 } 381 else if (name.equals("actor")) { 382 this.actor = new Reference(); 383 return this.actor; 384 } 385 else if (name.equals("userId")) { 386 this.userId = new Identifier(); 387 return this.userId; 388 } 389 else if (name.equals("relatedAgent")) { 390 return addRelatedAgent(); 391 } 392 else 393 return super.addChild(name); 394 } 395 396 public ProvenanceAgentComponent copy() { 397 ProvenanceAgentComponent dst = new ProvenanceAgentComponent(); 398 copyValues(dst); 399 dst.role = role == null ? null : role.copy(); 400 dst.actor = actor == null ? null : actor.copy(); 401 dst.userId = userId == null ? null : userId.copy(); 402 if (relatedAgent != null) { 403 dst.relatedAgent = new ArrayList<ProvenanceAgentRelatedAgentComponent>(); 404 for (ProvenanceAgentRelatedAgentComponent i : relatedAgent) 405 dst.relatedAgent.add(i.copy()); 406 }; 407 return dst; 408 } 409 410 @Override 411 public boolean equalsDeep(Base other) { 412 if (!super.equalsDeep(other)) 413 return false; 414 if (!(other instanceof ProvenanceAgentComponent)) 415 return false; 416 ProvenanceAgentComponent o = (ProvenanceAgentComponent) other; 417 return compareDeep(role, o.role, true) && compareDeep(actor, o.actor, true) && compareDeep(userId, o.userId, true) 418 && compareDeep(relatedAgent, o.relatedAgent, true); 419 } 420 421 @Override 422 public boolean equalsShallow(Base other) { 423 if (!super.equalsShallow(other)) 424 return false; 425 if (!(other instanceof ProvenanceAgentComponent)) 426 return false; 427 ProvenanceAgentComponent o = (ProvenanceAgentComponent) other; 428 return true; 429 } 430 431 public boolean isEmpty() { 432 return super.isEmpty() && (role == null || role.isEmpty()) && (actor == null || actor.isEmpty()) 433 && (userId == null || userId.isEmpty()) && (relatedAgent == null || relatedAgent.isEmpty()) 434 ; 435 } 436 437 public String fhirType() { 438 return "Provenance.agent"; 439 440 } 441 442 } 443 444 @Block() 445 public static class ProvenanceAgentRelatedAgentComponent extends BackboneElement implements IBaseBackboneElement { 446 /** 447 * The type of relationship between agents. 448 */ 449 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 450 @Description(shortDefinition="Type of relationship between agents", formalDefinition="The type of relationship between agents." ) 451 protected CodeableConcept type; 452 453 /** 454 * An internal reference to another agent listed in this provenance by its identifier. 455 */ 456 @Child(name = "target", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 457 @Description(shortDefinition="Reference to other agent in this resource by identifier", formalDefinition="An internal reference to another agent listed in this provenance by its identifier." ) 458 protected UriType target; 459 460 private static final long serialVersionUID = 794181198L; 461 462 /* 463 * Constructor 464 */ 465 public ProvenanceAgentRelatedAgentComponent() { 466 super(); 467 } 468 469 /* 470 * Constructor 471 */ 472 public ProvenanceAgentRelatedAgentComponent(CodeableConcept type, UriType target) { 473 super(); 474 this.type = type; 475 this.target = target; 476 } 477 478 /** 479 * @return {@link #type} (The type of relationship between agents.) 480 */ 481 public CodeableConcept getType() { 482 if (this.type == null) 483 if (Configuration.errorOnAutoCreate()) 484 throw new Error("Attempt to auto-create ProvenanceAgentRelatedAgentComponent.type"); 485 else if (Configuration.doAutoCreate()) 486 this.type = new CodeableConcept(); // cc 487 return this.type; 488 } 489 490 public boolean hasType() { 491 return this.type != null && !this.type.isEmpty(); 492 } 493 494 /** 495 * @param value {@link #type} (The type of relationship between agents.) 496 */ 497 public ProvenanceAgentRelatedAgentComponent setType(CodeableConcept value) { 498 this.type = value; 499 return this; 500 } 501 502 /** 503 * @return {@link #target} (An internal reference to another agent listed in this provenance by its identifier.). This is the underlying object with id, value and extensions. The accessor "getTarget" gives direct access to the value 504 */ 505 public UriType getTargetElement() { 506 if (this.target == null) 507 if (Configuration.errorOnAutoCreate()) 508 throw new Error("Attempt to auto-create ProvenanceAgentRelatedAgentComponent.target"); 509 else if (Configuration.doAutoCreate()) 510 this.target = new UriType(); // bb 511 return this.target; 512 } 513 514 public boolean hasTargetElement() { 515 return this.target != null && !this.target.isEmpty(); 516 } 517 518 public boolean hasTarget() { 519 return this.target != null && !this.target.isEmpty(); 520 } 521 522 /** 523 * @param value {@link #target} (An internal reference to another agent listed in this provenance by its identifier.). This is the underlying object with id, value and extensions. The accessor "getTarget" gives direct access to the value 524 */ 525 public ProvenanceAgentRelatedAgentComponent setTargetElement(UriType value) { 526 this.target = value; 527 return this; 528 } 529 530 /** 531 * @return An internal reference to another agent listed in this provenance by its identifier. 532 */ 533 public String getTarget() { 534 return this.target == null ? null : this.target.getValue(); 535 } 536 537 /** 538 * @param value An internal reference to another agent listed in this provenance by its identifier. 539 */ 540 public ProvenanceAgentRelatedAgentComponent setTarget(String value) { 541 if (this.target == null) 542 this.target = new UriType(); 543 this.target.setValue(value); 544 return this; 545 } 546 547 protected void listChildren(List<Property> childrenList) { 548 super.listChildren(childrenList); 549 childrenList.add(new Property("type", "CodeableConcept", "The type of relationship between agents.", 0, java.lang.Integer.MAX_VALUE, type)); 550 childrenList.add(new Property("target", "uri", "An internal reference to another agent listed in this provenance by its identifier.", 0, java.lang.Integer.MAX_VALUE, target)); 551 } 552 553 @Override 554 public void setProperty(String name, Base value) throws FHIRException { 555 if (name.equals("type")) 556 this.type = castToCodeableConcept(value); // CodeableConcept 557 else if (name.equals("target")) 558 this.target = castToUri(value); // UriType 559 else 560 super.setProperty(name, value); 561 } 562 563 @Override 564 public Base addChild(String name) throws FHIRException { 565 if (name.equals("type")) { 566 this.type = new CodeableConcept(); 567 return this.type; 568 } 569 else if (name.equals("target")) { 570 throw new FHIRException("Cannot call addChild on a primitive type Provenance.target"); 571 } 572 else 573 return super.addChild(name); 574 } 575 576 public ProvenanceAgentRelatedAgentComponent copy() { 577 ProvenanceAgentRelatedAgentComponent dst = new ProvenanceAgentRelatedAgentComponent(); 578 copyValues(dst); 579 dst.type = type == null ? null : type.copy(); 580 dst.target = target == null ? null : target.copy(); 581 return dst; 582 } 583 584 @Override 585 public boolean equalsDeep(Base other) { 586 if (!super.equalsDeep(other)) 587 return false; 588 if (!(other instanceof ProvenanceAgentRelatedAgentComponent)) 589 return false; 590 ProvenanceAgentRelatedAgentComponent o = (ProvenanceAgentRelatedAgentComponent) other; 591 return compareDeep(type, o.type, true) && compareDeep(target, o.target, true); 592 } 593 594 @Override 595 public boolean equalsShallow(Base other) { 596 if (!super.equalsShallow(other)) 597 return false; 598 if (!(other instanceof ProvenanceAgentRelatedAgentComponent)) 599 return false; 600 ProvenanceAgentRelatedAgentComponent o = (ProvenanceAgentRelatedAgentComponent) other; 601 return compareValues(target, o.target, true); 602 } 603 604 public boolean isEmpty() { 605 return super.isEmpty() && (type == null || type.isEmpty()) && (target == null || target.isEmpty()) 606 ; 607 } 608 609 public String fhirType() { 610 return "Provenance.agent.relatedAgent"; 611 612 } 613 614 } 615 616 @Block() 617 public static class ProvenanceEntityComponent extends BackboneElement implements IBaseBackboneElement { 618 /** 619 * How the entity was used during the activity. 620 */ 621 @Child(name = "role", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 622 @Description(shortDefinition="derivation | revision | quotation | source", formalDefinition="How the entity was used during the activity." ) 623 protected Enumeration<ProvenanceEntityRole> role; 624 625 /** 626 * The type of the entity. If the entity is a resource, then this is a resource type. 627 */ 628 @Child(name = "type", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true) 629 @Description(shortDefinition="The type of resource in this entity", formalDefinition="The type of the entity. If the entity is a resource, then this is a resource type." ) 630 protected Coding type; 631 632 /** 633 * Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative. 634 */ 635 @Child(name = "reference", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=true) 636 @Description(shortDefinition="Identity of entity", formalDefinition="Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative." ) 637 protected UriType reference; 638 639 /** 640 * Human-readable description of the entity. 641 */ 642 @Child(name = "display", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 643 @Description(shortDefinition="Human description of entity", formalDefinition="Human-readable description of the entity." ) 644 protected StringType display; 645 646 /** 647 * 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. 648 */ 649 @Child(name = "agent", type = {ProvenanceAgentComponent.class}, order=5, min=0, max=1, modifier=false, summary=true) 650 @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." ) 651 protected ProvenanceAgentComponent agent; 652 653 private static final long serialVersionUID = 1533729633L; 654 655 /* 656 * Constructor 657 */ 658 public ProvenanceEntityComponent() { 659 super(); 660 } 661 662 /* 663 * Constructor 664 */ 665 public ProvenanceEntityComponent(Enumeration<ProvenanceEntityRole> role, Coding type, UriType reference) { 666 super(); 667 this.role = role; 668 this.type = type; 669 this.reference = reference; 670 } 671 672 /** 673 * @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 674 */ 675 public Enumeration<ProvenanceEntityRole> getRoleElement() { 676 if (this.role == null) 677 if (Configuration.errorOnAutoCreate()) 678 throw new Error("Attempt to auto-create ProvenanceEntityComponent.role"); 679 else if (Configuration.doAutoCreate()) 680 this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory()); // bb 681 return this.role; 682 } 683 684 public boolean hasRoleElement() { 685 return this.role != null && !this.role.isEmpty(); 686 } 687 688 public boolean hasRole() { 689 return this.role != null && !this.role.isEmpty(); 690 } 691 692 /** 693 * @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 694 */ 695 public ProvenanceEntityComponent setRoleElement(Enumeration<ProvenanceEntityRole> value) { 696 this.role = value; 697 return this; 698 } 699 700 /** 701 * @return How the entity was used during the activity. 702 */ 703 public ProvenanceEntityRole getRole() { 704 return this.role == null ? null : this.role.getValue(); 705 } 706 707 /** 708 * @param value How the entity was used during the activity. 709 */ 710 public ProvenanceEntityComponent setRole(ProvenanceEntityRole value) { 711 if (this.role == null) 712 this.role = new Enumeration<ProvenanceEntityRole>(new ProvenanceEntityRoleEnumFactory()); 713 this.role.setValue(value); 714 return this; 715 } 716 717 /** 718 * @return {@link #type} (The type of the entity. If the entity is a resource, then this is a resource type.) 719 */ 720 public Coding getType() { 721 if (this.type == null) 722 if (Configuration.errorOnAutoCreate()) 723 throw new Error("Attempt to auto-create ProvenanceEntityComponent.type"); 724 else if (Configuration.doAutoCreate()) 725 this.type = new Coding(); // cc 726 return this.type; 727 } 728 729 public boolean hasType() { 730 return this.type != null && !this.type.isEmpty(); 731 } 732 733 /** 734 * @param value {@link #type} (The type of the entity. If the entity is a resource, then this is a resource type.) 735 */ 736 public ProvenanceEntityComponent setType(Coding value) { 737 this.type = value; 738 return this; 739 } 740 741 /** 742 * @return {@link #reference} (Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 743 */ 744 public UriType getReferenceElement() { 745 if (this.reference == null) 746 if (Configuration.errorOnAutoCreate()) 747 throw new Error("Attempt to auto-create ProvenanceEntityComponent.reference"); 748 else if (Configuration.doAutoCreate()) 749 this.reference = new UriType(); // bb 750 return this.reference; 751 } 752 753 public boolean hasReferenceElement() { 754 return this.reference != null && !this.reference.isEmpty(); 755 } 756 757 public boolean hasReference() { 758 return this.reference != null && !this.reference.isEmpty(); 759 } 760 761 /** 762 * @param value {@link #reference} (Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 763 */ 764 public ProvenanceEntityComponent setReferenceElement(UriType value) { 765 this.reference = value; 766 return this; 767 } 768 769 /** 770 * @return Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative. 771 */ 772 public String getReference() { 773 return this.reference == null ? null : this.reference.getValue(); 774 } 775 776 /** 777 * @param value Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative. 778 */ 779 public ProvenanceEntityComponent setReference(String value) { 780 if (this.reference == null) 781 this.reference = new UriType(); 782 this.reference.setValue(value); 783 return this; 784 } 785 786 /** 787 * @return {@link #display} (Human-readable description of the entity.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value 788 */ 789 public StringType getDisplayElement() { 790 if (this.display == null) 791 if (Configuration.errorOnAutoCreate()) 792 throw new Error("Attempt to auto-create ProvenanceEntityComponent.display"); 793 else if (Configuration.doAutoCreate()) 794 this.display = new StringType(); // bb 795 return this.display; 796 } 797 798 public boolean hasDisplayElement() { 799 return this.display != null && !this.display.isEmpty(); 800 } 801 802 public boolean hasDisplay() { 803 return this.display != null && !this.display.isEmpty(); 804 } 805 806 /** 807 * @param value {@link #display} (Human-readable description of the entity.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value 808 */ 809 public ProvenanceEntityComponent setDisplayElement(StringType value) { 810 this.display = value; 811 return this; 812 } 813 814 /** 815 * @return Human-readable description of the entity. 816 */ 817 public String getDisplay() { 818 return this.display == null ? null : this.display.getValue(); 819 } 820 821 /** 822 * @param value Human-readable description of the entity. 823 */ 824 public ProvenanceEntityComponent setDisplay(String value) { 825 if (Utilities.noString(value)) 826 this.display = null; 827 else { 828 if (this.display == null) 829 this.display = new StringType(); 830 this.display.setValue(value); 831 } 832 return this; 833 } 834 835 /** 836 * @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.) 837 */ 838 public ProvenanceAgentComponent getAgent() { 839 if (this.agent == null) 840 if (Configuration.errorOnAutoCreate()) 841 throw new Error("Attempt to auto-create ProvenanceEntityComponent.agent"); 842 else if (Configuration.doAutoCreate()) 843 this.agent = new ProvenanceAgentComponent(); // cc 844 return this.agent; 845 } 846 847 public boolean hasAgent() { 848 return this.agent != null && !this.agent.isEmpty(); 849 } 850 851 /** 852 * @param value {@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.) 853 */ 854 public ProvenanceEntityComponent setAgent(ProvenanceAgentComponent value) { 855 this.agent = value; 856 return this; 857 } 858 859 protected void listChildren(List<Property> childrenList) { 860 super.listChildren(childrenList); 861 childrenList.add(new Property("role", "code", "How the entity was used during the activity.", 0, java.lang.Integer.MAX_VALUE, role)); 862 childrenList.add(new Property("type", "Coding", "The type of the entity. If the entity is a resource, then this is a resource type.", 0, java.lang.Integer.MAX_VALUE, type)); 863 childrenList.add(new Property("reference", "uri", "Identity of the Entity used. May be a logical or physical uri and maybe absolute or relative.", 0, java.lang.Integer.MAX_VALUE, reference)); 864 childrenList.add(new Property("display", "string", "Human-readable description of the entity.", 0, java.lang.Integer.MAX_VALUE, display)); 865 childrenList.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)); 866 } 867 868 @Override 869 public void setProperty(String name, Base value) throws FHIRException { 870 if (name.equals("role")) 871 this.role = new ProvenanceEntityRoleEnumFactory().fromType(value); // Enumeration<ProvenanceEntityRole> 872 else if (name.equals("type")) 873 this.type = castToCoding(value); // Coding 874 else if (name.equals("reference")) 875 this.reference = castToUri(value); // UriType 876 else if (name.equals("display")) 877 this.display = castToString(value); // StringType 878 else if (name.equals("agent")) 879 this.agent = (ProvenanceAgentComponent) value; // ProvenanceAgentComponent 880 else 881 super.setProperty(name, value); 882 } 883 884 @Override 885 public Base addChild(String name) throws FHIRException { 886 if (name.equals("role")) { 887 throw new FHIRException("Cannot call addChild on a primitive type Provenance.role"); 888 } 889 else if (name.equals("type")) { 890 this.type = new Coding(); 891 return this.type; 892 } 893 else if (name.equals("reference")) { 894 throw new FHIRException("Cannot call addChild on a primitive type Provenance.reference"); 895 } 896 else if (name.equals("display")) { 897 throw new FHIRException("Cannot call addChild on a primitive type Provenance.display"); 898 } 899 else if (name.equals("agent")) { 900 this.agent = new ProvenanceAgentComponent(); 901 return this.agent; 902 } 903 else 904 return super.addChild(name); 905 } 906 907 public ProvenanceEntityComponent copy() { 908 ProvenanceEntityComponent dst = new ProvenanceEntityComponent(); 909 copyValues(dst); 910 dst.role = role == null ? null : role.copy(); 911 dst.type = type == null ? null : type.copy(); 912 dst.reference = reference == null ? null : reference.copy(); 913 dst.display = display == null ? null : display.copy(); 914 dst.agent = agent == null ? null : agent.copy(); 915 return dst; 916 } 917 918 @Override 919 public boolean equalsDeep(Base other) { 920 if (!super.equalsDeep(other)) 921 return false; 922 if (!(other instanceof ProvenanceEntityComponent)) 923 return false; 924 ProvenanceEntityComponent o = (ProvenanceEntityComponent) other; 925 return compareDeep(role, o.role, true) && compareDeep(type, o.type, true) && compareDeep(reference, o.reference, true) 926 && compareDeep(display, o.display, true) && compareDeep(agent, o.agent, true); 927 } 928 929 @Override 930 public boolean equalsShallow(Base other) { 931 if (!super.equalsShallow(other)) 932 return false; 933 if (!(other instanceof ProvenanceEntityComponent)) 934 return false; 935 ProvenanceEntityComponent o = (ProvenanceEntityComponent) other; 936 return compareValues(role, o.role, true) && compareValues(reference, o.reference, true) && compareValues(display, o.display, true) 937 ; 938 } 939 940 public boolean isEmpty() { 941 return super.isEmpty() && (role == null || role.isEmpty()) && (type == null || type.isEmpty()) 942 && (reference == null || reference.isEmpty()) && (display == null || display.isEmpty()) && (agent == null || agent.isEmpty()) 943 ; 944 } 945 946 public String fhirType() { 947 return "Provenance.entity"; 948 949 } 950 951 } 952 953 /** 954 * 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. 955 */ 956 @Child(name = "target", type = {}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 957 @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." ) 958 protected List<Reference> target; 959 /** 960 * 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.) 961 */ 962 protected List<Resource> targetTarget; 963 964 965 /** 966 * The period during which the activity occurred. 967 */ 968 @Child(name = "period", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 969 @Description(shortDefinition="When the activity occurred", formalDefinition="The period during which the activity occurred." ) 970 protected Period period; 971 972 /** 973 * The instant of time at which the activity was recorded. 974 */ 975 @Child(name = "recorded", type = {InstantType.class}, order=2, min=1, max=1, modifier=false, summary=true) 976 @Description(shortDefinition="When the activity was recorded / updated", formalDefinition="The instant of time at which the activity was recorded." ) 977 protected InstantType recorded; 978 979 /** 980 * The reason that the activity was taking place. 981 */ 982 @Child(name = "reason", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 983 @Description(shortDefinition="Reason the activity is occurring", formalDefinition="The reason that the activity was taking place." ) 984 protected List<CodeableConcept> reason; 985 986 /** 987 * 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. 988 */ 989 @Child(name = "activity", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 990 @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." ) 991 protected CodeableConcept activity; 992 993 /** 994 * Where the activity occurred, if relevant. 995 */ 996 @Child(name = "location", type = {Location.class}, order=5, min=0, max=1, modifier=false, summary=true) 997 @Description(shortDefinition="Where the activity occurred, if relevant", formalDefinition="Where the activity occurred, if relevant." ) 998 protected Reference location; 999 1000 /** 1001 * The actual object that is the target of the reference (Where the activity occurred, if relevant.) 1002 */ 1003 protected Location locationTarget; 1004 1005 /** 1006 * 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. 1007 */ 1008 @Child(name = "policy", type = {UriType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1009 @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." ) 1010 protected List<UriType> policy; 1011 1012 /** 1013 * An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed responsibility. 1014 */ 1015 @Child(name = "agent", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1016 @Description(shortDefinition="Agents involved in creating resource", formalDefinition="An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed responsibility." ) 1017 protected List<ProvenanceAgentComponent> agent; 1018 1019 /** 1020 * An entity used in this activity. 1021 */ 1022 @Child(name = "entity", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1023 @Description(shortDefinition="An entity used in this activity", formalDefinition="An entity used in this activity." ) 1024 protected List<ProvenanceEntityComponent> entity; 1025 1026 /** 1027 * A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated. 1028 */ 1029 @Child(name = "signature", type = {Signature.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1030 @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." ) 1031 protected List<Signature> signature; 1032 1033 private static final long serialVersionUID = -1053458671L; 1034 1035 /* 1036 * Constructor 1037 */ 1038 public Provenance() { 1039 super(); 1040 } 1041 1042 /* 1043 * Constructor 1044 */ 1045 public Provenance(InstantType recorded) { 1046 super(); 1047 this.recorded = recorded; 1048 } 1049 1050 /** 1051 * @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.) 1052 */ 1053 public List<Reference> getTarget() { 1054 if (this.target == null) 1055 this.target = new ArrayList<Reference>(); 1056 return this.target; 1057 } 1058 1059 public boolean hasTarget() { 1060 if (this.target == null) 1061 return false; 1062 for (Reference item : this.target) 1063 if (!item.isEmpty()) 1064 return true; 1065 return false; 1066 } 1067 1068 /** 1069 * @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.) 1070 */ 1071 // syntactic sugar 1072 public Reference addTarget() { //3 1073 Reference t = new Reference(); 1074 if (this.target == null) 1075 this.target = new ArrayList<Reference>(); 1076 this.target.add(t); 1077 return t; 1078 } 1079 1080 // syntactic sugar 1081 public Provenance addTarget(Reference t) { //3 1082 if (t == null) 1083 return this; 1084 if (this.target == null) 1085 this.target = new ArrayList<Reference>(); 1086 this.target.add(t); 1087 return this; 1088 } 1089 1090 /** 1091 * @return {@link #target} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. 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.) 1092 */ 1093 public List<Resource> getTargetTarget() { 1094 if (this.targetTarget == null) 1095 this.targetTarget = new ArrayList<Resource>(); 1096 return this.targetTarget; 1097 } 1098 1099 /** 1100 * @return {@link #period} (The period during which the activity occurred.) 1101 */ 1102 public Period getPeriod() { 1103 if (this.period == null) 1104 if (Configuration.errorOnAutoCreate()) 1105 throw new Error("Attempt to auto-create Provenance.period"); 1106 else if (Configuration.doAutoCreate()) 1107 this.period = new Period(); // cc 1108 return this.period; 1109 } 1110 1111 public boolean hasPeriod() { 1112 return this.period != null && !this.period.isEmpty(); 1113 } 1114 1115 /** 1116 * @param value {@link #period} (The period during which the activity occurred.) 1117 */ 1118 public Provenance setPeriod(Period value) { 1119 this.period = value; 1120 return this; 1121 } 1122 1123 /** 1124 * @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 1125 */ 1126 public InstantType getRecordedElement() { 1127 if (this.recorded == null) 1128 if (Configuration.errorOnAutoCreate()) 1129 throw new Error("Attempt to auto-create Provenance.recorded"); 1130 else if (Configuration.doAutoCreate()) 1131 this.recorded = new InstantType(); // bb 1132 return this.recorded; 1133 } 1134 1135 public boolean hasRecordedElement() { 1136 return this.recorded != null && !this.recorded.isEmpty(); 1137 } 1138 1139 public boolean hasRecorded() { 1140 return this.recorded != null && !this.recorded.isEmpty(); 1141 } 1142 1143 /** 1144 * @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 1145 */ 1146 public Provenance setRecordedElement(InstantType value) { 1147 this.recorded = value; 1148 return this; 1149 } 1150 1151 /** 1152 * @return The instant of time at which the activity was recorded. 1153 */ 1154 public Date getRecorded() { 1155 return this.recorded == null ? null : this.recorded.getValue(); 1156 } 1157 1158 /** 1159 * @param value The instant of time at which the activity was recorded. 1160 */ 1161 public Provenance setRecorded(Date value) { 1162 if (this.recorded == null) 1163 this.recorded = new InstantType(); 1164 this.recorded.setValue(value); 1165 return this; 1166 } 1167 1168 /** 1169 * @return {@link #reason} (The reason that the activity was taking place.) 1170 */ 1171 public List<CodeableConcept> getReason() { 1172 if (this.reason == null) 1173 this.reason = new ArrayList<CodeableConcept>(); 1174 return this.reason; 1175 } 1176 1177 public boolean hasReason() { 1178 if (this.reason == null) 1179 return false; 1180 for (CodeableConcept item : this.reason) 1181 if (!item.isEmpty()) 1182 return true; 1183 return false; 1184 } 1185 1186 /** 1187 * @return {@link #reason} (The reason that the activity was taking place.) 1188 */ 1189 // syntactic sugar 1190 public CodeableConcept addReason() { //3 1191 CodeableConcept t = new CodeableConcept(); 1192 if (this.reason == null) 1193 this.reason = new ArrayList<CodeableConcept>(); 1194 this.reason.add(t); 1195 return t; 1196 } 1197 1198 // syntactic sugar 1199 public Provenance addReason(CodeableConcept t) { //3 1200 if (t == null) 1201 return this; 1202 if (this.reason == null) 1203 this.reason = new ArrayList<CodeableConcept>(); 1204 this.reason.add(t); 1205 return this; 1206 } 1207 1208 /** 1209 * @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.) 1210 */ 1211 public CodeableConcept getActivity() { 1212 if (this.activity == null) 1213 if (Configuration.errorOnAutoCreate()) 1214 throw new Error("Attempt to auto-create Provenance.activity"); 1215 else if (Configuration.doAutoCreate()) 1216 this.activity = new CodeableConcept(); // cc 1217 return this.activity; 1218 } 1219 1220 public boolean hasActivity() { 1221 return this.activity != null && !this.activity.isEmpty(); 1222 } 1223 1224 /** 1225 * @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.) 1226 */ 1227 public Provenance setActivity(CodeableConcept value) { 1228 this.activity = value; 1229 return this; 1230 } 1231 1232 /** 1233 * @return {@link #location} (Where the activity occurred, if relevant.) 1234 */ 1235 public Reference getLocation() { 1236 if (this.location == null) 1237 if (Configuration.errorOnAutoCreate()) 1238 throw new Error("Attempt to auto-create Provenance.location"); 1239 else if (Configuration.doAutoCreate()) 1240 this.location = new Reference(); // cc 1241 return this.location; 1242 } 1243 1244 public boolean hasLocation() { 1245 return this.location != null && !this.location.isEmpty(); 1246 } 1247 1248 /** 1249 * @param value {@link #location} (Where the activity occurred, if relevant.) 1250 */ 1251 public Provenance setLocation(Reference value) { 1252 this.location = value; 1253 return this; 1254 } 1255 1256 /** 1257 * @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.) 1258 */ 1259 public Location getLocationTarget() { 1260 if (this.locationTarget == null) 1261 if (Configuration.errorOnAutoCreate()) 1262 throw new Error("Attempt to auto-create Provenance.location"); 1263 else if (Configuration.doAutoCreate()) 1264 this.locationTarget = new Location(); // aa 1265 return this.locationTarget; 1266 } 1267 1268 /** 1269 * @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.) 1270 */ 1271 public Provenance setLocationTarget(Location value) { 1272 this.locationTarget = value; 1273 return this; 1274 } 1275 1276 /** 1277 * @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.) 1278 */ 1279 public List<UriType> getPolicy() { 1280 if (this.policy == null) 1281 this.policy = new ArrayList<UriType>(); 1282 return this.policy; 1283 } 1284 1285 public boolean hasPolicy() { 1286 if (this.policy == null) 1287 return false; 1288 for (UriType item : this.policy) 1289 if (!item.isEmpty()) 1290 return true; 1291 return false; 1292 } 1293 1294 /** 1295 * @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.) 1296 */ 1297 // syntactic sugar 1298 public UriType addPolicyElement() {//2 1299 UriType t = new UriType(); 1300 if (this.policy == null) 1301 this.policy = new ArrayList<UriType>(); 1302 this.policy.add(t); 1303 return t; 1304 } 1305 1306 /** 1307 * @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.) 1308 */ 1309 public Provenance addPolicy(String value) { //1 1310 UriType t = new UriType(); 1311 t.setValue(value); 1312 if (this.policy == null) 1313 this.policy = new ArrayList<UriType>(); 1314 this.policy.add(t); 1315 return this; 1316 } 1317 1318 /** 1319 * @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.) 1320 */ 1321 public boolean hasPolicy(String value) { 1322 if (this.policy == null) 1323 return false; 1324 for (UriType v : this.policy) 1325 if (v.equals(value)) // uri 1326 return true; 1327 return false; 1328 } 1329 1330 /** 1331 * @return {@link #agent} (An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed responsibility.) 1332 */ 1333 public List<ProvenanceAgentComponent> getAgent() { 1334 if (this.agent == null) 1335 this.agent = new ArrayList<ProvenanceAgentComponent>(); 1336 return this.agent; 1337 } 1338 1339 public boolean hasAgent() { 1340 if (this.agent == null) 1341 return false; 1342 for (ProvenanceAgentComponent item : this.agent) 1343 if (!item.isEmpty()) 1344 return true; 1345 return false; 1346 } 1347 1348 /** 1349 * @return {@link #agent} (An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed responsibility.) 1350 */ 1351 // syntactic sugar 1352 public ProvenanceAgentComponent addAgent() { //3 1353 ProvenanceAgentComponent t = new ProvenanceAgentComponent(); 1354 if (this.agent == null) 1355 this.agent = new ArrayList<ProvenanceAgentComponent>(); 1356 this.agent.add(t); 1357 return t; 1358 } 1359 1360 // syntactic sugar 1361 public Provenance addAgent(ProvenanceAgentComponent t) { //3 1362 if (t == null) 1363 return this; 1364 if (this.agent == null) 1365 this.agent = new ArrayList<ProvenanceAgentComponent>(); 1366 this.agent.add(t); 1367 return this; 1368 } 1369 1370 /** 1371 * @return {@link #entity} (An entity used in this activity.) 1372 */ 1373 public List<ProvenanceEntityComponent> getEntity() { 1374 if (this.entity == null) 1375 this.entity = new ArrayList<ProvenanceEntityComponent>(); 1376 return this.entity; 1377 } 1378 1379 public boolean hasEntity() { 1380 if (this.entity == null) 1381 return false; 1382 for (ProvenanceEntityComponent item : this.entity) 1383 if (!item.isEmpty()) 1384 return true; 1385 return false; 1386 } 1387 1388 /** 1389 * @return {@link #entity} (An entity used in this activity.) 1390 */ 1391 // syntactic sugar 1392 public ProvenanceEntityComponent addEntity() { //3 1393 ProvenanceEntityComponent t = new ProvenanceEntityComponent(); 1394 if (this.entity == null) 1395 this.entity = new ArrayList<ProvenanceEntityComponent>(); 1396 this.entity.add(t); 1397 return t; 1398 } 1399 1400 // syntactic sugar 1401 public Provenance addEntity(ProvenanceEntityComponent t) { //3 1402 if (t == null) 1403 return this; 1404 if (this.entity == null) 1405 this.entity = new ArrayList<ProvenanceEntityComponent>(); 1406 this.entity.add(t); 1407 return this; 1408 } 1409 1410 /** 1411 * @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.) 1412 */ 1413 public List<Signature> getSignature() { 1414 if (this.signature == null) 1415 this.signature = new ArrayList<Signature>(); 1416 return this.signature; 1417 } 1418 1419 public boolean hasSignature() { 1420 if (this.signature == null) 1421 return false; 1422 for (Signature item : this.signature) 1423 if (!item.isEmpty()) 1424 return true; 1425 return false; 1426 } 1427 1428 /** 1429 * @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.) 1430 */ 1431 // syntactic sugar 1432 public Signature addSignature() { //3 1433 Signature t = new Signature(); 1434 if (this.signature == null) 1435 this.signature = new ArrayList<Signature>(); 1436 this.signature.add(t); 1437 return t; 1438 } 1439 1440 // syntactic sugar 1441 public Provenance addSignature(Signature t) { //3 1442 if (t == null) 1443 return this; 1444 if (this.signature == null) 1445 this.signature = new ArrayList<Signature>(); 1446 this.signature.add(t); 1447 return this; 1448 } 1449 1450 protected void listChildren(List<Property> childrenList) { 1451 super.listChildren(childrenList); 1452 childrenList.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)); 1453 childrenList.add(new Property("period", "Period", "The period during which the activity occurred.", 0, java.lang.Integer.MAX_VALUE, period)); 1454 childrenList.add(new Property("recorded", "instant", "The instant of time at which the activity was recorded.", 0, java.lang.Integer.MAX_VALUE, recorded)); 1455 childrenList.add(new Property("reason", "CodeableConcept", "The reason that the activity was taking place.", 0, java.lang.Integer.MAX_VALUE, reason)); 1456 childrenList.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, java.lang.Integer.MAX_VALUE, activity)); 1457 childrenList.add(new Property("location", "Reference(Location)", "Where the activity occurred, if relevant.", 0, java.lang.Integer.MAX_VALUE, location)); 1458 childrenList.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)); 1459 childrenList.add(new Property("agent", "", "An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed responsibility.", 0, java.lang.Integer.MAX_VALUE, agent)); 1460 childrenList.add(new Property("entity", "", "An entity used in this activity.", 0, java.lang.Integer.MAX_VALUE, entity)); 1461 childrenList.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)); 1462 } 1463 1464 @Override 1465 public void setProperty(String name, Base value) throws FHIRException { 1466 if (name.equals("target")) 1467 this.getTarget().add(castToReference(value)); 1468 else if (name.equals("period")) 1469 this.period = castToPeriod(value); // Period 1470 else if (name.equals("recorded")) 1471 this.recorded = castToInstant(value); // InstantType 1472 else if (name.equals("reason")) 1473 this.getReason().add(castToCodeableConcept(value)); 1474 else if (name.equals("activity")) 1475 this.activity = castToCodeableConcept(value); // CodeableConcept 1476 else if (name.equals("location")) 1477 this.location = castToReference(value); // Reference 1478 else if (name.equals("policy")) 1479 this.getPolicy().add(castToUri(value)); 1480 else if (name.equals("agent")) 1481 this.getAgent().add((ProvenanceAgentComponent) value); 1482 else if (name.equals("entity")) 1483 this.getEntity().add((ProvenanceEntityComponent) value); 1484 else if (name.equals("signature")) 1485 this.getSignature().add(castToSignature(value)); 1486 else 1487 super.setProperty(name, value); 1488 } 1489 1490 @Override 1491 public Base addChild(String name) throws FHIRException { 1492 if (name.equals("target")) { 1493 return addTarget(); 1494 } 1495 else if (name.equals("period")) { 1496 this.period = new Period(); 1497 return this.period; 1498 } 1499 else if (name.equals("recorded")) { 1500 throw new FHIRException("Cannot call addChild on a primitive type Provenance.recorded"); 1501 } 1502 else if (name.equals("reason")) { 1503 return addReason(); 1504 } 1505 else if (name.equals("activity")) { 1506 this.activity = new CodeableConcept(); 1507 return this.activity; 1508 } 1509 else if (name.equals("location")) { 1510 this.location = new Reference(); 1511 return this.location; 1512 } 1513 else if (name.equals("policy")) { 1514 throw new FHIRException("Cannot call addChild on a primitive type Provenance.policy"); 1515 } 1516 else if (name.equals("agent")) { 1517 return addAgent(); 1518 } 1519 else if (name.equals("entity")) { 1520 return addEntity(); 1521 } 1522 else if (name.equals("signature")) { 1523 return addSignature(); 1524 } 1525 else 1526 return super.addChild(name); 1527 } 1528 1529 public String fhirType() { 1530 return "Provenance"; 1531 1532 } 1533 1534 public Provenance copy() { 1535 Provenance dst = new Provenance(); 1536 copyValues(dst); 1537 if (target != null) { 1538 dst.target = new ArrayList<Reference>(); 1539 for (Reference i : target) 1540 dst.target.add(i.copy()); 1541 }; 1542 dst.period = period == null ? null : period.copy(); 1543 dst.recorded = recorded == null ? null : recorded.copy(); 1544 if (reason != null) { 1545 dst.reason = new ArrayList<CodeableConcept>(); 1546 for (CodeableConcept i : reason) 1547 dst.reason.add(i.copy()); 1548 }; 1549 dst.activity = activity == null ? null : activity.copy(); 1550 dst.location = location == null ? null : location.copy(); 1551 if (policy != null) { 1552 dst.policy = new ArrayList<UriType>(); 1553 for (UriType i : policy) 1554 dst.policy.add(i.copy()); 1555 }; 1556 if (agent != null) { 1557 dst.agent = new ArrayList<ProvenanceAgentComponent>(); 1558 for (ProvenanceAgentComponent i : agent) 1559 dst.agent.add(i.copy()); 1560 }; 1561 if (entity != null) { 1562 dst.entity = new ArrayList<ProvenanceEntityComponent>(); 1563 for (ProvenanceEntityComponent i : entity) 1564 dst.entity.add(i.copy()); 1565 }; 1566 if (signature != null) { 1567 dst.signature = new ArrayList<Signature>(); 1568 for (Signature i : signature) 1569 dst.signature.add(i.copy()); 1570 }; 1571 return dst; 1572 } 1573 1574 protected Provenance typedCopy() { 1575 return copy(); 1576 } 1577 1578 @Override 1579 public boolean equalsDeep(Base other) { 1580 if (!super.equalsDeep(other)) 1581 return false; 1582 if (!(other instanceof Provenance)) 1583 return false; 1584 Provenance o = (Provenance) other; 1585 return compareDeep(target, o.target, true) && compareDeep(period, o.period, true) && compareDeep(recorded, o.recorded, true) 1586 && compareDeep(reason, o.reason, true) && compareDeep(activity, o.activity, true) && compareDeep(location, o.location, true) 1587 && compareDeep(policy, o.policy, true) && compareDeep(agent, o.agent, true) && compareDeep(entity, o.entity, true) 1588 && compareDeep(signature, o.signature, true); 1589 } 1590 1591 @Override 1592 public boolean equalsShallow(Base other) { 1593 if (!super.equalsShallow(other)) 1594 return false; 1595 if (!(other instanceof Provenance)) 1596 return false; 1597 Provenance o = (Provenance) other; 1598 return compareValues(recorded, o.recorded, true) && compareValues(policy, o.policy, true); 1599 } 1600 1601 public boolean isEmpty() { 1602 return super.isEmpty() && (target == null || target.isEmpty()) && (period == null || period.isEmpty()) 1603 && (recorded == null || recorded.isEmpty()) && (reason == null || reason.isEmpty()) && (activity == null || activity.isEmpty()) 1604 && (location == null || location.isEmpty()) && (policy == null || policy.isEmpty()) && (agent == null || agent.isEmpty()) 1605 && (entity == null || entity.isEmpty()) && (signature == null || signature.isEmpty()); 1606 } 1607 1608 @Override 1609 public ResourceType getResourceType() { 1610 return ResourceType.Provenance; 1611 } 1612 1613 @SearchParamDefinition(name="sigtype", path="Provenance.signature.type", description="Indication of the reason the entity signed the object(s)", type="token" ) 1614 public static final String SP_SIGTYPE = "sigtype"; 1615 @SearchParamDefinition(name="agent", path="Provenance.agent.actor", description="Individual, device or organization playing role", type="reference" ) 1616 public static final String SP_AGENT = "agent"; 1617 @SearchParamDefinition(name="entitytype", path="Provenance.entity.type", description="The type of resource in this entity", type="token" ) 1618 public static final String SP_ENTITYTYPE = "entitytype"; 1619 @SearchParamDefinition(name="patient", path="Provenance.target", description="Target Reference(s) (usually version specific)", type="reference" ) 1620 public static final String SP_PATIENT = "patient"; 1621 @SearchParamDefinition(name="start", path="Provenance.period.start", description="Starting time with inclusive boundary", type="date" ) 1622 public static final String SP_START = "start"; 1623 @SearchParamDefinition(name="end", path="Provenance.period.end", description="End time with inclusive boundary, if not ongoing", type="date" ) 1624 public static final String SP_END = "end"; 1625 @SearchParamDefinition(name="location", path="Provenance.location", description="Where the activity occurred, if relevant", type="reference" ) 1626 public static final String SP_LOCATION = "location"; 1627 @SearchParamDefinition(name="userid", path="Provenance.agent.userId", description="Authorization-system identifier for the agent", type="token" ) 1628 public static final String SP_USERID = "userid"; 1629 @SearchParamDefinition(name="entity", path="Provenance.entity.reference", description="Identity of entity", type="uri" ) 1630 public static final String SP_ENTITY = "entity"; 1631 @SearchParamDefinition(name="target", path="Provenance.target", description="Target Reference(s) (usually version specific)", type="reference" ) 1632 public static final String SP_TARGET = "target"; 1633 1634}