![](/hapi-fhir/images/logos/raccoon-forwards.png)
001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038 039import ca.uhn.fhir.model.api.annotation.Block; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044 045/** 046 * Identifies two or more records (resource instances) that refer to the same 047 * real-world "occurrence". 048 */ 049@ResourceDef(name = "Linkage", profile = "http://hl7.org/fhir/StructureDefinition/Linkage") 050public class Linkage extends DomainResource { 051 052 public enum LinkageType { 053 /** 054 * The resource represents the "source of truth" (from the perspective of this 055 * Linkage resource) for the underlying event/condition/etc. 056 */ 057 SOURCE, 058 /** 059 * The resource represents an alternative view of the underlying 060 * event/condition/etc. The resource may still be actively maintained, even 061 * though it is not considered to be the source of truth. 062 */ 063 ALTERNATE, 064 /** 065 * The resource represents an obsolete record of the underlying 066 * event/condition/etc. It is not expected to be actively maintained. 067 */ 068 HISTORICAL, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 074 public static LinkageType fromCode(String codeString) throws FHIRException { 075 if (codeString == null || "".equals(codeString)) 076 return null; 077 if ("source".equals(codeString)) 078 return SOURCE; 079 if ("alternate".equals(codeString)) 080 return ALTERNATE; 081 if ("historical".equals(codeString)) 082 return HISTORICAL; 083 if (Configuration.isAcceptInvalidEnums()) 084 return null; 085 else 086 throw new FHIRException("Unknown LinkageType code '" + codeString + "'"); 087 } 088 089 public String toCode() { 090 switch (this) { 091 case SOURCE: 092 return "source"; 093 case ALTERNATE: 094 return "alternate"; 095 case HISTORICAL: 096 return "historical"; 097 case NULL: 098 return null; 099 default: 100 return "?"; 101 } 102 } 103 104 public String getSystem() { 105 switch (this) { 106 case SOURCE: 107 return "http://hl7.org/fhir/linkage-type"; 108 case ALTERNATE: 109 return "http://hl7.org/fhir/linkage-type"; 110 case HISTORICAL: 111 return "http://hl7.org/fhir/linkage-type"; 112 case NULL: 113 return null; 114 default: 115 return "?"; 116 } 117 } 118 119 public String getDefinition() { 120 switch (this) { 121 case SOURCE: 122 return "The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc."; 123 case ALTERNATE: 124 return "The resource represents an alternative view of the underlying event/condition/etc. The resource may still be actively maintained, even though it is not considered to be the source of truth."; 125 case HISTORICAL: 126 return "The resource represents an obsolete record of the underlying event/condition/etc. It is not expected to be actively maintained."; 127 case NULL: 128 return null; 129 default: 130 return "?"; 131 } 132 } 133 134 public String getDisplay() { 135 switch (this) { 136 case SOURCE: 137 return "Source of Truth"; 138 case ALTERNATE: 139 return "Alternate Record"; 140 case HISTORICAL: 141 return "Historical/Obsolete Record"; 142 case NULL: 143 return null; 144 default: 145 return "?"; 146 } 147 } 148 } 149 150 public static class LinkageTypeEnumFactory implements EnumFactory<LinkageType> { 151 public LinkageType fromCode(String codeString) throws IllegalArgumentException { 152 if (codeString == null || "".equals(codeString)) 153 if (codeString == null || "".equals(codeString)) 154 return null; 155 if ("source".equals(codeString)) 156 return LinkageType.SOURCE; 157 if ("alternate".equals(codeString)) 158 return LinkageType.ALTERNATE; 159 if ("historical".equals(codeString)) 160 return LinkageType.HISTORICAL; 161 throw new IllegalArgumentException("Unknown LinkageType code '" + codeString + "'"); 162 } 163 164 public Enumeration<LinkageType> fromType(PrimitiveType<?> code) throws FHIRException { 165 if (code == null) 166 return null; 167 if (code.isEmpty()) 168 return new Enumeration<LinkageType>(this, LinkageType.NULL, code); 169 String codeString = code.asStringValue(); 170 if (codeString == null || "".equals(codeString)) 171 return new Enumeration<LinkageType>(this, LinkageType.NULL, code); 172 if ("source".equals(codeString)) 173 return new Enumeration<LinkageType>(this, LinkageType.SOURCE, code); 174 if ("alternate".equals(codeString)) 175 return new Enumeration<LinkageType>(this, LinkageType.ALTERNATE, code); 176 if ("historical".equals(codeString)) 177 return new Enumeration<LinkageType>(this, LinkageType.HISTORICAL, code); 178 throw new FHIRException("Unknown LinkageType code '" + codeString + "'"); 179 } 180 181 public String toCode(LinkageType code) { 182 if (code == LinkageType.SOURCE) 183 return "source"; 184 if (code == LinkageType.ALTERNATE) 185 return "alternate"; 186 if (code == LinkageType.HISTORICAL) 187 return "historical"; 188 return "?"; 189 } 190 191 public String toSystem(LinkageType code) { 192 return code.getSystem(); 193 } 194 } 195 196 @Block() 197 public static class LinkageItemComponent extends BackboneElement implements IBaseBackboneElement { 198 /** 199 * Distinguishes which item is "source of truth" (if any) and which items are no 200 * longer considered to be current representations. 201 */ 202 @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 203 @Description(shortDefinition = "source | alternate | historical", formalDefinition = "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.") 204 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/linkage-type") 205 protected Enumeration<LinkageType> type; 206 207 /** 208 * The resource instance being linked as part of the group. 209 */ 210 @Child(name = "resource", type = { Reference.class }, order = 2, min = 1, max = 1, modifier = false, summary = true) 211 @Description(shortDefinition = "Resource being linked", formalDefinition = "The resource instance being linked as part of the group.") 212 protected Reference resource; 213 214 /** 215 * The actual object that is the target of the reference (The resource instance 216 * being linked as part of the group.) 217 */ 218 protected Resource resourceTarget; 219 220 private static final long serialVersionUID = -209332008L; 221 222 /** 223 * Constructor 224 */ 225 public LinkageItemComponent() { 226 super(); 227 } 228 229 /** 230 * Constructor 231 */ 232 public LinkageItemComponent(Enumeration<LinkageType> type, Reference resource) { 233 super(); 234 this.type = type; 235 this.resource = resource; 236 } 237 238 /** 239 * @return {@link #type} (Distinguishes which item is "source of truth" (if any) 240 * and which items are no longer considered to be current 241 * representations.). This is the underlying object with id, value and 242 * extensions. The accessor "getType" gives direct access to the value 243 */ 244 public Enumeration<LinkageType> getTypeElement() { 245 if (this.type == null) 246 if (Configuration.errorOnAutoCreate()) 247 throw new Error("Attempt to auto-create LinkageItemComponent.type"); 248 else if (Configuration.doAutoCreate()) 249 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); // bb 250 return this.type; 251 } 252 253 public boolean hasTypeElement() { 254 return this.type != null && !this.type.isEmpty(); 255 } 256 257 public boolean hasType() { 258 return this.type != null && !this.type.isEmpty(); 259 } 260 261 /** 262 * @param value {@link #type} (Distinguishes which item is "source of truth" (if 263 * any) and which items are no longer considered to be current 264 * representations.). This is the underlying object with id, value 265 * and extensions. The accessor "getType" gives direct access to 266 * the value 267 */ 268 public LinkageItemComponent setTypeElement(Enumeration<LinkageType> value) { 269 this.type = value; 270 return this; 271 } 272 273 /** 274 * @return Distinguishes which item is "source of truth" (if any) and which 275 * items are no longer considered to be current representations. 276 */ 277 public LinkageType getType() { 278 return this.type == null ? null : this.type.getValue(); 279 } 280 281 /** 282 * @param value Distinguishes which item is "source of truth" (if any) and which 283 * items are no longer considered to be current representations. 284 */ 285 public LinkageItemComponent setType(LinkageType value) { 286 if (this.type == null) 287 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); 288 this.type.setValue(value); 289 return this; 290 } 291 292 /** 293 * @return {@link #resource} (The resource instance being linked as part of the 294 * group.) 295 */ 296 public Reference getResource() { 297 if (this.resource == null) 298 if (Configuration.errorOnAutoCreate()) 299 throw new Error("Attempt to auto-create LinkageItemComponent.resource"); 300 else if (Configuration.doAutoCreate()) 301 this.resource = new Reference(); // cc 302 return this.resource; 303 } 304 305 public boolean hasResource() { 306 return this.resource != null && !this.resource.isEmpty(); 307 } 308 309 /** 310 * @param value {@link #resource} (The resource instance being linked as part of 311 * the group.) 312 */ 313 public LinkageItemComponent setResource(Reference value) { 314 this.resource = value; 315 return this; 316 } 317 318 /** 319 * @return {@link #resource} The actual object that is the target of the 320 * reference. The reference library doesn't populate this, but you can 321 * use it to hold the resource if you resolve it. (The resource instance 322 * being linked as part of the group.) 323 */ 324 public Resource getResourceTarget() { 325 return this.resourceTarget; 326 } 327 328 /** 329 * @param value {@link #resource} The actual object that is the target of the 330 * reference. The reference library doesn't use these, but you can 331 * use it to hold the resource if you resolve it. (The resource 332 * instance being linked as part of the group.) 333 */ 334 public LinkageItemComponent setResourceTarget(Resource value) { 335 this.resourceTarget = value; 336 return this; 337 } 338 339 protected void listChildren(List<Property> children) { 340 super.listChildren(children); 341 children.add(new Property("type", "code", 342 "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 343 0, 1, type)); 344 children.add(new Property("resource", "Reference(Any)", 345 "The resource instance being linked as part of the group.", 0, 1, resource)); 346 } 347 348 @Override 349 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 350 switch (_hash) { 351 case 3575610: 352 /* type */ return new Property("type", "code", 353 "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 354 0, 1, type); 355 case -341064690: 356 /* resource */ return new Property("resource", "Reference(Any)", 357 "The resource instance being linked as part of the group.", 0, 1, resource); 358 default: 359 return super.getNamedProperty(_hash, _name, _checkValid); 360 } 361 362 } 363 364 @Override 365 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 366 switch (hash) { 367 case 3575610: 368 /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<LinkageType> 369 case -341064690: 370 /* resource */ return this.resource == null ? new Base[0] : new Base[] { this.resource }; // Reference 371 default: 372 return super.getProperty(hash, name, checkValid); 373 } 374 375 } 376 377 @Override 378 public Base setProperty(int hash, String name, Base value) throws FHIRException { 379 switch (hash) { 380 case 3575610: // type 381 value = new LinkageTypeEnumFactory().fromType(castToCode(value)); 382 this.type = (Enumeration) value; // Enumeration<LinkageType> 383 return value; 384 case -341064690: // resource 385 this.resource = castToReference(value); // Reference 386 return value; 387 default: 388 return super.setProperty(hash, name, value); 389 } 390 391 } 392 393 @Override 394 public Base setProperty(String name, Base value) throws FHIRException { 395 if (name.equals("type")) { 396 value = new LinkageTypeEnumFactory().fromType(castToCode(value)); 397 this.type = (Enumeration) value; // Enumeration<LinkageType> 398 } else if (name.equals("resource")) { 399 this.resource = castToReference(value); // Reference 400 } else 401 return super.setProperty(name, value); 402 return value; 403 } 404 405 @Override 406 public void removeChild(String name, Base value) throws FHIRException { 407 if (name.equals("type")) { 408 this.type = null; 409 } else if (name.equals("resource")) { 410 this.resource = null; 411 } else 412 super.removeChild(name, value); 413 414 } 415 416 @Override 417 public Base makeProperty(int hash, String name) throws FHIRException { 418 switch (hash) { 419 case 3575610: 420 return getTypeElement(); 421 case -341064690: 422 return getResource(); 423 default: 424 return super.makeProperty(hash, name); 425 } 426 427 } 428 429 @Override 430 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 431 switch (hash) { 432 case 3575610: 433 /* type */ return new String[] { "code" }; 434 case -341064690: 435 /* resource */ return new String[] { "Reference" }; 436 default: 437 return super.getTypesForProperty(hash, name); 438 } 439 440 } 441 442 @Override 443 public Base addChild(String name) throws FHIRException { 444 if (name.equals("type")) { 445 throw new FHIRException("Cannot call addChild on a singleton property Linkage.type"); 446 } else if (name.equals("resource")) { 447 this.resource = new Reference(); 448 return this.resource; 449 } else 450 return super.addChild(name); 451 } 452 453 public LinkageItemComponent copy() { 454 LinkageItemComponent dst = new LinkageItemComponent(); 455 copyValues(dst); 456 return dst; 457 } 458 459 public void copyValues(LinkageItemComponent dst) { 460 super.copyValues(dst); 461 dst.type = type == null ? null : type.copy(); 462 dst.resource = resource == null ? null : resource.copy(); 463 } 464 465 @Override 466 public boolean equalsDeep(Base other_) { 467 if (!super.equalsDeep(other_)) 468 return false; 469 if (!(other_ instanceof LinkageItemComponent)) 470 return false; 471 LinkageItemComponent o = (LinkageItemComponent) other_; 472 return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true); 473 } 474 475 @Override 476 public boolean equalsShallow(Base other_) { 477 if (!super.equalsShallow(other_)) 478 return false; 479 if (!(other_ instanceof LinkageItemComponent)) 480 return false; 481 LinkageItemComponent o = (LinkageItemComponent) other_; 482 return compareValues(type, o.type, true); 483 } 484 485 public boolean isEmpty() { 486 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource); 487 } 488 489 public String fhirType() { 490 return "Linkage.item"; 491 492 } 493 494 } 495 496 /** 497 * Indicates whether the asserted set of linkages are considered to be "in 498 * effect". 499 */ 500 @Child(name = "active", type = { BooleanType.class }, order = 0, min = 0, max = 1, modifier = false, summary = true) 501 @Description(shortDefinition = "Whether this linkage assertion is active or not", formalDefinition = "Indicates whether the asserted set of linkages are considered to be \"in effect\".") 502 protected BooleanType active; 503 504 /** 505 * Identifies the user or organization responsible for asserting the linkages as 506 * well as the user or organization who establishes the context in which the 507 * nature of each linkage is evaluated. 508 */ 509 @Child(name = "author", type = { Practitioner.class, PractitionerRole.class, 510 Organization.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 511 @Description(shortDefinition = "Who is responsible for linkages", formalDefinition = "Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.") 512 protected Reference author; 513 514 /** 515 * The actual object that is the target of the reference (Identifies the user or 516 * organization responsible for asserting the linkages as well as the user or 517 * organization who establishes the context in which the nature of each linkage 518 * is evaluated.) 519 */ 520 protected Resource authorTarget; 521 522 /** 523 * Identifies which record considered as the reference to the same real-world 524 * occurrence as well as how the items should be evaluated within the collection 525 * of linked items. 526 */ 527 @Child(name = "item", type = {}, order = 2, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 528 @Description(shortDefinition = "Item to be linked", formalDefinition = "Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.") 529 protected List<LinkageItemComponent> item; 530 531 private static final long serialVersionUID = 25900306L; 532 533 /** 534 * Constructor 535 */ 536 public Linkage() { 537 super(); 538 } 539 540 /** 541 * @return {@link #active} (Indicates whether the asserted set of linkages are 542 * considered to be "in effect".). This is the underlying object with 543 * id, value and extensions. The accessor "getActive" gives direct 544 * access to the value 545 */ 546 public BooleanType getActiveElement() { 547 if (this.active == null) 548 if (Configuration.errorOnAutoCreate()) 549 throw new Error("Attempt to auto-create Linkage.active"); 550 else if (Configuration.doAutoCreate()) 551 this.active = new BooleanType(); // bb 552 return this.active; 553 } 554 555 public boolean hasActiveElement() { 556 return this.active != null && !this.active.isEmpty(); 557 } 558 559 public boolean hasActive() { 560 return this.active != null && !this.active.isEmpty(); 561 } 562 563 /** 564 * @param value {@link #active} (Indicates whether the asserted set of linkages 565 * are considered to be "in effect".). This is the underlying 566 * object with id, value and extensions. The accessor "getActive" 567 * gives direct access to the value 568 */ 569 public Linkage setActiveElement(BooleanType value) { 570 this.active = value; 571 return this; 572 } 573 574 /** 575 * @return Indicates whether the asserted set of linkages are considered to be 576 * "in effect". 577 */ 578 public boolean getActive() { 579 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 580 } 581 582 /** 583 * @param value Indicates whether the asserted set of linkages are considered to 584 * be "in effect". 585 */ 586 public Linkage setActive(boolean value) { 587 if (this.active == null) 588 this.active = new BooleanType(); 589 this.active.setValue(value); 590 return this; 591 } 592 593 /** 594 * @return {@link #author} (Identifies the user or organization responsible for 595 * asserting the linkages as well as the user or organization who 596 * establishes the context in which the nature of each linkage is 597 * evaluated.) 598 */ 599 public Reference getAuthor() { 600 if (this.author == null) 601 if (Configuration.errorOnAutoCreate()) 602 throw new Error("Attempt to auto-create Linkage.author"); 603 else if (Configuration.doAutoCreate()) 604 this.author = new Reference(); // cc 605 return this.author; 606 } 607 608 public boolean hasAuthor() { 609 return this.author != null && !this.author.isEmpty(); 610 } 611 612 /** 613 * @param value {@link #author} (Identifies the user or organization responsible 614 * for asserting the linkages as well as the user or organization 615 * who establishes the context in which the nature of each linkage 616 * is evaluated.) 617 */ 618 public Linkage setAuthor(Reference value) { 619 this.author = value; 620 return this; 621 } 622 623 /** 624 * @return {@link #author} The actual object that is the target of the 625 * reference. The reference library doesn't populate this, but you can 626 * use it to hold the resource if you resolve it. (Identifies the user 627 * or organization responsible for asserting the linkages as well as the 628 * user or organization who establishes the context in which the nature 629 * of each linkage is evaluated.) 630 */ 631 public Resource getAuthorTarget() { 632 return this.authorTarget; 633 } 634 635 /** 636 * @param value {@link #author} The actual object that is the target of the 637 * reference. The reference library doesn't use these, but you can 638 * use it to hold the resource if you resolve it. (Identifies the 639 * user or organization responsible for asserting the linkages as 640 * well as the user or organization who establishes the context in 641 * which the nature of each linkage is evaluated.) 642 */ 643 public Linkage setAuthorTarget(Resource value) { 644 this.authorTarget = value; 645 return this; 646 } 647 648 /** 649 * @return {@link #item} (Identifies which record considered as the reference to 650 * the same real-world occurrence as well as how the items should be 651 * evaluated within the collection of linked items.) 652 */ 653 public List<LinkageItemComponent> getItem() { 654 if (this.item == null) 655 this.item = new ArrayList<LinkageItemComponent>(); 656 return this.item; 657 } 658 659 /** 660 * @return Returns a reference to <code>this</code> for easy method chaining 661 */ 662 public Linkage setItem(List<LinkageItemComponent> theItem) { 663 this.item = theItem; 664 return this; 665 } 666 667 public boolean hasItem() { 668 if (this.item == null) 669 return false; 670 for (LinkageItemComponent item : this.item) 671 if (!item.isEmpty()) 672 return true; 673 return false; 674 } 675 676 public LinkageItemComponent addItem() { // 3 677 LinkageItemComponent t = new LinkageItemComponent(); 678 if (this.item == null) 679 this.item = new ArrayList<LinkageItemComponent>(); 680 this.item.add(t); 681 return t; 682 } 683 684 public Linkage addItem(LinkageItemComponent t) { // 3 685 if (t == null) 686 return this; 687 if (this.item == null) 688 this.item = new ArrayList<LinkageItemComponent>(); 689 this.item.add(t); 690 return this; 691 } 692 693 /** 694 * @return The first repetition of repeating field {@link #item}, creating it if 695 * it does not already exist 696 */ 697 public LinkageItemComponent getItemFirstRep() { 698 if (getItem().isEmpty()) { 699 addItem(); 700 } 701 return getItem().get(0); 702 } 703 704 protected void listChildren(List<Property> children) { 705 super.listChildren(children); 706 children.add(new Property("active", "boolean", 707 "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active)); 708 children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", 709 "Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.", 710 0, 1, author)); 711 children.add(new Property("item", "", 712 "Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.", 713 0, java.lang.Integer.MAX_VALUE, item)); 714 } 715 716 @Override 717 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 718 switch (_hash) { 719 case -1422950650: 720 /* active */ return new Property("active", "boolean", 721 "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active); 722 case -1406328437: 723 /* author */ return new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", 724 "Identifies the user or organization responsible for asserting the linkages as well as the user or organization who establishes the context in which the nature of each linkage is evaluated.", 725 0, 1, author); 726 case 3242771: 727 /* item */ return new Property("item", "", 728 "Identifies which record considered as the reference to the same real-world occurrence as well as how the items should be evaluated within the collection of linked items.", 729 0, java.lang.Integer.MAX_VALUE, item); 730 default: 731 return super.getNamedProperty(_hash, _name, _checkValid); 732 } 733 734 } 735 736 @Override 737 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 738 switch (hash) { 739 case -1422950650: 740 /* active */ return this.active == null ? new Base[0] : new Base[] { this.active }; // BooleanType 741 case -1406328437: 742 /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference 743 case 3242771: 744 /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // LinkageItemComponent 745 default: 746 return super.getProperty(hash, name, checkValid); 747 } 748 749 } 750 751 @Override 752 public Base setProperty(int hash, String name, Base value) throws FHIRException { 753 switch (hash) { 754 case -1422950650: // active 755 this.active = castToBoolean(value); // BooleanType 756 return value; 757 case -1406328437: // author 758 this.author = castToReference(value); // Reference 759 return value; 760 case 3242771: // item 761 this.getItem().add((LinkageItemComponent) value); // LinkageItemComponent 762 return value; 763 default: 764 return super.setProperty(hash, name, value); 765 } 766 767 } 768 769 @Override 770 public Base setProperty(String name, Base value) throws FHIRException { 771 if (name.equals("active")) { 772 this.active = castToBoolean(value); // BooleanType 773 } else if (name.equals("author")) { 774 this.author = castToReference(value); // Reference 775 } else if (name.equals("item")) { 776 this.getItem().add((LinkageItemComponent) value); 777 } else 778 return super.setProperty(name, value); 779 return value; 780 } 781 782 @Override 783 public void removeChild(String name, Base value) throws FHIRException { 784 if (name.equals("active")) { 785 this.active = null; 786 } else if (name.equals("author")) { 787 this.author = null; 788 } else if (name.equals("item")) { 789 this.getItem().remove((LinkageItemComponent) value); 790 } else 791 super.removeChild(name, value); 792 793 } 794 795 @Override 796 public Base makeProperty(int hash, String name) throws FHIRException { 797 switch (hash) { 798 case -1422950650: 799 return getActiveElement(); 800 case -1406328437: 801 return getAuthor(); 802 case 3242771: 803 return addItem(); 804 default: 805 return super.makeProperty(hash, name); 806 } 807 808 } 809 810 @Override 811 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 812 switch (hash) { 813 case -1422950650: 814 /* active */ return new String[] { "boolean" }; 815 case -1406328437: 816 /* author */ return new String[] { "Reference" }; 817 case 3242771: 818 /* item */ return new String[] {}; 819 default: 820 return super.getTypesForProperty(hash, name); 821 } 822 823 } 824 825 @Override 826 public Base addChild(String name) throws FHIRException { 827 if (name.equals("active")) { 828 throw new FHIRException("Cannot call addChild on a singleton property Linkage.active"); 829 } else if (name.equals("author")) { 830 this.author = new Reference(); 831 return this.author; 832 } else if (name.equals("item")) { 833 return addItem(); 834 } else 835 return super.addChild(name); 836 } 837 838 public String fhirType() { 839 return "Linkage"; 840 841 } 842 843 public Linkage copy() { 844 Linkage dst = new Linkage(); 845 copyValues(dst); 846 return dst; 847 } 848 849 public void copyValues(Linkage dst) { 850 super.copyValues(dst); 851 dst.active = active == null ? null : active.copy(); 852 dst.author = author == null ? null : author.copy(); 853 if (item != null) { 854 dst.item = new ArrayList<LinkageItemComponent>(); 855 for (LinkageItemComponent i : item) 856 dst.item.add(i.copy()); 857 } 858 ; 859 } 860 861 protected Linkage typedCopy() { 862 return copy(); 863 } 864 865 @Override 866 public boolean equalsDeep(Base other_) { 867 if (!super.equalsDeep(other_)) 868 return false; 869 if (!(other_ instanceof Linkage)) 870 return false; 871 Linkage o = (Linkage) other_; 872 return compareDeep(active, o.active, true) && compareDeep(author, o.author, true) 873 && compareDeep(item, o.item, true); 874 } 875 876 @Override 877 public boolean equalsShallow(Base other_) { 878 if (!super.equalsShallow(other_)) 879 return false; 880 if (!(other_ instanceof Linkage)) 881 return false; 882 Linkage o = (Linkage) other_; 883 return compareValues(active, o.active, true); 884 } 885 886 public boolean isEmpty() { 887 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(active, author, item); 888 } 889 890 @Override 891 public ResourceType getResourceType() { 892 return ResourceType.Linkage; 893 } 894 895 /** 896 * Search parameter: <b>item</b> 897 * <p> 898 * Description: <b>Matches on any item in the Linkage</b><br> 899 * Type: <b>reference</b><br> 900 * Path: <b>Linkage.item.resource</b><br> 901 * </p> 902 */ 903 @SearchParamDefinition(name = "item", path = "Linkage.item.resource", description = "Matches on any item in the Linkage", type = "reference") 904 public static final String SP_ITEM = "item"; 905 /** 906 * <b>Fluent Client</b> search parameter constant for <b>item</b> 907 * <p> 908 * Description: <b>Matches on any item in the Linkage</b><br> 909 * Type: <b>reference</b><br> 910 * Path: <b>Linkage.item.resource</b><br> 911 * </p> 912 */ 913 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 914 SP_ITEM); 915 916 /** 917 * Constant for fluent queries to be used to add include statements. Specifies 918 * the path value of "<b>Linkage:item</b>". 919 */ 920 public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("Linkage:item") 921 .toLocked(); 922 923 /** 924 * Search parameter: <b>author</b> 925 * <p> 926 * Description: <b>Author of the Linkage</b><br> 927 * Type: <b>reference</b><br> 928 * Path: <b>Linkage.author</b><br> 929 * </p> 930 */ 931 @SearchParamDefinition(name = "author", path = "Linkage.author", description = "Author of the Linkage", type = "reference", providesMembershipIn = { 932 @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class, 933 Practitioner.class, PractitionerRole.class }) 934 public static final String SP_AUTHOR = "author"; 935 /** 936 * <b>Fluent Client</b> search parameter constant for <b>author</b> 937 * <p> 938 * Description: <b>Author of the Linkage</b><br> 939 * Type: <b>reference</b><br> 940 * Path: <b>Linkage.author</b><br> 941 * </p> 942 */ 943 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 944 SP_AUTHOR); 945 946 /** 947 * Constant for fluent queries to be used to add include statements. Specifies 948 * the path value of "<b>Linkage:author</b>". 949 */ 950 public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Linkage:author") 951 .toLocked(); 952 953 /** 954 * Search parameter: <b>source</b> 955 * <p> 956 * Description: <b>Matches on any item in the Linkage with a type of 957 * 'source'</b><br> 958 * Type: <b>reference</b><br> 959 * Path: <b>Linkage.item.resource</b><br> 960 * </p> 961 */ 962 @SearchParamDefinition(name = "source", path = "Linkage.item.resource", description = "Matches on any item in the Linkage with a type of 'source'", type = "reference") 963 public static final String SP_SOURCE = "source"; 964 /** 965 * <b>Fluent Client</b> search parameter constant for <b>source</b> 966 * <p> 967 * Description: <b>Matches on any item in the Linkage with a type of 968 * 'source'</b><br> 969 * Type: <b>reference</b><br> 970 * Path: <b>Linkage.item.resource</b><br> 971 * </p> 972 */ 973 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 974 SP_SOURCE); 975 976 /** 977 * Constant for fluent queries to be used to add include statements. Specifies 978 * the path value of "<b>Linkage:source</b>". 979 */ 980 public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("Linkage:source") 981 .toLocked(); 982 983}