001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import java.math.*; 040import org.hl7.fhir.utilities.Utilities; 041import ca.uhn.fhir.model.api.annotation.ResourceDef; 042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.ChildOrder; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.Block; 047import org.hl7.fhir.instance.model.api.*; 048import org.hl7.fhir.exceptions.FHIRException; 049/** 050 * A container for a collection of resources. 051 */ 052@ResourceDef(name="Bundle", profile="http://hl7.org/fhir/StructureDefinition/Bundle") 053public class Bundle extends Resource implements IBaseBundle { 054 055 public enum BundleType { 056 /** 057 * The bundle is a document. The first resource is a Composition. 058 */ 059 DOCUMENT, 060 /** 061 * The bundle is a message. The first resource is a MessageHeader. 062 */ 063 MESSAGE, 064 /** 065 * The bundle is a transaction - intended to be processed by a server as an atomic commit. 066 */ 067 TRANSACTION, 068 /** 069 * The bundle is a transaction response. Because the response is a transaction response, the transaction has succeeded, and all responses are error free. 070 */ 071 TRANSACTIONRESPONSE, 072 /** 073 * The bundle is a set of actions - intended to be processed by a server as a group of independent actions. 074 */ 075 BATCH, 076 /** 077 * The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success. 078 */ 079 BATCHRESPONSE, 080 /** 081 * The bundle is a list of resources from a history interaction on a server. 082 */ 083 HISTORY, 084 /** 085 * The bundle is a list of resources returned as a result of a search/query interaction, operation, or message. 086 */ 087 SEARCHSET, 088 /** 089 * The bundle is a set of resources collected into a single package for ease of distribution that imposes no processing obligations or behavioral rules beyond persistence. 090 */ 091 COLLECTION, 092 /** 093 * added to help the parsers with the generic types 094 */ 095 NULL; 096 public static BundleType fromCode(String codeString) throws FHIRException { 097 if (codeString == null || "".equals(codeString)) 098 return null; 099 if ("document".equals(codeString)) 100 return DOCUMENT; 101 if ("message".equals(codeString)) 102 return MESSAGE; 103 if ("transaction".equals(codeString)) 104 return TRANSACTION; 105 if ("transaction-response".equals(codeString)) 106 return TRANSACTIONRESPONSE; 107 if ("batch".equals(codeString)) 108 return BATCH; 109 if ("batch-response".equals(codeString)) 110 return BATCHRESPONSE; 111 if ("history".equals(codeString)) 112 return HISTORY; 113 if ("searchset".equals(codeString)) 114 return SEARCHSET; 115 if ("collection".equals(codeString)) 116 return COLLECTION; 117 if (Configuration.isAcceptInvalidEnums()) 118 return null; 119 else 120 throw new FHIRException("Unknown BundleType code '"+codeString+"'"); 121 } 122 public String toCode() { 123 switch (this) { 124 case DOCUMENT: return "document"; 125 case MESSAGE: return "message"; 126 case TRANSACTION: return "transaction"; 127 case TRANSACTIONRESPONSE: return "transaction-response"; 128 case BATCH: return "batch"; 129 case BATCHRESPONSE: return "batch-response"; 130 case HISTORY: return "history"; 131 case SEARCHSET: return "searchset"; 132 case COLLECTION: return "collection"; 133 default: return "?"; 134 } 135 } 136 public String getSystem() { 137 switch (this) { 138 case DOCUMENT: return "http://hl7.org/fhir/bundle-type"; 139 case MESSAGE: return "http://hl7.org/fhir/bundle-type"; 140 case TRANSACTION: return "http://hl7.org/fhir/bundle-type"; 141 case TRANSACTIONRESPONSE: return "http://hl7.org/fhir/bundle-type"; 142 case BATCH: return "http://hl7.org/fhir/bundle-type"; 143 case BATCHRESPONSE: return "http://hl7.org/fhir/bundle-type"; 144 case HISTORY: return "http://hl7.org/fhir/bundle-type"; 145 case SEARCHSET: return "http://hl7.org/fhir/bundle-type"; 146 case COLLECTION: return "http://hl7.org/fhir/bundle-type"; 147 default: return "?"; 148 } 149 } 150 public String getDefinition() { 151 switch (this) { 152 case DOCUMENT: return "The bundle is a document. The first resource is a Composition."; 153 case MESSAGE: return "The bundle is a message. The first resource is a MessageHeader."; 154 case TRANSACTION: return "The bundle is a transaction - intended to be processed by a server as an atomic commit."; 155 case TRANSACTIONRESPONSE: return "The bundle is a transaction response. Because the response is a transaction response, the transaction has succeeded, and all responses are error free."; 156 case BATCH: return "The bundle is a set of actions - intended to be processed by a server as a group of independent actions."; 157 case BATCHRESPONSE: return "The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success."; 158 case HISTORY: return "The bundle is a list of resources from a history interaction on a server."; 159 case SEARCHSET: return "The bundle is a list of resources returned as a result of a search/query interaction, operation, or message."; 160 case COLLECTION: return "The bundle is a set of resources collected into a single package for ease of distribution that imposes no processing obligations or behavioral rules beyond persistence."; 161 default: return "?"; 162 } 163 } 164 public String getDisplay() { 165 switch (this) { 166 case DOCUMENT: return "Document"; 167 case MESSAGE: return "Message"; 168 case TRANSACTION: return "Transaction"; 169 case TRANSACTIONRESPONSE: return "Transaction Response"; 170 case BATCH: return "Batch"; 171 case BATCHRESPONSE: return "Batch Response"; 172 case HISTORY: return "History List"; 173 case SEARCHSET: return "Search Results"; 174 case COLLECTION: return "Collection"; 175 default: return "?"; 176 } 177 } 178 } 179 180 public static class BundleTypeEnumFactory implements EnumFactory<BundleType> { 181 public BundleType fromCode(String codeString) throws IllegalArgumentException { 182 if (codeString == null || "".equals(codeString)) 183 if (codeString == null || "".equals(codeString)) 184 return null; 185 if ("document".equals(codeString)) 186 return BundleType.DOCUMENT; 187 if ("message".equals(codeString)) 188 return BundleType.MESSAGE; 189 if ("transaction".equals(codeString)) 190 return BundleType.TRANSACTION; 191 if ("transaction-response".equals(codeString)) 192 return BundleType.TRANSACTIONRESPONSE; 193 if ("batch".equals(codeString)) 194 return BundleType.BATCH; 195 if ("batch-response".equals(codeString)) 196 return BundleType.BATCHRESPONSE; 197 if ("history".equals(codeString)) 198 return BundleType.HISTORY; 199 if ("searchset".equals(codeString)) 200 return BundleType.SEARCHSET; 201 if ("collection".equals(codeString)) 202 return BundleType.COLLECTION; 203 throw new IllegalArgumentException("Unknown BundleType code '"+codeString+"'"); 204 } 205 public Enumeration<BundleType> fromType(Base code) throws FHIRException { 206 if (code == null) 207 return null; 208 if (code.isEmpty()) 209 return new Enumeration<BundleType>(this); 210 String codeString = ((PrimitiveType) code).asStringValue(); 211 if (codeString == null || "".equals(codeString)) 212 return null; 213 if ("document".equals(codeString)) 214 return new Enumeration<BundleType>(this, BundleType.DOCUMENT); 215 if ("message".equals(codeString)) 216 return new Enumeration<BundleType>(this, BundleType.MESSAGE); 217 if ("transaction".equals(codeString)) 218 return new Enumeration<BundleType>(this, BundleType.TRANSACTION); 219 if ("transaction-response".equals(codeString)) 220 return new Enumeration<BundleType>(this, BundleType.TRANSACTIONRESPONSE); 221 if ("batch".equals(codeString)) 222 return new Enumeration<BundleType>(this, BundleType.BATCH); 223 if ("batch-response".equals(codeString)) 224 return new Enumeration<BundleType>(this, BundleType.BATCHRESPONSE); 225 if ("history".equals(codeString)) 226 return new Enumeration<BundleType>(this, BundleType.HISTORY); 227 if ("searchset".equals(codeString)) 228 return new Enumeration<BundleType>(this, BundleType.SEARCHSET); 229 if ("collection".equals(codeString)) 230 return new Enumeration<BundleType>(this, BundleType.COLLECTION); 231 throw new FHIRException("Unknown BundleType code '"+codeString+"'"); 232 } 233 public String toCode(BundleType code) { 234 if (code == BundleType.DOCUMENT) 235 return "document"; 236 if (code == BundleType.MESSAGE) 237 return "message"; 238 if (code == BundleType.TRANSACTION) 239 return "transaction"; 240 if (code == BundleType.TRANSACTIONRESPONSE) 241 return "transaction-response"; 242 if (code == BundleType.BATCH) 243 return "batch"; 244 if (code == BundleType.BATCHRESPONSE) 245 return "batch-response"; 246 if (code == BundleType.HISTORY) 247 return "history"; 248 if (code == BundleType.SEARCHSET) 249 return "searchset"; 250 if (code == BundleType.COLLECTION) 251 return "collection"; 252 return "?"; 253 } 254 public String toSystem(BundleType code) { 255 return code.getSystem(); 256 } 257 } 258 259 public enum SearchEntryMode { 260 /** 261 * This resource matched the search specification. 262 */ 263 MATCH, 264 /** 265 * This resource is returned because it is referred to from another resource in the search set. 266 */ 267 INCLUDE, 268 /** 269 * An OperationOutcome that provides additional information about the processing of a search. 270 */ 271 OUTCOME, 272 /** 273 * added to help the parsers with the generic types 274 */ 275 NULL; 276 public static SearchEntryMode fromCode(String codeString) throws FHIRException { 277 if (codeString == null || "".equals(codeString)) 278 return null; 279 if ("match".equals(codeString)) 280 return MATCH; 281 if ("include".equals(codeString)) 282 return INCLUDE; 283 if ("outcome".equals(codeString)) 284 return OUTCOME; 285 if (Configuration.isAcceptInvalidEnums()) 286 return null; 287 else 288 throw new FHIRException("Unknown SearchEntryMode code '"+codeString+"'"); 289 } 290 public String toCode() { 291 switch (this) { 292 case MATCH: return "match"; 293 case INCLUDE: return "include"; 294 case OUTCOME: return "outcome"; 295 default: return "?"; 296 } 297 } 298 public String getSystem() { 299 switch (this) { 300 case MATCH: return "http://hl7.org/fhir/search-entry-mode"; 301 case INCLUDE: return "http://hl7.org/fhir/search-entry-mode"; 302 case OUTCOME: return "http://hl7.org/fhir/search-entry-mode"; 303 default: return "?"; 304 } 305 } 306 public String getDefinition() { 307 switch (this) { 308 case MATCH: return "This resource matched the search specification."; 309 case INCLUDE: return "This resource is returned because it is referred to from another resource in the search set."; 310 case OUTCOME: return "An OperationOutcome that provides additional information about the processing of a search."; 311 default: return "?"; 312 } 313 } 314 public String getDisplay() { 315 switch (this) { 316 case MATCH: return "Match"; 317 case INCLUDE: return "Include"; 318 case OUTCOME: return "Outcome"; 319 default: return "?"; 320 } 321 } 322 } 323 324 public static class SearchEntryModeEnumFactory implements EnumFactory<SearchEntryMode> { 325 public SearchEntryMode fromCode(String codeString) throws IllegalArgumentException { 326 if (codeString == null || "".equals(codeString)) 327 if (codeString == null || "".equals(codeString)) 328 return null; 329 if ("match".equals(codeString)) 330 return SearchEntryMode.MATCH; 331 if ("include".equals(codeString)) 332 return SearchEntryMode.INCLUDE; 333 if ("outcome".equals(codeString)) 334 return SearchEntryMode.OUTCOME; 335 throw new IllegalArgumentException("Unknown SearchEntryMode code '"+codeString+"'"); 336 } 337 public Enumeration<SearchEntryMode> fromType(Base code) throws FHIRException { 338 if (code == null) 339 return null; 340 if (code.isEmpty()) 341 return new Enumeration<SearchEntryMode>(this); 342 String codeString = ((PrimitiveType) code).asStringValue(); 343 if (codeString == null || "".equals(codeString)) 344 return null; 345 if ("match".equals(codeString)) 346 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.MATCH); 347 if ("include".equals(codeString)) 348 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.INCLUDE); 349 if ("outcome".equals(codeString)) 350 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.OUTCOME); 351 throw new FHIRException("Unknown SearchEntryMode code '"+codeString+"'"); 352 } 353 public String toCode(SearchEntryMode code) { 354 if (code == SearchEntryMode.MATCH) 355 return "match"; 356 if (code == SearchEntryMode.INCLUDE) 357 return "include"; 358 if (code == SearchEntryMode.OUTCOME) 359 return "outcome"; 360 return "?"; 361 } 362 public String toSystem(SearchEntryMode code) { 363 return code.getSystem(); 364 } 365 } 366 367 public enum HTTPVerb { 368 /** 369 * HTTP GET Command. 370 */ 371 GET, 372 /** 373 * HTTP HEAD Command. 374 */ 375 HEAD, 376 /** 377 * HTTP POST Command. 378 */ 379 POST, 380 /** 381 * HTTP PUT Command. 382 */ 383 PUT, 384 /** 385 * HTTP DELETE Command. 386 */ 387 DELETE, 388 /** 389 * HTTP PATCH Command. 390 */ 391 PATCH, 392 /** 393 * added to help the parsers with the generic types 394 */ 395 NULL; 396 public static HTTPVerb fromCode(String codeString) throws FHIRException { 397 if (codeString == null || "".equals(codeString)) 398 return null; 399 if ("GET".equals(codeString)) 400 return GET; 401 if ("HEAD".equals(codeString)) 402 return HEAD; 403 if ("POST".equals(codeString)) 404 return POST; 405 if ("PUT".equals(codeString)) 406 return PUT; 407 if ("DELETE".equals(codeString)) 408 return DELETE; 409 if ("PATCH".equals(codeString)) 410 return PATCH; 411 if (Configuration.isAcceptInvalidEnums()) 412 return null; 413 else 414 throw new FHIRException("Unknown HTTPVerb code '"+codeString+"'"); 415 } 416 public String toCode() { 417 switch (this) { 418 case GET: return "GET"; 419 case HEAD: return "HEAD"; 420 case POST: return "POST"; 421 case PUT: return "PUT"; 422 case DELETE: return "DELETE"; 423 case PATCH: return "PATCH"; 424 default: return "?"; 425 } 426 } 427 public String getSystem() { 428 switch (this) { 429 case GET: return "http://hl7.org/fhir/http-verb"; 430 case HEAD: return "http://hl7.org/fhir/http-verb"; 431 case POST: return "http://hl7.org/fhir/http-verb"; 432 case PUT: return "http://hl7.org/fhir/http-verb"; 433 case DELETE: return "http://hl7.org/fhir/http-verb"; 434 case PATCH: return "http://hl7.org/fhir/http-verb"; 435 default: return "?"; 436 } 437 } 438 public String getDefinition() { 439 switch (this) { 440 case GET: return "HTTP GET Command."; 441 case HEAD: return "HTTP HEAD Command."; 442 case POST: return "HTTP POST Command."; 443 case PUT: return "HTTP PUT Command."; 444 case DELETE: return "HTTP DELETE Command."; 445 case PATCH: return "HTTP PATCH Command."; 446 default: return "?"; 447 } 448 } 449 public String getDisplay() { 450 switch (this) { 451 case GET: return "GET"; 452 case HEAD: return "HEAD"; 453 case POST: return "POST"; 454 case PUT: return "PUT"; 455 case DELETE: return "DELETE"; 456 case PATCH: return "PATCH"; 457 default: return "?"; 458 } 459 } 460 } 461 462 public static class HTTPVerbEnumFactory implements EnumFactory<HTTPVerb> { 463 public HTTPVerb fromCode(String codeString) throws IllegalArgumentException { 464 if (codeString == null || "".equals(codeString)) 465 if (codeString == null || "".equals(codeString)) 466 return null; 467 if ("GET".equals(codeString)) 468 return HTTPVerb.GET; 469 if ("HEAD".equals(codeString)) 470 return HTTPVerb.HEAD; 471 if ("POST".equals(codeString)) 472 return HTTPVerb.POST; 473 if ("PUT".equals(codeString)) 474 return HTTPVerb.PUT; 475 if ("DELETE".equals(codeString)) 476 return HTTPVerb.DELETE; 477 if ("PATCH".equals(codeString)) 478 return HTTPVerb.PATCH; 479 throw new IllegalArgumentException("Unknown HTTPVerb code '"+codeString+"'"); 480 } 481 public Enumeration<HTTPVerb> fromType(Base code) throws FHIRException { 482 if (code == null) 483 return null; 484 if (code.isEmpty()) 485 return new Enumeration<HTTPVerb>(this); 486 String codeString = ((PrimitiveType) code).asStringValue(); 487 if (codeString == null || "".equals(codeString)) 488 return null; 489 if ("GET".equals(codeString)) 490 return new Enumeration<HTTPVerb>(this, HTTPVerb.GET); 491 if ("HEAD".equals(codeString)) 492 return new Enumeration<HTTPVerb>(this, HTTPVerb.HEAD); 493 if ("POST".equals(codeString)) 494 return new Enumeration<HTTPVerb>(this, HTTPVerb.POST); 495 if ("PUT".equals(codeString)) 496 return new Enumeration<HTTPVerb>(this, HTTPVerb.PUT); 497 if ("DELETE".equals(codeString)) 498 return new Enumeration<HTTPVerb>(this, HTTPVerb.DELETE); 499 if ("PATCH".equals(codeString)) 500 return new Enumeration<HTTPVerb>(this, HTTPVerb.PATCH); 501 throw new FHIRException("Unknown HTTPVerb code '"+codeString+"'"); 502 } 503 public String toCode(HTTPVerb code) { 504 if (code == HTTPVerb.GET) 505 return "GET"; 506 if (code == HTTPVerb.HEAD) 507 return "HEAD"; 508 if (code == HTTPVerb.POST) 509 return "POST"; 510 if (code == HTTPVerb.PUT) 511 return "PUT"; 512 if (code == HTTPVerb.DELETE) 513 return "DELETE"; 514 if (code == HTTPVerb.PATCH) 515 return "PATCH"; 516 return "?"; 517 } 518 public String toSystem(HTTPVerb code) { 519 return code.getSystem(); 520 } 521 } 522 523 @Block() 524 public static class BundleLinkComponent extends BackboneElement implements IBaseBackboneElement { 525 /** 526 * A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1). 527 */ 528 @Child(name = "relation", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 529 @Description(shortDefinition="See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1", formalDefinition="A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1)." ) 530 protected StringType relation; 531 532 /** 533 * The reference details for the link. 534 */ 535 @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 536 @Description(shortDefinition="Reference details for the link", formalDefinition="The reference details for the link." ) 537 protected UriType url; 538 539 private static final long serialVersionUID = -1010386066L; 540 541 /** 542 * Constructor 543 */ 544 public BundleLinkComponent() { 545 super(); 546 } 547 548 /** 549 * Constructor 550 */ 551 public BundleLinkComponent(StringType relation, UriType url) { 552 super(); 553 this.relation = relation; 554 this.url = url; 555 } 556 557 /** 558 * @return {@link #relation} (A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).). This is the underlying object with id, value and extensions. The accessor "getRelation" gives direct access to the value 559 */ 560 public StringType getRelationElement() { 561 if (this.relation == null) 562 if (Configuration.errorOnAutoCreate()) 563 throw new Error("Attempt to auto-create BundleLinkComponent.relation"); 564 else if (Configuration.doAutoCreate()) 565 this.relation = new StringType(); // bb 566 return this.relation; 567 } 568 569 public boolean hasRelationElement() { 570 return this.relation != null && !this.relation.isEmpty(); 571 } 572 573 public boolean hasRelation() { 574 return this.relation != null && !this.relation.isEmpty(); 575 } 576 577 /** 578 * @param value {@link #relation} (A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).). This is the underlying object with id, value and extensions. The accessor "getRelation" gives direct access to the value 579 */ 580 public BundleLinkComponent setRelationElement(StringType value) { 581 this.relation = value; 582 return this; 583 } 584 585 /** 586 * @return A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1). 587 */ 588 public String getRelation() { 589 return this.relation == null ? null : this.relation.getValue(); 590 } 591 592 /** 593 * @param value A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1). 594 */ 595 public BundleLinkComponent setRelation(String value) { 596 if (this.relation == null) 597 this.relation = new StringType(); 598 this.relation.setValue(value); 599 return this; 600 } 601 602 /** 603 * @return {@link #url} (The reference details for the link.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 604 */ 605 public UriType getUrlElement() { 606 if (this.url == null) 607 if (Configuration.errorOnAutoCreate()) 608 throw new Error("Attempt to auto-create BundleLinkComponent.url"); 609 else if (Configuration.doAutoCreate()) 610 this.url = new UriType(); // bb 611 return this.url; 612 } 613 614 public boolean hasUrlElement() { 615 return this.url != null && !this.url.isEmpty(); 616 } 617 618 public boolean hasUrl() { 619 return this.url != null && !this.url.isEmpty(); 620 } 621 622 /** 623 * @param value {@link #url} (The reference details for the link.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 624 */ 625 public BundleLinkComponent setUrlElement(UriType value) { 626 this.url = value; 627 return this; 628 } 629 630 /** 631 * @return The reference details for the link. 632 */ 633 public String getUrl() { 634 return this.url == null ? null : this.url.getValue(); 635 } 636 637 /** 638 * @param value The reference details for the link. 639 */ 640 public BundleLinkComponent setUrl(String value) { 641 if (this.url == null) 642 this.url = new UriType(); 643 this.url.setValue(value); 644 return this; 645 } 646 647 protected void listChildren(List<Property> children) { 648 super.listChildren(children); 649 children.add(new Property("relation", "string", "A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).", 0, 1, relation)); 650 children.add(new Property("url", "uri", "The reference details for the link.", 0, 1, url)); 651 } 652 653 @Override 654 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 655 switch (_hash) { 656 case -554436100: /*relation*/ return new Property("relation", "string", "A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).", 0, 1, relation); 657 case 116079: /*url*/ return new Property("url", "uri", "The reference details for the link.", 0, 1, url); 658 default: return super.getNamedProperty(_hash, _name, _checkValid); 659 } 660 661 } 662 663 @Override 664 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 665 switch (hash) { 666 case -554436100: /*relation*/ return this.relation == null ? new Base[0] : new Base[] {this.relation}; // StringType 667 case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType 668 default: return super.getProperty(hash, name, checkValid); 669 } 670 671 } 672 673 @Override 674 public Base setProperty(int hash, String name, Base value) throws FHIRException { 675 switch (hash) { 676 case -554436100: // relation 677 this.relation = castToString(value); // StringType 678 return value; 679 case 116079: // url 680 this.url = castToUri(value); // UriType 681 return value; 682 default: return super.setProperty(hash, name, value); 683 } 684 685 } 686 687 @Override 688 public Base setProperty(String name, Base value) throws FHIRException { 689 if (name.equals("relation")) { 690 this.relation = castToString(value); // StringType 691 } else if (name.equals("url")) { 692 this.url = castToUri(value); // UriType 693 } else 694 return super.setProperty(name, value); 695 return value; 696 } 697 698 @Override 699 public Base makeProperty(int hash, String name) throws FHIRException { 700 switch (hash) { 701 case -554436100: return getRelationElement(); 702 case 116079: return getUrlElement(); 703 default: return super.makeProperty(hash, name); 704 } 705 706 } 707 708 @Override 709 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 710 switch (hash) { 711 case -554436100: /*relation*/ return new String[] {"string"}; 712 case 116079: /*url*/ return new String[] {"uri"}; 713 default: return super.getTypesForProperty(hash, name); 714 } 715 716 } 717 718 @Override 719 public Base addChild(String name) throws FHIRException { 720 if (name.equals("relation")) { 721 throw new FHIRException("Cannot call addChild on a primitive type Bundle.relation"); 722 } 723 else if (name.equals("url")) { 724 throw new FHIRException("Cannot call addChild on a primitive type Bundle.url"); 725 } 726 else 727 return super.addChild(name); 728 } 729 730 public BundleLinkComponent copy() { 731 BundleLinkComponent dst = new BundleLinkComponent(); 732 copyValues(dst); 733 return dst; 734 } 735 736 public void copyValues(BundleLinkComponent dst) { 737 super.copyValues(dst); 738 dst.relation = relation == null ? null : relation.copy(); 739 dst.url = url == null ? null : url.copy(); 740 } 741 742 @Override 743 public boolean equalsDeep(Base other_) { 744 if (!super.equalsDeep(other_)) 745 return false; 746 if (!(other_ instanceof BundleLinkComponent)) 747 return false; 748 BundleLinkComponent o = (BundleLinkComponent) other_; 749 return compareDeep(relation, o.relation, true) && compareDeep(url, o.url, true); 750 } 751 752 @Override 753 public boolean equalsShallow(Base other_) { 754 if (!super.equalsShallow(other_)) 755 return false; 756 if (!(other_ instanceof BundleLinkComponent)) 757 return false; 758 BundleLinkComponent o = (BundleLinkComponent) other_; 759 return compareValues(relation, o.relation, true) && compareValues(url, o.url, true); 760 } 761 762 public boolean isEmpty() { 763 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relation, url); 764 } 765 766 public String fhirType() { 767 return "Bundle.link"; 768 769 } 770 771 } 772 773 @Block() 774 public static class BundleEntryComponent extends BackboneElement implements IBaseBackboneElement { 775 /** 776 * A series of links that provide context to this entry. 777 */ 778 @Child(name = "link", type = {BundleLinkComponent.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 779 @Description(shortDefinition="Links related to this entry", formalDefinition="A series of links that provide context to this entry." ) 780 protected List<BundleLinkComponent> link; 781 782 /** 783 * The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 784* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) 785* Results from operations might involve resources that are not identified. 786 */ 787 @Child(name = "fullUrl", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 788 @Description(shortDefinition="URI for resource (Absolute URL server address or URI for UUID/OID)", formalDefinition="The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified." ) 789 protected UriType fullUrl; 790 791 /** 792 * The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type. 793 */ 794 @Child(name = "resource", type = {Resource.class}, order=3, min=0, max=1, modifier=false, summary=true) 795 @Description(shortDefinition="A resource in the bundle", formalDefinition="The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type." ) 796 protected Resource resource; 797 798 /** 799 * Information about the search process that lead to the creation of this entry. 800 */ 801 @Child(name = "search", type = {}, order=4, min=0, max=1, modifier=false, summary=true) 802 @Description(shortDefinition="Search related information", formalDefinition="Information about the search process that lead to the creation of this entry." ) 803 protected BundleEntrySearchComponent search; 804 805 /** 806 * Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry. 807 */ 808 @Child(name = "request", type = {}, order=5, min=0, max=1, modifier=false, summary=true) 809 @Description(shortDefinition="Additional execution information (transaction/batch/history)", formalDefinition="Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry." ) 810 protected BundleEntryRequestComponent request; 811 812 /** 813 * Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history. 814 */ 815 @Child(name = "response", type = {}, order=6, min=0, max=1, modifier=false, summary=true) 816 @Description(shortDefinition="Results of execution (transaction/batch/history)", formalDefinition="Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history." ) 817 protected BundleEntryResponseComponent response; 818 819 private static final long serialVersionUID = 517783054L; 820 821 /** 822 * Constructor 823 */ 824 public BundleEntryComponent() { 825 super(); 826 } 827 828 /** 829 * @return {@link #link} (A series of links that provide context to this entry.) 830 */ 831 public List<BundleLinkComponent> getLink() { 832 if (this.link == null) 833 this.link = new ArrayList<BundleLinkComponent>(); 834 return this.link; 835 } 836 837 /** 838 * @return Returns a reference to <code>this</code> for easy method chaining 839 */ 840 public BundleEntryComponent setLink(List<BundleLinkComponent> theLink) { 841 this.link = theLink; 842 return this; 843 } 844 845 public boolean hasLink() { 846 if (this.link == null) 847 return false; 848 for (BundleLinkComponent item : this.link) 849 if (!item.isEmpty()) 850 return true; 851 return false; 852 } 853 854 public BundleLinkComponent addLink() { //3 855 BundleLinkComponent t = new BundleLinkComponent(); 856 if (this.link == null) 857 this.link = new ArrayList<BundleLinkComponent>(); 858 this.link.add(t); 859 return t; 860 } 861 862 public BundleEntryComponent addLink(BundleLinkComponent t) { //3 863 if (t == null) 864 return this; 865 if (this.link == null) 866 this.link = new ArrayList<BundleLinkComponent>(); 867 this.link.add(t); 868 return this; 869 } 870 871 /** 872 * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist 873 */ 874 public BundleLinkComponent getLinkFirstRep() { 875 if (getLink().isEmpty()) { 876 addLink(); 877 } 878 return getLink().get(0); 879 } 880 881 /** 882 * @return {@link #fullUrl} (The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 883* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) 884* Results from operations might involve resources that are not identified.). This is the underlying object with id, value and extensions. The accessor "getFullUrl" gives direct access to the value 885 */ 886 public UriType getFullUrlElement() { 887 if (this.fullUrl == null) 888 if (Configuration.errorOnAutoCreate()) 889 throw new Error("Attempt to auto-create BundleEntryComponent.fullUrl"); 890 else if (Configuration.doAutoCreate()) 891 this.fullUrl = new UriType(); // bb 892 return this.fullUrl; 893 } 894 895 public boolean hasFullUrlElement() { 896 return this.fullUrl != null && !this.fullUrl.isEmpty(); 897 } 898 899 public boolean hasFullUrl() { 900 return this.fullUrl != null && !this.fullUrl.isEmpty(); 901 } 902 903 /** 904 * @param value {@link #fullUrl} (The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 905* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) 906* Results from operations might involve resources that are not identified.). This is the underlying object with id, value and extensions. The accessor "getFullUrl" gives direct access to the value 907 */ 908 public BundleEntryComponent setFullUrlElement(UriType value) { 909 this.fullUrl = value; 910 return this; 911 } 912 913 /** 914 * @return The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 915* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) 916* Results from operations might involve resources that are not identified. 917 */ 918 public String getFullUrl() { 919 return this.fullUrl == null ? null : this.fullUrl.getValue(); 920 } 921 922 /** 923 * @param value The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: 924* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) 925* Results from operations might involve resources that are not identified. 926 */ 927 public BundleEntryComponent setFullUrl(String value) { 928 if (Utilities.noString(value)) 929 this.fullUrl = null; 930 else { 931 if (this.fullUrl == null) 932 this.fullUrl = new UriType(); 933 this.fullUrl.setValue(value); 934 } 935 return this; 936 } 937 938 /** 939 * @return {@link #resource} (The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.) 940 */ 941 public Resource getResource() { 942 return this.resource; 943 } 944 945 public boolean hasResource() { 946 return this.resource != null && !this.resource.isEmpty(); 947 } 948 949 /** 950 * @param value {@link #resource} (The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.) 951 */ 952 public BundleEntryComponent setResource(Resource value) { 953 this.resource = value; 954 return this; 955 } 956 957 /** 958 * @return {@link #search} (Information about the search process that lead to the creation of this entry.) 959 */ 960 public BundleEntrySearchComponent getSearch() { 961 if (this.search == null) 962 if (Configuration.errorOnAutoCreate()) 963 throw new Error("Attempt to auto-create BundleEntryComponent.search"); 964 else if (Configuration.doAutoCreate()) 965 this.search = new BundleEntrySearchComponent(); // cc 966 return this.search; 967 } 968 969 public boolean hasSearch() { 970 return this.search != null && !this.search.isEmpty(); 971 } 972 973 /** 974 * @param value {@link #search} (Information about the search process that lead to the creation of this entry.) 975 */ 976 public BundleEntryComponent setSearch(BundleEntrySearchComponent value) { 977 this.search = value; 978 return this; 979 } 980 981 /** 982 * @return {@link #request} (Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry.) 983 */ 984 public BundleEntryRequestComponent getRequest() { 985 if (this.request == null) 986 if (Configuration.errorOnAutoCreate()) 987 throw new Error("Attempt to auto-create BundleEntryComponent.request"); 988 else if (Configuration.doAutoCreate()) 989 this.request = new BundleEntryRequestComponent(); // cc 990 return this.request; 991 } 992 993 public boolean hasRequest() { 994 return this.request != null && !this.request.isEmpty(); 995 } 996 997 /** 998 * @param value {@link #request} (Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry.) 999 */ 1000 public BundleEntryComponent setRequest(BundleEntryRequestComponent value) { 1001 this.request = value; 1002 return this; 1003 } 1004 1005 /** 1006 * @return {@link #response} (Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.) 1007 */ 1008 public BundleEntryResponseComponent getResponse() { 1009 if (this.response == null) 1010 if (Configuration.errorOnAutoCreate()) 1011 throw new Error("Attempt to auto-create BundleEntryComponent.response"); 1012 else if (Configuration.doAutoCreate()) 1013 this.response = new BundleEntryResponseComponent(); // cc 1014 return this.response; 1015 } 1016 1017 public boolean hasResponse() { 1018 return this.response != null && !this.response.isEmpty(); 1019 } 1020 1021 /** 1022 * @param value {@link #response} (Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.) 1023 */ 1024 public BundleEntryComponent setResponse(BundleEntryResponseComponent value) { 1025 this.response = value; 1026 return this; 1027 } 1028 1029 /** 1030 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 1031 * If no link is found which matches the given relation, returns <code>null</code>. If more than one 1032 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 1033 * 1034 * @param theRelation 1035 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 1036 * @return Returns a matching BundleLinkComponent, or <code>null</code> 1037 * @see IBaseBundle#LINK_NEXT 1038 * @see IBaseBundle#LINK_PREV 1039 * @see IBaseBundle#LINK_SELF 1040 */ 1041 public BundleLinkComponent getLink(String theRelation) { 1042 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 1043 for (BundleLinkComponent next : getLink()) { 1044 if (theRelation.equals(next.getRelation())) { 1045 return next; 1046 } 1047 } 1048 return null; 1049 } 1050 1051 /** 1052 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 1053 * If no link is found which matches the given relation, creates a new BundleLinkComponent with the 1054 * given relation and adds it to this Bundle. If more than one 1055 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 1056 * 1057 * @param theRelation 1058 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 1059 * @return Returns a matching BundleLinkComponent, or <code>null</code> 1060 * @see IBaseBundle#LINK_NEXT 1061 * @see IBaseBundle#LINK_PREV 1062 * @see IBaseBundle#LINK_SELF 1063 */ 1064 public BundleLinkComponent getLinkOrCreate(String theRelation) { 1065 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 1066 for (BundleLinkComponent next : getLink()) { 1067 if (theRelation.equals(next.getRelation())) { 1068 return next; 1069 } 1070 } 1071 BundleLinkComponent retVal = new BundleLinkComponent(); 1072 retVal.setRelation(theRelation); 1073 getLink().add(retVal); 1074 return retVal; 1075 } 1076 protected void listChildren(List<Property> children) { 1077 super.listChildren(children); 1078 children.add(new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0, java.lang.Integer.MAX_VALUE, link)); 1079 children.add(new Property("fullUrl", "uri", "The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.", 0, 1, fullUrl)); 1080 children.add(new Property("resource", "Resource", "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.", 0, 1, resource)); 1081 children.add(new Property("search", "", "Information about the search process that lead to the creation of this entry.", 0, 1, search)); 1082 children.add(new Property("request", "", "Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry.", 0, 1, request)); 1083 children.add(new Property("response", "", "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.", 0, 1, response)); 1084 } 1085 1086 @Override 1087 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1088 switch (_hash) { 1089 case 3321850: /*link*/ return new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0, java.lang.Integer.MAX_VALUE, link); 1090 case -511251360: /*fullUrl*/ return new Property("fullUrl", "uri", "The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: \n* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)\n* Results from operations might involve resources that are not identified.", 0, 1, fullUrl); 1091 case -341064690: /*resource*/ return new Property("resource", "Resource", "The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type.", 0, 1, resource); 1092 case -906336856: /*search*/ return new Property("search", "", "Information about the search process that lead to the creation of this entry.", 0, 1, search); 1093 case 1095692943: /*request*/ return new Property("request", "", "Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry.", 0, 1, request); 1094 case -340323263: /*response*/ return new Property("response", "", "Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history.", 0, 1, response); 1095 default: return super.getNamedProperty(_hash, _name, _checkValid); 1096 } 1097 1098 } 1099 1100 @Override 1101 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1102 switch (hash) { 1103 case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // BundleLinkComponent 1104 case -511251360: /*fullUrl*/ return this.fullUrl == null ? new Base[0] : new Base[] {this.fullUrl}; // UriType 1105 case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Resource 1106 case -906336856: /*search*/ return this.search == null ? new Base[0] : new Base[] {this.search}; // BundleEntrySearchComponent 1107 case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // BundleEntryRequestComponent 1108 case -340323263: /*response*/ return this.response == null ? new Base[0] : new Base[] {this.response}; // BundleEntryResponseComponent 1109 default: return super.getProperty(hash, name, checkValid); 1110 } 1111 1112 } 1113 1114 @Override 1115 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1116 switch (hash) { 1117 case 3321850: // link 1118 this.getLink().add((BundleLinkComponent) value); // BundleLinkComponent 1119 return value; 1120 case -511251360: // fullUrl 1121 this.fullUrl = castToUri(value); // UriType 1122 return value; 1123 case -341064690: // resource 1124 this.resource = castToResource(value); // Resource 1125 return value; 1126 case -906336856: // search 1127 this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent 1128 return value; 1129 case 1095692943: // request 1130 this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent 1131 return value; 1132 case -340323263: // response 1133 this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent 1134 return value; 1135 default: return super.setProperty(hash, name, value); 1136 } 1137 1138 } 1139 1140 @Override 1141 public Base setProperty(String name, Base value) throws FHIRException { 1142 if (name.equals("link")) { 1143 this.getLink().add((BundleLinkComponent) value); 1144 } else if (name.equals("fullUrl")) { 1145 this.fullUrl = castToUri(value); // UriType 1146 } else if (name.equals("resource")) { 1147 this.resource = castToResource(value); // Resource 1148 } else if (name.equals("search")) { 1149 this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent 1150 } else if (name.equals("request")) { 1151 this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent 1152 } else if (name.equals("response")) { 1153 this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent 1154 } else 1155 return super.setProperty(name, value); 1156 return value; 1157 } 1158 1159 @Override 1160 public Base makeProperty(int hash, String name) throws FHIRException { 1161 switch (hash) { 1162 case 3321850: return addLink(); 1163 case -511251360: return getFullUrlElement(); 1164 case -341064690: throw new FHIRException("Cannot make property resource as it is not a complex type"); // Resource 1165 case -906336856: return getSearch(); 1166 case 1095692943: return getRequest(); 1167 case -340323263: return getResponse(); 1168 default: return super.makeProperty(hash, name); 1169 } 1170 1171 } 1172 1173 @Override 1174 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1175 switch (hash) { 1176 case 3321850: /*link*/ return new String[] {"@Bundle.link"}; 1177 case -511251360: /*fullUrl*/ return new String[] {"uri"}; 1178 case -341064690: /*resource*/ return new String[] {"Resource"}; 1179 case -906336856: /*search*/ return new String[] {}; 1180 case 1095692943: /*request*/ return new String[] {}; 1181 case -340323263: /*response*/ return new String[] {}; 1182 default: return super.getTypesForProperty(hash, name); 1183 } 1184 1185 } 1186 1187 @Override 1188 public Base addChild(String name) throws FHIRException { 1189 if (name.equals("link")) { 1190 return addLink(); 1191 } 1192 else if (name.equals("fullUrl")) { 1193 throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); 1194 } 1195 else if (name.equals("resource")) { 1196 throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); 1197 } 1198 else if (name.equals("search")) { 1199 this.search = new BundleEntrySearchComponent(); 1200 return this.search; 1201 } 1202 else if (name.equals("request")) { 1203 this.request = new BundleEntryRequestComponent(); 1204 return this.request; 1205 } 1206 else if (name.equals("response")) { 1207 this.response = new BundleEntryResponseComponent(); 1208 return this.response; 1209 } 1210 else 1211 return super.addChild(name); 1212 } 1213 1214 public BundleEntryComponent copy() { 1215 BundleEntryComponent dst = new BundleEntryComponent(); 1216 copyValues(dst); 1217 return dst; 1218 } 1219 1220 public void copyValues(BundleEntryComponent dst) { 1221 super.copyValues(dst); 1222 if (link != null) { 1223 dst.link = new ArrayList<BundleLinkComponent>(); 1224 for (BundleLinkComponent i : link) 1225 dst.link.add(i.copy()); 1226 }; 1227 dst.fullUrl = fullUrl == null ? null : fullUrl.copy(); 1228 dst.resource = resource == null ? null : resource.copy(); 1229 dst.search = search == null ? null : search.copy(); 1230 dst.request = request == null ? null : request.copy(); 1231 dst.response = response == null ? null : response.copy(); 1232 } 1233 1234 @Override 1235 public boolean equalsDeep(Base other_) { 1236 if (!super.equalsDeep(other_)) 1237 return false; 1238 if (!(other_ instanceof BundleEntryComponent)) 1239 return false; 1240 BundleEntryComponent o = (BundleEntryComponent) other_; 1241 return compareDeep(link, o.link, true) && compareDeep(fullUrl, o.fullUrl, true) && compareDeep(resource, o.resource, true) 1242 && compareDeep(search, o.search, true) && compareDeep(request, o.request, true) && compareDeep(response, o.response, true) 1243 ; 1244 } 1245 1246 @Override 1247 public boolean equalsShallow(Base other_) { 1248 if (!super.equalsShallow(other_)) 1249 return false; 1250 if (!(other_ instanceof BundleEntryComponent)) 1251 return false; 1252 BundleEntryComponent o = (BundleEntryComponent) other_; 1253 return compareValues(fullUrl, o.fullUrl, true); 1254 } 1255 1256 public boolean isEmpty() { 1257 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(link, fullUrl, resource 1258 , search, request, response); 1259 } 1260 1261 public String fhirType() { 1262 return "Bundle.entry"; 1263 1264 } 1265 1266 } 1267 1268 @Block() 1269 public static class BundleEntrySearchComponent extends BackboneElement implements IBaseBackboneElement { 1270 /** 1271 * Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process. 1272 */ 1273 @Child(name = "mode", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 1274 @Description(shortDefinition="match | include | outcome - why this is in the result set", formalDefinition="Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process." ) 1275 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/search-entry-mode") 1276 protected Enumeration<SearchEntryMode> mode; 1277 1278 /** 1279 * When searching, the server's search ranking score for the entry. 1280 */ 1281 @Child(name = "score", type = {DecimalType.class}, order=2, min=0, max=1, modifier=false, summary=true) 1282 @Description(shortDefinition="Search ranking (between 0 and 1)", formalDefinition="When searching, the server's search ranking score for the entry." ) 1283 protected DecimalType score; 1284 1285 private static final long serialVersionUID = 837739866L; 1286 1287 /** 1288 * Constructor 1289 */ 1290 public BundleEntrySearchComponent() { 1291 super(); 1292 } 1293 1294 /** 1295 * @return {@link #mode} (Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value 1296 */ 1297 public Enumeration<SearchEntryMode> getModeElement() { 1298 if (this.mode == null) 1299 if (Configuration.errorOnAutoCreate()) 1300 throw new Error("Attempt to auto-create BundleEntrySearchComponent.mode"); 1301 else if (Configuration.doAutoCreate()) 1302 this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); // bb 1303 return this.mode; 1304 } 1305 1306 public boolean hasModeElement() { 1307 return this.mode != null && !this.mode.isEmpty(); 1308 } 1309 1310 public boolean hasMode() { 1311 return this.mode != null && !this.mode.isEmpty(); 1312 } 1313 1314 /** 1315 * @param value {@link #mode} (Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value 1316 */ 1317 public BundleEntrySearchComponent setModeElement(Enumeration<SearchEntryMode> value) { 1318 this.mode = value; 1319 return this; 1320 } 1321 1322 /** 1323 * @return Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process. 1324 */ 1325 public SearchEntryMode getMode() { 1326 return this.mode == null ? null : this.mode.getValue(); 1327 } 1328 1329 /** 1330 * @param value Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process. 1331 */ 1332 public BundleEntrySearchComponent setMode(SearchEntryMode value) { 1333 if (value == null) 1334 this.mode = null; 1335 else { 1336 if (this.mode == null) 1337 this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); 1338 this.mode.setValue(value); 1339 } 1340 return this; 1341 } 1342 1343 /** 1344 * @return {@link #score} (When searching, the server's search ranking score for the entry.). This is the underlying object with id, value and extensions. The accessor "getScore" gives direct access to the value 1345 */ 1346 public DecimalType getScoreElement() { 1347 if (this.score == null) 1348 if (Configuration.errorOnAutoCreate()) 1349 throw new Error("Attempt to auto-create BundleEntrySearchComponent.score"); 1350 else if (Configuration.doAutoCreate()) 1351 this.score = new DecimalType(); // bb 1352 return this.score; 1353 } 1354 1355 public boolean hasScoreElement() { 1356 return this.score != null && !this.score.isEmpty(); 1357 } 1358 1359 public boolean hasScore() { 1360 return this.score != null && !this.score.isEmpty(); 1361 } 1362 1363 /** 1364 * @param value {@link #score} (When searching, the server's search ranking score for the entry.). This is the underlying object with id, value and extensions. The accessor "getScore" gives direct access to the value 1365 */ 1366 public BundleEntrySearchComponent setScoreElement(DecimalType value) { 1367 this.score = value; 1368 return this; 1369 } 1370 1371 /** 1372 * @return When searching, the server's search ranking score for the entry. 1373 */ 1374 public BigDecimal getScore() { 1375 return this.score == null ? null : this.score.getValue(); 1376 } 1377 1378 /** 1379 * @param value When searching, the server's search ranking score for the entry. 1380 */ 1381 public BundleEntrySearchComponent setScore(BigDecimal value) { 1382 if (value == null) 1383 this.score = null; 1384 else { 1385 if (this.score == null) 1386 this.score = new DecimalType(); 1387 this.score.setValue(value); 1388 } 1389 return this; 1390 } 1391 1392 /** 1393 * @param value When searching, the server's search ranking score for the entry. 1394 */ 1395 public BundleEntrySearchComponent setScore(long value) { 1396 this.score = new DecimalType(); 1397 this.score.setValue(value); 1398 return this; 1399 } 1400 1401 /** 1402 * @param value When searching, the server's search ranking score for the entry. 1403 */ 1404 public BundleEntrySearchComponent setScore(double value) { 1405 this.score = new DecimalType(); 1406 this.score.setValue(value); 1407 return this; 1408 } 1409 1410 protected void listChildren(List<Property> children) { 1411 super.listChildren(children); 1412 children.add(new Property("mode", "code", "Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.", 0, 1, mode)); 1413 children.add(new Property("score", "decimal", "When searching, the server's search ranking score for the entry.", 0, 1, score)); 1414 } 1415 1416 @Override 1417 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1418 switch (_hash) { 1419 case 3357091: /*mode*/ return new Property("mode", "code", "Why this entry is in the result set - whether it's included as a match or because of an _include requirement, or to convey information or warning information about the search process.", 0, 1, mode); 1420 case 109264530: /*score*/ return new Property("score", "decimal", "When searching, the server's search ranking score for the entry.", 0, 1, score); 1421 default: return super.getNamedProperty(_hash, _name, _checkValid); 1422 } 1423 1424 } 1425 1426 @Override 1427 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1428 switch (hash) { 1429 case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<SearchEntryMode> 1430 case 109264530: /*score*/ return this.score == null ? new Base[0] : new Base[] {this.score}; // DecimalType 1431 default: return super.getProperty(hash, name, checkValid); 1432 } 1433 1434 } 1435 1436 @Override 1437 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1438 switch (hash) { 1439 case 3357091: // mode 1440 value = new SearchEntryModeEnumFactory().fromType(castToCode(value)); 1441 this.mode = (Enumeration) value; // Enumeration<SearchEntryMode> 1442 return value; 1443 case 109264530: // score 1444 this.score = castToDecimal(value); // DecimalType 1445 return value; 1446 default: return super.setProperty(hash, name, value); 1447 } 1448 1449 } 1450 1451 @Override 1452 public Base setProperty(String name, Base value) throws FHIRException { 1453 if (name.equals("mode")) { 1454 value = new SearchEntryModeEnumFactory().fromType(castToCode(value)); 1455 this.mode = (Enumeration) value; // Enumeration<SearchEntryMode> 1456 } else if (name.equals("score")) { 1457 this.score = castToDecimal(value); // DecimalType 1458 } else 1459 return super.setProperty(name, value); 1460 return value; 1461 } 1462 1463 @Override 1464 public Base makeProperty(int hash, String name) throws FHIRException { 1465 switch (hash) { 1466 case 3357091: return getModeElement(); 1467 case 109264530: return getScoreElement(); 1468 default: return super.makeProperty(hash, name); 1469 } 1470 1471 } 1472 1473 @Override 1474 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1475 switch (hash) { 1476 case 3357091: /*mode*/ return new String[] {"code"}; 1477 case 109264530: /*score*/ return new String[] {"decimal"}; 1478 default: return super.getTypesForProperty(hash, name); 1479 } 1480 1481 } 1482 1483 @Override 1484 public Base addChild(String name) throws FHIRException { 1485 if (name.equals("mode")) { 1486 throw new FHIRException("Cannot call addChild on a primitive type Bundle.mode"); 1487 } 1488 else if (name.equals("score")) { 1489 throw new FHIRException("Cannot call addChild on a primitive type Bundle.score"); 1490 } 1491 else 1492 return super.addChild(name); 1493 } 1494 1495 public BundleEntrySearchComponent copy() { 1496 BundleEntrySearchComponent dst = new BundleEntrySearchComponent(); 1497 copyValues(dst); 1498 return dst; 1499 } 1500 1501 public void copyValues(BundleEntrySearchComponent dst) { 1502 super.copyValues(dst); 1503 dst.mode = mode == null ? null : mode.copy(); 1504 dst.score = score == null ? null : score.copy(); 1505 } 1506 1507 @Override 1508 public boolean equalsDeep(Base other_) { 1509 if (!super.equalsDeep(other_)) 1510 return false; 1511 if (!(other_ instanceof BundleEntrySearchComponent)) 1512 return false; 1513 BundleEntrySearchComponent o = (BundleEntrySearchComponent) other_; 1514 return compareDeep(mode, o.mode, true) && compareDeep(score, o.score, true); 1515 } 1516 1517 @Override 1518 public boolean equalsShallow(Base other_) { 1519 if (!super.equalsShallow(other_)) 1520 return false; 1521 if (!(other_ instanceof BundleEntrySearchComponent)) 1522 return false; 1523 BundleEntrySearchComponent o = (BundleEntrySearchComponent) other_; 1524 return compareValues(mode, o.mode, true) && compareValues(score, o.score, true); 1525 } 1526 1527 public boolean isEmpty() { 1528 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(mode, score); 1529 } 1530 1531 public String fhirType() { 1532 return "Bundle.entry.search"; 1533 1534 } 1535 1536 } 1537 1538 @Block() 1539 public static class BundleEntryRequestComponent extends BackboneElement implements IBaseBackboneElement { 1540 /** 1541 * In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred. 1542 */ 1543 @Child(name = "method", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 1544 @Description(shortDefinition="GET | HEAD | POST | PUT | DELETE | PATCH", formalDefinition="In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred." ) 1545 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/http-verb") 1546 protected Enumeration<HTTPVerb> method; 1547 1548 /** 1549 * The URL for this entry, relative to the root (the address to which the request is posted). 1550 */ 1551 @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 1552 @Description(shortDefinition="URL for HTTP equivalent of this entry", formalDefinition="The URL for this entry, relative to the root (the address to which the request is posted)." ) 1553 protected UriType url; 1554 1555 /** 1556 * If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1557 */ 1558 @Child(name = "ifNoneMatch", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 1559 @Description(shortDefinition="For managing cache currency", formalDefinition="If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread)." ) 1560 protected StringType ifNoneMatch; 1561 1562 /** 1563 * Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1564 */ 1565 @Child(name = "ifModifiedSince", type = {InstantType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1566 @Description(shortDefinition="For managing cache currency", formalDefinition="Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread)." ) 1567 protected InstantType ifModifiedSince; 1568 1569 /** 1570 * Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1571 */ 1572 @Child(name = "ifMatch", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1573 @Description(shortDefinition="For managing update contention", formalDefinition="Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency)." ) 1574 protected StringType ifMatch; 1575 1576 /** 1577 * Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?"). 1578 */ 1579 @Child(name = "ifNoneExist", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true) 1580 @Description(shortDefinition="For conditional creates", formalDefinition="Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\")." ) 1581 protected StringType ifNoneExist; 1582 1583 private static final long serialVersionUID = -1349769744L; 1584 1585 /** 1586 * Constructor 1587 */ 1588 public BundleEntryRequestComponent() { 1589 super(); 1590 } 1591 1592 /** 1593 * Constructor 1594 */ 1595 public BundleEntryRequestComponent(Enumeration<HTTPVerb> method, UriType url) { 1596 super(); 1597 this.method = method; 1598 this.url = url; 1599 } 1600 1601 /** 1602 * @return {@link #method} (In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.). This is the underlying object with id, value and extensions. The accessor "getMethod" gives direct access to the value 1603 */ 1604 public Enumeration<HTTPVerb> getMethodElement() { 1605 if (this.method == null) 1606 if (Configuration.errorOnAutoCreate()) 1607 throw new Error("Attempt to auto-create BundleEntryRequestComponent.method"); 1608 else if (Configuration.doAutoCreate()) 1609 this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); // bb 1610 return this.method; 1611 } 1612 1613 public boolean hasMethodElement() { 1614 return this.method != null && !this.method.isEmpty(); 1615 } 1616 1617 public boolean hasMethod() { 1618 return this.method != null && !this.method.isEmpty(); 1619 } 1620 1621 /** 1622 * @param value {@link #method} (In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.). This is the underlying object with id, value and extensions. The accessor "getMethod" gives direct access to the value 1623 */ 1624 public BundleEntryRequestComponent setMethodElement(Enumeration<HTTPVerb> value) { 1625 this.method = value; 1626 return this; 1627 } 1628 1629 /** 1630 * @return In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred. 1631 */ 1632 public HTTPVerb getMethod() { 1633 return this.method == null ? null : this.method.getValue(); 1634 } 1635 1636 /** 1637 * @param value In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred. 1638 */ 1639 public BundleEntryRequestComponent setMethod(HTTPVerb value) { 1640 if (this.method == null) 1641 this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); 1642 this.method.setValue(value); 1643 return this; 1644 } 1645 1646 /** 1647 * @return {@link #url} (The URL for this entry, relative to the root (the address to which the request is posted).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 1648 */ 1649 public UriType getUrlElement() { 1650 if (this.url == null) 1651 if (Configuration.errorOnAutoCreate()) 1652 throw new Error("Attempt to auto-create BundleEntryRequestComponent.url"); 1653 else if (Configuration.doAutoCreate()) 1654 this.url = new UriType(); // bb 1655 return this.url; 1656 } 1657 1658 public boolean hasUrlElement() { 1659 return this.url != null && !this.url.isEmpty(); 1660 } 1661 1662 public boolean hasUrl() { 1663 return this.url != null && !this.url.isEmpty(); 1664 } 1665 1666 /** 1667 * @param value {@link #url} (The URL for this entry, relative to the root (the address to which the request is posted).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 1668 */ 1669 public BundleEntryRequestComponent setUrlElement(UriType value) { 1670 this.url = value; 1671 return this; 1672 } 1673 1674 /** 1675 * @return The URL for this entry, relative to the root (the address to which the request is posted). 1676 */ 1677 public String getUrl() { 1678 return this.url == null ? null : this.url.getValue(); 1679 } 1680 1681 /** 1682 * @param value The URL for this entry, relative to the root (the address to which the request is posted). 1683 */ 1684 public BundleEntryRequestComponent setUrl(String value) { 1685 if (this.url == null) 1686 this.url = new UriType(); 1687 this.url.setValue(value); 1688 return this; 1689 } 1690 1691 /** 1692 * @return {@link #ifNoneMatch} (If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread).). This is the underlying object with id, value and extensions. The accessor "getIfNoneMatch" gives direct access to the value 1693 */ 1694 public StringType getIfNoneMatchElement() { 1695 if (this.ifNoneMatch == null) 1696 if (Configuration.errorOnAutoCreate()) 1697 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneMatch"); 1698 else if (Configuration.doAutoCreate()) 1699 this.ifNoneMatch = new StringType(); // bb 1700 return this.ifNoneMatch; 1701 } 1702 1703 public boolean hasIfNoneMatchElement() { 1704 return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty(); 1705 } 1706 1707 public boolean hasIfNoneMatch() { 1708 return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty(); 1709 } 1710 1711 /** 1712 * @param value {@link #ifNoneMatch} (If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread).). This is the underlying object with id, value and extensions. The accessor "getIfNoneMatch" gives direct access to the value 1713 */ 1714 public BundleEntryRequestComponent setIfNoneMatchElement(StringType value) { 1715 this.ifNoneMatch = value; 1716 return this; 1717 } 1718 1719 /** 1720 * @return If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1721 */ 1722 public String getIfNoneMatch() { 1723 return this.ifNoneMatch == null ? null : this.ifNoneMatch.getValue(); 1724 } 1725 1726 /** 1727 * @param value If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1728 */ 1729 public BundleEntryRequestComponent setIfNoneMatch(String value) { 1730 if (Utilities.noString(value)) 1731 this.ifNoneMatch = null; 1732 else { 1733 if (this.ifNoneMatch == null) 1734 this.ifNoneMatch = new StringType(); 1735 this.ifNoneMatch.setValue(value); 1736 } 1737 return this; 1738 } 1739 1740 /** 1741 * @return {@link #ifModifiedSince} (Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread).). This is the underlying object with id, value and extensions. The accessor "getIfModifiedSince" gives direct access to the value 1742 */ 1743 public InstantType getIfModifiedSinceElement() { 1744 if (this.ifModifiedSince == null) 1745 if (Configuration.errorOnAutoCreate()) 1746 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifModifiedSince"); 1747 else if (Configuration.doAutoCreate()) 1748 this.ifModifiedSince = new InstantType(); // bb 1749 return this.ifModifiedSince; 1750 } 1751 1752 public boolean hasIfModifiedSinceElement() { 1753 return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty(); 1754 } 1755 1756 public boolean hasIfModifiedSince() { 1757 return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty(); 1758 } 1759 1760 /** 1761 * @param value {@link #ifModifiedSince} (Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread).). This is the underlying object with id, value and extensions. The accessor "getIfModifiedSince" gives direct access to the value 1762 */ 1763 public BundleEntryRequestComponent setIfModifiedSinceElement(InstantType value) { 1764 this.ifModifiedSince = value; 1765 return this; 1766 } 1767 1768 /** 1769 * @return Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1770 */ 1771 public Date getIfModifiedSince() { 1772 return this.ifModifiedSince == null ? null : this.ifModifiedSince.getValue(); 1773 } 1774 1775 /** 1776 * @param value Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1777 */ 1778 public BundleEntryRequestComponent setIfModifiedSince(Date value) { 1779 if (value == null) 1780 this.ifModifiedSince = null; 1781 else { 1782 if (this.ifModifiedSince == null) 1783 this.ifModifiedSince = new InstantType(); 1784 this.ifModifiedSince.setValue(value); 1785 } 1786 return this; 1787 } 1788 1789 /** 1790 * @return {@link #ifMatch} (Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency).). This is the underlying object with id, value and extensions. The accessor "getIfMatch" gives direct access to the value 1791 */ 1792 public StringType getIfMatchElement() { 1793 if (this.ifMatch == null) 1794 if (Configuration.errorOnAutoCreate()) 1795 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifMatch"); 1796 else if (Configuration.doAutoCreate()) 1797 this.ifMatch = new StringType(); // bb 1798 return this.ifMatch; 1799 } 1800 1801 public boolean hasIfMatchElement() { 1802 return this.ifMatch != null && !this.ifMatch.isEmpty(); 1803 } 1804 1805 public boolean hasIfMatch() { 1806 return this.ifMatch != null && !this.ifMatch.isEmpty(); 1807 } 1808 1809 /** 1810 * @param value {@link #ifMatch} (Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency).). This is the underlying object with id, value and extensions. The accessor "getIfMatch" gives direct access to the value 1811 */ 1812 public BundleEntryRequestComponent setIfMatchElement(StringType value) { 1813 this.ifMatch = value; 1814 return this; 1815 } 1816 1817 /** 1818 * @return Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1819 */ 1820 public String getIfMatch() { 1821 return this.ifMatch == null ? null : this.ifMatch.getValue(); 1822 } 1823 1824 /** 1825 * @param value Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1826 */ 1827 public BundleEntryRequestComponent setIfMatch(String value) { 1828 if (Utilities.noString(value)) 1829 this.ifMatch = null; 1830 else { 1831 if (this.ifMatch == null) 1832 this.ifMatch = new StringType(); 1833 this.ifMatch.setValue(value); 1834 } 1835 return this; 1836 } 1837 1838 /** 1839 * @return {@link #ifNoneExist} (Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?").). This is the underlying object with id, value and extensions. The accessor "getIfNoneExist" gives direct access to the value 1840 */ 1841 public StringType getIfNoneExistElement() { 1842 if (this.ifNoneExist == null) 1843 if (Configuration.errorOnAutoCreate()) 1844 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneExist"); 1845 else if (Configuration.doAutoCreate()) 1846 this.ifNoneExist = new StringType(); // bb 1847 return this.ifNoneExist; 1848 } 1849 1850 public boolean hasIfNoneExistElement() { 1851 return this.ifNoneExist != null && !this.ifNoneExist.isEmpty(); 1852 } 1853 1854 public boolean hasIfNoneExist() { 1855 return this.ifNoneExist != null && !this.ifNoneExist.isEmpty(); 1856 } 1857 1858 /** 1859 * @param value {@link #ifNoneExist} (Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?").). This is the underlying object with id, value and extensions. The accessor "getIfNoneExist" gives direct access to the value 1860 */ 1861 public BundleEntryRequestComponent setIfNoneExistElement(StringType value) { 1862 this.ifNoneExist = value; 1863 return this; 1864 } 1865 1866 /** 1867 * @return Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?"). 1868 */ 1869 public String getIfNoneExist() { 1870 return this.ifNoneExist == null ? null : this.ifNoneExist.getValue(); 1871 } 1872 1873 /** 1874 * @param value Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?"). 1875 */ 1876 public BundleEntryRequestComponent setIfNoneExist(String value) { 1877 if (Utilities.noString(value)) 1878 this.ifNoneExist = null; 1879 else { 1880 if (this.ifNoneExist == null) 1881 this.ifNoneExist = new StringType(); 1882 this.ifNoneExist.setValue(value); 1883 } 1884 return this; 1885 } 1886 1887 protected void listChildren(List<Property> children) { 1888 super.listChildren(children); 1889 children.add(new Property("method", "code", "In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.", 0, 1, method)); 1890 children.add(new Property("url", "uri", "The URL for this entry, relative to the root (the address to which the request is posted).", 0, 1, url)); 1891 children.add(new Property("ifNoneMatch", "string", "If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).", 0, 1, ifNoneMatch)); 1892 children.add(new Property("ifModifiedSince", "instant", "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).", 0, 1, ifModifiedSince)); 1893 children.add(new Property("ifMatch", "string", "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).", 0, 1, ifMatch)); 1894 children.add(new Property("ifNoneExist", "string", "Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\").", 0, 1, ifNoneExist)); 1895 } 1896 1897 @Override 1898 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1899 switch (_hash) { 1900 case -1077554975: /*method*/ return new Property("method", "code", "In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred.", 0, 1, method); 1901 case 116079: /*url*/ return new Property("url", "uri", "The URL for this entry, relative to the root (the address to which the request is posted).", 0, 1, url); 1902 case 171868368: /*ifNoneMatch*/ return new Property("ifNoneMatch", "string", "If the ETag values match, return a 304 Not Modified status. See the API documentation for [\"Conditional Read\"](http.html#cread).", 0, 1, ifNoneMatch); 1903 case -2061602860: /*ifModifiedSince*/ return new Property("ifModifiedSince", "instant", "Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread).", 0, 1, ifModifiedSince); 1904 case 1692894888: /*ifMatch*/ return new Property("ifMatch", "string", "Only perform the operation if the Etag value matches. For more information, see the API section [\"Managing Resource Contention\"](http.html#concurrency).", 0, 1, ifMatch); 1905 case 165155330: /*ifNoneExist*/ return new Property("ifNoneExist", "string", "Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for [\"Conditional Create\"](http.html#ccreate). This is just the query portion of the URL - what follows the \"?\" (not including the \"?\").", 0, 1, ifNoneExist); 1906 default: return super.getNamedProperty(_hash, _name, _checkValid); 1907 } 1908 1909 } 1910 1911 @Override 1912 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1913 switch (hash) { 1914 case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // Enumeration<HTTPVerb> 1915 case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType 1916 case 171868368: /*ifNoneMatch*/ return this.ifNoneMatch == null ? new Base[0] : new Base[] {this.ifNoneMatch}; // StringType 1917 case -2061602860: /*ifModifiedSince*/ return this.ifModifiedSince == null ? new Base[0] : new Base[] {this.ifModifiedSince}; // InstantType 1918 case 1692894888: /*ifMatch*/ return this.ifMatch == null ? new Base[0] : new Base[] {this.ifMatch}; // StringType 1919 case 165155330: /*ifNoneExist*/ return this.ifNoneExist == null ? new Base[0] : new Base[] {this.ifNoneExist}; // StringType 1920 default: return super.getProperty(hash, name, checkValid); 1921 } 1922 1923 } 1924 1925 @Override 1926 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1927 switch (hash) { 1928 case -1077554975: // method 1929 value = new HTTPVerbEnumFactory().fromType(castToCode(value)); 1930 this.method = (Enumeration) value; // Enumeration<HTTPVerb> 1931 return value; 1932 case 116079: // url 1933 this.url = castToUri(value); // UriType 1934 return value; 1935 case 171868368: // ifNoneMatch 1936 this.ifNoneMatch = castToString(value); // StringType 1937 return value; 1938 case -2061602860: // ifModifiedSince 1939 this.ifModifiedSince = castToInstant(value); // InstantType 1940 return value; 1941 case 1692894888: // ifMatch 1942 this.ifMatch = castToString(value); // StringType 1943 return value; 1944 case 165155330: // ifNoneExist 1945 this.ifNoneExist = castToString(value); // StringType 1946 return value; 1947 default: return super.setProperty(hash, name, value); 1948 } 1949 1950 } 1951 1952 @Override 1953 public Base setProperty(String name, Base value) throws FHIRException { 1954 if (name.equals("method")) { 1955 value = new HTTPVerbEnumFactory().fromType(castToCode(value)); 1956 this.method = (Enumeration) value; // Enumeration<HTTPVerb> 1957 } else if (name.equals("url")) { 1958 this.url = castToUri(value); // UriType 1959 } else if (name.equals("ifNoneMatch")) { 1960 this.ifNoneMatch = castToString(value); // StringType 1961 } else if (name.equals("ifModifiedSince")) { 1962 this.ifModifiedSince = castToInstant(value); // InstantType 1963 } else if (name.equals("ifMatch")) { 1964 this.ifMatch = castToString(value); // StringType 1965 } else if (name.equals("ifNoneExist")) { 1966 this.ifNoneExist = castToString(value); // StringType 1967 } else 1968 return super.setProperty(name, value); 1969 return value; 1970 } 1971 1972 @Override 1973 public Base makeProperty(int hash, String name) throws FHIRException { 1974 switch (hash) { 1975 case -1077554975: return getMethodElement(); 1976 case 116079: return getUrlElement(); 1977 case 171868368: return getIfNoneMatchElement(); 1978 case -2061602860: return getIfModifiedSinceElement(); 1979 case 1692894888: return getIfMatchElement(); 1980 case 165155330: return getIfNoneExistElement(); 1981 default: return super.makeProperty(hash, name); 1982 } 1983 1984 } 1985 1986 @Override 1987 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1988 switch (hash) { 1989 case -1077554975: /*method*/ return new String[] {"code"}; 1990 case 116079: /*url*/ return new String[] {"uri"}; 1991 case 171868368: /*ifNoneMatch*/ return new String[] {"string"}; 1992 case -2061602860: /*ifModifiedSince*/ return new String[] {"instant"}; 1993 case 1692894888: /*ifMatch*/ return new String[] {"string"}; 1994 case 165155330: /*ifNoneExist*/ return new String[] {"string"}; 1995 default: return super.getTypesForProperty(hash, name); 1996 } 1997 1998 } 1999 2000 @Override 2001 public Base addChild(String name) throws FHIRException { 2002 if (name.equals("method")) { 2003 throw new FHIRException("Cannot call addChild on a primitive type Bundle.method"); 2004 } 2005 else if (name.equals("url")) { 2006 throw new FHIRException("Cannot call addChild on a primitive type Bundle.url"); 2007 } 2008 else if (name.equals("ifNoneMatch")) { 2009 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifNoneMatch"); 2010 } 2011 else if (name.equals("ifModifiedSince")) { 2012 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifModifiedSince"); 2013 } 2014 else if (name.equals("ifMatch")) { 2015 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifMatch"); 2016 } 2017 else if (name.equals("ifNoneExist")) { 2018 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifNoneExist"); 2019 } 2020 else 2021 return super.addChild(name); 2022 } 2023 2024 public BundleEntryRequestComponent copy() { 2025 BundleEntryRequestComponent dst = new BundleEntryRequestComponent(); 2026 copyValues(dst); 2027 return dst; 2028 } 2029 2030 public void copyValues(BundleEntryRequestComponent dst) { 2031 super.copyValues(dst); 2032 dst.method = method == null ? null : method.copy(); 2033 dst.url = url == null ? null : url.copy(); 2034 dst.ifNoneMatch = ifNoneMatch == null ? null : ifNoneMatch.copy(); 2035 dst.ifModifiedSince = ifModifiedSince == null ? null : ifModifiedSince.copy(); 2036 dst.ifMatch = ifMatch == null ? null : ifMatch.copy(); 2037 dst.ifNoneExist = ifNoneExist == null ? null : ifNoneExist.copy(); 2038 } 2039 2040 @Override 2041 public boolean equalsDeep(Base other_) { 2042 if (!super.equalsDeep(other_)) 2043 return false; 2044 if (!(other_ instanceof BundleEntryRequestComponent)) 2045 return false; 2046 BundleEntryRequestComponent o = (BundleEntryRequestComponent) other_; 2047 return compareDeep(method, o.method, true) && compareDeep(url, o.url, true) && compareDeep(ifNoneMatch, o.ifNoneMatch, true) 2048 && compareDeep(ifModifiedSince, o.ifModifiedSince, true) && compareDeep(ifMatch, o.ifMatch, true) 2049 && compareDeep(ifNoneExist, o.ifNoneExist, true); 2050 } 2051 2052 @Override 2053 public boolean equalsShallow(Base other_) { 2054 if (!super.equalsShallow(other_)) 2055 return false; 2056 if (!(other_ instanceof BundleEntryRequestComponent)) 2057 return false; 2058 BundleEntryRequestComponent o = (BundleEntryRequestComponent) other_; 2059 return compareValues(method, o.method, true) && compareValues(url, o.url, true) && compareValues(ifNoneMatch, o.ifNoneMatch, true) 2060 && compareValues(ifModifiedSince, o.ifModifiedSince, true) && compareValues(ifMatch, o.ifMatch, true) 2061 && compareValues(ifNoneExist, o.ifNoneExist, true); 2062 } 2063 2064 public boolean isEmpty() { 2065 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(method, url, ifNoneMatch 2066 , ifModifiedSince, ifMatch, ifNoneExist); 2067 } 2068 2069 public String fhirType() { 2070 return "Bundle.entry.request"; 2071 2072 } 2073 2074 } 2075 2076 @Block() 2077 public static class BundleEntryResponseComponent extends BackboneElement implements IBaseBackboneElement { 2078 /** 2079 * The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code. 2080 */ 2081 @Child(name = "status", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 2082 @Description(shortDefinition="Status response code (text optional)", formalDefinition="The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code." ) 2083 protected StringType status; 2084 2085 /** 2086 * The location header created by processing this operation, populated if the operation returns a location. 2087 */ 2088 @Child(name = "location", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 2089 @Description(shortDefinition="The location (if the operation returns a location)", formalDefinition="The location header created by processing this operation, populated if the operation returns a location." ) 2090 protected UriType location; 2091 2092 /** 2093 * The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)). 2094 */ 2095 @Child(name = "etag", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 2096 @Description(shortDefinition="The Etag for the resource (if relevant)", formalDefinition="The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency))." ) 2097 protected StringType etag; 2098 2099 /** 2100 * The date/time that the resource was modified on the server. 2101 */ 2102 @Child(name = "lastModified", type = {InstantType.class}, order=4, min=0, max=1, modifier=false, summary=true) 2103 @Description(shortDefinition="Server's date time modified", formalDefinition="The date/time that the resource was modified on the server." ) 2104 protected InstantType lastModified; 2105 2106 /** 2107 * An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction. 2108 */ 2109 @Child(name = "outcome", type = {Resource.class}, order=5, min=0, max=1, modifier=false, summary=true) 2110 @Description(shortDefinition="OperationOutcome with hints and warnings (for batch/transaction)", formalDefinition="An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction." ) 2111 protected Resource outcome; 2112 2113 private static final long serialVersionUID = 923278008L; 2114 2115 /** 2116 * Constructor 2117 */ 2118 public BundleEntryResponseComponent() { 2119 super(); 2120 } 2121 2122 /** 2123 * Constructor 2124 */ 2125 public BundleEntryResponseComponent(StringType status) { 2126 super(); 2127 this.status = status; 2128 } 2129 2130 /** 2131 * @return {@link #status} (The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 2132 */ 2133 public StringType getStatusElement() { 2134 if (this.status == null) 2135 if (Configuration.errorOnAutoCreate()) 2136 throw new Error("Attempt to auto-create BundleEntryResponseComponent.status"); 2137 else if (Configuration.doAutoCreate()) 2138 this.status = new StringType(); // bb 2139 return this.status; 2140 } 2141 2142 public boolean hasStatusElement() { 2143 return this.status != null && !this.status.isEmpty(); 2144 } 2145 2146 public boolean hasStatus() { 2147 return this.status != null && !this.status.isEmpty(); 2148 } 2149 2150 /** 2151 * @param value {@link #status} (The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 2152 */ 2153 public BundleEntryResponseComponent setStatusElement(StringType value) { 2154 this.status = value; 2155 return this; 2156 } 2157 2158 /** 2159 * @return The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code. 2160 */ 2161 public String getStatus() { 2162 return this.status == null ? null : this.status.getValue(); 2163 } 2164 2165 /** 2166 * @param value The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code. 2167 */ 2168 public BundleEntryResponseComponent setStatus(String value) { 2169 if (this.status == null) 2170 this.status = new StringType(); 2171 this.status.setValue(value); 2172 return this; 2173 } 2174 2175 /** 2176 * @return {@link #location} (The location header created by processing this operation, populated if the operation returns a location.). This is the underlying object with id, value and extensions. The accessor "getLocation" gives direct access to the value 2177 */ 2178 public UriType getLocationElement() { 2179 if (this.location == null) 2180 if (Configuration.errorOnAutoCreate()) 2181 throw new Error("Attempt to auto-create BundleEntryResponseComponent.location"); 2182 else if (Configuration.doAutoCreate()) 2183 this.location = new UriType(); // bb 2184 return this.location; 2185 } 2186 2187 public boolean hasLocationElement() { 2188 return this.location != null && !this.location.isEmpty(); 2189 } 2190 2191 public boolean hasLocation() { 2192 return this.location != null && !this.location.isEmpty(); 2193 } 2194 2195 /** 2196 * @param value {@link #location} (The location header created by processing this operation, populated if the operation returns a location.). This is the underlying object with id, value and extensions. The accessor "getLocation" gives direct access to the value 2197 */ 2198 public BundleEntryResponseComponent setLocationElement(UriType value) { 2199 this.location = value; 2200 return this; 2201 } 2202 2203 /** 2204 * @return The location header created by processing this operation, populated if the operation returns a location. 2205 */ 2206 public String getLocation() { 2207 return this.location == null ? null : this.location.getValue(); 2208 } 2209 2210 /** 2211 * @param value The location header created by processing this operation, populated if the operation returns a location. 2212 */ 2213 public BundleEntryResponseComponent setLocation(String value) { 2214 if (Utilities.noString(value)) 2215 this.location = null; 2216 else { 2217 if (this.location == null) 2218 this.location = new UriType(); 2219 this.location.setValue(value); 2220 } 2221 return this; 2222 } 2223 2224 /** 2225 * @return {@link #etag} (The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).). This is the underlying object with id, value and extensions. The accessor "getEtag" gives direct access to the value 2226 */ 2227 public StringType getEtagElement() { 2228 if (this.etag == null) 2229 if (Configuration.errorOnAutoCreate()) 2230 throw new Error("Attempt to auto-create BundleEntryResponseComponent.etag"); 2231 else if (Configuration.doAutoCreate()) 2232 this.etag = new StringType(); // bb 2233 return this.etag; 2234 } 2235 2236 public boolean hasEtagElement() { 2237 return this.etag != null && !this.etag.isEmpty(); 2238 } 2239 2240 public boolean hasEtag() { 2241 return this.etag != null && !this.etag.isEmpty(); 2242 } 2243 2244 /** 2245 * @param value {@link #etag} (The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).). This is the underlying object with id, value and extensions. The accessor "getEtag" gives direct access to the value 2246 */ 2247 public BundleEntryResponseComponent setEtagElement(StringType value) { 2248 this.etag = value; 2249 return this; 2250 } 2251 2252 /** 2253 * @return The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)). 2254 */ 2255 public String getEtag() { 2256 return this.etag == null ? null : this.etag.getValue(); 2257 } 2258 2259 /** 2260 * @param value The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)). 2261 */ 2262 public BundleEntryResponseComponent setEtag(String value) { 2263 if (Utilities.noString(value)) 2264 this.etag = null; 2265 else { 2266 if (this.etag == null) 2267 this.etag = new StringType(); 2268 this.etag.setValue(value); 2269 } 2270 return this; 2271 } 2272 2273 /** 2274 * @return {@link #lastModified} (The date/time that the resource was modified on the server.). This is the underlying object with id, value and extensions. The accessor "getLastModified" gives direct access to the value 2275 */ 2276 public InstantType getLastModifiedElement() { 2277 if (this.lastModified == null) 2278 if (Configuration.errorOnAutoCreate()) 2279 throw new Error("Attempt to auto-create BundleEntryResponseComponent.lastModified"); 2280 else if (Configuration.doAutoCreate()) 2281 this.lastModified = new InstantType(); // bb 2282 return this.lastModified; 2283 } 2284 2285 public boolean hasLastModifiedElement() { 2286 return this.lastModified != null && !this.lastModified.isEmpty(); 2287 } 2288 2289 public boolean hasLastModified() { 2290 return this.lastModified != null && !this.lastModified.isEmpty(); 2291 } 2292 2293 /** 2294 * @param value {@link #lastModified} (The date/time that the resource was modified on the server.). This is the underlying object with id, value and extensions. The accessor "getLastModified" gives direct access to the value 2295 */ 2296 public BundleEntryResponseComponent setLastModifiedElement(InstantType value) { 2297 this.lastModified = value; 2298 return this; 2299 } 2300 2301 /** 2302 * @return The date/time that the resource was modified on the server. 2303 */ 2304 public Date getLastModified() { 2305 return this.lastModified == null ? null : this.lastModified.getValue(); 2306 } 2307 2308 /** 2309 * @param value The date/time that the resource was modified on the server. 2310 */ 2311 public BundleEntryResponseComponent setLastModified(Date value) { 2312 if (value == null) 2313 this.lastModified = null; 2314 else { 2315 if (this.lastModified == null) 2316 this.lastModified = new InstantType(); 2317 this.lastModified.setValue(value); 2318 } 2319 return this; 2320 } 2321 2322 /** 2323 * @return {@link #outcome} (An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.) 2324 */ 2325 public Resource getOutcome() { 2326 return this.outcome; 2327 } 2328 2329 public boolean hasOutcome() { 2330 return this.outcome != null && !this.outcome.isEmpty(); 2331 } 2332 2333 /** 2334 * @param value {@link #outcome} (An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.) 2335 */ 2336 public BundleEntryResponseComponent setOutcome(Resource value) { 2337 this.outcome = value; 2338 return this; 2339 } 2340 2341 protected void listChildren(List<Property> children) { 2342 super.listChildren(children); 2343 children.add(new Property("status", "string", "The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.", 0, 1, status)); 2344 children.add(new Property("location", "uri", "The location header created by processing this operation, populated if the operation returns a location.", 0, 1, location)); 2345 children.add(new Property("etag", "string", "The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).", 0, 1, etag)); 2346 children.add(new Property("lastModified", "instant", "The date/time that the resource was modified on the server.", 0, 1, lastModified)); 2347 children.add(new Property("outcome", "Resource", "An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.", 0, 1, outcome)); 2348 } 2349 2350 @Override 2351 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2352 switch (_hash) { 2353 case -892481550: /*status*/ return new Property("status", "string", "The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.", 0, 1, status); 2354 case 1901043637: /*location*/ return new Property("location", "uri", "The location header created by processing this operation, populated if the operation returns a location.", 0, 1, location); 2355 case 3123477: /*etag*/ return new Property("etag", "string", "The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).", 0, 1, etag); 2356 case 1959003007: /*lastModified*/ return new Property("lastModified", "instant", "The date/time that the resource was modified on the server.", 0, 1, lastModified); 2357 case -1106507950: /*outcome*/ return new Property("outcome", "Resource", "An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.", 0, 1, outcome); 2358 default: return super.getNamedProperty(_hash, _name, _checkValid); 2359 } 2360 2361 } 2362 2363 @Override 2364 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2365 switch (hash) { 2366 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // StringType 2367 case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // UriType 2368 case 3123477: /*etag*/ return this.etag == null ? new Base[0] : new Base[] {this.etag}; // StringType 2369 case 1959003007: /*lastModified*/ return this.lastModified == null ? new Base[0] : new Base[] {this.lastModified}; // InstantType 2370 case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Resource 2371 default: return super.getProperty(hash, name, checkValid); 2372 } 2373 2374 } 2375 2376 @Override 2377 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2378 switch (hash) { 2379 case -892481550: // status 2380 this.status = castToString(value); // StringType 2381 return value; 2382 case 1901043637: // location 2383 this.location = castToUri(value); // UriType 2384 return value; 2385 case 3123477: // etag 2386 this.etag = castToString(value); // StringType 2387 return value; 2388 case 1959003007: // lastModified 2389 this.lastModified = castToInstant(value); // InstantType 2390 return value; 2391 case -1106507950: // outcome 2392 this.outcome = castToResource(value); // Resource 2393 return value; 2394 default: return super.setProperty(hash, name, value); 2395 } 2396 2397 } 2398 2399 @Override 2400 public Base setProperty(String name, Base value) throws FHIRException { 2401 if (name.equals("status")) { 2402 this.status = castToString(value); // StringType 2403 } else if (name.equals("location")) { 2404 this.location = castToUri(value); // UriType 2405 } else if (name.equals("etag")) { 2406 this.etag = castToString(value); // StringType 2407 } else if (name.equals("lastModified")) { 2408 this.lastModified = castToInstant(value); // InstantType 2409 } else if (name.equals("outcome")) { 2410 this.outcome = castToResource(value); // Resource 2411 } else 2412 return super.setProperty(name, value); 2413 return value; 2414 } 2415 2416 @Override 2417 public Base makeProperty(int hash, String name) throws FHIRException { 2418 switch (hash) { 2419 case -892481550: return getStatusElement(); 2420 case 1901043637: return getLocationElement(); 2421 case 3123477: return getEtagElement(); 2422 case 1959003007: return getLastModifiedElement(); 2423 case -1106507950: throw new FHIRException("Cannot make property outcome as it is not a complex type"); // Resource 2424 default: return super.makeProperty(hash, name); 2425 } 2426 2427 } 2428 2429 @Override 2430 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2431 switch (hash) { 2432 case -892481550: /*status*/ return new String[] {"string"}; 2433 case 1901043637: /*location*/ return new String[] {"uri"}; 2434 case 3123477: /*etag*/ return new String[] {"string"}; 2435 case 1959003007: /*lastModified*/ return new String[] {"instant"}; 2436 case -1106507950: /*outcome*/ return new String[] {"Resource"}; 2437 default: return super.getTypesForProperty(hash, name); 2438 } 2439 2440 } 2441 2442 @Override 2443 public Base addChild(String name) throws FHIRException { 2444 if (name.equals("status")) { 2445 throw new FHIRException("Cannot call addChild on a primitive type Bundle.status"); 2446 } 2447 else if (name.equals("location")) { 2448 throw new FHIRException("Cannot call addChild on a primitive type Bundle.location"); 2449 } 2450 else if (name.equals("etag")) { 2451 throw new FHIRException("Cannot call addChild on a primitive type Bundle.etag"); 2452 } 2453 else if (name.equals("lastModified")) { 2454 throw new FHIRException("Cannot call addChild on a primitive type Bundle.lastModified"); 2455 } 2456 else if (name.equals("outcome")) { 2457 throw new FHIRException("Cannot call addChild on an abstract type Bundle.outcome"); 2458 } 2459 else 2460 return super.addChild(name); 2461 } 2462 2463 public BundleEntryResponseComponent copy() { 2464 BundleEntryResponseComponent dst = new BundleEntryResponseComponent(); 2465 copyValues(dst); 2466 return dst; 2467 } 2468 2469 public void copyValues(BundleEntryResponseComponent dst) { 2470 super.copyValues(dst); 2471 dst.status = status == null ? null : status.copy(); 2472 dst.location = location == null ? null : location.copy(); 2473 dst.etag = etag == null ? null : etag.copy(); 2474 dst.lastModified = lastModified == null ? null : lastModified.copy(); 2475 dst.outcome = outcome == null ? null : outcome.copy(); 2476 } 2477 2478 @Override 2479 public boolean equalsDeep(Base other_) { 2480 if (!super.equalsDeep(other_)) 2481 return false; 2482 if (!(other_ instanceof BundleEntryResponseComponent)) 2483 return false; 2484 BundleEntryResponseComponent o = (BundleEntryResponseComponent) other_; 2485 return compareDeep(status, o.status, true) && compareDeep(location, o.location, true) && compareDeep(etag, o.etag, true) 2486 && compareDeep(lastModified, o.lastModified, true) && compareDeep(outcome, o.outcome, true); 2487 } 2488 2489 @Override 2490 public boolean equalsShallow(Base other_) { 2491 if (!super.equalsShallow(other_)) 2492 return false; 2493 if (!(other_ instanceof BundleEntryResponseComponent)) 2494 return false; 2495 BundleEntryResponseComponent o = (BundleEntryResponseComponent) other_; 2496 return compareValues(status, o.status, true) && compareValues(location, o.location, true) && compareValues(etag, o.etag, true) 2497 && compareValues(lastModified, o.lastModified, true); 2498 } 2499 2500 public boolean isEmpty() { 2501 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(status, location, etag, lastModified 2502 , outcome); 2503 } 2504 2505 public String fhirType() { 2506 return "Bundle.entry.response"; 2507 2508 } 2509 2510 } 2511 2512 /** 2513 * A persistent identifier for the bundle that won't change as a bundle is copied from server to server. 2514 */ 2515 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 2516 @Description(shortDefinition="Persistent identifier for the bundle", formalDefinition="A persistent identifier for the bundle that won't change as a bundle is copied from server to server." ) 2517 protected Identifier identifier; 2518 2519 /** 2520 * Indicates the purpose of this bundle - how it is intended to be used. 2521 */ 2522 @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 2523 @Description(shortDefinition="document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", formalDefinition="Indicates the purpose of this bundle - how it is intended to be used." ) 2524 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bundle-type") 2525 protected Enumeration<BundleType> type; 2526 2527 /** 2528 * The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle. 2529 */ 2530 @Child(name = "timestamp", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=true) 2531 @Description(shortDefinition="When the bundle was assembled", formalDefinition="The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle." ) 2532 protected InstantType timestamp; 2533 2534 /** 2535 * If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle. 2536 */ 2537 @Child(name = "total", type = {UnsignedIntType.class}, order=3, min=0, max=1, modifier=false, summary=true) 2538 @Description(shortDefinition="If search, the total number of matches", formalDefinition="If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle." ) 2539 protected UnsignedIntType total; 2540 2541 /** 2542 * A series of links that provide context to this bundle. 2543 */ 2544 @Child(name = "link", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2545 @Description(shortDefinition="Links related to this Bundle", formalDefinition="A series of links that provide context to this bundle." ) 2546 protected List<BundleLinkComponent> link; 2547 2548 /** 2549 * An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only). 2550 */ 2551 @Child(name = "entry", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2552 @Description(shortDefinition="Entry in the bundle - will have a resource or information", formalDefinition="An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only)." ) 2553 protected List<BundleEntryComponent> entry; 2554 2555 /** 2556 * Digital Signature - base64 encoded. XML-DSig or a JWT. 2557 */ 2558 @Child(name = "signature", type = {Signature.class}, order=6, min=0, max=1, modifier=false, summary=true) 2559 @Description(shortDefinition="Digital Signature", formalDefinition="Digital Signature - base64 encoded. XML-DSig or a JWT." ) 2560 protected Signature signature; 2561 2562 private static final long serialVersionUID = 1740470158L; 2563 2564 /** 2565 * Constructor 2566 */ 2567 public Bundle() { 2568 super(); 2569 } 2570 2571 /** 2572 * Constructor 2573 */ 2574 public Bundle(Enumeration<BundleType> type) { 2575 super(); 2576 this.type = type; 2577 } 2578 2579 /** 2580 * @return {@link #identifier} (A persistent identifier for the bundle that won't change as a bundle is copied from server to server.) 2581 */ 2582 public Identifier getIdentifier() { 2583 if (this.identifier == null) 2584 if (Configuration.errorOnAutoCreate()) 2585 throw new Error("Attempt to auto-create Bundle.identifier"); 2586 else if (Configuration.doAutoCreate()) 2587 this.identifier = new Identifier(); // cc 2588 return this.identifier; 2589 } 2590 2591 public boolean hasIdentifier() { 2592 return this.identifier != null && !this.identifier.isEmpty(); 2593 } 2594 2595 /** 2596 * @param value {@link #identifier} (A persistent identifier for the bundle that won't change as a bundle is copied from server to server.) 2597 */ 2598 public Bundle setIdentifier(Identifier value) { 2599 this.identifier = value; 2600 return this; 2601 } 2602 2603 /** 2604 * @return {@link #type} (Indicates the purpose of this bundle - how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 2605 */ 2606 public Enumeration<BundleType> getTypeElement() { 2607 if (this.type == null) 2608 if (Configuration.errorOnAutoCreate()) 2609 throw new Error("Attempt to auto-create Bundle.type"); 2610 else if (Configuration.doAutoCreate()) 2611 this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); // bb 2612 return this.type; 2613 } 2614 2615 public boolean hasTypeElement() { 2616 return this.type != null && !this.type.isEmpty(); 2617 } 2618 2619 public boolean hasType() { 2620 return this.type != null && !this.type.isEmpty(); 2621 } 2622 2623 /** 2624 * @param value {@link #type} (Indicates the purpose of this bundle - how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 2625 */ 2626 public Bundle setTypeElement(Enumeration<BundleType> value) { 2627 this.type = value; 2628 return this; 2629 } 2630 2631 /** 2632 * @return Indicates the purpose of this bundle - how it is intended to be used. 2633 */ 2634 public BundleType getType() { 2635 return this.type == null ? null : this.type.getValue(); 2636 } 2637 2638 /** 2639 * @param value Indicates the purpose of this bundle - how it is intended to be used. 2640 */ 2641 public Bundle setType(BundleType value) { 2642 if (this.type == null) 2643 this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); 2644 this.type.setValue(value); 2645 return this; 2646 } 2647 2648 /** 2649 * @return {@link #timestamp} (The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 2650 */ 2651 public InstantType getTimestampElement() { 2652 if (this.timestamp == null) 2653 if (Configuration.errorOnAutoCreate()) 2654 throw new Error("Attempt to auto-create Bundle.timestamp"); 2655 else if (Configuration.doAutoCreate()) 2656 this.timestamp = new InstantType(); // bb 2657 return this.timestamp; 2658 } 2659 2660 public boolean hasTimestampElement() { 2661 return this.timestamp != null && !this.timestamp.isEmpty(); 2662 } 2663 2664 public boolean hasTimestamp() { 2665 return this.timestamp != null && !this.timestamp.isEmpty(); 2666 } 2667 2668 /** 2669 * @param value {@link #timestamp} (The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value 2670 */ 2671 public Bundle setTimestampElement(InstantType value) { 2672 this.timestamp = value; 2673 return this; 2674 } 2675 2676 /** 2677 * @return The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle. 2678 */ 2679 public Date getTimestamp() { 2680 return this.timestamp == null ? null : this.timestamp.getValue(); 2681 } 2682 2683 /** 2684 * @param value The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle. 2685 */ 2686 public Bundle setTimestamp(Date value) { 2687 if (value == null) 2688 this.timestamp = null; 2689 else { 2690 if (this.timestamp == null) 2691 this.timestamp = new InstantType(); 2692 this.timestamp.setValue(value); 2693 } 2694 return this; 2695 } 2696 2697 /** 2698 * @return {@link #total} (If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value 2699 */ 2700 public UnsignedIntType getTotalElement() { 2701 if (this.total == null) 2702 if (Configuration.errorOnAutoCreate()) 2703 throw new Error("Attempt to auto-create Bundle.total"); 2704 else if (Configuration.doAutoCreate()) 2705 this.total = new UnsignedIntType(); // bb 2706 return this.total; 2707 } 2708 2709 public boolean hasTotalElement() { 2710 return this.total != null && !this.total.isEmpty(); 2711 } 2712 2713 public boolean hasTotal() { 2714 return this.total != null && !this.total.isEmpty(); 2715 } 2716 2717 /** 2718 * @param value {@link #total} (If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value 2719 */ 2720 public Bundle setTotalElement(UnsignedIntType value) { 2721 this.total = value; 2722 return this; 2723 } 2724 2725 /** 2726 * @return If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle. 2727 */ 2728 public int getTotal() { 2729 return this.total == null || this.total.isEmpty() ? 0 : this.total.getValue(); 2730 } 2731 2732 /** 2733 * @param value If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle. 2734 */ 2735 public Bundle setTotal(int value) { 2736 if (this.total == null) 2737 this.total = new UnsignedIntType(); 2738 this.total.setValue(value); 2739 return this; 2740 } 2741 2742 /** 2743 * @return {@link #link} (A series of links that provide context to this bundle.) 2744 */ 2745 public List<BundleLinkComponent> getLink() { 2746 if (this.link == null) 2747 this.link = new ArrayList<BundleLinkComponent>(); 2748 return this.link; 2749 } 2750 2751 /** 2752 * @return Returns a reference to <code>this</code> for easy method chaining 2753 */ 2754 public Bundle setLink(List<BundleLinkComponent> theLink) { 2755 this.link = theLink; 2756 return this; 2757 } 2758 2759 public boolean hasLink() { 2760 if (this.link == null) 2761 return false; 2762 for (BundleLinkComponent item : this.link) 2763 if (!item.isEmpty()) 2764 return true; 2765 return false; 2766 } 2767 2768 public BundleLinkComponent addLink() { //3 2769 BundleLinkComponent t = new BundleLinkComponent(); 2770 if (this.link == null) 2771 this.link = new ArrayList<BundleLinkComponent>(); 2772 this.link.add(t); 2773 return t; 2774 } 2775 2776 public Bundle addLink(BundleLinkComponent t) { //3 2777 if (t == null) 2778 return this; 2779 if (this.link == null) 2780 this.link = new ArrayList<BundleLinkComponent>(); 2781 this.link.add(t); 2782 return this; 2783 } 2784 2785 /** 2786 * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist 2787 */ 2788 public BundleLinkComponent getLinkFirstRep() { 2789 if (getLink().isEmpty()) { 2790 addLink(); 2791 } 2792 return getLink().get(0); 2793 } 2794 2795 /** 2796 * @return {@link #entry} (An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).) 2797 */ 2798 public List<BundleEntryComponent> getEntry() { 2799 if (this.entry == null) 2800 this.entry = new ArrayList<BundleEntryComponent>(); 2801 return this.entry; 2802 } 2803 2804 /** 2805 * @return Returns a reference to <code>this</code> for easy method chaining 2806 */ 2807 public Bundle setEntry(List<BundleEntryComponent> theEntry) { 2808 this.entry = theEntry; 2809 return this; 2810 } 2811 2812 public boolean hasEntry() { 2813 if (this.entry == null) 2814 return false; 2815 for (BundleEntryComponent item : this.entry) 2816 if (!item.isEmpty()) 2817 return true; 2818 return false; 2819 } 2820 2821 public BundleEntryComponent addEntry() { //3 2822 BundleEntryComponent t = new BundleEntryComponent(); 2823 if (this.entry == null) 2824 this.entry = new ArrayList<BundleEntryComponent>(); 2825 this.entry.add(t); 2826 return t; 2827 } 2828 2829 public Bundle addEntry(BundleEntryComponent t) { //3 2830 if (t == null) 2831 return this; 2832 if (this.entry == null) 2833 this.entry = new ArrayList<BundleEntryComponent>(); 2834 this.entry.add(t); 2835 return this; 2836 } 2837 2838 /** 2839 * @return The first repetition of repeating field {@link #entry}, creating it if it does not already exist 2840 */ 2841 public BundleEntryComponent getEntryFirstRep() { 2842 if (getEntry().isEmpty()) { 2843 addEntry(); 2844 } 2845 return getEntry().get(0); 2846 } 2847 2848 /** 2849 * @return {@link #signature} (Digital Signature - base64 encoded. XML-DSig or a JWT.) 2850 */ 2851 public Signature getSignature() { 2852 if (this.signature == null) 2853 if (Configuration.errorOnAutoCreate()) 2854 throw new Error("Attempt to auto-create Bundle.signature"); 2855 else if (Configuration.doAutoCreate()) 2856 this.signature = new Signature(); // cc 2857 return this.signature; 2858 } 2859 2860 public boolean hasSignature() { 2861 return this.signature != null && !this.signature.isEmpty(); 2862 } 2863 2864 /** 2865 * @param value {@link #signature} (Digital Signature - base64 encoded. XML-DSig or a JWT.) 2866 */ 2867 public Bundle setSignature(Signature value) { 2868 this.signature = value; 2869 return this; 2870 } 2871 2872 /** 2873 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 2874 * If no link is found which matches the given relation, returns <code>null</code>. If more than one 2875 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 2876 * 2877 * @param theRelation 2878 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 2879 * @return Returns a matching BundleLinkComponent, or <code>null</code> 2880 * @see IBaseBundle#LINK_NEXT 2881 * @see IBaseBundle#LINK_PREV 2882 * @see IBaseBundle#LINK_SELF 2883 */ 2884 public BundleLinkComponent getLink(String theRelation) { 2885 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 2886 for (BundleLinkComponent next : getLink()) { 2887 if (theRelation.equals(next.getRelation())) { 2888 return next; 2889 } 2890 } 2891 return null; 2892 } 2893 2894 /** 2895 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 2896 * If no link is found which matches the given relation, creates a new BundleLinkComponent with the 2897 * given relation and adds it to this Bundle. If more than one 2898 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 2899 * 2900 * @param theRelation 2901 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 2902 * @return Returns a matching BundleLinkComponent, or <code>null</code> 2903 * @see IBaseBundle#LINK_NEXT 2904 * @see IBaseBundle#LINK_PREV 2905 * @see IBaseBundle#LINK_SELF 2906 */ 2907 public BundleLinkComponent getLinkOrCreate(String theRelation) { 2908 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 2909 for (BundleLinkComponent next : getLink()) { 2910 if (theRelation.equals(next.getRelation())) { 2911 return next; 2912 } 2913 } 2914 BundleLinkComponent retVal = new BundleLinkComponent(); 2915 retVal.setRelation(theRelation); 2916 getLink().add(retVal); 2917 return retVal; 2918 } 2919 protected void listChildren(List<Property> children) { 2920 super.listChildren(children); 2921 children.add(new Property("identifier", "Identifier", "A persistent identifier for the bundle that won't change as a bundle is copied from server to server.", 0, 1, identifier)); 2922 children.add(new Property("type", "code", "Indicates the purpose of this bundle - how it is intended to be used.", 0, 1, type)); 2923 children.add(new Property("timestamp", "instant", "The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.", 0, 1, timestamp)); 2924 children.add(new Property("total", "unsignedInt", "If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.", 0, 1, total)); 2925 children.add(new Property("link", "", "A series of links that provide context to this bundle.", 0, java.lang.Integer.MAX_VALUE, link)); 2926 children.add(new Property("entry", "", "An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).", 0, java.lang.Integer.MAX_VALUE, entry)); 2927 children.add(new Property("signature", "Signature", "Digital Signature - base64 encoded. XML-DSig or a JWT.", 0, 1, signature)); 2928 } 2929 2930 @Override 2931 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2932 switch (_hash) { 2933 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "A persistent identifier for the bundle that won't change as a bundle is copied from server to server.", 0, 1, identifier); 2934 case 3575610: /*type*/ return new Property("type", "code", "Indicates the purpose of this bundle - how it is intended to be used.", 0, 1, type); 2935 case 55126294: /*timestamp*/ return new Property("timestamp", "instant", "The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle.", 0, 1, timestamp); 2936 case 110549828: /*total*/ return new Property("total", "unsignedInt", "If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle.", 0, 1, total); 2937 case 3321850: /*link*/ return new Property("link", "", "A series of links that provide context to this bundle.", 0, java.lang.Integer.MAX_VALUE, link); 2938 case 96667762: /*entry*/ return new Property("entry", "", "An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only).", 0, java.lang.Integer.MAX_VALUE, entry); 2939 case 1073584312: /*signature*/ return new Property("signature", "Signature", "Digital Signature - base64 encoded. XML-DSig or a JWT.", 0, 1, signature); 2940 default: return super.getNamedProperty(_hash, _name, _checkValid); 2941 } 2942 2943 } 2944 2945 @Override 2946 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2947 switch (hash) { 2948 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 2949 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<BundleType> 2950 case 55126294: /*timestamp*/ return this.timestamp == null ? new Base[0] : new Base[] {this.timestamp}; // InstantType 2951 case 110549828: /*total*/ return this.total == null ? new Base[0] : new Base[] {this.total}; // UnsignedIntType 2952 case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // BundleLinkComponent 2953 case 96667762: /*entry*/ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // BundleEntryComponent 2954 case 1073584312: /*signature*/ return this.signature == null ? new Base[0] : new Base[] {this.signature}; // Signature 2955 default: return super.getProperty(hash, name, checkValid); 2956 } 2957 2958 } 2959 2960 @Override 2961 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2962 switch (hash) { 2963 case -1618432855: // identifier 2964 this.identifier = castToIdentifier(value); // Identifier 2965 return value; 2966 case 3575610: // type 2967 value = new BundleTypeEnumFactory().fromType(castToCode(value)); 2968 this.type = (Enumeration) value; // Enumeration<BundleType> 2969 return value; 2970 case 55126294: // timestamp 2971 this.timestamp = castToInstant(value); // InstantType 2972 return value; 2973 case 110549828: // total 2974 this.total = castToUnsignedInt(value); // UnsignedIntType 2975 return value; 2976 case 3321850: // link 2977 this.getLink().add((BundleLinkComponent) value); // BundleLinkComponent 2978 return value; 2979 case 96667762: // entry 2980 this.getEntry().add((BundleEntryComponent) value); // BundleEntryComponent 2981 return value; 2982 case 1073584312: // signature 2983 this.signature = castToSignature(value); // Signature 2984 return value; 2985 default: return super.setProperty(hash, name, value); 2986 } 2987 2988 } 2989 2990 @Override 2991 public Base setProperty(String name, Base value) throws FHIRException { 2992 if (name.equals("identifier")) { 2993 this.identifier = castToIdentifier(value); // Identifier 2994 } else if (name.equals("type")) { 2995 value = new BundleTypeEnumFactory().fromType(castToCode(value)); 2996 this.type = (Enumeration) value; // Enumeration<BundleType> 2997 } else if (name.equals("timestamp")) { 2998 this.timestamp = castToInstant(value); // InstantType 2999 } else if (name.equals("total")) { 3000 this.total = castToUnsignedInt(value); // UnsignedIntType 3001 } else if (name.equals("link")) { 3002 this.getLink().add((BundleLinkComponent) value); 3003 } else if (name.equals("entry")) { 3004 this.getEntry().add((BundleEntryComponent) value); 3005 } else if (name.equals("signature")) { 3006 this.signature = castToSignature(value); // Signature 3007 } else 3008 return super.setProperty(name, value); 3009 return value; 3010 } 3011 3012 @Override 3013 public Base makeProperty(int hash, String name) throws FHIRException { 3014 switch (hash) { 3015 case -1618432855: return getIdentifier(); 3016 case 3575610: return getTypeElement(); 3017 case 55126294: return getTimestampElement(); 3018 case 110549828: return getTotalElement(); 3019 case 3321850: return addLink(); 3020 case 96667762: return addEntry(); 3021 case 1073584312: return getSignature(); 3022 default: return super.makeProperty(hash, name); 3023 } 3024 3025 } 3026 3027 @Override 3028 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 3029 switch (hash) { 3030 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 3031 case 3575610: /*type*/ return new String[] {"code"}; 3032 case 55126294: /*timestamp*/ return new String[] {"instant"}; 3033 case 110549828: /*total*/ return new String[] {"unsignedInt"}; 3034 case 3321850: /*link*/ return new String[] {}; 3035 case 96667762: /*entry*/ return new String[] {}; 3036 case 1073584312: /*signature*/ return new String[] {"Signature"}; 3037 default: return super.getTypesForProperty(hash, name); 3038 } 3039 3040 } 3041 3042 @Override 3043 public Base addChild(String name) throws FHIRException { 3044 if (name.equals("identifier")) { 3045 this.identifier = new Identifier(); 3046 return this.identifier; 3047 } 3048 else if (name.equals("type")) { 3049 throw new FHIRException("Cannot call addChild on a primitive type Bundle.type"); 3050 } 3051 else if (name.equals("timestamp")) { 3052 throw new FHIRException("Cannot call addChild on a primitive type Bundle.timestamp"); 3053 } 3054 else if (name.equals("total")) { 3055 throw new FHIRException("Cannot call addChild on a primitive type Bundle.total"); 3056 } 3057 else if (name.equals("link")) { 3058 return addLink(); 3059 } 3060 else if (name.equals("entry")) { 3061 return addEntry(); 3062 } 3063 else if (name.equals("signature")) { 3064 this.signature = new Signature(); 3065 return this.signature; 3066 } 3067 else 3068 return super.addChild(name); 3069 } 3070 3071 public String fhirType() { 3072 return "Bundle"; 3073 3074 } 3075 3076 public Bundle copy() { 3077 Bundle dst = new Bundle(); 3078 copyValues(dst); 3079 return dst; 3080 } 3081 3082 public void copyValues(Bundle dst) { 3083 super.copyValues(dst); 3084 dst.identifier = identifier == null ? null : identifier.copy(); 3085 dst.type = type == null ? null : type.copy(); 3086 dst.timestamp = timestamp == null ? null : timestamp.copy(); 3087 dst.total = total == null ? null : total.copy(); 3088 if (link != null) { 3089 dst.link = new ArrayList<BundleLinkComponent>(); 3090 for (BundleLinkComponent i : link) 3091 dst.link.add(i.copy()); 3092 }; 3093 if (entry != null) { 3094 dst.entry = new ArrayList<BundleEntryComponent>(); 3095 for (BundleEntryComponent i : entry) 3096 dst.entry.add(i.copy()); 3097 }; 3098 dst.signature = signature == null ? null : signature.copy(); 3099 } 3100 3101 protected Bundle typedCopy() { 3102 return copy(); 3103 } 3104 3105 @Override 3106 public boolean equalsDeep(Base other_) { 3107 if (!super.equalsDeep(other_)) 3108 return false; 3109 if (!(other_ instanceof Bundle)) 3110 return false; 3111 Bundle o = (Bundle) other_; 3112 return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(timestamp, o.timestamp, true) 3113 && compareDeep(total, o.total, true) && compareDeep(link, o.link, true) && compareDeep(entry, o.entry, true) 3114 && compareDeep(signature, o.signature, true); 3115 } 3116 3117 @Override 3118 public boolean equalsShallow(Base other_) { 3119 if (!super.equalsShallow(other_)) 3120 return false; 3121 if (!(other_ instanceof Bundle)) 3122 return false; 3123 Bundle o = (Bundle) other_; 3124 return compareValues(type, o.type, true) && compareValues(timestamp, o.timestamp, true) && compareValues(total, o.total, true) 3125 ; 3126 } 3127 3128 public boolean isEmpty() { 3129 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, timestamp 3130 , total, link, entry, signature); 3131 } 3132 3133 @Override 3134 public ResourceType getResourceType() { 3135 return ResourceType.Bundle; 3136 } 3137 3138 /** 3139 * Search parameter: <b>identifier</b> 3140 * <p> 3141 * Description: <b>Persistent identifier for the bundle</b><br> 3142 * Type: <b>token</b><br> 3143 * Path: <b>Bundle.identifier</b><br> 3144 * </p> 3145 */ 3146 @SearchParamDefinition(name="identifier", path="Bundle.identifier", description="Persistent identifier for the bundle", type="token" ) 3147 public static final String SP_IDENTIFIER = "identifier"; 3148 /** 3149 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 3150 * <p> 3151 * Description: <b>Persistent identifier for the bundle</b><br> 3152 * Type: <b>token</b><br> 3153 * Path: <b>Bundle.identifier</b><br> 3154 * </p> 3155 */ 3156 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 3157 3158 /** 3159 * Search parameter: <b>composition</b> 3160 * <p> 3161 * Description: <b>The first resource in the bundle, if the bundle type is "document" - this is a composition, and this parameter provides access to search its contents</b><br> 3162 * Type: <b>reference</b><br> 3163 * Path: <b>Bundle.entry(0).resource</b><br> 3164 * </p> 3165 */ 3166 @SearchParamDefinition(name="composition", path="Bundle.entry[0].resource", description="The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to search its contents", type="reference", target={Composition.class } ) 3167 public static final String SP_COMPOSITION = "composition"; 3168 /** 3169 * <b>Fluent Client</b> search parameter constant for <b>composition</b> 3170 * <p> 3171 * Description: <b>The first resource in the bundle, if the bundle type is "document" - this is a composition, and this parameter provides access to search its contents</b><br> 3172 * Type: <b>reference</b><br> 3173 * Path: <b>Bundle.entry(0).resource</b><br> 3174 * </p> 3175 */ 3176 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam COMPOSITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_COMPOSITION); 3177 3178/** 3179 * Constant for fluent queries to be used to add include statements. Specifies 3180 * the path value of "<b>Bundle:composition</b>". 3181 */ 3182 public static final ca.uhn.fhir.model.api.Include INCLUDE_COMPOSITION = new ca.uhn.fhir.model.api.Include("Bundle:composition").toLocked(); 3183 3184 /** 3185 * Search parameter: <b>type</b> 3186 * <p> 3187 * Description: <b>document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection</b><br> 3188 * Type: <b>token</b><br> 3189 * Path: <b>Bundle.type</b><br> 3190 * </p> 3191 */ 3192 @SearchParamDefinition(name="type", path="Bundle.type", description="document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", type="token" ) 3193 public static final String SP_TYPE = "type"; 3194 /** 3195 * <b>Fluent Client</b> search parameter constant for <b>type</b> 3196 * <p> 3197 * Description: <b>document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection</b><br> 3198 * Type: <b>token</b><br> 3199 * Path: <b>Bundle.type</b><br> 3200 * </p> 3201 */ 3202 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 3203 3204 /** 3205 * Search parameter: <b>message</b> 3206 * <p> 3207 * Description: <b>The first resource in the bundle, if the bundle type is "message" - this is a message header, and this parameter provides access to search its contents</b><br> 3208 * Type: <b>reference</b><br> 3209 * Path: <b>Bundle.entry(0).resource</b><br> 3210 * </p> 3211 */ 3212 @SearchParamDefinition(name="message", path="Bundle.entry[0].resource", description="The first resource in the bundle, if the bundle type is \"message\" - this is a message header, and this parameter provides access to search its contents", type="reference", target={MessageHeader.class } ) 3213 public static final String SP_MESSAGE = "message"; 3214 /** 3215 * <b>Fluent Client</b> search parameter constant for <b>message</b> 3216 * <p> 3217 * Description: <b>The first resource in the bundle, if the bundle type is "message" - this is a message header, and this parameter provides access to search its contents</b><br> 3218 * Type: <b>reference</b><br> 3219 * Path: <b>Bundle.entry(0).resource</b><br> 3220 * </p> 3221 */ 3222 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MESSAGE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MESSAGE); 3223 3224/** 3225 * Constant for fluent queries to be used to add include statements. Specifies 3226 * the path value of "<b>Bundle:message</b>". 3227 */ 3228 public static final ca.uhn.fhir.model.api.Include INCLUDE_MESSAGE = new ca.uhn.fhir.model.api.Include("Bundle:message").toLocked(); 3229 3230 /** 3231 * Search parameter: <b>timestamp</b> 3232 * <p> 3233 * Description: <b>When the bundle was assembled</b><br> 3234 * Type: <b>date</b><br> 3235 * Path: <b>Bundle.timestamp</b><br> 3236 * </p> 3237 */ 3238 @SearchParamDefinition(name="timestamp", path="Bundle.timestamp", description="When the bundle was assembled", type="date" ) 3239 public static final String SP_TIMESTAMP = "timestamp"; 3240 /** 3241 * <b>Fluent Client</b> search parameter constant for <b>timestamp</b> 3242 * <p> 3243 * Description: <b>When the bundle was assembled</b><br> 3244 * Type: <b>date</b><br> 3245 * Path: <b>Bundle.timestamp</b><br> 3246 * </p> 3247 */ 3248 public static final ca.uhn.fhir.rest.gclient.DateClientParam TIMESTAMP = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_TIMESTAMP); 3249 3250 3251}