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