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