001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.List; 038 039import ca.uhn.fhir.model.api.annotation.Block; 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import org.hl7.fhir.exceptions.FHIRException; 046import org.hl7.fhir.utilities.Utilities; 047/** 048 * A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc. 049 */ 050@ResourceDef(name="Organization", profile="http://hl7.org/fhir/Profile/Organization") 051public class Organization extends DomainResource { 052 053 @Block() 054 public static class OrganizationContactComponent extends BackboneElement implements IBaseBackboneElement { 055 /** 056 * Indicates a purpose for which the contact can be reached. 057 */ 058 @Child(name = "purpose", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false) 059 @Description(shortDefinition="The type of contact", formalDefinition="Indicates a purpose for which the contact can be reached." ) 060 protected CodeableConcept purpose; 061 062 /** 063 * A name associated with the contact. 064 */ 065 @Child(name = "name", type = {HumanName.class}, order=2, min=0, max=1, modifier=false, summary=false) 066 @Description(shortDefinition="A name associated with the contact", formalDefinition="A name associated with the contact." ) 067 protected HumanName name; 068 069 /** 070 * A contact detail (e.g. a telephone number or an email address) by which the party may be contacted. 071 */ 072 @Child(name = "telecom", type = {ContactPoint.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 073 @Description(shortDefinition="Contact details (telephone, email, etc.) for a contact", formalDefinition="A contact detail (e.g. a telephone number or an email address) by which the party may be contacted." ) 074 protected List<ContactPoint> telecom; 075 076 /** 077 * Visiting or postal addresses for the contact. 078 */ 079 @Child(name = "address", type = {Address.class}, order=4, min=0, max=1, modifier=false, summary=false) 080 @Description(shortDefinition="Visiting or postal addresses for the contact", formalDefinition="Visiting or postal addresses for the contact." ) 081 protected Address address; 082 083 private static final long serialVersionUID = 1831121305L; 084 085 /* 086 * Constructor 087 */ 088 public OrganizationContactComponent() { 089 super(); 090 } 091 092 /** 093 * @return {@link #purpose} (Indicates a purpose for which the contact can be reached.) 094 */ 095 public CodeableConcept getPurpose() { 096 if (this.purpose == null) 097 if (Configuration.errorOnAutoCreate()) 098 throw new Error("Attempt to auto-create OrganizationContactComponent.purpose"); 099 else if (Configuration.doAutoCreate()) 100 this.purpose = new CodeableConcept(); // cc 101 return this.purpose; 102 } 103 104 public boolean hasPurpose() { 105 return this.purpose != null && !this.purpose.isEmpty(); 106 } 107 108 /** 109 * @param value {@link #purpose} (Indicates a purpose for which the contact can be reached.) 110 */ 111 public OrganizationContactComponent setPurpose(CodeableConcept value) { 112 this.purpose = value; 113 return this; 114 } 115 116 /** 117 * @return {@link #name} (A name associated with the contact.) 118 */ 119 public HumanName getName() { 120 if (this.name == null) 121 if (Configuration.errorOnAutoCreate()) 122 throw new Error("Attempt to auto-create OrganizationContactComponent.name"); 123 else if (Configuration.doAutoCreate()) 124 this.name = new HumanName(); // cc 125 return this.name; 126 } 127 128 public boolean hasName() { 129 return this.name != null && !this.name.isEmpty(); 130 } 131 132 /** 133 * @param value {@link #name} (A name associated with the contact.) 134 */ 135 public OrganizationContactComponent setName(HumanName value) { 136 this.name = value; 137 return this; 138 } 139 140 /** 141 * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.) 142 */ 143 public List<ContactPoint> getTelecom() { 144 if (this.telecom == null) 145 this.telecom = new ArrayList<ContactPoint>(); 146 return this.telecom; 147 } 148 149 public boolean hasTelecom() { 150 if (this.telecom == null) 151 return false; 152 for (ContactPoint item : this.telecom) 153 if (!item.isEmpty()) 154 return true; 155 return false; 156 } 157 158 /** 159 * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.) 160 */ 161 // syntactic sugar 162 public ContactPoint addTelecom() { //3 163 ContactPoint t = new ContactPoint(); 164 if (this.telecom == null) 165 this.telecom = new ArrayList<ContactPoint>(); 166 this.telecom.add(t); 167 return t; 168 } 169 170 // syntactic sugar 171 public OrganizationContactComponent addTelecom(ContactPoint t) { //3 172 if (t == null) 173 return this; 174 if (this.telecom == null) 175 this.telecom = new ArrayList<ContactPoint>(); 176 this.telecom.add(t); 177 return this; 178 } 179 180 /** 181 * @return {@link #address} (Visiting or postal addresses for the contact.) 182 */ 183 public Address getAddress() { 184 if (this.address == null) 185 if (Configuration.errorOnAutoCreate()) 186 throw new Error("Attempt to auto-create OrganizationContactComponent.address"); 187 else if (Configuration.doAutoCreate()) 188 this.address = new Address(); // cc 189 return this.address; 190 } 191 192 public boolean hasAddress() { 193 return this.address != null && !this.address.isEmpty(); 194 } 195 196 /** 197 * @param value {@link #address} (Visiting or postal addresses for the contact.) 198 */ 199 public OrganizationContactComponent setAddress(Address value) { 200 this.address = value; 201 return this; 202 } 203 204 protected void listChildren(List<Property> childrenList) { 205 super.listChildren(childrenList); 206 childrenList.add(new Property("purpose", "CodeableConcept", "Indicates a purpose for which the contact can be reached.", 0, java.lang.Integer.MAX_VALUE, purpose)); 207 childrenList.add(new Property("name", "HumanName", "A name associated with the contact.", 0, java.lang.Integer.MAX_VALUE, name)); 208 childrenList.add(new Property("telecom", "ContactPoint", "A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.", 0, java.lang.Integer.MAX_VALUE, telecom)); 209 childrenList.add(new Property("address", "Address", "Visiting or postal addresses for the contact.", 0, java.lang.Integer.MAX_VALUE, address)); 210 } 211 212 @Override 213 public void setProperty(String name, Base value) throws FHIRException { 214 if (name.equals("purpose")) 215 this.purpose = castToCodeableConcept(value); // CodeableConcept 216 else if (name.equals("name")) 217 this.name = castToHumanName(value); // HumanName 218 else if (name.equals("telecom")) 219 this.getTelecom().add(castToContactPoint(value)); 220 else if (name.equals("address")) 221 this.address = castToAddress(value); // Address 222 else 223 super.setProperty(name, value); 224 } 225 226 @Override 227 public Base addChild(String name) throws FHIRException { 228 if (name.equals("purpose")) { 229 this.purpose = new CodeableConcept(); 230 return this.purpose; 231 } 232 else if (name.equals("name")) { 233 this.name = new HumanName(); 234 return this.name; 235 } 236 else if (name.equals("telecom")) { 237 return addTelecom(); 238 } 239 else if (name.equals("address")) { 240 this.address = new Address(); 241 return this.address; 242 } 243 else 244 return super.addChild(name); 245 } 246 247 public OrganizationContactComponent copy() { 248 OrganizationContactComponent dst = new OrganizationContactComponent(); 249 copyValues(dst); 250 dst.purpose = purpose == null ? null : purpose.copy(); 251 dst.name = name == null ? null : name.copy(); 252 if (telecom != null) { 253 dst.telecom = new ArrayList<ContactPoint>(); 254 for (ContactPoint i : telecom) 255 dst.telecom.add(i.copy()); 256 }; 257 dst.address = address == null ? null : address.copy(); 258 return dst; 259 } 260 261 @Override 262 public boolean equalsDeep(Base other) { 263 if (!super.equalsDeep(other)) 264 return false; 265 if (!(other instanceof OrganizationContactComponent)) 266 return false; 267 OrganizationContactComponent o = (OrganizationContactComponent) other; 268 return compareDeep(purpose, o.purpose, true) && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) 269 && compareDeep(address, o.address, true); 270 } 271 272 @Override 273 public boolean equalsShallow(Base other) { 274 if (!super.equalsShallow(other)) 275 return false; 276 if (!(other instanceof OrganizationContactComponent)) 277 return false; 278 OrganizationContactComponent o = (OrganizationContactComponent) other; 279 return true; 280 } 281 282 public boolean isEmpty() { 283 return super.isEmpty() && (purpose == null || purpose.isEmpty()) && (name == null || name.isEmpty()) 284 && (telecom == null || telecom.isEmpty()) && (address == null || address.isEmpty()); 285 } 286 287 public String fhirType() { 288 return "Organization.contact"; 289 290 } 291 292 } 293 294 /** 295 * Identifier for the organization that is used to identify the organization across multiple disparate systems. 296 */ 297 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 298 @Description(shortDefinition="Identifies this organization across multiple systems", formalDefinition="Identifier for the organization that is used to identify the organization across multiple disparate systems." ) 299 protected List<Identifier> identifier; 300 301 /** 302 * Whether the organization's record is still in active use. 303 */ 304 @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true) 305 @Description(shortDefinition="Whether the organization's record is still in active use", formalDefinition="Whether the organization's record is still in active use." ) 306 protected BooleanType active; 307 308 /** 309 * The kind of organization that this is. 310 */ 311 @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 312 @Description(shortDefinition="Kind of organization", formalDefinition="The kind of organization that this is." ) 313 protected CodeableConcept type; 314 315 /** 316 * A name associated with the organization. 317 */ 318 @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 319 @Description(shortDefinition="Name used for the organization", formalDefinition="A name associated with the organization." ) 320 protected StringType name; 321 322 /** 323 * A contact detail for the organization. 324 */ 325 @Child(name = "telecom", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 326 @Description(shortDefinition="A contact detail for the organization", formalDefinition="A contact detail for the organization." ) 327 protected List<ContactPoint> telecom; 328 329 /** 330 * An address for the organization. 331 */ 332 @Child(name = "address", type = {Address.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 333 @Description(shortDefinition="An address for the organization", formalDefinition="An address for the organization." ) 334 protected List<Address> address; 335 336 /** 337 * The organization of which this organization forms a part. 338 */ 339 @Child(name = "partOf", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true) 340 @Description(shortDefinition="The organization of which this organization forms a part", formalDefinition="The organization of which this organization forms a part." ) 341 protected Reference partOf; 342 343 /** 344 * The actual object that is the target of the reference (The organization of which this organization forms a part.) 345 */ 346 protected Organization partOfTarget; 347 348 /** 349 * Contact for the organization for a certain purpose. 350 */ 351 @Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 352 @Description(shortDefinition="Contact for the organization for a certain purpose", formalDefinition="Contact for the organization for a certain purpose." ) 353 protected List<OrganizationContactComponent> contact; 354 355 private static final long serialVersionUID = -749567123L; 356 357 /* 358 * Constructor 359 */ 360 public Organization() { 361 super(); 362 } 363 364 /** 365 * @return {@link #identifier} (Identifier for the organization that is used to identify the organization across multiple disparate systems.) 366 */ 367 public List<Identifier> getIdentifier() { 368 if (this.identifier == null) 369 this.identifier = new ArrayList<Identifier>(); 370 return this.identifier; 371 } 372 373 public boolean hasIdentifier() { 374 if (this.identifier == null) 375 return false; 376 for (Identifier item : this.identifier) 377 if (!item.isEmpty()) 378 return true; 379 return false; 380 } 381 382 /** 383 * @return {@link #identifier} (Identifier for the organization that is used to identify the organization across multiple disparate systems.) 384 */ 385 // syntactic sugar 386 public Identifier addIdentifier() { //3 387 Identifier t = new Identifier(); 388 if (this.identifier == null) 389 this.identifier = new ArrayList<Identifier>(); 390 this.identifier.add(t); 391 return t; 392 } 393 394 // syntactic sugar 395 public Organization addIdentifier(Identifier t) { //3 396 if (t == null) 397 return this; 398 if (this.identifier == null) 399 this.identifier = new ArrayList<Identifier>(); 400 this.identifier.add(t); 401 return this; 402 } 403 404 /** 405 * @return {@link #active} (Whether the organization's record is still in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 406 */ 407 public BooleanType getActiveElement() { 408 if (this.active == null) 409 if (Configuration.errorOnAutoCreate()) 410 throw new Error("Attempt to auto-create Organization.active"); 411 else if (Configuration.doAutoCreate()) 412 this.active = new BooleanType(); // bb 413 return this.active; 414 } 415 416 public boolean hasActiveElement() { 417 return this.active != null && !this.active.isEmpty(); 418 } 419 420 public boolean hasActive() { 421 return this.active != null && !this.active.isEmpty(); 422 } 423 424 /** 425 * @param value {@link #active} (Whether the organization's record is still in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value 426 */ 427 public Organization setActiveElement(BooleanType value) { 428 this.active = value; 429 return this; 430 } 431 432 /** 433 * @return Whether the organization's record is still in active use. 434 */ 435 public boolean getActive() { 436 return this.active == null || this.active.isEmpty() ? false : this.active.getValue(); 437 } 438 439 /** 440 * @param value Whether the organization's record is still in active use. 441 */ 442 public Organization setActive(boolean value) { 443 if (this.active == null) 444 this.active = new BooleanType(); 445 this.active.setValue(value); 446 return this; 447 } 448 449 /** 450 * @return {@link #type} (The kind of organization that this is.) 451 */ 452 public CodeableConcept getType() { 453 if (this.type == null) 454 if (Configuration.errorOnAutoCreate()) 455 throw new Error("Attempt to auto-create Organization.type"); 456 else if (Configuration.doAutoCreate()) 457 this.type = new CodeableConcept(); // cc 458 return this.type; 459 } 460 461 public boolean hasType() { 462 return this.type != null && !this.type.isEmpty(); 463 } 464 465 /** 466 * @param value {@link #type} (The kind of organization that this is.) 467 */ 468 public Organization setType(CodeableConcept value) { 469 this.type = value; 470 return this; 471 } 472 473 /** 474 * @return {@link #name} (A name associated with the organization.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 475 */ 476 public StringType getNameElement() { 477 if (this.name == null) 478 if (Configuration.errorOnAutoCreate()) 479 throw new Error("Attempt to auto-create Organization.name"); 480 else if (Configuration.doAutoCreate()) 481 this.name = new StringType(); // bb 482 return this.name; 483 } 484 485 public boolean hasNameElement() { 486 return this.name != null && !this.name.isEmpty(); 487 } 488 489 public boolean hasName() { 490 return this.name != null && !this.name.isEmpty(); 491 } 492 493 /** 494 * @param value {@link #name} (A name associated with the organization.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 495 */ 496 public Organization setNameElement(StringType value) { 497 this.name = value; 498 return this; 499 } 500 501 /** 502 * @return A name associated with the organization. 503 */ 504 public String getName() { 505 return this.name == null ? null : this.name.getValue(); 506 } 507 508 /** 509 * @param value A name associated with the organization. 510 */ 511 public Organization setName(String value) { 512 if (Utilities.noString(value)) 513 this.name = null; 514 else { 515 if (this.name == null) 516 this.name = new StringType(); 517 this.name.setValue(value); 518 } 519 return this; 520 } 521 522 /** 523 * @return {@link #telecom} (A contact detail for the organization.) 524 */ 525 public List<ContactPoint> getTelecom() { 526 if (this.telecom == null) 527 this.telecom = new ArrayList<ContactPoint>(); 528 return this.telecom; 529 } 530 531 public boolean hasTelecom() { 532 if (this.telecom == null) 533 return false; 534 for (ContactPoint item : this.telecom) 535 if (!item.isEmpty()) 536 return true; 537 return false; 538 } 539 540 /** 541 * @return {@link #telecom} (A contact detail for the organization.) 542 */ 543 // syntactic sugar 544 public ContactPoint addTelecom() { //3 545 ContactPoint t = new ContactPoint(); 546 if (this.telecom == null) 547 this.telecom = new ArrayList<ContactPoint>(); 548 this.telecom.add(t); 549 return t; 550 } 551 552 // syntactic sugar 553 public Organization addTelecom(ContactPoint t) { //3 554 if (t == null) 555 return this; 556 if (this.telecom == null) 557 this.telecom = new ArrayList<ContactPoint>(); 558 this.telecom.add(t); 559 return this; 560 } 561 562 /** 563 * @return {@link #address} (An address for the organization.) 564 */ 565 public List<Address> getAddress() { 566 if (this.address == null) 567 this.address = new ArrayList<Address>(); 568 return this.address; 569 } 570 571 public boolean hasAddress() { 572 if (this.address == null) 573 return false; 574 for (Address item : this.address) 575 if (!item.isEmpty()) 576 return true; 577 return false; 578 } 579 580 /** 581 * @return {@link #address} (An address for the organization.) 582 */ 583 // syntactic sugar 584 public Address addAddress() { //3 585 Address t = new Address(); 586 if (this.address == null) 587 this.address = new ArrayList<Address>(); 588 this.address.add(t); 589 return t; 590 } 591 592 // syntactic sugar 593 public Organization addAddress(Address t) { //3 594 if (t == null) 595 return this; 596 if (this.address == null) 597 this.address = new ArrayList<Address>(); 598 this.address.add(t); 599 return this; 600 } 601 602 /** 603 * @return {@link #partOf} (The organization of which this organization forms a part.) 604 */ 605 public Reference getPartOf() { 606 if (this.partOf == null) 607 if (Configuration.errorOnAutoCreate()) 608 throw new Error("Attempt to auto-create Organization.partOf"); 609 else if (Configuration.doAutoCreate()) 610 this.partOf = new Reference(); // cc 611 return this.partOf; 612 } 613 614 public boolean hasPartOf() { 615 return this.partOf != null && !this.partOf.isEmpty(); 616 } 617 618 /** 619 * @param value {@link #partOf} (The organization of which this organization forms a part.) 620 */ 621 public Organization setPartOf(Reference value) { 622 this.partOf = value; 623 return this; 624 } 625 626 /** 627 * @return {@link #partOf} 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 organization of which this organization forms a part.) 628 */ 629 public Organization getPartOfTarget() { 630 if (this.partOfTarget == null) 631 if (Configuration.errorOnAutoCreate()) 632 throw new Error("Attempt to auto-create Organization.partOf"); 633 else if (Configuration.doAutoCreate()) 634 this.partOfTarget = new Organization(); // aa 635 return this.partOfTarget; 636 } 637 638 /** 639 * @param value {@link #partOf} 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 organization of which this organization forms a part.) 640 */ 641 public Organization setPartOfTarget(Organization value) { 642 this.partOfTarget = value; 643 return this; 644 } 645 646 /** 647 * @return {@link #contact} (Contact for the organization for a certain purpose.) 648 */ 649 public List<OrganizationContactComponent> getContact() { 650 if (this.contact == null) 651 this.contact = new ArrayList<OrganizationContactComponent>(); 652 return this.contact; 653 } 654 655 public boolean hasContact() { 656 if (this.contact == null) 657 return false; 658 for (OrganizationContactComponent item : this.contact) 659 if (!item.isEmpty()) 660 return true; 661 return false; 662 } 663 664 /** 665 * @return {@link #contact} (Contact for the organization for a certain purpose.) 666 */ 667 // syntactic sugar 668 public OrganizationContactComponent addContact() { //3 669 OrganizationContactComponent t = new OrganizationContactComponent(); 670 if (this.contact == null) 671 this.contact = new ArrayList<OrganizationContactComponent>(); 672 this.contact.add(t); 673 return t; 674 } 675 676 // syntactic sugar 677 public Organization addContact(OrganizationContactComponent t) { //3 678 if (t == null) 679 return this; 680 if (this.contact == null) 681 this.contact = new ArrayList<OrganizationContactComponent>(); 682 this.contact.add(t); 683 return this; 684 } 685 686 protected void listChildren(List<Property> childrenList) { 687 super.listChildren(childrenList); 688 childrenList.add(new Property("identifier", "Identifier", "Identifier for the organization that is used to identify the organization across multiple disparate systems.", 0, java.lang.Integer.MAX_VALUE, identifier)); 689 childrenList.add(new Property("active", "boolean", "Whether the organization's record is still in active use.", 0, java.lang.Integer.MAX_VALUE, active)); 690 childrenList.add(new Property("type", "CodeableConcept", "The kind of organization that this is.", 0, java.lang.Integer.MAX_VALUE, type)); 691 childrenList.add(new Property("name", "string", "A name associated with the organization.", 0, java.lang.Integer.MAX_VALUE, name)); 692 childrenList.add(new Property("telecom", "ContactPoint", "A contact detail for the organization.", 0, java.lang.Integer.MAX_VALUE, telecom)); 693 childrenList.add(new Property("address", "Address", "An address for the organization.", 0, java.lang.Integer.MAX_VALUE, address)); 694 childrenList.add(new Property("partOf", "Reference(Organization)", "The organization of which this organization forms a part.", 0, java.lang.Integer.MAX_VALUE, partOf)); 695 childrenList.add(new Property("contact", "", "Contact for the organization for a certain purpose.", 0, java.lang.Integer.MAX_VALUE, contact)); 696 } 697 698 @Override 699 public void setProperty(String name, Base value) throws FHIRException { 700 if (name.equals("identifier")) 701 this.getIdentifier().add(castToIdentifier(value)); 702 else if (name.equals("active")) 703 this.active = castToBoolean(value); // BooleanType 704 else if (name.equals("type")) 705 this.type = castToCodeableConcept(value); // CodeableConcept 706 else if (name.equals("name")) 707 this.name = castToString(value); // StringType 708 else if (name.equals("telecom")) 709 this.getTelecom().add(castToContactPoint(value)); 710 else if (name.equals("address")) 711 this.getAddress().add(castToAddress(value)); 712 else if (name.equals("partOf")) 713 this.partOf = castToReference(value); // Reference 714 else if (name.equals("contact")) 715 this.getContact().add((OrganizationContactComponent) value); 716 else 717 super.setProperty(name, value); 718 } 719 720 @Override 721 public Base addChild(String name) throws FHIRException { 722 if (name.equals("identifier")) { 723 return addIdentifier(); 724 } 725 else if (name.equals("active")) { 726 throw new FHIRException("Cannot call addChild on a primitive type Organization.active"); 727 } 728 else if (name.equals("type")) { 729 this.type = new CodeableConcept(); 730 return this.type; 731 } 732 else if (name.equals("name")) { 733 throw new FHIRException("Cannot call addChild on a primitive type Organization.name"); 734 } 735 else if (name.equals("telecom")) { 736 return addTelecom(); 737 } 738 else if (name.equals("address")) { 739 return addAddress(); 740 } 741 else if (name.equals("partOf")) { 742 this.partOf = new Reference(); 743 return this.partOf; 744 } 745 else if (name.equals("contact")) { 746 return addContact(); 747 } 748 else 749 return super.addChild(name); 750 } 751 752 public String fhirType() { 753 return "Organization"; 754 755 } 756 757 public Organization copy() { 758 Organization dst = new Organization(); 759 copyValues(dst); 760 if (identifier != null) { 761 dst.identifier = new ArrayList<Identifier>(); 762 for (Identifier i : identifier) 763 dst.identifier.add(i.copy()); 764 }; 765 dst.active = active == null ? null : active.copy(); 766 dst.type = type == null ? null : type.copy(); 767 dst.name = name == null ? null : name.copy(); 768 if (telecom != null) { 769 dst.telecom = new ArrayList<ContactPoint>(); 770 for (ContactPoint i : telecom) 771 dst.telecom.add(i.copy()); 772 }; 773 if (address != null) { 774 dst.address = new ArrayList<Address>(); 775 for (Address i : address) 776 dst.address.add(i.copy()); 777 }; 778 dst.partOf = partOf == null ? null : partOf.copy(); 779 if (contact != null) { 780 dst.contact = new ArrayList<OrganizationContactComponent>(); 781 for (OrganizationContactComponent i : contact) 782 dst.contact.add(i.copy()); 783 }; 784 return dst; 785 } 786 787 protected Organization typedCopy() { 788 return copy(); 789 } 790 791 @Override 792 public boolean equalsDeep(Base other) { 793 if (!super.equalsDeep(other)) 794 return false; 795 if (!(other instanceof Organization)) 796 return false; 797 Organization o = (Organization) other; 798 return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(type, o.type, true) 799 && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) && compareDeep(address, o.address, true) 800 && compareDeep(partOf, o.partOf, true) && compareDeep(contact, o.contact, true); 801 } 802 803 @Override 804 public boolean equalsShallow(Base other) { 805 if (!super.equalsShallow(other)) 806 return false; 807 if (!(other instanceof Organization)) 808 return false; 809 Organization o = (Organization) other; 810 return compareValues(active, o.active, true) && compareValues(name, o.name, true); 811 } 812 813 public boolean isEmpty() { 814 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (active == null || active.isEmpty()) 815 && (type == null || type.isEmpty()) && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty()) 816 && (address == null || address.isEmpty()) && (partOf == null || partOf.isEmpty()) && (contact == null || contact.isEmpty()) 817 ; 818 } 819 820 @Override 821 public ResourceType getResourceType() { 822 return ResourceType.Organization; 823 } 824 825 @SearchParamDefinition(name="identifier", path="Organization.identifier", description="Any identifier for the organization (not the accreditation issuer's identifier)", type="token" ) 826 public static final String SP_IDENTIFIER = "identifier"; 827 @SearchParamDefinition(name="partof", path="Organization.partOf", description="Search all organizations that are part of the given organization", type="reference" ) 828 public static final String SP_PARTOF = "partof"; 829 @SearchParamDefinition(name="phonetic", path="Organization.name", description="A portion of the organization's name using some kind of phonetic matching algorithm", type="string" ) 830 public static final String SP_PHONETIC = "phonetic"; 831 @SearchParamDefinition(name="address", path="Organization.address", description="A (part of the) address of the Organization", type="string" ) 832 public static final String SP_ADDRESS = "address"; 833 @SearchParamDefinition(name="address-state", path="Organization.address.state", description="A state specified in an address", type="string" ) 834 public static final String SP_ADDRESSSTATE = "address-state"; 835 @SearchParamDefinition(name="name", path="Organization.name", description="A portion of the organization's name", type="string" ) 836 public static final String SP_NAME = "name"; 837 @SearchParamDefinition(name="address-use", path="Organization.address.use", description="A use code specified in an address", type="token" ) 838 public static final String SP_ADDRESSUSE = "address-use"; 839 @SearchParamDefinition(name="active", path="Organization.active", description="Whether the organization's record is active", type="token" ) 840 public static final String SP_ACTIVE = "active"; 841 @SearchParamDefinition(name="type", path="Organization.type", description="A code for the type of organization", type="token" ) 842 public static final String SP_TYPE = "type"; 843 @SearchParamDefinition(name="address-city", path="Organization.address.city", description="A city specified in an address", type="string" ) 844 public static final String SP_ADDRESSCITY = "address-city"; 845 @SearchParamDefinition(name="address-postalcode", path="Organization.address.postalCode", description="A postal code specified in an address", type="string" ) 846 public static final String SP_ADDRESSPOSTALCODE = "address-postalcode"; 847 @SearchParamDefinition(name="address-country", path="Organization.address.country", description="A country specified in an address", type="string" ) 848 public static final String SP_ADDRESSCOUNTRY = "address-country"; 849 850}