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.DocumentReferenceStatus;
040import org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatusEnumFactory;
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/**
050 * A collection of documents compiled for a purpose together with metadata that
051 * applies to the collection.
052 */
053@ResourceDef(name = "DocumentManifest", profile = "http://hl7.org/fhir/StructureDefinition/DocumentManifest")
054public class DocumentManifest extends DomainResource {
055
056  @Block()
057  public static class DocumentManifestRelatedComponent extends BackboneElement implements IBaseBackboneElement {
058    /**
059     * Related identifier to this DocumentManifest. For example, Order numbers,
060     * accession numbers, XDW workflow numbers.
061     */
062    @Child(name = "identifier", type = {
063        Identifier.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
064    @Description(shortDefinition = "Identifiers of things that are related", formalDefinition = "Related identifier to this DocumentManifest.  For example, Order numbers, accession numbers, XDW workflow numbers.")
065    protected Identifier identifier;
066
067    /**
068     * Related Resource to this DocumentManifest. For example, Order,
069     * ServiceRequest, Procedure, EligibilityRequest, etc.
070     */
071    @Child(name = "ref", type = { Reference.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
072    @Description(shortDefinition = "Related Resource", formalDefinition = "Related Resource to this DocumentManifest. For example, Order, ServiceRequest,  Procedure, EligibilityRequest, etc.")
073    protected Reference ref;
074
075    /**
076     * The actual object that is the target of the reference (Related Resource to
077     * this DocumentManifest. For example, Order, ServiceRequest, Procedure,
078     * EligibilityRequest, etc.)
079     */
080    protected Resource refTarget;
081
082    private static final long serialVersionUID = -1670123330L;
083
084    /**
085     * Constructor
086     */
087    public DocumentManifestRelatedComponent() {
088      super();
089    }
090
091    /**
092     * @return {@link #identifier} (Related identifier to this DocumentManifest. For
093     *         example, Order numbers, accession numbers, XDW workflow numbers.)
094     */
095    public Identifier getIdentifier() {
096      if (this.identifier == null)
097        if (Configuration.errorOnAutoCreate())
098          throw new Error("Attempt to auto-create DocumentManifestRelatedComponent.identifier");
099        else if (Configuration.doAutoCreate())
100          this.identifier = new Identifier(); // cc
101      return this.identifier;
102    }
103
104    public boolean hasIdentifier() {
105      return this.identifier != null && !this.identifier.isEmpty();
106    }
107
108    /**
109     * @param value {@link #identifier} (Related identifier to this
110     *              DocumentManifest. For example, Order numbers, accession numbers,
111     *              XDW workflow numbers.)
112     */
113    public DocumentManifestRelatedComponent setIdentifier(Identifier value) {
114      this.identifier = value;
115      return this;
116    }
117
118    /**
119     * @return {@link #ref} (Related Resource to this DocumentManifest. For example,
120     *         Order, ServiceRequest, Procedure, EligibilityRequest, etc.)
121     */
122    public Reference getRef() {
123      if (this.ref == null)
124        if (Configuration.errorOnAutoCreate())
125          throw new Error("Attempt to auto-create DocumentManifestRelatedComponent.ref");
126        else if (Configuration.doAutoCreate())
127          this.ref = new Reference(); // cc
128      return this.ref;
129    }
130
131    public boolean hasRef() {
132      return this.ref != null && !this.ref.isEmpty();
133    }
134
135    /**
136     * @param value {@link #ref} (Related Resource to this DocumentManifest. For
137     *              example, Order, ServiceRequest, Procedure, EligibilityRequest,
138     *              etc.)
139     */
140    public DocumentManifestRelatedComponent setRef(Reference value) {
141      this.ref = value;
142      return this;
143    }
144
145    /**
146     * @return {@link #ref} The actual object that is the target of the reference.
147     *         The reference library doesn't populate this, but you can use it to
148     *         hold the resource if you resolve it. (Related Resource to this
149     *         DocumentManifest. For example, Order, ServiceRequest, Procedure,
150     *         EligibilityRequest, etc.)
151     */
152    public Resource getRefTarget() {
153      return this.refTarget;
154    }
155
156    /**
157     * @param value {@link #ref} The actual object that is the target of the
158     *              reference. The reference library doesn't use these, but you can
159     *              use it to hold the resource if you resolve it. (Related Resource
160     *              to this DocumentManifest. For example, Order, ServiceRequest,
161     *              Procedure, EligibilityRequest, etc.)
162     */
163    public DocumentManifestRelatedComponent setRefTarget(Resource value) {
164      this.refTarget = value;
165      return this;
166    }
167
168    protected void listChildren(List<Property> children) {
169      super.listChildren(children);
170      children.add(new Property("identifier", "Identifier",
171          "Related identifier to this DocumentManifest.  For example, Order numbers, accession numbers, XDW workflow numbers.",
172          0, 1, identifier));
173      children.add(new Property("ref", "Reference(Any)",
174          "Related Resource to this DocumentManifest. For example, Order, ServiceRequest,  Procedure, EligibilityRequest, etc.",
175          0, 1, ref));
176    }
177
178    @Override
179    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
180      switch (_hash) {
181      case -1618432855:
182        /* identifier */ return new Property("identifier", "Identifier",
183            "Related identifier to this DocumentManifest.  For example, Order numbers, accession numbers, XDW workflow numbers.",
184            0, 1, identifier);
185      case 112787:
186        /* ref */ return new Property("ref", "Reference(Any)",
187            "Related Resource to this DocumentManifest. For example, Order, ServiceRequest,  Procedure, EligibilityRequest, etc.",
188            0, 1, ref);
189      default:
190        return super.getNamedProperty(_hash, _name, _checkValid);
191      }
192
193    }
194
195    @Override
196    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
197      switch (hash) {
198      case -1618432855:
199        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
200      case 112787:
201        /* ref */ return this.ref == null ? new Base[0] : new Base[] { this.ref }; // Reference
202      default:
203        return super.getProperty(hash, name, checkValid);
204      }
205
206    }
207
208    @Override
209    public Base setProperty(int hash, String name, Base value) throws FHIRException {
210      switch (hash) {
211      case -1618432855: // identifier
212        this.identifier = castToIdentifier(value); // Identifier
213        return value;
214      case 112787: // ref
215        this.ref = castToReference(value); // Reference
216        return value;
217      default:
218        return super.setProperty(hash, name, value);
219      }
220
221    }
222
223    @Override
224    public Base setProperty(String name, Base value) throws FHIRException {
225      if (name.equals("identifier")) {
226        this.identifier = castToIdentifier(value); // Identifier
227      } else if (name.equals("ref")) {
228        this.ref = castToReference(value); // Reference
229      } else
230        return super.setProperty(name, value);
231      return value;
232    }
233
234    @Override
235    public Base makeProperty(int hash, String name) throws FHIRException {
236      switch (hash) {
237      case -1618432855:
238        return getIdentifier();
239      case 112787:
240        return getRef();
241      default:
242        return super.makeProperty(hash, name);
243      }
244
245    }
246
247    @Override
248    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
249      switch (hash) {
250      case -1618432855:
251        /* identifier */ return new String[] { "Identifier" };
252      case 112787:
253        /* ref */ return new String[] { "Reference" };
254      default:
255        return super.getTypesForProperty(hash, name);
256      }
257
258    }
259
260    @Override
261    public Base addChild(String name) throws FHIRException {
262      if (name.equals("identifier")) {
263        this.identifier = new Identifier();
264        return this.identifier;
265      } else if (name.equals("ref")) {
266        this.ref = new Reference();
267        return this.ref;
268      } else
269        return super.addChild(name);
270    }
271
272    public DocumentManifestRelatedComponent copy() {
273      DocumentManifestRelatedComponent dst = new DocumentManifestRelatedComponent();
274      copyValues(dst);
275      return dst;
276    }
277
278    public void copyValues(DocumentManifestRelatedComponent dst) {
279      super.copyValues(dst);
280      dst.identifier = identifier == null ? null : identifier.copy();
281      dst.ref = ref == null ? null : ref.copy();
282    }
283
284    @Override
285    public boolean equalsDeep(Base other_) {
286      if (!super.equalsDeep(other_))
287        return false;
288      if (!(other_ instanceof DocumentManifestRelatedComponent))
289        return false;
290      DocumentManifestRelatedComponent o = (DocumentManifestRelatedComponent) other_;
291      return compareDeep(identifier, o.identifier, true) && compareDeep(ref, o.ref, true);
292    }
293
294    @Override
295    public boolean equalsShallow(Base other_) {
296      if (!super.equalsShallow(other_))
297        return false;
298      if (!(other_ instanceof DocumentManifestRelatedComponent))
299        return false;
300      DocumentManifestRelatedComponent o = (DocumentManifestRelatedComponent) other_;
301      return true;
302    }
303
304    public boolean isEmpty() {
305      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, ref);
306    }
307
308    public String fhirType() {
309      return "DocumentManifest.related";
310
311    }
312
313  }
314
315  /**
316   * A single identifier that uniquely identifies this manifest. Principally used
317   * to refer to the manifest in non-FHIR contexts.
318   */
319  @Child(name = "masterIdentifier", type = {
320      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
321  @Description(shortDefinition = "Unique Identifier for the set of documents", formalDefinition = "A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.")
322  protected Identifier masterIdentifier;
323
324  /**
325   * Other identifiers associated with the document manifest, including version
326   * independent identifiers.
327   */
328  @Child(name = "identifier", type = {
329      Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
330  @Description(shortDefinition = "Other identifiers for the manifest", formalDefinition = "Other identifiers associated with the document manifest, including version independent  identifiers.")
331  protected List<Identifier> identifier;
332
333  /**
334   * The status of this document manifest.
335   */
336  @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
337  @Description(shortDefinition = "current | superseded | entered-in-error", formalDefinition = "The status of this document manifest.")
338  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/document-reference-status")
339  protected Enumeration<DocumentReferenceStatus> status;
340
341  /**
342   * The code specifying the type of clinical activity that resulted in placing
343   * the associated content into the DocumentManifest.
344   */
345  @Child(name = "type", type = { CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
346  @Description(shortDefinition = "Kind of document set", formalDefinition = "The code specifying the type of clinical activity that resulted in placing the associated content into the DocumentManifest.")
347  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActCode")
348  protected CodeableConcept type;
349
350  /**
351   * Who or what the set of documents is about. The documents can be about a
352   * person, (patient or healthcare practitioner), a device (i.e. machine) or even
353   * a group of subjects (such as a document about a herd of farm animals, or a
354   * set of patients that share a common exposure). If the documents cross more
355   * than one subject, then more than one subject is allowed here (unusual use
356   * case).
357   */
358  @Child(name = "subject", type = { Patient.class, Practitioner.class, Group.class,
359      Device.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
360  @Description(shortDefinition = "The subject of the set of documents", formalDefinition = "Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).")
361  protected Reference subject;
362
363  /**
364   * The actual object that is the target of the reference (Who or what the set of
365   * documents is about. The documents can be about a person, (patient or
366   * healthcare practitioner), a device (i.e. machine) or even a group of subjects
367   * (such as a document about a herd of farm animals, or a set of patients that
368   * share a common exposure). If the documents cross more than one subject, then
369   * more than one subject is allowed here (unusual use case).)
370   */
371  protected Resource subjectTarget;
372
373  /**
374   * When the document manifest was created for submission to the server (not
375   * necessarily the same thing as the actual resource last modified time, since
376   * it may be modified, replicated, etc.).
377   */
378  @Child(name = "created", type = {
379      DateTimeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
380  @Description(shortDefinition = "When this document manifest created", formalDefinition = "When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated, etc.).")
381  protected DateTimeType created;
382
383  /**
384   * Identifies who is the author of the manifest. Manifest author is not
385   * necessarly the author of the references included.
386   */
387  @Child(name = "author", type = { Practitioner.class, PractitionerRole.class, Organization.class, Device.class,
388      Patient.class,
389      RelatedPerson.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
390  @Description(shortDefinition = "Who and/or what authored the DocumentManifest", formalDefinition = "Identifies who is the author of the manifest. Manifest author is not necessarly the author of the references included.")
391  protected List<Reference> author;
392  /**
393   * The actual objects that are the target of the reference (Identifies who is
394   * the author of the manifest. Manifest author is not necessarly the author of
395   * the references included.)
396   */
397  protected List<Resource> authorTarget;
398
399  /**
400   * A patient, practitioner, or organization for which this set of documents is
401   * intended.
402   */
403  @Child(name = "recipient", type = { Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class,
404      Organization.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
405  @Description(shortDefinition = "Intended to get notified about this set of documents", formalDefinition = "A patient, practitioner, or organization for which this set of documents is intended.")
406  protected List<Reference> recipient;
407  /**
408   * The actual objects that are the target of the reference (A patient,
409   * practitioner, or organization for which this set of documents is intended.)
410   */
411  protected List<Resource> recipientTarget;
412
413  /**
414   * Identifies the source system, application, or software that produced the
415   * document manifest.
416   */
417  @Child(name = "source", type = { UriType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
418  @Description(shortDefinition = "The source system/application/software", formalDefinition = "Identifies the source system, application, or software that produced the document manifest.")
419  protected UriType source;
420
421  /**
422   * Human-readable description of the source document. This is sometimes known as
423   * the "title".
424   */
425  @Child(name = "description", type = {
426      StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
427  @Description(shortDefinition = "Human-readable description (title)", formalDefinition = "Human-readable description of the source document. This is sometimes known as the \"title\".")
428  protected StringType description;
429
430  /**
431   * The list of Resources that consist of the parts of this manifest.
432   */
433  @Child(name = "content", type = {
434      Reference.class }, order = 10, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
435  @Description(shortDefinition = "Items in manifest", formalDefinition = "The list of Resources that consist of the parts of this manifest.")
436  protected List<Reference> content;
437  /**
438   * The actual objects that are the target of the reference (The list of
439   * Resources that consist of the parts of this manifest.)
440   */
441  protected List<Resource> contentTarget;
442
443  /**
444   * Related identifiers or resources associated with the DocumentManifest.
445   */
446  @Child(name = "related", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
447  @Description(shortDefinition = "Related things", formalDefinition = "Related identifiers or resources associated with the DocumentManifest.")
448  protected List<DocumentManifestRelatedComponent> related;
449
450  private static final long serialVersionUID = 432971934L;
451
452  /**
453   * Constructor
454   */
455  public DocumentManifest() {
456    super();
457  }
458
459  /**
460   * Constructor
461   */
462  public DocumentManifest(Enumeration<DocumentReferenceStatus> status) {
463    super();
464    this.status = status;
465  }
466
467  /**
468   * @return {@link #masterIdentifier} (A single identifier that uniquely
469   *         identifies this manifest. Principally used to refer to the manifest
470   *         in non-FHIR contexts.)
471   */
472  public Identifier getMasterIdentifier() {
473    if (this.masterIdentifier == null)
474      if (Configuration.errorOnAutoCreate())
475        throw new Error("Attempt to auto-create DocumentManifest.masterIdentifier");
476      else if (Configuration.doAutoCreate())
477        this.masterIdentifier = new Identifier(); // cc
478    return this.masterIdentifier;
479  }
480
481  public boolean hasMasterIdentifier() {
482    return this.masterIdentifier != null && !this.masterIdentifier.isEmpty();
483  }
484
485  /**
486   * @param value {@link #masterIdentifier} (A single identifier that uniquely
487   *              identifies this manifest. Principally used to refer to the
488   *              manifest in non-FHIR contexts.)
489   */
490  public DocumentManifest setMasterIdentifier(Identifier value) {
491    this.masterIdentifier = value;
492    return this;
493  }
494
495  /**
496   * @return {@link #identifier} (Other identifiers associated with the document
497   *         manifest, including version independent identifiers.)
498   */
499  public List<Identifier> getIdentifier() {
500    if (this.identifier == null)
501      this.identifier = new ArrayList<Identifier>();
502    return this.identifier;
503  }
504
505  /**
506   * @return Returns a reference to <code>this</code> for easy method chaining
507   */
508  public DocumentManifest setIdentifier(List<Identifier> theIdentifier) {
509    this.identifier = theIdentifier;
510    return this;
511  }
512
513  public boolean hasIdentifier() {
514    if (this.identifier == null)
515      return false;
516    for (Identifier item : this.identifier)
517      if (!item.isEmpty())
518        return true;
519    return false;
520  }
521
522  public Identifier addIdentifier() { // 3
523    Identifier t = new Identifier();
524    if (this.identifier == null)
525      this.identifier = new ArrayList<Identifier>();
526    this.identifier.add(t);
527    return t;
528  }
529
530  public DocumentManifest addIdentifier(Identifier t) { // 3
531    if (t == null)
532      return this;
533    if (this.identifier == null)
534      this.identifier = new ArrayList<Identifier>();
535    this.identifier.add(t);
536    return this;
537  }
538
539  /**
540   * @return The first repetition of repeating field {@link #identifier}, creating
541   *         it if it does not already exist
542   */
543  public Identifier getIdentifierFirstRep() {
544    if (getIdentifier().isEmpty()) {
545      addIdentifier();
546    }
547    return getIdentifier().get(0);
548  }
549
550  /**
551   * @return {@link #status} (The status of this document manifest.). This is the
552   *         underlying object with id, value and extensions. The accessor
553   *         "getStatus" gives direct access to the value
554   */
555  public Enumeration<DocumentReferenceStatus> getStatusElement() {
556    if (this.status == null)
557      if (Configuration.errorOnAutoCreate())
558        throw new Error("Attempt to auto-create DocumentManifest.status");
559      else if (Configuration.doAutoCreate())
560        this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory()); // bb
561    return this.status;
562  }
563
564  public boolean hasStatusElement() {
565    return this.status != null && !this.status.isEmpty();
566  }
567
568  public boolean hasStatus() {
569    return this.status != null && !this.status.isEmpty();
570  }
571
572  /**
573   * @param value {@link #status} (The status of this document manifest.). This is
574   *              the underlying object with id, value and extensions. The
575   *              accessor "getStatus" gives direct access to the value
576   */
577  public DocumentManifest setStatusElement(Enumeration<DocumentReferenceStatus> value) {
578    this.status = value;
579    return this;
580  }
581
582  /**
583   * @return The status of this document manifest.
584   */
585  public DocumentReferenceStatus getStatus() {
586    return this.status == null ? null : this.status.getValue();
587  }
588
589  /**
590   * @param value The status of this document manifest.
591   */
592  public DocumentManifest setStatus(DocumentReferenceStatus value) {
593    if (this.status == null)
594      this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory());
595    this.status.setValue(value);
596    return this;
597  }
598
599  /**
600   * @return {@link #type} (The code specifying the type of clinical activity that
601   *         resulted in placing the associated content into the
602   *         DocumentManifest.)
603   */
604  public CodeableConcept getType() {
605    if (this.type == null)
606      if (Configuration.errorOnAutoCreate())
607        throw new Error("Attempt to auto-create DocumentManifest.type");
608      else if (Configuration.doAutoCreate())
609        this.type = new CodeableConcept(); // cc
610    return this.type;
611  }
612
613  public boolean hasType() {
614    return this.type != null && !this.type.isEmpty();
615  }
616
617  /**
618   * @param value {@link #type} (The code specifying the type of clinical activity
619   *              that resulted in placing the associated content into the
620   *              DocumentManifest.)
621   */
622  public DocumentManifest setType(CodeableConcept value) {
623    this.type = value;
624    return this;
625  }
626
627  /**
628   * @return {@link #subject} (Who or what the set of documents is about. The
629   *         documents can be about a person, (patient or healthcare
630   *         practitioner), a device (i.e. machine) or even a group of subjects
631   *         (such as a document about a herd of farm animals, or a set of
632   *         patients that share a common exposure). If the documents cross more
633   *         than one subject, then more than one subject is allowed here (unusual
634   *         use case).)
635   */
636  public Reference getSubject() {
637    if (this.subject == null)
638      if (Configuration.errorOnAutoCreate())
639        throw new Error("Attempt to auto-create DocumentManifest.subject");
640      else if (Configuration.doAutoCreate())
641        this.subject = new Reference(); // cc
642    return this.subject;
643  }
644
645  public boolean hasSubject() {
646    return this.subject != null && !this.subject.isEmpty();
647  }
648
649  /**
650   * @param value {@link #subject} (Who or what the set of documents is about. The
651   *              documents can be about a person, (patient or healthcare
652   *              practitioner), a device (i.e. machine) or even a group of
653   *              subjects (such as a document about a herd of farm animals, or a
654   *              set of patients that share a common exposure). If the documents
655   *              cross more than one subject, then more than one subject is
656   *              allowed here (unusual use case).)
657   */
658  public DocumentManifest setSubject(Reference value) {
659    this.subject = value;
660    return this;
661  }
662
663  /**
664   * @return {@link #subject} The actual object that is the target of the
665   *         reference. The reference library doesn't populate this, but you can
666   *         use it to hold the resource if you resolve it. (Who or what the set
667   *         of documents is about. The documents can be about a person, (patient
668   *         or healthcare practitioner), a device (i.e. machine) or even a group
669   *         of subjects (such as a document about a herd of farm animals, or a
670   *         set of patients that share a common exposure). If the documents cross
671   *         more than one subject, then more than one subject is allowed here
672   *         (unusual use case).)
673   */
674  public Resource getSubjectTarget() {
675    return this.subjectTarget;
676  }
677
678  /**
679   * @param value {@link #subject} The actual object that is the target of the
680   *              reference. The reference library doesn't use these, but you can
681   *              use it to hold the resource if you resolve it. (Who or what the
682   *              set of documents is about. The documents can be about a person,
683   *              (patient or healthcare practitioner), a device (i.e. machine) or
684   *              even a group of subjects (such as a document about a herd of
685   *              farm animals, or a set of patients that share a common
686   *              exposure). If the documents cross more than one subject, then
687   *              more than one subject is allowed here (unusual use case).)
688   */
689  public DocumentManifest setSubjectTarget(Resource value) {
690    this.subjectTarget = value;
691    return this;
692  }
693
694  /**
695   * @return {@link #created} (When the document manifest was created for
696   *         submission to the server (not necessarily the same thing as the
697   *         actual resource last modified time, since it may be modified,
698   *         replicated, etc.).). This is the underlying object with id, value and
699   *         extensions. The accessor "getCreated" gives direct access to the
700   *         value
701   */
702  public DateTimeType getCreatedElement() {
703    if (this.created == null)
704      if (Configuration.errorOnAutoCreate())
705        throw new Error("Attempt to auto-create DocumentManifest.created");
706      else if (Configuration.doAutoCreate())
707        this.created = new DateTimeType(); // bb
708    return this.created;
709  }
710
711  public boolean hasCreatedElement() {
712    return this.created != null && !this.created.isEmpty();
713  }
714
715  public boolean hasCreated() {
716    return this.created != null && !this.created.isEmpty();
717  }
718
719  /**
720   * @param value {@link #created} (When the document manifest was created for
721   *              submission to the server (not necessarily the same thing as the
722   *              actual resource last modified time, since it may be modified,
723   *              replicated, etc.).). This is the underlying object with id,
724   *              value and extensions. The accessor "getCreated" gives direct
725   *              access to the value
726   */
727  public DocumentManifest setCreatedElement(DateTimeType value) {
728    this.created = value;
729    return this;
730  }
731
732  /**
733   * @return When the document manifest was created for submission to the server
734   *         (not necessarily the same thing as the actual resource last modified
735   *         time, since it may be modified, replicated, etc.).
736   */
737  public Date getCreated() {
738    return this.created == null ? null : this.created.getValue();
739  }
740
741  /**
742   * @param value When the document manifest was created for submission to the
743   *              server (not necessarily the same thing as the actual resource
744   *              last modified time, since it may be modified, replicated, etc.).
745   */
746  public DocumentManifest setCreated(Date value) {
747    if (value == null)
748      this.created = null;
749    else {
750      if (this.created == null)
751        this.created = new DateTimeType();
752      this.created.setValue(value);
753    }
754    return this;
755  }
756
757  /**
758   * @return {@link #author} (Identifies who is the author of the manifest.
759   *         Manifest author is not necessarly the author of the references
760   *         included.)
761   */
762  public List<Reference> getAuthor() {
763    if (this.author == null)
764      this.author = new ArrayList<Reference>();
765    return this.author;
766  }
767
768  /**
769   * @return Returns a reference to <code>this</code> for easy method chaining
770   */
771  public DocumentManifest setAuthor(List<Reference> theAuthor) {
772    this.author = theAuthor;
773    return this;
774  }
775
776  public boolean hasAuthor() {
777    if (this.author == null)
778      return false;
779    for (Reference item : this.author)
780      if (!item.isEmpty())
781        return true;
782    return false;
783  }
784
785  public Reference addAuthor() { // 3
786    Reference t = new Reference();
787    if (this.author == null)
788      this.author = new ArrayList<Reference>();
789    this.author.add(t);
790    return t;
791  }
792
793  public DocumentManifest addAuthor(Reference t) { // 3
794    if (t == null)
795      return this;
796    if (this.author == null)
797      this.author = new ArrayList<Reference>();
798    this.author.add(t);
799    return this;
800  }
801
802  /**
803   * @return The first repetition of repeating field {@link #author}, creating it
804   *         if it does not already exist
805   */
806  public Reference getAuthorFirstRep() {
807    if (getAuthor().isEmpty()) {
808      addAuthor();
809    }
810    return getAuthor().get(0);
811  }
812
813  /**
814   * @deprecated Use Reference#setResource(IBaseResource) instead
815   */
816  @Deprecated
817  public List<Resource> getAuthorTarget() {
818    if (this.authorTarget == null)
819      this.authorTarget = new ArrayList<Resource>();
820    return this.authorTarget;
821  }
822
823  /**
824   * @return {@link #recipient} (A patient, practitioner, or organization for
825   *         which this set of documents is intended.)
826   */
827  public List<Reference> getRecipient() {
828    if (this.recipient == null)
829      this.recipient = new ArrayList<Reference>();
830    return this.recipient;
831  }
832
833  /**
834   * @return Returns a reference to <code>this</code> for easy method chaining
835   */
836  public DocumentManifest setRecipient(List<Reference> theRecipient) {
837    this.recipient = theRecipient;
838    return this;
839  }
840
841  public boolean hasRecipient() {
842    if (this.recipient == null)
843      return false;
844    for (Reference item : this.recipient)
845      if (!item.isEmpty())
846        return true;
847    return false;
848  }
849
850  public Reference addRecipient() { // 3
851    Reference t = new Reference();
852    if (this.recipient == null)
853      this.recipient = new ArrayList<Reference>();
854    this.recipient.add(t);
855    return t;
856  }
857
858  public DocumentManifest addRecipient(Reference t) { // 3
859    if (t == null)
860      return this;
861    if (this.recipient == null)
862      this.recipient = new ArrayList<Reference>();
863    this.recipient.add(t);
864    return this;
865  }
866
867  /**
868   * @return The first repetition of repeating field {@link #recipient}, creating
869   *         it if it does not already exist
870   */
871  public Reference getRecipientFirstRep() {
872    if (getRecipient().isEmpty()) {
873      addRecipient();
874    }
875    return getRecipient().get(0);
876  }
877
878  /**
879   * @deprecated Use Reference#setResource(IBaseResource) instead
880   */
881  @Deprecated
882  public List<Resource> getRecipientTarget() {
883    if (this.recipientTarget == null)
884      this.recipientTarget = new ArrayList<Resource>();
885    return this.recipientTarget;
886  }
887
888  /**
889   * @return {@link #source} (Identifies the source system, application, or
890   *         software that produced the document manifest.). This is the
891   *         underlying object with id, value and extensions. The accessor
892   *         "getSource" gives direct access to the value
893   */
894  public UriType getSourceElement() {
895    if (this.source == null)
896      if (Configuration.errorOnAutoCreate())
897        throw new Error("Attempt to auto-create DocumentManifest.source");
898      else if (Configuration.doAutoCreate())
899        this.source = new UriType(); // bb
900    return this.source;
901  }
902
903  public boolean hasSourceElement() {
904    return this.source != null && !this.source.isEmpty();
905  }
906
907  public boolean hasSource() {
908    return this.source != null && !this.source.isEmpty();
909  }
910
911  /**
912   * @param value {@link #source} (Identifies the source system, application, or
913   *              software that produced the document manifest.). This is the
914   *              underlying object with id, value and extensions. The accessor
915   *              "getSource" gives direct access to the value
916   */
917  public DocumentManifest setSourceElement(UriType value) {
918    this.source = value;
919    return this;
920  }
921
922  /**
923   * @return Identifies the source system, application, or software that produced
924   *         the document manifest.
925   */
926  public String getSource() {
927    return this.source == null ? null : this.source.getValue();
928  }
929
930  /**
931   * @param value Identifies the source system, application, or software that
932   *              produced the document manifest.
933   */
934  public DocumentManifest setSource(String value) {
935    if (Utilities.noString(value))
936      this.source = null;
937    else {
938      if (this.source == null)
939        this.source = new UriType();
940      this.source.setValue(value);
941    }
942    return this;
943  }
944
945  /**
946   * @return {@link #description} (Human-readable description of the source
947   *         document. This is sometimes known as the "title".). This is the
948   *         underlying object with id, value and extensions. The accessor
949   *         "getDescription" gives direct access to the value
950   */
951  public StringType getDescriptionElement() {
952    if (this.description == null)
953      if (Configuration.errorOnAutoCreate())
954        throw new Error("Attempt to auto-create DocumentManifest.description");
955      else if (Configuration.doAutoCreate())
956        this.description = new StringType(); // bb
957    return this.description;
958  }
959
960  public boolean hasDescriptionElement() {
961    return this.description != null && !this.description.isEmpty();
962  }
963
964  public boolean hasDescription() {
965    return this.description != null && !this.description.isEmpty();
966  }
967
968  /**
969   * @param value {@link #description} (Human-readable description of the source
970   *              document. This is sometimes known as the "title".). This is the
971   *              underlying object with id, value and extensions. The accessor
972   *              "getDescription" gives direct access to the value
973   */
974  public DocumentManifest setDescriptionElement(StringType value) {
975    this.description = value;
976    return this;
977  }
978
979  /**
980   * @return Human-readable description of the source document. This is sometimes
981   *         known as the "title".
982   */
983  public String getDescription() {
984    return this.description == null ? null : this.description.getValue();
985  }
986
987  /**
988   * @param value Human-readable description of the source document. This is
989   *              sometimes known as the "title".
990   */
991  public DocumentManifest setDescription(String value) {
992    if (Utilities.noString(value))
993      this.description = null;
994    else {
995      if (this.description == null)
996        this.description = new StringType();
997      this.description.setValue(value);
998    }
999    return this;
1000  }
1001
1002  /**
1003   * @return {@link #content} (The list of Resources that consist of the parts of
1004   *         this manifest.)
1005   */
1006  public List<Reference> getContent() {
1007    if (this.content == null)
1008      this.content = new ArrayList<Reference>();
1009    return this.content;
1010  }
1011
1012  /**
1013   * @return Returns a reference to <code>this</code> for easy method chaining
1014   */
1015  public DocumentManifest setContent(List<Reference> theContent) {
1016    this.content = theContent;
1017    return this;
1018  }
1019
1020  public boolean hasContent() {
1021    if (this.content == null)
1022      return false;
1023    for (Reference item : this.content)
1024      if (!item.isEmpty())
1025        return true;
1026    return false;
1027  }
1028
1029  public Reference addContent() { // 3
1030    Reference t = new Reference();
1031    if (this.content == null)
1032      this.content = new ArrayList<Reference>();
1033    this.content.add(t);
1034    return t;
1035  }
1036
1037  public DocumentManifest addContent(Reference t) { // 3
1038    if (t == null)
1039      return this;
1040    if (this.content == null)
1041      this.content = new ArrayList<Reference>();
1042    this.content.add(t);
1043    return this;
1044  }
1045
1046  /**
1047   * @return The first repetition of repeating field {@link #content}, creating it
1048   *         if it does not already exist
1049   */
1050  public Reference getContentFirstRep() {
1051    if (getContent().isEmpty()) {
1052      addContent();
1053    }
1054    return getContent().get(0);
1055  }
1056
1057  /**
1058   * @deprecated Use Reference#setResource(IBaseResource) instead
1059   */
1060  @Deprecated
1061  public List<Resource> getContentTarget() {
1062    if (this.contentTarget == null)
1063      this.contentTarget = new ArrayList<Resource>();
1064    return this.contentTarget;
1065  }
1066
1067  /**
1068   * @return {@link #related} (Related identifiers or resources associated with
1069   *         the DocumentManifest.)
1070   */
1071  public List<DocumentManifestRelatedComponent> getRelated() {
1072    if (this.related == null)
1073      this.related = new ArrayList<DocumentManifestRelatedComponent>();
1074    return this.related;
1075  }
1076
1077  /**
1078   * @return Returns a reference to <code>this</code> for easy method chaining
1079   */
1080  public DocumentManifest setRelated(List<DocumentManifestRelatedComponent> theRelated) {
1081    this.related = theRelated;
1082    return this;
1083  }
1084
1085  public boolean hasRelated() {
1086    if (this.related == null)
1087      return false;
1088    for (DocumentManifestRelatedComponent item : this.related)
1089      if (!item.isEmpty())
1090        return true;
1091    return false;
1092  }
1093
1094  public DocumentManifestRelatedComponent addRelated() { // 3
1095    DocumentManifestRelatedComponent t = new DocumentManifestRelatedComponent();
1096    if (this.related == null)
1097      this.related = new ArrayList<DocumentManifestRelatedComponent>();
1098    this.related.add(t);
1099    return t;
1100  }
1101
1102  public DocumentManifest addRelated(DocumentManifestRelatedComponent t) { // 3
1103    if (t == null)
1104      return this;
1105    if (this.related == null)
1106      this.related = new ArrayList<DocumentManifestRelatedComponent>();
1107    this.related.add(t);
1108    return this;
1109  }
1110
1111  /**
1112   * @return The first repetition of repeating field {@link #related}, creating it
1113   *         if it does not already exist
1114   */
1115  public DocumentManifestRelatedComponent getRelatedFirstRep() {
1116    if (getRelated().isEmpty()) {
1117      addRelated();
1118    }
1119    return getRelated().get(0);
1120  }
1121
1122  protected void listChildren(List<Property> children) {
1123    super.listChildren(children);
1124    children.add(new Property("masterIdentifier", "Identifier",
1125        "A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.",
1126        0, 1, masterIdentifier));
1127    children.add(new Property("identifier", "Identifier",
1128        "Other identifiers associated with the document manifest, including version independent  identifiers.", 0,
1129        java.lang.Integer.MAX_VALUE, identifier));
1130    children.add(new Property("status", "code", "The status of this document manifest.", 0, 1, status));
1131    children.add(new Property("type", "CodeableConcept",
1132        "The code specifying the type of clinical activity that resulted in placing the associated content into the DocumentManifest.",
1133        0, 1, type));
1134    children.add(new Property("subject", "Reference(Patient|Practitioner|Group|Device)",
1135        "Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).",
1136        0, 1, subject));
1137    children.add(new Property("created", "dateTime",
1138        "When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated, etc.).",
1139        0, 1, created));
1140    children.add(new Property("author",
1141        "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson)",
1142        "Identifies who is the author of the manifest. Manifest author is not necessarly the author of the references included.",
1143        0, java.lang.Integer.MAX_VALUE, author));
1144    children
1145        .add(new Property("recipient", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)",
1146            "A patient, practitioner, or organization for which this set of documents is intended.", 0,
1147            java.lang.Integer.MAX_VALUE, recipient));
1148    children.add(new Property("source", "uri",
1149        "Identifies the source system, application, or software that produced the document manifest.", 0, 1, source));
1150    children.add(new Property("description", "string",
1151        "Human-readable description of the source document. This is sometimes known as the \"title\".", 0, 1,
1152        description));
1153    children.add(new Property("content", "Reference(Any)",
1154        "The list of Resources that consist of the parts of this manifest.", 0, java.lang.Integer.MAX_VALUE, content));
1155    children.add(new Property("related", "", "Related identifiers or resources associated with the DocumentManifest.",
1156        0, java.lang.Integer.MAX_VALUE, related));
1157  }
1158
1159  @Override
1160  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1161    switch (_hash) {
1162    case 243769515:
1163      /* masterIdentifier */ return new Property("masterIdentifier", "Identifier",
1164          "A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.",
1165          0, 1, masterIdentifier);
1166    case -1618432855:
1167      /* identifier */ return new Property("identifier", "Identifier",
1168          "Other identifiers associated with the document manifest, including version independent  identifiers.", 0,
1169          java.lang.Integer.MAX_VALUE, identifier);
1170    case -892481550:
1171      /* status */ return new Property("status", "code", "The status of this document manifest.", 0, 1, status);
1172    case 3575610:
1173      /* type */ return new Property("type", "CodeableConcept",
1174          "The code specifying the type of clinical activity that resulted in placing the associated content into the DocumentManifest.",
1175          0, 1, type);
1176    case -1867885268:
1177      /* subject */ return new Property("subject", "Reference(Patient|Practitioner|Group|Device)",
1178          "Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).",
1179          0, 1, subject);
1180    case 1028554472:
1181      /* created */ return new Property("created", "dateTime",
1182          "When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated, etc.).",
1183          0, 1, created);
1184    case -1406328437:
1185      /* author */ return new Property("author",
1186          "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson)",
1187          "Identifies who is the author of the manifest. Manifest author is not necessarly the author of the references included.",
1188          0, java.lang.Integer.MAX_VALUE, author);
1189    case 820081177:
1190      /* recipient */ return new Property("recipient",
1191          "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)",
1192          "A patient, practitioner, or organization for which this set of documents is intended.", 0,
1193          java.lang.Integer.MAX_VALUE, recipient);
1194    case -896505829:
1195      /* source */ return new Property("source", "uri",
1196          "Identifies the source system, application, or software that produced the document manifest.", 0, 1, source);
1197    case -1724546052:
1198      /* description */ return new Property("description", "string",
1199          "Human-readable description of the source document. This is sometimes known as the \"title\".", 0, 1,
1200          description);
1201    case 951530617:
1202      /* content */ return new Property("content", "Reference(Any)",
1203          "The list of Resources that consist of the parts of this manifest.", 0, java.lang.Integer.MAX_VALUE, content);
1204    case 1090493483:
1205      /* related */ return new Property("related", "",
1206          "Related identifiers or resources associated with the DocumentManifest.", 0, java.lang.Integer.MAX_VALUE,
1207          related);
1208    default:
1209      return super.getNamedProperty(_hash, _name, _checkValid);
1210    }
1211
1212  }
1213
1214  @Override
1215  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1216    switch (hash) {
1217    case 243769515:
1218      /* masterIdentifier */ return this.masterIdentifier == null ? new Base[0] : new Base[] { this.masterIdentifier }; // Identifier
1219    case -1618432855:
1220      /* identifier */ return this.identifier == null ? new Base[0]
1221          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1222    case -892481550:
1223      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DocumentReferenceStatus>
1224    case 3575610:
1225      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1226    case -1867885268:
1227      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
1228    case 1028554472:
1229      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
1230    case -1406328437:
1231      /* author */ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
1232    case 820081177:
1233      /* recipient */ return this.recipient == null ? new Base[0]
1234          : this.recipient.toArray(new Base[this.recipient.size()]); // Reference
1235    case -896505829:
1236      /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // UriType
1237    case -1724546052:
1238      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
1239    case 951530617:
1240      /* content */ return this.content == null ? new Base[0] : this.content.toArray(new Base[this.content.size()]); // Reference
1241    case 1090493483:
1242      /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // DocumentManifestRelatedComponent
1243    default:
1244      return super.getProperty(hash, name, checkValid);
1245    }
1246
1247  }
1248
1249  @Override
1250  public Base setProperty(int hash, String name, Base value) throws FHIRException {
1251    switch (hash) {
1252    case 243769515: // masterIdentifier
1253      this.masterIdentifier = castToIdentifier(value); // Identifier
1254      return value;
1255    case -1618432855: // identifier
1256      this.getIdentifier().add(castToIdentifier(value)); // Identifier
1257      return value;
1258    case -892481550: // status
1259      value = new DocumentReferenceStatusEnumFactory().fromType(castToCode(value));
1260      this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
1261      return value;
1262    case 3575610: // type
1263      this.type = castToCodeableConcept(value); // CodeableConcept
1264      return value;
1265    case -1867885268: // subject
1266      this.subject = castToReference(value); // Reference
1267      return value;
1268    case 1028554472: // created
1269      this.created = castToDateTime(value); // DateTimeType
1270      return value;
1271    case -1406328437: // author
1272      this.getAuthor().add(castToReference(value)); // Reference
1273      return value;
1274    case 820081177: // recipient
1275      this.getRecipient().add(castToReference(value)); // Reference
1276      return value;
1277    case -896505829: // source
1278      this.source = castToUri(value); // UriType
1279      return value;
1280    case -1724546052: // description
1281      this.description = castToString(value); // StringType
1282      return value;
1283    case 951530617: // content
1284      this.getContent().add(castToReference(value)); // Reference
1285      return value;
1286    case 1090493483: // related
1287      this.getRelated().add((DocumentManifestRelatedComponent) value); // DocumentManifestRelatedComponent
1288      return value;
1289    default:
1290      return super.setProperty(hash, name, value);
1291    }
1292
1293  }
1294
1295  @Override
1296  public Base setProperty(String name, Base value) throws FHIRException {
1297    if (name.equals("masterIdentifier")) {
1298      this.masterIdentifier = castToIdentifier(value); // Identifier
1299    } else if (name.equals("identifier")) {
1300      this.getIdentifier().add(castToIdentifier(value));
1301    } else if (name.equals("status")) {
1302      value = new DocumentReferenceStatusEnumFactory().fromType(castToCode(value));
1303      this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
1304    } else if (name.equals("type")) {
1305      this.type = castToCodeableConcept(value); // CodeableConcept
1306    } else if (name.equals("subject")) {
1307      this.subject = castToReference(value); // Reference
1308    } else if (name.equals("created")) {
1309      this.created = castToDateTime(value); // DateTimeType
1310    } else if (name.equals("author")) {
1311      this.getAuthor().add(castToReference(value));
1312    } else if (name.equals("recipient")) {
1313      this.getRecipient().add(castToReference(value));
1314    } else if (name.equals("source")) {
1315      this.source = castToUri(value); // UriType
1316    } else if (name.equals("description")) {
1317      this.description = castToString(value); // StringType
1318    } else if (name.equals("content")) {
1319      this.getContent().add(castToReference(value));
1320    } else if (name.equals("related")) {
1321      this.getRelated().add((DocumentManifestRelatedComponent) value);
1322    } else
1323      return super.setProperty(name, value);
1324    return value;
1325  }
1326
1327  @Override
1328  public Base makeProperty(int hash, String name) throws FHIRException {
1329    switch (hash) {
1330    case 243769515:
1331      return getMasterIdentifier();
1332    case -1618432855:
1333      return addIdentifier();
1334    case -892481550:
1335      return getStatusElement();
1336    case 3575610:
1337      return getType();
1338    case -1867885268:
1339      return getSubject();
1340    case 1028554472:
1341      return getCreatedElement();
1342    case -1406328437:
1343      return addAuthor();
1344    case 820081177:
1345      return addRecipient();
1346    case -896505829:
1347      return getSourceElement();
1348    case -1724546052:
1349      return getDescriptionElement();
1350    case 951530617:
1351      return addContent();
1352    case 1090493483:
1353      return addRelated();
1354    default:
1355      return super.makeProperty(hash, name);
1356    }
1357
1358  }
1359
1360  @Override
1361  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1362    switch (hash) {
1363    case 243769515:
1364      /* masterIdentifier */ return new String[] { "Identifier" };
1365    case -1618432855:
1366      /* identifier */ return new String[] { "Identifier" };
1367    case -892481550:
1368      /* status */ return new String[] { "code" };
1369    case 3575610:
1370      /* type */ return new String[] { "CodeableConcept" };
1371    case -1867885268:
1372      /* subject */ return new String[] { "Reference" };
1373    case 1028554472:
1374      /* created */ return new String[] { "dateTime" };
1375    case -1406328437:
1376      /* author */ return new String[] { "Reference" };
1377    case 820081177:
1378      /* recipient */ return new String[] { "Reference" };
1379    case -896505829:
1380      /* source */ return new String[] { "uri" };
1381    case -1724546052:
1382      /* description */ return new String[] { "string" };
1383    case 951530617:
1384      /* content */ return new String[] { "Reference" };
1385    case 1090493483:
1386      /* related */ return new String[] {};
1387    default:
1388      return super.getTypesForProperty(hash, name);
1389    }
1390
1391  }
1392
1393  @Override
1394  public Base addChild(String name) throws FHIRException {
1395    if (name.equals("masterIdentifier")) {
1396      this.masterIdentifier = new Identifier();
1397      return this.masterIdentifier;
1398    } else if (name.equals("identifier")) {
1399      return addIdentifier();
1400    } else if (name.equals("status")) {
1401      throw new FHIRException("Cannot call addChild on a singleton property DocumentManifest.status");
1402    } else if (name.equals("type")) {
1403      this.type = new CodeableConcept();
1404      return this.type;
1405    } else if (name.equals("subject")) {
1406      this.subject = new Reference();
1407      return this.subject;
1408    } else if (name.equals("created")) {
1409      throw new FHIRException("Cannot call addChild on a singleton property DocumentManifest.created");
1410    } else if (name.equals("author")) {
1411      return addAuthor();
1412    } else if (name.equals("recipient")) {
1413      return addRecipient();
1414    } else if (name.equals("source")) {
1415      throw new FHIRException("Cannot call addChild on a singleton property DocumentManifest.source");
1416    } else if (name.equals("description")) {
1417      throw new FHIRException("Cannot call addChild on a singleton property DocumentManifest.description");
1418    } else if (name.equals("content")) {
1419      return addContent();
1420    } else if (name.equals("related")) {
1421      return addRelated();
1422    } else
1423      return super.addChild(name);
1424  }
1425
1426  public String fhirType() {
1427    return "DocumentManifest";
1428
1429  }
1430
1431  public DocumentManifest copy() {
1432    DocumentManifest dst = new DocumentManifest();
1433    copyValues(dst);
1434    return dst;
1435  }
1436
1437  public void copyValues(DocumentManifest dst) {
1438    super.copyValues(dst);
1439    dst.masterIdentifier = masterIdentifier == null ? null : masterIdentifier.copy();
1440    if (identifier != null) {
1441      dst.identifier = new ArrayList<Identifier>();
1442      for (Identifier i : identifier)
1443        dst.identifier.add(i.copy());
1444    }
1445    ;
1446    dst.status = status == null ? null : status.copy();
1447    dst.type = type == null ? null : type.copy();
1448    dst.subject = subject == null ? null : subject.copy();
1449    dst.created = created == null ? null : created.copy();
1450    if (author != null) {
1451      dst.author = new ArrayList<Reference>();
1452      for (Reference i : author)
1453        dst.author.add(i.copy());
1454    }
1455    ;
1456    if (recipient != null) {
1457      dst.recipient = new ArrayList<Reference>();
1458      for (Reference i : recipient)
1459        dst.recipient.add(i.copy());
1460    }
1461    ;
1462    dst.source = source == null ? null : source.copy();
1463    dst.description = description == null ? null : description.copy();
1464    if (content != null) {
1465      dst.content = new ArrayList<Reference>();
1466      for (Reference i : content)
1467        dst.content.add(i.copy());
1468    }
1469    ;
1470    if (related != null) {
1471      dst.related = new ArrayList<DocumentManifestRelatedComponent>();
1472      for (DocumentManifestRelatedComponent i : related)
1473        dst.related.add(i.copy());
1474    }
1475    ;
1476  }
1477
1478  protected DocumentManifest typedCopy() {
1479    return copy();
1480  }
1481
1482  @Override
1483  public boolean equalsDeep(Base other_) {
1484    if (!super.equalsDeep(other_))
1485      return false;
1486    if (!(other_ instanceof DocumentManifest))
1487      return false;
1488    DocumentManifest o = (DocumentManifest) other_;
1489    return compareDeep(masterIdentifier, o.masterIdentifier, true) && compareDeep(identifier, o.identifier, true)
1490        && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
1491        && compareDeep(subject, o.subject, true) && compareDeep(created, o.created, true)
1492        && compareDeep(author, o.author, true) && compareDeep(recipient, o.recipient, true)
1493        && compareDeep(source, o.source, true) && compareDeep(description, o.description, true)
1494        && compareDeep(content, o.content, true) && compareDeep(related, o.related, true);
1495  }
1496
1497  @Override
1498  public boolean equalsShallow(Base other_) {
1499    if (!super.equalsShallow(other_))
1500      return false;
1501    if (!(other_ instanceof DocumentManifest))
1502      return false;
1503    DocumentManifest o = (DocumentManifest) other_;
1504    return compareValues(status, o.status, true) && compareValues(created, o.created, true)
1505        && compareValues(source, o.source, true) && compareValues(description, o.description, true);
1506  }
1507
1508  public boolean isEmpty() {
1509    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(masterIdentifier, identifier, status, type, subject,
1510        created, author, recipient, source, description, content, related);
1511  }
1512
1513  @Override
1514  public ResourceType getResourceType() {
1515    return ResourceType.DocumentManifest;
1516  }
1517
1518  /**
1519   * Search parameter: <b>identifier</b>
1520   * <p>
1521   * Description: <b>Unique Identifier for the set of documents</b><br>
1522   * Type: <b>token</b><br>
1523   * Path: <b>DocumentManifest.masterIdentifier,
1524   * DocumentManifest.identifier</b><br>
1525   * </p>
1526   */
1527  @SearchParamDefinition(name = "identifier", path = "DocumentManifest.masterIdentifier | DocumentManifest.identifier", description = "Unique Identifier for the set of documents", type = "token")
1528  public static final String SP_IDENTIFIER = "identifier";
1529  /**
1530   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1531   * <p>
1532   * Description: <b>Unique Identifier for the set of documents</b><br>
1533   * Type: <b>token</b><br>
1534   * Path: <b>DocumentManifest.masterIdentifier,
1535   * DocumentManifest.identifier</b><br>
1536   * </p>
1537   */
1538  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1539      SP_IDENTIFIER);
1540
1541  /**
1542   * Search parameter: <b>item</b>
1543   * <p>
1544   * Description: <b>Items in manifest</b><br>
1545   * Type: <b>reference</b><br>
1546   * Path: <b>DocumentManifest.content</b><br>
1547   * </p>
1548   */
1549  @SearchParamDefinition(name = "item", path = "DocumentManifest.content", description = "Items in manifest", type = "reference")
1550  public static final String SP_ITEM = "item";
1551  /**
1552   * <b>Fluent Client</b> search parameter constant for <b>item</b>
1553   * <p>
1554   * Description: <b>Items in manifest</b><br>
1555   * Type: <b>reference</b><br>
1556   * Path: <b>DocumentManifest.content</b><br>
1557   * </p>
1558   */
1559  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1560      SP_ITEM);
1561
1562  /**
1563   * Constant for fluent queries to be used to add include statements. Specifies
1564   * the path value of "<b>DocumentManifest:item</b>".
1565   */
1566  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include(
1567      "DocumentManifest:item").toLocked();
1568
1569  /**
1570   * Search parameter: <b>related-id</b>
1571   * <p>
1572   * Description: <b>Identifiers of things that are related</b><br>
1573   * Type: <b>token</b><br>
1574   * Path: <b>DocumentManifest.related.identifier</b><br>
1575   * </p>
1576   */
1577  @SearchParamDefinition(name = "related-id", path = "DocumentManifest.related.identifier", description = "Identifiers of things that are related", type = "token")
1578  public static final String SP_RELATED_ID = "related-id";
1579  /**
1580   * <b>Fluent Client</b> search parameter constant for <b>related-id</b>
1581   * <p>
1582   * Description: <b>Identifiers of things that are related</b><br>
1583   * Type: <b>token</b><br>
1584   * Path: <b>DocumentManifest.related.identifier</b><br>
1585   * </p>
1586   */
1587  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATED_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1588      SP_RELATED_ID);
1589
1590  /**
1591   * Search parameter: <b>subject</b>
1592   * <p>
1593   * Description: <b>The subject of the set of documents</b><br>
1594   * Type: <b>reference</b><br>
1595   * Path: <b>DocumentManifest.subject</b><br>
1596   * </p>
1597   */
1598  @SearchParamDefinition(name = "subject", path = "DocumentManifest.subject", description = "The subject of the set of documents", type = "reference", providesMembershipIn = {
1599      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
1600      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
1601      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class, Group.class,
1602          Patient.class, Practitioner.class })
1603  public static final String SP_SUBJECT = "subject";
1604  /**
1605   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1606   * <p>
1607   * Description: <b>The subject of the set of documents</b><br>
1608   * Type: <b>reference</b><br>
1609   * Path: <b>DocumentManifest.subject</b><br>
1610   * </p>
1611   */
1612  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1613      SP_SUBJECT);
1614
1615  /**
1616   * Constant for fluent queries to be used to add include statements. Specifies
1617   * the path value of "<b>DocumentManifest:subject</b>".
1618   */
1619  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
1620      "DocumentManifest:subject").toLocked();
1621
1622  /**
1623   * Search parameter: <b>author</b>
1624   * <p>
1625   * Description: <b>Who and/or what authored the DocumentManifest</b><br>
1626   * Type: <b>reference</b><br>
1627   * Path: <b>DocumentManifest.author</b><br>
1628   * </p>
1629   */
1630  @SearchParamDefinition(name = "author", path = "DocumentManifest.author", description = "Who and/or what authored the DocumentManifest", type = "reference", providesMembershipIn = {
1631      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
1632      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
1633      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
1634      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
1635          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
1636  public static final String SP_AUTHOR = "author";
1637  /**
1638   * <b>Fluent Client</b> search parameter constant for <b>author</b>
1639   * <p>
1640   * Description: <b>Who and/or what authored the DocumentManifest</b><br>
1641   * Type: <b>reference</b><br>
1642   * Path: <b>DocumentManifest.author</b><br>
1643   * </p>
1644   */
1645  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1646      SP_AUTHOR);
1647
1648  /**
1649   * Constant for fluent queries to be used to add include statements. Specifies
1650   * the path value of "<b>DocumentManifest:author</b>".
1651   */
1652  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
1653      "DocumentManifest:author").toLocked();
1654
1655  /**
1656   * Search parameter: <b>created</b>
1657   * <p>
1658   * Description: <b>When this document manifest created</b><br>
1659   * Type: <b>date</b><br>
1660   * Path: <b>DocumentManifest.created</b><br>
1661   * </p>
1662   */
1663  @SearchParamDefinition(name = "created", path = "DocumentManifest.created", description = "When this document manifest created", type = "date")
1664  public static final String SP_CREATED = "created";
1665  /**
1666   * <b>Fluent Client</b> search parameter constant for <b>created</b>
1667   * <p>
1668   * Description: <b>When this document manifest created</b><br>
1669   * Type: <b>date</b><br>
1670   * Path: <b>DocumentManifest.created</b><br>
1671   * </p>
1672   */
1673  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(
1674      SP_CREATED);
1675
1676  /**
1677   * Search parameter: <b>description</b>
1678   * <p>
1679   * Description: <b>Human-readable description (title)</b><br>
1680   * Type: <b>string</b><br>
1681   * Path: <b>DocumentManifest.description</b><br>
1682   * </p>
1683   */
1684  @SearchParamDefinition(name = "description", path = "DocumentManifest.description", description = "Human-readable description (title)", type = "string")
1685  public static final String SP_DESCRIPTION = "description";
1686  /**
1687   * <b>Fluent Client</b> search parameter constant for <b>description</b>
1688   * <p>
1689   * Description: <b>Human-readable description (title)</b><br>
1690   * Type: <b>string</b><br>
1691   * Path: <b>DocumentManifest.description</b><br>
1692   * </p>
1693   */
1694  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(
1695      SP_DESCRIPTION);
1696
1697  /**
1698   * Search parameter: <b>source</b>
1699   * <p>
1700   * Description: <b>The source system/application/software</b><br>
1701   * Type: <b>uri</b><br>
1702   * Path: <b>DocumentManifest.source</b><br>
1703   * </p>
1704   */
1705  @SearchParamDefinition(name = "source", path = "DocumentManifest.source", description = "The source system/application/software", type = "uri")
1706  public static final String SP_SOURCE = "source";
1707  /**
1708   * <b>Fluent Client</b> search parameter constant for <b>source</b>
1709   * <p>
1710   * Description: <b>The source system/application/software</b><br>
1711   * Type: <b>uri</b><br>
1712   * Path: <b>DocumentManifest.source</b><br>
1713   * </p>
1714   */
1715  public static final ca.uhn.fhir.rest.gclient.UriClientParam SOURCE = new ca.uhn.fhir.rest.gclient.UriClientParam(
1716      SP_SOURCE);
1717
1718  /**
1719   * Search parameter: <b>type</b>
1720   * <p>
1721   * Description: <b>Kind of document set</b><br>
1722   * Type: <b>token</b><br>
1723   * Path: <b>DocumentManifest.type</b><br>
1724   * </p>
1725   */
1726  @SearchParamDefinition(name = "type", path = "DocumentManifest.type", description = "Kind of document set", type = "token")
1727  public static final String SP_TYPE = "type";
1728  /**
1729   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1730   * <p>
1731   * Description: <b>Kind of document set</b><br>
1732   * Type: <b>token</b><br>
1733   * Path: <b>DocumentManifest.type</b><br>
1734   * </p>
1735   */
1736  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1737      SP_TYPE);
1738
1739  /**
1740   * Search parameter: <b>related-ref</b>
1741   * <p>
1742   * Description: <b>Related Resource</b><br>
1743   * Type: <b>reference</b><br>
1744   * Path: <b>DocumentManifest.related.ref</b><br>
1745   * </p>
1746   */
1747  @SearchParamDefinition(name = "related-ref", path = "DocumentManifest.related.ref", description = "Related Resource", type = "reference", providesMembershipIn = {
1748      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") })
1749  public static final String SP_RELATED_REF = "related-ref";
1750  /**
1751   * <b>Fluent Client</b> search parameter constant for <b>related-ref</b>
1752   * <p>
1753   * Description: <b>Related Resource</b><br>
1754   * Type: <b>reference</b><br>
1755   * Path: <b>DocumentManifest.related.ref</b><br>
1756   * </p>
1757   */
1758  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1759      SP_RELATED_REF);
1760
1761  /**
1762   * Constant for fluent queries to be used to add include statements. Specifies
1763   * the path value of "<b>DocumentManifest:related-ref</b>".
1764   */
1765  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED_REF = new ca.uhn.fhir.model.api.Include(
1766      "DocumentManifest:related-ref").toLocked();
1767
1768  /**
1769   * Search parameter: <b>patient</b>
1770   * <p>
1771   * Description: <b>The subject of the set of documents</b><br>
1772   * Type: <b>reference</b><br>
1773   * Path: <b>DocumentManifest.subject</b><br>
1774   * </p>
1775   */
1776  @SearchParamDefinition(name = "patient", path = "DocumentManifest.subject.where(resolve() is Patient)", description = "The subject of the set of documents", type = "reference", target = {
1777      Patient.class })
1778  public static final String SP_PATIENT = "patient";
1779  /**
1780   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1781   * <p>
1782   * Description: <b>The subject of the set of documents</b><br>
1783   * Type: <b>reference</b><br>
1784   * Path: <b>DocumentManifest.subject</b><br>
1785   * </p>
1786   */
1787  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1788      SP_PATIENT);
1789
1790  /**
1791   * Constant for fluent queries to be used to add include statements. Specifies
1792   * the path value of "<b>DocumentManifest:patient</b>".
1793   */
1794  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
1795      "DocumentManifest:patient").toLocked();
1796
1797  /**
1798   * Search parameter: <b>recipient</b>
1799   * <p>
1800   * Description: <b>Intended to get notified about this set of documents</b><br>
1801   * Type: <b>reference</b><br>
1802   * Path: <b>DocumentManifest.recipient</b><br>
1803   * </p>
1804   */
1805  @SearchParamDefinition(name = "recipient", path = "DocumentManifest.recipient", description = "Intended to get notified about this set of documents", type = "reference", providesMembershipIn = {
1806      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
1807      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
1808      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Organization.class,
1809          Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
1810  public static final String SP_RECIPIENT = "recipient";
1811  /**
1812   * <b>Fluent Client</b> search parameter constant for <b>recipient</b>
1813   * <p>
1814   * Description: <b>Intended to get notified about this set of documents</b><br>
1815   * Type: <b>reference</b><br>
1816   * Path: <b>DocumentManifest.recipient</b><br>
1817   * </p>
1818   */
1819  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECIPIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
1820      SP_RECIPIENT);
1821
1822  /**
1823   * Constant for fluent queries to be used to add include statements. Specifies
1824   * the path value of "<b>DocumentManifest:recipient</b>".
1825   */
1826  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECIPIENT = new ca.uhn.fhir.model.api.Include(
1827      "DocumentManifest:recipient").toLocked();
1828
1829  /**
1830   * Search parameter: <b>status</b>
1831   * <p>
1832   * Description: <b>current | superseded | entered-in-error</b><br>
1833   * Type: <b>token</b><br>
1834   * Path: <b>DocumentManifest.status</b><br>
1835   * </p>
1836   */
1837  @SearchParamDefinition(name = "status", path = "DocumentManifest.status", description = "current | superseded | entered-in-error", type = "token")
1838  public static final String SP_STATUS = "status";
1839  /**
1840   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1841   * <p>
1842   * Description: <b>current | superseded | entered-in-error</b><br>
1843   * Type: <b>token</b><br>
1844   * Path: <b>DocumentManifest.status</b><br>
1845   * </p>
1846   */
1847  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
1848      SP_STATUS);
1849
1850}