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