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