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