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