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