001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
040import org.hl7.fhir.r4.model.Enumerations.AdministrativeGenderEnumFactory;
041
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047
048/**
049 * Demographics and administrative information about a person independent of a
050 * specific health-related context.
051 */
052@ResourceDef(name = "Person", profile = "http://hl7.org/fhir/StructureDefinition/Person")
053public class Person extends DomainResource {
054
055  public enum IdentityAssuranceLevel {
056    /**
057     * Little or no confidence in the asserted identity's accuracy.
058     */
059    LEVEL1,
060    /**
061     * Some confidence in the asserted identity's accuracy.
062     */
063    LEVEL2,
064    /**
065     * High confidence in the asserted identity's accuracy.
066     */
067    LEVEL3,
068    /**
069     * Very high confidence in the asserted identity's accuracy.
070     */
071    LEVEL4,
072    /**
073     * added to help the parsers with the generic types
074     */
075    NULL;
076
077    public static IdentityAssuranceLevel fromCode(String codeString) throws FHIRException {
078      if (codeString == null || "".equals(codeString))
079        return null;
080      if ("level1".equals(codeString))
081        return LEVEL1;
082      if ("level2".equals(codeString))
083        return LEVEL2;
084      if ("level3".equals(codeString))
085        return LEVEL3;
086      if ("level4".equals(codeString))
087        return LEVEL4;
088      if (Configuration.isAcceptInvalidEnums())
089        return null;
090      else
091        throw new FHIRException("Unknown IdentityAssuranceLevel code '" + codeString + "'");
092    }
093
094    public String toCode() {
095      switch (this) {
096      case LEVEL1:
097        return "level1";
098      case LEVEL2:
099        return "level2";
100      case LEVEL3:
101        return "level3";
102      case LEVEL4:
103        return "level4";
104      case NULL:
105        return null;
106      default:
107        return "?";
108      }
109    }
110
111    public String getSystem() {
112      switch (this) {
113      case LEVEL1:
114        return "http://hl7.org/fhir/identity-assuranceLevel";
115      case LEVEL2:
116        return "http://hl7.org/fhir/identity-assuranceLevel";
117      case LEVEL3:
118        return "http://hl7.org/fhir/identity-assuranceLevel";
119      case LEVEL4:
120        return "http://hl7.org/fhir/identity-assuranceLevel";
121      case NULL:
122        return null;
123      default:
124        return "?";
125      }
126    }
127
128    public String getDefinition() {
129      switch (this) {
130      case LEVEL1:
131        return "Little or no confidence in the asserted identity's accuracy.";
132      case LEVEL2:
133        return "Some confidence in the asserted identity's accuracy.";
134      case LEVEL3:
135        return "High confidence in the asserted identity's accuracy.";
136      case LEVEL4:
137        return "Very high confidence in the asserted identity's accuracy.";
138      case NULL:
139        return null;
140      default:
141        return "?";
142      }
143    }
144
145    public String getDisplay() {
146      switch (this) {
147      case LEVEL1:
148        return "Level 1";
149      case LEVEL2:
150        return "Level 2";
151      case LEVEL3:
152        return "Level 3";
153      case LEVEL4:
154        return "Level 4";
155      case NULL:
156        return null;
157      default:
158        return "?";
159      }
160    }
161  }
162
163  public static class IdentityAssuranceLevelEnumFactory implements EnumFactory<IdentityAssuranceLevel> {
164    public IdentityAssuranceLevel fromCode(String codeString) throws IllegalArgumentException {
165      if (codeString == null || "".equals(codeString))
166        if (codeString == null || "".equals(codeString))
167          return null;
168      if ("level1".equals(codeString))
169        return IdentityAssuranceLevel.LEVEL1;
170      if ("level2".equals(codeString))
171        return IdentityAssuranceLevel.LEVEL2;
172      if ("level3".equals(codeString))
173        return IdentityAssuranceLevel.LEVEL3;
174      if ("level4".equals(codeString))
175        return IdentityAssuranceLevel.LEVEL4;
176      throw new IllegalArgumentException("Unknown IdentityAssuranceLevel code '" + codeString + "'");
177    }
178
179    public Enumeration<IdentityAssuranceLevel> fromType(PrimitiveType<?> code) throws FHIRException {
180      if (code == null)
181        return null;
182      if (code.isEmpty())
183        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.NULL, code);
184      String codeString = code.asStringValue();
185      if (codeString == null || "".equals(codeString))
186        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.NULL, code);
187      if ("level1".equals(codeString))
188        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.LEVEL1, code);
189      if ("level2".equals(codeString))
190        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.LEVEL2, code);
191      if ("level3".equals(codeString))
192        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.LEVEL3, code);
193      if ("level4".equals(codeString))
194        return new Enumeration<IdentityAssuranceLevel>(this, IdentityAssuranceLevel.LEVEL4, code);
195      throw new FHIRException("Unknown IdentityAssuranceLevel code '" + codeString + "'");
196    }
197
198    public String toCode(IdentityAssuranceLevel code) {
199      if (code == IdentityAssuranceLevel.LEVEL1)
200        return "level1";
201      if (code == IdentityAssuranceLevel.LEVEL2)
202        return "level2";
203      if (code == IdentityAssuranceLevel.LEVEL3)
204        return "level3";
205      if (code == IdentityAssuranceLevel.LEVEL4)
206        return "level4";
207      return "?";
208    }
209
210    public String toSystem(IdentityAssuranceLevel code) {
211      return code.getSystem();
212    }
213  }
214
215  @Block()
216  public static class PersonLinkComponent extends BackboneElement implements IBaseBackboneElement {
217    /**
218     * The resource to which this actual person is associated.
219     */
220    @Child(name = "target", type = { Patient.class, Practitioner.class, RelatedPerson.class,
221        Person.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
222    @Description(shortDefinition = "The resource to which this actual person is associated", formalDefinition = "The resource to which this actual person is associated.")
223    protected Reference target;
224
225    /**
226     * The actual object that is the target of the reference (The resource to which
227     * this actual person is associated.)
228     */
229    protected Resource targetTarget;
230
231    /**
232     * Level of assurance that this link is associated with the target resource.
233     */
234    @Child(name = "assurance", type = {
235        CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
236    @Description(shortDefinition = "level1 | level2 | level3 | level4", formalDefinition = "Level of assurance that this link is associated with the target resource.")
237    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/identity-assuranceLevel")
238    protected Enumeration<IdentityAssuranceLevel> assurance;
239
240    private static final long serialVersionUID = 508763647L;
241
242    /**
243     * Constructor
244     */
245    public PersonLinkComponent() {
246      super();
247    }
248
249    /**
250     * Constructor
251     */
252    public PersonLinkComponent(Reference target) {
253      super();
254      this.target = target;
255    }
256
257    /**
258     * @return {@link #target} (The resource to which this actual person is
259     *         associated.)
260     */
261    public Reference getTarget() {
262      if (this.target == null)
263        if (Configuration.errorOnAutoCreate())
264          throw new Error("Attempt to auto-create PersonLinkComponent.target");
265        else if (Configuration.doAutoCreate())
266          this.target = new Reference(); // cc
267      return this.target;
268    }
269
270    public boolean hasTarget() {
271      return this.target != null && !this.target.isEmpty();
272    }
273
274    /**
275     * @param value {@link #target} (The resource to which this actual person is
276     *              associated.)
277     */
278    public PersonLinkComponent setTarget(Reference value) {
279      this.target = value;
280      return this;
281    }
282
283    /**
284     * @return {@link #target} The actual object that is the target of the
285     *         reference. The reference library doesn't populate this, but you can
286     *         use it to hold the resource if you resolve it. (The resource to which
287     *         this actual person is associated.)
288     */
289    public Resource getTargetTarget() {
290      return this.targetTarget;
291    }
292
293    /**
294     * @param value {@link #target} The actual object that is the target of the
295     *              reference. The reference library doesn't use these, but you can
296     *              use it to hold the resource if you resolve it. (The resource to
297     *              which this actual person is associated.)
298     */
299    public PersonLinkComponent setTargetTarget(Resource value) {
300      this.targetTarget = value;
301      return this;
302    }
303
304    /**
305     * @return {@link #assurance} (Level of assurance that this link is associated
306     *         with the target resource.). This is the underlying object with id,
307     *         value and extensions. The accessor "getAssurance" gives direct access
308     *         to the value
309     */
310    public Enumeration<IdentityAssuranceLevel> getAssuranceElement() {
311      if (this.assurance == null)
312        if (Configuration.errorOnAutoCreate())
313          throw new Error("Attempt to auto-create PersonLinkComponent.assurance");
314        else if (Configuration.doAutoCreate())
315          this.assurance = new Enumeration<IdentityAssuranceLevel>(new IdentityAssuranceLevelEnumFactory()); // bb
316      return this.assurance;
317    }
318
319    public boolean hasAssuranceElement() {
320      return this.assurance != null && !this.assurance.isEmpty();
321    }
322
323    public boolean hasAssurance() {
324      return this.assurance != null && !this.assurance.isEmpty();
325    }
326
327    /**
328     * @param value {@link #assurance} (Level of assurance that this link is
329     *              associated with the target resource.). This is the underlying
330     *              object with id, value and extensions. The accessor
331     *              "getAssurance" gives direct access to the value
332     */
333    public PersonLinkComponent setAssuranceElement(Enumeration<IdentityAssuranceLevel> value) {
334      this.assurance = value;
335      return this;
336    }
337
338    /**
339     * @return Level of assurance that this link is associated with the target
340     *         resource.
341     */
342    public IdentityAssuranceLevel getAssurance() {
343      return this.assurance == null ? null : this.assurance.getValue();
344    }
345
346    /**
347     * @param value Level of assurance that this link is associated with the target
348     *              resource.
349     */
350    public PersonLinkComponent setAssurance(IdentityAssuranceLevel value) {
351      if (value == null)
352        this.assurance = null;
353      else {
354        if (this.assurance == null)
355          this.assurance = new Enumeration<IdentityAssuranceLevel>(new IdentityAssuranceLevelEnumFactory());
356        this.assurance.setValue(value);
357      }
358      return this;
359    }
360
361    protected void listChildren(List<Property> children) {
362      super.listChildren(children);
363      children.add(new Property("target", "Reference(Patient|Practitioner|RelatedPerson|Person)",
364          "The resource to which this actual person is associated.", 0, 1, target));
365      children.add(new Property("assurance", "code",
366          "Level of assurance that this link is associated with the target resource.", 0, 1, assurance));
367    }
368
369    @Override
370    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
371      switch (_hash) {
372      case -880905839:
373        /* target */ return new Property("target", "Reference(Patient|Practitioner|RelatedPerson|Person)",
374            "The resource to which this actual person is associated.", 0, 1, target);
375      case 1771900717:
376        /* assurance */ return new Property("assurance", "code",
377            "Level of assurance that this link is associated with the target resource.", 0, 1, assurance);
378      default:
379        return super.getNamedProperty(_hash, _name, _checkValid);
380      }
381
382    }
383
384    @Override
385    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
386      switch (hash) {
387      case -880905839:
388        /* target */ return this.target == null ? new Base[0] : new Base[] { this.target }; // Reference
389      case 1771900717:
390        /* assurance */ return this.assurance == null ? new Base[0] : new Base[] { this.assurance }; // Enumeration<IdentityAssuranceLevel>
391      default:
392        return super.getProperty(hash, name, checkValid);
393      }
394
395    }
396
397    @Override
398    public Base setProperty(int hash, String name, Base value) throws FHIRException {
399      switch (hash) {
400      case -880905839: // target
401        this.target = castToReference(value); // Reference
402        return value;
403      case 1771900717: // assurance
404        value = new IdentityAssuranceLevelEnumFactory().fromType(castToCode(value));
405        this.assurance = (Enumeration) value; // Enumeration<IdentityAssuranceLevel>
406        return value;
407      default:
408        return super.setProperty(hash, name, value);
409      }
410
411    }
412
413    @Override
414    public Base setProperty(String name, Base value) throws FHIRException {
415      if (name.equals("target")) {
416        this.target = castToReference(value); // Reference
417      } else if (name.equals("assurance")) {
418        value = new IdentityAssuranceLevelEnumFactory().fromType(castToCode(value));
419        this.assurance = (Enumeration) value; // Enumeration<IdentityAssuranceLevel>
420      } else
421        return super.setProperty(name, value);
422      return value;
423    }
424
425    @Override
426    public Base makeProperty(int hash, String name) throws FHIRException {
427      switch (hash) {
428      case -880905839:
429        return getTarget();
430      case 1771900717:
431        return getAssuranceElement();
432      default:
433        return super.makeProperty(hash, name);
434      }
435
436    }
437
438    @Override
439    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
440      switch (hash) {
441      case -880905839:
442        /* target */ return new String[] { "Reference" };
443      case 1771900717:
444        /* assurance */ return new String[] { "code" };
445      default:
446        return super.getTypesForProperty(hash, name);
447      }
448
449    }
450
451    @Override
452    public Base addChild(String name) throws FHIRException {
453      if (name.equals("target")) {
454        this.target = new Reference();
455        return this.target;
456      } else if (name.equals("assurance")) {
457        throw new FHIRException("Cannot call addChild on a singleton property Person.assurance");
458      } else
459        return super.addChild(name);
460    }
461
462    public PersonLinkComponent copy() {
463      PersonLinkComponent dst = new PersonLinkComponent();
464      copyValues(dst);
465      return dst;
466    }
467
468    public void copyValues(PersonLinkComponent dst) {
469      super.copyValues(dst);
470      dst.target = target == null ? null : target.copy();
471      dst.assurance = assurance == null ? null : assurance.copy();
472    }
473
474    @Override
475    public boolean equalsDeep(Base other_) {
476      if (!super.equalsDeep(other_))
477        return false;
478      if (!(other_ instanceof PersonLinkComponent))
479        return false;
480      PersonLinkComponent o = (PersonLinkComponent) other_;
481      return compareDeep(target, o.target, true) && compareDeep(assurance, o.assurance, true);
482    }
483
484    @Override
485    public boolean equalsShallow(Base other_) {
486      if (!super.equalsShallow(other_))
487        return false;
488      if (!(other_ instanceof PersonLinkComponent))
489        return false;
490      PersonLinkComponent o = (PersonLinkComponent) other_;
491      return compareValues(assurance, o.assurance, true);
492    }
493
494    public boolean isEmpty() {
495      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, assurance);
496    }
497
498    public String fhirType() {
499      return "Person.link";
500
501    }
502
503  }
504
505  /**
506   * Identifier for a person within a particular scope.
507   */
508  @Child(name = "identifier", type = {
509      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
510  @Description(shortDefinition = "A human identifier for this person", formalDefinition = "Identifier for a person within a particular scope.")
511  protected List<Identifier> identifier;
512
513  /**
514   * A name associated with the person.
515   */
516  @Child(name = "name", type = {
517      HumanName.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
518  @Description(shortDefinition = "A name associated with the person", formalDefinition = "A name associated with the person.")
519  protected List<HumanName> name;
520
521  /**
522   * A contact detail for the person, e.g. a telephone number or an email address.
523   */
524  @Child(name = "telecom", type = {
525      ContactPoint.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
526  @Description(shortDefinition = "A contact detail for the person", formalDefinition = "A contact detail for the person, e.g. a telephone number or an email address.")
527  protected List<ContactPoint> telecom;
528
529  /**
530   * Administrative Gender.
531   */
532  @Child(name = "gender", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
533  @Description(shortDefinition = "male | female | other | unknown", formalDefinition = "Administrative Gender.")
534  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/administrative-gender")
535  protected Enumeration<AdministrativeGender> gender;
536
537  /**
538   * The birth date for the person.
539   */
540  @Child(name = "birthDate", type = { DateType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
541  @Description(shortDefinition = "The date on which the person was born", formalDefinition = "The birth date for the person.")
542  protected DateType birthDate;
543
544  /**
545   * One or more addresses for the person.
546   */
547  @Child(name = "address", type = {
548      Address.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
549  @Description(shortDefinition = "One or more addresses for the person", formalDefinition = "One or more addresses for the person.")
550  protected List<Address> address;
551
552  /**
553   * An image that can be displayed as a thumbnail of the person to enhance the
554   * identification of the individual.
555   */
556  @Child(name = "photo", type = { Attachment.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
557  @Description(shortDefinition = "Image of the person", formalDefinition = "An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.")
558  protected Attachment photo;
559
560  /**
561   * The organization that is the custodian of the person record.
562   */
563  @Child(name = "managingOrganization", type = {
564      Organization.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
565  @Description(shortDefinition = "The organization that is the custodian of the person record", formalDefinition = "The organization that is the custodian of the person record.")
566  protected Reference managingOrganization;
567
568  /**
569   * The actual object that is the target of the reference (The organization that
570   * is the custodian of the person record.)
571   */
572  protected Organization managingOrganizationTarget;
573
574  /**
575   * Whether this person's record is in active use.
576   */
577  @Child(name = "active", type = { BooleanType.class }, order = 8, min = 0, max = 1, modifier = true, summary = true)
578  @Description(shortDefinition = "This person's record is in active use", formalDefinition = "Whether this person's record is in active use.")
579  protected BooleanType active;
580
581  /**
582   * Link to a resource that concerns the same actual person.
583   */
584  @Child(name = "link", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
585  @Description(shortDefinition = "Link to a resource that concerns the same actual person", formalDefinition = "Link to a resource that concerns the same actual person.")
586  protected List<PersonLinkComponent> link;
587
588  private static final long serialVersionUID = -117464654L;
589
590  /**
591   * Constructor
592   */
593  public Person() {
594    super();
595  }
596
597  /**
598   * @return {@link #identifier} (Identifier for a person within a particular
599   *         scope.)
600   */
601  public List<Identifier> getIdentifier() {
602    if (this.identifier == null)
603      this.identifier = new ArrayList<Identifier>();
604    return this.identifier;
605  }
606
607  /**
608   * @return Returns a reference to <code>this</code> for easy method chaining
609   */
610  public Person setIdentifier(List<Identifier> theIdentifier) {
611    this.identifier = theIdentifier;
612    return this;
613  }
614
615  public boolean hasIdentifier() {
616    if (this.identifier == null)
617      return false;
618    for (Identifier item : this.identifier)
619      if (!item.isEmpty())
620        return true;
621    return false;
622  }
623
624  public Identifier addIdentifier() { // 3
625    Identifier t = new Identifier();
626    if (this.identifier == null)
627      this.identifier = new ArrayList<Identifier>();
628    this.identifier.add(t);
629    return t;
630  }
631
632  public Person addIdentifier(Identifier t) { // 3
633    if (t == null)
634      return this;
635    if (this.identifier == null)
636      this.identifier = new ArrayList<Identifier>();
637    this.identifier.add(t);
638    return this;
639  }
640
641  /**
642   * @return The first repetition of repeating field {@link #identifier}, creating
643   *         it if it does not already exist
644   */
645  public Identifier getIdentifierFirstRep() {
646    if (getIdentifier().isEmpty()) {
647      addIdentifier();
648    }
649    return getIdentifier().get(0);
650  }
651
652  /**
653   * @return {@link #name} (A name associated with the person.)
654   */
655  public List<HumanName> getName() {
656    if (this.name == null)
657      this.name = new ArrayList<HumanName>();
658    return this.name;
659  }
660
661  /**
662   * @return Returns a reference to <code>this</code> for easy method chaining
663   */
664  public Person setName(List<HumanName> theName) {
665    this.name = theName;
666    return this;
667  }
668
669  public boolean hasName() {
670    if (this.name == null)
671      return false;
672    for (HumanName item : this.name)
673      if (!item.isEmpty())
674        return true;
675    return false;
676  }
677
678  public HumanName addName() { // 3
679    HumanName t = new HumanName();
680    if (this.name == null)
681      this.name = new ArrayList<HumanName>();
682    this.name.add(t);
683    return t;
684  }
685
686  public Person addName(HumanName t) { // 3
687    if (t == null)
688      return this;
689    if (this.name == null)
690      this.name = new ArrayList<HumanName>();
691    this.name.add(t);
692    return this;
693  }
694
695  /**
696   * @return The first repetition of repeating field {@link #name}, creating it if
697   *         it does not already exist
698   */
699  public HumanName getNameFirstRep() {
700    if (getName().isEmpty()) {
701      addName();
702    }
703    return getName().get(0);
704  }
705
706  /**
707   * @return {@link #telecom} (A contact detail for the person, e.g. a telephone
708   *         number or an email address.)
709   */
710  public List<ContactPoint> getTelecom() {
711    if (this.telecom == null)
712      this.telecom = new ArrayList<ContactPoint>();
713    return this.telecom;
714  }
715
716  /**
717   * @return Returns a reference to <code>this</code> for easy method chaining
718   */
719  public Person setTelecom(List<ContactPoint> theTelecom) {
720    this.telecom = theTelecom;
721    return this;
722  }
723
724  public boolean hasTelecom() {
725    if (this.telecom == null)
726      return false;
727    for (ContactPoint item : this.telecom)
728      if (!item.isEmpty())
729        return true;
730    return false;
731  }
732
733  public ContactPoint addTelecom() { // 3
734    ContactPoint t = new ContactPoint();
735    if (this.telecom == null)
736      this.telecom = new ArrayList<ContactPoint>();
737    this.telecom.add(t);
738    return t;
739  }
740
741  public Person addTelecom(ContactPoint t) { // 3
742    if (t == null)
743      return this;
744    if (this.telecom == null)
745      this.telecom = new ArrayList<ContactPoint>();
746    this.telecom.add(t);
747    return this;
748  }
749
750  /**
751   * @return The first repetition of repeating field {@link #telecom}, creating it
752   *         if it does not already exist
753   */
754  public ContactPoint getTelecomFirstRep() {
755    if (getTelecom().isEmpty()) {
756      addTelecom();
757    }
758    return getTelecom().get(0);
759  }
760
761  /**
762   * @return {@link #gender} (Administrative Gender.). This is the underlying
763   *         object with id, value and extensions. The accessor "getGender" gives
764   *         direct access to the value
765   */
766  public Enumeration<AdministrativeGender> getGenderElement() {
767    if (this.gender == null)
768      if (Configuration.errorOnAutoCreate())
769        throw new Error("Attempt to auto-create Person.gender");
770      else if (Configuration.doAutoCreate())
771        this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
772    return this.gender;
773  }
774
775  public boolean hasGenderElement() {
776    return this.gender != null && !this.gender.isEmpty();
777  }
778
779  public boolean hasGender() {
780    return this.gender != null && !this.gender.isEmpty();
781  }
782
783  /**
784   * @param value {@link #gender} (Administrative Gender.). This is the underlying
785   *              object with id, value and extensions. The accessor "getGender"
786   *              gives direct access to the value
787   */
788  public Person setGenderElement(Enumeration<AdministrativeGender> value) {
789    this.gender = value;
790    return this;
791  }
792
793  /**
794   * @return Administrative Gender.
795   */
796  public AdministrativeGender getGender() {
797    return this.gender == null ? null : this.gender.getValue();
798  }
799
800  /**
801   * @param value Administrative Gender.
802   */
803  public Person setGender(AdministrativeGender value) {
804    if (value == null)
805      this.gender = null;
806    else {
807      if (this.gender == null)
808        this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
809      this.gender.setValue(value);
810    }
811    return this;
812  }
813
814  /**
815   * @return {@link #birthDate} (The birth date for the person.). This is the
816   *         underlying object with id, value and extensions. The accessor
817   *         "getBirthDate" gives direct access to the value
818   */
819  public DateType getBirthDateElement() {
820    if (this.birthDate == null)
821      if (Configuration.errorOnAutoCreate())
822        throw new Error("Attempt to auto-create Person.birthDate");
823      else if (Configuration.doAutoCreate())
824        this.birthDate = new DateType(); // bb
825    return this.birthDate;
826  }
827
828  public boolean hasBirthDateElement() {
829    return this.birthDate != null && !this.birthDate.isEmpty();
830  }
831
832  public boolean hasBirthDate() {
833    return this.birthDate != null && !this.birthDate.isEmpty();
834  }
835
836  /**
837   * @param value {@link #birthDate} (The birth date for the person.). This is the
838   *              underlying object with id, value and extensions. The accessor
839   *              "getBirthDate" gives direct access to the value
840   */
841  public Person setBirthDateElement(DateType value) {
842    this.birthDate = value;
843    return this;
844  }
845
846  /**
847   * @return The birth date for the person.
848   */
849  public Date getBirthDate() {
850    return this.birthDate == null ? null : this.birthDate.getValue();
851  }
852
853  /**
854   * @param value The birth date for the person.
855   */
856  public Person setBirthDate(Date value) {
857    if (value == null)
858      this.birthDate = null;
859    else {
860      if (this.birthDate == null)
861        this.birthDate = new DateType();
862      this.birthDate.setValue(value);
863    }
864    return this;
865  }
866
867  /**
868   * @return {@link #address} (One or more addresses for the person.)
869   */
870  public List<Address> getAddress() {
871    if (this.address == null)
872      this.address = new ArrayList<Address>();
873    return this.address;
874  }
875
876  /**
877   * @return Returns a reference to <code>this</code> for easy method chaining
878   */
879  public Person setAddress(List<Address> theAddress) {
880    this.address = theAddress;
881    return this;
882  }
883
884  public boolean hasAddress() {
885    if (this.address == null)
886      return false;
887    for (Address item : this.address)
888      if (!item.isEmpty())
889        return true;
890    return false;
891  }
892
893  public Address addAddress() { // 3
894    Address t = new Address();
895    if (this.address == null)
896      this.address = new ArrayList<Address>();
897    this.address.add(t);
898    return t;
899  }
900
901  public Person addAddress(Address t) { // 3
902    if (t == null)
903      return this;
904    if (this.address == null)
905      this.address = new ArrayList<Address>();
906    this.address.add(t);
907    return this;
908  }
909
910  /**
911   * @return The first repetition of repeating field {@link #address}, creating it
912   *         if it does not already exist
913   */
914  public Address getAddressFirstRep() {
915    if (getAddress().isEmpty()) {
916      addAddress();
917    }
918    return getAddress().get(0);
919  }
920
921  /**
922   * @return {@link #photo} (An image that can be displayed as a thumbnail of the
923   *         person to enhance the identification of the individual.)
924   */
925  public Attachment getPhoto() {
926    if (this.photo == null)
927      if (Configuration.errorOnAutoCreate())
928        throw new Error("Attempt to auto-create Person.photo");
929      else if (Configuration.doAutoCreate())
930        this.photo = new Attachment(); // cc
931    return this.photo;
932  }
933
934  public boolean hasPhoto() {
935    return this.photo != null && !this.photo.isEmpty();
936  }
937
938  /**
939   * @param value {@link #photo} (An image that can be displayed as a thumbnail of
940   *              the person to enhance the identification of the individual.)
941   */
942  public Person setPhoto(Attachment value) {
943    this.photo = value;
944    return this;
945  }
946
947  /**
948   * @return {@link #managingOrganization} (The organization that is the custodian
949   *         of the person record.)
950   */
951  public Reference getManagingOrganization() {
952    if (this.managingOrganization == null)
953      if (Configuration.errorOnAutoCreate())
954        throw new Error("Attempt to auto-create Person.managingOrganization");
955      else if (Configuration.doAutoCreate())
956        this.managingOrganization = new Reference(); // cc
957    return this.managingOrganization;
958  }
959
960  public boolean hasManagingOrganization() {
961    return this.managingOrganization != null && !this.managingOrganization.isEmpty();
962  }
963
964  /**
965   * @param value {@link #managingOrganization} (The organization that is the
966   *              custodian of the person record.)
967   */
968  public Person setManagingOrganization(Reference value) {
969    this.managingOrganization = value;
970    return this;
971  }
972
973  /**
974   * @return {@link #managingOrganization} The actual object that is the target of
975   *         the reference. The reference library doesn't populate this, but you
976   *         can use it to hold the resource if you resolve it. (The organization
977   *         that is the custodian of the person record.)
978   */
979  public Organization getManagingOrganizationTarget() {
980    if (this.managingOrganizationTarget == null)
981      if (Configuration.errorOnAutoCreate())
982        throw new Error("Attempt to auto-create Person.managingOrganization");
983      else if (Configuration.doAutoCreate())
984        this.managingOrganizationTarget = new Organization(); // aa
985    return this.managingOrganizationTarget;
986  }
987
988  /**
989   * @param value {@link #managingOrganization} The actual object that is the
990   *              target of the reference. The reference library doesn't use
991   *              these, but you can use it to hold the resource if you resolve
992   *              it. (The organization that is the custodian of the person
993   *              record.)
994   */
995  public Person setManagingOrganizationTarget(Organization value) {
996    this.managingOrganizationTarget = value;
997    return this;
998  }
999
1000  /**
1001   * @return {@link #active} (Whether this person's record is in active use.).
1002   *         This is the underlying object with id, value and extensions. The
1003   *         accessor "getActive" gives direct access to the value
1004   */
1005  public BooleanType getActiveElement() {
1006    if (this.active == null)
1007      if (Configuration.errorOnAutoCreate())
1008        throw new Error("Attempt to auto-create Person.active");
1009      else if (Configuration.doAutoCreate())
1010        this.active = new BooleanType(); // bb
1011    return this.active;
1012  }
1013
1014  public boolean hasActiveElement() {
1015    return this.active != null && !this.active.isEmpty();
1016  }
1017
1018  public boolean hasActive() {
1019    return this.active != null && !this.active.isEmpty();
1020  }
1021
1022  /**
1023   * @param value {@link #active} (Whether this person's record is in active
1024   *              use.). This is the underlying object with id, value and
1025   *              extensions. The accessor "getActive" gives direct access to the
1026   *              value
1027   */
1028  public Person setActiveElement(BooleanType value) {
1029    this.active = value;
1030    return this;
1031  }
1032
1033  /**
1034   * @return Whether this person's record is in active use.
1035   */
1036  public boolean getActive() {
1037    return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
1038  }
1039
1040  /**
1041   * @param value Whether this person's record is in active use.
1042   */
1043  public Person setActive(boolean value) {
1044    if (this.active == null)
1045      this.active = new BooleanType();
1046    this.active.setValue(value);
1047    return this;
1048  }
1049
1050  /**
1051   * @return {@link #link} (Link to a resource that concerns the same actual
1052   *         person.)
1053   */
1054  public List<PersonLinkComponent> getLink() {
1055    if (this.link == null)
1056      this.link = new ArrayList<PersonLinkComponent>();
1057    return this.link;
1058  }
1059
1060  /**
1061   * @return Returns a reference to <code>this</code> for easy method chaining
1062   */
1063  public Person setLink(List<PersonLinkComponent> theLink) {
1064    this.link = theLink;
1065    return this;
1066  }
1067
1068  public boolean hasLink() {
1069    if (this.link == null)
1070      return false;
1071    for (PersonLinkComponent item : this.link)
1072      if (!item.isEmpty())
1073        return true;
1074    return false;
1075  }
1076
1077  public PersonLinkComponent addLink() { // 3
1078    PersonLinkComponent t = new PersonLinkComponent();
1079    if (this.link == null)
1080      this.link = new ArrayList<PersonLinkComponent>();
1081    this.link.add(t);
1082    return t;
1083  }
1084
1085  public Person addLink(PersonLinkComponent t) { // 3
1086    if (t == null)
1087      return this;
1088    if (this.link == null)
1089      this.link = new ArrayList<PersonLinkComponent>();
1090    this.link.add(t);
1091    return this;
1092  }
1093
1094  /**
1095   * @return The first repetition of repeating field {@link #link}, creating it if
1096   *         it does not already exist
1097   */
1098  public PersonLinkComponent getLinkFirstRep() {
1099    if (getLink().isEmpty()) {
1100      addLink();
1101    }
1102    return getLink().get(0);
1103  }
1104
1105  protected void listChildren(List<Property> children) {
1106    super.listChildren(children);
1107    children.add(new Property("identifier", "Identifier", "Identifier for a person within a particular scope.", 0,
1108        java.lang.Integer.MAX_VALUE, identifier));
1109    children.add(
1110        new Property("name", "HumanName", "A name associated with the person.", 0, java.lang.Integer.MAX_VALUE, name));
1111    children.add(new Property("telecom", "ContactPoint",
1112        "A contact detail for the person, e.g. a telephone number or an email address.", 0, java.lang.Integer.MAX_VALUE,
1113        telecom));
1114    children.add(new Property("gender", "code", "Administrative Gender.", 0, 1, gender));
1115    children.add(new Property("birthDate", "date", "The birth date for the person.", 0, 1, birthDate));
1116    children.add(new Property("address", "Address", "One or more addresses for the person.", 0,
1117        java.lang.Integer.MAX_VALUE, address));
1118    children.add(new Property("photo", "Attachment",
1119        "An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.",
1120        0, 1, photo));
1121    children.add(new Property("managingOrganization", "Reference(Organization)",
1122        "The organization that is the custodian of the person record.", 0, 1, managingOrganization));
1123    children.add(new Property("active", "boolean", "Whether this person's record is in active use.", 0, 1, active));
1124    children.add(new Property("link", "", "Link to a resource that concerns the same actual person.", 0,
1125        java.lang.Integer.MAX_VALUE, link));
1126  }
1127
1128  @Override
1129  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1130    switch (_hash) {
1131    case -1618432855:
1132      /* identifier */ return new Property("identifier", "Identifier",
1133          "Identifier for a person within a particular scope.", 0, java.lang.Integer.MAX_VALUE, identifier);
1134    case 3373707:
1135      /* name */ return new Property("name", "HumanName", "A name associated with the person.", 0,
1136          java.lang.Integer.MAX_VALUE, name);
1137    case -1429363305:
1138      /* telecom */ return new Property("telecom", "ContactPoint",
1139          "A contact detail for the person, e.g. a telephone number or an email address.", 0,
1140          java.lang.Integer.MAX_VALUE, telecom);
1141    case -1249512767:
1142      /* gender */ return new Property("gender", "code", "Administrative Gender.", 0, 1, gender);
1143    case -1210031859:
1144      /* birthDate */ return new Property("birthDate", "date", "The birth date for the person.", 0, 1, birthDate);
1145    case -1147692044:
1146      /* address */ return new Property("address", "Address", "One or more addresses for the person.", 0,
1147          java.lang.Integer.MAX_VALUE, address);
1148    case 106642994:
1149      /* photo */ return new Property("photo", "Attachment",
1150          "An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.",
1151          0, 1, photo);
1152    case -2058947787:
1153      /* managingOrganization */ return new Property("managingOrganization", "Reference(Organization)",
1154          "The organization that is the custodian of the person record.", 0, 1, managingOrganization);
1155    case -1422950650:
1156      /* active */ return new Property("active", "boolean", "Whether this person's record is in active use.", 0, 1,
1157          active);
1158    case 3321850:
1159      /* link */ return new Property("link", "", "Link to a resource that concerns the same actual person.", 0,
1160          java.lang.Integer.MAX_VALUE, link);
1161    default:
1162      return super.getNamedProperty(_hash, _name, _checkValid);
1163    }
1164
1165  }
1166
1167  @Override
1168  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1169    switch (hash) {
1170    case -1618432855:
1171      /* identifier */ return this.identifier == null ? new Base[0]
1172          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1173    case 3373707:
1174      /* name */ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // HumanName
1175    case -1429363305:
1176      /* telecom */ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
1177    case -1249512767:
1178      /* gender */ return this.gender == null ? new Base[0] : new Base[] { this.gender }; // Enumeration<AdministrativeGender>
1179    case -1210031859:
1180      /* birthDate */ return this.birthDate == null ? new Base[0] : new Base[] { this.birthDate }; // DateType
1181    case -1147692044:
1182      /* address */ return this.address == null ? new Base[0] : this.address.toArray(new Base[this.address.size()]); // Address
1183    case 106642994:
1184      /* photo */ return this.photo == null ? new Base[0] : new Base[] { this.photo }; // Attachment
1185    case -2058947787:
1186      /* managingOrganization */ return this.managingOrganization == null ? new Base[0]
1187          : new Base[] { this.managingOrganization }; // Reference
1188    case -1422950650:
1189      /* active */ return this.active == null ? new Base[0] : new Base[] { this.active }; // BooleanType
1190    case 3321850:
1191      /* link */ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // PersonLinkComponent
1192    default:
1193      return super.getProperty(hash, name, checkValid);
1194    }
1195
1196  }
1197
1198  @Override
1199  public Base setProperty(int hash, String name, Base value) throws FHIRException {
1200    switch (hash) {
1201    case -1618432855: // identifier
1202      this.getIdentifier().add(castToIdentifier(value)); // Identifier
1203      return value;
1204    case 3373707: // name
1205      this.getName().add(castToHumanName(value)); // HumanName
1206      return value;
1207    case -1429363305: // telecom
1208      this.getTelecom().add(castToContactPoint(value)); // ContactPoint
1209      return value;
1210    case -1249512767: // gender
1211      value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1212      this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1213      return value;
1214    case -1210031859: // birthDate
1215      this.birthDate = castToDate(value); // DateType
1216      return value;
1217    case -1147692044: // address
1218      this.getAddress().add(castToAddress(value)); // Address
1219      return value;
1220    case 106642994: // photo
1221      this.photo = castToAttachment(value); // Attachment
1222      return value;
1223    case -2058947787: // managingOrganization
1224      this.managingOrganization = castToReference(value); // Reference
1225      return value;
1226    case -1422950650: // active
1227      this.active = castToBoolean(value); // BooleanType
1228      return value;
1229    case 3321850: // link
1230      this.getLink().add((PersonLinkComponent) value); // PersonLinkComponent
1231      return value;
1232    default:
1233      return super.setProperty(hash, name, value);
1234    }
1235
1236  }
1237
1238  @Override
1239  public Base setProperty(String name, Base value) throws FHIRException {
1240    if (name.equals("identifier")) {
1241      this.getIdentifier().add(castToIdentifier(value));
1242    } else if (name.equals("name")) {
1243      this.getName().add(castToHumanName(value));
1244    } else if (name.equals("telecom")) {
1245      this.getTelecom().add(castToContactPoint(value));
1246    } else if (name.equals("gender")) {
1247      value = new AdministrativeGenderEnumFactory().fromType(castToCode(value));
1248      this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1249    } else if (name.equals("birthDate")) {
1250      this.birthDate = castToDate(value); // DateType
1251    } else if (name.equals("address")) {
1252      this.getAddress().add(castToAddress(value));
1253    } else if (name.equals("photo")) {
1254      this.photo = castToAttachment(value); // Attachment
1255    } else if (name.equals("managingOrganization")) {
1256      this.managingOrganization = castToReference(value); // Reference
1257    } else if (name.equals("active")) {
1258      this.active = castToBoolean(value); // BooleanType
1259    } else if (name.equals("link")) {
1260      this.getLink().add((PersonLinkComponent) value);
1261    } else
1262      return super.setProperty(name, value);
1263    return value;
1264  }
1265
1266  @Override
1267  public Base makeProperty(int hash, String name) throws FHIRException {
1268    switch (hash) {
1269    case -1618432855:
1270      return addIdentifier();
1271    case 3373707:
1272      return addName();
1273    case -1429363305:
1274      return addTelecom();
1275    case -1249512767:
1276      return getGenderElement();
1277    case -1210031859:
1278      return getBirthDateElement();
1279    case -1147692044:
1280      return addAddress();
1281    case 106642994:
1282      return getPhoto();
1283    case -2058947787:
1284      return getManagingOrganization();
1285    case -1422950650:
1286      return getActiveElement();
1287    case 3321850:
1288      return addLink();
1289    default:
1290      return super.makeProperty(hash, name);
1291    }
1292
1293  }
1294
1295  @Override
1296  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1297    switch (hash) {
1298    case -1618432855:
1299      /* identifier */ return new String[] { "Identifier" };
1300    case 3373707:
1301      /* name */ return new String[] { "HumanName" };
1302    case -1429363305:
1303      /* telecom */ return new String[] { "ContactPoint" };
1304    case -1249512767:
1305      /* gender */ return new String[] { "code" };
1306    case -1210031859:
1307      /* birthDate */ return new String[] { "date" };
1308    case -1147692044:
1309      /* address */ return new String[] { "Address" };
1310    case 106642994:
1311      /* photo */ return new String[] { "Attachment" };
1312    case -2058947787:
1313      /* managingOrganization */ return new String[] { "Reference" };
1314    case -1422950650:
1315      /* active */ return new String[] { "boolean" };
1316    case 3321850:
1317      /* link */ return new String[] {};
1318    default:
1319      return super.getTypesForProperty(hash, name);
1320    }
1321
1322  }
1323
1324  @Override
1325  public Base addChild(String name) throws FHIRException {
1326    if (name.equals("identifier")) {
1327      return addIdentifier();
1328    } else if (name.equals("name")) {
1329      return addName();
1330    } else if (name.equals("telecom")) {
1331      return addTelecom();
1332    } else if (name.equals("gender")) {
1333      throw new FHIRException("Cannot call addChild on a singleton property Person.gender");
1334    } else if (name.equals("birthDate")) {
1335      throw new FHIRException("Cannot call addChild on a singleton property Person.birthDate");
1336    } else if (name.equals("address")) {
1337      return addAddress();
1338    } else if (name.equals("photo")) {
1339      this.photo = new Attachment();
1340      return this.photo;
1341    } else if (name.equals("managingOrganization")) {
1342      this.managingOrganization = new Reference();
1343      return this.managingOrganization;
1344    } else if (name.equals("active")) {
1345      throw new FHIRException("Cannot call addChild on a singleton property Person.active");
1346    } else if (name.equals("link")) {
1347      return addLink();
1348    } else
1349      return super.addChild(name);
1350  }
1351
1352  public String fhirType() {
1353    return "Person";
1354
1355  }
1356
1357  public Person copy() {
1358    Person dst = new Person();
1359    copyValues(dst);
1360    return dst;
1361  }
1362
1363  public void copyValues(Person dst) {
1364    super.copyValues(dst);
1365    if (identifier != null) {
1366      dst.identifier = new ArrayList<Identifier>();
1367      for (Identifier i : identifier)
1368        dst.identifier.add(i.copy());
1369    }
1370    ;
1371    if (name != null) {
1372      dst.name = new ArrayList<HumanName>();
1373      for (HumanName i : name)
1374        dst.name.add(i.copy());
1375    }
1376    ;
1377    if (telecom != null) {
1378      dst.telecom = new ArrayList<ContactPoint>();
1379      for (ContactPoint i : telecom)
1380        dst.telecom.add(i.copy());
1381    }
1382    ;
1383    dst.gender = gender == null ? null : gender.copy();
1384    dst.birthDate = birthDate == null ? null : birthDate.copy();
1385    if (address != null) {
1386      dst.address = new ArrayList<Address>();
1387      for (Address i : address)
1388        dst.address.add(i.copy());
1389    }
1390    ;
1391    dst.photo = photo == null ? null : photo.copy();
1392    dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
1393    dst.active = active == null ? null : active.copy();
1394    if (link != null) {
1395      dst.link = new ArrayList<PersonLinkComponent>();
1396      for (PersonLinkComponent i : link)
1397        dst.link.add(i.copy());
1398    }
1399    ;
1400  }
1401
1402  protected Person typedCopy() {
1403    return copy();
1404  }
1405
1406  @Override
1407  public boolean equalsDeep(Base other_) {
1408    if (!super.equalsDeep(other_))
1409      return false;
1410    if (!(other_ instanceof Person))
1411      return false;
1412    Person o = (Person) other_;
1413    return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true)
1414        && compareDeep(telecom, o.telecom, true) && compareDeep(gender, o.gender, true)
1415        && compareDeep(birthDate, o.birthDate, true) && compareDeep(address, o.address, true)
1416        && compareDeep(photo, o.photo, true) && compareDeep(managingOrganization, o.managingOrganization, true)
1417        && compareDeep(active, o.active, true) && compareDeep(link, o.link, true);
1418  }
1419
1420  @Override
1421  public boolean equalsShallow(Base other_) {
1422    if (!super.equalsShallow(other_))
1423      return false;
1424    if (!(other_ instanceof Person))
1425      return false;
1426    Person o = (Person) other_;
1427    return compareValues(gender, o.gender, true) && compareValues(birthDate, o.birthDate, true)
1428        && compareValues(active, o.active, true);
1429  }
1430
1431  public boolean isEmpty() {
1432    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, name, telecom, gender, birthDate,
1433        address, photo, managingOrganization, active, link);
1434  }
1435
1436  @Override
1437  public ResourceType getResourceType() {
1438    return ResourceType.Person;
1439  }
1440
1441  /**
1442   * Search parameter: <b>identifier</b>
1443   * <p>
1444   * Description: <b>A person Identifier</b><br>
1445   * Type: <b>token</b><br>
1446   * Path: <b>Person.identifier</b><br>
1447   * </p>
1448   */
1449  @SearchParamDefinition(name = "identifier", path = "Person.identifier", description = "A person Identifier", type = "token")
1450  public static final String SP_IDENTIFIER = "identifier";
1451  /**
1452   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1453   * <p>
1454   * Description: <b>A person Identifier</b><br>
1455   * Type: <b>token</b><br>
1456   * Path: <b>Person.identifier</b><br>
1457   * </p>
1458   */
1459  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1460      SP_IDENTIFIER);
1461
1462  /**
1463   * Search parameter: <b>address</b>
1464   * <p>
1465   * Description: <b>A server defined search that may match any of the string
1466   * fields in the Address, including line, city, district, state, country,
1467   * postalCode, and/or text</b><br>
1468   * Type: <b>string</b><br>
1469   * Path: <b>Person.address</b><br>
1470   * </p>
1471   */
1472  @SearchParamDefinition(name = "address", path = "Person.address", description = "A server defined search that may match any of the string fields in the Address, including line, city, district, state, country, postalCode, and/or text", type = "string")
1473  public static final String SP_ADDRESS = "address";
1474  /**
1475   * <b>Fluent Client</b> search parameter constant for <b>address</b>
1476   * <p>
1477   * Description: <b>A server defined search that may match any of the string
1478   * fields in the Address, including line, city, district, state, country,
1479   * postalCode, and/or text</b><br>
1480   * Type: <b>string</b><br>
1481   * Path: <b>Person.address</b><br>
1482   * </p>
1483   */
1484  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(
1485      SP_ADDRESS);
1486
1487  /**
1488   * Search parameter: <b>birthdate</b>
1489   * <p>
1490   * Description: <b>The person's date of birth</b><br>
1491   * Type: <b>date</b><br>
1492   * Path: <b>Person.birthDate</b><br>
1493   * </p>
1494   */
1495  @SearchParamDefinition(name = "birthdate", path = "Person.birthDate", description = "The person's date of birth", type = "date")
1496  public static final String SP_BIRTHDATE = "birthdate";
1497  /**
1498   * <b>Fluent Client</b> search parameter constant for <b>birthdate</b>
1499   * <p>
1500   * Description: <b>The person's date of birth</b><br>
1501   * Type: <b>date</b><br>
1502   * Path: <b>Person.birthDate</b><br>
1503   * </p>
1504   */
1505  public static final ca.uhn.fhir.rest.gclient.DateClientParam BIRTHDATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
1506      SP_BIRTHDATE);
1507
1508  /**
1509   * Search parameter: <b>address-state</b>
1510   * <p>
1511   * Description: <b>A state specified in an address</b><br>
1512   * Type: <b>string</b><br>
1513   * Path: <b>Person.address.state</b><br>
1514   * </p>
1515   */
1516  @SearchParamDefinition(name = "address-state", path = "Person.address.state", description = "A state specified in an address", type = "string")
1517  public static final String SP_ADDRESS_STATE = "address-state";
1518  /**
1519   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
1520   * <p>
1521   * Description: <b>A state specified in an address</b><br>
1522   * Type: <b>string</b><br>
1523   * Path: <b>Person.address.state</b><br>
1524   * </p>
1525   */
1526  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(
1527      SP_ADDRESS_STATE);
1528
1529  /**
1530   * Search parameter: <b>gender</b>
1531   * <p>
1532   * Description: <b>The gender of the person</b><br>
1533   * Type: <b>token</b><br>
1534   * Path: <b>Person.gender</b><br>
1535   * </p>
1536   */
1537  @SearchParamDefinition(name = "gender", path = "Person.gender", description = "The gender of the person", type = "token")
1538  public static final String SP_GENDER = "gender";
1539  /**
1540   * <b>Fluent Client</b> search parameter constant for <b>gender</b>
1541   * <p>
1542   * Description: <b>The gender of the person</b><br>
1543   * Type: <b>token</b><br>
1544   * Path: <b>Person.gender</b><br>
1545   * </p>
1546   */
1547  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GENDER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1548      SP_GENDER);
1549
1550  /**
1551   * Search parameter: <b>practitioner</b>
1552   * <p>
1553   * Description: <b>The Person links to this Practitioner</b><br>
1554   * Type: <b>reference</b><br>
1555   * Path: <b>Person.link.target</b><br>
1556   * </p>
1557   */
1558  @SearchParamDefinition(name = "practitioner", path = "Person.link.target.where(resolve() is Practitioner)", description = "The Person links to this Practitioner", type = "reference", providesMembershipIn = {
1559      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class })
1560  public static final String SP_PRACTITIONER = "practitioner";
1561  /**
1562   * <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
1563   * <p>
1564   * Description: <b>The Person links to this Practitioner</b><br>
1565   * Type: <b>reference</b><br>
1566   * Path: <b>Person.link.target</b><br>
1567   * </p>
1568   */
1569  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1570      SP_PRACTITIONER);
1571
1572  /**
1573   * Constant for fluent queries to be used to add include statements. Specifies
1574   * the path value of "<b>Person:practitioner</b>".
1575   */
1576  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include(
1577      "Person:practitioner").toLocked();
1578
1579  /**
1580   * Search parameter: <b>link</b>
1581   * <p>
1582   * Description: <b>Any link has this Patient, Person, RelatedPerson or
1583   * Practitioner reference</b><br>
1584   * Type: <b>reference</b><br>
1585   * Path: <b>Person.link.target</b><br>
1586   * </p>
1587   */
1588  @SearchParamDefinition(name = "link", path = "Person.link.target", description = "Any link has this Patient, Person, RelatedPerson or Practitioner reference", type = "reference", providesMembershipIn = {
1589      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Patient.class, Person.class,
1590          Practitioner.class, RelatedPerson.class })
1591  public static final String SP_LINK = "link";
1592  /**
1593   * <b>Fluent Client</b> search parameter constant for <b>link</b>
1594   * <p>
1595   * Description: <b>Any link has this Patient, Person, RelatedPerson or
1596   * Practitioner reference</b><br>
1597   * Type: <b>reference</b><br>
1598   * Path: <b>Person.link.target</b><br>
1599   * </p>
1600   */
1601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LINK = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1602      SP_LINK);
1603
1604  /**
1605   * Constant for fluent queries to be used to add include statements. Specifies
1606   * the path value of "<b>Person:link</b>".
1607   */
1608  public static final ca.uhn.fhir.model.api.Include INCLUDE_LINK = new ca.uhn.fhir.model.api.Include("Person:link")
1609      .toLocked();
1610
1611  /**
1612   * Search parameter: <b>relatedperson</b>
1613   * <p>
1614   * Description: <b>The Person links to this RelatedPerson</b><br>
1615   * Type: <b>reference</b><br>
1616   * Path: <b>Person.link.target</b><br>
1617   * </p>
1618   */
1619  @SearchParamDefinition(name = "relatedperson", path = "Person.link.target.where(resolve() is RelatedPerson)", description = "The Person links to this RelatedPerson", type = "reference", target = {
1620      RelatedPerson.class })
1621  public static final String SP_RELATEDPERSON = "relatedperson";
1622  /**
1623   * <b>Fluent Client</b> search parameter constant for <b>relatedperson</b>
1624   * <p>
1625   * Description: <b>The Person links to this RelatedPerson</b><br>
1626   * Type: <b>reference</b><br>
1627   * Path: <b>Person.link.target</b><br>
1628   * </p>
1629   */
1630  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATEDPERSON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1631      SP_RELATEDPERSON);
1632
1633  /**
1634   * Constant for fluent queries to be used to add include statements. Specifies
1635   * the path value of "<b>Person:relatedperson</b>".
1636   */
1637  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATEDPERSON = new ca.uhn.fhir.model.api.Include(
1638      "Person:relatedperson").toLocked();
1639
1640  /**
1641   * Search parameter: <b>address-postalcode</b>
1642   * <p>
1643   * Description: <b>A postal code specified in an address</b><br>
1644   * Type: <b>string</b><br>
1645   * Path: <b>Person.address.postalCode</b><br>
1646   * </p>
1647   */
1648  @SearchParamDefinition(name = "address-postalcode", path = "Person.address.postalCode", description = "A postal code specified in an address", type = "string")
1649  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1650  /**
1651   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1652   * <p>
1653   * Description: <b>A postal code specified in an address</b><br>
1654   * Type: <b>string</b><br>
1655   * Path: <b>Person.address.postalCode</b><br>
1656   * </p>
1657   */
1658  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(
1659      SP_ADDRESS_POSTALCODE);
1660
1661  /**
1662   * Search parameter: <b>address-country</b>
1663   * <p>
1664   * Description: <b>A country specified in an address</b><br>
1665   * Type: <b>string</b><br>
1666   * Path: <b>Person.address.country</b><br>
1667   * </p>
1668   */
1669  @SearchParamDefinition(name = "address-country", path = "Person.address.country", description = "A country specified in an address", type = "string")
1670  public static final String SP_ADDRESS_COUNTRY = "address-country";
1671  /**
1672   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
1673   * <p>
1674   * Description: <b>A country specified in an address</b><br>
1675   * Type: <b>string</b><br>
1676   * Path: <b>Person.address.country</b><br>
1677   * </p>
1678   */
1679  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(
1680      SP_ADDRESS_COUNTRY);
1681
1682  /**
1683   * Search parameter: <b>phonetic</b>
1684   * <p>
1685   * Description: <b>A portion of name using some kind of phonetic matching
1686   * algorithm</b><br>
1687   * Type: <b>string</b><br>
1688   * Path: <b>Person.name</b><br>
1689   * </p>
1690   */
1691  @SearchParamDefinition(name = "phonetic", path = "Person.name", description = "A portion of name using some kind of phonetic matching algorithm", type = "string")
1692  public static final String SP_PHONETIC = "phonetic";
1693  /**
1694   * <b>Fluent Client</b> search parameter constant for <b>phonetic</b>
1695   * <p>
1696   * Description: <b>A portion of name using some kind of phonetic matching
1697   * algorithm</b><br>
1698   * Type: <b>string</b><br>
1699   * Path: <b>Person.name</b><br>
1700   * </p>
1701   */
1702  public static final ca.uhn.fhir.rest.gclient.StringClientParam PHONETIC = new ca.uhn.fhir.rest.gclient.StringClientParam(
1703      SP_PHONETIC);
1704
1705  /**
1706   * Search parameter: <b>phone</b>
1707   * <p>
1708   * Description: <b>A value in a phone contact</b><br>
1709   * Type: <b>token</b><br>
1710   * Path: <b>Person.telecom(system=phone)</b><br>
1711   * </p>
1712   */
1713  @SearchParamDefinition(name = "phone", path = "Person.telecom.where(system='phone')", description = "A value in a phone contact", type = "token")
1714  public static final String SP_PHONE = "phone";
1715  /**
1716   * <b>Fluent Client</b> search parameter constant for <b>phone</b>
1717   * <p>
1718   * Description: <b>A value in a phone contact</b><br>
1719   * Type: <b>token</b><br>
1720   * Path: <b>Person.telecom(system=phone)</b><br>
1721   * </p>
1722   */
1723  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PHONE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1724      SP_PHONE);
1725
1726  /**
1727   * Search parameter: <b>patient</b>
1728   * <p>
1729   * Description: <b>The Person links to this Patient</b><br>
1730   * Type: <b>reference</b><br>
1731   * Path: <b>Person.link.target</b><br>
1732   * </p>
1733   */
1734  @SearchParamDefinition(name = "patient", path = "Person.link.target.where(resolve() is Patient)", description = "The Person links to this Patient", type = "reference", providesMembershipIn = {
1735      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
1736  public static final String SP_PATIENT = "patient";
1737  /**
1738   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1739   * <p>
1740   * Description: <b>The Person links to this Patient</b><br>
1741   * Type: <b>reference</b><br>
1742   * Path: <b>Person.link.target</b><br>
1743   * </p>
1744   */
1745  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1746      SP_PATIENT);
1747
1748  /**
1749   * Constant for fluent queries to be used to add include statements. Specifies
1750   * the path value of "<b>Person:patient</b>".
1751   */
1752  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
1753      "Person:patient").toLocked();
1754
1755  /**
1756   * Search parameter: <b>organization</b>
1757   * <p>
1758   * Description: <b>The organization at which this person record is being
1759   * managed</b><br>
1760   * Type: <b>reference</b><br>
1761   * Path: <b>Person.managingOrganization</b><br>
1762   * </p>
1763   */
1764  @SearchParamDefinition(name = "organization", path = "Person.managingOrganization", description = "The organization at which this person record is being managed", type = "reference", target = {
1765      Organization.class })
1766  public static final String SP_ORGANIZATION = "organization";
1767  /**
1768   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1769   * <p>
1770   * Description: <b>The organization at which this person record is being
1771   * managed</b><br>
1772   * Type: <b>reference</b><br>
1773   * Path: <b>Person.managingOrganization</b><br>
1774   * </p>
1775   */
1776  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1777      SP_ORGANIZATION);
1778
1779  /**
1780   * Constant for fluent queries to be used to add include statements. Specifies
1781   * the path value of "<b>Person:organization</b>".
1782   */
1783  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include(
1784      "Person:organization").toLocked();
1785
1786  /**
1787   * Search parameter: <b>name</b>
1788   * <p>
1789   * Description: <b>A server defined search that may match any of the string
1790   * fields in the HumanName, including family, give, prefix, suffix, suffix,
1791   * and/or text</b><br>
1792   * Type: <b>string</b><br>
1793   * Path: <b>Person.name</b><br>
1794   * </p>
1795   */
1796  @SearchParamDefinition(name = "name", path = "Person.name", description = "A server defined search that may match any of the string fields in the HumanName, including family, give, prefix, suffix, suffix, and/or text", type = "string")
1797  public static final String SP_NAME = "name";
1798  /**
1799   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1800   * <p>
1801   * Description: <b>A server defined search that may match any of the string
1802   * fields in the HumanName, including family, give, prefix, suffix, suffix,
1803   * and/or text</b><br>
1804   * Type: <b>string</b><br>
1805   * Path: <b>Person.name</b><br>
1806   * </p>
1807   */
1808  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
1809      SP_NAME);
1810
1811  /**
1812   * Search parameter: <b>address-use</b>
1813   * <p>
1814   * Description: <b>A use code specified in an address</b><br>
1815   * Type: <b>token</b><br>
1816   * Path: <b>Person.address.use</b><br>
1817   * </p>
1818   */
1819  @SearchParamDefinition(name = "address-use", path = "Person.address.use", description = "A use code specified in an address", type = "token")
1820  public static final String SP_ADDRESS_USE = "address-use";
1821  /**
1822   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
1823   * <p>
1824   * Description: <b>A use code specified in an address</b><br>
1825   * Type: <b>token</b><br>
1826   * Path: <b>Person.address.use</b><br>
1827   * </p>
1828   */
1829  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1830      SP_ADDRESS_USE);
1831
1832  /**
1833   * Search parameter: <b>telecom</b>
1834   * <p>
1835   * Description: <b>The value in any kind of contact</b><br>
1836   * Type: <b>token</b><br>
1837   * Path: <b>Person.telecom</b><br>
1838   * </p>
1839   */
1840  @SearchParamDefinition(name = "telecom", path = "Person.telecom", description = "The value in any kind of contact", type = "token")
1841  public static final String SP_TELECOM = "telecom";
1842  /**
1843   * <b>Fluent Client</b> search parameter constant for <b>telecom</b>
1844   * <p>
1845   * Description: <b>The value in any kind of contact</b><br>
1846   * Type: <b>token</b><br>
1847   * Path: <b>Person.telecom</b><br>
1848   * </p>
1849   */
1850  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TELECOM = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1851      SP_TELECOM);
1852
1853  /**
1854   * Search parameter: <b>address-city</b>
1855   * <p>
1856   * Description: <b>A city specified in an address</b><br>
1857   * Type: <b>string</b><br>
1858   * Path: <b>Person.address.city</b><br>
1859   * </p>
1860   */
1861  @SearchParamDefinition(name = "address-city", path = "Person.address.city", description = "A city specified in an address", type = "string")
1862  public static final String SP_ADDRESS_CITY = "address-city";
1863  /**
1864   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
1865   * <p>
1866   * Description: <b>A city specified in an address</b><br>
1867   * Type: <b>string</b><br>
1868   * Path: <b>Person.address.city</b><br>
1869   * </p>
1870   */
1871  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(
1872      SP_ADDRESS_CITY);
1873
1874  /**
1875   * Search parameter: <b>email</b>
1876   * <p>
1877   * Description: <b>A value in an email contact</b><br>
1878   * Type: <b>token</b><br>
1879   * Path: <b>Person.telecom(system=email)</b><br>
1880   * </p>
1881   */
1882  @SearchParamDefinition(name = "email", path = "Person.telecom.where(system='email')", description = "A value in an email contact", type = "token")
1883  public static final String SP_EMAIL = "email";
1884  /**
1885   * <b>Fluent Client</b> search parameter constant for <b>email</b>
1886   * <p>
1887   * Description: <b>A value in an email contact</b><br>
1888   * Type: <b>token</b><br>
1889   * Path: <b>Person.telecom(system=email)</b><br>
1890   * </p>
1891   */
1892  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMAIL = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1893      SP_EMAIL);
1894
1895}