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