001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048/**
049 * 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.
050 */
051@ResourceDef(name="Organization", profile="http://hl7.org/fhir/Profile/Organization")
052public class Organization extends DomainResource {
053
054    @Block()
055    public static class OrganizationContactComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * Indicates a purpose for which the contact can be reached.
058         */
059        @Child(name = "purpose", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
060        @Description(shortDefinition="The type of contact", formalDefinition="Indicates a purpose for which the contact can be reached." )
061        protected CodeableConcept purpose;
062
063        /**
064         * A name associated with the contact.
065         */
066        @Child(name = "name", type = {HumanName.class}, order=2, min=0, max=1, modifier=false, summary=false)
067        @Description(shortDefinition="A name associated with the contact", formalDefinition="A name associated with the contact." )
068        protected HumanName name;
069
070        /**
071         * A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
072         */
073        @Child(name = "telecom", type = {ContactPoint.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
074        @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." )
075        protected List<ContactPoint> telecom;
076
077        /**
078         * Visiting or postal addresses for the contact.
079         */
080        @Child(name = "address", type = {Address.class}, order=4, min=0, max=1, modifier=false, summary=false)
081        @Description(shortDefinition="Visiting or postal addresses for the contact", formalDefinition="Visiting or postal addresses for the contact." )
082        protected Address address;
083
084        private static final long serialVersionUID = 1831121305L;
085
086    /**
087     * Constructor
088     */
089      public OrganizationContactComponent() {
090        super();
091      }
092
093        /**
094         * @return {@link #purpose} (Indicates a purpose for which the contact can be reached.)
095         */
096        public CodeableConcept getPurpose() { 
097          if (this.purpose == null)
098            if (Configuration.errorOnAutoCreate())
099              throw new Error("Attempt to auto-create OrganizationContactComponent.purpose");
100            else if (Configuration.doAutoCreate())
101              this.purpose = new CodeableConcept(); // cc
102          return this.purpose;
103        }
104
105        public boolean hasPurpose() { 
106          return this.purpose != null && !this.purpose.isEmpty();
107        }
108
109        /**
110         * @param value {@link #purpose} (Indicates a purpose for which the contact can be reached.)
111         */
112        public OrganizationContactComponent setPurpose(CodeableConcept value) { 
113          this.purpose = value;
114          return this;
115        }
116
117        /**
118         * @return {@link #name} (A name associated with the contact.)
119         */
120        public HumanName getName() { 
121          if (this.name == null)
122            if (Configuration.errorOnAutoCreate())
123              throw new Error("Attempt to auto-create OrganizationContactComponent.name");
124            else if (Configuration.doAutoCreate())
125              this.name = new HumanName(); // cc
126          return this.name;
127        }
128
129        public boolean hasName() { 
130          return this.name != null && !this.name.isEmpty();
131        }
132
133        /**
134         * @param value {@link #name} (A name associated with the contact.)
135         */
136        public OrganizationContactComponent setName(HumanName value) { 
137          this.name = value;
138          return this;
139        }
140
141        /**
142         * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.)
143         */
144        public List<ContactPoint> getTelecom() { 
145          if (this.telecom == null)
146            this.telecom = new ArrayList<ContactPoint>();
147          return this.telecom;
148        }
149
150        public boolean hasTelecom() { 
151          if (this.telecom == null)
152            return false;
153          for (ContactPoint item : this.telecom)
154            if (!item.isEmpty())
155              return true;
156          return false;
157        }
158
159        /**
160         * @return {@link #telecom} (A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.)
161         */
162    // syntactic sugar
163        public ContactPoint addTelecom() { //3
164          ContactPoint t = new ContactPoint();
165          if (this.telecom == null)
166            this.telecom = new ArrayList<ContactPoint>();
167          this.telecom.add(t);
168          return t;
169        }
170
171    // syntactic sugar
172        public OrganizationContactComponent addTelecom(ContactPoint t) { //3
173          if (t == null)
174            return this;
175          if (this.telecom == null)
176            this.telecom = new ArrayList<ContactPoint>();
177          this.telecom.add(t);
178          return this;
179        }
180
181        /**
182         * @return {@link #address} (Visiting or postal addresses for the contact.)
183         */
184        public Address getAddress() { 
185          if (this.address == null)
186            if (Configuration.errorOnAutoCreate())
187              throw new Error("Attempt to auto-create OrganizationContactComponent.address");
188            else if (Configuration.doAutoCreate())
189              this.address = new Address(); // cc
190          return this.address;
191        }
192
193        public boolean hasAddress() { 
194          return this.address != null && !this.address.isEmpty();
195        }
196
197        /**
198         * @param value {@link #address} (Visiting or postal addresses for the contact.)
199         */
200        public OrganizationContactComponent setAddress(Address value) { 
201          this.address = value;
202          return this;
203        }
204
205        protected void listChildren(List<Property> childrenList) {
206          super.listChildren(childrenList);
207          childrenList.add(new Property("purpose", "CodeableConcept", "Indicates a purpose for which the contact can be reached.", 0, java.lang.Integer.MAX_VALUE, purpose));
208          childrenList.add(new Property("name", "HumanName", "A name associated with the contact.", 0, java.lang.Integer.MAX_VALUE, name));
209          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));
210          childrenList.add(new Property("address", "Address", "Visiting or postal addresses for the contact.", 0, java.lang.Integer.MAX_VALUE, address));
211        }
212
213      @Override
214      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
215        switch (hash) {
216        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // CodeableConcept
217        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // HumanName
218        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
219        case -1147692044: /*address*/ return this.address == null ? new Base[0] : new Base[] {this.address}; // Address
220        default: return super.getProperty(hash, name, checkValid);
221        }
222
223      }
224
225      @Override
226      public void setProperty(int hash, String name, Base value) throws FHIRException {
227        switch (hash) {
228        case -220463842: // purpose
229          this.purpose = castToCodeableConcept(value); // CodeableConcept
230          break;
231        case 3373707: // name
232          this.name = castToHumanName(value); // HumanName
233          break;
234        case -1429363305: // telecom
235          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
236          break;
237        case -1147692044: // address
238          this.address = castToAddress(value); // Address
239          break;
240        default: super.setProperty(hash, name, value);
241        }
242
243      }
244
245      @Override
246      public void setProperty(String name, Base value) throws FHIRException {
247        if (name.equals("purpose"))
248          this.purpose = castToCodeableConcept(value); // CodeableConcept
249        else if (name.equals("name"))
250          this.name = castToHumanName(value); // HumanName
251        else if (name.equals("telecom"))
252          this.getTelecom().add(castToContactPoint(value));
253        else if (name.equals("address"))
254          this.address = castToAddress(value); // Address
255        else
256          super.setProperty(name, value);
257      }
258
259      @Override
260      public Base makeProperty(int hash, String name) throws FHIRException {
261        switch (hash) {
262        case -220463842:  return getPurpose(); // CodeableConcept
263        case 3373707:  return getName(); // HumanName
264        case -1429363305:  return addTelecom(); // ContactPoint
265        case -1147692044:  return getAddress(); // Address
266        default: return super.makeProperty(hash, name);
267        }
268
269      }
270
271      @Override
272      public Base addChild(String name) throws FHIRException {
273        if (name.equals("purpose")) {
274          this.purpose = new CodeableConcept();
275          return this.purpose;
276        }
277        else if (name.equals("name")) {
278          this.name = new HumanName();
279          return this.name;
280        }
281        else if (name.equals("telecom")) {
282          return addTelecom();
283        }
284        else if (name.equals("address")) {
285          this.address = new Address();
286          return this.address;
287        }
288        else
289          return super.addChild(name);
290      }
291
292      public OrganizationContactComponent copy() {
293        OrganizationContactComponent dst = new OrganizationContactComponent();
294        copyValues(dst);
295        dst.purpose = purpose == null ? null : purpose.copy();
296        dst.name = name == null ? null : name.copy();
297        if (telecom != null) {
298          dst.telecom = new ArrayList<ContactPoint>();
299          for (ContactPoint i : telecom)
300            dst.telecom.add(i.copy());
301        };
302        dst.address = address == null ? null : address.copy();
303        return dst;
304      }
305
306      @Override
307      public boolean equalsDeep(Base other) {
308        if (!super.equalsDeep(other))
309          return false;
310        if (!(other instanceof OrganizationContactComponent))
311          return false;
312        OrganizationContactComponent o = (OrganizationContactComponent) other;
313        return compareDeep(purpose, o.purpose, true) && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true)
314           && compareDeep(address, o.address, true);
315      }
316
317      @Override
318      public boolean equalsShallow(Base other) {
319        if (!super.equalsShallow(other))
320          return false;
321        if (!(other instanceof OrganizationContactComponent))
322          return false;
323        OrganizationContactComponent o = (OrganizationContactComponent) other;
324        return true;
325      }
326
327      public boolean isEmpty() {
328        return super.isEmpty() && (purpose == null || purpose.isEmpty()) && (name == null || name.isEmpty())
329           && (telecom == null || telecom.isEmpty()) && (address == null || address.isEmpty());
330      }
331
332  public String fhirType() {
333    return "Organization.contact";
334
335  }
336
337  }
338
339    /**
340     * Identifier for the organization that is used to identify the organization across multiple disparate systems.
341     */
342    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
343    @Description(shortDefinition="Identifies this organization  across multiple systems", formalDefinition="Identifier for the organization that is used to identify the organization across multiple disparate systems." )
344    protected List<Identifier> identifier;
345
346    /**
347     * Whether the organization's record is still in active use.
348     */
349    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
350    @Description(shortDefinition="Whether the organization's record is still in active use", formalDefinition="Whether the organization's record is still in active use." )
351    protected BooleanType active;
352
353    /**
354     * The kind of organization that this is.
355     */
356    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
357    @Description(shortDefinition="Kind of organization", formalDefinition="The kind of organization that this is." )
358    protected CodeableConcept type;
359
360    /**
361     * A name associated with the organization.
362     */
363    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
364    @Description(shortDefinition="Name used for the organization", formalDefinition="A name associated with the organization." )
365    protected StringType name;
366
367    /**
368     * A contact detail for the organization.
369     */
370    @Child(name = "telecom", type = {ContactPoint.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
371    @Description(shortDefinition="A contact detail for the organization", formalDefinition="A contact detail for the organization." )
372    protected List<ContactPoint> telecom;
373
374    /**
375     * An address for the organization.
376     */
377    @Child(name = "address", type = {Address.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
378    @Description(shortDefinition="An address for the organization", formalDefinition="An address for the organization." )
379    protected List<Address> address;
380
381    /**
382     * The organization of which this organization forms a part.
383     */
384    @Child(name = "partOf", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
385    @Description(shortDefinition="The organization of which this organization forms a part", formalDefinition="The organization of which this organization forms a part." )
386    protected Reference partOf;
387
388    /**
389     * The actual object that is the target of the reference (The organization of which this organization forms a part.)
390     */
391    protected Organization partOfTarget;
392
393    /**
394     * Contact for the organization for a certain purpose.
395     */
396    @Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
397    @Description(shortDefinition="Contact for the organization for a certain purpose", formalDefinition="Contact for the organization for a certain purpose." )
398    protected List<OrganizationContactComponent> contact;
399
400    private static final long serialVersionUID = -749567123L;
401
402  /**
403   * Constructor
404   */
405    public Organization() {
406      super();
407    }
408
409    /**
410     * @return {@link #identifier} (Identifier for the organization that is used to identify the organization across multiple disparate systems.)
411     */
412    public List<Identifier> getIdentifier() { 
413      if (this.identifier == null)
414        this.identifier = new ArrayList<Identifier>();
415      return this.identifier;
416    }
417
418    public boolean hasIdentifier() { 
419      if (this.identifier == null)
420        return false;
421      for (Identifier item : this.identifier)
422        if (!item.isEmpty())
423          return true;
424      return false;
425    }
426
427    /**
428     * @return {@link #identifier} (Identifier for the organization that is used to identify the organization across multiple disparate systems.)
429     */
430    // syntactic sugar
431    public Identifier addIdentifier() { //3
432      Identifier t = new Identifier();
433      if (this.identifier == null)
434        this.identifier = new ArrayList<Identifier>();
435      this.identifier.add(t);
436      return t;
437    }
438
439    // syntactic sugar
440    public Organization addIdentifier(Identifier t) { //3
441      if (t == null)
442        return this;
443      if (this.identifier == null)
444        this.identifier = new ArrayList<Identifier>();
445      this.identifier.add(t);
446      return this;
447    }
448
449    /**
450     * @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
451     */
452    public BooleanType getActiveElement() { 
453      if (this.active == null)
454        if (Configuration.errorOnAutoCreate())
455          throw new Error("Attempt to auto-create Organization.active");
456        else if (Configuration.doAutoCreate())
457          this.active = new BooleanType(); // bb
458      return this.active;
459    }
460
461    public boolean hasActiveElement() { 
462      return this.active != null && !this.active.isEmpty();
463    }
464
465    public boolean hasActive() { 
466      return this.active != null && !this.active.isEmpty();
467    }
468
469    /**
470     * @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
471     */
472    public Organization setActiveElement(BooleanType value) { 
473      this.active = value;
474      return this;
475    }
476
477    /**
478     * @return Whether the organization's record is still in active use.
479     */
480    public boolean getActive() { 
481      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
482    }
483
484    /**
485     * @param value Whether the organization's record is still in active use.
486     */
487    public Organization setActive(boolean value) { 
488        if (this.active == null)
489          this.active = new BooleanType();
490        this.active.setValue(value);
491      return this;
492    }
493
494    /**
495     * @return {@link #type} (The kind of organization that this is.)
496     */
497    public CodeableConcept getType() { 
498      if (this.type == null)
499        if (Configuration.errorOnAutoCreate())
500          throw new Error("Attempt to auto-create Organization.type");
501        else if (Configuration.doAutoCreate())
502          this.type = new CodeableConcept(); // cc
503      return this.type;
504    }
505
506    public boolean hasType() { 
507      return this.type != null && !this.type.isEmpty();
508    }
509
510    /**
511     * @param value {@link #type} (The kind of organization that this is.)
512     */
513    public Organization setType(CodeableConcept value) { 
514      this.type = value;
515      return this;
516    }
517
518    /**
519     * @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
520     */
521    public StringType getNameElement() { 
522      if (this.name == null)
523        if (Configuration.errorOnAutoCreate())
524          throw new Error("Attempt to auto-create Organization.name");
525        else if (Configuration.doAutoCreate())
526          this.name = new StringType(); // bb
527      return this.name;
528    }
529
530    public boolean hasNameElement() { 
531      return this.name != null && !this.name.isEmpty();
532    }
533
534    public boolean hasName() { 
535      return this.name != null && !this.name.isEmpty();
536    }
537
538    /**
539     * @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
540     */
541    public Organization setNameElement(StringType value) { 
542      this.name = value;
543      return this;
544    }
545
546    /**
547     * @return A name associated with the organization.
548     */
549    public String getName() { 
550      return this.name == null ? null : this.name.getValue();
551    }
552
553    /**
554     * @param value A name associated with the organization.
555     */
556    public Organization setName(String value) { 
557      if (Utilities.noString(value))
558        this.name = null;
559      else {
560        if (this.name == null)
561          this.name = new StringType();
562        this.name.setValue(value);
563      }
564      return this;
565    }
566
567    /**
568     * @return {@link #telecom} (A contact detail for the organization.)
569     */
570    public List<ContactPoint> getTelecom() { 
571      if (this.telecom == null)
572        this.telecom = new ArrayList<ContactPoint>();
573      return this.telecom;
574    }
575
576    public boolean hasTelecom() { 
577      if (this.telecom == null)
578        return false;
579      for (ContactPoint item : this.telecom)
580        if (!item.isEmpty())
581          return true;
582      return false;
583    }
584
585    /**
586     * @return {@link #telecom} (A contact detail for the organization.)
587     */
588    // syntactic sugar
589    public ContactPoint addTelecom() { //3
590      ContactPoint t = new ContactPoint();
591      if (this.telecom == null)
592        this.telecom = new ArrayList<ContactPoint>();
593      this.telecom.add(t);
594      return t;
595    }
596
597    // syntactic sugar
598    public Organization addTelecom(ContactPoint t) { //3
599      if (t == null)
600        return this;
601      if (this.telecom == null)
602        this.telecom = new ArrayList<ContactPoint>();
603      this.telecom.add(t);
604      return this;
605    }
606
607    /**
608     * @return {@link #address} (An address for the organization.)
609     */
610    public List<Address> getAddress() { 
611      if (this.address == null)
612        this.address = new ArrayList<Address>();
613      return this.address;
614    }
615
616    public boolean hasAddress() { 
617      if (this.address == null)
618        return false;
619      for (Address item : this.address)
620        if (!item.isEmpty())
621          return true;
622      return false;
623    }
624
625    /**
626     * @return {@link #address} (An address for the organization.)
627     */
628    // syntactic sugar
629    public Address addAddress() { //3
630      Address t = new Address();
631      if (this.address == null)
632        this.address = new ArrayList<Address>();
633      this.address.add(t);
634      return t;
635    }
636
637    // syntactic sugar
638    public Organization addAddress(Address t) { //3
639      if (t == null)
640        return this;
641      if (this.address == null)
642        this.address = new ArrayList<Address>();
643      this.address.add(t);
644      return this;
645    }
646
647    /**
648     * @return {@link #partOf} (The organization of which this organization forms a part.)
649     */
650    public Reference getPartOf() { 
651      if (this.partOf == null)
652        if (Configuration.errorOnAutoCreate())
653          throw new Error("Attempt to auto-create Organization.partOf");
654        else if (Configuration.doAutoCreate())
655          this.partOf = new Reference(); // cc
656      return this.partOf;
657    }
658
659    public boolean hasPartOf() { 
660      return this.partOf != null && !this.partOf.isEmpty();
661    }
662
663    /**
664     * @param value {@link #partOf} (The organization of which this organization forms a part.)
665     */
666    public Organization setPartOf(Reference value) { 
667      this.partOf = value;
668      return this;
669    }
670
671    /**
672     * @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.)
673     */
674    public Organization getPartOfTarget() { 
675      if (this.partOfTarget == null)
676        if (Configuration.errorOnAutoCreate())
677          throw new Error("Attempt to auto-create Organization.partOf");
678        else if (Configuration.doAutoCreate())
679          this.partOfTarget = new Organization(); // aa
680      return this.partOfTarget;
681    }
682
683    /**
684     * @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.)
685     */
686    public Organization setPartOfTarget(Organization value) { 
687      this.partOfTarget = value;
688      return this;
689    }
690
691    /**
692     * @return {@link #contact} (Contact for the organization for a certain purpose.)
693     */
694    public List<OrganizationContactComponent> getContact() { 
695      if (this.contact == null)
696        this.contact = new ArrayList<OrganizationContactComponent>();
697      return this.contact;
698    }
699
700    public boolean hasContact() { 
701      if (this.contact == null)
702        return false;
703      for (OrganizationContactComponent item : this.contact)
704        if (!item.isEmpty())
705          return true;
706      return false;
707    }
708
709    /**
710     * @return {@link #contact} (Contact for the organization for a certain purpose.)
711     */
712    // syntactic sugar
713    public OrganizationContactComponent addContact() { //3
714      OrganizationContactComponent t = new OrganizationContactComponent();
715      if (this.contact == null)
716        this.contact = new ArrayList<OrganizationContactComponent>();
717      this.contact.add(t);
718      return t;
719    }
720
721    // syntactic sugar
722    public Organization addContact(OrganizationContactComponent t) { //3
723      if (t == null)
724        return this;
725      if (this.contact == null)
726        this.contact = new ArrayList<OrganizationContactComponent>();
727      this.contact.add(t);
728      return this;
729    }
730
731      protected void listChildren(List<Property> childrenList) {
732        super.listChildren(childrenList);
733        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));
734        childrenList.add(new Property("active", "boolean", "Whether the organization's record is still in active use.", 0, java.lang.Integer.MAX_VALUE, active));
735        childrenList.add(new Property("type", "CodeableConcept", "The kind of organization that this is.", 0, java.lang.Integer.MAX_VALUE, type));
736        childrenList.add(new Property("name", "string", "A name associated with the organization.", 0, java.lang.Integer.MAX_VALUE, name));
737        childrenList.add(new Property("telecom", "ContactPoint", "A contact detail for the organization.", 0, java.lang.Integer.MAX_VALUE, telecom));
738        childrenList.add(new Property("address", "Address", "An address for the organization.", 0, java.lang.Integer.MAX_VALUE, address));
739        childrenList.add(new Property("partOf", "Reference(Organization)", "The organization of which this organization forms a part.", 0, java.lang.Integer.MAX_VALUE, partOf));
740        childrenList.add(new Property("contact", "", "Contact for the organization for a certain purpose.", 0, java.lang.Integer.MAX_VALUE, contact));
741      }
742
743      @Override
744      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
745        switch (hash) {
746        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
747        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
748        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
749        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
750        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
751        case -1147692044: /*address*/ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
752        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : new Base[] {this.partOf}; // Reference
753        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // OrganizationContactComponent
754        default: return super.getProperty(hash, name, checkValid);
755        }
756
757      }
758
759      @Override
760      public void setProperty(int hash, String name, Base value) throws FHIRException {
761        switch (hash) {
762        case -1618432855: // identifier
763          this.getIdentifier().add(castToIdentifier(value)); // Identifier
764          break;
765        case -1422950650: // active
766          this.active = castToBoolean(value); // BooleanType
767          break;
768        case 3575610: // type
769          this.type = castToCodeableConcept(value); // CodeableConcept
770          break;
771        case 3373707: // name
772          this.name = castToString(value); // StringType
773          break;
774        case -1429363305: // telecom
775          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
776          break;
777        case -1147692044: // address
778          this.getAddress().add(castToAddress(value)); // Address
779          break;
780        case -995410646: // partOf
781          this.partOf = castToReference(value); // Reference
782          break;
783        case 951526432: // contact
784          this.getContact().add((OrganizationContactComponent) value); // OrganizationContactComponent
785          break;
786        default: super.setProperty(hash, name, value);
787        }
788
789      }
790
791      @Override
792      public void setProperty(String name, Base value) throws FHIRException {
793        if (name.equals("identifier"))
794          this.getIdentifier().add(castToIdentifier(value));
795        else if (name.equals("active"))
796          this.active = castToBoolean(value); // BooleanType
797        else if (name.equals("type"))
798          this.type = castToCodeableConcept(value); // CodeableConcept
799        else if (name.equals("name"))
800          this.name = castToString(value); // StringType
801        else if (name.equals("telecom"))
802          this.getTelecom().add(castToContactPoint(value));
803        else if (name.equals("address"))
804          this.getAddress().add(castToAddress(value));
805        else if (name.equals("partOf"))
806          this.partOf = castToReference(value); // Reference
807        else if (name.equals("contact"))
808          this.getContact().add((OrganizationContactComponent) value);
809        else
810          super.setProperty(name, value);
811      }
812
813      @Override
814      public Base makeProperty(int hash, String name) throws FHIRException {
815        switch (hash) {
816        case -1618432855:  return addIdentifier(); // Identifier
817        case -1422950650: throw new FHIRException("Cannot make property active as it is not a complex type"); // BooleanType
818        case 3575610:  return getType(); // CodeableConcept
819        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
820        case -1429363305:  return addTelecom(); // ContactPoint
821        case -1147692044:  return addAddress(); // Address
822        case -995410646:  return getPartOf(); // Reference
823        case 951526432:  return addContact(); // OrganizationContactComponent
824        default: return super.makeProperty(hash, name);
825        }
826
827      }
828
829      @Override
830      public Base addChild(String name) throws FHIRException {
831        if (name.equals("identifier")) {
832          return addIdentifier();
833        }
834        else if (name.equals("active")) {
835          throw new FHIRException("Cannot call addChild on a primitive type Organization.active");
836        }
837        else if (name.equals("type")) {
838          this.type = new CodeableConcept();
839          return this.type;
840        }
841        else if (name.equals("name")) {
842          throw new FHIRException("Cannot call addChild on a primitive type Organization.name");
843        }
844        else if (name.equals("telecom")) {
845          return addTelecom();
846        }
847        else if (name.equals("address")) {
848          return addAddress();
849        }
850        else if (name.equals("partOf")) {
851          this.partOf = new Reference();
852          return this.partOf;
853        }
854        else if (name.equals("contact")) {
855          return addContact();
856        }
857        else
858          return super.addChild(name);
859      }
860
861  public String fhirType() {
862    return "Organization";
863
864  }
865
866      public Organization copy() {
867        Organization dst = new Organization();
868        copyValues(dst);
869        if (identifier != null) {
870          dst.identifier = new ArrayList<Identifier>();
871          for (Identifier i : identifier)
872            dst.identifier.add(i.copy());
873        };
874        dst.active = active == null ? null : active.copy();
875        dst.type = type == null ? null : type.copy();
876        dst.name = name == null ? null : name.copy();
877        if (telecom != null) {
878          dst.telecom = new ArrayList<ContactPoint>();
879          for (ContactPoint i : telecom)
880            dst.telecom.add(i.copy());
881        };
882        if (address != null) {
883          dst.address = new ArrayList<Address>();
884          for (Address i : address)
885            dst.address.add(i.copy());
886        };
887        dst.partOf = partOf == null ? null : partOf.copy();
888        if (contact != null) {
889          dst.contact = new ArrayList<OrganizationContactComponent>();
890          for (OrganizationContactComponent i : contact)
891            dst.contact.add(i.copy());
892        };
893        return dst;
894      }
895
896      protected Organization typedCopy() {
897        return copy();
898      }
899
900      @Override
901      public boolean equalsDeep(Base other) {
902        if (!super.equalsDeep(other))
903          return false;
904        if (!(other instanceof Organization))
905          return false;
906        Organization o = (Organization) other;
907        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(type, o.type, true)
908           && compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true) && compareDeep(address, o.address, true)
909           && compareDeep(partOf, o.partOf, true) && compareDeep(contact, o.contact, true);
910      }
911
912      @Override
913      public boolean equalsShallow(Base other) {
914        if (!super.equalsShallow(other))
915          return false;
916        if (!(other instanceof Organization))
917          return false;
918        Organization o = (Organization) other;
919        return compareValues(active, o.active, true) && compareValues(name, o.name, true);
920      }
921
922      public boolean isEmpty() {
923        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (active == null || active.isEmpty())
924           && (type == null || type.isEmpty()) && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
925           && (address == null || address.isEmpty()) && (partOf == null || partOf.isEmpty()) && (contact == null || contact.isEmpty())
926          ;
927      }
928
929  @Override
930  public ResourceType getResourceType() {
931    return ResourceType.Organization;
932   }
933
934 /**
935   * Search parameter: <b>address-state</b>
936   * <p>
937   * Description: <b>A state specified in an address</b><br>
938   * Type: <b>string</b><br>
939   * Path: <b>Organization.address.state</b><br>
940   * </p>
941   */
942  @SearchParamDefinition(name="address-state", path="Organization.address.state", description="A state specified in an address", type="string" )
943  public static final String SP_ADDRESS_STATE = "address-state";
944 /**
945   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
946   * <p>
947   * Description: <b>A state specified in an address</b><br>
948   * Type: <b>string</b><br>
949   * Path: <b>Organization.address.state</b><br>
950   * </p>
951   */
952  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
953
954 /**
955   * Search parameter: <b>address-city</b>
956   * <p>
957   * Description: <b>A city specified in an address</b><br>
958   * Type: <b>string</b><br>
959   * Path: <b>Organization.address.city</b><br>
960   * </p>
961   */
962  @SearchParamDefinition(name="address-city", path="Organization.address.city", description="A city specified in an address", type="string" )
963  public static final String SP_ADDRESS_CITY = "address-city";
964 /**
965   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
966   * <p>
967   * Description: <b>A city specified in an address</b><br>
968   * Type: <b>string</b><br>
969   * Path: <b>Organization.address.city</b><br>
970   * </p>
971   */
972  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
973
974 /**
975   * Search parameter: <b>phonetic</b>
976   * <p>
977   * Description: <b>A portion of the organization's name using some kind of phonetic matching algorithm</b><br>
978   * Type: <b>string</b><br>
979   * Path: <b>Organization.name</b><br>
980   * </p>
981   */
982  @SearchParamDefinition(name="phonetic", path="Organization.name", description="A portion of the organization's name using some kind of phonetic matching algorithm", type="string" )
983  public static final String SP_PHONETIC = "phonetic";
984 /**
985   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
986   * <p>
987   * Description: <b>A portion of the organization's name using some kind of phonetic matching algorithm</b><br>
988   * Type: <b>string</b><br>
989   * Path: <b>Organization.name</b><br>
990   * </p>
991   */
992  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PHONETIC);
993
994 /**
995   * Search parameter: <b>partof</b>
996   * <p>
997   * Description: <b>Search all organizations that are part of the given organization</b><br>
998   * Type: <b>reference</b><br>
999   * Path: <b>Organization.partOf</b><br>
1000   * </p>
1001   */
1002  @SearchParamDefinition(name="partof", path="Organization.partOf", description="Search all organizations that are part of the given organization", type="reference" )
1003  public static final String SP_PARTOF = "partof";
1004 /**
1005   * <b>Fluent Client</b> search parameter constant for <b>partof</b>
1006   * <p>
1007   * Description: <b>Search all organizations that are part of the given organization</b><br>
1008   * Type: <b>reference</b><br>
1009   * Path: <b>Organization.partOf</b><br>
1010   * </p>
1011   */
1012  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTOF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTOF);
1013
1014/**
1015   * Constant for fluent queries to be used to add include statements. Specifies
1016   * the path value of "<b>Organization:partof</b>".
1017   */
1018  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTOF = new ca.uhn.fhir.model.api.Include("Organization:partof").toLocked();
1019
1020 /**
1021   * Search parameter: <b>address</b>
1022   * <p>
1023   * Description: <b>A (part of the) address of the Organization</b><br>
1024   * Type: <b>string</b><br>
1025   * Path: <b>Organization.address</b><br>
1026   * </p>
1027   */
1028  @SearchParamDefinition(name="address", path="Organization.address", description="A (part of the) address of the Organization", type="string" )
1029  public static final String SP_ADDRESS = "address";
1030 /**
1031   * <b>Fluent Client</b> search parameter constant for <b>address</b>
1032   * <p>
1033   * Description: <b>A (part of the) address of the Organization</b><br>
1034   * Type: <b>string</b><br>
1035   * Path: <b>Organization.address</b><br>
1036   * </p>
1037   */
1038  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
1039
1040 /**
1041   * Search parameter: <b>address-use</b>
1042   * <p>
1043   * Description: <b>A use code specified in an address</b><br>
1044   * Type: <b>token</b><br>
1045   * Path: <b>Organization.address.use</b><br>
1046   * </p>
1047   */
1048  @SearchParamDefinition(name="address-use", path="Organization.address.use", description="A use code specified in an address", type="token" )
1049  public static final String SP_ADDRESS_USE = "address-use";
1050 /**
1051   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
1052   * <p>
1053   * Description: <b>A use code specified in an address</b><br>
1054   * Type: <b>token</b><br>
1055   * Path: <b>Organization.address.use</b><br>
1056   * </p>
1057   */
1058  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
1059
1060 /**
1061   * Search parameter: <b>name</b>
1062   * <p>
1063   * Description: <b>A portion of the organization's name</b><br>
1064   * Type: <b>string</b><br>
1065   * Path: <b>Organization.name</b><br>
1066   * </p>
1067   */
1068  @SearchParamDefinition(name="name", path="Organization.name", description="A portion of the organization's name", type="string" )
1069  public static final String SP_NAME = "name";
1070 /**
1071   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1072   * <p>
1073   * Description: <b>A portion of the organization's name</b><br>
1074   * Type: <b>string</b><br>
1075   * Path: <b>Organization.name</b><br>
1076   * </p>
1077   */
1078  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1079
1080 /**
1081   * Search parameter: <b>address-country</b>
1082   * <p>
1083   * Description: <b>A country specified in an address</b><br>
1084   * Type: <b>string</b><br>
1085   * Path: <b>Organization.address.country</b><br>
1086   * </p>
1087   */
1088  @SearchParamDefinition(name="address-country", path="Organization.address.country", description="A country specified in an address", type="string" )
1089  public static final String SP_ADDRESS_COUNTRY = "address-country";
1090 /**
1091   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
1092   * <p>
1093   * Description: <b>A country specified in an address</b><br>
1094   * Type: <b>string</b><br>
1095   * Path: <b>Organization.address.country</b><br>
1096   * </p>
1097   */
1098  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
1099
1100 /**
1101   * Search parameter: <b>active</b>
1102   * <p>
1103   * Description: <b>Whether the organization's record is active</b><br>
1104   * Type: <b>token</b><br>
1105   * Path: <b>Organization.active</b><br>
1106   * </p>
1107   */
1108  @SearchParamDefinition(name="active", path="Organization.active", description="Whether the organization's record is active", type="token" )
1109  public static final String SP_ACTIVE = "active";
1110 /**
1111   * <b>Fluent Client</b> search parameter constant for <b>active</b>
1112   * <p>
1113   * Description: <b>Whether the organization's record is active</b><br>
1114   * Type: <b>token</b><br>
1115   * Path: <b>Organization.active</b><br>
1116   * </p>
1117   */
1118  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTIVE);
1119
1120 /**
1121   * Search parameter: <b>type</b>
1122   * <p>
1123   * Description: <b>A code for the type of organization</b><br>
1124   * Type: <b>token</b><br>
1125   * Path: <b>Organization.type</b><br>
1126   * </p>
1127   */
1128  @SearchParamDefinition(name="type", path="Organization.type", description="A code for the type of organization", type="token" )
1129  public static final String SP_TYPE = "type";
1130 /**
1131   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1132   * <p>
1133   * Description: <b>A code for the type of organization</b><br>
1134   * Type: <b>token</b><br>
1135   * Path: <b>Organization.type</b><br>
1136   * </p>
1137   */
1138  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1139
1140 /**
1141   * Search parameter: <b>identifier</b>
1142   * <p>
1143   * Description: <b>Any identifier for the organization (not the accreditation issuer's identifier)</b><br>
1144   * Type: <b>token</b><br>
1145   * Path: <b>Organization.identifier</b><br>
1146   * </p>
1147   */
1148  @SearchParamDefinition(name="identifier", path="Organization.identifier", description="Any identifier for the organization (not the accreditation issuer's identifier)", type="token" )
1149  public static final String SP_IDENTIFIER = "identifier";
1150 /**
1151   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1152   * <p>
1153   * Description: <b>Any identifier for the organization (not the accreditation issuer's identifier)</b><br>
1154   * Type: <b>token</b><br>
1155   * Path: <b>Organization.identifier</b><br>
1156   * </p>
1157   */
1158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1159
1160 /**
1161   * Search parameter: <b>address-postalcode</b>
1162   * <p>
1163   * Description: <b>A postal code specified in an address</b><br>
1164   * Type: <b>string</b><br>
1165   * Path: <b>Organization.address.postalCode</b><br>
1166   * </p>
1167   */
1168  @SearchParamDefinition(name="address-postalcode", path="Organization.address.postalCode", description="A postal code specified in an address", type="string" )
1169  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1170 /**
1171   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1172   * <p>
1173   * Description: <b>A postal code specified in an address</b><br>
1174   * Type: <b>string</b><br>
1175   * Path: <b>Organization.address.postalCode</b><br>
1176   * </p>
1177   */
1178  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
1179
1180
1181}