001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 042 043import ca.uhn.fhir.model.api.annotation.Block; 044import ca.uhn.fhir.model.api.annotation.Child; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.ResourceDef; 047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 048/** 049 * An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health agency was notified about a reportable condition. 050 */ 051@ResourceDef(name="Communication", profile="http://hl7.org/fhir/Profile/Communication") 052public class Communication extends DomainResource { 053 054 public enum CommunicationStatus { 055 /** 056 * The communication transmission is ongoing. 057 */ 058 INPROGRESS, 059 /** 060 * The message transmission is complete, i.e., delivered to the recipient's destination. 061 */ 062 COMPLETED, 063 /** 064 * The communication transmission has been held by originating system/user request. 065 */ 066 SUSPENDED, 067 /** 068 * The receiving system has declined to accept the message. 069 */ 070 REJECTED, 071 /** 072 * There was a failure in transmitting the message out. 073 */ 074 FAILED, 075 /** 076 * added to help the parsers 077 */ 078 NULL; 079 public static CommunicationStatus fromCode(String codeString) throws FHIRException { 080 if (codeString == null || "".equals(codeString)) 081 return null; 082 if ("in-progress".equals(codeString)) 083 return INPROGRESS; 084 if ("completed".equals(codeString)) 085 return COMPLETED; 086 if ("suspended".equals(codeString)) 087 return SUSPENDED; 088 if ("rejected".equals(codeString)) 089 return REJECTED; 090 if ("failed".equals(codeString)) 091 return FAILED; 092 throw new FHIRException("Unknown CommunicationStatus code '"+codeString+"'"); 093 } 094 public String toCode() { 095 switch (this) { 096 case INPROGRESS: return "in-progress"; 097 case COMPLETED: return "completed"; 098 case SUSPENDED: return "suspended"; 099 case REJECTED: return "rejected"; 100 case FAILED: return "failed"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 public String getSystem() { 106 switch (this) { 107 case INPROGRESS: return "http://hl7.org/fhir/communication-status"; 108 case COMPLETED: return "http://hl7.org/fhir/communication-status"; 109 case SUSPENDED: return "http://hl7.org/fhir/communication-status"; 110 case REJECTED: return "http://hl7.org/fhir/communication-status"; 111 case FAILED: return "http://hl7.org/fhir/communication-status"; 112 case NULL: return null; 113 default: return "?"; 114 } 115 } 116 public String getDefinition() { 117 switch (this) { 118 case INPROGRESS: return "The communication transmission is ongoing."; 119 case COMPLETED: return "The message transmission is complete, i.e., delivered to the recipient's destination."; 120 case SUSPENDED: return "The communication transmission has been held by originating system/user request."; 121 case REJECTED: return "The receiving system has declined to accept the message."; 122 case FAILED: return "There was a failure in transmitting the message out."; 123 case NULL: return null; 124 default: return "?"; 125 } 126 } 127 public String getDisplay() { 128 switch (this) { 129 case INPROGRESS: return "In Progress"; 130 case COMPLETED: return "Completed"; 131 case SUSPENDED: return "Suspended"; 132 case REJECTED: return "Rejected"; 133 case FAILED: return "Failed"; 134 case NULL: return null; 135 default: return "?"; 136 } 137 } 138 } 139 140 public static class CommunicationStatusEnumFactory implements EnumFactory<CommunicationStatus> { 141 public CommunicationStatus fromCode(String codeString) throws IllegalArgumentException { 142 if (codeString == null || "".equals(codeString)) 143 if (codeString == null || "".equals(codeString)) 144 return null; 145 if ("in-progress".equals(codeString)) 146 return CommunicationStatus.INPROGRESS; 147 if ("completed".equals(codeString)) 148 return CommunicationStatus.COMPLETED; 149 if ("suspended".equals(codeString)) 150 return CommunicationStatus.SUSPENDED; 151 if ("rejected".equals(codeString)) 152 return CommunicationStatus.REJECTED; 153 if ("failed".equals(codeString)) 154 return CommunicationStatus.FAILED; 155 throw new IllegalArgumentException("Unknown CommunicationStatus code '"+codeString+"'"); 156 } 157 public Enumeration<CommunicationStatus> fromType(Base code) throws FHIRException { 158 if (code == null || code.isEmpty()) 159 return null; 160 String codeString = ((PrimitiveType) code).asStringValue(); 161 if (codeString == null || "".equals(codeString)) 162 return null; 163 if ("in-progress".equals(codeString)) 164 return new Enumeration<CommunicationStatus>(this, CommunicationStatus.INPROGRESS); 165 if ("completed".equals(codeString)) 166 return new Enumeration<CommunicationStatus>(this, CommunicationStatus.COMPLETED); 167 if ("suspended".equals(codeString)) 168 return new Enumeration<CommunicationStatus>(this, CommunicationStatus.SUSPENDED); 169 if ("rejected".equals(codeString)) 170 return new Enumeration<CommunicationStatus>(this, CommunicationStatus.REJECTED); 171 if ("failed".equals(codeString)) 172 return new Enumeration<CommunicationStatus>(this, CommunicationStatus.FAILED); 173 throw new FHIRException("Unknown CommunicationStatus code '"+codeString+"'"); 174 } 175 public String toCode(CommunicationStatus code) { 176 if (code == CommunicationStatus.INPROGRESS) 177 return "in-progress"; 178 if (code == CommunicationStatus.COMPLETED) 179 return "completed"; 180 if (code == CommunicationStatus.SUSPENDED) 181 return "suspended"; 182 if (code == CommunicationStatus.REJECTED) 183 return "rejected"; 184 if (code == CommunicationStatus.FAILED) 185 return "failed"; 186 return "?"; 187 } 188 public String toSystem(CommunicationStatus code) { 189 return code.getSystem(); 190 } 191 } 192 193 @Block() 194 public static class CommunicationPayloadComponent extends BackboneElement implements IBaseBackboneElement { 195 /** 196 * A communicated content (or for multi-part communications, one portion of the communication). 197 */ 198 @Child(name = "content", type = {StringType.class, Attachment.class}, order=1, min=1, max=1, modifier=false, summary=true) 199 @Description(shortDefinition="Message part content", formalDefinition="A communicated content (or for multi-part communications, one portion of the communication)." ) 200 protected Type content; 201 202 private static final long serialVersionUID = -1763459053L; 203 204 /** 205 * Constructor 206 */ 207 public CommunicationPayloadComponent() { 208 super(); 209 } 210 211 /** 212 * Constructor 213 */ 214 public CommunicationPayloadComponent(Type content) { 215 super(); 216 this.content = content; 217 } 218 219 /** 220 * @return {@link #content} (A communicated content (or for multi-part communications, one portion of the communication).) 221 */ 222 public Type getContent() { 223 return this.content; 224 } 225 226 /** 227 * @return {@link #content} (A communicated content (or for multi-part communications, one portion of the communication).) 228 */ 229 public StringType getContentStringType() throws FHIRException { 230 if (!(this.content instanceof StringType)) 231 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.content.getClass().getName()+" was encountered"); 232 return (StringType) this.content; 233 } 234 235 public boolean hasContentStringType() { 236 return this.content instanceof StringType; 237 } 238 239 /** 240 * @return {@link #content} (A communicated content (or for multi-part communications, one portion of the communication).) 241 */ 242 public Attachment getContentAttachment() throws FHIRException { 243 if (!(this.content instanceof Attachment)) 244 throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.content.getClass().getName()+" was encountered"); 245 return (Attachment) this.content; 246 } 247 248 public boolean hasContentAttachment() { 249 return this.content instanceof Attachment; 250 } 251 252 /** 253 * @return {@link #content} (A communicated content (or for multi-part communications, one portion of the communication).) 254 */ 255 public Reference getContentReference() throws FHIRException { 256 if (!(this.content instanceof Reference)) 257 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.content.getClass().getName()+" was encountered"); 258 return (Reference) this.content; 259 } 260 261 public boolean hasContentReference() { 262 return this.content instanceof Reference; 263 } 264 265 public boolean hasContent() { 266 return this.content != null && !this.content.isEmpty(); 267 } 268 269 /** 270 * @param value {@link #content} (A communicated content (or for multi-part communications, one portion of the communication).) 271 */ 272 public CommunicationPayloadComponent setContent(Type value) { 273 this.content = value; 274 return this; 275 } 276 277 protected void listChildren(List<Property> childrenList) { 278 super.listChildren(childrenList); 279 childrenList.add(new Property("content[x]", "string|Attachment|Reference(Any)", "A communicated content (or for multi-part communications, one portion of the communication).", 0, java.lang.Integer.MAX_VALUE, content)); 280 } 281 282 @Override 283 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 284 switch (hash) { 285 case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Type 286 default: return super.getProperty(hash, name, checkValid); 287 } 288 289 } 290 291 @Override 292 public void setProperty(int hash, String name, Base value) throws FHIRException { 293 switch (hash) { 294 case 951530617: // content 295 this.content = (Type) value; // Type 296 break; 297 default: super.setProperty(hash, name, value); 298 } 299 300 } 301 302 @Override 303 public void setProperty(String name, Base value) throws FHIRException { 304 if (name.equals("content[x]")) 305 this.content = (Type) value; // Type 306 else 307 super.setProperty(name, value); 308 } 309 310 @Override 311 public Base makeProperty(int hash, String name) throws FHIRException { 312 switch (hash) { 313 case 264548711: return getContent(); // Type 314 default: return super.makeProperty(hash, name); 315 } 316 317 } 318 319 @Override 320 public Base addChild(String name) throws FHIRException { 321 if (name.equals("contentString")) { 322 this.content = new StringType(); 323 return this.content; 324 } 325 else if (name.equals("contentAttachment")) { 326 this.content = new Attachment(); 327 return this.content; 328 } 329 else if (name.equals("contentReference")) { 330 this.content = new Reference(); 331 return this.content; 332 } 333 else 334 return super.addChild(name); 335 } 336 337 public CommunicationPayloadComponent copy() { 338 CommunicationPayloadComponent dst = new CommunicationPayloadComponent(); 339 copyValues(dst); 340 dst.content = content == null ? null : content.copy(); 341 return dst; 342 } 343 344 @Override 345 public boolean equalsDeep(Base other) { 346 if (!super.equalsDeep(other)) 347 return false; 348 if (!(other instanceof CommunicationPayloadComponent)) 349 return false; 350 CommunicationPayloadComponent o = (CommunicationPayloadComponent) other; 351 return compareDeep(content, o.content, true); 352 } 353 354 @Override 355 public boolean equalsShallow(Base other) { 356 if (!super.equalsShallow(other)) 357 return false; 358 if (!(other instanceof CommunicationPayloadComponent)) 359 return false; 360 CommunicationPayloadComponent o = (CommunicationPayloadComponent) other; 361 return true; 362 } 363 364 public boolean isEmpty() { 365 return super.isEmpty() && (content == null || content.isEmpty()); 366 } 367 368 public String fhirType() { 369 return "Communication.payload"; 370 371 } 372 373 } 374 375 /** 376 * Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation). 377 */ 378 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 379 @Description(shortDefinition="Unique identifier", formalDefinition="Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." ) 380 protected List<Identifier> identifier; 381 382 /** 383 * The type of message conveyed such as alert, notification, reminder, instruction, etc. 384 */ 385 @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 386 @Description(shortDefinition="Message category", formalDefinition="The type of message conveyed such as alert, notification, reminder, instruction, etc." ) 387 protected CodeableConcept category; 388 389 /** 390 * The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication. 391 */ 392 @Child(name = "sender", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=2, min=0, max=1, modifier=false, summary=true) 393 @Description(shortDefinition="Message sender", formalDefinition="The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication." ) 394 protected Reference sender; 395 396 /** 397 * The actual object that is the target of the reference (The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.) 398 */ 399 protected Resource senderTarget; 400 401 /** 402 * The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time). 403 */ 404 @Child(name = "recipient", type = {Device.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Group.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 405 @Description(shortDefinition="Message recipient", formalDefinition="The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time)." ) 406 protected List<Reference> recipient; 407 /** 408 * The actual objects that are the target of the reference (The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).) 409 */ 410 protected List<Resource> recipientTarget; 411 412 413 /** 414 * Text, attachment(s), or resource(s) that was communicated to the recipient. 415 */ 416 @Child(name = "payload", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 417 @Description(shortDefinition="Message payload", formalDefinition="Text, attachment(s), or resource(s) that was communicated to the recipient." ) 418 protected List<CommunicationPayloadComponent> payload; 419 420 /** 421 * A channel that was used for this communication (e.g. email, fax). 422 */ 423 @Child(name = "medium", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 424 @Description(shortDefinition="A channel of communication", formalDefinition="A channel that was used for this communication (e.g. email, fax)." ) 425 protected List<CodeableConcept> medium; 426 427 /** 428 * The status of the transmission. 429 */ 430 @Child(name = "status", type = {CodeType.class}, order=6, min=0, max=1, modifier=true, summary=true) 431 @Description(shortDefinition="in-progress | completed | suspended | rejected | failed", formalDefinition="The status of the transmission." ) 432 protected Enumeration<CommunicationStatus> status; 433 434 /** 435 * The encounter within which the communication was sent. 436 */ 437 @Child(name = "encounter", type = {Encounter.class}, order=7, min=0, max=1, modifier=false, summary=true) 438 @Description(shortDefinition="Encounter leading to message", formalDefinition="The encounter within which the communication was sent." ) 439 protected Reference encounter; 440 441 /** 442 * The actual object that is the target of the reference (The encounter within which the communication was sent.) 443 */ 444 protected Encounter encounterTarget; 445 446 /** 447 * The time when this communication was sent. 448 */ 449 @Child(name = "sent", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true) 450 @Description(shortDefinition="When sent", formalDefinition="The time when this communication was sent." ) 451 protected DateTimeType sent; 452 453 /** 454 * The time when this communication arrived at the destination. 455 */ 456 @Child(name = "received", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true) 457 @Description(shortDefinition="When received", formalDefinition="The time when this communication arrived at the destination." ) 458 protected DateTimeType received; 459 460 /** 461 * The reason or justification for the communication. 462 */ 463 @Child(name = "reason", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 464 @Description(shortDefinition="Indication for message", formalDefinition="The reason or justification for the communication." ) 465 protected List<CodeableConcept> reason; 466 467 /** 468 * The patient who was the focus of this communication. 469 */ 470 @Child(name = "subject", type = {Patient.class}, order=11, min=0, max=1, modifier=false, summary=true) 471 @Description(shortDefinition="Focus of message", formalDefinition="The patient who was the focus of this communication." ) 472 protected Reference subject; 473 474 /** 475 * The actual object that is the target of the reference (The patient who was the focus of this communication.) 476 */ 477 protected Patient subjectTarget; 478 479 /** 480 * The communication request that was responsible for producing this communication. 481 */ 482 @Child(name = "requestDetail", type = {CommunicationRequest.class}, order=12, min=0, max=1, modifier=false, summary=true) 483 @Description(shortDefinition="CommunicationRequest producing this message", formalDefinition="The communication request that was responsible for producing this communication." ) 484 protected Reference requestDetail; 485 486 /** 487 * The actual object that is the target of the reference (The communication request that was responsible for producing this communication.) 488 */ 489 protected CommunicationRequest requestDetailTarget; 490 491 private static final long serialVersionUID = -1654449146L; 492 493 /** 494 * Constructor 495 */ 496 public Communication() { 497 super(); 498 } 499 500 /** 501 * @return {@link #identifier} (Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 502 */ 503 public List<Identifier> getIdentifier() { 504 if (this.identifier == null) 505 this.identifier = new ArrayList<Identifier>(); 506 return this.identifier; 507 } 508 509 public boolean hasIdentifier() { 510 if (this.identifier == null) 511 return false; 512 for (Identifier item : this.identifier) 513 if (!item.isEmpty()) 514 return true; 515 return false; 516 } 517 518 /** 519 * @return {@link #identifier} (Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 520 */ 521 // syntactic sugar 522 public Identifier addIdentifier() { //3 523 Identifier t = new Identifier(); 524 if (this.identifier == null) 525 this.identifier = new ArrayList<Identifier>(); 526 this.identifier.add(t); 527 return t; 528 } 529 530 // syntactic sugar 531 public Communication addIdentifier(Identifier t) { //3 532 if (t == null) 533 return this; 534 if (this.identifier == null) 535 this.identifier = new ArrayList<Identifier>(); 536 this.identifier.add(t); 537 return this; 538 } 539 540 /** 541 * @return {@link #category} (The type of message conveyed such as alert, notification, reminder, instruction, etc.) 542 */ 543 public CodeableConcept getCategory() { 544 if (this.category == null) 545 if (Configuration.errorOnAutoCreate()) 546 throw new Error("Attempt to auto-create Communication.category"); 547 else if (Configuration.doAutoCreate()) 548 this.category = new CodeableConcept(); // cc 549 return this.category; 550 } 551 552 public boolean hasCategory() { 553 return this.category != null && !this.category.isEmpty(); 554 } 555 556 /** 557 * @param value {@link #category} (The type of message conveyed such as alert, notification, reminder, instruction, etc.) 558 */ 559 public Communication setCategory(CodeableConcept value) { 560 this.category = value; 561 return this; 562 } 563 564 /** 565 * @return {@link #sender} (The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.) 566 */ 567 public Reference getSender() { 568 if (this.sender == null) 569 if (Configuration.errorOnAutoCreate()) 570 throw new Error("Attempt to auto-create Communication.sender"); 571 else if (Configuration.doAutoCreate()) 572 this.sender = new Reference(); // cc 573 return this.sender; 574 } 575 576 public boolean hasSender() { 577 return this.sender != null && !this.sender.isEmpty(); 578 } 579 580 /** 581 * @param value {@link #sender} (The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.) 582 */ 583 public Communication setSender(Reference value) { 584 this.sender = value; 585 return this; 586 } 587 588 /** 589 * @return {@link #sender} 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 entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.) 590 */ 591 public Resource getSenderTarget() { 592 return this.senderTarget; 593 } 594 595 /** 596 * @param value {@link #sender} 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 entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.) 597 */ 598 public Communication setSenderTarget(Resource value) { 599 this.senderTarget = value; 600 return this; 601 } 602 603 /** 604 * @return {@link #recipient} (The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).) 605 */ 606 public List<Reference> getRecipient() { 607 if (this.recipient == null) 608 this.recipient = new ArrayList<Reference>(); 609 return this.recipient; 610 } 611 612 public boolean hasRecipient() { 613 if (this.recipient == null) 614 return false; 615 for (Reference item : this.recipient) 616 if (!item.isEmpty()) 617 return true; 618 return false; 619 } 620 621 /** 622 * @return {@link #recipient} (The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).) 623 */ 624 // syntactic sugar 625 public Reference addRecipient() { //3 626 Reference t = new Reference(); 627 if (this.recipient == null) 628 this.recipient = new ArrayList<Reference>(); 629 this.recipient.add(t); 630 return t; 631 } 632 633 // syntactic sugar 634 public Communication addRecipient(Reference t) { //3 635 if (t == null) 636 return this; 637 if (this.recipient == null) 638 this.recipient = new ArrayList<Reference>(); 639 this.recipient.add(t); 640 return this; 641 } 642 643 /** 644 * @return {@link #recipient} (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 entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).) 645 */ 646 public List<Resource> getRecipientTarget() { 647 if (this.recipientTarget == null) 648 this.recipientTarget = new ArrayList<Resource>(); 649 return this.recipientTarget; 650 } 651 652 /** 653 * @return {@link #payload} (Text, attachment(s), or resource(s) that was communicated to the recipient.) 654 */ 655 public List<CommunicationPayloadComponent> getPayload() { 656 if (this.payload == null) 657 this.payload = new ArrayList<CommunicationPayloadComponent>(); 658 return this.payload; 659 } 660 661 public boolean hasPayload() { 662 if (this.payload == null) 663 return false; 664 for (CommunicationPayloadComponent item : this.payload) 665 if (!item.isEmpty()) 666 return true; 667 return false; 668 } 669 670 /** 671 * @return {@link #payload} (Text, attachment(s), or resource(s) that was communicated to the recipient.) 672 */ 673 // syntactic sugar 674 public CommunicationPayloadComponent addPayload() { //3 675 CommunicationPayloadComponent t = new CommunicationPayloadComponent(); 676 if (this.payload == null) 677 this.payload = new ArrayList<CommunicationPayloadComponent>(); 678 this.payload.add(t); 679 return t; 680 } 681 682 // syntactic sugar 683 public Communication addPayload(CommunicationPayloadComponent t) { //3 684 if (t == null) 685 return this; 686 if (this.payload == null) 687 this.payload = new ArrayList<CommunicationPayloadComponent>(); 688 this.payload.add(t); 689 return this; 690 } 691 692 /** 693 * @return {@link #medium} (A channel that was used for this communication (e.g. email, fax).) 694 */ 695 public List<CodeableConcept> getMedium() { 696 if (this.medium == null) 697 this.medium = new ArrayList<CodeableConcept>(); 698 return this.medium; 699 } 700 701 public boolean hasMedium() { 702 if (this.medium == null) 703 return false; 704 for (CodeableConcept item : this.medium) 705 if (!item.isEmpty()) 706 return true; 707 return false; 708 } 709 710 /** 711 * @return {@link #medium} (A channel that was used for this communication (e.g. email, fax).) 712 */ 713 // syntactic sugar 714 public CodeableConcept addMedium() { //3 715 CodeableConcept t = new CodeableConcept(); 716 if (this.medium == null) 717 this.medium = new ArrayList<CodeableConcept>(); 718 this.medium.add(t); 719 return t; 720 } 721 722 // syntactic sugar 723 public Communication addMedium(CodeableConcept t) { //3 724 if (t == null) 725 return this; 726 if (this.medium == null) 727 this.medium = new ArrayList<CodeableConcept>(); 728 this.medium.add(t); 729 return this; 730 } 731 732 /** 733 * @return {@link #status} (The status of the transmission.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 734 */ 735 public Enumeration<CommunicationStatus> getStatusElement() { 736 if (this.status == null) 737 if (Configuration.errorOnAutoCreate()) 738 throw new Error("Attempt to auto-create Communication.status"); 739 else if (Configuration.doAutoCreate()) 740 this.status = new Enumeration<CommunicationStatus>(new CommunicationStatusEnumFactory()); // bb 741 return this.status; 742 } 743 744 public boolean hasStatusElement() { 745 return this.status != null && !this.status.isEmpty(); 746 } 747 748 public boolean hasStatus() { 749 return this.status != null && !this.status.isEmpty(); 750 } 751 752 /** 753 * @param value {@link #status} (The status of the transmission.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 754 */ 755 public Communication setStatusElement(Enumeration<CommunicationStatus> value) { 756 this.status = value; 757 return this; 758 } 759 760 /** 761 * @return The status of the transmission. 762 */ 763 public CommunicationStatus getStatus() { 764 return this.status == null ? null : this.status.getValue(); 765 } 766 767 /** 768 * @param value The status of the transmission. 769 */ 770 public Communication setStatus(CommunicationStatus value) { 771 if (value == null) 772 this.status = null; 773 else { 774 if (this.status == null) 775 this.status = new Enumeration<CommunicationStatus>(new CommunicationStatusEnumFactory()); 776 this.status.setValue(value); 777 } 778 return this; 779 } 780 781 /** 782 * @return {@link #encounter} (The encounter within which the communication was sent.) 783 */ 784 public Reference getEncounter() { 785 if (this.encounter == null) 786 if (Configuration.errorOnAutoCreate()) 787 throw new Error("Attempt to auto-create Communication.encounter"); 788 else if (Configuration.doAutoCreate()) 789 this.encounter = new Reference(); // cc 790 return this.encounter; 791 } 792 793 public boolean hasEncounter() { 794 return this.encounter != null && !this.encounter.isEmpty(); 795 } 796 797 /** 798 * @param value {@link #encounter} (The encounter within which the communication was sent.) 799 */ 800 public Communication setEncounter(Reference value) { 801 this.encounter = value; 802 return this; 803 } 804 805 /** 806 * @return {@link #encounter} 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 encounter within which the communication was sent.) 807 */ 808 public Encounter getEncounterTarget() { 809 if (this.encounterTarget == null) 810 if (Configuration.errorOnAutoCreate()) 811 throw new Error("Attempt to auto-create Communication.encounter"); 812 else if (Configuration.doAutoCreate()) 813 this.encounterTarget = new Encounter(); // aa 814 return this.encounterTarget; 815 } 816 817 /** 818 * @param value {@link #encounter} 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 encounter within which the communication was sent.) 819 */ 820 public Communication setEncounterTarget(Encounter value) { 821 this.encounterTarget = value; 822 return this; 823 } 824 825 /** 826 * @return {@link #sent} (The time when this communication was sent.). This is the underlying object with id, value and extensions. The accessor "getSent" gives direct access to the value 827 */ 828 public DateTimeType getSentElement() { 829 if (this.sent == null) 830 if (Configuration.errorOnAutoCreate()) 831 throw new Error("Attempt to auto-create Communication.sent"); 832 else if (Configuration.doAutoCreate()) 833 this.sent = new DateTimeType(); // bb 834 return this.sent; 835 } 836 837 public boolean hasSentElement() { 838 return this.sent != null && !this.sent.isEmpty(); 839 } 840 841 public boolean hasSent() { 842 return this.sent != null && !this.sent.isEmpty(); 843 } 844 845 /** 846 * @param value {@link #sent} (The time when this communication was sent.). This is the underlying object with id, value and extensions. The accessor "getSent" gives direct access to the value 847 */ 848 public Communication setSentElement(DateTimeType value) { 849 this.sent = value; 850 return this; 851 } 852 853 /** 854 * @return The time when this communication was sent. 855 */ 856 public Date getSent() { 857 return this.sent == null ? null : this.sent.getValue(); 858 } 859 860 /** 861 * @param value The time when this communication was sent. 862 */ 863 public Communication setSent(Date value) { 864 if (value == null) 865 this.sent = null; 866 else { 867 if (this.sent == null) 868 this.sent = new DateTimeType(); 869 this.sent.setValue(value); 870 } 871 return this; 872 } 873 874 /** 875 * @return {@link #received} (The time when this communication arrived at the destination.). This is the underlying object with id, value and extensions. The accessor "getReceived" gives direct access to the value 876 */ 877 public DateTimeType getReceivedElement() { 878 if (this.received == null) 879 if (Configuration.errorOnAutoCreate()) 880 throw new Error("Attempt to auto-create Communication.received"); 881 else if (Configuration.doAutoCreate()) 882 this.received = new DateTimeType(); // bb 883 return this.received; 884 } 885 886 public boolean hasReceivedElement() { 887 return this.received != null && !this.received.isEmpty(); 888 } 889 890 public boolean hasReceived() { 891 return this.received != null && !this.received.isEmpty(); 892 } 893 894 /** 895 * @param value {@link #received} (The time when this communication arrived at the destination.). This is the underlying object with id, value and extensions. The accessor "getReceived" gives direct access to the value 896 */ 897 public Communication setReceivedElement(DateTimeType value) { 898 this.received = value; 899 return this; 900 } 901 902 /** 903 * @return The time when this communication arrived at the destination. 904 */ 905 public Date getReceived() { 906 return this.received == null ? null : this.received.getValue(); 907 } 908 909 /** 910 * @param value The time when this communication arrived at the destination. 911 */ 912 public Communication setReceived(Date value) { 913 if (value == null) 914 this.received = null; 915 else { 916 if (this.received == null) 917 this.received = new DateTimeType(); 918 this.received.setValue(value); 919 } 920 return this; 921 } 922 923 /** 924 * @return {@link #reason} (The reason or justification for the communication.) 925 */ 926 public List<CodeableConcept> getReason() { 927 if (this.reason == null) 928 this.reason = new ArrayList<CodeableConcept>(); 929 return this.reason; 930 } 931 932 public boolean hasReason() { 933 if (this.reason == null) 934 return false; 935 for (CodeableConcept item : this.reason) 936 if (!item.isEmpty()) 937 return true; 938 return false; 939 } 940 941 /** 942 * @return {@link #reason} (The reason or justification for the communication.) 943 */ 944 // syntactic sugar 945 public CodeableConcept addReason() { //3 946 CodeableConcept t = new CodeableConcept(); 947 if (this.reason == null) 948 this.reason = new ArrayList<CodeableConcept>(); 949 this.reason.add(t); 950 return t; 951 } 952 953 // syntactic sugar 954 public Communication addReason(CodeableConcept t) { //3 955 if (t == null) 956 return this; 957 if (this.reason == null) 958 this.reason = new ArrayList<CodeableConcept>(); 959 this.reason.add(t); 960 return this; 961 } 962 963 /** 964 * @return {@link #subject} (The patient who was the focus of this communication.) 965 */ 966 public Reference getSubject() { 967 if (this.subject == null) 968 if (Configuration.errorOnAutoCreate()) 969 throw new Error("Attempt to auto-create Communication.subject"); 970 else if (Configuration.doAutoCreate()) 971 this.subject = new Reference(); // cc 972 return this.subject; 973 } 974 975 public boolean hasSubject() { 976 return this.subject != null && !this.subject.isEmpty(); 977 } 978 979 /** 980 * @param value {@link #subject} (The patient who was the focus of this communication.) 981 */ 982 public Communication setSubject(Reference value) { 983 this.subject = value; 984 return this; 985 } 986 987 /** 988 * @return {@link #subject} 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 patient who was the focus of this communication.) 989 */ 990 public Patient getSubjectTarget() { 991 if (this.subjectTarget == null) 992 if (Configuration.errorOnAutoCreate()) 993 throw new Error("Attempt to auto-create Communication.subject"); 994 else if (Configuration.doAutoCreate()) 995 this.subjectTarget = new Patient(); // aa 996 return this.subjectTarget; 997 } 998 999 /** 1000 * @param value {@link #subject} 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 patient who was the focus of this communication.) 1001 */ 1002 public Communication setSubjectTarget(Patient value) { 1003 this.subjectTarget = value; 1004 return this; 1005 } 1006 1007 /** 1008 * @return {@link #requestDetail} (The communication request that was responsible for producing this communication.) 1009 */ 1010 public Reference getRequestDetail() { 1011 if (this.requestDetail == null) 1012 if (Configuration.errorOnAutoCreate()) 1013 throw new Error("Attempt to auto-create Communication.requestDetail"); 1014 else if (Configuration.doAutoCreate()) 1015 this.requestDetail = new Reference(); // cc 1016 return this.requestDetail; 1017 } 1018 1019 public boolean hasRequestDetail() { 1020 return this.requestDetail != null && !this.requestDetail.isEmpty(); 1021 } 1022 1023 /** 1024 * @param value {@link #requestDetail} (The communication request that was responsible for producing this communication.) 1025 */ 1026 public Communication setRequestDetail(Reference value) { 1027 this.requestDetail = value; 1028 return this; 1029 } 1030 1031 /** 1032 * @return {@link #requestDetail} 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 communication request that was responsible for producing this communication.) 1033 */ 1034 public CommunicationRequest getRequestDetailTarget() { 1035 if (this.requestDetailTarget == null) 1036 if (Configuration.errorOnAutoCreate()) 1037 throw new Error("Attempt to auto-create Communication.requestDetail"); 1038 else if (Configuration.doAutoCreate()) 1039 this.requestDetailTarget = new CommunicationRequest(); // aa 1040 return this.requestDetailTarget; 1041 } 1042 1043 /** 1044 * @param value {@link #requestDetail} 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 communication request that was responsible for producing this communication.) 1045 */ 1046 public Communication setRequestDetailTarget(CommunicationRequest value) { 1047 this.requestDetailTarget = value; 1048 return this; 1049 } 1050 1051 protected void listChildren(List<Property> childrenList) { 1052 super.listChildren(childrenList); 1053 childrenList.add(new Property("identifier", "Identifier", "Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier)); 1054 childrenList.add(new Property("category", "CodeableConcept", "The type of message conveyed such as alert, notification, reminder, instruction, etc.", 0, java.lang.Integer.MAX_VALUE, category)); 1055 childrenList.add(new Property("sender", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson)", "The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.", 0, java.lang.Integer.MAX_VALUE, sender)); 1056 childrenList.add(new Property("recipient", "Reference(Device|Organization|Patient|Practitioner|RelatedPerson|Group)", "The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient. Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).", 0, java.lang.Integer.MAX_VALUE, recipient)); 1057 childrenList.add(new Property("payload", "", "Text, attachment(s), or resource(s) that was communicated to the recipient.", 0, java.lang.Integer.MAX_VALUE, payload)); 1058 childrenList.add(new Property("medium", "CodeableConcept", "A channel that was used for this communication (e.g. email, fax).", 0, java.lang.Integer.MAX_VALUE, medium)); 1059 childrenList.add(new Property("status", "code", "The status of the transmission.", 0, java.lang.Integer.MAX_VALUE, status)); 1060 childrenList.add(new Property("encounter", "Reference(Encounter)", "The encounter within which the communication was sent.", 0, java.lang.Integer.MAX_VALUE, encounter)); 1061 childrenList.add(new Property("sent", "dateTime", "The time when this communication was sent.", 0, java.lang.Integer.MAX_VALUE, sent)); 1062 childrenList.add(new Property("received", "dateTime", "The time when this communication arrived at the destination.", 0, java.lang.Integer.MAX_VALUE, received)); 1063 childrenList.add(new Property("reason", "CodeableConcept", "The reason or justification for the communication.", 0, java.lang.Integer.MAX_VALUE, reason)); 1064 childrenList.add(new Property("subject", "Reference(Patient)", "The patient who was the focus of this communication.", 0, java.lang.Integer.MAX_VALUE, subject)); 1065 childrenList.add(new Property("requestDetail", "Reference(CommunicationRequest)", "The communication request that was responsible for producing this communication.", 0, java.lang.Integer.MAX_VALUE, requestDetail)); 1066 } 1067 1068 @Override 1069 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1070 switch (hash) { 1071 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1072 case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept 1073 case -905962955: /*sender*/ return this.sender == null ? new Base[0] : new Base[] {this.sender}; // Reference 1074 case 820081177: /*recipient*/ return this.recipient == null ? new Base[0] : this.recipient.toArray(new Base[this.recipient.size()]); // Reference 1075 case -786701938: /*payload*/ return this.payload == null ? new Base[0] : this.payload.toArray(new Base[this.payload.size()]); // CommunicationPayloadComponent 1076 case -1078030475: /*medium*/ return this.medium == null ? new Base[0] : this.medium.toArray(new Base[this.medium.size()]); // CodeableConcept 1077 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CommunicationStatus> 1078 case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference 1079 case 3526552: /*sent*/ return this.sent == null ? new Base[0] : new Base[] {this.sent}; // DateTimeType 1080 case -808719903: /*received*/ return this.received == null ? new Base[0] : new Base[] {this.received}; // DateTimeType 1081 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept 1082 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 1083 case 960204736: /*requestDetail*/ return this.requestDetail == null ? new Base[0] : new Base[] {this.requestDetail}; // Reference 1084 default: return super.getProperty(hash, name, checkValid); 1085 } 1086 1087 } 1088 1089 @Override 1090 public void setProperty(int hash, String name, Base value) throws FHIRException { 1091 switch (hash) { 1092 case -1618432855: // identifier 1093 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1094 break; 1095 case 50511102: // category 1096 this.category = castToCodeableConcept(value); // CodeableConcept 1097 break; 1098 case -905962955: // sender 1099 this.sender = castToReference(value); // Reference 1100 break; 1101 case 820081177: // recipient 1102 this.getRecipient().add(castToReference(value)); // Reference 1103 break; 1104 case -786701938: // payload 1105 this.getPayload().add((CommunicationPayloadComponent) value); // CommunicationPayloadComponent 1106 break; 1107 case -1078030475: // medium 1108 this.getMedium().add(castToCodeableConcept(value)); // CodeableConcept 1109 break; 1110 case -892481550: // status 1111 this.status = new CommunicationStatusEnumFactory().fromType(value); // Enumeration<CommunicationStatus> 1112 break; 1113 case 1524132147: // encounter 1114 this.encounter = castToReference(value); // Reference 1115 break; 1116 case 3526552: // sent 1117 this.sent = castToDateTime(value); // DateTimeType 1118 break; 1119 case -808719903: // received 1120 this.received = castToDateTime(value); // DateTimeType 1121 break; 1122 case -934964668: // reason 1123 this.getReason().add(castToCodeableConcept(value)); // CodeableConcept 1124 break; 1125 case -1867885268: // subject 1126 this.subject = castToReference(value); // Reference 1127 break; 1128 case 960204736: // requestDetail 1129 this.requestDetail = castToReference(value); // Reference 1130 break; 1131 default: super.setProperty(hash, name, value); 1132 } 1133 1134 } 1135 1136 @Override 1137 public void setProperty(String name, Base value) throws FHIRException { 1138 if (name.equals("identifier")) 1139 this.getIdentifier().add(castToIdentifier(value)); 1140 else if (name.equals("category")) 1141 this.category = castToCodeableConcept(value); // CodeableConcept 1142 else if (name.equals("sender")) 1143 this.sender = castToReference(value); // Reference 1144 else if (name.equals("recipient")) 1145 this.getRecipient().add(castToReference(value)); 1146 else if (name.equals("payload")) 1147 this.getPayload().add((CommunicationPayloadComponent) value); 1148 else if (name.equals("medium")) 1149 this.getMedium().add(castToCodeableConcept(value)); 1150 else if (name.equals("status")) 1151 this.status = new CommunicationStatusEnumFactory().fromType(value); // Enumeration<CommunicationStatus> 1152 else if (name.equals("encounter")) 1153 this.encounter = castToReference(value); // Reference 1154 else if (name.equals("sent")) 1155 this.sent = castToDateTime(value); // DateTimeType 1156 else if (name.equals("received")) 1157 this.received = castToDateTime(value); // DateTimeType 1158 else if (name.equals("reason")) 1159 this.getReason().add(castToCodeableConcept(value)); 1160 else if (name.equals("subject")) 1161 this.subject = castToReference(value); // Reference 1162 else if (name.equals("requestDetail")) 1163 this.requestDetail = castToReference(value); // Reference 1164 else 1165 super.setProperty(name, value); 1166 } 1167 1168 @Override 1169 public Base makeProperty(int hash, String name) throws FHIRException { 1170 switch (hash) { 1171 case -1618432855: return addIdentifier(); // Identifier 1172 case 50511102: return getCategory(); // CodeableConcept 1173 case -905962955: return getSender(); // Reference 1174 case 820081177: return addRecipient(); // Reference 1175 case -786701938: return addPayload(); // CommunicationPayloadComponent 1176 case -1078030475: return addMedium(); // CodeableConcept 1177 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<CommunicationStatus> 1178 case 1524132147: return getEncounter(); // Reference 1179 case 3526552: throw new FHIRException("Cannot make property sent as it is not a complex type"); // DateTimeType 1180 case -808719903: throw new FHIRException("Cannot make property received as it is not a complex type"); // DateTimeType 1181 case -934964668: return addReason(); // CodeableConcept 1182 case -1867885268: return getSubject(); // Reference 1183 case 960204736: return getRequestDetail(); // Reference 1184 default: return super.makeProperty(hash, name); 1185 } 1186 1187 } 1188 1189 @Override 1190 public Base addChild(String name) throws FHIRException { 1191 if (name.equals("identifier")) { 1192 return addIdentifier(); 1193 } 1194 else if (name.equals("category")) { 1195 this.category = new CodeableConcept(); 1196 return this.category; 1197 } 1198 else if (name.equals("sender")) { 1199 this.sender = new Reference(); 1200 return this.sender; 1201 } 1202 else if (name.equals("recipient")) { 1203 return addRecipient(); 1204 } 1205 else if (name.equals("payload")) { 1206 return addPayload(); 1207 } 1208 else if (name.equals("medium")) { 1209 return addMedium(); 1210 } 1211 else if (name.equals("status")) { 1212 throw new FHIRException("Cannot call addChild on a primitive type Communication.status"); 1213 } 1214 else if (name.equals("encounter")) { 1215 this.encounter = new Reference(); 1216 return this.encounter; 1217 } 1218 else if (name.equals("sent")) { 1219 throw new FHIRException("Cannot call addChild on a primitive type Communication.sent"); 1220 } 1221 else if (name.equals("received")) { 1222 throw new FHIRException("Cannot call addChild on a primitive type Communication.received"); 1223 } 1224 else if (name.equals("reason")) { 1225 return addReason(); 1226 } 1227 else if (name.equals("subject")) { 1228 this.subject = new Reference(); 1229 return this.subject; 1230 } 1231 else if (name.equals("requestDetail")) { 1232 this.requestDetail = new Reference(); 1233 return this.requestDetail; 1234 } 1235 else 1236 return super.addChild(name); 1237 } 1238 1239 public String fhirType() { 1240 return "Communication"; 1241 1242 } 1243 1244 public Communication copy() { 1245 Communication dst = new Communication(); 1246 copyValues(dst); 1247 if (identifier != null) { 1248 dst.identifier = new ArrayList<Identifier>(); 1249 for (Identifier i : identifier) 1250 dst.identifier.add(i.copy()); 1251 }; 1252 dst.category = category == null ? null : category.copy(); 1253 dst.sender = sender == null ? null : sender.copy(); 1254 if (recipient != null) { 1255 dst.recipient = new ArrayList<Reference>(); 1256 for (Reference i : recipient) 1257 dst.recipient.add(i.copy()); 1258 }; 1259 if (payload != null) { 1260 dst.payload = new ArrayList<CommunicationPayloadComponent>(); 1261 for (CommunicationPayloadComponent i : payload) 1262 dst.payload.add(i.copy()); 1263 }; 1264 if (medium != null) { 1265 dst.medium = new ArrayList<CodeableConcept>(); 1266 for (CodeableConcept i : medium) 1267 dst.medium.add(i.copy()); 1268 }; 1269 dst.status = status == null ? null : status.copy(); 1270 dst.encounter = encounter == null ? null : encounter.copy(); 1271 dst.sent = sent == null ? null : sent.copy(); 1272 dst.received = received == null ? null : received.copy(); 1273 if (reason != null) { 1274 dst.reason = new ArrayList<CodeableConcept>(); 1275 for (CodeableConcept i : reason) 1276 dst.reason.add(i.copy()); 1277 }; 1278 dst.subject = subject == null ? null : subject.copy(); 1279 dst.requestDetail = requestDetail == null ? null : requestDetail.copy(); 1280 return dst; 1281 } 1282 1283 protected Communication typedCopy() { 1284 return copy(); 1285 } 1286 1287 @Override 1288 public boolean equalsDeep(Base other) { 1289 if (!super.equalsDeep(other)) 1290 return false; 1291 if (!(other instanceof Communication)) 1292 return false; 1293 Communication o = (Communication) other; 1294 return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) && compareDeep(sender, o.sender, true) 1295 && compareDeep(recipient, o.recipient, true) && compareDeep(payload, o.payload, true) && compareDeep(medium, o.medium, true) 1296 && compareDeep(status, o.status, true) && compareDeep(encounter, o.encounter, true) && compareDeep(sent, o.sent, true) 1297 && compareDeep(received, o.received, true) && compareDeep(reason, o.reason, true) && compareDeep(subject, o.subject, true) 1298 && compareDeep(requestDetail, o.requestDetail, true); 1299 } 1300 1301 @Override 1302 public boolean equalsShallow(Base other) { 1303 if (!super.equalsShallow(other)) 1304 return false; 1305 if (!(other instanceof Communication)) 1306 return false; 1307 Communication o = (Communication) other; 1308 return compareValues(status, o.status, true) && compareValues(sent, o.sent, true) && compareValues(received, o.received, true) 1309 ; 1310 } 1311 1312 public boolean isEmpty() { 1313 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty()) 1314 && (sender == null || sender.isEmpty()) && (recipient == null || recipient.isEmpty()) && (payload == null || payload.isEmpty()) 1315 && (medium == null || medium.isEmpty()) && (status == null || status.isEmpty()) && (encounter == null || encounter.isEmpty()) 1316 && (sent == null || sent.isEmpty()) && (received == null || received.isEmpty()) && (reason == null || reason.isEmpty()) 1317 && (subject == null || subject.isEmpty()) && (requestDetail == null || requestDetail.isEmpty()) 1318 ; 1319 } 1320 1321 @Override 1322 public ResourceType getResourceType() { 1323 return ResourceType.Communication; 1324 } 1325 1326 /** 1327 * Search parameter: <b>sender</b> 1328 * <p> 1329 * Description: <b>Message sender</b><br> 1330 * Type: <b>reference</b><br> 1331 * Path: <b>Communication.sender</b><br> 1332 * </p> 1333 */ 1334 @SearchParamDefinition(name="sender", path="Communication.sender", description="Message sender", type="reference" ) 1335 public static final String SP_SENDER = "sender"; 1336 /** 1337 * <b>Fluent Client</b> search parameter constant for <b>sender</b> 1338 * <p> 1339 * Description: <b>Message sender</b><br> 1340 * Type: <b>reference</b><br> 1341 * Path: <b>Communication.sender</b><br> 1342 * </p> 1343 */ 1344 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SENDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SENDER); 1345 1346/** 1347 * Constant for fluent queries to be used to add include statements. Specifies 1348 * the path value of "<b>Communication:sender</b>". 1349 */ 1350 public static final ca.uhn.fhir.model.api.Include INCLUDE_SENDER = new ca.uhn.fhir.model.api.Include("Communication:sender").toLocked(); 1351 1352 /** 1353 * Search parameter: <b>sent</b> 1354 * <p> 1355 * Description: <b>When sent</b><br> 1356 * Type: <b>date</b><br> 1357 * Path: <b>Communication.sent</b><br> 1358 * </p> 1359 */ 1360 @SearchParamDefinition(name="sent", path="Communication.sent", description="When sent", type="date" ) 1361 public static final String SP_SENT = "sent"; 1362 /** 1363 * <b>Fluent Client</b> search parameter constant for <b>sent</b> 1364 * <p> 1365 * Description: <b>When sent</b><br> 1366 * Type: <b>date</b><br> 1367 * Path: <b>Communication.sent</b><br> 1368 * </p> 1369 */ 1370 public static final ca.uhn.fhir.rest.gclient.DateClientParam SENT = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_SENT); 1371 1372 /** 1373 * Search parameter: <b>category</b> 1374 * <p> 1375 * Description: <b>Message category</b><br> 1376 * Type: <b>token</b><br> 1377 * Path: <b>Communication.category</b><br> 1378 * </p> 1379 */ 1380 @SearchParamDefinition(name="category", path="Communication.category", description="Message category", type="token" ) 1381 public static final String SP_CATEGORY = "category"; 1382 /** 1383 * <b>Fluent Client</b> search parameter constant for <b>category</b> 1384 * <p> 1385 * Description: <b>Message category</b><br> 1386 * Type: <b>token</b><br> 1387 * Path: <b>Communication.category</b><br> 1388 * </p> 1389 */ 1390 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY); 1391 1392 /** 1393 * Search parameter: <b>patient</b> 1394 * <p> 1395 * Description: <b>Focus of message</b><br> 1396 * Type: <b>reference</b><br> 1397 * Path: <b>Communication.subject</b><br> 1398 * </p> 1399 */ 1400 @SearchParamDefinition(name="patient", path="Communication.subject", description="Focus of message", type="reference" ) 1401 public static final String SP_PATIENT = "patient"; 1402 /** 1403 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1404 * <p> 1405 * Description: <b>Focus of message</b><br> 1406 * Type: <b>reference</b><br> 1407 * Path: <b>Communication.subject</b><br> 1408 * </p> 1409 */ 1410 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1411 1412/** 1413 * Constant for fluent queries to be used to add include statements. Specifies 1414 * the path value of "<b>Communication:patient</b>". 1415 */ 1416 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Communication:patient").toLocked(); 1417 1418 /** 1419 * Search parameter: <b>status</b> 1420 * <p> 1421 * Description: <b>in-progress | completed | suspended | rejected | failed</b><br> 1422 * Type: <b>token</b><br> 1423 * Path: <b>Communication.status</b><br> 1424 * </p> 1425 */ 1426 @SearchParamDefinition(name="status", path="Communication.status", description="in-progress | completed | suspended | rejected | failed", type="token" ) 1427 public static final String SP_STATUS = "status"; 1428 /** 1429 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1430 * <p> 1431 * Description: <b>in-progress | completed | suspended | rejected | failed</b><br> 1432 * Type: <b>token</b><br> 1433 * Path: <b>Communication.status</b><br> 1434 * </p> 1435 */ 1436 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1437 1438 /** 1439 * Search parameter: <b>subject</b> 1440 * <p> 1441 * Description: <b>Focus of message</b><br> 1442 * Type: <b>reference</b><br> 1443 * Path: <b>Communication.subject</b><br> 1444 * </p> 1445 */ 1446 @SearchParamDefinition(name="subject", path="Communication.subject", description="Focus of message", type="reference" ) 1447 public static final String SP_SUBJECT = "subject"; 1448 /** 1449 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 1450 * <p> 1451 * Description: <b>Focus of message</b><br> 1452 * Type: <b>reference</b><br> 1453 * Path: <b>Communication.subject</b><br> 1454 * </p> 1455 */ 1456 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 1457 1458/** 1459 * Constant for fluent queries to be used to add include statements. Specifies 1460 * the path value of "<b>Communication:subject</b>". 1461 */ 1462 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Communication:subject").toLocked(); 1463 1464 /** 1465 * Search parameter: <b>request</b> 1466 * <p> 1467 * Description: <b>CommunicationRequest producing this message</b><br> 1468 * Type: <b>reference</b><br> 1469 * Path: <b>Communication.requestDetail</b><br> 1470 * </p> 1471 */ 1472 @SearchParamDefinition(name="request", path="Communication.requestDetail", description="CommunicationRequest producing this message", type="reference" ) 1473 public static final String SP_REQUEST = "request"; 1474 /** 1475 * <b>Fluent Client</b> search parameter constant for <b>request</b> 1476 * <p> 1477 * Description: <b>CommunicationRequest producing this message</b><br> 1478 * Type: <b>reference</b><br> 1479 * Path: <b>Communication.requestDetail</b><br> 1480 * </p> 1481 */ 1482 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST); 1483 1484/** 1485 * Constant for fluent queries to be used to add include statements. Specifies 1486 * the path value of "<b>Communication:request</b>". 1487 */ 1488 public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("Communication:request").toLocked(); 1489 1490 /** 1491 * Search parameter: <b>received</b> 1492 * <p> 1493 * Description: <b>When received</b><br> 1494 * Type: <b>date</b><br> 1495 * Path: <b>Communication.received</b><br> 1496 * </p> 1497 */ 1498 @SearchParamDefinition(name="received", path="Communication.received", description="When received", type="date" ) 1499 public static final String SP_RECEIVED = "received"; 1500 /** 1501 * <b>Fluent Client</b> search parameter constant for <b>received</b> 1502 * <p> 1503 * Description: <b>When received</b><br> 1504 * Type: <b>date</b><br> 1505 * Path: <b>Communication.received</b><br> 1506 * </p> 1507 */ 1508 public static final ca.uhn.fhir.rest.gclient.DateClientParam RECEIVED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_RECEIVED); 1509 1510 /** 1511 * Search parameter: <b>encounter</b> 1512 * <p> 1513 * Description: <b>Encounter leading to message</b><br> 1514 * Type: <b>reference</b><br> 1515 * Path: <b>Communication.encounter</b><br> 1516 * </p> 1517 */ 1518 @SearchParamDefinition(name="encounter", path="Communication.encounter", description="Encounter leading to message", type="reference" ) 1519 public static final String SP_ENCOUNTER = "encounter"; 1520 /** 1521 * <b>Fluent Client</b> search parameter constant for <b>encounter</b> 1522 * <p> 1523 * Description: <b>Encounter leading to message</b><br> 1524 * Type: <b>reference</b><br> 1525 * Path: <b>Communication.encounter</b><br> 1526 * </p> 1527 */ 1528 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER); 1529 1530/** 1531 * Constant for fluent queries to be used to add include statements. Specifies 1532 * the path value of "<b>Communication:encounter</b>". 1533 */ 1534 public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Communication:encounter").toLocked(); 1535 1536 /** 1537 * Search parameter: <b>identifier</b> 1538 * <p> 1539 * Description: <b>Unique identifier</b><br> 1540 * Type: <b>token</b><br> 1541 * Path: <b>Communication.identifier</b><br> 1542 * </p> 1543 */ 1544 @SearchParamDefinition(name="identifier", path="Communication.identifier", description="Unique identifier", type="token" ) 1545 public static final String SP_IDENTIFIER = "identifier"; 1546 /** 1547 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1548 * <p> 1549 * Description: <b>Unique identifier</b><br> 1550 * Type: <b>token</b><br> 1551 * Path: <b>Communication.identifier</b><br> 1552 * </p> 1553 */ 1554 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1555 1556 /** 1557 * Search parameter: <b>medium</b> 1558 * <p> 1559 * Description: <b>A channel of communication</b><br> 1560 * Type: <b>token</b><br> 1561 * Path: <b>Communication.medium</b><br> 1562 * </p> 1563 */ 1564 @SearchParamDefinition(name="medium", path="Communication.medium", description="A channel of communication", type="token" ) 1565 public static final String SP_MEDIUM = "medium"; 1566 /** 1567 * <b>Fluent Client</b> search parameter constant for <b>medium</b> 1568 * <p> 1569 * Description: <b>A channel of communication</b><br> 1570 * Type: <b>token</b><br> 1571 * Path: <b>Communication.medium</b><br> 1572 * </p> 1573 */ 1574 public static final ca.uhn.fhir.rest.gclient.TokenClientParam MEDIUM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MEDIUM); 1575 1576 /** 1577 * Search parameter: <b>recipient</b> 1578 * <p> 1579 * Description: <b>Message recipient</b><br> 1580 * Type: <b>reference</b><br> 1581 * Path: <b>Communication.recipient</b><br> 1582 * </p> 1583 */ 1584 @SearchParamDefinition(name="recipient", path="Communication.recipient", description="Message recipient", type="reference" ) 1585 public static final String SP_RECIPIENT = "recipient"; 1586 /** 1587 * <b>Fluent Client</b> search parameter constant for <b>recipient</b> 1588 * <p> 1589 * Description: <b>Message recipient</b><br> 1590 * Type: <b>reference</b><br> 1591 * Path: <b>Communication.recipient</b><br> 1592 * </p> 1593 */ 1594 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECIPIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECIPIENT); 1595 1596/** 1597 * Constant for fluent queries to be used to add include statements. Specifies 1598 * the path value of "<b>Communication:recipient</b>". 1599 */ 1600 public static final ca.uhn.fhir.model.api.Include INCLUDE_RECIPIENT = new ca.uhn.fhir.model.api.Include("Communication:recipient").toLocked(); 1601 1602 1603}