001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 045import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 046import org.hl7.fhir.exceptions.FHIRException; 047import org.hl7.fhir.utilities.Utilities; 048/** 049 * The header for a message exchange that is either requesting or responding to an action. The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle. 050 */ 051@ResourceDef(name="MessageHeader", profile="http://hl7.org/fhir/Profile/MessageHeader") 052public class MessageHeader extends DomainResource { 053 054 public enum ResponseType { 055 /** 056 * The message was accepted and processed without error. 057 */ 058 OK, 059 /** 060 * Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required. 061 */ 062 TRANSIENTERROR, 063 /** 064 * The message was rejected because of some content in it. There is no point in re-sending without change. The response narrative SHALL describe the issue. 065 */ 066 FATALERROR, 067 /** 068 * added to help the parsers 069 */ 070 NULL; 071 public static ResponseType fromCode(String codeString) throws FHIRException { 072 if (codeString == null || "".equals(codeString)) 073 return null; 074 if ("ok".equals(codeString)) 075 return OK; 076 if ("transient-error".equals(codeString)) 077 return TRANSIENTERROR; 078 if ("fatal-error".equals(codeString)) 079 return FATALERROR; 080 throw new FHIRException("Unknown ResponseType code '"+codeString+"'"); 081 } 082 public String toCode() { 083 switch (this) { 084 case OK: return "ok"; 085 case TRANSIENTERROR: return "transient-error"; 086 case FATALERROR: return "fatal-error"; 087 default: return "?"; 088 } 089 } 090 public String getSystem() { 091 switch (this) { 092 case OK: return "http://hl7.org/fhir/response-code"; 093 case TRANSIENTERROR: return "http://hl7.org/fhir/response-code"; 094 case FATALERROR: return "http://hl7.org/fhir/response-code"; 095 default: return "?"; 096 } 097 } 098 public String getDefinition() { 099 switch (this) { 100 case OK: return "The message was accepted and processed without error."; 101 case TRANSIENTERROR: return "Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required."; 102 case FATALERROR: return "The message was rejected because of some content in it. There is no point in re-sending without change. The response narrative SHALL describe the issue."; 103 default: return "?"; 104 } 105 } 106 public String getDisplay() { 107 switch (this) { 108 case OK: return "OK"; 109 case TRANSIENTERROR: return "Transient Error"; 110 case FATALERROR: return "Fatal Error"; 111 default: return "?"; 112 } 113 } 114 } 115 116 public static class ResponseTypeEnumFactory implements EnumFactory<ResponseType> { 117 public ResponseType fromCode(String codeString) throws IllegalArgumentException { 118 if (codeString == null || "".equals(codeString)) 119 if (codeString == null || "".equals(codeString)) 120 return null; 121 if ("ok".equals(codeString)) 122 return ResponseType.OK; 123 if ("transient-error".equals(codeString)) 124 return ResponseType.TRANSIENTERROR; 125 if ("fatal-error".equals(codeString)) 126 return ResponseType.FATALERROR; 127 throw new IllegalArgumentException("Unknown ResponseType code '"+codeString+"'"); 128 } 129 public Enumeration<ResponseType> fromType(Base code) throws FHIRException { 130 if (code == null || code.isEmpty()) 131 return null; 132 String codeString = ((PrimitiveType) code).asStringValue(); 133 if (codeString == null || "".equals(codeString)) 134 return null; 135 if ("ok".equals(codeString)) 136 return new Enumeration<ResponseType>(this, ResponseType.OK); 137 if ("transient-error".equals(codeString)) 138 return new Enumeration<ResponseType>(this, ResponseType.TRANSIENTERROR); 139 if ("fatal-error".equals(codeString)) 140 return new Enumeration<ResponseType>(this, ResponseType.FATALERROR); 141 throw new FHIRException("Unknown ResponseType code '"+codeString+"'"); 142 } 143 public String toCode(ResponseType code) { 144 if (code == ResponseType.OK) 145 return "ok"; 146 if (code == ResponseType.TRANSIENTERROR) 147 return "transient-error"; 148 if (code == ResponseType.FATALERROR) 149 return "fatal-error"; 150 return "?"; 151 } 152 } 153 154 @Block() 155 public static class MessageHeaderResponseComponent extends BackboneElement implements IBaseBackboneElement { 156 /** 157 * The id of the message that this message is a response to. 158 */ 159 @Child(name = "identifier", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true) 160 @Description(shortDefinition="Id of original message", formalDefinition="The id of the message that this message is a response to." ) 161 protected IdType identifier; 162 163 /** 164 * Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not. 165 */ 166 @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true) 167 @Description(shortDefinition="ok | transient-error | fatal-error", formalDefinition="Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not." ) 168 protected Enumeration<ResponseType> code; 169 170 /** 171 * Full details of any issues found in the message. 172 */ 173 @Child(name = "details", type = {OperationOutcome.class}, order=3, min=0, max=1, modifier=false, summary=true) 174 @Description(shortDefinition="Specific list of hints/warnings/errors", formalDefinition="Full details of any issues found in the message." ) 175 protected Reference details; 176 177 /** 178 * The actual object that is the target of the reference (Full details of any issues found in the message.) 179 */ 180 protected OperationOutcome detailsTarget; 181 182 private static final long serialVersionUID = -1008716838L; 183 184 /* 185 * Constructor 186 */ 187 public MessageHeaderResponseComponent() { 188 super(); 189 } 190 191 /* 192 * Constructor 193 */ 194 public MessageHeaderResponseComponent(IdType identifier, Enumeration<ResponseType> code) { 195 super(); 196 this.identifier = identifier; 197 this.code = code; 198 } 199 200 /** 201 * @return {@link #identifier} (The id of the message that this message is a response to.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value 202 */ 203 public IdType getIdentifierElement() { 204 if (this.identifier == null) 205 if (Configuration.errorOnAutoCreate()) 206 throw new Error("Attempt to auto-create MessageHeaderResponseComponent.identifier"); 207 else if (Configuration.doAutoCreate()) 208 this.identifier = new IdType(); // bb 209 return this.identifier; 210 } 211 212 public boolean hasIdentifierElement() { 213 return this.identifier != null && !this.identifier.isEmpty(); 214 } 215 216 public boolean hasIdentifier() { 217 return this.identifier != null && !this.identifier.isEmpty(); 218 } 219 220 /** 221 * @param value {@link #identifier} (The id of the message that this message is a response to.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value 222 */ 223 public MessageHeaderResponseComponent setIdentifierElement(IdType value) { 224 this.identifier = value; 225 return this; 226 } 227 228 /** 229 * @return The id of the message that this message is a response to. 230 */ 231 public String getIdentifier() { 232 return this.identifier == null ? null : this.identifier.getValue(); 233 } 234 235 /** 236 * @param value The id of the message that this message is a response to. 237 */ 238 public MessageHeaderResponseComponent setIdentifier(String value) { 239 if (this.identifier == null) 240 this.identifier = new IdType(); 241 this.identifier.setValue(value); 242 return this; 243 } 244 245 /** 246 * @return {@link #code} (Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 247 */ 248 public Enumeration<ResponseType> getCodeElement() { 249 if (this.code == null) 250 if (Configuration.errorOnAutoCreate()) 251 throw new Error("Attempt to auto-create MessageHeaderResponseComponent.code"); 252 else if (Configuration.doAutoCreate()) 253 this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory()); // bb 254 return this.code; 255 } 256 257 public boolean hasCodeElement() { 258 return this.code != null && !this.code.isEmpty(); 259 } 260 261 public boolean hasCode() { 262 return this.code != null && !this.code.isEmpty(); 263 } 264 265 /** 266 * @param value {@link #code} (Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 267 */ 268 public MessageHeaderResponseComponent setCodeElement(Enumeration<ResponseType> value) { 269 this.code = value; 270 return this; 271 } 272 273 /** 274 * @return Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not. 275 */ 276 public ResponseType getCode() { 277 return this.code == null ? null : this.code.getValue(); 278 } 279 280 /** 281 * @param value Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not. 282 */ 283 public MessageHeaderResponseComponent setCode(ResponseType value) { 284 if (this.code == null) 285 this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory()); 286 this.code.setValue(value); 287 return this; 288 } 289 290 /** 291 * @return {@link #details} (Full details of any issues found in the message.) 292 */ 293 public Reference getDetails() { 294 if (this.details == null) 295 if (Configuration.errorOnAutoCreate()) 296 throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details"); 297 else if (Configuration.doAutoCreate()) 298 this.details = new Reference(); // cc 299 return this.details; 300 } 301 302 public boolean hasDetails() { 303 return this.details != null && !this.details.isEmpty(); 304 } 305 306 /** 307 * @param value {@link #details} (Full details of any issues found in the message.) 308 */ 309 public MessageHeaderResponseComponent setDetails(Reference value) { 310 this.details = value; 311 return this; 312 } 313 314 /** 315 * @return {@link #details} 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. (Full details of any issues found in the message.) 316 */ 317 public OperationOutcome getDetailsTarget() { 318 if (this.detailsTarget == null) 319 if (Configuration.errorOnAutoCreate()) 320 throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details"); 321 else if (Configuration.doAutoCreate()) 322 this.detailsTarget = new OperationOutcome(); // aa 323 return this.detailsTarget; 324 } 325 326 /** 327 * @param value {@link #details} 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. (Full details of any issues found in the message.) 328 */ 329 public MessageHeaderResponseComponent setDetailsTarget(OperationOutcome value) { 330 this.detailsTarget = value; 331 return this; 332 } 333 334 protected void listChildren(List<Property> childrenList) { 335 super.listChildren(childrenList); 336 childrenList.add(new Property("identifier", "id", "The id of the message that this message is a response to.", 0, java.lang.Integer.MAX_VALUE, identifier)); 337 childrenList.add(new Property("code", "code", "Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.", 0, java.lang.Integer.MAX_VALUE, code)); 338 childrenList.add(new Property("details", "Reference(OperationOutcome)", "Full details of any issues found in the message.", 0, java.lang.Integer.MAX_VALUE, details)); 339 } 340 341 @Override 342 public void setProperty(String name, Base value) throws FHIRException { 343 if (name.equals("identifier")) 344 this.identifier = castToId(value); // IdType 345 else if (name.equals("code")) 346 this.code = new ResponseTypeEnumFactory().fromType(value); // Enumeration<ResponseType> 347 else if (name.equals("details")) 348 this.details = castToReference(value); // Reference 349 else 350 super.setProperty(name, value); 351 } 352 353 @Override 354 public Base addChild(String name) throws FHIRException { 355 if (name.equals("identifier")) { 356 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.identifier"); 357 } 358 else if (name.equals("code")) { 359 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.code"); 360 } 361 else if (name.equals("details")) { 362 this.details = new Reference(); 363 return this.details; 364 } 365 else 366 return super.addChild(name); 367 } 368 369 public MessageHeaderResponseComponent copy() { 370 MessageHeaderResponseComponent dst = new MessageHeaderResponseComponent(); 371 copyValues(dst); 372 dst.identifier = identifier == null ? null : identifier.copy(); 373 dst.code = code == null ? null : code.copy(); 374 dst.details = details == null ? null : details.copy(); 375 return dst; 376 } 377 378 @Override 379 public boolean equalsDeep(Base other) { 380 if (!super.equalsDeep(other)) 381 return false; 382 if (!(other instanceof MessageHeaderResponseComponent)) 383 return false; 384 MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other; 385 return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(details, o.details, true) 386 ; 387 } 388 389 @Override 390 public boolean equalsShallow(Base other) { 391 if (!super.equalsShallow(other)) 392 return false; 393 if (!(other instanceof MessageHeaderResponseComponent)) 394 return false; 395 MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other; 396 return compareValues(identifier, o.identifier, true) && compareValues(code, o.code, true); 397 } 398 399 public boolean isEmpty() { 400 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty()) 401 && (details == null || details.isEmpty()); 402 } 403 404 public String fhirType() { 405 return "MessageHeader.response"; 406 407 } 408 409 } 410 411 @Block() 412 public static class MessageSourceComponent extends BackboneElement implements IBaseBackboneElement { 413 /** 414 * Human-readable name for the source system. 415 */ 416 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 417 @Description(shortDefinition="Name of system", formalDefinition="Human-readable name for the source system." ) 418 protected StringType name; 419 420 /** 421 * May include configuration or other information useful in debugging. 422 */ 423 @Child(name = "software", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 424 @Description(shortDefinition="Name of software running the system", formalDefinition="May include configuration or other information useful in debugging." ) 425 protected StringType software; 426 427 /** 428 * Can convey versions of multiple systems in situations where a message passes through multiple hands. 429 */ 430 @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 431 @Description(shortDefinition="Version of software running", formalDefinition="Can convey versions of multiple systems in situations where a message passes through multiple hands." ) 432 protected StringType version; 433 434 /** 435 * An e-mail, phone, website or other contact point to use to resolve issues with message communications. 436 */ 437 @Child(name = "contact", type = {ContactPoint.class}, order=4, min=0, max=1, modifier=false, summary=true) 438 @Description(shortDefinition="Human contact for problems", formalDefinition="An e-mail, phone, website or other contact point to use to resolve issues with message communications." ) 439 protected ContactPoint contact; 440 441 /** 442 * Identifies the routing target to send acknowledgements to. 443 */ 444 @Child(name = "endpoint", type = {UriType.class}, order=5, min=1, max=1, modifier=false, summary=true) 445 @Description(shortDefinition="Actual message source address or id", formalDefinition="Identifies the routing target to send acknowledgements to." ) 446 protected UriType endpoint; 447 448 private static final long serialVersionUID = -115878196L; 449 450 /* 451 * Constructor 452 */ 453 public MessageSourceComponent() { 454 super(); 455 } 456 457 /* 458 * Constructor 459 */ 460 public MessageSourceComponent(UriType endpoint) { 461 super(); 462 this.endpoint = endpoint; 463 } 464 465 /** 466 * @return {@link #name} (Human-readable name for the source system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 467 */ 468 public StringType getNameElement() { 469 if (this.name == null) 470 if (Configuration.errorOnAutoCreate()) 471 throw new Error("Attempt to auto-create MessageSourceComponent.name"); 472 else if (Configuration.doAutoCreate()) 473 this.name = new StringType(); // bb 474 return this.name; 475 } 476 477 public boolean hasNameElement() { 478 return this.name != null && !this.name.isEmpty(); 479 } 480 481 public boolean hasName() { 482 return this.name != null && !this.name.isEmpty(); 483 } 484 485 /** 486 * @param value {@link #name} (Human-readable name for the source system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 487 */ 488 public MessageSourceComponent setNameElement(StringType value) { 489 this.name = value; 490 return this; 491 } 492 493 /** 494 * @return Human-readable name for the source system. 495 */ 496 public String getName() { 497 return this.name == null ? null : this.name.getValue(); 498 } 499 500 /** 501 * @param value Human-readable name for the source system. 502 */ 503 public MessageSourceComponent setName(String value) { 504 if (Utilities.noString(value)) 505 this.name = null; 506 else { 507 if (this.name == null) 508 this.name = new StringType(); 509 this.name.setValue(value); 510 } 511 return this; 512 } 513 514 /** 515 * @return {@link #software} (May include configuration or other information useful in debugging.). This is the underlying object with id, value and extensions. The accessor "getSoftware" gives direct access to the value 516 */ 517 public StringType getSoftwareElement() { 518 if (this.software == null) 519 if (Configuration.errorOnAutoCreate()) 520 throw new Error("Attempt to auto-create MessageSourceComponent.software"); 521 else if (Configuration.doAutoCreate()) 522 this.software = new StringType(); // bb 523 return this.software; 524 } 525 526 public boolean hasSoftwareElement() { 527 return this.software != null && !this.software.isEmpty(); 528 } 529 530 public boolean hasSoftware() { 531 return this.software != null && !this.software.isEmpty(); 532 } 533 534 /** 535 * @param value {@link #software} (May include configuration or other information useful in debugging.). This is the underlying object with id, value and extensions. The accessor "getSoftware" gives direct access to the value 536 */ 537 public MessageSourceComponent setSoftwareElement(StringType value) { 538 this.software = value; 539 return this; 540 } 541 542 /** 543 * @return May include configuration or other information useful in debugging. 544 */ 545 public String getSoftware() { 546 return this.software == null ? null : this.software.getValue(); 547 } 548 549 /** 550 * @param value May include configuration or other information useful in debugging. 551 */ 552 public MessageSourceComponent setSoftware(String value) { 553 if (Utilities.noString(value)) 554 this.software = null; 555 else { 556 if (this.software == null) 557 this.software = new StringType(); 558 this.software.setValue(value); 559 } 560 return this; 561 } 562 563 /** 564 * @return {@link #version} (Can convey versions of multiple systems in situations where a message passes through multiple hands.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 565 */ 566 public StringType getVersionElement() { 567 if (this.version == null) 568 if (Configuration.errorOnAutoCreate()) 569 throw new Error("Attempt to auto-create MessageSourceComponent.version"); 570 else if (Configuration.doAutoCreate()) 571 this.version = new StringType(); // bb 572 return this.version; 573 } 574 575 public boolean hasVersionElement() { 576 return this.version != null && !this.version.isEmpty(); 577 } 578 579 public boolean hasVersion() { 580 return this.version != null && !this.version.isEmpty(); 581 } 582 583 /** 584 * @param value {@link #version} (Can convey versions of multiple systems in situations where a message passes through multiple hands.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 585 */ 586 public MessageSourceComponent setVersionElement(StringType value) { 587 this.version = value; 588 return this; 589 } 590 591 /** 592 * @return Can convey versions of multiple systems in situations where a message passes through multiple hands. 593 */ 594 public String getVersion() { 595 return this.version == null ? null : this.version.getValue(); 596 } 597 598 /** 599 * @param value Can convey versions of multiple systems in situations where a message passes through multiple hands. 600 */ 601 public MessageSourceComponent setVersion(String value) { 602 if (Utilities.noString(value)) 603 this.version = null; 604 else { 605 if (this.version == null) 606 this.version = new StringType(); 607 this.version.setValue(value); 608 } 609 return this; 610 } 611 612 /** 613 * @return {@link #contact} (An e-mail, phone, website or other contact point to use to resolve issues with message communications.) 614 */ 615 public ContactPoint getContact() { 616 if (this.contact == null) 617 if (Configuration.errorOnAutoCreate()) 618 throw new Error("Attempt to auto-create MessageSourceComponent.contact"); 619 else if (Configuration.doAutoCreate()) 620 this.contact = new ContactPoint(); // cc 621 return this.contact; 622 } 623 624 public boolean hasContact() { 625 return this.contact != null && !this.contact.isEmpty(); 626 } 627 628 /** 629 * @param value {@link #contact} (An e-mail, phone, website or other contact point to use to resolve issues with message communications.) 630 */ 631 public MessageSourceComponent setContact(ContactPoint value) { 632 this.contact = value; 633 return this; 634 } 635 636 /** 637 * @return {@link #endpoint} (Identifies the routing target to send acknowledgements to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 638 */ 639 public UriType getEndpointElement() { 640 if (this.endpoint == null) 641 if (Configuration.errorOnAutoCreate()) 642 throw new Error("Attempt to auto-create MessageSourceComponent.endpoint"); 643 else if (Configuration.doAutoCreate()) 644 this.endpoint = new UriType(); // bb 645 return this.endpoint; 646 } 647 648 public boolean hasEndpointElement() { 649 return this.endpoint != null && !this.endpoint.isEmpty(); 650 } 651 652 public boolean hasEndpoint() { 653 return this.endpoint != null && !this.endpoint.isEmpty(); 654 } 655 656 /** 657 * @param value {@link #endpoint} (Identifies the routing target to send acknowledgements to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 658 */ 659 public MessageSourceComponent setEndpointElement(UriType value) { 660 this.endpoint = value; 661 return this; 662 } 663 664 /** 665 * @return Identifies the routing target to send acknowledgements to. 666 */ 667 public String getEndpoint() { 668 return this.endpoint == null ? null : this.endpoint.getValue(); 669 } 670 671 /** 672 * @param value Identifies the routing target to send acknowledgements to. 673 */ 674 public MessageSourceComponent setEndpoint(String value) { 675 if (this.endpoint == null) 676 this.endpoint = new UriType(); 677 this.endpoint.setValue(value); 678 return this; 679 } 680 681 protected void listChildren(List<Property> childrenList) { 682 super.listChildren(childrenList); 683 childrenList.add(new Property("name", "string", "Human-readable name for the source system.", 0, java.lang.Integer.MAX_VALUE, name)); 684 childrenList.add(new Property("software", "string", "May include configuration or other information useful in debugging.", 0, java.lang.Integer.MAX_VALUE, software)); 685 childrenList.add(new Property("version", "string", "Can convey versions of multiple systems in situations where a message passes through multiple hands.", 0, java.lang.Integer.MAX_VALUE, version)); 686 childrenList.add(new Property("contact", "ContactPoint", "An e-mail, phone, website or other contact point to use to resolve issues with message communications.", 0, java.lang.Integer.MAX_VALUE, contact)); 687 childrenList.add(new Property("endpoint", "uri", "Identifies the routing target to send acknowledgements to.", 0, java.lang.Integer.MAX_VALUE, endpoint)); 688 } 689 690 @Override 691 public void setProperty(String name, Base value) throws FHIRException { 692 if (name.equals("name")) 693 this.name = castToString(value); // StringType 694 else if (name.equals("software")) 695 this.software = castToString(value); // StringType 696 else if (name.equals("version")) 697 this.version = castToString(value); // StringType 698 else if (name.equals("contact")) 699 this.contact = castToContactPoint(value); // ContactPoint 700 else if (name.equals("endpoint")) 701 this.endpoint = castToUri(value); // UriType 702 else 703 super.setProperty(name, value); 704 } 705 706 @Override 707 public Base addChild(String name) throws FHIRException { 708 if (name.equals("name")) { 709 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.name"); 710 } 711 else if (name.equals("software")) { 712 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.software"); 713 } 714 else if (name.equals("version")) { 715 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.version"); 716 } 717 else if (name.equals("contact")) { 718 this.contact = new ContactPoint(); 719 return this.contact; 720 } 721 else if (name.equals("endpoint")) { 722 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.endpoint"); 723 } 724 else 725 return super.addChild(name); 726 } 727 728 public MessageSourceComponent copy() { 729 MessageSourceComponent dst = new MessageSourceComponent(); 730 copyValues(dst); 731 dst.name = name == null ? null : name.copy(); 732 dst.software = software == null ? null : software.copy(); 733 dst.version = version == null ? null : version.copy(); 734 dst.contact = contact == null ? null : contact.copy(); 735 dst.endpoint = endpoint == null ? null : endpoint.copy(); 736 return dst; 737 } 738 739 @Override 740 public boolean equalsDeep(Base other) { 741 if (!super.equalsDeep(other)) 742 return false; 743 if (!(other instanceof MessageSourceComponent)) 744 return false; 745 MessageSourceComponent o = (MessageSourceComponent) other; 746 return compareDeep(name, o.name, true) && compareDeep(software, o.software, true) && compareDeep(version, o.version, true) 747 && compareDeep(contact, o.contact, true) && compareDeep(endpoint, o.endpoint, true); 748 } 749 750 @Override 751 public boolean equalsShallow(Base other) { 752 if (!super.equalsShallow(other)) 753 return false; 754 if (!(other instanceof MessageSourceComponent)) 755 return false; 756 MessageSourceComponent o = (MessageSourceComponent) other; 757 return compareValues(name, o.name, true) && compareValues(software, o.software, true) && compareValues(version, o.version, true) 758 && compareValues(endpoint, o.endpoint, true); 759 } 760 761 public boolean isEmpty() { 762 return super.isEmpty() && (name == null || name.isEmpty()) && (software == null || software.isEmpty()) 763 && (version == null || version.isEmpty()) && (contact == null || contact.isEmpty()) && (endpoint == null || endpoint.isEmpty()) 764 ; 765 } 766 767 public String fhirType() { 768 return "MessageHeader.source"; 769 770 } 771 772 } 773 774 @Block() 775 public static class MessageDestinationComponent extends BackboneElement implements IBaseBackboneElement { 776 /** 777 * Human-readable name for the target system. 778 */ 779 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 780 @Description(shortDefinition="Name of system", formalDefinition="Human-readable name for the target system." ) 781 protected StringType name; 782 783 /** 784 * Identifies the target end system in situations where the initial message transmission is to an intermediary system. 785 */ 786 @Child(name = "target", type = {Device.class}, order=2, min=0, max=1, modifier=false, summary=true) 787 @Description(shortDefinition="Particular delivery destination within the destination", formalDefinition="Identifies the target end system in situations where the initial message transmission is to an intermediary system." ) 788 protected Reference target; 789 790 /** 791 * The actual object that is the target of the reference (Identifies the target end system in situations where the initial message transmission is to an intermediary system.) 792 */ 793 protected Device targetTarget; 794 795 /** 796 * Indicates where the message should be routed to. 797 */ 798 @Child(name = "endpoint", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=true) 799 @Description(shortDefinition="Actual destination address or id", formalDefinition="Indicates where the message should be routed to." ) 800 protected UriType endpoint; 801 802 private static final long serialVersionUID = -2097633309L; 803 804 /* 805 * Constructor 806 */ 807 public MessageDestinationComponent() { 808 super(); 809 } 810 811 /* 812 * Constructor 813 */ 814 public MessageDestinationComponent(UriType endpoint) { 815 super(); 816 this.endpoint = endpoint; 817 } 818 819 /** 820 * @return {@link #name} (Human-readable name for the target system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 821 */ 822 public StringType getNameElement() { 823 if (this.name == null) 824 if (Configuration.errorOnAutoCreate()) 825 throw new Error("Attempt to auto-create MessageDestinationComponent.name"); 826 else if (Configuration.doAutoCreate()) 827 this.name = new StringType(); // bb 828 return this.name; 829 } 830 831 public boolean hasNameElement() { 832 return this.name != null && !this.name.isEmpty(); 833 } 834 835 public boolean hasName() { 836 return this.name != null && !this.name.isEmpty(); 837 } 838 839 /** 840 * @param value {@link #name} (Human-readable name for the target system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 841 */ 842 public MessageDestinationComponent setNameElement(StringType value) { 843 this.name = value; 844 return this; 845 } 846 847 /** 848 * @return Human-readable name for the target system. 849 */ 850 public String getName() { 851 return this.name == null ? null : this.name.getValue(); 852 } 853 854 /** 855 * @param value Human-readable name for the target system. 856 */ 857 public MessageDestinationComponent setName(String value) { 858 if (Utilities.noString(value)) 859 this.name = null; 860 else { 861 if (this.name == null) 862 this.name = new StringType(); 863 this.name.setValue(value); 864 } 865 return this; 866 } 867 868 /** 869 * @return {@link #target} (Identifies the target end system in situations where the initial message transmission is to an intermediary system.) 870 */ 871 public Reference getTarget() { 872 if (this.target == null) 873 if (Configuration.errorOnAutoCreate()) 874 throw new Error("Attempt to auto-create MessageDestinationComponent.target"); 875 else if (Configuration.doAutoCreate()) 876 this.target = new Reference(); // cc 877 return this.target; 878 } 879 880 public boolean hasTarget() { 881 return this.target != null && !this.target.isEmpty(); 882 } 883 884 /** 885 * @param value {@link #target} (Identifies the target end system in situations where the initial message transmission is to an intermediary system.) 886 */ 887 public MessageDestinationComponent setTarget(Reference value) { 888 this.target = value; 889 return this; 890 } 891 892 /** 893 * @return {@link #target} 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. (Identifies the target end system in situations where the initial message transmission is to an intermediary system.) 894 */ 895 public Device getTargetTarget() { 896 if (this.targetTarget == null) 897 if (Configuration.errorOnAutoCreate()) 898 throw new Error("Attempt to auto-create MessageDestinationComponent.target"); 899 else if (Configuration.doAutoCreate()) 900 this.targetTarget = new Device(); // aa 901 return this.targetTarget; 902 } 903 904 /** 905 * @param value {@link #target} 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. (Identifies the target end system in situations where the initial message transmission is to an intermediary system.) 906 */ 907 public MessageDestinationComponent setTargetTarget(Device value) { 908 this.targetTarget = value; 909 return this; 910 } 911 912 /** 913 * @return {@link #endpoint} (Indicates where the message should be routed to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 914 */ 915 public UriType getEndpointElement() { 916 if (this.endpoint == null) 917 if (Configuration.errorOnAutoCreate()) 918 throw new Error("Attempt to auto-create MessageDestinationComponent.endpoint"); 919 else if (Configuration.doAutoCreate()) 920 this.endpoint = new UriType(); // bb 921 return this.endpoint; 922 } 923 924 public boolean hasEndpointElement() { 925 return this.endpoint != null && !this.endpoint.isEmpty(); 926 } 927 928 public boolean hasEndpoint() { 929 return this.endpoint != null && !this.endpoint.isEmpty(); 930 } 931 932 /** 933 * @param value {@link #endpoint} (Indicates where the message should be routed to.). This is the underlying object with id, value and extensions. The accessor "getEndpoint" gives direct access to the value 934 */ 935 public MessageDestinationComponent setEndpointElement(UriType value) { 936 this.endpoint = value; 937 return this; 938 } 939 940 /** 941 * @return Indicates where the message should be routed to. 942 */ 943 public String getEndpoint() { 944 return this.endpoint == null ? null : this.endpoint.getValue(); 945 } 946 947 /** 948 * @param value Indicates where the message should be routed to. 949 */ 950 public MessageDestinationComponent setEndpoint(String value) { 951 if (this.endpoint == null) 952 this.endpoint = new UriType(); 953 this.endpoint.setValue(value); 954 return this; 955 } 956 957 protected void listChildren(List<Property> childrenList) { 958 super.listChildren(childrenList); 959 childrenList.add(new Property("name", "string", "Human-readable name for the target system.", 0, java.lang.Integer.MAX_VALUE, name)); 960 childrenList.add(new Property("target", "Reference(Device)", "Identifies the target end system in situations where the initial message transmission is to an intermediary system.", 0, java.lang.Integer.MAX_VALUE, target)); 961 childrenList.add(new Property("endpoint", "uri", "Indicates where the message should be routed to.", 0, java.lang.Integer.MAX_VALUE, endpoint)); 962 } 963 964 @Override 965 public void setProperty(String name, Base value) throws FHIRException { 966 if (name.equals("name")) 967 this.name = castToString(value); // StringType 968 else if (name.equals("target")) 969 this.target = castToReference(value); // Reference 970 else if (name.equals("endpoint")) 971 this.endpoint = castToUri(value); // UriType 972 else 973 super.setProperty(name, value); 974 } 975 976 @Override 977 public Base addChild(String name) throws FHIRException { 978 if (name.equals("name")) { 979 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.name"); 980 } 981 else if (name.equals("target")) { 982 this.target = new Reference(); 983 return this.target; 984 } 985 else if (name.equals("endpoint")) { 986 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.endpoint"); 987 } 988 else 989 return super.addChild(name); 990 } 991 992 public MessageDestinationComponent copy() { 993 MessageDestinationComponent dst = new MessageDestinationComponent(); 994 copyValues(dst); 995 dst.name = name == null ? null : name.copy(); 996 dst.target = target == null ? null : target.copy(); 997 dst.endpoint = endpoint == null ? null : endpoint.copy(); 998 return dst; 999 } 1000 1001 @Override 1002 public boolean equalsDeep(Base other) { 1003 if (!super.equalsDeep(other)) 1004 return false; 1005 if (!(other instanceof MessageDestinationComponent)) 1006 return false; 1007 MessageDestinationComponent o = (MessageDestinationComponent) other; 1008 return compareDeep(name, o.name, true) && compareDeep(target, o.target, true) && compareDeep(endpoint, o.endpoint, true) 1009 ; 1010 } 1011 1012 @Override 1013 public boolean equalsShallow(Base other) { 1014 if (!super.equalsShallow(other)) 1015 return false; 1016 if (!(other instanceof MessageDestinationComponent)) 1017 return false; 1018 MessageDestinationComponent o = (MessageDestinationComponent) other; 1019 return compareValues(name, o.name, true) && compareValues(endpoint, o.endpoint, true); 1020 } 1021 1022 public boolean isEmpty() { 1023 return super.isEmpty() && (name == null || name.isEmpty()) && (target == null || target.isEmpty()) 1024 && (endpoint == null || endpoint.isEmpty()); 1025 } 1026 1027 public String fhirType() { 1028 return "MessageHeader.destination"; 1029 1030 } 1031 1032 } 1033 1034 /** 1035 * The time that the message was sent. 1036 */ 1037 @Child(name = "timestamp", type = {InstantType.class}, order=0, min=1, max=1, modifier=false, summary=true) 1038 @Description(shortDefinition="Time that the message was sent", formalDefinition="The time that the message was sent." ) 1039 protected InstantType timestamp; 1040 1041 /** 1042 * Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value "http://hl7.org/fhir/message-events". 1043 */ 1044 @Child(name = "event", type = {Coding.class}, order=1, min=1, max=1, modifier=true, summary=true) 1045 @Description(shortDefinition="Code for the event this message represents", formalDefinition="Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://hl7.org/fhir/message-events\"." ) 1046 protected Coding event; 1047 1048 /** 1049 * Information about the message that this message is a response to. Only present if this message is a response. 1050 */ 1051 @Child(name = "response", type = {}, order=2, min=0, max=1, modifier=true, summary=true) 1052 @Description(shortDefinition="If this is a reply to prior message", formalDefinition="Information about the message that this message is a response to. Only present if this message is a response." ) 1053 protected MessageHeaderResponseComponent response; 1054 1055 /** 1056 * The source application from which this message originated. 1057 */ 1058 @Child(name = "source", type = {}, order=3, min=1, max=1, modifier=false, summary=true) 1059 @Description(shortDefinition="Message Source Application", formalDefinition="The source application from which this message originated." ) 1060 protected MessageSourceComponent source; 1061 1062 /** 1063 * The destination application which the message is intended for. 1064 */ 1065 @Child(name = "destination", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1066 @Description(shortDefinition="Message Destination Application(s)", formalDefinition="The destination application which the message is intended for." ) 1067 protected List<MessageDestinationComponent> destination; 1068 1069 /** 1070 * The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions. 1071 */ 1072 @Child(name = "enterer", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true) 1073 @Description(shortDefinition="The source of the data entry", formalDefinition="The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions." ) 1074 protected Reference enterer; 1075 1076 /** 1077 * The actual object that is the target of the reference (The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.) 1078 */ 1079 protected Practitioner entererTarget; 1080 1081 /** 1082 * The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions. 1083 */ 1084 @Child(name = "author", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true) 1085 @Description(shortDefinition="The source of the decision", formalDefinition="The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions." ) 1086 protected Reference author; 1087 1088 /** 1089 * The actual object that is the target of the reference (The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.) 1090 */ 1091 protected Practitioner authorTarget; 1092 1093 /** 1094 * Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient. 1095 */ 1096 @Child(name = "receiver", type = {Practitioner.class, Organization.class}, order=7, min=0, max=1, modifier=false, summary=true) 1097 @Description(shortDefinition="Intended \"real-world\" recipient for the data", formalDefinition="Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient." ) 1098 protected Reference receiver; 1099 1100 /** 1101 * The actual object that is the target of the reference (Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.) 1102 */ 1103 protected Resource receiverTarget; 1104 1105 /** 1106 * The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party. 1107 */ 1108 @Child(name = "responsible", type = {Practitioner.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true) 1109 @Description(shortDefinition="Final responsibility for event", formalDefinition="The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party." ) 1110 protected Reference responsible; 1111 1112 /** 1113 * The actual object that is the target of the reference (The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.) 1114 */ 1115 protected Resource responsibleTarget; 1116 1117 /** 1118 * Coded indication of the cause for the event - indicates a reason for the occurrence of the event that is a focus of this message. 1119 */ 1120 @Child(name = "reason", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true) 1121 @Description(shortDefinition="Cause of event", formalDefinition="Coded indication of the cause for the event - indicates a reason for the occurrence of the event that is a focus of this message." ) 1122 protected CodeableConcept reason; 1123 1124 /** 1125 * The actual data of the message - a reference to the root/focus class of the event. 1126 */ 1127 @Child(name = "data", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1128 @Description(shortDefinition="The actual content of the message", formalDefinition="The actual data of the message - a reference to the root/focus class of the event." ) 1129 protected List<Reference> data; 1130 /** 1131 * The actual objects that are the target of the reference (The actual data of the message - a reference to the root/focus class of the event.) 1132 */ 1133 protected List<Resource> dataTarget; 1134 1135 1136 private static final long serialVersionUID = 1429728517L; 1137 1138 /* 1139 * Constructor 1140 */ 1141 public MessageHeader() { 1142 super(); 1143 } 1144 1145 /* 1146 * Constructor 1147 */ 1148 public MessageHeader(InstantType timestamp, Coding event, MessageSourceComponent source) { 1149 super(); 1150 this.timestamp = timestamp; 1151 this.event = event; 1152 this.source = source; 1153 } 1154 1155 /** 1156 * @return {@link #timestamp} (The time that the message was sent.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 1157 */ 1158 public InstantType getTimestampElement() { 1159 if (this.timestamp == null) 1160 if (Configuration.errorOnAutoCreate()) 1161 throw new Error("Attempt to auto-create MessageHeader.timestamp"); 1162 else if (Configuration.doAutoCreate()) 1163 this.timestamp = new InstantType(); // bb 1164 return this.timestamp; 1165 } 1166 1167 public boolean hasTimestampElement() { 1168 return this.timestamp != null && !this.timestamp.isEmpty(); 1169 } 1170 1171 public boolean hasTimestamp() { 1172 return this.timestamp != null && !this.timestamp.isEmpty(); 1173 } 1174 1175 /** 1176 * @param value {@link #timestamp} (The time that the message was sent.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 1177 */ 1178 public MessageHeader setTimestampElement(InstantType value) { 1179 this.timestamp = value; 1180 return this; 1181 } 1182 1183 /** 1184 * @return The time that the message was sent. 1185 */ 1186 public Date getTimestamp() { 1187 return this.timestamp == null ? null : this.timestamp.getValue(); 1188 } 1189 1190 /** 1191 * @param value The time that the message was sent. 1192 */ 1193 public MessageHeader setTimestamp(Date value) { 1194 if (this.timestamp == null) 1195 this.timestamp = new InstantType(); 1196 this.timestamp.setValue(value); 1197 return this; 1198 } 1199 1200 /** 1201 * @return {@link #event} (Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value "http://hl7.org/fhir/message-events".) 1202 */ 1203 public Coding getEvent() { 1204 if (this.event == null) 1205 if (Configuration.errorOnAutoCreate()) 1206 throw new Error("Attempt to auto-create MessageHeader.event"); 1207 else if (Configuration.doAutoCreate()) 1208 this.event = new Coding(); // cc 1209 return this.event; 1210 } 1211 1212 public boolean hasEvent() { 1213 return this.event != null && !this.event.isEmpty(); 1214 } 1215 1216 /** 1217 * @param value {@link #event} (Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value "http://hl7.org/fhir/message-events".) 1218 */ 1219 public MessageHeader setEvent(Coding value) { 1220 this.event = value; 1221 return this; 1222 } 1223 1224 /** 1225 * @return {@link #response} (Information about the message that this message is a response to. Only present if this message is a response.) 1226 */ 1227 public MessageHeaderResponseComponent getResponse() { 1228 if (this.response == null) 1229 if (Configuration.errorOnAutoCreate()) 1230 throw new Error("Attempt to auto-create MessageHeader.response"); 1231 else if (Configuration.doAutoCreate()) 1232 this.response = new MessageHeaderResponseComponent(); // cc 1233 return this.response; 1234 } 1235 1236 public boolean hasResponse() { 1237 return this.response != null && !this.response.isEmpty(); 1238 } 1239 1240 /** 1241 * @param value {@link #response} (Information about the message that this message is a response to. Only present if this message is a response.) 1242 */ 1243 public MessageHeader setResponse(MessageHeaderResponseComponent value) { 1244 this.response = value; 1245 return this; 1246 } 1247 1248 /** 1249 * @return {@link #source} (The source application from which this message originated.) 1250 */ 1251 public MessageSourceComponent getSource() { 1252 if (this.source == null) 1253 if (Configuration.errorOnAutoCreate()) 1254 throw new Error("Attempt to auto-create MessageHeader.source"); 1255 else if (Configuration.doAutoCreate()) 1256 this.source = new MessageSourceComponent(); // cc 1257 return this.source; 1258 } 1259 1260 public boolean hasSource() { 1261 return this.source != null && !this.source.isEmpty(); 1262 } 1263 1264 /** 1265 * @param value {@link #source} (The source application from which this message originated.) 1266 */ 1267 public MessageHeader setSource(MessageSourceComponent value) { 1268 this.source = value; 1269 return this; 1270 } 1271 1272 /** 1273 * @return {@link #destination} (The destination application which the message is intended for.) 1274 */ 1275 public List<MessageDestinationComponent> getDestination() { 1276 if (this.destination == null) 1277 this.destination = new ArrayList<MessageDestinationComponent>(); 1278 return this.destination; 1279 } 1280 1281 public boolean hasDestination() { 1282 if (this.destination == null) 1283 return false; 1284 for (MessageDestinationComponent item : this.destination) 1285 if (!item.isEmpty()) 1286 return true; 1287 return false; 1288 } 1289 1290 /** 1291 * @return {@link #destination} (The destination application which the message is intended for.) 1292 */ 1293 // syntactic sugar 1294 public MessageDestinationComponent addDestination() { //3 1295 MessageDestinationComponent t = new MessageDestinationComponent(); 1296 if (this.destination == null) 1297 this.destination = new ArrayList<MessageDestinationComponent>(); 1298 this.destination.add(t); 1299 return t; 1300 } 1301 1302 // syntactic sugar 1303 public MessageHeader addDestination(MessageDestinationComponent t) { //3 1304 if (t == null) 1305 return this; 1306 if (this.destination == null) 1307 this.destination = new ArrayList<MessageDestinationComponent>(); 1308 this.destination.add(t); 1309 return this; 1310 } 1311 1312 /** 1313 * @return {@link #enterer} (The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.) 1314 */ 1315 public Reference getEnterer() { 1316 if (this.enterer == null) 1317 if (Configuration.errorOnAutoCreate()) 1318 throw new Error("Attempt to auto-create MessageHeader.enterer"); 1319 else if (Configuration.doAutoCreate()) 1320 this.enterer = new Reference(); // cc 1321 return this.enterer; 1322 } 1323 1324 public boolean hasEnterer() { 1325 return this.enterer != null && !this.enterer.isEmpty(); 1326 } 1327 1328 /** 1329 * @param value {@link #enterer} (The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.) 1330 */ 1331 public MessageHeader setEnterer(Reference value) { 1332 this.enterer = value; 1333 return this; 1334 } 1335 1336 /** 1337 * @return {@link #enterer} 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 person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.) 1338 */ 1339 public Practitioner getEntererTarget() { 1340 if (this.entererTarget == null) 1341 if (Configuration.errorOnAutoCreate()) 1342 throw new Error("Attempt to auto-create MessageHeader.enterer"); 1343 else if (Configuration.doAutoCreate()) 1344 this.entererTarget = new Practitioner(); // aa 1345 return this.entererTarget; 1346 } 1347 1348 /** 1349 * @param value {@link #enterer} 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 person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.) 1350 */ 1351 public MessageHeader setEntererTarget(Practitioner value) { 1352 this.entererTarget = value; 1353 return this; 1354 } 1355 1356 /** 1357 * @return {@link #author} (The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.) 1358 */ 1359 public Reference getAuthor() { 1360 if (this.author == null) 1361 if (Configuration.errorOnAutoCreate()) 1362 throw new Error("Attempt to auto-create MessageHeader.author"); 1363 else if (Configuration.doAutoCreate()) 1364 this.author = new Reference(); // cc 1365 return this.author; 1366 } 1367 1368 public boolean hasAuthor() { 1369 return this.author != null && !this.author.isEmpty(); 1370 } 1371 1372 /** 1373 * @param value {@link #author} (The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.) 1374 */ 1375 public MessageHeader setAuthor(Reference value) { 1376 this.author = value; 1377 return this; 1378 } 1379 1380 /** 1381 * @return {@link #author} 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 logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.) 1382 */ 1383 public Practitioner getAuthorTarget() { 1384 if (this.authorTarget == null) 1385 if (Configuration.errorOnAutoCreate()) 1386 throw new Error("Attempt to auto-create MessageHeader.author"); 1387 else if (Configuration.doAutoCreate()) 1388 this.authorTarget = new Practitioner(); // aa 1389 return this.authorTarget; 1390 } 1391 1392 /** 1393 * @param value {@link #author} 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 logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.) 1394 */ 1395 public MessageHeader setAuthorTarget(Practitioner value) { 1396 this.authorTarget = value; 1397 return this; 1398 } 1399 1400 /** 1401 * @return {@link #receiver} (Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.) 1402 */ 1403 public Reference getReceiver() { 1404 if (this.receiver == null) 1405 if (Configuration.errorOnAutoCreate()) 1406 throw new Error("Attempt to auto-create MessageHeader.receiver"); 1407 else if (Configuration.doAutoCreate()) 1408 this.receiver = new Reference(); // cc 1409 return this.receiver; 1410 } 1411 1412 public boolean hasReceiver() { 1413 return this.receiver != null && !this.receiver.isEmpty(); 1414 } 1415 1416 /** 1417 * @param value {@link #receiver} (Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.) 1418 */ 1419 public MessageHeader setReceiver(Reference value) { 1420 this.receiver = value; 1421 return this; 1422 } 1423 1424 /** 1425 * @return {@link #receiver} 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. (Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.) 1426 */ 1427 public Resource getReceiverTarget() { 1428 return this.receiverTarget; 1429 } 1430 1431 /** 1432 * @param value {@link #receiver} 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. (Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.) 1433 */ 1434 public MessageHeader setReceiverTarget(Resource value) { 1435 this.receiverTarget = value; 1436 return this; 1437 } 1438 1439 /** 1440 * @return {@link #responsible} (The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.) 1441 */ 1442 public Reference getResponsible() { 1443 if (this.responsible == null) 1444 if (Configuration.errorOnAutoCreate()) 1445 throw new Error("Attempt to auto-create MessageHeader.responsible"); 1446 else if (Configuration.doAutoCreate()) 1447 this.responsible = new Reference(); // cc 1448 return this.responsible; 1449 } 1450 1451 public boolean hasResponsible() { 1452 return this.responsible != null && !this.responsible.isEmpty(); 1453 } 1454 1455 /** 1456 * @param value {@link #responsible} (The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.) 1457 */ 1458 public MessageHeader setResponsible(Reference value) { 1459 this.responsible = value; 1460 return this; 1461 } 1462 1463 /** 1464 * @return {@link #responsible} 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 person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.) 1465 */ 1466 public Resource getResponsibleTarget() { 1467 return this.responsibleTarget; 1468 } 1469 1470 /** 1471 * @param value {@link #responsible} 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 person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.) 1472 */ 1473 public MessageHeader setResponsibleTarget(Resource value) { 1474 this.responsibleTarget = value; 1475 return this; 1476 } 1477 1478 /** 1479 * @return {@link #reason} (Coded indication of the cause for the event - indicates a reason for the occurrence of the event that is a focus of this message.) 1480 */ 1481 public CodeableConcept getReason() { 1482 if (this.reason == null) 1483 if (Configuration.errorOnAutoCreate()) 1484 throw new Error("Attempt to auto-create MessageHeader.reason"); 1485 else if (Configuration.doAutoCreate()) 1486 this.reason = new CodeableConcept(); // cc 1487 return this.reason; 1488 } 1489 1490 public boolean hasReason() { 1491 return this.reason != null && !this.reason.isEmpty(); 1492 } 1493 1494 /** 1495 * @param value {@link #reason} (Coded indication of the cause for the event - indicates a reason for the occurrence of the event that is a focus of this message.) 1496 */ 1497 public MessageHeader setReason(CodeableConcept value) { 1498 this.reason = value; 1499 return this; 1500 } 1501 1502 /** 1503 * @return {@link #data} (The actual data of the message - a reference to the root/focus class of the event.) 1504 */ 1505 public List<Reference> getData() { 1506 if (this.data == null) 1507 this.data = new ArrayList<Reference>(); 1508 return this.data; 1509 } 1510 1511 public boolean hasData() { 1512 if (this.data == null) 1513 return false; 1514 for (Reference item : this.data) 1515 if (!item.isEmpty()) 1516 return true; 1517 return false; 1518 } 1519 1520 /** 1521 * @return {@link #data} (The actual data of the message - a reference to the root/focus class of the event.) 1522 */ 1523 // syntactic sugar 1524 public Reference addData() { //3 1525 Reference t = new Reference(); 1526 if (this.data == null) 1527 this.data = new ArrayList<Reference>(); 1528 this.data.add(t); 1529 return t; 1530 } 1531 1532 // syntactic sugar 1533 public MessageHeader addData(Reference t) { //3 1534 if (t == null) 1535 return this; 1536 if (this.data == null) 1537 this.data = new ArrayList<Reference>(); 1538 this.data.add(t); 1539 return this; 1540 } 1541 1542 /** 1543 * @return {@link #data} (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 actual data of the message - a reference to the root/focus class of the event.) 1544 */ 1545 public List<Resource> getDataTarget() { 1546 if (this.dataTarget == null) 1547 this.dataTarget = new ArrayList<Resource>(); 1548 return this.dataTarget; 1549 } 1550 1551 protected void listChildren(List<Property> childrenList) { 1552 super.listChildren(childrenList); 1553 childrenList.add(new Property("timestamp", "instant", "The time that the message was sent.", 0, java.lang.Integer.MAX_VALUE, timestamp)); 1554 childrenList.add(new Property("event", "Coding", "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://hl7.org/fhir/message-events\".", 0, java.lang.Integer.MAX_VALUE, event)); 1555 childrenList.add(new Property("response", "", "Information about the message that this message is a response to. Only present if this message is a response.", 0, java.lang.Integer.MAX_VALUE, response)); 1556 childrenList.add(new Property("source", "", "The source application from which this message originated.", 0, java.lang.Integer.MAX_VALUE, source)); 1557 childrenList.add(new Property("destination", "", "The destination application which the message is intended for.", 0, java.lang.Integer.MAX_VALUE, destination)); 1558 childrenList.add(new Property("enterer", "Reference(Practitioner)", "The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.", 0, java.lang.Integer.MAX_VALUE, enterer)); 1559 childrenList.add(new Property("author", "Reference(Practitioner)", "The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.", 0, java.lang.Integer.MAX_VALUE, author)); 1560 childrenList.add(new Property("receiver", "Reference(Practitioner|Organization)", "Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.", 0, java.lang.Integer.MAX_VALUE, receiver)); 1561 childrenList.add(new Property("responsible", "Reference(Practitioner|Organization)", "The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.", 0, java.lang.Integer.MAX_VALUE, responsible)); 1562 childrenList.add(new Property("reason", "CodeableConcept", "Coded indication of the cause for the event - indicates a reason for the occurrence of the event that is a focus of this message.", 0, java.lang.Integer.MAX_VALUE, reason)); 1563 childrenList.add(new Property("data", "Reference(Any)", "The actual data of the message - a reference to the root/focus class of the event.", 0, java.lang.Integer.MAX_VALUE, data)); 1564 } 1565 1566 @Override 1567 public void setProperty(String name, Base value) throws FHIRException { 1568 if (name.equals("timestamp")) 1569 this.timestamp = castToInstant(value); // InstantType 1570 else if (name.equals("event")) 1571 this.event = castToCoding(value); // Coding 1572 else if (name.equals("response")) 1573 this.response = (MessageHeaderResponseComponent) value; // MessageHeaderResponseComponent 1574 else if (name.equals("source")) 1575 this.source = (MessageSourceComponent) value; // MessageSourceComponent 1576 else if (name.equals("destination")) 1577 this.getDestination().add((MessageDestinationComponent) value); 1578 else if (name.equals("enterer")) 1579 this.enterer = castToReference(value); // Reference 1580 else if (name.equals("author")) 1581 this.author = castToReference(value); // Reference 1582 else if (name.equals("receiver")) 1583 this.receiver = castToReference(value); // Reference 1584 else if (name.equals("responsible")) 1585 this.responsible = castToReference(value); // Reference 1586 else if (name.equals("reason")) 1587 this.reason = castToCodeableConcept(value); // CodeableConcept 1588 else if (name.equals("data")) 1589 this.getData().add(castToReference(value)); 1590 else 1591 super.setProperty(name, value); 1592 } 1593 1594 @Override 1595 public Base addChild(String name) throws FHIRException { 1596 if (name.equals("timestamp")) { 1597 throw new FHIRException("Cannot call addChild on a primitive type MessageHeader.timestamp"); 1598 } 1599 else if (name.equals("event")) { 1600 this.event = new Coding(); 1601 return this.event; 1602 } 1603 else if (name.equals("response")) { 1604 this.response = new MessageHeaderResponseComponent(); 1605 return this.response; 1606 } 1607 else if (name.equals("source")) { 1608 this.source = new MessageSourceComponent(); 1609 return this.source; 1610 } 1611 else if (name.equals("destination")) { 1612 return addDestination(); 1613 } 1614 else if (name.equals("enterer")) { 1615 this.enterer = new Reference(); 1616 return this.enterer; 1617 } 1618 else if (name.equals("author")) { 1619 this.author = new Reference(); 1620 return this.author; 1621 } 1622 else if (name.equals("receiver")) { 1623 this.receiver = new Reference(); 1624 return this.receiver; 1625 } 1626 else if (name.equals("responsible")) { 1627 this.responsible = new Reference(); 1628 return this.responsible; 1629 } 1630 else if (name.equals("reason")) { 1631 this.reason = new CodeableConcept(); 1632 return this.reason; 1633 } 1634 else if (name.equals("data")) { 1635 return addData(); 1636 } 1637 else 1638 return super.addChild(name); 1639 } 1640 1641 public String fhirType() { 1642 return "MessageHeader"; 1643 1644 } 1645 1646 public MessageHeader copy() { 1647 MessageHeader dst = new MessageHeader(); 1648 copyValues(dst); 1649 dst.timestamp = timestamp == null ? null : timestamp.copy(); 1650 dst.event = event == null ? null : event.copy(); 1651 dst.response = response == null ? null : response.copy(); 1652 dst.source = source == null ? null : source.copy(); 1653 if (destination != null) { 1654 dst.destination = new ArrayList<MessageDestinationComponent>(); 1655 for (MessageDestinationComponent i : destination) 1656 dst.destination.add(i.copy()); 1657 }; 1658 dst.enterer = enterer == null ? null : enterer.copy(); 1659 dst.author = author == null ? null : author.copy(); 1660 dst.receiver = receiver == null ? null : receiver.copy(); 1661 dst.responsible = responsible == null ? null : responsible.copy(); 1662 dst.reason = reason == null ? null : reason.copy(); 1663 if (data != null) { 1664 dst.data = new ArrayList<Reference>(); 1665 for (Reference i : data) 1666 dst.data.add(i.copy()); 1667 }; 1668 return dst; 1669 } 1670 1671 protected MessageHeader typedCopy() { 1672 return copy(); 1673 } 1674 1675 @Override 1676 public boolean equalsDeep(Base other) { 1677 if (!super.equalsDeep(other)) 1678 return false; 1679 if (!(other instanceof MessageHeader)) 1680 return false; 1681 MessageHeader o = (MessageHeader) other; 1682 return compareDeep(timestamp, o.timestamp, true) && compareDeep(event, o.event, true) && compareDeep(response, o.response, true) 1683 && compareDeep(source, o.source, true) && compareDeep(destination, o.destination, true) && compareDeep(enterer, o.enterer, true) 1684 && compareDeep(author, o.author, true) && compareDeep(receiver, o.receiver, true) && compareDeep(responsible, o.responsible, true) 1685 && compareDeep(reason, o.reason, true) && compareDeep(data, o.data, true); 1686 } 1687 1688 @Override 1689 public boolean equalsShallow(Base other) { 1690 if (!super.equalsShallow(other)) 1691 return false; 1692 if (!(other instanceof MessageHeader)) 1693 return false; 1694 MessageHeader o = (MessageHeader) other; 1695 return compareValues(timestamp, o.timestamp, true); 1696 } 1697 1698 public boolean isEmpty() { 1699 return super.isEmpty() && (timestamp == null || timestamp.isEmpty()) && (event == null || event.isEmpty()) 1700 && (response == null || response.isEmpty()) && (source == null || source.isEmpty()) && (destination == null || destination.isEmpty()) 1701 && (enterer == null || enterer.isEmpty()) && (author == null || author.isEmpty()) && (receiver == null || receiver.isEmpty()) 1702 && (responsible == null || responsible.isEmpty()) && (reason == null || reason.isEmpty()) 1703 && (data == null || data.isEmpty()); 1704 } 1705 1706 @Override 1707 public ResourceType getResourceType() { 1708 return ResourceType.MessageHeader; 1709 } 1710 1711 @SearchParamDefinition(name="code", path="MessageHeader.response.code", description="ok | transient-error | fatal-error", type="token" ) 1712 public static final String SP_CODE = "code"; 1713 @SearchParamDefinition(name="data", path="MessageHeader.data", description="The actual content of the message", type="reference" ) 1714 public static final String SP_DATA = "data"; 1715 @SearchParamDefinition(name="receiver", path="MessageHeader.receiver", description="Intended \"real-world\" recipient for the data", type="reference" ) 1716 public static final String SP_RECEIVER = "receiver"; 1717 @SearchParamDefinition(name="author", path="MessageHeader.author", description="The source of the decision", type="reference" ) 1718 public static final String SP_AUTHOR = "author"; 1719 @SearchParamDefinition(name="destination", path="MessageHeader.destination.name", description="Name of system", type="string" ) 1720 public static final String SP_DESTINATION = "destination"; 1721 @SearchParamDefinition(name="source", path="MessageHeader.source.name", description="Name of system", type="string" ) 1722 public static final String SP_SOURCE = "source"; 1723 @SearchParamDefinition(name="target", path="MessageHeader.destination.target", description="Particular delivery destination within the destination", type="reference" ) 1724 public static final String SP_TARGET = "target"; 1725 @SearchParamDefinition(name="destination-uri", path="MessageHeader.destination.endpoint", description="Actual destination address or id", type="uri" ) 1726 public static final String SP_DESTINATIONURI = "destination-uri"; 1727 @SearchParamDefinition(name="source-uri", path="MessageHeader.source.endpoint", description="Actual message source address or id", type="uri" ) 1728 public static final String SP_SOURCEURI = "source-uri"; 1729 @SearchParamDefinition(name="responsible", path="MessageHeader.responsible", description="Final responsibility for event", type="reference" ) 1730 public static final String SP_RESPONSIBLE = "responsible"; 1731 @SearchParamDefinition(name="response-id", path="MessageHeader.response.identifier", description="Id of original message", type="token" ) 1732 public static final String SP_RESPONSEID = "response-id"; 1733 @SearchParamDefinition(name="enterer", path="MessageHeader.enterer", description="The source of the data entry", type="reference" ) 1734 public static final String SP_ENTERER = "enterer"; 1735 @SearchParamDefinition(name="event", path="MessageHeader.event", description="Code for the event this message represents", type="token" ) 1736 public static final String SP_EVENT = "event"; 1737 @SearchParamDefinition(name="timestamp", path="MessageHeader.timestamp", description="Time that the message was sent", type="date" ) 1738 public static final String SP_TIMESTAMP = "timestamp"; 1739 1740}