001package org.hl7.fhir.dstu3.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization. 047 */ 048@ResourceDef(name="Group", profile="http://hl7.org/fhir/Profile/Group") 049public class Group extends DomainResource { 050 051 public enum GroupType { 052 /** 053 * Group contains "person" Patient resources 054 */ 055 PERSON, 056 /** 057 * Group contains "animal" Patient resources 058 */ 059 ANIMAL, 060 /** 061 * Group contains healthcare practitioner resources 062 */ 063 PRACTITIONER, 064 /** 065 * Group contains Device resources 066 */ 067 DEVICE, 068 /** 069 * Group contains Medication resources 070 */ 071 MEDICATION, 072 /** 073 * Group contains Substance resources 074 */ 075 SUBSTANCE, 076 /** 077 * added to help the parsers with the generic types 078 */ 079 NULL; 080 public static GroupType fromCode(String codeString) throws FHIRException { 081 if (codeString == null || "".equals(codeString)) 082 return null; 083 if ("person".equals(codeString)) 084 return PERSON; 085 if ("animal".equals(codeString)) 086 return ANIMAL; 087 if ("practitioner".equals(codeString)) 088 return PRACTITIONER; 089 if ("device".equals(codeString)) 090 return DEVICE; 091 if ("medication".equals(codeString)) 092 return MEDICATION; 093 if ("substance".equals(codeString)) 094 return SUBSTANCE; 095 if (Configuration.isAcceptInvalidEnums()) 096 return null; 097 else 098 throw new FHIRException("Unknown GroupType code '"+codeString+"'"); 099 } 100 public String toCode() { 101 switch (this) { 102 case PERSON: return "person"; 103 case ANIMAL: return "animal"; 104 case PRACTITIONER: return "practitioner"; 105 case DEVICE: return "device"; 106 case MEDICATION: return "medication"; 107 case SUBSTANCE: return "substance"; 108 default: return "?"; 109 } 110 } 111 public String getSystem() { 112 switch (this) { 113 case PERSON: return "http://hl7.org/fhir/group-type"; 114 case ANIMAL: return "http://hl7.org/fhir/group-type"; 115 case PRACTITIONER: return "http://hl7.org/fhir/group-type"; 116 case DEVICE: return "http://hl7.org/fhir/group-type"; 117 case MEDICATION: return "http://hl7.org/fhir/group-type"; 118 case SUBSTANCE: return "http://hl7.org/fhir/group-type"; 119 default: return "?"; 120 } 121 } 122 public String getDefinition() { 123 switch (this) { 124 case PERSON: return "Group contains \"person\" Patient resources"; 125 case ANIMAL: return "Group contains \"animal\" Patient resources"; 126 case PRACTITIONER: return "Group contains healthcare practitioner resources"; 127 case DEVICE: return "Group contains Device resources"; 128 case MEDICATION: return "Group contains Medication resources"; 129 case SUBSTANCE: return "Group contains Substance resources"; 130 default: return "?"; 131 } 132 } 133 public String getDisplay() { 134 switch (this) { 135 case PERSON: return "Person"; 136 case ANIMAL: return "Animal"; 137 case PRACTITIONER: return "Practitioner"; 138 case DEVICE: return "Device"; 139 case MEDICATION: return "Medication"; 140 case SUBSTANCE: return "Substance"; 141 default: return "?"; 142 } 143 } 144 } 145 146 public static class GroupTypeEnumFactory implements EnumFactory<GroupType> { 147 public GroupType fromCode(String codeString) throws IllegalArgumentException { 148 if (codeString == null || "".equals(codeString)) 149 if (codeString == null || "".equals(codeString)) 150 return null; 151 if ("person".equals(codeString)) 152 return GroupType.PERSON; 153 if ("animal".equals(codeString)) 154 return GroupType.ANIMAL; 155 if ("practitioner".equals(codeString)) 156 return GroupType.PRACTITIONER; 157 if ("device".equals(codeString)) 158 return GroupType.DEVICE; 159 if ("medication".equals(codeString)) 160 return GroupType.MEDICATION; 161 if ("substance".equals(codeString)) 162 return GroupType.SUBSTANCE; 163 throw new IllegalArgumentException("Unknown GroupType code '"+codeString+"'"); 164 } 165 public Enumeration<GroupType> fromType(Base code) throws FHIRException { 166 if (code == null) 167 return null; 168 if (code.isEmpty()) 169 return new Enumeration<GroupType>(this); 170 String codeString = ((PrimitiveType) code).asStringValue(); 171 if (codeString == null || "".equals(codeString)) 172 return null; 173 if ("person".equals(codeString)) 174 return new Enumeration<GroupType>(this, GroupType.PERSON); 175 if ("animal".equals(codeString)) 176 return new Enumeration<GroupType>(this, GroupType.ANIMAL); 177 if ("practitioner".equals(codeString)) 178 return new Enumeration<GroupType>(this, GroupType.PRACTITIONER); 179 if ("device".equals(codeString)) 180 return new Enumeration<GroupType>(this, GroupType.DEVICE); 181 if ("medication".equals(codeString)) 182 return new Enumeration<GroupType>(this, GroupType.MEDICATION); 183 if ("substance".equals(codeString)) 184 return new Enumeration<GroupType>(this, GroupType.SUBSTANCE); 185 throw new FHIRException("Unknown GroupType code '"+codeString+"'"); 186 } 187 public String toCode(GroupType code) { 188 if (code == GroupType.PERSON) 189 return "person"; 190 if (code == GroupType.ANIMAL) 191 return "animal"; 192 if (code == GroupType.PRACTITIONER) 193 return "practitioner"; 194 if (code == GroupType.DEVICE) 195 return "device"; 196 if (code == GroupType.MEDICATION) 197 return "medication"; 198 if (code == GroupType.SUBSTANCE) 199 return "substance"; 200 return "?"; 201 } 202 public String toSystem(GroupType code) { 203 return code.getSystem(); 204 } 205 } 206 207 @Block() 208 public static class GroupCharacteristicComponent extends BackboneElement implements IBaseBackboneElement { 209 /** 210 * A code that identifies the kind of trait being asserted. 211 */ 212 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) 213 @Description(shortDefinition="Kind of characteristic", formalDefinition="A code that identifies the kind of trait being asserted." ) 214 protected CodeableConcept code; 215 216 /** 217 * The value of the trait that holds (or does not hold - see 'exclude') for members of the group. 218 */ 219 @Child(name = "value", type = {CodeableConcept.class, BooleanType.class, Quantity.class, Range.class}, order=2, min=1, max=1, modifier=false, summary=false) 220 @Description(shortDefinition="Value held by characteristic", formalDefinition="The value of the trait that holds (or does not hold - see 'exclude') for members of the group." ) 221 protected Type value; 222 223 /** 224 * If true, indicates the characteristic is one that is NOT held by members of the group. 225 */ 226 @Child(name = "exclude", type = {BooleanType.class}, order=3, min=1, max=1, modifier=true, summary=false) 227 @Description(shortDefinition="Group includes or excludes", formalDefinition="If true, indicates the characteristic is one that is NOT held by members of the group." ) 228 protected BooleanType exclude; 229 230 /** 231 * The period over which the characteristic is tested; e.g. the patient had an operation during the month of June. 232 */ 233 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=false) 234 @Description(shortDefinition="Period over which characteristic is tested", formalDefinition="The period over which the characteristic is tested; e.g. the patient had an operation during the month of June." ) 235 protected Period period; 236 237 private static final long serialVersionUID = -1000688967L; 238 239 /** 240 * Constructor 241 */ 242 public GroupCharacteristicComponent() { 243 super(); 244 } 245 246 /** 247 * Constructor 248 */ 249 public GroupCharacteristicComponent(CodeableConcept code, Type value, BooleanType exclude) { 250 super(); 251 this.code = code; 252 this.value = value; 253 this.exclude = exclude; 254 } 255 256 /** 257 * @return {@link #code} (A code that identifies the kind of trait being asserted.) 258 */ 259 public CodeableConcept getCode() { 260 if (this.code == null) 261 if (Configuration.errorOnAutoCreate()) 262 throw new Error("Attempt to auto-create GroupCharacteristicComponent.code"); 263 else if (Configuration.doAutoCreate()) 264 this.code = new CodeableConcept(); // cc 265 return this.code; 266 } 267 268 public boolean hasCode() { 269 return this.code != null && !this.code.isEmpty(); 270 } 271 272 /** 273 * @param value {@link #code} (A code that identifies the kind of trait being asserted.) 274 */ 275 public GroupCharacteristicComponent setCode(CodeableConcept value) { 276 this.code = value; 277 return this; 278 } 279 280 /** 281 * @return {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 282 */ 283 public Type getValue() { 284 return this.value; 285 } 286 287 /** 288 * @return {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 289 */ 290 public CodeableConcept getValueCodeableConcept() throws FHIRException { 291 if (!(this.value instanceof CodeableConcept)) 292 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 293 return (CodeableConcept) this.value; 294 } 295 296 public boolean hasValueCodeableConcept() { 297 return this.value instanceof CodeableConcept; 298 } 299 300 /** 301 * @return {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 302 */ 303 public BooleanType getValueBooleanType() throws FHIRException { 304 if (!(this.value instanceof BooleanType)) 305 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered"); 306 return (BooleanType) this.value; 307 } 308 309 public boolean hasValueBooleanType() { 310 return this.value instanceof BooleanType; 311 } 312 313 /** 314 * @return {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 315 */ 316 public Quantity getValueQuantity() throws FHIRException { 317 if (!(this.value instanceof Quantity)) 318 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 319 return (Quantity) this.value; 320 } 321 322 public boolean hasValueQuantity() { 323 return this.value instanceof Quantity; 324 } 325 326 /** 327 * @return {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 328 */ 329 public Range getValueRange() throws FHIRException { 330 if (!(this.value instanceof Range)) 331 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered"); 332 return (Range) this.value; 333 } 334 335 public boolean hasValueRange() { 336 return this.value instanceof Range; 337 } 338 339 public boolean hasValue() { 340 return this.value != null && !this.value.isEmpty(); 341 } 342 343 /** 344 * @param value {@link #value} (The value of the trait that holds (or does not hold - see 'exclude') for members of the group.) 345 */ 346 public GroupCharacteristicComponent setValue(Type value) { 347 this.value = value; 348 return this; 349 } 350 351 /** 352 * @return {@link #exclude} (If true, indicates the characteristic is one that is NOT held by members of the group.). This is the underlying object with id, value and extensions. The accessor "getExclude" gives direct access to the value 353 */ 354 public BooleanType getExcludeElement() { 355 if (this.exclude == null) 356 if (Configuration.errorOnAutoCreate()) 357 throw new Error("Attempt to auto-create GroupCharacteristicComponent.exclude"); 358 else if (Configuration.doAutoCreate()) 359 this.exclude = new BooleanType(); // bb 360 return this.exclude; 361 } 362 363 public boolean hasExcludeElement() { 364 return this.exclude != null && !this.exclude.isEmpty(); 365 } 366 367 public boolean hasExclude() { 368 return this.exclude != null && !this.exclude.isEmpty(); 369 } 370 371 /** 372 * @param value {@link #exclude} (If true, indicates the characteristic is one that is NOT held by members of the group.). This is the underlying object with id, value and extensions. The accessor "getExclude" gives direct access to the value 373 */ 374 public GroupCharacteristicComponent setExcludeElement(BooleanType value) { 375 this.exclude = value; 376 return this; 377 } 378 379 /** 380 * @return If true, indicates the characteristic is one that is NOT held by members of the group. 381 */ 382 public boolean getExclude() { 383 return this.exclude == null || this.exclude.isEmpty() ? false : this.exclude.getValue(); 384 } 385 386 /** 387 * @param value If true, indicates the characteristic is one that is NOT held by members of the group. 388 */ 389 public GroupCharacteristicComponent setExclude(boolean value) { 390 if (this.exclude == null) 391 this.exclude = new BooleanType(); 392 this.exclude.setValue(value); 393 return this; 394 } 395 396 /** 397 * @return {@link #period} (The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.) 398 */ 399 public Period getPeriod() { 400 if (this.period == null) 401 if (Configuration.errorOnAutoCreate()) 402 throw new Error("Attempt to auto-create GroupCharacteristicComponent.period"); 403 else if (Configuration.doAutoCreate()) 404 this.period = new Period(); // cc 405 return this.period; 406 } 407 408 public boolean hasPeriod() { 409 return this.period != null && !this.period.isEmpty(); 410 } 411 412 /** 413 * @param value {@link #period} (The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.) 414 */ 415 public GroupCharacteristicComponent setPeriod(Period value) { 416 this.period = value; 417 return this; 418 } 419 420 protected void listChildren(List<Property> childrenList) { 421 super.listChildren(childrenList); 422 childrenList.add(new Property("code", "CodeableConcept", "A code that identifies the kind of trait being asserted.", 0, java.lang.Integer.MAX_VALUE, code)); 423 childrenList.add(new Property("value[x]", "CodeableConcept|boolean|Quantity|Range", "The value of the trait that holds (or does not hold - see 'exclude') for members of the group.", 0, java.lang.Integer.MAX_VALUE, value)); 424 childrenList.add(new Property("exclude", "boolean", "If true, indicates the characteristic is one that is NOT held by members of the group.", 0, java.lang.Integer.MAX_VALUE, exclude)); 425 childrenList.add(new Property("period", "Period", "The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.", 0, java.lang.Integer.MAX_VALUE, period)); 426 } 427 428 @Override 429 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 430 switch (hash) { 431 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 432 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type 433 case -1321148966: /*exclude*/ return this.exclude == null ? new Base[0] : new Base[] {this.exclude}; // BooleanType 434 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 435 default: return super.getProperty(hash, name, checkValid); 436 } 437 438 } 439 440 @Override 441 public Base setProperty(int hash, String name, Base value) throws FHIRException { 442 switch (hash) { 443 case 3059181: // code 444 this.code = castToCodeableConcept(value); // CodeableConcept 445 return value; 446 case 111972721: // value 447 this.value = castToType(value); // Type 448 return value; 449 case -1321148966: // exclude 450 this.exclude = castToBoolean(value); // BooleanType 451 return value; 452 case -991726143: // period 453 this.period = castToPeriod(value); // Period 454 return value; 455 default: return super.setProperty(hash, name, value); 456 } 457 458 } 459 460 @Override 461 public Base setProperty(String name, Base value) throws FHIRException { 462 if (name.equals("code")) { 463 this.code = castToCodeableConcept(value); // CodeableConcept 464 } else if (name.equals("value[x]")) { 465 this.value = castToType(value); // Type 466 } else if (name.equals("exclude")) { 467 this.exclude = castToBoolean(value); // BooleanType 468 } else if (name.equals("period")) { 469 this.period = castToPeriod(value); // Period 470 } else 471 return super.setProperty(name, value); 472 return value; 473 } 474 475 @Override 476 public Base makeProperty(int hash, String name) throws FHIRException { 477 switch (hash) { 478 case 3059181: return getCode(); 479 case -1410166417: return getValue(); 480 case 111972721: return getValue(); 481 case -1321148966: return getExcludeElement(); 482 case -991726143: return getPeriod(); 483 default: return super.makeProperty(hash, name); 484 } 485 486 } 487 488 @Override 489 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 490 switch (hash) { 491 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 492 case 111972721: /*value*/ return new String[] {"CodeableConcept", "boolean", "Quantity", "Range"}; 493 case -1321148966: /*exclude*/ return new String[] {"boolean"}; 494 case -991726143: /*period*/ return new String[] {"Period"}; 495 default: return super.getTypesForProperty(hash, name); 496 } 497 498 } 499 500 @Override 501 public Base addChild(String name) throws FHIRException { 502 if (name.equals("code")) { 503 this.code = new CodeableConcept(); 504 return this.code; 505 } 506 else if (name.equals("valueCodeableConcept")) { 507 this.value = new CodeableConcept(); 508 return this.value; 509 } 510 else if (name.equals("valueBoolean")) { 511 this.value = new BooleanType(); 512 return this.value; 513 } 514 else if (name.equals("valueQuantity")) { 515 this.value = new Quantity(); 516 return this.value; 517 } 518 else if (name.equals("valueRange")) { 519 this.value = new Range(); 520 return this.value; 521 } 522 else if (name.equals("exclude")) { 523 throw new FHIRException("Cannot call addChild on a primitive type Group.exclude"); 524 } 525 else if (name.equals("period")) { 526 this.period = new Period(); 527 return this.period; 528 } 529 else 530 return super.addChild(name); 531 } 532 533 public GroupCharacteristicComponent copy() { 534 GroupCharacteristicComponent dst = new GroupCharacteristicComponent(); 535 copyValues(dst); 536 dst.code = code == null ? null : code.copy(); 537 dst.value = value == null ? null : value.copy(); 538 dst.exclude = exclude == null ? null : exclude.copy(); 539 dst.period = period == null ? null : period.copy(); 540 return dst; 541 } 542 543 @Override 544 public boolean equalsDeep(Base other) { 545 if (!super.equalsDeep(other)) 546 return false; 547 if (!(other instanceof GroupCharacteristicComponent)) 548 return false; 549 GroupCharacteristicComponent o = (GroupCharacteristicComponent) other; 550 return compareDeep(code, o.code, true) && compareDeep(value, o.value, true) && compareDeep(exclude, o.exclude, true) 551 && compareDeep(period, o.period, true); 552 } 553 554 @Override 555 public boolean equalsShallow(Base other) { 556 if (!super.equalsShallow(other)) 557 return false; 558 if (!(other instanceof GroupCharacteristicComponent)) 559 return false; 560 GroupCharacteristicComponent o = (GroupCharacteristicComponent) other; 561 return compareValues(exclude, o.exclude, true); 562 } 563 564 public boolean isEmpty() { 565 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value, exclude, period 566 ); 567 } 568 569 public String fhirType() { 570 return "Group.characteristic"; 571 572 } 573 574 } 575 576 @Block() 577 public static class GroupMemberComponent extends BackboneElement implements IBaseBackboneElement { 578 /** 579 * A reference to the entity that is a member of the group. Must be consistent with Group.type. 580 */ 581 @Child(name = "entity", type = {Patient.class, Practitioner.class, Device.class, Medication.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false) 582 @Description(shortDefinition="Reference to the group member", formalDefinition="A reference to the entity that is a member of the group. Must be consistent with Group.type." ) 583 protected Reference entity; 584 585 /** 586 * The actual object that is the target of the reference (A reference to the entity that is a member of the group. Must be consistent with Group.type.) 587 */ 588 protected Resource entityTarget; 589 590 /** 591 * The period that the member was in the group, if known. 592 */ 593 @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=false) 594 @Description(shortDefinition="Period member belonged to the group", formalDefinition="The period that the member was in the group, if known." ) 595 protected Period period; 596 597 /** 598 * A flag to indicate that the member is no longer in the group, but previously may have been a member. 599 */ 600 @Child(name = "inactive", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false) 601 @Description(shortDefinition="If member is no longer in group", formalDefinition="A flag to indicate that the member is no longer in the group, but previously may have been a member." ) 602 protected BooleanType inactive; 603 604 private static final long serialVersionUID = -333869055L; 605 606 /** 607 * Constructor 608 */ 609 public GroupMemberComponent() { 610 super(); 611 } 612 613 /** 614 * Constructor 615 */ 616 public GroupMemberComponent(Reference entity) { 617 super(); 618 this.entity = entity; 619 } 620 621 /** 622 * @return {@link #entity} (A reference to the entity that is a member of the group. Must be consistent with Group.type.) 623 */ 624 public Reference getEntity() { 625 if (this.entity == null) 626 if (Configuration.errorOnAutoCreate()) 627 throw new Error("Attempt to auto-create GroupMemberComponent.entity"); 628 else if (Configuration.doAutoCreate()) 629 this.entity = new Reference(); // cc 630 return this.entity; 631 } 632 633 public boolean hasEntity() { 634 return this.entity != null && !this.entity.isEmpty(); 635 } 636 637 /** 638 * @param value {@link #entity} (A reference to the entity that is a member of the group. Must be consistent with Group.type.) 639 */ 640 public GroupMemberComponent setEntity(Reference value) { 641 this.entity = value; 642 return this; 643 } 644 645 /** 646 * @return {@link #entity} 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. (A reference to the entity that is a member of the group. Must be consistent with Group.type.) 647 */ 648 public Resource getEntityTarget() { 649 return this.entityTarget; 650 } 651 652 /** 653 * @param value {@link #entity} 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. (A reference to the entity that is a member of the group. Must be consistent with Group.type.) 654 */ 655 public GroupMemberComponent setEntityTarget(Resource value) { 656 this.entityTarget = value; 657 return this; 658 } 659 660 /** 661 * @return {@link #period} (The period that the member was in the group, if known.) 662 */ 663 public Period getPeriod() { 664 if (this.period == null) 665 if (Configuration.errorOnAutoCreate()) 666 throw new Error("Attempt to auto-create GroupMemberComponent.period"); 667 else if (Configuration.doAutoCreate()) 668 this.period = new Period(); // cc 669 return this.period; 670 } 671 672 public boolean hasPeriod() { 673 return this.period != null && !this.period.isEmpty(); 674 } 675 676 /** 677 * @param value {@link #period} (The period that the member was in the group, if known.) 678 */ 679 public GroupMemberComponent setPeriod(Period value) { 680 this.period = value; 681 return this; 682 } 683 684 /** 685 * @return {@link #inactive} (A flag to indicate that the member is no longer in the group, but previously may have been a member.). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value 686 */ 687 public BooleanType getInactiveElement() { 688 if (this.inactive == null) 689 if (Configuration.errorOnAutoCreate()) 690 throw new Error("Attempt to auto-create GroupMemberComponent.inactive"); 691 else if (Configuration.doAutoCreate()) 692 this.inactive = new BooleanType(); // bb 693 return this.inactive; 694 } 695 696 public boolean hasInactiveElement() { 697 return this.inactive != null && !this.inactive.isEmpty(); 698 } 699 700 public boolean hasInactive() { 701 return this.inactive != null && !this.inactive.isEmpty(); 702 } 703 704 /** 705 * @param value {@link #inactive} (A flag to indicate that the member is no longer in the group, but previously may have been a member.). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value 706 */ 707 public GroupMemberComponent setInactiveElement(BooleanType value) { 708 this.inactive = value; 709 return this; 710 } 711 712 /** 713 * @return A flag to indicate that the member is no longer in the group, but previously may have been a member. 714 */ 715 public boolean getInactive() { 716 return this.inactive == null || this.inactive.isEmpty() ? false : this.inactive.getValue(); 717 } 718 719 /** 720 * @param value A flag to indicate that the member is no longer in the group, but previously may have been a member. 721 */ 722 public GroupMemberComponent setInactive(boolean value) { 723 if (this.inactive == null) 724 this.inactive = new BooleanType(); 725 this.inactive.setValue(value); 726 return this; 727 } 728 729 protected void listChildren(List<Property> childrenList) { 730 super.listChildren(childrenList); 731 childrenList.add(new Property("entity", "Reference(Patient|Practitioner|Device|Medication|Substance)", "A reference to the entity that is a member of the group. Must be consistent with Group.type.", 0, java.lang.Integer.MAX_VALUE, entity)); 732 childrenList.add(new Property("period", "Period", "The period that the member was in the group, if known.", 0, java.lang.Integer.MAX_VALUE, period)); 733 childrenList.add(new Property("inactive", "boolean", "A flag to indicate that the member is no longer in the group, but previously may have been a member.", 0, java.lang.Integer.MAX_VALUE, inactive)); 734 } 735 736 @Override 737 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 738 switch (hash) { 739 case -1298275357: /*entity*/ return this.entity == null ? new Base[0] : new Base[] {this.entity}; // Reference 740 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 741 case 24665195: /*inactive*/ return this.inactive == null ? new Base[0] : new Base[] {this.inactive}; // BooleanType 742 default: return super.getProperty(hash, name, checkValid); 743 } 744 745 } 746 747 @Override 748 public Base setProperty(int hash, String name, Base value) throws FHIRException { 749 switch (hash) { 750 case -1298275357: // entity 751 this.entity = castToReference(value); // Reference 752 return value; 753 case -991726143: // period 754 this.period = castToPeriod(value); // Period 755 return value; 756 case 24665195: // inactive 757 this.inactive = castToBoolean(value); // BooleanType 758 return value; 759 default: return super.setProperty(hash, name, value); 760 } 761 762 } 763 764 @Override 765 public Base setProperty(String name, Base value) throws FHIRException { 766 if (name.equals("entity")) { 767 this.entity = castToReference(value); // Reference 768 } else if (name.equals("period")) { 769 this.period = castToPeriod(value); // Period 770 } else if (name.equals("inactive")) { 771 this.inactive = castToBoolean(value); // BooleanType 772 } else 773 return super.setProperty(name, value); 774 return value; 775 } 776 777 @Override 778 public Base makeProperty(int hash, String name) throws FHIRException { 779 switch (hash) { 780 case -1298275357: return getEntity(); 781 case -991726143: return getPeriod(); 782 case 24665195: return getInactiveElement(); 783 default: return super.makeProperty(hash, name); 784 } 785 786 } 787 788 @Override 789 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 790 switch (hash) { 791 case -1298275357: /*entity*/ return new String[] {"Reference"}; 792 case -991726143: /*period*/ return new String[] {"Period"}; 793 case 24665195: /*inactive*/ return new String[] {"boolean"}; 794 default: return super.getTypesForProperty(hash, name); 795 } 796 797 } 798 799 @Override 800 public Base addChild(String name) throws FHIRException { 801 if (name.equals("entity")) { 802 this.entity = new Reference(); 803 return this.entity; 804 } 805 else if (name.equals("period")) { 806 this.period = new Period(); 807 return this.period; 808 } 809 else if (name.equals("inactive")) { 810 throw new FHIRException("Cannot call addChild on a primitive type Group.inactive"); 811 } 812 else 813 return super.addChild(name); 814 } 815 816 public GroupMemberComponent copy() { 817 GroupMemberComponent dst = new GroupMemberComponent(); 818 copyValues(dst); 819 dst.entity = entity == null ? null : entity.copy(); 820 dst.period = period == null ? null : period.copy(); 821 dst.inactive = inactive == null ? null : inactive.copy(); 822 return dst; 823 } 824 825 @Override 826 public boolean equalsDeep(Base other) { 827 if (!super.equalsDeep(other)) 828 return false; 829 if (!(other instanceof GroupMemberComponent)) 830 return false; 831 GroupMemberComponent o = (GroupMemberComponent) other; 832 return compareDeep(entity, o.entity, true) && compareDeep(period, o.period, true) && compareDeep(inactive, o.inactive, true) 833 ; 834 } 835 836 @Override 837 public boolean equalsShallow(Base other) { 838 if (!super.equalsShallow(other)) 839 return false; 840 if (!(other instanceof GroupMemberComponent)) 841 return false; 842 GroupMemberComponent o = (GroupMemberComponent) other; 843 return compareValues(inactive, o.inactive, true); 844 } 845 846 public boolean isEmpty() { 847 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(entity, period, inactive 848 ); 849 } 850 851 public String fhirType() { 852 return "Group.member"; 853 854 } 855 856 } 857 858 /** 859 * A unique business identifier for this group. 860 */ 861 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 862 @Description(shortDefinition="Unique id", formalDefinition="A unique business identifier for this group." ) 863 protected List<Identifier> identifier; 864 865 /** 866 * Indicates whether the record for the group is available for use or is merely being retained for historical purposes. 867 */ 868 @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true) 869 @Description(shortDefinition="Whether this group's record is in active use", formalDefinition="Indicates whether the record for the group is available for use or is merely being retained for historical purposes." ) 870 protected BooleanType active; 871 872 /** 873 * Identifies the broad classification of the kind of resources the group includes. 874 */ 875 @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true) 876 @Description(shortDefinition="person | animal | practitioner | device | medication | substance", formalDefinition="Identifies the broad classification of the kind of resources the group includes." ) 877 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/group-type") 878 protected Enumeration<GroupType> type; 879 880 /** 881 * If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals. 882 */ 883 @Child(name = "actual", type = {BooleanType.class}, order=3, min=1, max=1, modifier=false, summary=true) 884 @Description(shortDefinition="Descriptive or actual", formalDefinition="If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals." ) 885 protected BooleanType actual; 886 887 /** 888 * Provides a specific type of resource the group includes; e.g. "cow", "syringe", etc. 889 */ 890 @Child(name = "code", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 891 @Description(shortDefinition="Kind of Group members", formalDefinition="Provides a specific type of resource the group includes; e.g. \"cow\", \"syringe\", etc." ) 892 protected CodeableConcept code; 893 894 /** 895 * A label assigned to the group for human identification and communication. 896 */ 897 @Child(name = "name", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 898 @Description(shortDefinition="Label for Group", formalDefinition="A label assigned to the group for human identification and communication." ) 899 protected StringType name; 900 901 /** 902 * A count of the number of resource instances that are part of the group. 903 */ 904 @Child(name = "quantity", type = {UnsignedIntType.class}, order=6, min=0, max=1, modifier=false, summary=true) 905 @Description(shortDefinition="Number of members", formalDefinition="A count of the number of resource instances that are part of the group." ) 906 protected UnsignedIntType quantity; 907 908 /** 909 * Identifies the traits shared by members of the group. 910 */ 911 @Child(name = "characteristic", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 912 @Description(shortDefinition="Trait of group members", formalDefinition="Identifies the traits shared by members of the group." ) 913 protected List<GroupCharacteristicComponent> characteristic; 914 915 /** 916 * Identifies the resource instances that are members of the group. 917 */ 918 @Child(name = "member", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 919 @Description(shortDefinition="Who or what is in group", formalDefinition="Identifies the resource instances that are members of the group." ) 920 protected List<GroupMemberComponent> member; 921 922 private static final long serialVersionUID = 659980713L; 923 924 /** 925 * Constructor 926 */ 927 public Group() { 928 super(); 929 } 930 931 /** 932 * Constructor 933 */ 934 public Group(Enumeration<GroupType> type, BooleanType actual) { 935 super(); 936 this.type = type; 937 this.actual = actual; 938 } 939 940 /** 941 * @return {@link #identifier} (A unique business identifier for this group.) 942 */ 943 public List<Identifier> getIdentifier() { 944 if (this.identifier == null) 945 this.identifier = new ArrayList<Identifier>(); 946 return this.identifier; 947 } 948 949 /** 950 * @return Returns a reference to <code>this</code> for easy method chaining 951 */ 952 public Group setIdentifier(List<Identifier> theIdentifier) { 953 this.identifier = theIdentifier; 954 return this; 955 } 956 957 public boolean hasIdentifier() { 958 if (this.identifier == null) 959 return false; 960 for (Identifier item : this.identifier) 961 if (!item.isEmpty()) 962 return true; 963 return false; 964 } 965 966 public Identifier addIdentifier() { //3 967 Identifier t = new Identifier(); 968 if (this.identifier == null) 969 this.identifier = new ArrayList<Identifier>(); 970 this.identifier.add(t); 971 return t; 972 } 973 974 public Group addIdentifier(Identifier t) { //3 975 if (t == null) 976 return this; 977 if (this.identifier == null) 978 this.identifier = new ArrayList<Identifier>(); 979 this.identifier.add(t); 980 return this; 981 } 982 983 /** 984 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 985 */ 986 public Identifier getIdentifierFirstRep() { 987 if (getIdentifier().isEmpty()) { 988 addIdentifier(); 989 } 990 return getIdentifier().get(0); 991 } 992 993 /** 994 * @return {@link #active} (Indicates whether the record for the group is available for use or is merely being retained for historical purposes.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 995 */ 996 public BooleanType getActiveElement() { 997 if (this.active == null) 998 if (Configuration.errorOnAutoCreate()) 999 throw new Error("Attempt to auto-create Group.active"); 1000 else if (Configuration.doAutoCreate()) 1001 this.active = new BooleanType(); // bb 1002 return this.active; 1003 } 1004 1005 public boolean hasActiveElement() { 1006 return this.active != null && !this.active.isEmpty(); 1007 } 1008 1009 public boolean hasActive() { 1010 return this.active != null && !this.active.isEmpty(); 1011 } 1012 1013 /** 1014 * @param value {@link #active} (Indicates whether the record for the group is available for use or is merely being retained for historical purposes.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 1015 */ 1016 public Group setActiveElement(BooleanType value) { 1017 this.active = value; 1018 return this; 1019 } 1020 1021 /** 1022 * @return Indicates whether the record for the group is available for use or is merely being retained for historical purposes. 1023 */ 1024 public boolean getActive() { 1025 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 1026 } 1027 1028 /** 1029 * @param value Indicates whether the record for the group is available for use or is merely being retained for historical purposes. 1030 */ 1031 public Group setActive(boolean value) { 1032 if (this.active == null) 1033 this.active = new BooleanType(); 1034 this.active.setValue(value); 1035 return this; 1036 } 1037 1038 /** 1039 * @return {@link #type} (Identifies the broad classification of the kind of resources the group includes.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1040 */ 1041 public Enumeration<GroupType> getTypeElement() { 1042 if (this.type == null) 1043 if (Configuration.errorOnAutoCreate()) 1044 throw new Error("Attempt to auto-create Group.type"); 1045 else if (Configuration.doAutoCreate()) 1046 this.type = new Enumeration<GroupType>(new GroupTypeEnumFactory()); // bb 1047 return this.type; 1048 } 1049 1050 public boolean hasTypeElement() { 1051 return this.type != null && !this.type.isEmpty(); 1052 } 1053 1054 public boolean hasType() { 1055 return this.type != null && !this.type.isEmpty(); 1056 } 1057 1058 /** 1059 * @param value {@link #type} (Identifies the broad classification of the kind of resources the group includes.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1060 */ 1061 public Group setTypeElement(Enumeration<GroupType> value) { 1062 this.type = value; 1063 return this; 1064 } 1065 1066 /** 1067 * @return Identifies the broad classification of the kind of resources the group includes. 1068 */ 1069 public GroupType getType() { 1070 return this.type == null ? null : this.type.getValue(); 1071 } 1072 1073 /** 1074 * @param value Identifies the broad classification of the kind of resources the group includes. 1075 */ 1076 public Group setType(GroupType value) { 1077 if (this.type == null) 1078 this.type = new Enumeration<GroupType>(new GroupTypeEnumFactory()); 1079 this.type.setValue(value); 1080 return this; 1081 } 1082 1083 /** 1084 * @return {@link #actual} (If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals.). This is the underlying object with id, value and extensions. The accessor "getActual" gives direct access to the value 1085 */ 1086 public BooleanType getActualElement() { 1087 if (this.actual == null) 1088 if (Configuration.errorOnAutoCreate()) 1089 throw new Error("Attempt to auto-create Group.actual"); 1090 else if (Configuration.doAutoCreate()) 1091 this.actual = new BooleanType(); // bb 1092 return this.actual; 1093 } 1094 1095 public boolean hasActualElement() { 1096 return this.actual != null && !this.actual.isEmpty(); 1097 } 1098 1099 public boolean hasActual() { 1100 return this.actual != null && !this.actual.isEmpty(); 1101 } 1102 1103 /** 1104 * @param value {@link #actual} (If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals.). This is the underlying object with id, value and extensions. The accessor "getActual" gives direct access to the value 1105 */ 1106 public Group setActualElement(BooleanType value) { 1107 this.actual = value; 1108 return this; 1109 } 1110 1111 /** 1112 * @return If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals. 1113 */ 1114 public boolean getActual() { 1115 return this.actual == null || this.actual.isEmpty() ? false : this.actual.getValue(); 1116 } 1117 1118 /** 1119 * @param value If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals. 1120 */ 1121 public Group setActual(boolean value) { 1122 if (this.actual == null) 1123 this.actual = new BooleanType(); 1124 this.actual.setValue(value); 1125 return this; 1126 } 1127 1128 /** 1129 * @return {@link #code} (Provides a specific type of resource the group includes; e.g. "cow", "syringe", etc.) 1130 */ 1131 public CodeableConcept getCode() { 1132 if (this.code == null) 1133 if (Configuration.errorOnAutoCreate()) 1134 throw new Error("Attempt to auto-create Group.code"); 1135 else if (Configuration.doAutoCreate()) 1136 this.code = new CodeableConcept(); // cc 1137 return this.code; 1138 } 1139 1140 public boolean hasCode() { 1141 return this.code != null && !this.code.isEmpty(); 1142 } 1143 1144 /** 1145 * @param value {@link #code} (Provides a specific type of resource the group includes; e.g. "cow", "syringe", etc.) 1146 */ 1147 public Group setCode(CodeableConcept value) { 1148 this.code = value; 1149 return this; 1150 } 1151 1152 /** 1153 * @return {@link #name} (A label assigned to the group for human identification and communication.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 1154 */ 1155 public StringType getNameElement() { 1156 if (this.name == null) 1157 if (Configuration.errorOnAutoCreate()) 1158 throw new Error("Attempt to auto-create Group.name"); 1159 else if (Configuration.doAutoCreate()) 1160 this.name = new StringType(); // bb 1161 return this.name; 1162 } 1163 1164 public boolean hasNameElement() { 1165 return this.name != null && !this.name.isEmpty(); 1166 } 1167 1168 public boolean hasName() { 1169 return this.name != null && !this.name.isEmpty(); 1170 } 1171 1172 /** 1173 * @param value {@link #name} (A label assigned to the group for human identification and communication.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 1174 */ 1175 public Group setNameElement(StringType value) { 1176 this.name = value; 1177 return this; 1178 } 1179 1180 /** 1181 * @return A label assigned to the group for human identification and communication. 1182 */ 1183 public String getName() { 1184 return this.name == null ? null : this.name.getValue(); 1185 } 1186 1187 /** 1188 * @param value A label assigned to the group for human identification and communication. 1189 */ 1190 public Group setName(String value) { 1191 if (Utilities.noString(value)) 1192 this.name = null; 1193 else { 1194 if (this.name == null) 1195 this.name = new StringType(); 1196 this.name.setValue(value); 1197 } 1198 return this; 1199 } 1200 1201 /** 1202 * @return {@link #quantity} (A count of the number of resource instances that are part of the group.). This is the underlying object with id, value and extensions. The accessor "getQuantity" gives direct access to the value 1203 */ 1204 public UnsignedIntType getQuantityElement() { 1205 if (this.quantity == null) 1206 if (Configuration.errorOnAutoCreate()) 1207 throw new Error("Attempt to auto-create Group.quantity"); 1208 else if (Configuration.doAutoCreate()) 1209 this.quantity = new UnsignedIntType(); // bb 1210 return this.quantity; 1211 } 1212 1213 public boolean hasQuantityElement() { 1214 return this.quantity != null && !this.quantity.isEmpty(); 1215 } 1216 1217 public boolean hasQuantity() { 1218 return this.quantity != null && !this.quantity.isEmpty(); 1219 } 1220 1221 /** 1222 * @param value {@link #quantity} (A count of the number of resource instances that are part of the group.). This is the underlying object with id, value and extensions. The accessor "getQuantity" gives direct access to the value 1223 */ 1224 public Group setQuantityElement(UnsignedIntType value) { 1225 this.quantity = value; 1226 return this; 1227 } 1228 1229 /** 1230 * @return A count of the number of resource instances that are part of the group. 1231 */ 1232 public int getQuantity() { 1233 return this.quantity == null || this.quantity.isEmpty() ? 0 : this.quantity.getValue(); 1234 } 1235 1236 /** 1237 * @param value A count of the number of resource instances that are part of the group. 1238 */ 1239 public Group setQuantity(int value) { 1240 if (this.quantity == null) 1241 this.quantity = new UnsignedIntType(); 1242 this.quantity.setValue(value); 1243 return this; 1244 } 1245 1246 /** 1247 * @return {@link #characteristic} (Identifies the traits shared by members of the group.) 1248 */ 1249 public List<GroupCharacteristicComponent> getCharacteristic() { 1250 if (this.characteristic == null) 1251 this.characteristic = new ArrayList<GroupCharacteristicComponent>(); 1252 return this.characteristic; 1253 } 1254 1255 /** 1256 * @return Returns a reference to <code>this</code> for easy method chaining 1257 */ 1258 public Group setCharacteristic(List<GroupCharacteristicComponent> theCharacteristic) { 1259 this.characteristic = theCharacteristic; 1260 return this; 1261 } 1262 1263 public boolean hasCharacteristic() { 1264 if (this.characteristic == null) 1265 return false; 1266 for (GroupCharacteristicComponent item : this.characteristic) 1267 if (!item.isEmpty()) 1268 return true; 1269 return false; 1270 } 1271 1272 public GroupCharacteristicComponent addCharacteristic() { //3 1273 GroupCharacteristicComponent t = new GroupCharacteristicComponent(); 1274 if (this.characteristic == null) 1275 this.characteristic = new ArrayList<GroupCharacteristicComponent>(); 1276 this.characteristic.add(t); 1277 return t; 1278 } 1279 1280 public Group addCharacteristic(GroupCharacteristicComponent t) { //3 1281 if (t == null) 1282 return this; 1283 if (this.characteristic == null) 1284 this.characteristic = new ArrayList<GroupCharacteristicComponent>(); 1285 this.characteristic.add(t); 1286 return this; 1287 } 1288 1289 /** 1290 * @return The first repetition of repeating field {@link #characteristic}, creating it if it does not already exist 1291 */ 1292 public GroupCharacteristicComponent getCharacteristicFirstRep() { 1293 if (getCharacteristic().isEmpty()) { 1294 addCharacteristic(); 1295 } 1296 return getCharacteristic().get(0); 1297 } 1298 1299 /** 1300 * @return {@link #member} (Identifies the resource instances that are members of the group.) 1301 */ 1302 public List<GroupMemberComponent> getMember() { 1303 if (this.member == null) 1304 this.member = new ArrayList<GroupMemberComponent>(); 1305 return this.member; 1306 } 1307 1308 /** 1309 * @return Returns a reference to <code>this</code> for easy method chaining 1310 */ 1311 public Group setMember(List<GroupMemberComponent> theMember) { 1312 this.member = theMember; 1313 return this; 1314 } 1315 1316 public boolean hasMember() { 1317 if (this.member == null) 1318 return false; 1319 for (GroupMemberComponent item : this.member) 1320 if (!item.isEmpty()) 1321 return true; 1322 return false; 1323 } 1324 1325 public GroupMemberComponent addMember() { //3 1326 GroupMemberComponent t = new GroupMemberComponent(); 1327 if (this.member == null) 1328 this.member = new ArrayList<GroupMemberComponent>(); 1329 this.member.add(t); 1330 return t; 1331 } 1332 1333 public Group addMember(GroupMemberComponent t) { //3 1334 if (t == null) 1335 return this; 1336 if (this.member == null) 1337 this.member = new ArrayList<GroupMemberComponent>(); 1338 this.member.add(t); 1339 return this; 1340 } 1341 1342 /** 1343 * @return The first repetition of repeating field {@link #member}, creating it if it does not already exist 1344 */ 1345 public GroupMemberComponent getMemberFirstRep() { 1346 if (getMember().isEmpty()) { 1347 addMember(); 1348 } 1349 return getMember().get(0); 1350 } 1351 1352 protected void listChildren(List<Property> childrenList) { 1353 super.listChildren(childrenList); 1354 childrenList.add(new Property("identifier", "Identifier", "A unique business identifier for this group.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1355 childrenList.add(new Property("active", "boolean", "Indicates whether the record for the group is available for use or is merely being retained for historical purposes.", 0, java.lang.Integer.MAX_VALUE, active)); 1356 childrenList.add(new Property("type", "code", "Identifies the broad classification of the kind of resources the group includes.", 0, java.lang.Integer.MAX_VALUE, type)); 1357 childrenList.add(new Property("actual", "boolean", "If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals.", 0, java.lang.Integer.MAX_VALUE, actual)); 1358 childrenList.add(new Property("code", "CodeableConcept", "Provides a specific type of resource the group includes; e.g. \"cow\", \"syringe\", etc.", 0, java.lang.Integer.MAX_VALUE, code)); 1359 childrenList.add(new Property("name", "string", "A label assigned to the group for human identification and communication.", 0, java.lang.Integer.MAX_VALUE, name)); 1360 childrenList.add(new Property("quantity", "unsignedInt", "A count of the number of resource instances that are part of the group.", 0, java.lang.Integer.MAX_VALUE, quantity)); 1361 childrenList.add(new Property("characteristic", "", "Identifies the traits shared by members of the group.", 0, java.lang.Integer.MAX_VALUE, characteristic)); 1362 childrenList.add(new Property("member", "", "Identifies the resource instances that are members of the group.", 0, java.lang.Integer.MAX_VALUE, member)); 1363 } 1364 1365 @Override 1366 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1367 switch (hash) { 1368 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1369 case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType 1370 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<GroupType> 1371 case -1422939762: /*actual*/ return this.actual == null ? new Base[0] : new Base[] {this.actual}; // BooleanType 1372 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 1373 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 1374 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // UnsignedIntType 1375 case 366313883: /*characteristic*/ return this.characteristic == null ? new Base[0] : this.characteristic.toArray(new Base[this.characteristic.size()]); // GroupCharacteristicComponent 1376 case -1077769574: /*member*/ return this.member == null ? new Base[0] : this.member.toArray(new Base[this.member.size()]); // GroupMemberComponent 1377 default: return super.getProperty(hash, name, checkValid); 1378 } 1379 1380 } 1381 1382 @Override 1383 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1384 switch (hash) { 1385 case -1618432855: // identifier 1386 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1387 return value; 1388 case -1422950650: // active 1389 this.active = castToBoolean(value); // BooleanType 1390 return value; 1391 case 3575610: // type 1392 value = new GroupTypeEnumFactory().fromType(castToCode(value)); 1393 this.type = (Enumeration) value; // Enumeration<GroupType> 1394 return value; 1395 case -1422939762: // actual 1396 this.actual = castToBoolean(value); // BooleanType 1397 return value; 1398 case 3059181: // code 1399 this.code = castToCodeableConcept(value); // CodeableConcept 1400 return value; 1401 case 3373707: // name 1402 this.name = castToString(value); // StringType 1403 return value; 1404 case -1285004149: // quantity 1405 this.quantity = castToUnsignedInt(value); // UnsignedIntType 1406 return value; 1407 case 366313883: // characteristic 1408 this.getCharacteristic().add((GroupCharacteristicComponent) value); // GroupCharacteristicComponent 1409 return value; 1410 case -1077769574: // member 1411 this.getMember().add((GroupMemberComponent) value); // GroupMemberComponent 1412 return value; 1413 default: return super.setProperty(hash, name, value); 1414 } 1415 1416 } 1417 1418 @Override 1419 public Base setProperty(String name, Base value) throws FHIRException { 1420 if (name.equals("identifier")) { 1421 this.getIdentifier().add(castToIdentifier(value)); 1422 } else if (name.equals("active")) { 1423 this.active = castToBoolean(value); // BooleanType 1424 } else if (name.equals("type")) { 1425 value = new GroupTypeEnumFactory().fromType(castToCode(value)); 1426 this.type = (Enumeration) value; // Enumeration<GroupType> 1427 } else if (name.equals("actual")) { 1428 this.actual = castToBoolean(value); // BooleanType 1429 } else if (name.equals("code")) { 1430 this.code = castToCodeableConcept(value); // CodeableConcept 1431 } else if (name.equals("name")) { 1432 this.name = castToString(value); // StringType 1433 } else if (name.equals("quantity")) { 1434 this.quantity = castToUnsignedInt(value); // UnsignedIntType 1435 } else if (name.equals("characteristic")) { 1436 this.getCharacteristic().add((GroupCharacteristicComponent) value); 1437 } else if (name.equals("member")) { 1438 this.getMember().add((GroupMemberComponent) value); 1439 } else 1440 return super.setProperty(name, value); 1441 return value; 1442 } 1443 1444 @Override 1445 public Base makeProperty(int hash, String name) throws FHIRException { 1446 switch (hash) { 1447 case -1618432855: return addIdentifier(); 1448 case -1422950650: return getActiveElement(); 1449 case 3575610: return getTypeElement(); 1450 case -1422939762: return getActualElement(); 1451 case 3059181: return getCode(); 1452 case 3373707: return getNameElement(); 1453 case -1285004149: return getQuantityElement(); 1454 case 366313883: return addCharacteristic(); 1455 case -1077769574: return addMember(); 1456 default: return super.makeProperty(hash, name); 1457 } 1458 1459 } 1460 1461 @Override 1462 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1463 switch (hash) { 1464 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1465 case -1422950650: /*active*/ return new String[] {"boolean"}; 1466 case 3575610: /*type*/ return new String[] {"code"}; 1467 case -1422939762: /*actual*/ return new String[] {"boolean"}; 1468 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 1469 case 3373707: /*name*/ return new String[] {"string"}; 1470 case -1285004149: /*quantity*/ return new String[] {"unsignedInt"}; 1471 case 366313883: /*characteristic*/ return new String[] {}; 1472 case -1077769574: /*member*/ return new String[] {}; 1473 default: return super.getTypesForProperty(hash, name); 1474 } 1475 1476 } 1477 1478 @Override 1479 public Base addChild(String name) throws FHIRException { 1480 if (name.equals("identifier")) { 1481 return addIdentifier(); 1482 } 1483 else if (name.equals("active")) { 1484 throw new FHIRException("Cannot call addChild on a primitive type Group.active"); 1485 } 1486 else if (name.equals("type")) { 1487 throw new FHIRException("Cannot call addChild on a primitive type Group.type"); 1488 } 1489 else if (name.equals("actual")) { 1490 throw new FHIRException("Cannot call addChild on a primitive type Group.actual"); 1491 } 1492 else if (name.equals("code")) { 1493 this.code = new CodeableConcept(); 1494 return this.code; 1495 } 1496 else if (name.equals("name")) { 1497 throw new FHIRException("Cannot call addChild on a primitive type Group.name"); 1498 } 1499 else if (name.equals("quantity")) { 1500 throw new FHIRException("Cannot call addChild on a primitive type Group.quantity"); 1501 } 1502 else if (name.equals("characteristic")) { 1503 return addCharacteristic(); 1504 } 1505 else if (name.equals("member")) { 1506 return addMember(); 1507 } 1508 else 1509 return super.addChild(name); 1510 } 1511 1512 public String fhirType() { 1513 return "Group"; 1514 1515 } 1516 1517 public Group copy() { 1518 Group dst = new Group(); 1519 copyValues(dst); 1520 if (identifier != null) { 1521 dst.identifier = new ArrayList<Identifier>(); 1522 for (Identifier i : identifier) 1523 dst.identifier.add(i.copy()); 1524 }; 1525 dst.active = active == null ? null : active.copy(); 1526 dst.type = type == null ? null : type.copy(); 1527 dst.actual = actual == null ? null : actual.copy(); 1528 dst.code = code == null ? null : code.copy(); 1529 dst.name = name == null ? null : name.copy(); 1530 dst.quantity = quantity == null ? null : quantity.copy(); 1531 if (characteristic != null) { 1532 dst.characteristic = new ArrayList<GroupCharacteristicComponent>(); 1533 for (GroupCharacteristicComponent i : characteristic) 1534 dst.characteristic.add(i.copy()); 1535 }; 1536 if (member != null) { 1537 dst.member = new ArrayList<GroupMemberComponent>(); 1538 for (GroupMemberComponent i : member) 1539 dst.member.add(i.copy()); 1540 }; 1541 return dst; 1542 } 1543 1544 protected Group typedCopy() { 1545 return copy(); 1546 } 1547 1548 @Override 1549 public boolean equalsDeep(Base other) { 1550 if (!super.equalsDeep(other)) 1551 return false; 1552 if (!(other instanceof Group)) 1553 return false; 1554 Group o = (Group) other; 1555 return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(type, o.type, true) 1556 && compareDeep(actual, o.actual, true) && compareDeep(code, o.code, true) && compareDeep(name, o.name, true) 1557 && compareDeep(quantity, o.quantity, true) && compareDeep(characteristic, o.characteristic, true) 1558 && compareDeep(member, o.member, true); 1559 } 1560 1561 @Override 1562 public boolean equalsShallow(Base other) { 1563 if (!super.equalsShallow(other)) 1564 return false; 1565 if (!(other instanceof Group)) 1566 return false; 1567 Group o = (Group) other; 1568 return compareValues(active, o.active, true) && compareValues(type, o.type, true) && compareValues(actual, o.actual, true) 1569 && compareValues(name, o.name, true) && compareValues(quantity, o.quantity, true); 1570 } 1571 1572 public boolean isEmpty() { 1573 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, type 1574 , actual, code, name, quantity, characteristic, member); 1575 } 1576 1577 @Override 1578 public ResourceType getResourceType() { 1579 return ResourceType.Group; 1580 } 1581 1582 /** 1583 * Search parameter: <b>actual</b> 1584 * <p> 1585 * Description: <b>Descriptive or actual</b><br> 1586 * Type: <b>token</b><br> 1587 * Path: <b>Group.actual</b><br> 1588 * </p> 1589 */ 1590 @SearchParamDefinition(name="actual", path="Group.actual", description="Descriptive or actual", type="token" ) 1591 public static final String SP_ACTUAL = "actual"; 1592 /** 1593 * <b>Fluent Client</b> search parameter constant for <b>actual</b> 1594 * <p> 1595 * Description: <b>Descriptive or actual</b><br> 1596 * Type: <b>token</b><br> 1597 * Path: <b>Group.actual</b><br> 1598 * </p> 1599 */ 1600 public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTUAL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTUAL); 1601 1602 /** 1603 * Search parameter: <b>identifier</b> 1604 * <p> 1605 * Description: <b>Unique id</b><br> 1606 * Type: <b>token</b><br> 1607 * Path: <b>Group.identifier</b><br> 1608 * </p> 1609 */ 1610 @SearchParamDefinition(name="identifier", path="Group.identifier", description="Unique id", type="token" ) 1611 public static final String SP_IDENTIFIER = "identifier"; 1612 /** 1613 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1614 * <p> 1615 * Description: <b>Unique id</b><br> 1616 * Type: <b>token</b><br> 1617 * Path: <b>Group.identifier</b><br> 1618 * </p> 1619 */ 1620 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1621 1622 /** 1623 * Search parameter: <b>characteristic-value</b> 1624 * <p> 1625 * Description: <b>A composite of both characteristic and value</b><br> 1626 * Type: <b>composite</b><br> 1627 * Path: <b></b><br> 1628 * </p> 1629 */ 1630 @SearchParamDefinition(name="characteristic-value", path="Group.characteristic", description="A composite of both characteristic and value", type="composite", compositeOf={"characteristic", "value"} ) 1631 public static final String SP_CHARACTERISTIC_VALUE = "characteristic-value"; 1632 /** 1633 * <b>Fluent Client</b> search parameter constant for <b>characteristic-value</b> 1634 * <p> 1635 * Description: <b>A composite of both characteristic and value</b><br> 1636 * Type: <b>composite</b><br> 1637 * Path: <b></b><br> 1638 * </p> 1639 */ 1640 public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CHARACTERISTIC_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CHARACTERISTIC_VALUE); 1641 1642 /** 1643 * Search parameter: <b>code</b> 1644 * <p> 1645 * Description: <b>The kind of resources contained</b><br> 1646 * Type: <b>token</b><br> 1647 * Path: <b>Group.code</b><br> 1648 * </p> 1649 */ 1650 @SearchParamDefinition(name="code", path="Group.code", description="The kind of resources contained", type="token" ) 1651 public static final String SP_CODE = "code"; 1652 /** 1653 * <b>Fluent Client</b> search parameter constant for <b>code</b> 1654 * <p> 1655 * Description: <b>The kind of resources contained</b><br> 1656 * Type: <b>token</b><br> 1657 * Path: <b>Group.code</b><br> 1658 * </p> 1659 */ 1660 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 1661 1662 /** 1663 * Search parameter: <b>member</b> 1664 * <p> 1665 * Description: <b>Reference to the group member</b><br> 1666 * Type: <b>reference</b><br> 1667 * Path: <b>Group.member.entity</b><br> 1668 * </p> 1669 */ 1670 @SearchParamDefinition(name="member", path="Group.member.entity", description="Reference to the group member", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Medication.class, Patient.class, Practitioner.class, Substance.class } ) 1671 public static final String SP_MEMBER = "member"; 1672 /** 1673 * <b>Fluent Client</b> search parameter constant for <b>member</b> 1674 * <p> 1675 * Description: <b>Reference to the group member</b><br> 1676 * Type: <b>reference</b><br> 1677 * Path: <b>Group.member.entity</b><br> 1678 * </p> 1679 */ 1680 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEMBER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEMBER); 1681 1682/** 1683 * Constant for fluent queries to be used to add include statements. Specifies 1684 * the path value of "<b>Group:member</b>". 1685 */ 1686 public static final ca.uhn.fhir.model.api.Include INCLUDE_MEMBER = new ca.uhn.fhir.model.api.Include("Group:member").toLocked(); 1687 1688 /** 1689 * Search parameter: <b>exclude</b> 1690 * <p> 1691 * Description: <b>Group includes or excludes</b><br> 1692 * Type: <b>token</b><br> 1693 * Path: <b>Group.characteristic.exclude</b><br> 1694 * </p> 1695 */ 1696 @SearchParamDefinition(name="exclude", path="Group.characteristic.exclude", description="Group includes or excludes", type="token" ) 1697 public static final String SP_EXCLUDE = "exclude"; 1698 /** 1699 * <b>Fluent Client</b> search parameter constant for <b>exclude</b> 1700 * <p> 1701 * Description: <b>Group includes or excludes</b><br> 1702 * Type: <b>token</b><br> 1703 * Path: <b>Group.characteristic.exclude</b><br> 1704 * </p> 1705 */ 1706 public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXCLUDE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EXCLUDE); 1707 1708 /** 1709 * Search parameter: <b>type</b> 1710 * <p> 1711 * Description: <b>The type of resources the group contains</b><br> 1712 * Type: <b>token</b><br> 1713 * Path: <b>Group.type</b><br> 1714 * </p> 1715 */ 1716 @SearchParamDefinition(name="type", path="Group.type", description="The type of resources the group contains", type="token" ) 1717 public static final String SP_TYPE = "type"; 1718 /** 1719 * <b>Fluent Client</b> search parameter constant for <b>type</b> 1720 * <p> 1721 * Description: <b>The type of resources the group contains</b><br> 1722 * Type: <b>token</b><br> 1723 * Path: <b>Group.type</b><br> 1724 * </p> 1725 */ 1726 public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE); 1727 1728 /** 1729 * Search parameter: <b>value</b> 1730 * <p> 1731 * Description: <b>Value held by characteristic</b><br> 1732 * Type: <b>token</b><br> 1733 * Path: <b>Group.characteristic.value[x]</b><br> 1734 * </p> 1735 */ 1736 @SearchParamDefinition(name="value", path="Group.characteristic.value", description="Value held by characteristic", type="token" ) 1737 public static final String SP_VALUE = "value"; 1738 /** 1739 * <b>Fluent Client</b> search parameter constant for <b>value</b> 1740 * <p> 1741 * Description: <b>Value held by characteristic</b><br> 1742 * Type: <b>token</b><br> 1743 * Path: <b>Group.characteristic.value[x]</b><br> 1744 * </p> 1745 */ 1746 public static final ca.uhn.fhir.rest.gclient.TokenClientParam VALUE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VALUE); 1747 1748 /** 1749 * Search parameter: <b>characteristic</b> 1750 * <p> 1751 * Description: <b>Kind of characteristic</b><br> 1752 * Type: <b>token</b><br> 1753 * Path: <b>Group.characteristic.code</b><br> 1754 * </p> 1755 */ 1756 @SearchParamDefinition(name="characteristic", path="Group.characteristic.code", description="Kind of characteristic", type="token" ) 1757 public static final String SP_CHARACTERISTIC = "characteristic"; 1758 /** 1759 * <b>Fluent Client</b> search parameter constant for <b>characteristic</b> 1760 * <p> 1761 * Description: <b>Kind of characteristic</b><br> 1762 * Type: <b>token</b><br> 1763 * Path: <b>Group.characteristic.code</b><br> 1764 * </p> 1765 */ 1766 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CHARACTERISTIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CHARACTERISTIC); 1767 1768 1769} 1770