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