001package org.hl7.fhir.instance.model; 002 003import java.math.BigDecimal; 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// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 035import java.util.*; 036 037import org.hl7.fhir.exceptions.FHIRException; 038import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 039import org.hl7.fhir.instance.model.api.IBaseBundle; 040import org.hl7.fhir.utilities.Utilities; 041 042import ca.uhn.fhir.model.api.annotation.*; 043/** 044 * A container for a collection of resources. 045 */ 046@ResourceDef(name="Bundle", profile="http://hl7.org/fhir/Profile/Bundle") 047public class Bundle extends Resource implements IBaseBundle { 048 049 public enum BundleType { 050 /** 051 * The bundle is a document. The first resource is a Composition. 052 */ 053 DOCUMENT, 054 /** 055 * The bundle is a message. The first resource is a MessageHeader. 056 */ 057 MESSAGE, 058 /** 059 * The bundle is a transaction - intended to be processed by a server as an atomic commit. 060 */ 061 TRANSACTION, 062 /** 063 * The bundle is a transaction response. Because the response is a transaction response, the transactionhas succeeded, and all responses are error free. 064 */ 065 TRANSACTIONRESPONSE, 066 /** 067 * The bundle is a transaction - intended to be processed by a server as a group of actions. 068 */ 069 BATCH, 070 /** 071 * The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success. 072 */ 073 BATCHRESPONSE, 074 /** 075 * The bundle is a list of resources from a history interaction on a server. 076 */ 077 HISTORY, 078 /** 079 * The bundle is a list of resources returned as a result of a search/query interaction, operation, or message. 080 */ 081 SEARCHSET, 082 /** 083 * The bundle is a set of resources collected into a single document for ease of distribution. 084 */ 085 COLLECTION, 086 /** 087 * added to help the parsers 088 */ 089 NULL; 090 public static BundleType fromCode(String codeString) throws FHIRException { 091 if (codeString == null || "".equals(codeString)) 092 return null; 093 if ("document".equals(codeString)) 094 return DOCUMENT; 095 if ("message".equals(codeString)) 096 return MESSAGE; 097 if ("transaction".equals(codeString)) 098 return TRANSACTION; 099 if ("transaction-response".equals(codeString)) 100 return TRANSACTIONRESPONSE; 101 if ("batch".equals(codeString)) 102 return BATCH; 103 if ("batch-response".equals(codeString)) 104 return BATCHRESPONSE; 105 if ("history".equals(codeString)) 106 return HISTORY; 107 if ("searchset".equals(codeString)) 108 return SEARCHSET; 109 if ("collection".equals(codeString)) 110 return COLLECTION; 111 throw new FHIRException("Unknown BundleType code '"+codeString+"'"); 112 } 113 public String toCode() { 114 switch (this) { 115 case DOCUMENT: return "document"; 116 case MESSAGE: return "message"; 117 case TRANSACTION: return "transaction"; 118 case TRANSACTIONRESPONSE: return "transaction-response"; 119 case BATCH: return "batch"; 120 case BATCHRESPONSE: return "batch-response"; 121 case HISTORY: return "history"; 122 case SEARCHSET: return "searchset"; 123 case COLLECTION: return "collection"; 124 default: return "?"; 125 } 126 } 127 public String getSystem() { 128 switch (this) { 129 case DOCUMENT: return "http://hl7.org/fhir/bundle-type"; 130 case MESSAGE: return "http://hl7.org/fhir/bundle-type"; 131 case TRANSACTION: return "http://hl7.org/fhir/bundle-type"; 132 case TRANSACTIONRESPONSE: return "http://hl7.org/fhir/bundle-type"; 133 case BATCH: return "http://hl7.org/fhir/bundle-type"; 134 case BATCHRESPONSE: return "http://hl7.org/fhir/bundle-type"; 135 case HISTORY: return "http://hl7.org/fhir/bundle-type"; 136 case SEARCHSET: return "http://hl7.org/fhir/bundle-type"; 137 case COLLECTION: return "http://hl7.org/fhir/bundle-type"; 138 default: return "?"; 139 } 140 } 141 public String getDefinition() { 142 switch (this) { 143 case DOCUMENT: return "The bundle is a document. The first resource is a Composition."; 144 case MESSAGE: return "The bundle is a message. The first resource is a MessageHeader."; 145 case TRANSACTION: return "The bundle is a transaction - intended to be processed by a server as an atomic commit."; 146 case TRANSACTIONRESPONSE: return "The bundle is a transaction response. Because the response is a transaction response, the transactionhas succeeded, and all responses are error free."; 147 case BATCH: return "The bundle is a transaction - intended to be processed by a server as a group of actions."; 148 case BATCHRESPONSE: return "The bundle is a batch response. Note that as a batch, some responses may indicate failure and others success."; 149 case HISTORY: return "The bundle is a list of resources from a history interaction on a server."; 150 case SEARCHSET: return "The bundle is a list of resources returned as a result of a search/query interaction, operation, or message."; 151 case COLLECTION: return "The bundle is a set of resources collected into a single document for ease of distribution."; 152 default: return "?"; 153 } 154 } 155 public String getDisplay() { 156 switch (this) { 157 case DOCUMENT: return "Document"; 158 case MESSAGE: return "Message"; 159 case TRANSACTION: return "Transaction"; 160 case TRANSACTIONRESPONSE: return "Transaction Response"; 161 case BATCH: return "Batch"; 162 case BATCHRESPONSE: return "Batch Response"; 163 case HISTORY: return "History List"; 164 case SEARCHSET: return "Search Results"; 165 case COLLECTION: return "Collection"; 166 default: return "?"; 167 } 168 } 169 } 170 171 public static class BundleTypeEnumFactory implements EnumFactory<BundleType> { 172 public BundleType fromCode(String codeString) throws IllegalArgumentException { 173 if (codeString == null || "".equals(codeString)) 174 if (codeString == null || "".equals(codeString)) 175 return null; 176 if ("document".equals(codeString)) 177 return BundleType.DOCUMENT; 178 if ("message".equals(codeString)) 179 return BundleType.MESSAGE; 180 if ("transaction".equals(codeString)) 181 return BundleType.TRANSACTION; 182 if ("transaction-response".equals(codeString)) 183 return BundleType.TRANSACTIONRESPONSE; 184 if ("batch".equals(codeString)) 185 return BundleType.BATCH; 186 if ("batch-response".equals(codeString)) 187 return BundleType.BATCHRESPONSE; 188 if ("history".equals(codeString)) 189 return BundleType.HISTORY; 190 if ("searchset".equals(codeString)) 191 return BundleType.SEARCHSET; 192 if ("collection".equals(codeString)) 193 return BundleType.COLLECTION; 194 throw new IllegalArgumentException("Unknown BundleType code '"+codeString+"'"); 195 } 196 public Enumeration<BundleType> fromType(Base code) throws FHIRException { 197 if (code == null || code.isEmpty()) 198 return null; 199 String codeString = ((PrimitiveType) code).asStringValue(); 200 if (codeString == null || "".equals(codeString)) 201 return null; 202 if ("document".equals(codeString)) 203 return new Enumeration<BundleType>(this, BundleType.DOCUMENT); 204 if ("message".equals(codeString)) 205 return new Enumeration<BundleType>(this, BundleType.MESSAGE); 206 if ("transaction".equals(codeString)) 207 return new Enumeration<BundleType>(this, BundleType.TRANSACTION); 208 if ("transaction-response".equals(codeString)) 209 return new Enumeration<BundleType>(this, BundleType.TRANSACTIONRESPONSE); 210 if ("batch".equals(codeString)) 211 return new Enumeration<BundleType>(this, BundleType.BATCH); 212 if ("batch-response".equals(codeString)) 213 return new Enumeration<BundleType>(this, BundleType.BATCHRESPONSE); 214 if ("history".equals(codeString)) 215 return new Enumeration<BundleType>(this, BundleType.HISTORY); 216 if ("searchset".equals(codeString)) 217 return new Enumeration<BundleType>(this, BundleType.SEARCHSET); 218 if ("collection".equals(codeString)) 219 return new Enumeration<BundleType>(this, BundleType.COLLECTION); 220 throw new FHIRException("Unknown BundleType code '"+codeString+"'"); 221 } 222 public String toCode(BundleType code) { 223 if (code == BundleType.DOCUMENT) 224 return "document"; 225 if (code == BundleType.MESSAGE) 226 return "message"; 227 if (code == BundleType.TRANSACTION) 228 return "transaction"; 229 if (code == BundleType.TRANSACTIONRESPONSE) 230 return "transaction-response"; 231 if (code == BundleType.BATCH) 232 return "batch"; 233 if (code == BundleType.BATCHRESPONSE) 234 return "batch-response"; 235 if (code == BundleType.HISTORY) 236 return "history"; 237 if (code == BundleType.SEARCHSET) 238 return "searchset"; 239 if (code == BundleType.COLLECTION) 240 return "collection"; 241 return "?"; 242 } 243 } 244 245 public enum SearchEntryMode { 246 /** 247 * This resource matched the search specification. 248 */ 249 MATCH, 250 /** 251 * This resource is returned because it is referred to from another resource in the search set. 252 */ 253 INCLUDE, 254 /** 255 * An OperationOutcome that provides additional information about the processing of a search. 256 */ 257 OUTCOME, 258 /** 259 * added to help the parsers 260 */ 261 NULL; 262 public static SearchEntryMode fromCode(String codeString) throws FHIRException { 263 if (codeString == null || "".equals(codeString)) 264 return null; 265 if ("match".equals(codeString)) 266 return MATCH; 267 if ("include".equals(codeString)) 268 return INCLUDE; 269 if ("outcome".equals(codeString)) 270 return OUTCOME; 271 throw new FHIRException("Unknown SearchEntryMode code '"+codeString+"'"); 272 } 273 public String toCode() { 274 switch (this) { 275 case MATCH: return "match"; 276 case INCLUDE: return "include"; 277 case OUTCOME: return "outcome"; 278 default: return "?"; 279 } 280 } 281 public String getSystem() { 282 switch (this) { 283 case MATCH: return "http://hl7.org/fhir/search-entry-mode"; 284 case INCLUDE: return "http://hl7.org/fhir/search-entry-mode"; 285 case OUTCOME: return "http://hl7.org/fhir/search-entry-mode"; 286 default: return "?"; 287 } 288 } 289 public String getDefinition() { 290 switch (this) { 291 case MATCH: return "This resource matched the search specification."; 292 case INCLUDE: return "This resource is returned because it is referred to from another resource in the search set."; 293 case OUTCOME: return "An OperationOutcome that provides additional information about the processing of a search."; 294 default: return "?"; 295 } 296 } 297 public String getDisplay() { 298 switch (this) { 299 case MATCH: return "Match"; 300 case INCLUDE: return "Include"; 301 case OUTCOME: return "Outcome"; 302 default: return "?"; 303 } 304 } 305 } 306 307 public static class SearchEntryModeEnumFactory implements EnumFactory<SearchEntryMode> { 308 public SearchEntryMode fromCode(String codeString) throws IllegalArgumentException { 309 if (codeString == null || "".equals(codeString)) 310 if (codeString == null || "".equals(codeString)) 311 return null; 312 if ("match".equals(codeString)) 313 return SearchEntryMode.MATCH; 314 if ("include".equals(codeString)) 315 return SearchEntryMode.INCLUDE; 316 if ("outcome".equals(codeString)) 317 return SearchEntryMode.OUTCOME; 318 throw new IllegalArgumentException("Unknown SearchEntryMode code '"+codeString+"'"); 319 } 320 public Enumeration<SearchEntryMode> fromType(Base code) throws FHIRException { 321 if (code == null || code.isEmpty()) 322 return null; 323 String codeString = ((PrimitiveType) code).asStringValue(); 324 if (codeString == null || "".equals(codeString)) 325 return null; 326 if ("match".equals(codeString)) 327 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.MATCH); 328 if ("include".equals(codeString)) 329 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.INCLUDE); 330 if ("outcome".equals(codeString)) 331 return new Enumeration<SearchEntryMode>(this, SearchEntryMode.OUTCOME); 332 throw new FHIRException("Unknown SearchEntryMode code '"+codeString+"'"); 333 } 334 public String toCode(SearchEntryMode code) { 335 if (code == SearchEntryMode.MATCH) 336 return "match"; 337 if (code == SearchEntryMode.INCLUDE) 338 return "include"; 339 if (code == SearchEntryMode.OUTCOME) 340 return "outcome"; 341 return "?"; 342 } 343 } 344 345 public enum HTTPVerb { 346 /** 347 * HTTP GET 348 */ 349 GET, 350 /** 351 * HTTP POST 352 */ 353 POST, 354 /** 355 * HTTP PUT 356 */ 357 PUT, 358 /** 359 * HTTP DELETE 360 */ 361 DELETE, 362 /** 363 * added to help the parsers 364 */ 365 NULL; 366 public static HTTPVerb fromCode(String codeString) throws FHIRException { 367 if (codeString == null || "".equals(codeString)) 368 return null; 369 if ("GET".equals(codeString)) 370 return GET; 371 if ("POST".equals(codeString)) 372 return POST; 373 if ("PUT".equals(codeString)) 374 return PUT; 375 if ("DELETE".equals(codeString)) 376 return DELETE; 377 throw new FHIRException("Unknown HTTPVerb code '"+codeString+"'"); 378 } 379 public String toCode() { 380 switch (this) { 381 case GET: return "GET"; 382 case POST: return "POST"; 383 case PUT: return "PUT"; 384 case DELETE: return "DELETE"; 385 default: return "?"; 386 } 387 } 388 public String getSystem() { 389 switch (this) { 390 case GET: return "http://hl7.org/fhir/http-verb"; 391 case POST: return "http://hl7.org/fhir/http-verb"; 392 case PUT: return "http://hl7.org/fhir/http-verb"; 393 case DELETE: return "http://hl7.org/fhir/http-verb"; 394 default: return "?"; 395 } 396 } 397 public String getDefinition() { 398 switch (this) { 399 case GET: return "HTTP GET"; 400 case POST: return "HTTP POST"; 401 case PUT: return "HTTP PUT"; 402 case DELETE: return "HTTP DELETE"; 403 default: return "?"; 404 } 405 } 406 public String getDisplay() { 407 switch (this) { 408 case GET: return "GET"; 409 case POST: return "POST"; 410 case PUT: return "PUT"; 411 case DELETE: return "DELETE"; 412 default: return "?"; 413 } 414 } 415 } 416 417 public static class HTTPVerbEnumFactory implements EnumFactory<HTTPVerb> { 418 public HTTPVerb fromCode(String codeString) throws IllegalArgumentException { 419 if (codeString == null || "".equals(codeString)) 420 if (codeString == null || "".equals(codeString)) 421 return null; 422 if ("GET".equals(codeString)) 423 return HTTPVerb.GET; 424 if ("POST".equals(codeString)) 425 return HTTPVerb.POST; 426 if ("PUT".equals(codeString)) 427 return HTTPVerb.PUT; 428 if ("DELETE".equals(codeString)) 429 return HTTPVerb.DELETE; 430 throw new IllegalArgumentException("Unknown HTTPVerb code '"+codeString+"'"); 431 } 432 public Enumeration<HTTPVerb> fromType(Base code) throws FHIRException { 433 if (code == null || code.isEmpty()) 434 return null; 435 String codeString = ((PrimitiveType) code).asStringValue(); 436 if (codeString == null || "".equals(codeString)) 437 return null; 438 if ("GET".equals(codeString)) 439 return new Enumeration<HTTPVerb>(this, HTTPVerb.GET); 440 if ("POST".equals(codeString)) 441 return new Enumeration<HTTPVerb>(this, HTTPVerb.POST); 442 if ("PUT".equals(codeString)) 443 return new Enumeration<HTTPVerb>(this, HTTPVerb.PUT); 444 if ("DELETE".equals(codeString)) 445 return new Enumeration<HTTPVerb>(this, HTTPVerb.DELETE); 446 throw new FHIRException("Unknown HTTPVerb code '"+codeString+"'"); 447 } 448 public String toCode(HTTPVerb code) { 449 if (code == HTTPVerb.GET) 450 return "GET"; 451 if (code == HTTPVerb.POST) 452 return "POST"; 453 if (code == HTTPVerb.PUT) 454 return "PUT"; 455 if (code == HTTPVerb.DELETE) 456 return "DELETE"; 457 return "?"; 458 } 459 } 460 461 @Block() 462 public static class BundleLinkComponent extends BackboneElement implements IBaseBackboneElement { 463 /** 464 * A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]]. 465 */ 466 @Child(name = "relation", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 467 @Description(shortDefinition="http://www.iana.org/assignments/link-relations/link-relations.xhtml", formalDefinition="A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]]." ) 468 protected StringType relation; 469 470 /** 471 * The reference details for the link. 472 */ 473 @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 474 @Description(shortDefinition="Reference details for the link", formalDefinition="The reference details for the link." ) 475 protected UriType url; 476 477 private static final long serialVersionUID = -1010386066L; 478 479 /* 480 * Constructor 481 */ 482 public BundleLinkComponent() { 483 super(); 484 } 485 486 /* 487 * Constructor 488 */ 489 public BundleLinkComponent(StringType relation, UriType url) { 490 super(); 491 this.relation = relation; 492 this.url = url; 493 } 494 495 /** 496 * @return {@link #relation} (A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]].). This is the underlying object with id, value and extensions. The accessor "getRelation" gives direct access to the value 497 */ 498 public StringType getRelationElement() { 499 if (this.relation == null) 500 if (Configuration.errorOnAutoCreate()) 501 throw new Error("Attempt to auto-create BundleLinkComponent.relation"); 502 else if (Configuration.doAutoCreate()) 503 this.relation = new StringType(); // bb 504 return this.relation; 505 } 506 507 public boolean hasRelationElement() { 508 return this.relation != null && !this.relation.isEmpty(); 509 } 510 511 public boolean hasRelation() { 512 return this.relation != null && !this.relation.isEmpty(); 513 } 514 515 /** 516 * @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]].). This is the underlying object with id, value and extensions. The accessor "getRelation" gives direct access to the value 517 */ 518 public BundleLinkComponent setRelationElement(StringType value) { 519 this.relation = value; 520 return this; 521 } 522 523 /** 524 * @return A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]]. 525 */ 526 public String getRelation() { 527 return this.relation == null ? null : this.relation.getValue(); 528 } 529 530 /** 531 * @param value A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]]. 532 */ 533 public BundleLinkComponent setRelation(String value) { 534 if (this.relation == null) 535 this.relation = new StringType(); 536 this.relation.setValue(value); 537 return this; 538 } 539 540 /** 541 * @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 542 */ 543 public UriType getUrlElement() { 544 if (this.url == null) 545 if (Configuration.errorOnAutoCreate()) 546 throw new Error("Attempt to auto-create BundleLinkComponent.url"); 547 else if (Configuration.doAutoCreate()) 548 this.url = new UriType(); // bb 549 return this.url; 550 } 551 552 public boolean hasUrlElement() { 553 return this.url != null && !this.url.isEmpty(); 554 } 555 556 public boolean hasUrl() { 557 return this.url != null && !this.url.isEmpty(); 558 } 559 560 /** 561 * @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 562 */ 563 public BundleLinkComponent setUrlElement(UriType value) { 564 this.url = value; 565 return this; 566 } 567 568 /** 569 * @return The reference details for the link. 570 */ 571 public String getUrl() { 572 return this.url == null ? null : this.url.getValue(); 573 } 574 575 /** 576 * @param value The reference details for the link. 577 */ 578 public BundleLinkComponent setUrl(String value) { 579 if (this.url == null) 580 this.url = new UriType(); 581 this.url.setValue(value); 582 return this; 583 } 584 585 protected void listChildren(List<Property> childrenList) { 586 super.listChildren(childrenList); 587 childrenList.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]].", 0, java.lang.Integer.MAX_VALUE, relation)); 588 childrenList.add(new Property("url", "uri", "The reference details for the link.", 0, java.lang.Integer.MAX_VALUE, url)); 589 } 590 591 @Override 592 public void setProperty(String name, Base value) throws FHIRException { 593 if (name.equals("relation")) 594 this.relation = castToString(value); // StringType 595 else if (name.equals("url")) 596 this.url = castToUri(value); // UriType 597 else 598 super.setProperty(name, value); 599 } 600 601 @Override 602 public Base addChild(String name) throws FHIRException { 603 if (name.equals("relation")) { 604 throw new FHIRException("Cannot call addChild on a primitive type Bundle.relation"); 605 } 606 else if (name.equals("url")) { 607 throw new FHIRException("Cannot call addChild on a primitive type Bundle.url"); 608 } 609 else 610 return super.addChild(name); 611 } 612 613 public BundleLinkComponent copy() { 614 BundleLinkComponent dst = new BundleLinkComponent(); 615 copyValues(dst); 616 dst.relation = relation == null ? null : relation.copy(); 617 dst.url = url == null ? null : url.copy(); 618 return dst; 619 } 620 621 @Override 622 public boolean equalsDeep(Base other) { 623 if (!super.equalsDeep(other)) 624 return false; 625 if (!(other instanceof BundleLinkComponent)) 626 return false; 627 BundleLinkComponent o = (BundleLinkComponent) other; 628 return compareDeep(relation, o.relation, true) && compareDeep(url, o.url, true); 629 } 630 631 @Override 632 public boolean equalsShallow(Base other) { 633 if (!super.equalsShallow(other)) 634 return false; 635 if (!(other instanceof BundleLinkComponent)) 636 return false; 637 BundleLinkComponent o = (BundleLinkComponent) other; 638 return compareValues(relation, o.relation, true) && compareValues(url, o.url, true); 639 } 640 641 public boolean isEmpty() { 642 return super.isEmpty() && (relation == null || relation.isEmpty()) && (url == null || url.isEmpty()) 643 ; 644 } 645 646 public String fhirType() { 647 return "Bundle.link"; 648 649 } 650 651 } 652 653 @Block() 654 public static class BundleEntryComponent extends BackboneElement implements IBaseBackboneElement { 655 /** 656 * A series of links that provide context to this entry. 657 */ 658 @Child(name = "link", type = {BundleLinkComponent.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 659 @Description(shortDefinition="Links related to this entry", formalDefinition="A series of links that provide context to this entry." ) 660 protected List<BundleLinkComponent> link; 661 662 /** 663 * The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. 664 */ 665 @Child(name = "fullUrl", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 666 @Description(shortDefinition="Absolute URL for resource (server address, or UUID/OID)", formalDefinition="The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource." ) 667 protected UriType fullUrl; 668 669 /** 670 * The Resources for the entry. 671 */ 672 @Child(name = "resource", type = {Resource.class}, order=3, min=0, max=1, modifier=false, summary=true) 673 @Description(shortDefinition="A resource in the bundle", formalDefinition="The Resources for the entry." ) 674 protected Resource resource; 675 676 /** 677 * Information about the search process that lead to the creation of this entry. 678 */ 679 @Child(name = "search", type = {}, order=4, min=0, max=1, modifier=false, summary=true) 680 @Description(shortDefinition="Search related information", formalDefinition="Information about the search process that lead to the creation of this entry." ) 681 protected BundleEntrySearchComponent search; 682 683 /** 684 * Additional information about how this entry should be processed as part of a transaction. 685 */ 686 @Child(name = "request", type = {}, order=5, min=0, max=1, modifier=false, summary=true) 687 @Description(shortDefinition="Transaction Related Information", formalDefinition="Additional information about how this entry should be processed as part of a transaction." ) 688 protected BundleEntryRequestComponent request; 689 690 /** 691 * Additional information about how this entry should be processed as part of a transaction. 692 */ 693 @Child(name = "response", type = {}, order=6, min=0, max=1, modifier=false, summary=true) 694 @Description(shortDefinition="Transaction Related Information", formalDefinition="Additional information about how this entry should be processed as part of a transaction." ) 695 protected BundleEntryResponseComponent response; 696 697 private static final long serialVersionUID = 517783054L; 698 699 /* 700 * Constructor 701 */ 702 public BundleEntryComponent() { 703 super(); 704 } 705 706 /** 707 * @return {@link #link} (A series of links that provide context to this entry.) 708 */ 709 public List<BundleLinkComponent> getLink() { 710 if (this.link == null) 711 this.link = new ArrayList<BundleLinkComponent>(); 712 return this.link; 713 } 714 715 public boolean hasLink() { 716 if (this.link == null) 717 return false; 718 for (BundleLinkComponent item : this.link) 719 if (!item.isEmpty()) 720 return true; 721 return false; 722 } 723 724 /** 725 * @return {@link #link} (A series of links that provide context to this entry.) 726 */ 727 // syntactic sugar 728 public BundleLinkComponent addLink() { //3 729 BundleLinkComponent t = new BundleLinkComponent(); 730 if (this.link == null) 731 this.link = new ArrayList<BundleLinkComponent>(); 732 this.link.add(t); 733 return t; 734 } 735 736 // syntactic sugar 737 public BundleEntryComponent addLink(BundleLinkComponent t) { //3 738 if (t == null) 739 return this; 740 if (this.link == null) 741 this.link = new ArrayList<BundleLinkComponent>(); 742 this.link.add(t); 743 return this; 744 } 745 746 /** 747 * @return {@link #fullUrl} (The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource.). This is the underlying object with id, value and extensions. The accessor "getFullUrl" gives direct access to the value 748 */ 749 public UriType getFullUrlElement() { 750 if (this.fullUrl == null) 751 if (Configuration.errorOnAutoCreate()) 752 throw new Error("Attempt to auto-create BundleEntryComponent.fullUrl"); 753 else if (Configuration.doAutoCreate()) 754 this.fullUrl = new UriType(); // bb 755 return this.fullUrl; 756 } 757 758 public boolean hasFullUrlElement() { 759 return this.fullUrl != null && !this.fullUrl.isEmpty(); 760 } 761 762 public boolean hasFullUrl() { 763 return this.fullUrl != null && !this.fullUrl.isEmpty(); 764 } 765 766 /** 767 * @param value {@link #fullUrl} (The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource.). This is the underlying object with id, value and extensions. The accessor "getFullUrl" gives direct access to the value 768 */ 769 public BundleEntryComponent setFullUrlElement(UriType value) { 770 this.fullUrl = value; 771 return this; 772 } 773 774 /** 775 * @return The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. 776 */ 777 public String getFullUrl() { 778 return this.fullUrl == null ? null : this.fullUrl.getValue(); 779 } 780 781 /** 782 * @param value The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. 783 */ 784 public BundleEntryComponent setFullUrl(String value) { 785 if (Utilities.noString(value)) 786 this.fullUrl = null; 787 else { 788 if (this.fullUrl == null) 789 this.fullUrl = new UriType(); 790 this.fullUrl.setValue(value); 791 } 792 return this; 793 } 794 795 /** 796 * @return {@link #resource} (The Resources for the entry.) 797 */ 798 public Resource getResource() { 799 return this.resource; 800 } 801 802 public boolean hasResource() { 803 return this.resource != null && !this.resource.isEmpty(); 804 } 805 806 /** 807 * @param value {@link #resource} (The Resources for the entry.) 808 */ 809 public BundleEntryComponent setResource(Resource value) { 810 this.resource = value; 811 return this; 812 } 813 814 /** 815 * @return {@link #search} (Information about the search process that lead to the creation of this entry.) 816 */ 817 public BundleEntrySearchComponent getSearch() { 818 if (this.search == null) 819 if (Configuration.errorOnAutoCreate()) 820 throw new Error("Attempt to auto-create BundleEntryComponent.search"); 821 else if (Configuration.doAutoCreate()) 822 this.search = new BundleEntrySearchComponent(); // cc 823 return this.search; 824 } 825 826 public boolean hasSearch() { 827 return this.search != null && !this.search.isEmpty(); 828 } 829 830 /** 831 * @param value {@link #search} (Information about the search process that lead to the creation of this entry.) 832 */ 833 public BundleEntryComponent setSearch(BundleEntrySearchComponent value) { 834 this.search = value; 835 return this; 836 } 837 838 /** 839 * @return {@link #request} (Additional information about how this entry should be processed as part of a transaction.) 840 */ 841 public BundleEntryRequestComponent getRequest() { 842 if (this.request == null) 843 if (Configuration.errorOnAutoCreate()) 844 throw new Error("Attempt to auto-create BundleEntryComponent.request"); 845 else if (Configuration.doAutoCreate()) 846 this.request = new BundleEntryRequestComponent(); // cc 847 return this.request; 848 } 849 850 public boolean hasRequest() { 851 return this.request != null && !this.request.isEmpty(); 852 } 853 854 /** 855 * @param value {@link #request} (Additional information about how this entry should be processed as part of a transaction.) 856 */ 857 public BundleEntryComponent setRequest(BundleEntryRequestComponent value) { 858 this.request = value; 859 return this; 860 } 861 862 /** 863 * @return {@link #response} (Additional information about how this entry should be processed as part of a transaction.) 864 */ 865 public BundleEntryResponseComponent getResponse() { 866 if (this.response == null) 867 if (Configuration.errorOnAutoCreate()) 868 throw new Error("Attempt to auto-create BundleEntryComponent.response"); 869 else if (Configuration.doAutoCreate()) 870 this.response = new BundleEntryResponseComponent(); // cc 871 return this.response; 872 } 873 874 public boolean hasResponse() { 875 return this.response != null && !this.response.isEmpty(); 876 } 877 878 /** 879 * @param value {@link #response} (Additional information about how this entry should be processed as part of a transaction.) 880 */ 881 public BundleEntryComponent setResponse(BundleEntryResponseComponent value) { 882 this.response = value; 883 return this; 884 } 885 886 protected void listChildren(List<Property> childrenList) { 887 super.listChildren(childrenList); 888 childrenList.add(new Property("link", "@Bundle.link", "A series of links that provide context to this entry.", 0, java.lang.Integer.MAX_VALUE, link)); 889 childrenList.add(new Property("fullUrl", "uri", "The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource.", 0, java.lang.Integer.MAX_VALUE, fullUrl)); 890 childrenList.add(new Property("resource", "Resource", "The Resources for the entry.", 0, java.lang.Integer.MAX_VALUE, resource)); 891 childrenList.add(new Property("search", "", "Information about the search process that lead to the creation of this entry.", 0, java.lang.Integer.MAX_VALUE, search)); 892 childrenList.add(new Property("request", "", "Additional information about how this entry should be processed as part of a transaction.", 0, java.lang.Integer.MAX_VALUE, request)); 893 childrenList.add(new Property("response", "", "Additional information about how this entry should be processed as part of a transaction.", 0, java.lang.Integer.MAX_VALUE, response)); 894 } 895 896 @Override 897 public void setProperty(String name, Base value) throws FHIRException { 898 if (name.equals("link")) 899 this.getLink().add((BundleLinkComponent) value); 900 else if (name.equals("fullUrl")) 901 this.fullUrl = castToUri(value); // UriType 902 else if (name.equals("resource")) 903 this.resource = castToResource(value); // Resource 904 else if (name.equals("search")) 905 this.search = (BundleEntrySearchComponent) value; // BundleEntrySearchComponent 906 else if (name.equals("request")) 907 this.request = (BundleEntryRequestComponent) value; // BundleEntryRequestComponent 908 else if (name.equals("response")) 909 this.response = (BundleEntryResponseComponent) value; // BundleEntryResponseComponent 910 else 911 super.setProperty(name, value); 912 } 913 914 @Override 915 public Base addChild(String name) throws FHIRException { 916 if (name.equals("link")) { 917 return addLink(); 918 } 919 else if (name.equals("fullUrl")) { 920 throw new FHIRException("Cannot call addChild on a primitive type Bundle.fullUrl"); 921 } 922 else if (name.equals("resource")) { 923 throw new FHIRException("Cannot call addChild on an abstract type Bundle.resource"); 924 } 925 else if (name.equals("search")) { 926 this.search = new BundleEntrySearchComponent(); 927 return this.search; 928 } 929 else if (name.equals("request")) { 930 this.request = new BundleEntryRequestComponent(); 931 return this.request; 932 } 933 else if (name.equals("response")) { 934 this.response = new BundleEntryResponseComponent(); 935 return this.response; 936 } 937 else 938 return super.addChild(name); 939 } 940 941 public BundleEntryComponent copy() { 942 BundleEntryComponent dst = new BundleEntryComponent(); 943 copyValues(dst); 944 if (link != null) { 945 dst.link = new ArrayList<BundleLinkComponent>(); 946 for (BundleLinkComponent i : link) 947 dst.link.add(i.copy()); 948 }; 949 dst.fullUrl = fullUrl == null ? null : fullUrl.copy(); 950 dst.resource = resource == null ? null : resource.copy(); 951 dst.search = search == null ? null : search.copy(); 952 dst.request = request == null ? null : request.copy(); 953 dst.response = response == null ? null : response.copy(); 954 return dst; 955 } 956 957 @Override 958 public boolean equalsDeep(Base other) { 959 if (!super.equalsDeep(other)) 960 return false; 961 if (!(other instanceof BundleEntryComponent)) 962 return false; 963 BundleEntryComponent o = (BundleEntryComponent) other; 964 return compareDeep(link, o.link, true) && compareDeep(fullUrl, o.fullUrl, true) && compareDeep(resource, o.resource, true) 965 && compareDeep(search, o.search, true) && compareDeep(request, o.request, true) && compareDeep(response, o.response, true) 966 ; 967 } 968 969 @Override 970 public boolean equalsShallow(Base other) { 971 if (!super.equalsShallow(other)) 972 return false; 973 if (!(other instanceof BundleEntryComponent)) 974 return false; 975 BundleEntryComponent o = (BundleEntryComponent) other; 976 return compareValues(fullUrl, o.fullUrl, true); 977 } 978 979 public boolean isEmpty() { 980 return super.isEmpty() && (link == null || link.isEmpty()) && (fullUrl == null || fullUrl.isEmpty()) 981 && (resource == null || resource.isEmpty()) && (search == null || search.isEmpty()) && (request == null || request.isEmpty()) 982 && (response == null || response.isEmpty()); 983 } 984 985 public String fhirType() { 986 return "Bundle.entry"; 987 988 } 989 990 } 991 992 @Block() 993 public static class BundleEntrySearchComponent extends BackboneElement implements IBaseBackboneElement { 994 /** 995 * Why this entry is in the result set - whether it's included as a match or because of an _include requirement. 996 */ 997 @Child(name = "mode", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 998 @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." ) 999 protected Enumeration<SearchEntryMode> mode; 1000 1001 /** 1002 * When searching, the server's search ranking score for the entry. 1003 */ 1004 @Child(name = "score", type = {DecimalType.class}, order=2, min=0, max=1, modifier=false, summary=true) 1005 @Description(shortDefinition="Search ranking (between 0 and 1)", formalDefinition="When searching, the server's search ranking score for the entry." ) 1006 protected DecimalType score; 1007 1008 private static final long serialVersionUID = 837739866L; 1009 1010 /* 1011 * Constructor 1012 */ 1013 public BundleEntrySearchComponent() { 1014 super(); 1015 } 1016 1017 /** 1018 * @return {@link #mode} (Why this entry is in the result set - whether it's included as a match or because of an _include requirement.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value 1019 */ 1020 public Enumeration<SearchEntryMode> getModeElement() { 1021 if (this.mode == null) 1022 if (Configuration.errorOnAutoCreate()) 1023 throw new Error("Attempt to auto-create BundleEntrySearchComponent.mode"); 1024 else if (Configuration.doAutoCreate()) 1025 this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); // bb 1026 return this.mode; 1027 } 1028 1029 public boolean hasModeElement() { 1030 return this.mode != null && !this.mode.isEmpty(); 1031 } 1032 1033 public boolean hasMode() { 1034 return this.mode != null && !this.mode.isEmpty(); 1035 } 1036 1037 /** 1038 * @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.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value 1039 */ 1040 public BundleEntrySearchComponent setModeElement(Enumeration<SearchEntryMode> value) { 1041 this.mode = value; 1042 return this; 1043 } 1044 1045 /** 1046 * @return Why this entry is in the result set - whether it's included as a match or because of an _include requirement. 1047 */ 1048 public SearchEntryMode getMode() { 1049 return this.mode == null ? null : this.mode.getValue(); 1050 } 1051 1052 /** 1053 * @param value Why this entry is in the result set - whether it's included as a match or because of an _include requirement. 1054 */ 1055 public BundleEntrySearchComponent setMode(SearchEntryMode value) { 1056 if (value == null) 1057 this.mode = null; 1058 else { 1059 if (this.mode == null) 1060 this.mode = new Enumeration<SearchEntryMode>(new SearchEntryModeEnumFactory()); 1061 this.mode.setValue(value); 1062 } 1063 return this; 1064 } 1065 1066 /** 1067 * @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 1068 */ 1069 public DecimalType getScoreElement() { 1070 if (this.score == null) 1071 if (Configuration.errorOnAutoCreate()) 1072 throw new Error("Attempt to auto-create BundleEntrySearchComponent.score"); 1073 else if (Configuration.doAutoCreate()) 1074 this.score = new DecimalType(); // bb 1075 return this.score; 1076 } 1077 1078 public boolean hasScoreElement() { 1079 return this.score != null && !this.score.isEmpty(); 1080 } 1081 1082 public boolean hasScore() { 1083 return this.score != null && !this.score.isEmpty(); 1084 } 1085 1086 /** 1087 * @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 1088 */ 1089 public BundleEntrySearchComponent setScoreElement(DecimalType value) { 1090 this.score = value; 1091 return this; 1092 } 1093 1094 /** 1095 * @return When searching, the server's search ranking score for the entry. 1096 */ 1097 public BigDecimal getScore() { 1098 return this.score == null ? null : this.score.getValue(); 1099 } 1100 1101 /** 1102 * @param value When searching, the server's search ranking score for the entry. 1103 */ 1104 public BundleEntrySearchComponent setScore(BigDecimal value) { 1105 if (value == null) 1106 this.score = null; 1107 else { 1108 if (this.score == null) 1109 this.score = new DecimalType(); 1110 this.score.setValue(value); 1111 } 1112 return this; 1113 } 1114 1115 protected void listChildren(List<Property> childrenList) { 1116 super.listChildren(childrenList); 1117 childrenList.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.", 0, java.lang.Integer.MAX_VALUE, mode)); 1118 childrenList.add(new Property("score", "decimal", "When searching, the server's search ranking score for the entry.", 0, java.lang.Integer.MAX_VALUE, score)); 1119 } 1120 1121 @Override 1122 public void setProperty(String name, Base value) throws FHIRException { 1123 if (name.equals("mode")) 1124 this.mode = new SearchEntryModeEnumFactory().fromType(value); // Enumeration<SearchEntryMode> 1125 else if (name.equals("score")) 1126 this.score = castToDecimal(value); // DecimalType 1127 else 1128 super.setProperty(name, value); 1129 } 1130 1131 @Override 1132 public Base addChild(String name) throws FHIRException { 1133 if (name.equals("mode")) { 1134 throw new FHIRException("Cannot call addChild on a primitive type Bundle.mode"); 1135 } 1136 else if (name.equals("score")) { 1137 throw new FHIRException("Cannot call addChild on a primitive type Bundle.score"); 1138 } 1139 else 1140 return super.addChild(name); 1141 } 1142 1143 public BundleEntrySearchComponent copy() { 1144 BundleEntrySearchComponent dst = new BundleEntrySearchComponent(); 1145 copyValues(dst); 1146 dst.mode = mode == null ? null : mode.copy(); 1147 dst.score = score == null ? null : score.copy(); 1148 return dst; 1149 } 1150 1151 @Override 1152 public boolean equalsDeep(Base other) { 1153 if (!super.equalsDeep(other)) 1154 return false; 1155 if (!(other instanceof BundleEntrySearchComponent)) 1156 return false; 1157 BundleEntrySearchComponent o = (BundleEntrySearchComponent) other; 1158 return compareDeep(mode, o.mode, true) && compareDeep(score, o.score, true); 1159 } 1160 1161 @Override 1162 public boolean equalsShallow(Base other) { 1163 if (!super.equalsShallow(other)) 1164 return false; 1165 if (!(other instanceof BundleEntrySearchComponent)) 1166 return false; 1167 BundleEntrySearchComponent o = (BundleEntrySearchComponent) other; 1168 return compareValues(mode, o.mode, true) && compareValues(score, o.score, true); 1169 } 1170 1171 public boolean isEmpty() { 1172 return super.isEmpty() && (mode == null || mode.isEmpty()) && (score == null || score.isEmpty()) 1173 ; 1174 } 1175 1176 public String fhirType() { 1177 return "Bundle.entry.search"; 1178 1179 } 1180 1181 } 1182 1183 @Block() 1184 public static class BundleEntryRequestComponent extends BackboneElement implements IBaseBackboneElement { 1185 /** 1186 * The HTTP verb for this entry in either a update history, or a transaction/ transaction response. 1187 */ 1188 @Child(name = "method", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 1189 @Description(shortDefinition="GET | POST | PUT | DELETE", formalDefinition="The HTTP verb for this entry in either a update history, or a transaction/ transaction response." ) 1190 protected Enumeration<HTTPVerb> method; 1191 1192 /** 1193 * The URL for this entry, relative to the root (the address to which the request is posted). 1194 */ 1195 @Child(name = "url", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 1196 @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)." ) 1197 protected UriType url; 1198 1199 /** 1200 * If the ETag values match, return a 304 Not modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1201 */ 1202 @Child(name = "ifNoneMatch", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 1203 @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)." ) 1204 protected StringType ifNoneMatch; 1205 1206 /** 1207 * Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1208 */ 1209 @Child(name = "ifModifiedSince", type = {InstantType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1210 @Description(shortDefinition="For managing update contention", formalDefinition="Only perform the operation if the last updated date matches. See the API documentation for [\"Conditional Read\"](http.html#cread)." ) 1211 protected InstantType ifModifiedSince; 1212 1213 /** 1214 * Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1215 */ 1216 @Child(name = "ifMatch", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1217 @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)." ) 1218 protected StringType ifMatch; 1219 1220 /** 1221 * 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 "?"). 1222 */ 1223 @Child(name = "ifNoneExist", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true) 1224 @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 \"?\")." ) 1225 protected StringType ifNoneExist; 1226 1227 private static final long serialVersionUID = -1349769744L; 1228 1229 /* 1230 * Constructor 1231 */ 1232 public BundleEntryRequestComponent() { 1233 super(); 1234 } 1235 1236 /* 1237 * Constructor 1238 */ 1239 public BundleEntryRequestComponent(Enumeration<HTTPVerb> method, UriType url) { 1240 super(); 1241 this.method = method; 1242 this.url = url; 1243 } 1244 1245 /** 1246 * @return {@link #method} (The HTTP verb for this entry in either a update history, or a transaction/ transaction response.). This is the underlying object with id, value and extensions. The accessor "getMethod" gives direct access to the value 1247 */ 1248 public Enumeration<HTTPVerb> getMethodElement() { 1249 if (this.method == null) 1250 if (Configuration.errorOnAutoCreate()) 1251 throw new Error("Attempt to auto-create BundleEntryRequestComponent.method"); 1252 else if (Configuration.doAutoCreate()) 1253 this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); // bb 1254 return this.method; 1255 } 1256 1257 public boolean hasMethodElement() { 1258 return this.method != null && !this.method.isEmpty(); 1259 } 1260 1261 public boolean hasMethod() { 1262 return this.method != null && !this.method.isEmpty(); 1263 } 1264 1265 /** 1266 * @param value {@link #method} (The HTTP verb for this entry in either a update history, or a transaction/ transaction response.). This is the underlying object with id, value and extensions. The accessor "getMethod" gives direct access to the value 1267 */ 1268 public BundleEntryRequestComponent setMethodElement(Enumeration<HTTPVerb> value) { 1269 this.method = value; 1270 return this; 1271 } 1272 1273 /** 1274 * @return The HTTP verb for this entry in either a update history, or a transaction/ transaction response. 1275 */ 1276 public HTTPVerb getMethod() { 1277 return this.method == null ? null : this.method.getValue(); 1278 } 1279 1280 /** 1281 * @param value The HTTP verb for this entry in either a update history, or a transaction/ transaction response. 1282 */ 1283 public BundleEntryRequestComponent setMethod(HTTPVerb value) { 1284 if (this.method == null) 1285 this.method = new Enumeration<HTTPVerb>(new HTTPVerbEnumFactory()); 1286 this.method.setValue(value); 1287 return this; 1288 } 1289 1290 /** 1291 * @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 1292 */ 1293 public UriType getUrlElement() { 1294 if (this.url == null) 1295 if (Configuration.errorOnAutoCreate()) 1296 throw new Error("Attempt to auto-create BundleEntryRequestComponent.url"); 1297 else if (Configuration.doAutoCreate()) 1298 this.url = new UriType(); // bb 1299 return this.url; 1300 } 1301 1302 public boolean hasUrlElement() { 1303 return this.url != null && !this.url.isEmpty(); 1304 } 1305 1306 public boolean hasUrl() { 1307 return this.url != null && !this.url.isEmpty(); 1308 } 1309 1310 /** 1311 * @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 1312 */ 1313 public BundleEntryRequestComponent setUrlElement(UriType value) { 1314 this.url = value; 1315 return this; 1316 } 1317 1318 /** 1319 * @return The URL for this entry, relative to the root (the address to which the request is posted). 1320 */ 1321 public String getUrl() { 1322 return this.url == null ? null : this.url.getValue(); 1323 } 1324 1325 /** 1326 * @param value The URL for this entry, relative to the root (the address to which the request is posted). 1327 */ 1328 public BundleEntryRequestComponent setUrl(String value) { 1329 if (this.url == null) 1330 this.url = new UriType(); 1331 this.url.setValue(value); 1332 return this; 1333 } 1334 1335 /** 1336 * @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 1337 */ 1338 public StringType getIfNoneMatchElement() { 1339 if (this.ifNoneMatch == null) 1340 if (Configuration.errorOnAutoCreate()) 1341 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneMatch"); 1342 else if (Configuration.doAutoCreate()) 1343 this.ifNoneMatch = new StringType(); // bb 1344 return this.ifNoneMatch; 1345 } 1346 1347 public boolean hasIfNoneMatchElement() { 1348 return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty(); 1349 } 1350 1351 public boolean hasIfNoneMatch() { 1352 return this.ifNoneMatch != null && !this.ifNoneMatch.isEmpty(); 1353 } 1354 1355 /** 1356 * @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 1357 */ 1358 public BundleEntryRequestComponent setIfNoneMatchElement(StringType value) { 1359 this.ifNoneMatch = value; 1360 return this; 1361 } 1362 1363 /** 1364 * @return If the ETag values match, return a 304 Not modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1365 */ 1366 public String getIfNoneMatch() { 1367 return this.ifNoneMatch == null ? null : this.ifNoneMatch.getValue(); 1368 } 1369 1370 /** 1371 * @param value If the ETag values match, return a 304 Not modified status. See the API documentation for ["Conditional Read"](http.html#cread). 1372 */ 1373 public BundleEntryRequestComponent setIfNoneMatch(String value) { 1374 if (Utilities.noString(value)) 1375 this.ifNoneMatch = null; 1376 else { 1377 if (this.ifNoneMatch == null) 1378 this.ifNoneMatch = new StringType(); 1379 this.ifNoneMatch.setValue(value); 1380 } 1381 return this; 1382 } 1383 1384 /** 1385 * @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 1386 */ 1387 public InstantType getIfModifiedSinceElement() { 1388 if (this.ifModifiedSince == null) 1389 if (Configuration.errorOnAutoCreate()) 1390 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifModifiedSince"); 1391 else if (Configuration.doAutoCreate()) 1392 this.ifModifiedSince = new InstantType(); // bb 1393 return this.ifModifiedSince; 1394 } 1395 1396 public boolean hasIfModifiedSinceElement() { 1397 return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty(); 1398 } 1399 1400 public boolean hasIfModifiedSince() { 1401 return this.ifModifiedSince != null && !this.ifModifiedSince.isEmpty(); 1402 } 1403 1404 /** 1405 * @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 1406 */ 1407 public BundleEntryRequestComponent setIfModifiedSinceElement(InstantType value) { 1408 this.ifModifiedSince = value; 1409 return this; 1410 } 1411 1412 /** 1413 * @return Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1414 */ 1415 public Date getIfModifiedSince() { 1416 return this.ifModifiedSince == null ? null : this.ifModifiedSince.getValue(); 1417 } 1418 1419 /** 1420 * @param value Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread). 1421 */ 1422 public BundleEntryRequestComponent setIfModifiedSince(Date value) { 1423 if (value == null) 1424 this.ifModifiedSince = null; 1425 else { 1426 if (this.ifModifiedSince == null) 1427 this.ifModifiedSince = new InstantType(); 1428 this.ifModifiedSince.setValue(value); 1429 } 1430 return this; 1431 } 1432 1433 /** 1434 * @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 1435 */ 1436 public StringType getIfMatchElement() { 1437 if (this.ifMatch == null) 1438 if (Configuration.errorOnAutoCreate()) 1439 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifMatch"); 1440 else if (Configuration.doAutoCreate()) 1441 this.ifMatch = new StringType(); // bb 1442 return this.ifMatch; 1443 } 1444 1445 public boolean hasIfMatchElement() { 1446 return this.ifMatch != null && !this.ifMatch.isEmpty(); 1447 } 1448 1449 public boolean hasIfMatch() { 1450 return this.ifMatch != null && !this.ifMatch.isEmpty(); 1451 } 1452 1453 /** 1454 * @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 1455 */ 1456 public BundleEntryRequestComponent setIfMatchElement(StringType value) { 1457 this.ifMatch = value; 1458 return this; 1459 } 1460 1461 /** 1462 * @return Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1463 */ 1464 public String getIfMatch() { 1465 return this.ifMatch == null ? null : this.ifMatch.getValue(); 1466 } 1467 1468 /** 1469 * @param value Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency). 1470 */ 1471 public BundleEntryRequestComponent setIfMatch(String value) { 1472 if (Utilities.noString(value)) 1473 this.ifMatch = null; 1474 else { 1475 if (this.ifMatch == null) 1476 this.ifMatch = new StringType(); 1477 this.ifMatch.setValue(value); 1478 } 1479 return this; 1480 } 1481 1482 /** 1483 * @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 1484 */ 1485 public StringType getIfNoneExistElement() { 1486 if (this.ifNoneExist == null) 1487 if (Configuration.errorOnAutoCreate()) 1488 throw new Error("Attempt to auto-create BundleEntryRequestComponent.ifNoneExist"); 1489 else if (Configuration.doAutoCreate()) 1490 this.ifNoneExist = new StringType(); // bb 1491 return this.ifNoneExist; 1492 } 1493 1494 public boolean hasIfNoneExistElement() { 1495 return this.ifNoneExist != null && !this.ifNoneExist.isEmpty(); 1496 } 1497 1498 public boolean hasIfNoneExist() { 1499 return this.ifNoneExist != null && !this.ifNoneExist.isEmpty(); 1500 } 1501 1502 /** 1503 * @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 1504 */ 1505 public BundleEntryRequestComponent setIfNoneExistElement(StringType value) { 1506 this.ifNoneExist = value; 1507 return this; 1508 } 1509 1510 /** 1511 * @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 "?"). 1512 */ 1513 public String getIfNoneExist() { 1514 return this.ifNoneExist == null ? null : this.ifNoneExist.getValue(); 1515 } 1516 1517 /** 1518 * @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 "?"). 1519 */ 1520 public BundleEntryRequestComponent setIfNoneExist(String value) { 1521 if (Utilities.noString(value)) 1522 this.ifNoneExist = null; 1523 else { 1524 if (this.ifNoneExist == null) 1525 this.ifNoneExist = new StringType(); 1526 this.ifNoneExist.setValue(value); 1527 } 1528 return this; 1529 } 1530 1531 protected void listChildren(List<Property> childrenList) { 1532 super.listChildren(childrenList); 1533 childrenList.add(new Property("method", "code", "The HTTP verb for this entry in either a update history, or a transaction/ transaction response.", 0, java.lang.Integer.MAX_VALUE, method)); 1534 childrenList.add(new Property("url", "uri", "The URL for this entry, relative to the root (the address to which the request is posted).", 0, java.lang.Integer.MAX_VALUE, url)); 1535 childrenList.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, java.lang.Integer.MAX_VALUE, ifNoneMatch)); 1536 childrenList.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, java.lang.Integer.MAX_VALUE, ifModifiedSince)); 1537 childrenList.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, java.lang.Integer.MAX_VALUE, ifMatch)); 1538 childrenList.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, java.lang.Integer.MAX_VALUE, ifNoneExist)); 1539 } 1540 1541 @Override 1542 public void setProperty(String name, Base value) throws FHIRException { 1543 if (name.equals("method")) 1544 this.method = new HTTPVerbEnumFactory().fromType(value); // Enumeration<HTTPVerb> 1545 else if (name.equals("url")) 1546 this.url = castToUri(value); // UriType 1547 else if (name.equals("ifNoneMatch")) 1548 this.ifNoneMatch = castToString(value); // StringType 1549 else if (name.equals("ifModifiedSince")) 1550 this.ifModifiedSince = castToInstant(value); // InstantType 1551 else if (name.equals("ifMatch")) 1552 this.ifMatch = castToString(value); // StringType 1553 else if (name.equals("ifNoneExist")) 1554 this.ifNoneExist = castToString(value); // StringType 1555 else 1556 super.setProperty(name, value); 1557 } 1558 1559 @Override 1560 public Base addChild(String name) throws FHIRException { 1561 if (name.equals("method")) { 1562 throw new FHIRException("Cannot call addChild on a primitive type Bundle.method"); 1563 } 1564 else if (name.equals("url")) { 1565 throw new FHIRException("Cannot call addChild on a primitive type Bundle.url"); 1566 } 1567 else if (name.equals("ifNoneMatch")) { 1568 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifNoneMatch"); 1569 } 1570 else if (name.equals("ifModifiedSince")) { 1571 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifModifiedSince"); 1572 } 1573 else if (name.equals("ifMatch")) { 1574 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifMatch"); 1575 } 1576 else if (name.equals("ifNoneExist")) { 1577 throw new FHIRException("Cannot call addChild on a primitive type Bundle.ifNoneExist"); 1578 } 1579 else 1580 return super.addChild(name); 1581 } 1582 1583 public BundleEntryRequestComponent copy() { 1584 BundleEntryRequestComponent dst = new BundleEntryRequestComponent(); 1585 copyValues(dst); 1586 dst.method = method == null ? null : method.copy(); 1587 dst.url = url == null ? null : url.copy(); 1588 dst.ifNoneMatch = ifNoneMatch == null ? null : ifNoneMatch.copy(); 1589 dst.ifModifiedSince = ifModifiedSince == null ? null : ifModifiedSince.copy(); 1590 dst.ifMatch = ifMatch == null ? null : ifMatch.copy(); 1591 dst.ifNoneExist = ifNoneExist == null ? null : ifNoneExist.copy(); 1592 return dst; 1593 } 1594 1595 @Override 1596 public boolean equalsDeep(Base other) { 1597 if (!super.equalsDeep(other)) 1598 return false; 1599 if (!(other instanceof BundleEntryRequestComponent)) 1600 return false; 1601 BundleEntryRequestComponent o = (BundleEntryRequestComponent) other; 1602 return compareDeep(method, o.method, true) && compareDeep(url, o.url, true) && compareDeep(ifNoneMatch, o.ifNoneMatch, true) 1603 && compareDeep(ifModifiedSince, o.ifModifiedSince, true) && compareDeep(ifMatch, o.ifMatch, true) 1604 && compareDeep(ifNoneExist, o.ifNoneExist, true); 1605 } 1606 1607 @Override 1608 public boolean equalsShallow(Base other) { 1609 if (!super.equalsShallow(other)) 1610 return false; 1611 if (!(other instanceof BundleEntryRequestComponent)) 1612 return false; 1613 BundleEntryRequestComponent o = (BundleEntryRequestComponent) other; 1614 return compareValues(method, o.method, true) && compareValues(url, o.url, true) && compareValues(ifNoneMatch, o.ifNoneMatch, true) 1615 && compareValues(ifModifiedSince, o.ifModifiedSince, true) && compareValues(ifMatch, o.ifMatch, true) 1616 && compareValues(ifNoneExist, o.ifNoneExist, true); 1617 } 1618 1619 public boolean isEmpty() { 1620 return super.isEmpty() && (method == null || method.isEmpty()) && (url == null || url.isEmpty()) 1621 && (ifNoneMatch == null || ifNoneMatch.isEmpty()) && (ifModifiedSince == null || ifModifiedSince.isEmpty()) 1622 && (ifMatch == null || ifMatch.isEmpty()) && (ifNoneExist == null || ifNoneExist.isEmpty()) 1623 ; 1624 } 1625 1626 public String fhirType() { 1627 return "Bundle.entry.request"; 1628 1629 } 1630 1631 } 1632 1633 @Block() 1634 public static class BundleEntryResponseComponent extends BackboneElement implements IBaseBackboneElement { 1635 /** 1636 * The status code returned by processing this entry. 1637 */ 1638 @Child(name = "status", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true) 1639 @Description(shortDefinition="Status return code for entry", formalDefinition="The status code returned by processing this entry." ) 1640 protected StringType status; 1641 1642 /** 1643 * The location header created by processing this operation. 1644 */ 1645 @Child(name = "location", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 1646 @Description(shortDefinition="The location, if the operation returns a location", formalDefinition="The location header created by processing this operation." ) 1647 protected UriType location; 1648 1649 /** 1650 * The etag for the resource, it the operation for the entry produced a versioned resource. 1651 */ 1652 @Child(name = "etag", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 1653 @Description(shortDefinition="The etag for the resource (if relevant)", formalDefinition="The etag for the resource, it the operation for the entry produced a versioned resource." ) 1654 protected StringType etag; 1655 1656 /** 1657 * The date/time that the resource was modified on the server. 1658 */ 1659 @Child(name = "lastModified", type = {InstantType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1660 @Description(shortDefinition="Server's date time modified", formalDefinition="The date/time that the resource was modified on the server." ) 1661 protected InstantType lastModified; 1662 1663 private static final long serialVersionUID = -1526413234L; 1664 1665 /* 1666 * Constructor 1667 */ 1668 public BundleEntryResponseComponent() { 1669 super(); 1670 } 1671 1672 /* 1673 * Constructor 1674 */ 1675 public BundleEntryResponseComponent(StringType status) { 1676 super(); 1677 this.status = status; 1678 } 1679 1680 /** 1681 * @return {@link #status} (The status code returned by processing this entry.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1682 */ 1683 public StringType getStatusElement() { 1684 if (this.status == null) 1685 if (Configuration.errorOnAutoCreate()) 1686 throw new Error("Attempt to auto-create BundleEntryResponseComponent.status"); 1687 else if (Configuration.doAutoCreate()) 1688 this.status = new StringType(); // bb 1689 return this.status; 1690 } 1691 1692 public boolean hasStatusElement() { 1693 return this.status != null && !this.status.isEmpty(); 1694 } 1695 1696 public boolean hasStatus() { 1697 return this.status != null && !this.status.isEmpty(); 1698 } 1699 1700 /** 1701 * @param value {@link #status} (The status code returned by processing this entry.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1702 */ 1703 public BundleEntryResponseComponent setStatusElement(StringType value) { 1704 this.status = value; 1705 return this; 1706 } 1707 1708 /** 1709 * @return The status code returned by processing this entry. 1710 */ 1711 public String getStatus() { 1712 return this.status == null ? null : this.status.getValue(); 1713 } 1714 1715 /** 1716 * @param value The status code returned by processing this entry. 1717 */ 1718 public BundleEntryResponseComponent setStatus(String value) { 1719 if (this.status == null) 1720 this.status = new StringType(); 1721 this.status.setValue(value); 1722 return this; 1723 } 1724 1725 /** 1726 * @return {@link #location} (The location header created by processing this operation.). This is the underlying object with id, value and extensions. The accessor "getLocation" gives direct access to the value 1727 */ 1728 public UriType getLocationElement() { 1729 if (this.location == null) 1730 if (Configuration.errorOnAutoCreate()) 1731 throw new Error("Attempt to auto-create BundleEntryResponseComponent.location"); 1732 else if (Configuration.doAutoCreate()) 1733 this.location = new UriType(); // bb 1734 return this.location; 1735 } 1736 1737 public boolean hasLocationElement() { 1738 return this.location != null && !this.location.isEmpty(); 1739 } 1740 1741 public boolean hasLocation() { 1742 return this.location != null && !this.location.isEmpty(); 1743 } 1744 1745 /** 1746 * @param value {@link #location} (The location header created by processing this operation.). This is the underlying object with id, value and extensions. The accessor "getLocation" gives direct access to the value 1747 */ 1748 public BundleEntryResponseComponent setLocationElement(UriType value) { 1749 this.location = value; 1750 return this; 1751 } 1752 1753 /** 1754 * @return The location header created by processing this operation. 1755 */ 1756 public String getLocation() { 1757 return this.location == null ? null : this.location.getValue(); 1758 } 1759 1760 /** 1761 * @param value The location header created by processing this operation. 1762 */ 1763 public BundleEntryResponseComponent setLocation(String value) { 1764 if (Utilities.noString(value)) 1765 this.location = null; 1766 else { 1767 if (this.location == null) 1768 this.location = new UriType(); 1769 this.location.setValue(value); 1770 } 1771 return this; 1772 } 1773 1774 /** 1775 * @return {@link #etag} (The etag for the resource, it the operation for the entry produced a versioned resource.). This is the underlying object with id, value and extensions. The accessor "getEtag" gives direct access to the value 1776 */ 1777 public StringType getEtagElement() { 1778 if (this.etag == null) 1779 if (Configuration.errorOnAutoCreate()) 1780 throw new Error("Attempt to auto-create BundleEntryResponseComponent.etag"); 1781 else if (Configuration.doAutoCreate()) 1782 this.etag = new StringType(); // bb 1783 return this.etag; 1784 } 1785 1786 public boolean hasEtagElement() { 1787 return this.etag != null && !this.etag.isEmpty(); 1788 } 1789 1790 public boolean hasEtag() { 1791 return this.etag != null && !this.etag.isEmpty(); 1792 } 1793 1794 /** 1795 * @param value {@link #etag} (The etag for the resource, it the operation for the entry produced a versioned resource.). This is the underlying object with id, value and extensions. The accessor "getEtag" gives direct access to the value 1796 */ 1797 public BundleEntryResponseComponent setEtagElement(StringType value) { 1798 this.etag = value; 1799 return this; 1800 } 1801 1802 /** 1803 * @return The etag for the resource, it the operation for the entry produced a versioned resource. 1804 */ 1805 public String getEtag() { 1806 return this.etag == null ? null : this.etag.getValue(); 1807 } 1808 1809 /** 1810 * @param value The etag for the resource, it the operation for the entry produced a versioned resource. 1811 */ 1812 public BundleEntryResponseComponent setEtag(String value) { 1813 if (Utilities.noString(value)) 1814 this.etag = null; 1815 else { 1816 if (this.etag == null) 1817 this.etag = new StringType(); 1818 this.etag.setValue(value); 1819 } 1820 return this; 1821 } 1822 1823 /** 1824 * @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 1825 */ 1826 public InstantType getLastModifiedElement() { 1827 if (this.lastModified == null) 1828 if (Configuration.errorOnAutoCreate()) 1829 throw new Error("Attempt to auto-create BundleEntryResponseComponent.lastModified"); 1830 else if (Configuration.doAutoCreate()) 1831 this.lastModified = new InstantType(); // bb 1832 return this.lastModified; 1833 } 1834 1835 public boolean hasLastModifiedElement() { 1836 return this.lastModified != null && !this.lastModified.isEmpty(); 1837 } 1838 1839 public boolean hasLastModified() { 1840 return this.lastModified != null && !this.lastModified.isEmpty(); 1841 } 1842 1843 /** 1844 * @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 1845 */ 1846 public BundleEntryResponseComponent setLastModifiedElement(InstantType value) { 1847 this.lastModified = value; 1848 return this; 1849 } 1850 1851 /** 1852 * @return The date/time that the resource was modified on the server. 1853 */ 1854 public Date getLastModified() { 1855 return this.lastModified == null ? null : this.lastModified.getValue(); 1856 } 1857 1858 /** 1859 * @param value The date/time that the resource was modified on the server. 1860 */ 1861 public BundleEntryResponseComponent setLastModified(Date value) { 1862 if (value == null) 1863 this.lastModified = null; 1864 else { 1865 if (this.lastModified == null) 1866 this.lastModified = new InstantType(); 1867 this.lastModified.setValue(value); 1868 } 1869 return this; 1870 } 1871 1872 protected void listChildren(List<Property> childrenList) { 1873 super.listChildren(childrenList); 1874 childrenList.add(new Property("status", "string", "The status code returned by processing this entry.", 0, java.lang.Integer.MAX_VALUE, status)); 1875 childrenList.add(new Property("location", "uri", "The location header created by processing this operation.", 0, java.lang.Integer.MAX_VALUE, location)); 1876 childrenList.add(new Property("etag", "string", "The etag for the resource, it the operation for the entry produced a versioned resource.", 0, java.lang.Integer.MAX_VALUE, etag)); 1877 childrenList.add(new Property("lastModified", "instant", "The date/time that the resource was modified on the server.", 0, java.lang.Integer.MAX_VALUE, lastModified)); 1878 } 1879 1880 @Override 1881 public void setProperty(String name, Base value) throws FHIRException { 1882 if (name.equals("status")) 1883 this.status = castToString(value); // StringType 1884 else if (name.equals("location")) 1885 this.location = castToUri(value); // UriType 1886 else if (name.equals("etag")) 1887 this.etag = castToString(value); // StringType 1888 else if (name.equals("lastModified")) 1889 this.lastModified = castToInstant(value); // InstantType 1890 else 1891 super.setProperty(name, value); 1892 } 1893 1894 @Override 1895 public Base addChild(String name) throws FHIRException { 1896 if (name.equals("status")) { 1897 throw new FHIRException("Cannot call addChild on a primitive type Bundle.status"); 1898 } 1899 else if (name.equals("location")) { 1900 throw new FHIRException("Cannot call addChild on a primitive type Bundle.location"); 1901 } 1902 else if (name.equals("etag")) { 1903 throw new FHIRException("Cannot call addChild on a primitive type Bundle.etag"); 1904 } 1905 else if (name.equals("lastModified")) { 1906 throw new FHIRException("Cannot call addChild on a primitive type Bundle.lastModified"); 1907 } 1908 else 1909 return super.addChild(name); 1910 } 1911 1912 public BundleEntryResponseComponent copy() { 1913 BundleEntryResponseComponent dst = new BundleEntryResponseComponent(); 1914 copyValues(dst); 1915 dst.status = status == null ? null : status.copy(); 1916 dst.location = location == null ? null : location.copy(); 1917 dst.etag = etag == null ? null : etag.copy(); 1918 dst.lastModified = lastModified == null ? null : lastModified.copy(); 1919 return dst; 1920 } 1921 1922 @Override 1923 public boolean equalsDeep(Base other) { 1924 if (!super.equalsDeep(other)) 1925 return false; 1926 if (!(other instanceof BundleEntryResponseComponent)) 1927 return false; 1928 BundleEntryResponseComponent o = (BundleEntryResponseComponent) other; 1929 return compareDeep(status, o.status, true) && compareDeep(location, o.location, true) && compareDeep(etag, o.etag, true) 1930 && compareDeep(lastModified, o.lastModified, true); 1931 } 1932 1933 @Override 1934 public boolean equalsShallow(Base other) { 1935 if (!super.equalsShallow(other)) 1936 return false; 1937 if (!(other instanceof BundleEntryResponseComponent)) 1938 return false; 1939 BundleEntryResponseComponent o = (BundleEntryResponseComponent) other; 1940 return compareValues(status, o.status, true) && compareValues(location, o.location, true) && compareValues(etag, o.etag, true) 1941 && compareValues(lastModified, o.lastModified, true); 1942 } 1943 1944 public boolean isEmpty() { 1945 return super.isEmpty() && (status == null || status.isEmpty()) && (location == null || location.isEmpty()) 1946 && (etag == null || etag.isEmpty()) && (lastModified == null || lastModified.isEmpty()); 1947 } 1948 1949 public String fhirType() { 1950 return "Bundle.entry.response"; 1951 1952 } 1953 1954 } 1955 1956 /** 1957 * Indicates the purpose of this bundle- how it was intended to be used. 1958 */ 1959 @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true) 1960 @Description(shortDefinition="document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", formalDefinition="Indicates the purpose of this bundle- how it was intended to be used." ) 1961 protected Enumeration<BundleType> type; 1962 1963 /** 1964 * If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle). 1965 */ 1966 @Child(name = "total", type = {UnsignedIntType.class}, order=1, min=0, max=1, modifier=false, summary=true) 1967 @Description(shortDefinition="If search, the total number of matches", formalDefinition="If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle)." ) 1968 protected UnsignedIntType total; 1969 1970 /** 1971 * A series of links that provide context to this bundle. 1972 */ 1973 @Child(name = "link", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1974 @Description(shortDefinition="Links related to this Bundle", formalDefinition="A series of links that provide context to this bundle." ) 1975 protected List<BundleLinkComponent> link; 1976 1977 /** 1978 * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only). 1979 */ 1980 @Child(name = "entry", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1981 @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)." ) 1982 protected List<BundleEntryComponent> entry; 1983 1984 /** 1985 * Digital Signature - base64 encoded. XML DigSIg or a JWT. 1986 */ 1987 @Child(name = "signature", type = {Signature.class}, order=4, min=0, max=1, modifier=false, summary=true) 1988 @Description(shortDefinition="Digital Signature", formalDefinition="Digital Signature - base64 encoded. XML DigSIg or a JWT." ) 1989 protected Signature signature; 1990 1991 private static final long serialVersionUID = -2041954721L; 1992 1993 /* 1994 * Constructor 1995 */ 1996 public Bundle() { 1997 super(); 1998 } 1999 2000 /* 2001 * Constructor 2002 */ 2003 public Bundle(Enumeration<BundleType> type) { 2004 super(); 2005 this.type = type; 2006 } 2007 2008 /** 2009 * @return {@link #type} (Indicates the purpose of this bundle- how it was intended to be used.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 2010 */ 2011 public Enumeration<BundleType> getTypeElement() { 2012 if (this.type == null) 2013 if (Configuration.errorOnAutoCreate()) 2014 throw new Error("Attempt to auto-create Bundle.type"); 2015 else if (Configuration.doAutoCreate()) 2016 this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); // bb 2017 return this.type; 2018 } 2019 2020 public boolean hasTypeElement() { 2021 return this.type != null && !this.type.isEmpty(); 2022 } 2023 2024 public boolean hasType() { 2025 return this.type != null && !this.type.isEmpty(); 2026 } 2027 2028 /** 2029 * @param value {@link #type} (Indicates the purpose of this bundle- how it was intended to be used.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 2030 */ 2031 public Bundle setTypeElement(Enumeration<BundleType> value) { 2032 this.type = value; 2033 return this; 2034 } 2035 2036 /** 2037 * @return Indicates the purpose of this bundle- how it was intended to be used. 2038 */ 2039 public BundleType getType() { 2040 return this.type == null ? null : this.type.getValue(); 2041 } 2042 2043 /** 2044 * @param value Indicates the purpose of this bundle- how it was intended to be used. 2045 */ 2046 public Bundle setType(BundleType value) { 2047 if (this.type == null) 2048 this.type = new Enumeration<BundleType>(new BundleTypeEnumFactory()); 2049 this.type.setValue(value); 2050 return this; 2051 } 2052 2053 /** 2054 * @return {@link #total} (If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value 2055 */ 2056 public UnsignedIntType getTotalElement() { 2057 if (this.total == null) 2058 if (Configuration.errorOnAutoCreate()) 2059 throw new Error("Attempt to auto-create Bundle.total"); 2060 else if (Configuration.doAutoCreate()) 2061 this.total = new UnsignedIntType(); // bb 2062 return this.total; 2063 } 2064 2065 public boolean hasTotalElement() { 2066 return this.total != null && !this.total.isEmpty(); 2067 } 2068 2069 public boolean hasTotal() { 2070 return this.total != null && !this.total.isEmpty(); 2071 } 2072 2073 /** 2074 * @param value {@link #total} (If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value 2075 */ 2076 public Bundle setTotalElement(UnsignedIntType value) { 2077 this.total = value; 2078 return this; 2079 } 2080 2081 /** 2082 * @return If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle). 2083 */ 2084 public int getTotal() { 2085 return this.total == null || this.total.isEmpty() ? 0 : this.total.getValue(); 2086 } 2087 2088 /** 2089 * @param value If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle). 2090 */ 2091 public Bundle setTotal(int value) { 2092 if (this.total == null) 2093 this.total = new UnsignedIntType(); 2094 this.total.setValue(value); 2095 return this; 2096 } 2097 2098 /** 2099 * @return {@link #link} (A series of links that provide context to this bundle.) 2100 */ 2101 public List<BundleLinkComponent> getLink() { 2102 if (this.link == null) 2103 this.link = new ArrayList<BundleLinkComponent>(); 2104 return this.link; 2105 } 2106 2107 public boolean hasLink() { 2108 if (this.link == null) 2109 return false; 2110 for (BundleLinkComponent item : this.link) 2111 if (!item.isEmpty()) 2112 return true; 2113 return false; 2114 } 2115 2116 /** 2117 * @return {@link #link} (A series of links that provide context to this bundle.) 2118 */ 2119 // syntactic sugar 2120 public BundleLinkComponent addLink() { //3 2121 BundleLinkComponent t = new BundleLinkComponent(); 2122 if (this.link == null) 2123 this.link = new ArrayList<BundleLinkComponent>(); 2124 this.link.add(t); 2125 return t; 2126 } 2127 2128 // syntactic sugar 2129 public Bundle addLink(BundleLinkComponent t) { //3 2130 if (t == null) 2131 return this; 2132 if (this.link == null) 2133 this.link = new ArrayList<BundleLinkComponent>(); 2134 this.link.add(t); 2135 return this; 2136 } 2137 2138 /** 2139 * @return {@link #entry} (An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only).) 2140 */ 2141 public List<BundleEntryComponent> getEntry() { 2142 if (this.entry == null) 2143 this.entry = new ArrayList<BundleEntryComponent>(); 2144 return this.entry; 2145 } 2146 2147 public boolean hasEntry() { 2148 if (this.entry == null) 2149 return false; 2150 for (BundleEntryComponent item : this.entry) 2151 if (!item.isEmpty()) 2152 return true; 2153 return false; 2154 } 2155 2156 /** 2157 * @return {@link #entry} (An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only).) 2158 */ 2159 // syntactic sugar 2160 public BundleEntryComponent addEntry() { //3 2161 BundleEntryComponent t = new BundleEntryComponent(); 2162 if (this.entry == null) 2163 this.entry = new ArrayList<BundleEntryComponent>(); 2164 this.entry.add(t); 2165 return t; 2166 } 2167 2168 // syntactic sugar 2169 public Bundle addEntry(BundleEntryComponent t) { //3 2170 if (t == null) 2171 return this; 2172 if (this.entry == null) 2173 this.entry = new ArrayList<BundleEntryComponent>(); 2174 this.entry.add(t); 2175 return this; 2176 } 2177 2178 /** 2179 * @return {@link #signature} (Digital Signature - base64 encoded. XML DigSIg or a JWT.) 2180 */ 2181 public Signature getSignature() { 2182 if (this.signature == null) 2183 if (Configuration.errorOnAutoCreate()) 2184 throw new Error("Attempt to auto-create Bundle.signature"); 2185 else if (Configuration.doAutoCreate()) 2186 this.signature = new Signature(); // cc 2187 return this.signature; 2188 } 2189 2190 public boolean hasSignature() { 2191 return this.signature != null && !this.signature.isEmpty(); 2192 } 2193 2194 /** 2195 * @param value {@link #signature} (Digital Signature - base64 encoded. XML DigSIg or a JWT.) 2196 */ 2197 public Bundle setSignature(Signature value) { 2198 this.signature = value; 2199 return this; 2200 } 2201 2202 /** 2203 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 2204 * If no link is found which matches the given relation, returns <code>null</code>. If more than one 2205 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 2206 * 2207 * @param theRelation 2208 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 2209 * @return Returns a matching BundleLinkComponent, or <code>null</code> 2210 * @see IBaseBundle#LINK_NEXT 2211 * @see IBaseBundle#LINK_PREV 2212 * @see IBaseBundle#LINK_SELF 2213 */ 2214 public BundleLinkComponent getLink(String theRelation) { 2215 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 2216 for (BundleLinkComponent next : getLink()) { 2217 if (theRelation.equals(next.getRelation())) { 2218 return next; 2219 } 2220 } 2221 return null; 2222 } 2223 2224 /** 2225 * Returns the {@link #getLink() link} which matches a given {@link BundleLinkComponent#getRelation() relation}. 2226 * If no link is found which matches the given relation, creates a new BundleLinkComponent with the 2227 * given relation and adds it to this Bundle. If more than one 2228 * link is found which matches the given relation, returns the first matching BundleLinkComponent. 2229 * 2230 * @param theRelation 2231 * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. 2232 * @return Returns a matching BundleLinkComponent, or <code>null</code> 2233 * @see IBaseBundle#LINK_NEXT 2234 * @see IBaseBundle#LINK_PREV 2235 * @see IBaseBundle#LINK_SELF 2236 */ 2237 public BundleLinkComponent getLinkOrCreate(String theRelation) { 2238 org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); 2239 for (BundleLinkComponent next : getLink()) { 2240 if (theRelation.equals(next.getRelation())) { 2241 return next; 2242 } 2243 } 2244 BundleLinkComponent retVal = new BundleLinkComponent(); 2245 retVal.setRelation(theRelation); 2246 getLink().add(retVal); 2247 return retVal; 2248 } 2249 protected void listChildren(List<Property> childrenList) { 2250 super.listChildren(childrenList); 2251 childrenList.add(new Property("type", "code", "Indicates the purpose of this bundle- how it was intended to be used.", 0, java.lang.Integer.MAX_VALUE, type)); 2252 childrenList.add(new Property("total", "unsignedInt", "If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).", 0, java.lang.Integer.MAX_VALUE, total)); 2253 childrenList.add(new Property("link", "", "A series of links that provide context to this bundle.", 0, java.lang.Integer.MAX_VALUE, link)); 2254 childrenList.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)); 2255 childrenList.add(new Property("signature", "Signature", "Digital Signature - base64 encoded. XML DigSIg or a JWT.", 0, java.lang.Integer.MAX_VALUE, signature)); 2256 } 2257 2258 @Override 2259 public void setProperty(String name, Base value) throws FHIRException { 2260 if (name.equals("type")) 2261 this.type = new BundleTypeEnumFactory().fromType(value); // Enumeration<BundleType> 2262 else if (name.equals("total")) 2263 this.total = castToUnsignedInt(value); // UnsignedIntType 2264 else if (name.equals("link")) 2265 this.getLink().add((BundleLinkComponent) value); 2266 else if (name.equals("entry")) 2267 this.getEntry().add((BundleEntryComponent) value); 2268 else if (name.equals("signature")) 2269 this.signature = castToSignature(value); // Signature 2270 else 2271 super.setProperty(name, value); 2272 } 2273 2274 @Override 2275 public Base addChild(String name) throws FHIRException { 2276 if (name.equals("type")) { 2277 throw new FHIRException("Cannot call addChild on a primitive type Bundle.type"); 2278 } 2279 else if (name.equals("total")) { 2280 throw new FHIRException("Cannot call addChild on a primitive type Bundle.total"); 2281 } 2282 else if (name.equals("link")) { 2283 return addLink(); 2284 } 2285 else if (name.equals("entry")) { 2286 return addEntry(); 2287 } 2288 else if (name.equals("signature")) { 2289 this.signature = new Signature(); 2290 return this.signature; 2291 } 2292 else 2293 return super.addChild(name); 2294 } 2295 2296 public String fhirType() { 2297 return "Bundle"; 2298 2299 } 2300 2301 public Bundle copy() { 2302 Bundle dst = new Bundle(); 2303 copyValues(dst); 2304 dst.type = type == null ? null : type.copy(); 2305 dst.total = total == null ? null : total.copy(); 2306 if (link != null) { 2307 dst.link = new ArrayList<BundleLinkComponent>(); 2308 for (BundleLinkComponent i : link) 2309 dst.link.add(i.copy()); 2310 }; 2311 if (entry != null) { 2312 dst.entry = new ArrayList<BundleEntryComponent>(); 2313 for (BundleEntryComponent i : entry) 2314 dst.entry.add(i.copy()); 2315 }; 2316 dst.signature = signature == null ? null : signature.copy(); 2317 return dst; 2318 } 2319 2320 protected Bundle typedCopy() { 2321 return copy(); 2322 } 2323 2324 @Override 2325 public boolean equalsDeep(Base other) { 2326 if (!super.equalsDeep(other)) 2327 return false; 2328 if (!(other instanceof Bundle)) 2329 return false; 2330 Bundle o = (Bundle) other; 2331 return compareDeep(type, o.type, true) && compareDeep(total, o.total, true) && compareDeep(link, o.link, true) 2332 && compareDeep(entry, o.entry, true) && compareDeep(signature, o.signature, true); 2333 } 2334 2335 @Override 2336 public boolean equalsShallow(Base other) { 2337 if (!super.equalsShallow(other)) 2338 return false; 2339 if (!(other instanceof Bundle)) 2340 return false; 2341 Bundle o = (Bundle) other; 2342 return compareValues(type, o.type, true) && compareValues(total, o.total, true); 2343 } 2344 2345 public boolean isEmpty() { 2346 return super.isEmpty() && (type == null || type.isEmpty()) && (total == null || total.isEmpty()) 2347 && (link == null || link.isEmpty()) && (entry == null || entry.isEmpty()) && (signature == null || signature.isEmpty()) 2348 ; 2349 } 2350 2351 @Override 2352 public ResourceType getResourceType() { 2353 return ResourceType.Bundle; 2354 } 2355 2356 @SearchParamDefinition(name="composition", path="Bundle.entry.resource.item(0)", description="The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to searches its contents", type="reference" ) 2357 public static final String SP_COMPOSITION = "composition"; 2358 @SearchParamDefinition(name="type", path="Bundle.type", description="document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", type="token" ) 2359 public static final String SP_TYPE = "type"; 2360 @SearchParamDefinition(name="message", path="Bundle.entry.resource.item(0)", 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" ) 2361 public static final String SP_MESSAGE = "message"; 2362 2363} 2364