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