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