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