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 default: return "?"; 091 } 092 } 093 public String getSystem() { 094 switch (this) { 095 case SOURCE: return "http://hl7.org/fhir/linkage-type"; 096 case ALTERNATE: return "http://hl7.org/fhir/linkage-type"; 097 case HISTORICAL: return "http://hl7.org/fhir/linkage-type"; 098 default: return "?"; 099 } 100 } 101 public String getDefinition() { 102 switch (this) { 103 case SOURCE: return "The resource represents the \"source of truth\" (from the perspective of this Linkage resource) for the underlying event/condition/etc."; 104 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."; 105 case HISTORICAL: return "The resource represents an obsolete record of the underlying event/condition/etc. It is not expected to be actively maintained."; 106 default: return "?"; 107 } 108 } 109 public String getDisplay() { 110 switch (this) { 111 case SOURCE: return "Source of Truth"; 112 case ALTERNATE: return "Alternate Record"; 113 case HISTORICAL: return "Historical/Obsolete Record"; 114 default: return "?"; 115 } 116 } 117 } 118 119 public static class LinkageTypeEnumFactory implements EnumFactory<LinkageType> { 120 public LinkageType fromCode(String codeString) throws IllegalArgumentException { 121 if (codeString == null || "".equals(codeString)) 122 if (codeString == null || "".equals(codeString)) 123 return null; 124 if ("source".equals(codeString)) 125 return LinkageType.SOURCE; 126 if ("alternate".equals(codeString)) 127 return LinkageType.ALTERNATE; 128 if ("historical".equals(codeString)) 129 return LinkageType.HISTORICAL; 130 throw new IllegalArgumentException("Unknown LinkageType code '"+codeString+"'"); 131 } 132 public Enumeration<LinkageType> fromType(Base code) throws FHIRException { 133 if (code == null) 134 return null; 135 if (code.isEmpty()) 136 return new Enumeration<LinkageType>(this); 137 String codeString = ((PrimitiveType) code).asStringValue(); 138 if (codeString == null || "".equals(codeString)) 139 return null; 140 if ("source".equals(codeString)) 141 return new Enumeration<LinkageType>(this, LinkageType.SOURCE); 142 if ("alternate".equals(codeString)) 143 return new Enumeration<LinkageType>(this, LinkageType.ALTERNATE); 144 if ("historical".equals(codeString)) 145 return new Enumeration<LinkageType>(this, LinkageType.HISTORICAL); 146 throw new FHIRException("Unknown LinkageType code '"+codeString+"'"); 147 } 148 public String toCode(LinkageType code) { 149 if (code == LinkageType.SOURCE) 150 return "source"; 151 if (code == LinkageType.ALTERNATE) 152 return "alternate"; 153 if (code == LinkageType.HISTORICAL) 154 return "historical"; 155 return "?"; 156 } 157 public String toSystem(LinkageType code) { 158 return code.getSystem(); 159 } 160 } 161 162 @Block() 163 public static class LinkageItemComponent extends BackboneElement implements IBaseBackboneElement { 164 /** 165 * Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 166 */ 167 @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 168 @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." ) 169 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/linkage-type") 170 protected Enumeration<LinkageType> type; 171 172 /** 173 * The resource instance being linked as part of the group. 174 */ 175 @Child(name = "resource", type = {Reference.class}, order=2, min=1, max=1, modifier=false, summary=true) 176 @Description(shortDefinition="Resource being linked", formalDefinition="The resource instance being linked as part of the group." ) 177 protected Reference resource; 178 179 /** 180 * The actual object that is the target of the reference (The resource instance being linked as part of the group.) 181 */ 182 protected Resource resourceTarget; 183 184 private static final long serialVersionUID = -209332008L; 185 186 /** 187 * Constructor 188 */ 189 public LinkageItemComponent() { 190 super(); 191 } 192 193 /** 194 * Constructor 195 */ 196 public LinkageItemComponent(Enumeration<LinkageType> type, Reference resource) { 197 super(); 198 this.type = type; 199 this.resource = resource; 200 } 201 202 /** 203 * @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 204 */ 205 public Enumeration<LinkageType> getTypeElement() { 206 if (this.type == null) 207 if (Configuration.errorOnAutoCreate()) 208 throw new Error("Attempt to auto-create LinkageItemComponent.type"); 209 else if (Configuration.doAutoCreate()) 210 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); // bb 211 return this.type; 212 } 213 214 public boolean hasTypeElement() { 215 return this.type != null && !this.type.isEmpty(); 216 } 217 218 public boolean hasType() { 219 return this.type != null && !this.type.isEmpty(); 220 } 221 222 /** 223 * @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 224 */ 225 public LinkageItemComponent setTypeElement(Enumeration<LinkageType> value) { 226 this.type = value; 227 return this; 228 } 229 230 /** 231 * @return Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 232 */ 233 public LinkageType getType() { 234 return this.type == null ? null : this.type.getValue(); 235 } 236 237 /** 238 * @param value Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations. 239 */ 240 public LinkageItemComponent setType(LinkageType value) { 241 if (this.type == null) 242 this.type = new Enumeration<LinkageType>(new LinkageTypeEnumFactory()); 243 this.type.setValue(value); 244 return this; 245 } 246 247 /** 248 * @return {@link #resource} (The resource instance being linked as part of the group.) 249 */ 250 public Reference getResource() { 251 if (this.resource == null) 252 if (Configuration.errorOnAutoCreate()) 253 throw new Error("Attempt to auto-create LinkageItemComponent.resource"); 254 else if (Configuration.doAutoCreate()) 255 this.resource = new Reference(); // cc 256 return this.resource; 257 } 258 259 public boolean hasResource() { 260 return this.resource != null && !this.resource.isEmpty(); 261 } 262 263 /** 264 * @param value {@link #resource} (The resource instance being linked as part of the group.) 265 */ 266 public LinkageItemComponent setResource(Reference value) { 267 this.resource = value; 268 return this; 269 } 270 271 /** 272 * @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.) 273 */ 274 public Resource getResourceTarget() { 275 return this.resourceTarget; 276 } 277 278 /** 279 * @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.) 280 */ 281 public LinkageItemComponent setResourceTarget(Resource value) { 282 this.resourceTarget = value; 283 return this; 284 } 285 286 protected void listChildren(List<Property> children) { 287 super.listChildren(children); 288 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)); 289 children.add(new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource)); 290 } 291 292 @Override 293 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 294 switch (_hash) { 295 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); 296 case -341064690: /*resource*/ return new Property("resource", "Reference(Any)", "The resource instance being linked as part of the group.", 0, 1, resource); 297 default: return super.getNamedProperty(_hash, _name, _checkValid); 298 } 299 300 } 301 302 @Override 303 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 304 switch (hash) { 305 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<LinkageType> 306 case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference 307 default: return super.getProperty(hash, name, checkValid); 308 } 309 310 } 311 312 @Override 313 public Base setProperty(int hash, String name, Base value) throws FHIRException { 314 switch (hash) { 315 case 3575610: // type 316 value = new LinkageTypeEnumFactory().fromType(castToCode(value)); 317 this.type = (Enumeration) value; // Enumeration<LinkageType> 318 return value; 319 case -341064690: // resource 320 this.resource = castToReference(value); // Reference 321 return value; 322 default: return super.setProperty(hash, name, value); 323 } 324 325 } 326 327 @Override 328 public Base setProperty(String name, Base value) throws FHIRException { 329 if (name.equals("type")) { 330 value = new LinkageTypeEnumFactory().fromType(castToCode(value)); 331 this.type = (Enumeration) value; // Enumeration<LinkageType> 332 } else if (name.equals("resource")) { 333 this.resource = castToReference(value); // Reference 334 } else 335 return super.setProperty(name, value); 336 return value; 337 } 338 339 @Override 340 public Base makeProperty(int hash, String name) throws FHIRException { 341 switch (hash) { 342 case 3575610: return getTypeElement(); 343 case -341064690: return getResource(); 344 default: return super.makeProperty(hash, name); 345 } 346 347 } 348 349 @Override 350 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 351 switch (hash) { 352 case 3575610: /*type*/ return new String[] {"code"}; 353 case -341064690: /*resource*/ return new String[] {"Reference"}; 354 default: return super.getTypesForProperty(hash, name); 355 } 356 357 } 358 359 @Override 360 public Base addChild(String name) throws FHIRException { 361 if (name.equals("type")) { 362 throw new FHIRException("Cannot call addChild on a primitive type Linkage.type"); 363 } 364 else if (name.equals("resource")) { 365 this.resource = new Reference(); 366 return this.resource; 367 } 368 else 369 return super.addChild(name); 370 } 371 372 public LinkageItemComponent copy() { 373 LinkageItemComponent dst = new LinkageItemComponent(); 374 copyValues(dst); 375 return dst; 376 } 377 378 public void copyValues(LinkageItemComponent dst) { 379 super.copyValues(dst); 380 dst.type = type == null ? null : type.copy(); 381 dst.resource = resource == null ? null : resource.copy(); 382 } 383 384 @Override 385 public boolean equalsDeep(Base other_) { 386 if (!super.equalsDeep(other_)) 387 return false; 388 if (!(other_ instanceof LinkageItemComponent)) 389 return false; 390 LinkageItemComponent o = (LinkageItemComponent) other_; 391 return compareDeep(type, o.type, true) && compareDeep(resource, o.resource, true); 392 } 393 394 @Override 395 public boolean equalsShallow(Base other_) { 396 if (!super.equalsShallow(other_)) 397 return false; 398 if (!(other_ instanceof LinkageItemComponent)) 399 return false; 400 LinkageItemComponent o = (LinkageItemComponent) other_; 401 return compareValues(type, o.type, true); 402 } 403 404 public boolean isEmpty() { 405 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, resource); 406 } 407 408 public String fhirType() { 409 return "Linkage.item"; 410 411 } 412 413 } 414 415 /** 416 * Indicates whether the asserted set of linkages are considered to be "in effect". 417 */ 418 @Child(name = "active", type = {BooleanType.class}, order=0, min=0, max=1, modifier=false, summary=true) 419 @Description(shortDefinition="Whether this linkage assertion is active or not", formalDefinition="Indicates whether the asserted set of linkages are considered to be \"in effect\"." ) 420 protected BooleanType active; 421 422 /** 423 * 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. 424 */ 425 @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=1, min=0, max=1, modifier=false, summary=true) 426 @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." ) 427 protected Reference author; 428 429 /** 430 * 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.) 431 */ 432 protected Resource authorTarget; 433 434 /** 435 * 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. 436 */ 437 @Child(name = "item", type = {}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 438 @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." ) 439 protected List<LinkageItemComponent> item; 440 441 private static final long serialVersionUID = 25900306L; 442 443 /** 444 * Constructor 445 */ 446 public Linkage() { 447 super(); 448 } 449 450 /** 451 * @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 452 */ 453 public BooleanType getActiveElement() { 454 if (this.active == null) 455 if (Configuration.errorOnAutoCreate()) 456 throw new Error("Attempt to auto-create Linkage.active"); 457 else if (Configuration.doAutoCreate()) 458 this.active = new BooleanType(); // bb 459 return this.active; 460 } 461 462 public boolean hasActiveElement() { 463 return this.active != null && !this.active.isEmpty(); 464 } 465 466 public boolean hasActive() { 467 return this.active != null && !this.active.isEmpty(); 468 } 469 470 /** 471 * @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 472 */ 473 public Linkage setActiveElement(BooleanType value) { 474 this.active = value; 475 return this; 476 } 477 478 /** 479 * @return Indicates whether the asserted set of linkages are considered to be "in effect". 480 */ 481 public boolean getActive() { 482 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 483 } 484 485 /** 486 * @param value Indicates whether the asserted set of linkages are considered to be "in effect". 487 */ 488 public Linkage setActive(boolean value) { 489 if (this.active == null) 490 this.active = new BooleanType(); 491 this.active.setValue(value); 492 return this; 493 } 494 495 /** 496 * @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.) 497 */ 498 public Reference getAuthor() { 499 if (this.author == null) 500 if (Configuration.errorOnAutoCreate()) 501 throw new Error("Attempt to auto-create Linkage.author"); 502 else if (Configuration.doAutoCreate()) 503 this.author = new Reference(); // cc 504 return this.author; 505 } 506 507 public boolean hasAuthor() { 508 return this.author != null && !this.author.isEmpty(); 509 } 510 511 /** 512 * @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.) 513 */ 514 public Linkage setAuthor(Reference value) { 515 this.author = value; 516 return this; 517 } 518 519 /** 520 * @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.) 521 */ 522 public Resource getAuthorTarget() { 523 return this.authorTarget; 524 } 525 526 /** 527 * @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.) 528 */ 529 public Linkage setAuthorTarget(Resource value) { 530 this.authorTarget = value; 531 return this; 532 } 533 534 /** 535 * @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.) 536 */ 537 public List<LinkageItemComponent> getItem() { 538 if (this.item == null) 539 this.item = new ArrayList<LinkageItemComponent>(); 540 return this.item; 541 } 542 543 /** 544 * @return Returns a reference to <code>this</code> for easy method chaining 545 */ 546 public Linkage setItem(List<LinkageItemComponent> theItem) { 547 this.item = theItem; 548 return this; 549 } 550 551 public boolean hasItem() { 552 if (this.item == null) 553 return false; 554 for (LinkageItemComponent item : this.item) 555 if (!item.isEmpty()) 556 return true; 557 return false; 558 } 559 560 public LinkageItemComponent addItem() { //3 561 LinkageItemComponent t = new LinkageItemComponent(); 562 if (this.item == null) 563 this.item = new ArrayList<LinkageItemComponent>(); 564 this.item.add(t); 565 return t; 566 } 567 568 public Linkage addItem(LinkageItemComponent t) { //3 569 if (t == null) 570 return this; 571 if (this.item == null) 572 this.item = new ArrayList<LinkageItemComponent>(); 573 this.item.add(t); 574 return this; 575 } 576 577 /** 578 * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist 579 */ 580 public LinkageItemComponent getItemFirstRep() { 581 if (getItem().isEmpty()) { 582 addItem(); 583 } 584 return getItem().get(0); 585 } 586 587 protected void listChildren(List<Property> children) { 588 super.listChildren(children); 589 children.add(new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active)); 590 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)); 591 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)); 592 } 593 594 @Override 595 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 596 switch (_hash) { 597 case -1422950650: /*active*/ return new Property("active", "boolean", "Indicates whether the asserted set of linkages are considered to be \"in effect\".", 0, 1, active); 598 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); 599 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); 600 default: return super.getNamedProperty(_hash, _name, _checkValid); 601 } 602 603 } 604 605 @Override 606 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 607 switch (hash) { 608 case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType 609 case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference 610 case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // LinkageItemComponent 611 default: return super.getProperty(hash, name, checkValid); 612 } 613 614 } 615 616 @Override 617 public Base setProperty(int hash, String name, Base value) throws FHIRException { 618 switch (hash) { 619 case -1422950650: // active 620 this.active = castToBoolean(value); // BooleanType 621 return value; 622 case -1406328437: // author 623 this.author = castToReference(value); // Reference 624 return value; 625 case 3242771: // item 626 this.getItem().add((LinkageItemComponent) value); // LinkageItemComponent 627 return value; 628 default: return super.setProperty(hash, name, value); 629 } 630 631 } 632 633 @Override 634 public Base setProperty(String name, Base value) throws FHIRException { 635 if (name.equals("active")) { 636 this.active = castToBoolean(value); // BooleanType 637 } else if (name.equals("author")) { 638 this.author = castToReference(value); // Reference 639 } else if (name.equals("item")) { 640 this.getItem().add((LinkageItemComponent) value); 641 } else 642 return super.setProperty(name, value); 643 return value; 644 } 645 646 @Override 647 public Base makeProperty(int hash, String name) throws FHIRException { 648 switch (hash) { 649 case -1422950650: return getActiveElement(); 650 case -1406328437: return getAuthor(); 651 case 3242771: return addItem(); 652 default: return super.makeProperty(hash, name); 653 } 654 655 } 656 657 @Override 658 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 659 switch (hash) { 660 case -1422950650: /*active*/ return new String[] {"boolean"}; 661 case -1406328437: /*author*/ return new String[] {"Reference"}; 662 case 3242771: /*item*/ return new String[] {}; 663 default: return super.getTypesForProperty(hash, name); 664 } 665 666 } 667 668 @Override 669 public Base addChild(String name) throws FHIRException { 670 if (name.equals("active")) { 671 throw new FHIRException("Cannot call addChild on a primitive type Linkage.active"); 672 } 673 else if (name.equals("author")) { 674 this.author = new Reference(); 675 return this.author; 676 } 677 else if (name.equals("item")) { 678 return addItem(); 679 } 680 else 681 return super.addChild(name); 682 } 683 684 public String fhirType() { 685 return "Linkage"; 686 687 } 688 689 public Linkage copy() { 690 Linkage dst = new Linkage(); 691 copyValues(dst); 692 return dst; 693 } 694 695 public void copyValues(Linkage dst) { 696 super.copyValues(dst); 697 dst.active = active == null ? null : active.copy(); 698 dst.author = author == null ? null : author.copy(); 699 if (item != null) { 700 dst.item = new ArrayList<LinkageItemComponent>(); 701 for (LinkageItemComponent i : item) 702 dst.item.add(i.copy()); 703 }; 704 } 705 706 protected Linkage typedCopy() { 707 return copy(); 708 } 709 710 @Override 711 public boolean equalsDeep(Base other_) { 712 if (!super.equalsDeep(other_)) 713 return false; 714 if (!(other_ instanceof Linkage)) 715 return false; 716 Linkage o = (Linkage) other_; 717 return compareDeep(active, o.active, true) && compareDeep(author, o.author, true) && compareDeep(item, o.item, true) 718 ; 719 } 720 721 @Override 722 public boolean equalsShallow(Base other_) { 723 if (!super.equalsShallow(other_)) 724 return false; 725 if (!(other_ instanceof Linkage)) 726 return false; 727 Linkage o = (Linkage) other_; 728 return compareValues(active, o.active, true); 729 } 730 731 public boolean isEmpty() { 732 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(active, author, item); 733 } 734 735 @Override 736 public ResourceType getResourceType() { 737 return ResourceType.Linkage; 738 } 739 740 /** 741 * Search parameter: <b>item</b> 742 * <p> 743 * Description: <b>Matches on any item in the Linkage</b><br> 744 * Type: <b>reference</b><br> 745 * Path: <b>Linkage.item.resource</b><br> 746 * </p> 747 */ 748 @SearchParamDefinition(name="item", path="Linkage.item.resource", description="Matches on any item in the Linkage", type="reference" ) 749 public static final String SP_ITEM = "item"; 750 /** 751 * <b>Fluent Client</b> search parameter constant for <b>item</b> 752 * <p> 753 * Description: <b>Matches on any item in the Linkage</b><br> 754 * Type: <b>reference</b><br> 755 * Path: <b>Linkage.item.resource</b><br> 756 * </p> 757 */ 758 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM); 759 760/** 761 * Constant for fluent queries to be used to add include statements. Specifies 762 * the path value of "<b>Linkage:item</b>". 763 */ 764 public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("Linkage:item").toLocked(); 765 766 /** 767 * Search parameter: <b>author</b> 768 * <p> 769 * Description: <b>Author of the Linkage</b><br> 770 * Type: <b>reference</b><br> 771 * Path: <b>Linkage.author</b><br> 772 * </p> 773 */ 774 @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 } ) 775 public static final String SP_AUTHOR = "author"; 776 /** 777 * <b>Fluent Client</b> search parameter constant for <b>author</b> 778 * <p> 779 * Description: <b>Author of the Linkage</b><br> 780 * Type: <b>reference</b><br> 781 * Path: <b>Linkage.author</b><br> 782 * </p> 783 */ 784 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR); 785 786/** 787 * Constant for fluent queries to be used to add include statements. Specifies 788 * the path value of "<b>Linkage:author</b>". 789 */ 790 public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Linkage:author").toLocked(); 791 792 /** 793 * Search parameter: <b>source</b> 794 * <p> 795 * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br> 796 * Type: <b>reference</b><br> 797 * Path: <b>Linkage.item.resource</b><br> 798 * </p> 799 */ 800 @SearchParamDefinition(name="source", path="Linkage.item.resource", description="Matches on any item in the Linkage with a type of 'source'", type="reference" ) 801 public static final String SP_SOURCE = "source"; 802 /** 803 * <b>Fluent Client</b> search parameter constant for <b>source</b> 804 * <p> 805 * Description: <b>Matches on any item in the Linkage with a type of 'source'</b><br> 806 * Type: <b>reference</b><br> 807 * Path: <b>Linkage.item.resource</b><br> 808 * </p> 809 */ 810 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE); 811 812/** 813 * Constant for fluent queries to be used to add include statements. Specifies 814 * the path value of "<b>Linkage:source</b>". 815 */ 816 public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("Linkage:source").toLocked(); 817 818 819}