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