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