![](/hapi-fhir/images/logos/raccoon-forwards.png)
001package org.hl7.fhir.r5.model; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r5.model.Enumerations.*; 039import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.ChildOrder; 047import ca.uhn.fhir.model.api.annotation.Description; 048import ca.uhn.fhir.model.api.annotation.Block; 049 050/** 051 * Identifies two or more records (resource instances) that refer to the same real-world "occurrence". 052 */ 053@ResourceDef(name="Linkage", profile="http://hl7.org/fhir/StructureDefinition/Linkage") 054public class Linkage extends DomainResource { 055 056 public enum LinkageType { 057 /** 058 * The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc. 059 */ 060 SOURCE, 061 /** 062 * 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. 063 */ 064 ALTERNATE, 065 /** 066 * The resource represents an obsolete record of the underlying 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 public static LinkageType fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("source".equals(codeString)) 077 return SOURCE; 078 if ("alternate".equals(codeString)) 079 return ALTERNATE; 080 if ("historical".equals(codeString)) 081 return HISTORICAL; 082 if (Configuration.isAcceptInvalidEnums()) 083 return null; 084 else 085 throw new FHIRException("Unknown LinkageType code '"+codeString+"'"); 086 } 087 public String toCode() { 088 switch (this) { 089 case SOURCE: return "source"; 090 case ALTERNATE: return "alternate"; 091 case HISTORICAL: return "historical"; 092 case NULL: return null; 093 default: return "?"; 094 } 095 } 096 public String getSystem() { 097 switch (this) { 098 case SOURCE: return "http://hl7.org/fhir/linkage-type"; 099 case ALTERNATE: return "http://hl7.org/fhir/linkage-type"; 100 case HISTORICAL: return "http://hl7.org/fhir/linkage-type"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 public String getDefinition() { 106 switch (this) { 107 case SOURCE: return "The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc."; 108 case ALTERNATE: 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."; 109 case HISTORICAL: return "The resource represents an obsolete record of the underlying event/condition/etc. It is not expected to be actively maintained."; 110 case NULL: return null; 111 default: return "?"; 112 } 113 } 114 public String getDisplay() { 115 switch (this) { 116 case SOURCE: return "Source of Truth"; 117 case ALTERNATE: return "Alternate Record"; 118 case HISTORICAL: return "Historical/Obsolete Record"; 119 case NULL: return null; 120 default: return "?"; 121 } 122 } 123 } 124 125 public static class LinkageTypeEnumFactory implements EnumFactory<LinkageType> { 126 public LinkageType fromCode(String codeString) throws IllegalArgumentException { 127 if (codeString == null || "".equals(codeString)) 128 if (codeString == null || "".equals(codeString)) 129 return null; 130 if ("source".equals(codeString)) 131 return LinkageType.SOURCE; 132 if ("alternate".equals(codeString)) 133 return LinkageType.ALTERNATE; 134 if ("historical".equals(codeString)) 135 return LinkageType.HISTORICAL; 136 throw new IllegalArgumentException("Unknown LinkageType code '"+codeString+"'"); 137 } 138 public Enumeration<LinkageType> fromType(PrimitiveType<?> code) throws FHIRException { 139 if (code == null) 140 return null; 141 if (code.isEmpty()) 142 return new Enumeration<LinkageType>(this, LinkageType.NULL, code); 143 String codeString = ((PrimitiveType) code).asStringValue(); 144 if (codeString == null || "".equals(codeString)) 145 return new Enumeration<LinkageType>(this, LinkageType.NULL, code); 146 if ("source".equals(codeString)) 147 return new Enumeration<LinkageType>(this, LinkageType.SOURCE, code); 148 if ("alternate".equals(codeString)) 149 return new Enumeration<LinkageType>(this, LinkageType.ALTERNATE, code); 150 if ("historical".equals(codeString)) 151 return new Enumeration<LinkageType>(this, LinkageType.HISTORICAL, code); 152 throw new FHIRException("Unknown LinkageType code '"+codeString+"'"); 153 } 154 public String toCode(LinkageType code) { 155 if (code == LinkageType.SOURCE) 156 return "source"; 157 if (code == LinkageType.ALTERNATE) 158 return "alternate"; 159 if (code == LinkageType.HISTORICAL) 160 return "historical"; 161 return "?"; 162 } 163 public String toSystem(LinkageType code) { 164 return code.getSystem(); 165 } 166 } 167 168 @Block() 169 public static class LinkageItemComponent extends BackboneElement implements IBaseBackboneElement { 170 /** 171 * Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 172 */ 173 @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 174 @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." ) 175 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/linkage-type") 176 protected Enumeration<LinkageType> type; 177 178 /** 179 * The resource instance being linked as part of the group. 180 */ 181 @Child(name = "resource", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true) 182 @Description(shortDefinition="Resource being linked", formalDefinition="The resource instance being linked as part of the group." ) 183 protected Reference resource; 184 185 private static final long serialVersionUID = 527428511L; 186 187 /** 188 * Constructor 189 */ 190 public LinkageItemComponent() { 191 super(); 192 } 193 194 /** 195 * Constructor 196 */ 197 public LinkageItemComponent(LinkageType type, Reference resource) { 198 super(); 199 this.setType(type); 200 this.setResource(resource); 201 } 202 203 /** 204 * @return {@link #type} (Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 205 */ 206 public Enumeration<LinkageType> getTypeElement() { 207 if (this.type == null) 208 if (Configuration.errorOnAutoCreate()) 209 throw new Error("Attempt to auto-create LinkageItemComponent.type"); 210 else if (Configuration.doAutoCreate()) 211 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); // bb 212 return this.type; 213 } 214 215 public boolean hasTypeElement() { 216 return this.type != null && !this.type.isEmpty(); 217 } 218 219 public boolean hasType() { 220 return this.type != null && !this.type.isEmpty(); 221 } 222 223 /** 224 * @param value {@link #type} (Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 225 */ 226 public LinkageItemComponent setTypeElement(Enumeration<LinkageType> value) { 227 this.type = value; 228 return this; 229 } 230 231 /** 232 * @return Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 233 */ 234 public LinkageType getType() { 235 return this.type == null ? null : this.type.getValue(); 236 } 237 238 /** 239 * @param value Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 240 */ 241 public LinkageItemComponent setType(LinkageType value) { 242 if (this.type == null) 243 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); 244 this.type.setValue(value); 245 return this; 246 } 247 248 /** 249 * @return {@link #resource} (The resource instance being linked as part of the group.) 250 */ 251 public Reference getResource() { 252 if (this.resource == null) 253 if (Configuration.errorOnAutoCreate()) 254 throw new Error("Attempt to auto-create LinkageItemComponent.resource"); 255 else if (Configuration.doAutoCreate()) 256 this.resource = new Reference(); // cc 257 return this.resource; 258 } 259 260 public boolean hasResource() { 261 return this.resource != null && !this.resource.isEmpty(); 262 } 263 264 /** 265 * @param value {@link #resource} (The resource instance being linked as part of the group.) 266 */ 267 public LinkageItemComponent setResource(Reference value) { 268 this.resource = value; 269 return this; 270 } 271 272 protected void listChildren(List<Property> children) { 273 super.listChildren(children); 274 children.add(new Property("type", "code", "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 0, 1, type)); 275 children.add(new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource)); 276 } 277 278 @Override 279 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 280 switch (_hash) { 281 case 3575610: /*type*/ return new Property("type", "code", "Distinguishes which item is \"source of truth\" (if any) and which items are no longer considered to be current representations.", 0, 1, type); 282 case -341064690: /*resource*/ return new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource); 283 default: return super.getNamedProperty(_hash, _name, _checkValid); 284 } 285 286 } 287 288 @Override 289 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 290 switch (hash) { 291 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<LinkageType> 292 case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference 293 default: return super.getProperty(hash, name, checkValid); 294 } 295 296 } 297 298 @Override 299 public Base setProperty(int hash, String name, Base value) throws FHIRException { 300 switch (hash) { 301 case 3575610: // type 302 value = new LinkageTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 303 this.type = (Enumeration) value; // Enumeration<LinkageType> 304 return value; 305 case -341064690: // resource 306 this.resource = TypeConvertor.castToReference(value); // Reference 307 return value; 308 default: return super.setProperty(hash, name, value); 309 } 310 311 } 312 313 @Override 314 public Base setProperty(String name, Base value) throws FHIRException { 315 if (name.equals("type")) { 316 value = new LinkageTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 317 this.type = (Enumeration) value; // Enumeration<LinkageType> 318 } else if (name.equals("resource")) { 319 this.resource = TypeConvertor.castToReference(value); // Reference 320 } else 321 return super.setProperty(name, value); 322 return value; 323 } 324 325 @Override 326 public void removeChild(String name, Base value) throws FHIRException { 327 if (name.equals("type")) { 328 value = new LinkageTypeEnumFactory().fromType(TypeConvertor.castToCode(value)); 329 this.type = (Enumeration) value; // Enumeration<LinkageType> 330 } else if (name.equals("resource")) { 331 this.resource = null; 332 } else 333 super.removeChild(name, value); 334 335 } 336 337 @Override 338 public Base makeProperty(int hash, String name) throws FHIRException { 339 switch (hash) { 340 case 3575610: return getTypeElement(); 341 case -341064690: return getResource(); 342 default: return super.makeProperty(hash, name); 343 } 344 345 } 346 347 @Override 348 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 349 switch (hash) { 350 case 3575610: /*type*/ return new String[] {"code"}; 351 case -341064690: /*resource*/ return new String[] {"Reference"}; 352 default: return super.getTypesForProperty(hash, name); 353 } 354 355 } 356 357 @Override 358 public Base addChild(String name) throws FHIRException { 359 if (name.equals("type")) { 360 throw new FHIRException("Cannot call addChild on a singleton property Linkage.item.type"); 361 } 362 else if (name.equals("resource")) { 363 this.resource = new Reference(); 364 return this.resource; 365 } 366 else 367 return super.addChild(name); 368 } 369 370 public LinkageItemComponent copy() { 371 LinkageItemComponent dst = new LinkageItemComponent(); 372 copyValues(dst); 373 return dst; 374 } 375 376 public void copyValues(LinkageItemComponent dst) { 377 super.copyValues(dst); 378 dst.type = type == null ? null : type.copy(); 379 dst.resource = resource == null ? null : resource.copy(); 380 } 381 382 @Override 383 public boolean equalsDeep(Base other_) { 384 if (!super.equalsDeep(other_)) 385 return false; 386 if (!(other_ instanceof LinkageItemComponent)) 387 return false; 388 LinkageItemComponent o = (LinkageItemComponent) other_; 389 return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true); 390 } 391 392 @Override 393 public boolean equalsShallow(Base other_) { 394 if (!super.equalsShallow(other_)) 395 return false; 396 if (!(other_ instanceof LinkageItemComponent)) 397 return false; 398 LinkageItemComponent o = (LinkageItemComponent) other_; 399 return compareValues(type, o.type, true); 400 } 401 402 public boolean isEmpty() { 403 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource); 404 } 405 406 public String fhirType() { 407 return "Linkage.item"; 408 409 } 410 411 } 412 413 /** 414 * Indicates whether the asserted set of linkages are considered to be "in effect". 415 */ 416 @Child(name = "active", type = {BooleanType.class}, order=0, min=0, max=1, modifier=false, summary=true) 417 @Description(shortDefinition="Whether this linkage assertion is active or not", formalDefinition="Indicates whether the asserted set of linkages are considered to be \"in effect\"." ) 418 protected BooleanType active; 419 420 /** 421 * 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. 422 */ 423 @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=1, min=0, max=1, modifier=false, summary=true) 424 @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." ) 425 protected Reference author; 426 427 /** 428 * 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. 429 */ 430 @Child(name = "item", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 431 @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." ) 432 protected List<LinkageItemComponent> item; 433 434 private static final long serialVersionUID = 810520886L; 435 436 /** 437 * Constructor 438 */ 439 public Linkage() { 440 super(); 441 } 442 443 /** 444 * Constructor 445 */ 446 public Linkage(LinkageItemComponent item) { 447 super(); 448 this.addItem(item); 449 } 450 451 /** 452 * @return {@link #active} (Indicates whether the asserted set of linkages are considered to be "in effect".). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 453 */ 454 public BooleanType getActiveElement() { 455 if (this.active == null) 456 if (Configuration.errorOnAutoCreate()) 457 throw new Error("Attempt to auto-create Linkage.active"); 458 else if (Configuration.doAutoCreate()) 459 this.active = new BooleanType(); // bb 460 return this.active; 461 } 462 463 public boolean hasActiveElement() { 464 return this.active != null && !this.active.isEmpty(); 465 } 466 467 public boolean hasActive() { 468 return this.active != null && !this.active.isEmpty(); 469 } 470 471 /** 472 * @param value {@link #active} (Indicates whether the asserted set of linkages are considered to be "in effect".). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 473 */ 474 public Linkage setActiveElement(BooleanType value) { 475 this.active = value; 476 return this; 477 } 478 479 /** 480 * @return Indicates whether the asserted set of linkages are considered to be "in effect". 481 */ 482 public boolean getActive() { 483 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 484 } 485 486 /** 487 * @param value Indicates whether the asserted set of linkages are considered to be "in effect". 488 */ 489 public Linkage setActive(boolean value) { 490 if (this.active == null) 491 this.active = new BooleanType(); 492 this.active.setValue(value); 493 return this; 494 } 495 496 /** 497 * @return {@link #author} (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.) 498 */ 499 public Reference getAuthor() { 500 if (this.author == null) 501 if (Configuration.errorOnAutoCreate()) 502 throw new Error("Attempt to auto-create Linkage.author"); 503 else if (Configuration.doAutoCreate()) 504 this.author = new Reference(); // cc 505 return this.author; 506 } 507 508 public boolean hasAuthor() { 509 return this.author != null && !this.author.isEmpty(); 510 } 511 512 /** 513 * @param value {@link #author} (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.) 514 */ 515 public Linkage setAuthor(Reference value) { 516 this.author = value; 517 return this; 518 } 519 520 /** 521 * @return {@link #item} (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.) 522 */ 523 public List<LinkageItemComponent> getItem() { 524 if (this.item == null) 525 this.item = new ArrayList<LinkageItemComponent>(); 526 return this.item; 527 } 528 529 /** 530 * @return Returns a reference to <code>this</code> for easy method chaining 531 */ 532 public Linkage setItem(List<LinkageItemComponent> theItem) { 533 this.item = theItem; 534 return this; 535 } 536 537 public boolean hasItem() { 538 if (this.item == null) 539 return false; 540 for (LinkageItemComponent item : this.item) 541 if (!item.isEmpty()) 542 return true; 543 return false; 544 } 545 546 public LinkageItemComponent addItem() { //3 547 LinkageItemComponent t = new LinkageItemComponent(); 548 if (this.item == null) 549 this.item = new ArrayList<LinkageItemComponent>(); 550 this.item.add(t); 551 return t; 552 } 553 554 public Linkage addItem(LinkageItemComponent t) { //3 555 if (t == null) 556 return this; 557 if (this.item == null) 558 this.item = new ArrayList<LinkageItemComponent>(); 559 this.item.add(t); 560 return this; 561 } 562 563 /** 564 * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3} 565 */ 566 public LinkageItemComponent getItemFirstRep() { 567 if (getItem().isEmpty()) { 568 addItem(); 569 } 570 return getItem().get(0); 571 } 572 573 protected void listChildren(List<Property> children) { 574 super.listChildren(children); 575 children.add(new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active)); 576 children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", "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.", 0, 1, author)); 577 children.add(new Property("item", "", "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.", 0, java.lang.Integer.MAX_VALUE, item)); 578 } 579 580 @Override 581 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 582 switch (_hash) { 583 case -1422950650: /*active*/ return new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active); 584 case -1406328437: /*author*/ return new Property("author", "Reference(Practitioner|PractitionerRole|Organization)", "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.", 0, 1, author); 585 case 3242771: /*item*/ return new Property("item", "", "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.", 0, java.lang.Integer.MAX_VALUE, item); 586 default: return super.getNamedProperty(_hash, _name, _checkValid); 587 } 588 589 } 590 591 @Override 592 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 593 switch (hash) { 594 case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType 595 case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference 596 case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // LinkageItemComponent 597 default: return super.getProperty(hash, name, checkValid); 598 } 599 600 } 601 602 @Override 603 public Base setProperty(int hash, String name, Base value) throws FHIRException { 604 switch (hash) { 605 case -1422950650: // active 606 this.active = TypeConvertor.castToBoolean(value); // BooleanType 607 return value; 608 case -1406328437: // author 609 this.author = TypeConvertor.castToReference(value); // Reference 610 return value; 611 case 3242771: // item 612 this.getItem().add((LinkageItemComponent) value); // LinkageItemComponent 613 return value; 614 default: return super.setProperty(hash, name, value); 615 } 616 617 } 618 619 @Override 620 public Base setProperty(String name, Base value) throws FHIRException { 621 if (name.equals("active")) { 622 this.active = TypeConvertor.castToBoolean(value); // BooleanType 623 } else if (name.equals("author")) { 624 this.author = TypeConvertor.castToReference(value); // Reference 625 } else if (name.equals("item")) { 626 this.getItem().add((LinkageItemComponent) value); 627 } else 628 return super.setProperty(name, value); 629 return value; 630 } 631 632 @Override 633 public void removeChild(String name, Base value) throws FHIRException { 634 if (name.equals("active")) { 635 this.active = null; 636 } else if (name.equals("author")) { 637 this.author = null; 638 } else if (name.equals("item")) { 639 this.getItem().remove((LinkageItemComponent) value); 640 } else 641 super.removeChild(name, value); 642 643 } 644 645 @Override 646 public Base makeProperty(int hash, String name) throws FHIRException { 647 switch (hash) { 648 case -1422950650: return getActiveElement(); 649 case -1406328437: return getAuthor(); 650 case 3242771: return addItem(); 651 default: return super.makeProperty(hash, name); 652 } 653 654 } 655 656 @Override 657 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 658 switch (hash) { 659 case -1422950650: /*active*/ return new String[] {"boolean"}; 660 case -1406328437: /*author*/ return new String[] {"Reference"}; 661 case 3242771: /*item*/ return new String[] {}; 662 default: return super.getTypesForProperty(hash, name); 663 } 664 665 } 666 667 @Override 668 public Base addChild(String name) throws FHIRException { 669 if (name.equals("active")) { 670 throw new FHIRException("Cannot call addChild on a singleton property Linkage.active"); 671 } 672 else if (name.equals("author")) { 673 this.author = new Reference(); 674 return this.author; 675 } 676 else if (name.equals("item")) { 677 return addItem(); 678 } 679 else 680 return super.addChild(name); 681 } 682 683 public String fhirType() { 684 return "Linkage"; 685 686 } 687 688 public Linkage copy() { 689 Linkage dst = new Linkage(); 690 copyValues(dst); 691 return dst; 692 } 693 694 public void copyValues(Linkage dst) { 695 super.copyValues(dst); 696 dst.active = active == null ? null : active.copy(); 697 dst.author = author == null ? null : author.copy(); 698 if (item != null) { 699 dst.item = new ArrayList<LinkageItemComponent>(); 700 for (LinkageItemComponent i : item) 701 dst.item.add(i.copy()); 702 }; 703 } 704 705 protected Linkage typedCopy() { 706 return copy(); 707 } 708 709 @Override 710 public boolean equalsDeep(Base other_) { 711 if (!super.equalsDeep(other_)) 712 return false; 713 if (!(other_ instanceof Linkage)) 714 return false; 715 Linkage o = (Linkage) other_; 716 return compareDeep(active, o.active, true) && compareDeep(author, o.author, true) && compareDeep(item, o.item, true) 717 ; 718 } 719 720 @Override 721 public boolean equalsShallow(Base other_) { 722 if (!super.equalsShallow(other_)) 723 return false; 724 if (!(other_ instanceof Linkage)) 725 return false; 726 Linkage o = (Linkage) other_; 727 return compareValues(active, o.active, true); 728 } 729 730 public boolean isEmpty() { 731 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(active, author, item); 732 } 733 734 @Override 735 public ResourceType getResourceType() { 736 return ResourceType.Linkage; 737 } 738 739 /** 740 * Search parameter: <b>author</b> 741 * <p> 742 * Description: <b>Author of the Linkage</b><br> 743 * Type: <b>reference</b><br> 744 * Path: <b>Linkage.author</b><br> 745 * </p> 746 */ 747 @SearchParamDefinition(name="author", path="Linkage.author", description="Author of the Linkage", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } ) 748 public static final String SP_AUTHOR = "author"; 749 /** 750 * <b>Fluent Client</b> search parameter constant for <b>author</b> 751 * <p> 752 * Description: <b>Author of the Linkage</b><br> 753 * Type: <b>reference</b><br> 754 * Path: <b>Linkage.author</b><br> 755 * </p> 756 */ 757 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR); 758 759/** 760 * Constant for fluent queries to be used to add include statements. Specifies 761 * the path value of "<b>Linkage:author</b>". 762 */ 763 public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Linkage:author").toLocked(); 764 765 /** 766 * Search parameter: <b>item</b> 767 * <p> 768 * Description: <b>Matches on any item in the Linkage</b><br> 769 * Type: <b>reference</b><br> 770 * Path: <b>Linkage.item.resource</b><br> 771 * </p> 772 */ 773 @SearchParamDefinition(name="item", path="Linkage.item.resource", description="Matches on any item in the Linkage", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BiologicallyDerivedProductDispense.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceAssociation.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentReference.class, Encounter.class, EncounterHistory.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryItem.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Parameters.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestPlan.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } ) 774 public static final String SP_ITEM = "item"; 775 /** 776 * <b>Fluent Client</b> search parameter constant for <b>item</b> 777 * <p> 778 * Description: <b>Matches on any item in the Linkage</b><br> 779 * Type: <b>reference</b><br> 780 * Path: <b>Linkage.item.resource</b><br> 781 * </p> 782 */ 783 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM); 784 785/** 786 * Constant for fluent queries to be used to add include statements. Specifies 787 * the path value of "<b>Linkage:item</b>". 788 */ 789 public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("Linkage:item").toLocked(); 790 791 /** 792 * Search parameter: <b>source</b> 793 * <p> 794 * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br> 795 * Type: <b>reference</b><br> 796 * Path: <b>Linkage.item.resource</b><br> 797 * </p> 798 */ 799 @SearchParamDefinition(name="source", path="Linkage.item.resource", description="Matches on any item in the Linkage with a type of 'source'", type="reference", target={Account.class, ActivityDefinition.class, ActorDefinition.class, AdministrableProductDefinition.class, AdverseEvent.class, AllergyIntolerance.class, Appointment.class, AppointmentResponse.class, ArtifactAssessment.class, AuditEvent.class, Basic.class, Binary.class, BiologicallyDerivedProduct.class, BiologicallyDerivedProductDispense.class, BodyStructure.class, Bundle.class, CapabilityStatement.class, CarePlan.class, CareTeam.class, ChargeItem.class, ChargeItemDefinition.class, Citation.class, Claim.class, ClaimResponse.class, ClinicalImpression.class, ClinicalUseDefinition.class, CodeSystem.class, Communication.class, CommunicationRequest.class, CompartmentDefinition.class, Composition.class, ConceptMap.class, Condition.class, ConditionDefinition.class, Consent.class, Contract.class, Coverage.class, CoverageEligibilityRequest.class, CoverageEligibilityResponse.class, DetectedIssue.class, Device.class, DeviceAssociation.class, DeviceDefinition.class, DeviceDispense.class, DeviceMetric.class, DeviceRequest.class, DeviceUsage.class, DiagnosticReport.class, DocumentReference.class, Encounter.class, EncounterHistory.class, Endpoint.class, EnrollmentRequest.class, EnrollmentResponse.class, EpisodeOfCare.class, EventDefinition.class, Evidence.class, EvidenceReport.class, EvidenceVariable.class, ExampleScenario.class, ExplanationOfBenefit.class, FamilyMemberHistory.class, Flag.class, FormularyItem.class, GenomicStudy.class, Goal.class, GraphDefinition.class, Group.class, GuidanceResponse.class, HealthcareService.class, ImagingSelection.class, ImagingStudy.class, Immunization.class, ImmunizationEvaluation.class, ImmunizationRecommendation.class, ImplementationGuide.class, Ingredient.class, InsurancePlan.class, InventoryItem.class, InventoryReport.class, Invoice.class, Library.class, Linkage.class, ListResource.class, Location.class, ManufacturedItemDefinition.class, Measure.class, MeasureReport.class, Medication.class, MedicationAdministration.class, MedicationDispense.class, MedicationKnowledge.class, MedicationRequest.class, MedicationStatement.class, MedicinalProductDefinition.class, MessageDefinition.class, MessageHeader.class, MolecularSequence.class, NamingSystem.class, NutritionIntake.class, NutritionOrder.class, NutritionProduct.class, Observation.class, ObservationDefinition.class, OperationDefinition.class, OperationOutcome.class, Organization.class, OrganizationAffiliation.class, PackagedProductDefinition.class, Parameters.class, Patient.class, PaymentNotice.class, PaymentReconciliation.class, Permission.class, Person.class, PlanDefinition.class, Practitioner.class, PractitionerRole.class, Procedure.class, Provenance.class, Questionnaire.class, QuestionnaireResponse.class, RegulatedAuthorization.class, RelatedPerson.class, RequestOrchestration.class, Requirements.class, ResearchStudy.class, ResearchSubject.class, RiskAssessment.class, Schedule.class, SearchParameter.class, ServiceRequest.class, Slot.class, Specimen.class, SpecimenDefinition.class, StructureDefinition.class, StructureMap.class, Subscription.class, SubscriptionStatus.class, SubscriptionTopic.class, Substance.class, SubstanceDefinition.class, SubstanceNucleicAcid.class, SubstancePolymer.class, SubstanceProtein.class, SubstanceReferenceInformation.class, SubstanceSourceMaterial.class, SupplyDelivery.class, SupplyRequest.class, Task.class, TerminologyCapabilities.class, TestPlan.class, TestReport.class, TestScript.class, Transport.class, ValueSet.class, VerificationResult.class, VisionPrescription.class } ) 800 public static final String SP_SOURCE = "source"; 801 /** 802 * <b>Fluent Client</b> search parameter constant for <b>source</b> 803 * <p> 804 * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br> 805 * Type: <b>reference</b><br> 806 * Path: <b>Linkage.item.resource</b><br> 807 * </p> 808 */ 809 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE); 810 811/** 812 * Constant for fluent queries to be used to add include statements. Specifies 813 * the path value of "<b>Linkage:source</b>". 814 */ 815 public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("Linkage:source").toLocked(); 816 817 818} 819