001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus;
040import org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatusEnumFactory;
041import org.hl7.fhir.utilities.Utilities;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.ResourceDef;
047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
048
049/**
050 * A reference to a document of any kind for any purpose. Provides metadata
051 * about the document so that the document can be discovered and managed. The
052 * scope of a document is any seralized object with a mime-type, so includes
053 * formal patient centric documents (CDA), cliical notes, scanned paper, and
054 * non-patient specific documents like policy text.
055 */
056@ResourceDef(name = "DocumentReference", profile = "http://hl7.org/fhir/StructureDefinition/DocumentReference")
057public class DocumentReference extends DomainResource {
058
059  public enum ReferredDocumentStatus {
060    /**
061     * This is a preliminary composition or document (also known as initial or
062     * interim). The content may be incomplete or unverified.
063     */
064    PRELIMINARY,
065    /**
066     * This version of the composition is complete and verified by an appropriate
067     * person and no further work is planned. Any subsequent updates would be on a
068     * new version of the composition.
069     */
070    FINAL,
071    /**
072     * The composition content or the referenced resources have been modified
073     * (edited or added to) subsequent to being released as "final" and the
074     * composition is complete and verified by an authorized person.
075     */
076    AMENDED,
077    /**
078     * The composition or document was originally created/issued in error, and this
079     * is an amendment that marks that the entire series should not be considered as
080     * valid.
081     */
082    ENTEREDINERROR,
083    /**
084     * added to help the parsers with the generic types
085     */
086    NULL;
087
088    public static ReferredDocumentStatus fromCode(String codeString) throws FHIRException {
089      if (codeString == null || "".equals(codeString))
090        return null;
091      if ("preliminary".equals(codeString))
092        return PRELIMINARY;
093      if ("final".equals(codeString))
094        return FINAL;
095      if ("amended".equals(codeString))
096        return AMENDED;
097      if ("entered-in-error".equals(codeString))
098        return ENTEREDINERROR;
099      if (Configuration.isAcceptInvalidEnums())
100        return null;
101      else
102        throw new FHIRException("Unknown ReferredDocumentStatus code '" + codeString + "'");
103    }
104
105    public String toCode() {
106      switch (this) {
107      case PRELIMINARY:
108        return "preliminary";
109      case FINAL:
110        return "final";
111      case AMENDED:
112        return "amended";
113      case ENTEREDINERROR:
114        return "entered-in-error";
115      case NULL:
116        return null;
117      default:
118        return "?";
119      }
120    }
121
122    public String getSystem() {
123      switch (this) {
124      case PRELIMINARY:
125        return "http://hl7.org/fhir/composition-status";
126      case FINAL:
127        return "http://hl7.org/fhir/composition-status";
128      case AMENDED:
129        return "http://hl7.org/fhir/composition-status";
130      case ENTEREDINERROR:
131        return "http://hl7.org/fhir/composition-status";
132      case NULL:
133        return null;
134      default:
135        return "?";
136      }
137    }
138
139    public String getDefinition() {
140      switch (this) {
141      case PRELIMINARY:
142        return "This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.";
143      case FINAL:
144        return "This version of the composition is complete and verified by an appropriate person and no further work is planned. Any subsequent updates would be on a new version of the composition.";
145      case AMENDED:
146        return "The composition content or the referenced resources have been modified (edited or added to) subsequent to being released as \"final\" and the composition is complete and verified by an authorized person.";
147      case ENTEREDINERROR:
148        return "The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid.";
149      case NULL:
150        return null;
151      default:
152        return "?";
153      }
154    }
155
156    public String getDisplay() {
157      switch (this) {
158      case PRELIMINARY:
159        return "Preliminary";
160      case FINAL:
161        return "Final";
162      case AMENDED:
163        return "Amended";
164      case ENTEREDINERROR:
165        return "Entered in Error";
166      case NULL:
167        return null;
168      default:
169        return "?";
170      }
171    }
172  }
173
174  public static class ReferredDocumentStatusEnumFactory implements EnumFactory<ReferredDocumentStatus> {
175    public ReferredDocumentStatus fromCode(String codeString) throws IllegalArgumentException {
176      if (codeString == null || "".equals(codeString))
177        if (codeString == null || "".equals(codeString))
178          return null;
179      if ("preliminary".equals(codeString))
180        return ReferredDocumentStatus.PRELIMINARY;
181      if ("final".equals(codeString))
182        return ReferredDocumentStatus.FINAL;
183      if ("amended".equals(codeString))
184        return ReferredDocumentStatus.AMENDED;
185      if ("entered-in-error".equals(codeString))
186        return ReferredDocumentStatus.ENTEREDINERROR;
187      throw new IllegalArgumentException("Unknown ReferredDocumentStatus code '" + codeString + "'");
188    }
189
190    public Enumeration<ReferredDocumentStatus> fromType(PrimitiveType<?> code) throws FHIRException {
191      if (code == null)
192        return null;
193      if (code.isEmpty())
194        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.NULL, code);
195      String codeString = code.asStringValue();
196      if (codeString == null || "".equals(codeString))
197        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.NULL, code);
198      if ("preliminary".equals(codeString))
199        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.PRELIMINARY, code);
200      if ("final".equals(codeString))
201        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.FINAL, code);
202      if ("amended".equals(codeString))
203        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.AMENDED, code);
204      if ("entered-in-error".equals(codeString))
205        return new Enumeration<ReferredDocumentStatus>(this, ReferredDocumentStatus.ENTEREDINERROR, code);
206      throw new FHIRException("Unknown ReferredDocumentStatus code '" + codeString + "'");
207    }
208
209    public String toCode(ReferredDocumentStatus code) {
210      if (code == ReferredDocumentStatus.PRELIMINARY)
211        return "preliminary";
212      if (code == ReferredDocumentStatus.FINAL)
213        return "final";
214      if (code == ReferredDocumentStatus.AMENDED)
215        return "amended";
216      if (code == ReferredDocumentStatus.ENTEREDINERROR)
217        return "entered-in-error";
218      return "?";
219    }
220
221    public String toSystem(ReferredDocumentStatus code) {
222      return code.getSystem();
223    }
224  }
225
226  public enum DocumentRelationshipType {
227    /**
228     * This document logically replaces or supersedes the target document.
229     */
230    REPLACES,
231    /**
232     * This document was generated by transforming the target document (e.g. format
233     * or language conversion).
234     */
235    TRANSFORMS,
236    /**
237     * This document is a signature of the target document.
238     */
239    SIGNS,
240    /**
241     * This document adds additional information to the target document.
242     */
243    APPENDS,
244    /**
245     * added to help the parsers with the generic types
246     */
247    NULL;
248
249    public static DocumentRelationshipType fromCode(String codeString) throws FHIRException {
250      if (codeString == null || "".equals(codeString))
251        return null;
252      if ("replaces".equals(codeString))
253        return REPLACES;
254      if ("transforms".equals(codeString))
255        return TRANSFORMS;
256      if ("signs".equals(codeString))
257        return SIGNS;
258      if ("appends".equals(codeString))
259        return APPENDS;
260      if (Configuration.isAcceptInvalidEnums())
261        return null;
262      else
263        throw new FHIRException("Unknown DocumentRelationshipType code '" + codeString + "'");
264    }
265
266    public String toCode() {
267      switch (this) {
268      case REPLACES:
269        return "replaces";
270      case TRANSFORMS:
271        return "transforms";
272      case SIGNS:
273        return "signs";
274      case APPENDS:
275        return "appends";
276      case NULL:
277        return null;
278      default:
279        return "?";
280      }
281    }
282
283    public String getSystem() {
284      switch (this) {
285      case REPLACES:
286        return "http://hl7.org/fhir/document-relationship-type";
287      case TRANSFORMS:
288        return "http://hl7.org/fhir/document-relationship-type";
289      case SIGNS:
290        return "http://hl7.org/fhir/document-relationship-type";
291      case APPENDS:
292        return "http://hl7.org/fhir/document-relationship-type";
293      case NULL:
294        return null;
295      default:
296        return "?";
297      }
298    }
299
300    public String getDefinition() {
301      switch (this) {
302      case REPLACES:
303        return "This document logically replaces or supersedes the target document.";
304      case TRANSFORMS:
305        return "This document was generated by transforming the target document (e.g. format or language conversion).";
306      case SIGNS:
307        return "This document is a signature of the target document.";
308      case APPENDS:
309        return "This document adds additional information to the target document.";
310      case NULL:
311        return null;
312      default:
313        return "?";
314      }
315    }
316
317    public String getDisplay() {
318      switch (this) {
319      case REPLACES:
320        return "Replaces";
321      case TRANSFORMS:
322        return "Transforms";
323      case SIGNS:
324        return "Signs";
325      case APPENDS:
326        return "Appends";
327      case NULL:
328        return null;
329      default:
330        return "?";
331      }
332    }
333  }
334
335  public static class DocumentRelationshipTypeEnumFactory implements EnumFactory<DocumentRelationshipType> {
336    public DocumentRelationshipType fromCode(String codeString) throws IllegalArgumentException {
337      if (codeString == null || "".equals(codeString))
338        if (codeString == null || "".equals(codeString))
339          return null;
340      if ("replaces".equals(codeString))
341        return DocumentRelationshipType.REPLACES;
342      if ("transforms".equals(codeString))
343        return DocumentRelationshipType.TRANSFORMS;
344      if ("signs".equals(codeString))
345        return DocumentRelationshipType.SIGNS;
346      if ("appends".equals(codeString))
347        return DocumentRelationshipType.APPENDS;
348      throw new IllegalArgumentException("Unknown DocumentRelationshipType code '" + codeString + "'");
349    }
350
351    public Enumeration<DocumentRelationshipType> fromType(PrimitiveType<?> code) throws FHIRException {
352      if (code == null)
353        return null;
354      if (code.isEmpty())
355        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.NULL, code);
356      String codeString = code.asStringValue();
357      if (codeString == null || "".equals(codeString))
358        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.NULL, code);
359      if ("replaces".equals(codeString))
360        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.REPLACES, code);
361      if ("transforms".equals(codeString))
362        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.TRANSFORMS, code);
363      if ("signs".equals(codeString))
364        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.SIGNS, code);
365      if ("appends".equals(codeString))
366        return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.APPENDS, code);
367      throw new FHIRException("Unknown DocumentRelationshipType code '" + codeString + "'");
368    }
369
370    public String toCode(DocumentRelationshipType code) {
371      if (code == DocumentRelationshipType.REPLACES)
372        return "replaces";
373      if (code == DocumentRelationshipType.TRANSFORMS)
374        return "transforms";
375      if (code == DocumentRelationshipType.SIGNS)
376        return "signs";
377      if (code == DocumentRelationshipType.APPENDS)
378        return "appends";
379      return "?";
380    }
381
382    public String toSystem(DocumentRelationshipType code) {
383      return code.getSystem();
384    }
385  }
386
387  @Block()
388  public static class DocumentReferenceRelatesToComponent extends BackboneElement implements IBaseBackboneElement {
389    /**
390     * The type of relationship that this document has with anther document.
391     */
392    @Child(name = "code", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
393    @Description(shortDefinition = "replaces | transforms | signs | appends", formalDefinition = "The type of relationship that this document has with anther document.")
394    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/document-relationship-type")
395    protected Enumeration<DocumentRelationshipType> code;
396
397    /**
398     * The target document of this relationship.
399     */
400    @Child(name = "target", type = {
401        DocumentReference.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
402    @Description(shortDefinition = "Target of the relationship", formalDefinition = "The target document of this relationship.")
403    protected Reference target;
404
405    /**
406     * The actual object that is the target of the reference (The target document of
407     * this relationship.)
408     */
409    protected DocumentReference targetTarget;
410
411    private static final long serialVersionUID = -347257495L;
412
413    /**
414     * Constructor
415     */
416    public DocumentReferenceRelatesToComponent() {
417      super();
418    }
419
420    /**
421     * Constructor
422     */
423    public DocumentReferenceRelatesToComponent(Enumeration<DocumentRelationshipType> code, Reference target) {
424      super();
425      this.code = code;
426      this.target = target;
427    }
428
429    /**
430     * @return {@link #code} (The type of relationship that this document has with
431     *         anther document.). This is the underlying object with id, value and
432     *         extensions. The accessor "getCode" gives direct access to the value
433     */
434    public Enumeration<DocumentRelationshipType> getCodeElement() {
435      if (this.code == null)
436        if (Configuration.errorOnAutoCreate())
437          throw new Error("Attempt to auto-create DocumentReferenceRelatesToComponent.code");
438        else if (Configuration.doAutoCreate())
439          this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory()); // bb
440      return this.code;
441    }
442
443    public boolean hasCodeElement() {
444      return this.code != null && !this.code.isEmpty();
445    }
446
447    public boolean hasCode() {
448      return this.code != null && !this.code.isEmpty();
449    }
450
451    /**
452     * @param value {@link #code} (The type of relationship that this document has
453     *              with anther document.). This is the underlying object with id,
454     *              value and extensions. The accessor "getCode" gives direct access
455     *              to the value
456     */
457    public DocumentReferenceRelatesToComponent setCodeElement(Enumeration<DocumentRelationshipType> value) {
458      this.code = value;
459      return this;
460    }
461
462    /**
463     * @return The type of relationship that this document has with anther document.
464     */
465    public DocumentRelationshipType getCode() {
466      return this.code == null ? null : this.code.getValue();
467    }
468
469    /**
470     * @param value The type of relationship that this document has with anther
471     *              document.
472     */
473    public DocumentReferenceRelatesToComponent setCode(DocumentRelationshipType value) {
474      if (this.code == null)
475        this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory());
476      this.code.setValue(value);
477      return this;
478    }
479
480    /**
481     * @return {@link #target} (The target document of this relationship.)
482     */
483    public Reference getTarget() {
484      if (this.target == null)
485        if (Configuration.errorOnAutoCreate())
486          throw new Error("Attempt to auto-create DocumentReferenceRelatesToComponent.target");
487        else if (Configuration.doAutoCreate())
488          this.target = new Reference(); // cc
489      return this.target;
490    }
491
492    public boolean hasTarget() {
493      return this.target != null && !this.target.isEmpty();
494    }
495
496    /**
497     * @param value {@link #target} (The target document of this relationship.)
498     */
499    public DocumentReferenceRelatesToComponent setTarget(Reference value) {
500      this.target = value;
501      return this;
502    }
503
504    /**
505     * @return {@link #target} The actual object that is the target of the
506     *         reference. The reference library doesn't populate this, but you can
507     *         use it to hold the resource if you resolve it. (The target document
508     *         of this relationship.)
509     */
510    public DocumentReference getTargetTarget() {
511      if (this.targetTarget == null)
512        if (Configuration.errorOnAutoCreate())
513          throw new Error("Attempt to auto-create DocumentReferenceRelatesToComponent.target");
514        else if (Configuration.doAutoCreate())
515          this.targetTarget = new DocumentReference(); // aa
516      return this.targetTarget;
517    }
518
519    /**
520     * @param value {@link #target} The actual object that is the target of the
521     *              reference. The reference library doesn't use these, but you can
522     *              use it to hold the resource if you resolve it. (The target
523     *              document of this relationship.)
524     */
525    public DocumentReferenceRelatesToComponent setTargetTarget(DocumentReference value) {
526      this.targetTarget = value;
527      return this;
528    }
529
530    protected void listChildren(List<Property> children) {
531      super.listChildren(children);
532      children.add(new Property("code", "code", "The type of relationship that this document has with anther document.",
533          0, 1, code));
534      children.add(new Property("target", "Reference(DocumentReference)", "The target document of this relationship.",
535          0, 1, target));
536    }
537
538    @Override
539    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
540      switch (_hash) {
541      case 3059181:
542        /* code */ return new Property("code", "code",
543            "The type of relationship that this document has with anther document.", 0, 1, code);
544      case -880905839:
545        /* target */ return new Property("target", "Reference(DocumentReference)",
546            "The target document of this relationship.", 0, 1, target);
547      default:
548        return super.getNamedProperty(_hash, _name, _checkValid);
549      }
550
551    }
552
553    @Override
554    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
555      switch (hash) {
556      case 3059181:
557        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // Enumeration<DocumentRelationshipType>
558      case -880905839:
559        /* target */ return this.target == null ? new Base[0] : new Base[] { this.target }; // Reference
560      default:
561        return super.getProperty(hash, name, checkValid);
562      }
563
564    }
565
566    @Override
567    public Base setProperty(int hash, String name, Base value) throws FHIRException {
568      switch (hash) {
569      case 3059181: // code
570        value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
571        this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
572        return value;
573      case -880905839: // target
574        this.target = castToReference(value); // Reference
575        return value;
576      default:
577        return super.setProperty(hash, name, value);
578      }
579
580    }
581
582    @Override
583    public Base setProperty(String name, Base value) throws FHIRException {
584      if (name.equals("code")) {
585        value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
586        this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
587      } else if (name.equals("target")) {
588        this.target = castToReference(value); // Reference
589      } else
590        return super.setProperty(name, value);
591      return value;
592    }
593
594  @Override
595  public void removeChild(String name, Base value) throws FHIRException {
596      if (name.equals("code")) {
597        this.code = null;
598      } else if (name.equals("target")) {
599        this.target = null;
600      } else
601        super.removeChild(name, value);
602      
603    }
604
605    @Override
606    public Base makeProperty(int hash, String name) throws FHIRException {
607      switch (hash) {
608      case 3059181:
609        return getCodeElement();
610      case -880905839:
611        return getTarget();
612      default:
613        return super.makeProperty(hash, name);
614      }
615
616    }
617
618    @Override
619    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
620      switch (hash) {
621      case 3059181:
622        /* code */ return new String[] { "code" };
623      case -880905839:
624        /* target */ return new String[] { "Reference" };
625      default:
626        return super.getTypesForProperty(hash, name);
627      }
628
629    }
630
631    @Override
632    public Base addChild(String name) throws FHIRException {
633      if (name.equals("code")) {
634        throw new FHIRException("Cannot call addChild on a singleton property DocumentReference.code");
635      } else if (name.equals("target")) {
636        this.target = new Reference();
637        return this.target;
638      } else
639        return super.addChild(name);
640    }
641
642    public DocumentReferenceRelatesToComponent copy() {
643      DocumentReferenceRelatesToComponent dst = new DocumentReferenceRelatesToComponent();
644      copyValues(dst);
645      return dst;
646    }
647
648    public void copyValues(DocumentReferenceRelatesToComponent dst) {
649      super.copyValues(dst);
650      dst.code = code == null ? null : code.copy();
651      dst.target = target == null ? null : target.copy();
652    }
653
654    @Override
655    public boolean equalsDeep(Base other_) {
656      if (!super.equalsDeep(other_))
657        return false;
658      if (!(other_ instanceof DocumentReferenceRelatesToComponent))
659        return false;
660      DocumentReferenceRelatesToComponent o = (DocumentReferenceRelatesToComponent) other_;
661      return compareDeep(code, o.code, true) && compareDeep(target, o.target, true);
662    }
663
664    @Override
665    public boolean equalsShallow(Base other_) {
666      if (!super.equalsShallow(other_))
667        return false;
668      if (!(other_ instanceof DocumentReferenceRelatesToComponent))
669        return false;
670      DocumentReferenceRelatesToComponent o = (DocumentReferenceRelatesToComponent) other_;
671      return compareValues(code, o.code, true);
672    }
673
674    public boolean isEmpty() {
675      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, target);
676    }
677
678    public String fhirType() {
679      return "DocumentReference.relatesTo";
680
681    }
682
683  }
684
685  @Block()
686  public static class DocumentReferenceContentComponent extends BackboneElement implements IBaseBackboneElement {
687    /**
688     * The document or URL of the document along with critical metadata to prove
689     * content has integrity.
690     */
691    @Child(name = "attachment", type = {
692        Attachment.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
693    @Description(shortDefinition = "Where to access the document", formalDefinition = "The document or URL of the document along with critical metadata to prove content has integrity.")
694    protected Attachment attachment;
695
696    /**
697     * An identifier of the document encoding, structure, and template that the
698     * document conforms to beyond the base format indicated in the mimeType.
699     */
700    @Child(name = "format", type = { Coding.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
701    @Description(shortDefinition = "Format/content rules for the document", formalDefinition = "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.")
702    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/formatcodes")
703    protected Coding format;
704
705    private static final long serialVersionUID = -1313860217L;
706
707    /**
708     * Constructor
709     */
710    public DocumentReferenceContentComponent() {
711      super();
712    }
713
714    /**
715     * Constructor
716     */
717    public DocumentReferenceContentComponent(Attachment attachment) {
718      super();
719      this.attachment = attachment;
720    }
721
722    /**
723     * @return {@link #attachment} (The document or URL of the document along with
724     *         critical metadata to prove content has integrity.)
725     */
726    public Attachment getAttachment() {
727      if (this.attachment == null)
728        if (Configuration.errorOnAutoCreate())
729          throw new Error("Attempt to auto-create DocumentReferenceContentComponent.attachment");
730        else if (Configuration.doAutoCreate())
731          this.attachment = new Attachment(); // cc
732      return this.attachment;
733    }
734
735    public boolean hasAttachment() {
736      return this.attachment != null && !this.attachment.isEmpty();
737    }
738
739    /**
740     * @param value {@link #attachment} (The document or URL of the document along
741     *              with critical metadata to prove content has integrity.)
742     */
743    public DocumentReferenceContentComponent setAttachment(Attachment value) {
744      this.attachment = value;
745      return this;
746    }
747
748    /**
749     * @return {@link #format} (An identifier of the document encoding, structure,
750     *         and template that the document conforms to beyond the base format
751     *         indicated in the mimeType.)
752     */
753    public Coding getFormat() {
754      if (this.format == null)
755        if (Configuration.errorOnAutoCreate())
756          throw new Error("Attempt to auto-create DocumentReferenceContentComponent.format");
757        else if (Configuration.doAutoCreate())
758          this.format = new Coding(); // cc
759      return this.format;
760    }
761
762    public boolean hasFormat() {
763      return this.format != null && !this.format.isEmpty();
764    }
765
766    /**
767     * @param value {@link #format} (An identifier of the document encoding,
768     *              structure, and template that the document conforms to beyond the
769     *              base format indicated in the mimeType.)
770     */
771    public DocumentReferenceContentComponent setFormat(Coding value) {
772      this.format = value;
773      return this;
774    }
775
776    protected void listChildren(List<Property> children) {
777      super.listChildren(children);
778      children.add(new Property("attachment", "Attachment",
779          "The document or URL of the document along with critical metadata to prove content has integrity.", 0, 1,
780          attachment));
781      children.add(new Property("format", "Coding",
782          "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.",
783          0, 1, format));
784    }
785
786    @Override
787    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
788      switch (_hash) {
789      case -1963501277:
790        /* attachment */ return new Property("attachment", "Attachment",
791            "The document or URL of the document along with critical metadata to prove content has integrity.", 0, 1,
792            attachment);
793      case -1268779017:
794        /* format */ return new Property("format", "Coding",
795            "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.",
796            0, 1, format);
797      default:
798        return super.getNamedProperty(_hash, _name, _checkValid);
799      }
800
801    }
802
803    @Override
804    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
805      switch (hash) {
806      case -1963501277:
807        /* attachment */ return this.attachment == null ? new Base[0] : new Base[] { this.attachment }; // Attachment
808      case -1268779017:
809        /* format */ return this.format == null ? new Base[0] : new Base[] { this.format }; // Coding
810      default:
811        return super.getProperty(hash, name, checkValid);
812      }
813
814    }
815
816    @Override
817    public Base setProperty(int hash, String name, Base value) throws FHIRException {
818      switch (hash) {
819      case -1963501277: // attachment
820        this.attachment = castToAttachment(value); // Attachment
821        return value;
822      case -1268779017: // format
823        this.format = castToCoding(value); // Coding
824        return value;
825      default:
826        return super.setProperty(hash, name, value);
827      }
828
829    }
830
831    @Override
832    public Base setProperty(String name, Base value) throws FHIRException {
833      if (name.equals("attachment")) {
834        this.attachment = castToAttachment(value); // Attachment
835      } else if (name.equals("format")) {
836        this.format = castToCoding(value); // Coding
837      } else
838        return super.setProperty(name, value);
839      return value;
840    }
841
842  @Override
843  public void removeChild(String name, Base value) throws FHIRException {
844      if (name.equals("attachment")) {
845        this.attachment = null;
846      } else if (name.equals("format")) {
847        this.format = null;
848      } else
849        super.removeChild(name, value);
850      
851    }
852
853    @Override
854    public Base makeProperty(int hash, String name) throws FHIRException {
855      switch (hash) {
856      case -1963501277:
857        return getAttachment();
858      case -1268779017:
859        return getFormat();
860      default:
861        return super.makeProperty(hash, name);
862      }
863
864    }
865
866    @Override
867    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
868      switch (hash) {
869      case -1963501277:
870        /* attachment */ return new String[] { "Attachment" };
871      case -1268779017:
872        /* format */ return new String[] { "Coding" };
873      default:
874        return super.getTypesForProperty(hash, name);
875      }
876
877    }
878
879    @Override
880    public Base addChild(String name) throws FHIRException {
881      if (name.equals("attachment")) {
882        this.attachment = new Attachment();
883        return this.attachment;
884      } else if (name.equals("format")) {
885        this.format = new Coding();
886        return this.format;
887      } else
888        return super.addChild(name);
889    }
890
891    public DocumentReferenceContentComponent copy() {
892      DocumentReferenceContentComponent dst = new DocumentReferenceContentComponent();
893      copyValues(dst);
894      return dst;
895    }
896
897    public void copyValues(DocumentReferenceContentComponent dst) {
898      super.copyValues(dst);
899      dst.attachment = attachment == null ? null : attachment.copy();
900      dst.format = format == null ? null : format.copy();
901    }
902
903    @Override
904    public boolean equalsDeep(Base other_) {
905      if (!super.equalsDeep(other_))
906        return false;
907      if (!(other_ instanceof DocumentReferenceContentComponent))
908        return false;
909      DocumentReferenceContentComponent o = (DocumentReferenceContentComponent) other_;
910      return compareDeep(attachment, o.attachment, true) && compareDeep(format, o.format, true);
911    }
912
913    @Override
914    public boolean equalsShallow(Base other_) {
915      if (!super.equalsShallow(other_))
916        return false;
917      if (!(other_ instanceof DocumentReferenceContentComponent))
918        return false;
919      DocumentReferenceContentComponent o = (DocumentReferenceContentComponent) other_;
920      return true;
921    }
922
923    public boolean isEmpty() {
924      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(attachment, format);
925    }
926
927    public String fhirType() {
928      return "DocumentReference.content";
929
930    }
931
932  }
933
934  @Block()
935  public static class DocumentReferenceContextComponent extends BackboneElement implements IBaseBackboneElement {
936    /**
937     * Describes the clinical encounter or type of care that the document content is
938     * associated with.
939     */
940    @Child(name = "encounter", type = { Encounter.class,
941        EpisodeOfCare.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
942    @Description(shortDefinition = "Context of the document  content", formalDefinition = "Describes the clinical encounter or type of care that the document content is associated with.")
943    protected List<Reference> encounter;
944    /**
945     * The actual objects that are the target of the reference (Describes the
946     * clinical encounter or type of care that the document content is associated
947     * with.)
948     */
949    protected List<Resource> encounterTarget;
950
951    /**
952     * This list of codes represents the main clinical acts, such as a colonoscopy
953     * or an appendectomy, being documented. In some cases, the event is inherent in
954     * the type Code, such as a "History and Physical Report" in which the procedure
955     * being documented is necessarily a "History and Physical" act.
956     */
957    @Child(name = "event", type = {
958        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
959    @Description(shortDefinition = "Main clinical acts documented", formalDefinition = "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.")
960    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActCode")
961    protected List<CodeableConcept> event;
962
963    /**
964     * The time period over which the service that is described by the document was
965     * provided.
966     */
967    @Child(name = "period", type = { Period.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
968    @Description(shortDefinition = "Time of service that is being documented", formalDefinition = "The time period over which the service that is described by the document was provided.")
969    protected Period period;
970
971    /**
972     * The kind of facility where the patient was seen.
973     */
974    @Child(name = "facilityType", type = {
975        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
976    @Description(shortDefinition = "Kind of facility where patient was seen", formalDefinition = "The kind of facility where the patient was seen.")
977    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/c80-facilitycodes")
978    protected CodeableConcept facilityType;
979
980    /**
981     * This property may convey specifics about the practice setting where the
982     * content was created, often reflecting the clinical specialty.
983     */
984    @Child(name = "practiceSetting", type = {
985        CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
986    @Description(shortDefinition = "Additional details about where the content was created (e.g. clinical specialty)", formalDefinition = "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.")
987    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/c80-practice-codes")
988    protected CodeableConcept practiceSetting;
989
990    /**
991     * The Patient Information as known when the document was published. May be a
992     * reference to a version specific, or contained.
993     */
994    @Child(name = "sourcePatientInfo", type = {
995        Patient.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
996    @Description(shortDefinition = "Patient demographics from source", formalDefinition = "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.")
997    protected Reference sourcePatientInfo;
998
999    /**
1000     * The actual object that is the target of the reference (The Patient
1001     * Information as known when the document was published. May be a reference to a
1002     * version specific, or contained.)
1003     */
1004    protected Patient sourcePatientInfoTarget;
1005
1006    /**
1007     * Related identifiers or resources associated with the DocumentReference.
1008     */
1009    @Child(name = "related", type = {
1010        Reference.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1011    @Description(shortDefinition = "Related identifiers or resources", formalDefinition = "Related identifiers or resources associated with the DocumentReference.")
1012    protected List<Reference> related;
1013    /**
1014     * The actual objects that are the target of the reference (Related identifiers
1015     * or resources associated with the DocumentReference.)
1016     */
1017    protected List<Resource> relatedTarget;
1018
1019    private static final long serialVersionUID = 140463218L;
1020
1021    /**
1022     * Constructor
1023     */
1024    public DocumentReferenceContextComponent() {
1025      super();
1026    }
1027
1028    /**
1029     * @return {@link #encounter} (Describes the clinical encounter or type of care
1030     *         that the document content is associated with.)
1031     */
1032    public List<Reference> getEncounter() {
1033      if (this.encounter == null)
1034        this.encounter = new ArrayList<Reference>();
1035      return this.encounter;
1036    }
1037
1038    /**
1039     * @return Returns a reference to <code>this</code> for easy method chaining
1040     */
1041    public DocumentReferenceContextComponent setEncounter(List<Reference> theEncounter) {
1042      this.encounter = theEncounter;
1043      return this;
1044    }
1045
1046    public boolean hasEncounter() {
1047      if (this.encounter == null)
1048        return false;
1049      for (Reference item : this.encounter)
1050        if (!item.isEmpty())
1051          return true;
1052      return false;
1053    }
1054
1055    public Reference addEncounter() { // 3
1056      Reference t = new Reference();
1057      if (this.encounter == null)
1058        this.encounter = new ArrayList<Reference>();
1059      this.encounter.add(t);
1060      return t;
1061    }
1062
1063    public DocumentReferenceContextComponent addEncounter(Reference t) { // 3
1064      if (t == null)
1065        return this;
1066      if (this.encounter == null)
1067        this.encounter = new ArrayList<Reference>();
1068      this.encounter.add(t);
1069      return this;
1070    }
1071
1072    /**
1073     * @return The first repetition of repeating field {@link #encounter}, creating
1074     *         it if it does not already exist
1075     */
1076    public Reference getEncounterFirstRep() {
1077      if (getEncounter().isEmpty()) {
1078        addEncounter();
1079      }
1080      return getEncounter().get(0);
1081    }
1082
1083    /**
1084     * @deprecated Use Reference#setResource(IBaseResource) instead
1085     */
1086    @Deprecated
1087    public List<Resource> getEncounterTarget() {
1088      if (this.encounterTarget == null)
1089        this.encounterTarget = new ArrayList<Resource>();
1090      return this.encounterTarget;
1091    }
1092
1093    /**
1094     * @return {@link #event} (This list of codes represents the main clinical acts,
1095     *         such as a colonoscopy or an appendectomy, being documented. In some
1096     *         cases, the event is inherent in the type Code, such as a "History and
1097     *         Physical Report" in which the procedure being documented is
1098     *         necessarily a "History and Physical" act.)
1099     */
1100    public List<CodeableConcept> getEvent() {
1101      if (this.event == null)
1102        this.event = new ArrayList<CodeableConcept>();
1103      return this.event;
1104    }
1105
1106    /**
1107     * @return Returns a reference to <code>this</code> for easy method chaining
1108     */
1109    public DocumentReferenceContextComponent setEvent(List<CodeableConcept> theEvent) {
1110      this.event = theEvent;
1111      return this;
1112    }
1113
1114    public boolean hasEvent() {
1115      if (this.event == null)
1116        return false;
1117      for (CodeableConcept item : this.event)
1118        if (!item.isEmpty())
1119          return true;
1120      return false;
1121    }
1122
1123    public CodeableConcept addEvent() { // 3
1124      CodeableConcept t = new CodeableConcept();
1125      if (this.event == null)
1126        this.event = new ArrayList<CodeableConcept>();
1127      this.event.add(t);
1128      return t;
1129    }
1130
1131    public DocumentReferenceContextComponent addEvent(CodeableConcept t) { // 3
1132      if (t == null)
1133        return this;
1134      if (this.event == null)
1135        this.event = new ArrayList<CodeableConcept>();
1136      this.event.add(t);
1137      return this;
1138    }
1139
1140    /**
1141     * @return The first repetition of repeating field {@link #event}, creating it
1142     *         if it does not already exist
1143     */
1144    public CodeableConcept getEventFirstRep() {
1145      if (getEvent().isEmpty()) {
1146        addEvent();
1147      }
1148      return getEvent().get(0);
1149    }
1150
1151    /**
1152     * @return {@link #period} (The time period over which the service that is
1153     *         described by the document was provided.)
1154     */
1155    public Period getPeriod() {
1156      if (this.period == null)
1157        if (Configuration.errorOnAutoCreate())
1158          throw new Error("Attempt to auto-create DocumentReferenceContextComponent.period");
1159        else if (Configuration.doAutoCreate())
1160          this.period = new Period(); // cc
1161      return this.period;
1162    }
1163
1164    public boolean hasPeriod() {
1165      return this.period != null && !this.period.isEmpty();
1166    }
1167
1168    /**
1169     * @param value {@link #period} (The time period over which the service that is
1170     *              described by the document was provided.)
1171     */
1172    public DocumentReferenceContextComponent setPeriod(Period value) {
1173      this.period = value;
1174      return this;
1175    }
1176
1177    /**
1178     * @return {@link #facilityType} (The kind of facility where the patient was
1179     *         seen.)
1180     */
1181    public CodeableConcept getFacilityType() {
1182      if (this.facilityType == null)
1183        if (Configuration.errorOnAutoCreate())
1184          throw new Error("Attempt to auto-create DocumentReferenceContextComponent.facilityType");
1185        else if (Configuration.doAutoCreate())
1186          this.facilityType = new CodeableConcept(); // cc
1187      return this.facilityType;
1188    }
1189
1190    public boolean hasFacilityType() {
1191      return this.facilityType != null && !this.facilityType.isEmpty();
1192    }
1193
1194    /**
1195     * @param value {@link #facilityType} (The kind of facility where the patient
1196     *              was seen.)
1197     */
1198    public DocumentReferenceContextComponent setFacilityType(CodeableConcept value) {
1199      this.facilityType = value;
1200      return this;
1201    }
1202
1203    /**
1204     * @return {@link #practiceSetting} (This property may convey specifics about
1205     *         the practice setting where the content was created, often reflecting
1206     *         the clinical specialty.)
1207     */
1208    public CodeableConcept getPracticeSetting() {
1209      if (this.practiceSetting == null)
1210        if (Configuration.errorOnAutoCreate())
1211          throw new Error("Attempt to auto-create DocumentReferenceContextComponent.practiceSetting");
1212        else if (Configuration.doAutoCreate())
1213          this.practiceSetting = new CodeableConcept(); // cc
1214      return this.practiceSetting;
1215    }
1216
1217    public boolean hasPracticeSetting() {
1218      return this.practiceSetting != null && !this.practiceSetting.isEmpty();
1219    }
1220
1221    /**
1222     * @param value {@link #practiceSetting} (This property may convey specifics
1223     *              about the practice setting where the content was created, often
1224     *              reflecting the clinical specialty.)
1225     */
1226    public DocumentReferenceContextComponent setPracticeSetting(CodeableConcept value) {
1227      this.practiceSetting = value;
1228      return this;
1229    }
1230
1231    /**
1232     * @return {@link #sourcePatientInfo} (The Patient Information as known when the
1233     *         document was published. May be a reference to a version specific, or
1234     *         contained.)
1235     */
1236    public Reference getSourcePatientInfo() {
1237      if (this.sourcePatientInfo == null)
1238        if (Configuration.errorOnAutoCreate())
1239          throw new Error("Attempt to auto-create DocumentReferenceContextComponent.sourcePatientInfo");
1240        else if (Configuration.doAutoCreate())
1241          this.sourcePatientInfo = new Reference(); // cc
1242      return this.sourcePatientInfo;
1243    }
1244
1245    public boolean hasSourcePatientInfo() {
1246      return this.sourcePatientInfo != null && !this.sourcePatientInfo.isEmpty();
1247    }
1248
1249    /**
1250     * @param value {@link #sourcePatientInfo} (The Patient Information as known
1251     *              when the document was published. May be a reference to a version
1252     *              specific, or contained.)
1253     */
1254    public DocumentReferenceContextComponent setSourcePatientInfo(Reference value) {
1255      this.sourcePatientInfo = value;
1256      return this;
1257    }
1258
1259    /**
1260     * @return {@link #sourcePatientInfo} The actual object that is the target of
1261     *         the reference. The reference library doesn't populate this, but you
1262     *         can use it to hold the resource if you resolve it. (The Patient
1263     *         Information as known when the document was published. May be a
1264     *         reference to a version specific, or contained.)
1265     */
1266    public Patient getSourcePatientInfoTarget() {
1267      if (this.sourcePatientInfoTarget == null)
1268        if (Configuration.errorOnAutoCreate())
1269          throw new Error("Attempt to auto-create DocumentReferenceContextComponent.sourcePatientInfo");
1270        else if (Configuration.doAutoCreate())
1271          this.sourcePatientInfoTarget = new Patient(); // aa
1272      return this.sourcePatientInfoTarget;
1273    }
1274
1275    /**
1276     * @param value {@link #sourcePatientInfo} The actual object that is the target
1277     *              of the reference. The reference library doesn't use these, but
1278     *              you can use it to hold the resource if you resolve it. (The
1279     *              Patient Information as known when the document was published.
1280     *              May be a reference to a version specific, or contained.)
1281     */
1282    public DocumentReferenceContextComponent setSourcePatientInfoTarget(Patient value) {
1283      this.sourcePatientInfoTarget = value;
1284      return this;
1285    }
1286
1287    /**
1288     * @return {@link #related} (Related identifiers or resources associated with
1289     *         the DocumentReference.)
1290     */
1291    public List<Reference> getRelated() {
1292      if (this.related == null)
1293        this.related = new ArrayList<Reference>();
1294      return this.related;
1295    }
1296
1297    /**
1298     * @return Returns a reference to <code>this</code> for easy method chaining
1299     */
1300    public DocumentReferenceContextComponent setRelated(List<Reference> theRelated) {
1301      this.related = theRelated;
1302      return this;
1303    }
1304
1305    public boolean hasRelated() {
1306      if (this.related == null)
1307        return false;
1308      for (Reference item : this.related)
1309        if (!item.isEmpty())
1310          return true;
1311      return false;
1312    }
1313
1314    public Reference addRelated() { // 3
1315      Reference t = new Reference();
1316      if (this.related == null)
1317        this.related = new ArrayList<Reference>();
1318      this.related.add(t);
1319      return t;
1320    }
1321
1322    public DocumentReferenceContextComponent addRelated(Reference t) { // 3
1323      if (t == null)
1324        return this;
1325      if (this.related == null)
1326        this.related = new ArrayList<Reference>();
1327      this.related.add(t);
1328      return this;
1329    }
1330
1331    /**
1332     * @return The first repetition of repeating field {@link #related}, creating it
1333     *         if it does not already exist
1334     */
1335    public Reference getRelatedFirstRep() {
1336      if (getRelated().isEmpty()) {
1337        addRelated();
1338      }
1339      return getRelated().get(0);
1340    }
1341
1342    /**
1343     * @deprecated Use Reference#setResource(IBaseResource) instead
1344     */
1345    @Deprecated
1346    public List<Resource> getRelatedTarget() {
1347      if (this.relatedTarget == null)
1348        this.relatedTarget = new ArrayList<Resource>();
1349      return this.relatedTarget;
1350    }
1351
1352    protected void listChildren(List<Property> children) {
1353      super.listChildren(children);
1354      children.add(new Property("encounter", "Reference(Encounter|EpisodeOfCare)",
1355          "Describes the clinical encounter or type of care that the document content is associated with.", 0,
1356          java.lang.Integer.MAX_VALUE, encounter));
1357      children.add(new Property("event", "CodeableConcept",
1358          "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.",
1359          0, java.lang.Integer.MAX_VALUE, event));
1360      children.add(new Property("period", "Period",
1361          "The time period over which the service that is described by the document was provided.", 0, 1, period));
1362      children.add(new Property("facilityType", "CodeableConcept", "The kind of facility where the patient was seen.",
1363          0, 1, facilityType));
1364      children.add(new Property("practiceSetting", "CodeableConcept",
1365          "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.",
1366          0, 1, practiceSetting));
1367      children.add(new Property("sourcePatientInfo", "Reference(Patient)",
1368          "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.",
1369          0, 1, sourcePatientInfo));
1370      children.add(new Property("related", "Reference(Any)",
1371          "Related identifiers or resources associated with the DocumentReference.", 0, java.lang.Integer.MAX_VALUE,
1372          related));
1373    }
1374
1375    @Override
1376    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1377      switch (_hash) {
1378      case 1524132147:
1379        /* encounter */ return new Property("encounter", "Reference(Encounter|EpisodeOfCare)",
1380            "Describes the clinical encounter or type of care that the document content is associated with.", 0,
1381            java.lang.Integer.MAX_VALUE, encounter);
1382      case 96891546:
1383        /* event */ return new Property("event", "CodeableConcept",
1384            "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.",
1385            0, java.lang.Integer.MAX_VALUE, event);
1386      case -991726143:
1387        /* period */ return new Property("period", "Period",
1388            "The time period over which the service that is described by the document was provided.", 0, 1, period);
1389      case 370698365:
1390        /* facilityType */ return new Property("facilityType", "CodeableConcept",
1391            "The kind of facility where the patient was seen.", 0, 1, facilityType);
1392      case 331373717:
1393        /* practiceSetting */ return new Property("practiceSetting", "CodeableConcept",
1394            "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.",
1395            0, 1, practiceSetting);
1396      case 2031381048:
1397        /* sourcePatientInfo */ return new Property("sourcePatientInfo", "Reference(Patient)",
1398            "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.",
1399            0, 1, sourcePatientInfo);
1400      case 1090493483:
1401        /* related */ return new Property("related", "Reference(Any)",
1402            "Related identifiers or resources associated with the DocumentReference.", 0, java.lang.Integer.MAX_VALUE,
1403            related);
1404      default:
1405        return super.getNamedProperty(_hash, _name, _checkValid);
1406      }
1407
1408    }
1409
1410    @Override
1411    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1412      switch (hash) {
1413      case 1524132147:
1414        /* encounter */ return this.encounter == null ? new Base[0]
1415            : this.encounter.toArray(new Base[this.encounter.size()]); // Reference
1416      case 96891546:
1417        /* event */ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CodeableConcept
1418      case -991726143:
1419        /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
1420      case 370698365:
1421        /* facilityType */ return this.facilityType == null ? new Base[0] : new Base[] { this.facilityType }; // CodeableConcept
1422      case 331373717:
1423        /* practiceSetting */ return this.practiceSetting == null ? new Base[0] : new Base[] { this.practiceSetting }; // CodeableConcept
1424      case 2031381048:
1425        /* sourcePatientInfo */ return this.sourcePatientInfo == null ? new Base[0]
1426            : new Base[] { this.sourcePatientInfo }; // Reference
1427      case 1090493483:
1428        /* related */ return this.related == null ? new Base[0] : this.related.toArray(new Base[this.related.size()]); // Reference
1429      default:
1430        return super.getProperty(hash, name, checkValid);
1431      }
1432
1433    }
1434
1435    @Override
1436    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1437      switch (hash) {
1438      case 1524132147: // encounter
1439        this.getEncounter().add(castToReference(value)); // Reference
1440        return value;
1441      case 96891546: // event
1442        this.getEvent().add(castToCodeableConcept(value)); // CodeableConcept
1443        return value;
1444      case -991726143: // period
1445        this.period = castToPeriod(value); // Period
1446        return value;
1447      case 370698365: // facilityType
1448        this.facilityType = castToCodeableConcept(value); // CodeableConcept
1449        return value;
1450      case 331373717: // practiceSetting
1451        this.practiceSetting = castToCodeableConcept(value); // CodeableConcept
1452        return value;
1453      case 2031381048: // sourcePatientInfo
1454        this.sourcePatientInfo = castToReference(value); // Reference
1455        return value;
1456      case 1090493483: // related
1457        this.getRelated().add(castToReference(value)); // Reference
1458        return value;
1459      default:
1460        return super.setProperty(hash, name, value);
1461      }
1462
1463    }
1464
1465    @Override
1466    public Base setProperty(String name, Base value) throws FHIRException {
1467      if (name.equals("encounter")) {
1468        this.getEncounter().add(castToReference(value));
1469      } else if (name.equals("event")) {
1470        this.getEvent().add(castToCodeableConcept(value));
1471      } else if (name.equals("period")) {
1472        this.period = castToPeriod(value); // Period
1473      } else if (name.equals("facilityType")) {
1474        this.facilityType = castToCodeableConcept(value); // CodeableConcept
1475      } else if (name.equals("practiceSetting")) {
1476        this.practiceSetting = castToCodeableConcept(value); // CodeableConcept
1477      } else if (name.equals("sourcePatientInfo")) {
1478        this.sourcePatientInfo = castToReference(value); // Reference
1479      } else if (name.equals("related")) {
1480        this.getRelated().add(castToReference(value));
1481      } else
1482        return super.setProperty(name, value);
1483      return value;
1484    }
1485
1486  @Override
1487  public void removeChild(String name, Base value) throws FHIRException {
1488      if (name.equals("encounter")) {
1489        this.getEncounter().remove(castToReference(value));
1490      } else if (name.equals("event")) {
1491        this.getEvent().remove(castToCodeableConcept(value));
1492      } else if (name.equals("period")) {
1493        this.period = null;
1494      } else if (name.equals("facilityType")) {
1495        this.facilityType = null;
1496      } else if (name.equals("practiceSetting")) {
1497        this.practiceSetting = null;
1498      } else if (name.equals("sourcePatientInfo")) {
1499        this.sourcePatientInfo = null;
1500      } else if (name.equals("related")) {
1501        this.getRelated().remove(castToReference(value));
1502      } else
1503        super.removeChild(name, value);
1504      
1505    }
1506
1507    @Override
1508    public Base makeProperty(int hash, String name) throws FHIRException {
1509      switch (hash) {
1510      case 1524132147:
1511        return addEncounter();
1512      case 96891546:
1513        return addEvent();
1514      case -991726143:
1515        return getPeriod();
1516      case 370698365:
1517        return getFacilityType();
1518      case 331373717:
1519        return getPracticeSetting();
1520      case 2031381048:
1521        return getSourcePatientInfo();
1522      case 1090493483:
1523        return addRelated();
1524      default:
1525        return super.makeProperty(hash, name);
1526      }
1527
1528    }
1529
1530    @Override
1531    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1532      switch (hash) {
1533      case 1524132147:
1534        /* encounter */ return new String[] { "Reference" };
1535      case 96891546:
1536        /* event */ return new String[] { "CodeableConcept" };
1537      case -991726143:
1538        /* period */ return new String[] { "Period" };
1539      case 370698365:
1540        /* facilityType */ return new String[] { "CodeableConcept" };
1541      case 331373717:
1542        /* practiceSetting */ return new String[] { "CodeableConcept" };
1543      case 2031381048:
1544        /* sourcePatientInfo */ return new String[] { "Reference" };
1545      case 1090493483:
1546        /* related */ return new String[] { "Reference" };
1547      default:
1548        return super.getTypesForProperty(hash, name);
1549      }
1550
1551    }
1552
1553    @Override
1554    public Base addChild(String name) throws FHIRException {
1555      if (name.equals("encounter")) {
1556        return addEncounter();
1557      } else if (name.equals("event")) {
1558        return addEvent();
1559      } else if (name.equals("period")) {
1560        this.period = new Period();
1561        return this.period;
1562      } else if (name.equals("facilityType")) {
1563        this.facilityType = new CodeableConcept();
1564        return this.facilityType;
1565      } else if (name.equals("practiceSetting")) {
1566        this.practiceSetting = new CodeableConcept();
1567        return this.practiceSetting;
1568      } else if (name.equals("sourcePatientInfo")) {
1569        this.sourcePatientInfo = new Reference();
1570        return this.sourcePatientInfo;
1571      } else if (name.equals("related")) {
1572        return addRelated();
1573      } else
1574        return super.addChild(name);
1575    }
1576
1577    public DocumentReferenceContextComponent copy() {
1578      DocumentReferenceContextComponent dst = new DocumentReferenceContextComponent();
1579      copyValues(dst);
1580      return dst;
1581    }
1582
1583    public void copyValues(DocumentReferenceContextComponent dst) {
1584      super.copyValues(dst);
1585      if (encounter != null) {
1586        dst.encounter = new ArrayList<Reference>();
1587        for (Reference i : encounter)
1588          dst.encounter.add(i.copy());
1589      }
1590      ;
1591      if (event != null) {
1592        dst.event = new ArrayList<CodeableConcept>();
1593        for (CodeableConcept i : event)
1594          dst.event.add(i.copy());
1595      }
1596      ;
1597      dst.period = period == null ? null : period.copy();
1598      dst.facilityType = facilityType == null ? null : facilityType.copy();
1599      dst.practiceSetting = practiceSetting == null ? null : practiceSetting.copy();
1600      dst.sourcePatientInfo = sourcePatientInfo == null ? null : sourcePatientInfo.copy();
1601      if (related != null) {
1602        dst.related = new ArrayList<Reference>();
1603        for (Reference i : related)
1604          dst.related.add(i.copy());
1605      }
1606      ;
1607    }
1608
1609    @Override
1610    public boolean equalsDeep(Base other_) {
1611      if (!super.equalsDeep(other_))
1612        return false;
1613      if (!(other_ instanceof DocumentReferenceContextComponent))
1614        return false;
1615      DocumentReferenceContextComponent o = (DocumentReferenceContextComponent) other_;
1616      return compareDeep(encounter, o.encounter, true) && compareDeep(event, o.event, true)
1617          && compareDeep(period, o.period, true) && compareDeep(facilityType, o.facilityType, true)
1618          && compareDeep(practiceSetting, o.practiceSetting, true)
1619          && compareDeep(sourcePatientInfo, o.sourcePatientInfo, true) && compareDeep(related, o.related, true);
1620    }
1621
1622    @Override
1623    public boolean equalsShallow(Base other_) {
1624      if (!super.equalsShallow(other_))
1625        return false;
1626      if (!(other_ instanceof DocumentReferenceContextComponent))
1627        return false;
1628      DocumentReferenceContextComponent o = (DocumentReferenceContextComponent) other_;
1629      return true;
1630    }
1631
1632    public boolean isEmpty() {
1633      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(encounter, event, period, facilityType,
1634          practiceSetting, sourcePatientInfo, related);
1635    }
1636
1637    public String fhirType() {
1638      return "DocumentReference.context";
1639
1640    }
1641
1642  }
1643
1644  /**
1645   * Document identifier as assigned by the source of the document. This
1646   * identifier is specific to this version of the document. This unique
1647   * identifier may be used elsewhere to identify this version of the document.
1648   */
1649  @Child(name = "masterIdentifier", type = {
1650      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
1651  @Description(shortDefinition = "Master Version Specific Identifier", formalDefinition = "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.")
1652  protected Identifier masterIdentifier;
1653
1654  /**
1655   * Other identifiers associated with the document, including version independent
1656   * identifiers.
1657   */
1658  @Child(name = "identifier", type = {
1659      Identifier.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1660  @Description(shortDefinition = "Other identifiers for the document", formalDefinition = "Other identifiers associated with the document, including version independent identifiers.")
1661  protected List<Identifier> identifier;
1662
1663  /**
1664   * The status of this document reference.
1665   */
1666  @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
1667  @Description(shortDefinition = "current | superseded | entered-in-error", formalDefinition = "The status of this document reference.")
1668  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/document-reference-status")
1669  protected Enumeration<DocumentReferenceStatus> status;
1670
1671  /**
1672   * The status of the underlying document.
1673   */
1674  @Child(name = "docStatus", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1675  @Description(shortDefinition = "preliminary | final | amended | entered-in-error", formalDefinition = "The status of the underlying document.")
1676  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/composition-status")
1677  protected Enumeration<ReferredDocumentStatus> docStatus;
1678
1679  /**
1680   * Specifies the particular kind of document referenced (e.g. History and
1681   * Physical, Discharge Summary, Progress Note). This usually equates to the
1682   * purpose of making the document referenced.
1683   */
1684  @Child(name = "type", type = { CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1685  @Description(shortDefinition = "Kind of document (LOINC if possible)", formalDefinition = "Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.")
1686  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/c80-doc-typecodes")
1687  protected CodeableConcept type;
1688
1689  /**
1690   * A categorization for the type of document referenced - helps for indexing and
1691   * searching. This may be implied by or derived from the code specified in the
1692   * DocumentReference.type.
1693   */
1694  @Child(name = "category", type = {
1695      CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1696  @Description(shortDefinition = "Categorization of document", formalDefinition = "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.")
1697  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/document-classcodes")
1698  protected List<CodeableConcept> category;
1699
1700  /**
1701   * Who or what the document is about. The document can be about a person,
1702   * (patient or healthcare practitioner), a device (e.g. a machine) or even a
1703   * group of subjects (such as a document about a herd of farm animals, or a set
1704   * of patients that share a common exposure).
1705   */
1706  @Child(name = "subject", type = { Patient.class, Practitioner.class, Group.class,
1707      Device.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1708  @Description(shortDefinition = "Who/what is the subject of the document", formalDefinition = "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a 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).")
1709  protected Reference subject;
1710
1711  /**
1712   * The actual object that is the target of the reference (Who or what the
1713   * document is about. The document can be about a person, (patient or healthcare
1714   * practitioner), a device (e.g. a machine) or even a group of subjects (such as
1715   * a document about a herd of farm animals, or a set of patients that share a
1716   * common exposure).)
1717   */
1718  protected Resource subjectTarget;
1719
1720  /**
1721   * When the document reference was created.
1722   */
1723  @Child(name = "date", type = { InstantType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1724  @Description(shortDefinition = "When this document reference was created", formalDefinition = "When the document reference was created.")
1725  protected InstantType date;
1726
1727  /**
1728   * Identifies who is responsible for adding the information to the document.
1729   */
1730  @Child(name = "author", type = { Practitioner.class, PractitionerRole.class, Organization.class, Device.class,
1731      Patient.class,
1732      RelatedPerson.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1733  @Description(shortDefinition = "Who and/or what authored the document", formalDefinition = "Identifies who is responsible for adding the information to the document.")
1734  protected List<Reference> author;
1735  /**
1736   * The actual objects that are the target of the reference (Identifies who is
1737   * responsible for adding the information to the document.)
1738   */
1739  protected List<Resource> authorTarget;
1740
1741  /**
1742   * Which person or organization authenticates that this document is valid.
1743   */
1744  @Child(name = "authenticator", type = { Practitioner.class, PractitionerRole.class,
1745      Organization.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1746  @Description(shortDefinition = "Who/what authenticated the document", formalDefinition = "Which person or organization authenticates that this document is valid.")
1747  protected Reference authenticator;
1748
1749  /**
1750   * The actual object that is the target of the reference (Which person or
1751   * organization authenticates that this document is valid.)
1752   */
1753  protected Resource authenticatorTarget;
1754
1755  /**
1756   * Identifies the organization or group who is responsible for ongoing
1757   * maintenance of and access to the document.
1758   */
1759  @Child(name = "custodian", type = {
1760      Organization.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
1761  @Description(shortDefinition = "Organization which maintains the document", formalDefinition = "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.")
1762  protected Reference custodian;
1763
1764  /**
1765   * The actual object that is the target of the reference (Identifies the
1766   * organization or group who is responsible for ongoing maintenance of and
1767   * access to the document.)
1768   */
1769  protected Organization custodianTarget;
1770
1771  /**
1772   * Relationships that this document has with other document references that
1773   * already exist.
1774   */
1775  @Child(name = "relatesTo", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1776  @Description(shortDefinition = "Relationships to other documents", formalDefinition = "Relationships that this document has with other document references that already exist.")
1777  protected List<DocumentReferenceRelatesToComponent> relatesTo;
1778
1779  /**
1780   * Human-readable description of the source document.
1781   */
1782  @Child(name = "description", type = {
1783      StringType.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
1784  @Description(shortDefinition = "Human-readable description", formalDefinition = "Human-readable description of the source document.")
1785  protected StringType description;
1786
1787  /**
1788   * A set of Security-Tag codes specifying the level of privacy/security of the
1789   * Document. Note that DocumentReference.meta.security contains the security
1790   * labels of the "reference" to the document, while
1791   * DocumentReference.securityLabel contains a snapshot of the security labels on
1792   * the document the reference refers to.
1793   */
1794  @Child(name = "securityLabel", type = {
1795      CodeableConcept.class }, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1796  @Description(shortDefinition = "Document security-tags", formalDefinition = "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.")
1797  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/security-labels")
1798  protected List<CodeableConcept> securityLabel;
1799
1800  /**
1801   * The document and format referenced. There may be multiple content element
1802   * repetitions, each with a different format.
1803   */
1804  @Child(name = "content", type = {}, order = 14, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1805  @Description(shortDefinition = "Document referenced", formalDefinition = "The document and format referenced. There may be multiple content element repetitions, each with a different format.")
1806  protected List<DocumentReferenceContentComponent> content;
1807
1808  /**
1809   * The clinical context in which the document was prepared.
1810   */
1811  @Child(name = "context", type = {}, order = 15, min = 0, max = 1, modifier = false, summary = true)
1812  @Description(shortDefinition = "Clinical context of document", formalDefinition = "The clinical context in which the document was prepared.")
1813  protected DocumentReferenceContextComponent context;
1814
1815  private static final long serialVersionUID = 307086535L;
1816
1817  /**
1818   * Constructor
1819   */
1820  public DocumentReference() {
1821    super();
1822  }
1823
1824  /**
1825   * Constructor
1826   */
1827  public DocumentReference(Enumeration<DocumentReferenceStatus> status) {
1828    super();
1829    this.status = status;
1830  }
1831
1832  /**
1833   * @return {@link #masterIdentifier} (Document identifier as assigned by the
1834   *         source of the document. This identifier is specific to this version
1835   *         of the document. This unique identifier may be used elsewhere to
1836   *         identify this version of the document.)
1837   */
1838  public Identifier getMasterIdentifier() {
1839    if (this.masterIdentifier == null)
1840      if (Configuration.errorOnAutoCreate())
1841        throw new Error("Attempt to auto-create DocumentReference.masterIdentifier");
1842      else if (Configuration.doAutoCreate())
1843        this.masterIdentifier = new Identifier(); // cc
1844    return this.masterIdentifier;
1845  }
1846
1847  public boolean hasMasterIdentifier() {
1848    return this.masterIdentifier != null && !this.masterIdentifier.isEmpty();
1849  }
1850
1851  /**
1852   * @param value {@link #masterIdentifier} (Document identifier as assigned by
1853   *              the source of the document. This identifier is specific to this
1854   *              version of the document. This unique identifier may be used
1855   *              elsewhere to identify this version of the document.)
1856   */
1857  public DocumentReference setMasterIdentifier(Identifier value) {
1858    this.masterIdentifier = value;
1859    return this;
1860  }
1861
1862  /**
1863   * @return {@link #identifier} (Other identifiers associated with the document,
1864   *         including version independent identifiers.)
1865   */
1866  public List<Identifier> getIdentifier() {
1867    if (this.identifier == null)
1868      this.identifier = new ArrayList<Identifier>();
1869    return this.identifier;
1870  }
1871
1872  /**
1873   * @return Returns a reference to <code>this</code> for easy method chaining
1874   */
1875  public DocumentReference setIdentifier(List<Identifier> theIdentifier) {
1876    this.identifier = theIdentifier;
1877    return this;
1878  }
1879
1880  public boolean hasIdentifier() {
1881    if (this.identifier == null)
1882      return false;
1883    for (Identifier item : this.identifier)
1884      if (!item.isEmpty())
1885        return true;
1886    return false;
1887  }
1888
1889  public Identifier addIdentifier() { // 3
1890    Identifier t = new Identifier();
1891    if (this.identifier == null)
1892      this.identifier = new ArrayList<Identifier>();
1893    this.identifier.add(t);
1894    return t;
1895  }
1896
1897  public DocumentReference addIdentifier(Identifier t) { // 3
1898    if (t == null)
1899      return this;
1900    if (this.identifier == null)
1901      this.identifier = new ArrayList<Identifier>();
1902    this.identifier.add(t);
1903    return this;
1904  }
1905
1906  /**
1907   * @return The first repetition of repeating field {@link #identifier}, creating
1908   *         it if it does not already exist
1909   */
1910  public Identifier getIdentifierFirstRep() {
1911    if (getIdentifier().isEmpty()) {
1912      addIdentifier();
1913    }
1914    return getIdentifier().get(0);
1915  }
1916
1917  /**
1918   * @return {@link #status} (The status of this document reference.). This is the
1919   *         underlying object with id, value and extensions. The accessor
1920   *         "getStatus" gives direct access to the value
1921   */
1922  public Enumeration<DocumentReferenceStatus> getStatusElement() {
1923    if (this.status == null)
1924      if (Configuration.errorOnAutoCreate())
1925        throw new Error("Attempt to auto-create DocumentReference.status");
1926      else if (Configuration.doAutoCreate())
1927        this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory()); // bb
1928    return this.status;
1929  }
1930
1931  public boolean hasStatusElement() {
1932    return this.status != null && !this.status.isEmpty();
1933  }
1934
1935  public boolean hasStatus() {
1936    return this.status != null && !this.status.isEmpty();
1937  }
1938
1939  /**
1940   * @param value {@link #status} (The status of this document reference.). This
1941   *              is the underlying object with id, value and extensions. The
1942   *              accessor "getStatus" gives direct access to the value
1943   */
1944  public DocumentReference setStatusElement(Enumeration<DocumentReferenceStatus> value) {
1945    this.status = value;
1946    return this;
1947  }
1948
1949  /**
1950   * @return The status of this document reference.
1951   */
1952  public DocumentReferenceStatus getStatus() {
1953    return this.status == null ? null : this.status.getValue();
1954  }
1955
1956  /**
1957   * @param value The status of this document reference.
1958   */
1959  public DocumentReference setStatus(DocumentReferenceStatus value) {
1960    if (this.status == null)
1961      this.status = new Enumeration<DocumentReferenceStatus>(new DocumentReferenceStatusEnumFactory());
1962    this.status.setValue(value);
1963    return this;
1964  }
1965
1966  /**
1967   * @return {@link #docStatus} (The status of the underlying document.). This is
1968   *         the underlying object with id, value and extensions. The accessor
1969   *         "getDocStatus" gives direct access to the value
1970   */
1971  public Enumeration<ReferredDocumentStatus> getDocStatusElement() {
1972    if (this.docStatus == null)
1973      if (Configuration.errorOnAutoCreate())
1974        throw new Error("Attempt to auto-create DocumentReference.docStatus");
1975      else if (Configuration.doAutoCreate())
1976        this.docStatus = new Enumeration<ReferredDocumentStatus>(new ReferredDocumentStatusEnumFactory()); // bb
1977    return this.docStatus;
1978  }
1979
1980  public boolean hasDocStatusElement() {
1981    return this.docStatus != null && !this.docStatus.isEmpty();
1982  }
1983
1984  public boolean hasDocStatus() {
1985    return this.docStatus != null && !this.docStatus.isEmpty();
1986  }
1987
1988  /**
1989   * @param value {@link #docStatus} (The status of the underlying document.).
1990   *              This is the underlying object with id, value and extensions. The
1991   *              accessor "getDocStatus" gives direct access to the value
1992   */
1993  public DocumentReference setDocStatusElement(Enumeration<ReferredDocumentStatus> value) {
1994    this.docStatus = value;
1995    return this;
1996  }
1997
1998  /**
1999   * @return The status of the underlying document.
2000   */
2001  public ReferredDocumentStatus getDocStatus() {
2002    return this.docStatus == null ? null : this.docStatus.getValue();
2003  }
2004
2005  /**
2006   * @param value The status of the underlying document.
2007   */
2008  public DocumentReference setDocStatus(ReferredDocumentStatus value) {
2009    if (value == null)
2010      this.docStatus = null;
2011    else {
2012      if (this.docStatus == null)
2013        this.docStatus = new Enumeration<ReferredDocumentStatus>(new ReferredDocumentStatusEnumFactory());
2014      this.docStatus.setValue(value);
2015    }
2016    return this;
2017  }
2018
2019  /**
2020   * @return {@link #type} (Specifies the particular kind of document referenced
2021   *         (e.g. History and Physical, Discharge Summary, Progress Note). This
2022   *         usually equates to the purpose of making the document referenced.)
2023   */
2024  public CodeableConcept getType() {
2025    if (this.type == null)
2026      if (Configuration.errorOnAutoCreate())
2027        throw new Error("Attempt to auto-create DocumentReference.type");
2028      else if (Configuration.doAutoCreate())
2029        this.type = new CodeableConcept(); // cc
2030    return this.type;
2031  }
2032
2033  public boolean hasType() {
2034    return this.type != null && !this.type.isEmpty();
2035  }
2036
2037  /**
2038   * @param value {@link #type} (Specifies the particular kind of document
2039   *              referenced (e.g. History and Physical, Discharge Summary,
2040   *              Progress Note). This usually equates to the purpose of making
2041   *              the document referenced.)
2042   */
2043  public DocumentReference setType(CodeableConcept value) {
2044    this.type = value;
2045    return this;
2046  }
2047
2048  /**
2049   * @return {@link #category} (A categorization for the type of document
2050   *         referenced - helps for indexing and searching. This may be implied by
2051   *         or derived from the code specified in the DocumentReference.type.)
2052   */
2053  public List<CodeableConcept> getCategory() {
2054    if (this.category == null)
2055      this.category = new ArrayList<CodeableConcept>();
2056    return this.category;
2057  }
2058
2059  /**
2060   * @return Returns a reference to <code>this</code> for easy method chaining
2061   */
2062  public DocumentReference setCategory(List<CodeableConcept> theCategory) {
2063    this.category = theCategory;
2064    return this;
2065  }
2066
2067  public boolean hasCategory() {
2068    if (this.category == null)
2069      return false;
2070    for (CodeableConcept item : this.category)
2071      if (!item.isEmpty())
2072        return true;
2073    return false;
2074  }
2075
2076  public CodeableConcept addCategory() { // 3
2077    CodeableConcept t = new CodeableConcept();
2078    if (this.category == null)
2079      this.category = new ArrayList<CodeableConcept>();
2080    this.category.add(t);
2081    return t;
2082  }
2083
2084  public DocumentReference addCategory(CodeableConcept t) { // 3
2085    if (t == null)
2086      return this;
2087    if (this.category == null)
2088      this.category = new ArrayList<CodeableConcept>();
2089    this.category.add(t);
2090    return this;
2091  }
2092
2093  /**
2094   * @return The first repetition of repeating field {@link #category}, creating
2095   *         it if it does not already exist
2096   */
2097  public CodeableConcept getCategoryFirstRep() {
2098    if (getCategory().isEmpty()) {
2099      addCategory();
2100    }
2101    return getCategory().get(0);
2102  }
2103
2104  /**
2105   * @return {@link #subject} (Who or what the document is about. The document can
2106   *         be about a person, (patient or healthcare practitioner), a device
2107   *         (e.g. a machine) or even a group of subjects (such as a document
2108   *         about a herd of farm animals, or a set of patients that share a
2109   *         common exposure).)
2110   */
2111  public Reference getSubject() {
2112    if (this.subject == null)
2113      if (Configuration.errorOnAutoCreate())
2114        throw new Error("Attempt to auto-create DocumentReference.subject");
2115      else if (Configuration.doAutoCreate())
2116        this.subject = new Reference(); // cc
2117    return this.subject;
2118  }
2119
2120  public boolean hasSubject() {
2121    return this.subject != null && !this.subject.isEmpty();
2122  }
2123
2124  /**
2125   * @param value {@link #subject} (Who or what the document is about. The
2126   *              document can be about a person, (patient or healthcare
2127   *              practitioner), a device (e.g. a machine) or even a group of
2128   *              subjects (such as a document about a herd of farm animals, or a
2129   *              set of patients that share a common exposure).)
2130   */
2131  public DocumentReference setSubject(Reference value) {
2132    this.subject = value;
2133    return this;
2134  }
2135
2136  /**
2137   * @return {@link #subject} The actual object that is the target of the
2138   *         reference. The reference library doesn't populate this, but you can
2139   *         use it to hold the resource if you resolve it. (Who or what the
2140   *         document is about. The document can be about a person, (patient or
2141   *         healthcare practitioner), a device (e.g. a machine) or even a group
2142   *         of subjects (such as a document about a herd of farm animals, or a
2143   *         set of patients that share a common exposure).)
2144   */
2145  public Resource getSubjectTarget() {
2146    return this.subjectTarget;
2147  }
2148
2149  /**
2150   * @param value {@link #subject} The actual object that is the target of the
2151   *              reference. The reference library doesn't use these, but you can
2152   *              use it to hold the resource if you resolve it. (Who or what the
2153   *              document is about. The document can be about a person, (patient
2154   *              or healthcare practitioner), a device (e.g. a machine) or even a
2155   *              group of subjects (such as a document about a herd of farm
2156   *              animals, or a set of patients that share a common exposure).)
2157   */
2158  public DocumentReference setSubjectTarget(Resource value) {
2159    this.subjectTarget = value;
2160    return this;
2161  }
2162
2163  /**
2164   * @return {@link #date} (When the document reference was created.). This is the
2165   *         underlying object with id, value and extensions. The accessor
2166   *         "getDate" gives direct access to the value
2167   */
2168  public InstantType getDateElement() {
2169    if (this.date == null)
2170      if (Configuration.errorOnAutoCreate())
2171        throw new Error("Attempt to auto-create DocumentReference.date");
2172      else if (Configuration.doAutoCreate())
2173        this.date = new InstantType(); // bb
2174    return this.date;
2175  }
2176
2177  public boolean hasDateElement() {
2178    return this.date != null && !this.date.isEmpty();
2179  }
2180
2181  public boolean hasDate() {
2182    return this.date != null && !this.date.isEmpty();
2183  }
2184
2185  /**
2186   * @param value {@link #date} (When the document reference was created.). This
2187   *              is the underlying object with id, value and extensions. The
2188   *              accessor "getDate" gives direct access to the value
2189   */
2190  public DocumentReference setDateElement(InstantType value) {
2191    this.date = value;
2192    return this;
2193  }
2194
2195  /**
2196   * @return When the document reference was created.
2197   */
2198  public Date getDate() {
2199    return this.date == null ? null : this.date.getValue();
2200  }
2201
2202  /**
2203   * @param value When the document reference was created.
2204   */
2205  public DocumentReference setDate(Date value) {
2206    if (value == null)
2207      this.date = null;
2208    else {
2209      if (this.date == null)
2210        this.date = new InstantType();
2211      this.date.setValue(value);
2212    }
2213    return this;
2214  }
2215
2216  /**
2217   * @return {@link #author} (Identifies who is responsible for adding the
2218   *         information to the document.)
2219   */
2220  public List<Reference> getAuthor() {
2221    if (this.author == null)
2222      this.author = new ArrayList<Reference>();
2223    return this.author;
2224  }
2225
2226  /**
2227   * @return Returns a reference to <code>this</code> for easy method chaining
2228   */
2229  public DocumentReference setAuthor(List<Reference> theAuthor) {
2230    this.author = theAuthor;
2231    return this;
2232  }
2233
2234  public boolean hasAuthor() {
2235    if (this.author == null)
2236      return false;
2237    for (Reference item : this.author)
2238      if (!item.isEmpty())
2239        return true;
2240    return false;
2241  }
2242
2243  public Reference addAuthor() { // 3
2244    Reference t = new Reference();
2245    if (this.author == null)
2246      this.author = new ArrayList<Reference>();
2247    this.author.add(t);
2248    return t;
2249  }
2250
2251  public DocumentReference addAuthor(Reference t) { // 3
2252    if (t == null)
2253      return this;
2254    if (this.author == null)
2255      this.author = new ArrayList<Reference>();
2256    this.author.add(t);
2257    return this;
2258  }
2259
2260  /**
2261   * @return The first repetition of repeating field {@link #author}, creating it
2262   *         if it does not already exist
2263   */
2264  public Reference getAuthorFirstRep() {
2265    if (getAuthor().isEmpty()) {
2266      addAuthor();
2267    }
2268    return getAuthor().get(0);
2269  }
2270
2271  /**
2272   * @deprecated Use Reference#setResource(IBaseResource) instead
2273   */
2274  @Deprecated
2275  public List<Resource> getAuthorTarget() {
2276    if (this.authorTarget == null)
2277      this.authorTarget = new ArrayList<Resource>();
2278    return this.authorTarget;
2279  }
2280
2281  /**
2282   * @return {@link #authenticator} (Which person or organization authenticates
2283   *         that this document is valid.)
2284   */
2285  public Reference getAuthenticator() {
2286    if (this.authenticator == null)
2287      if (Configuration.errorOnAutoCreate())
2288        throw new Error("Attempt to auto-create DocumentReference.authenticator");
2289      else if (Configuration.doAutoCreate())
2290        this.authenticator = new Reference(); // cc
2291    return this.authenticator;
2292  }
2293
2294  public boolean hasAuthenticator() {
2295    return this.authenticator != null && !this.authenticator.isEmpty();
2296  }
2297
2298  /**
2299   * @param value {@link #authenticator} (Which person or organization
2300   *              authenticates that this document is valid.)
2301   */
2302  public DocumentReference setAuthenticator(Reference value) {
2303    this.authenticator = value;
2304    return this;
2305  }
2306
2307  /**
2308   * @return {@link #authenticator} The actual object that is the target of the
2309   *         reference. The reference library doesn't populate this, but you can
2310   *         use it to hold the resource if you resolve it. (Which person or
2311   *         organization authenticates that this document is valid.)
2312   */
2313  public Resource getAuthenticatorTarget() {
2314    return this.authenticatorTarget;
2315  }
2316
2317  /**
2318   * @param value {@link #authenticator} The actual object that is the target of
2319   *              the reference. The reference library doesn't use these, but you
2320   *              can use it to hold the resource if you resolve it. (Which person
2321   *              or organization authenticates that this document is valid.)
2322   */
2323  public DocumentReference setAuthenticatorTarget(Resource value) {
2324    this.authenticatorTarget = value;
2325    return this;
2326  }
2327
2328  /**
2329   * @return {@link #custodian} (Identifies the organization or group who is
2330   *         responsible for ongoing maintenance of and access to the document.)
2331   */
2332  public Reference getCustodian() {
2333    if (this.custodian == null)
2334      if (Configuration.errorOnAutoCreate())
2335        throw new Error("Attempt to auto-create DocumentReference.custodian");
2336      else if (Configuration.doAutoCreate())
2337        this.custodian = new Reference(); // cc
2338    return this.custodian;
2339  }
2340
2341  public boolean hasCustodian() {
2342    return this.custodian != null && !this.custodian.isEmpty();
2343  }
2344
2345  /**
2346   * @param value {@link #custodian} (Identifies the organization or group who is
2347   *              responsible for ongoing maintenance of and access to the
2348   *              document.)
2349   */
2350  public DocumentReference setCustodian(Reference value) {
2351    this.custodian = value;
2352    return this;
2353  }
2354
2355  /**
2356   * @return {@link #custodian} The actual object that is the target of the
2357   *         reference. The reference library doesn't populate this, but you can
2358   *         use it to hold the resource if you resolve it. (Identifies the
2359   *         organization or group who is responsible for ongoing maintenance of
2360   *         and access to the document.)
2361   */
2362  public Organization getCustodianTarget() {
2363    if (this.custodianTarget == null)
2364      if (Configuration.errorOnAutoCreate())
2365        throw new Error("Attempt to auto-create DocumentReference.custodian");
2366      else if (Configuration.doAutoCreate())
2367        this.custodianTarget = new Organization(); // aa
2368    return this.custodianTarget;
2369  }
2370
2371  /**
2372   * @param value {@link #custodian} The actual object that is the target of the
2373   *              reference. The reference library doesn't use these, but you can
2374   *              use it to hold the resource if you resolve it. (Identifies the
2375   *              organization or group who is responsible for ongoing maintenance
2376   *              of and access to the document.)
2377   */
2378  public DocumentReference setCustodianTarget(Organization value) {
2379    this.custodianTarget = value;
2380    return this;
2381  }
2382
2383  /**
2384   * @return {@link #relatesTo} (Relationships that this document has with other
2385   *         document references that already exist.)
2386   */
2387  public List<DocumentReferenceRelatesToComponent> getRelatesTo() {
2388    if (this.relatesTo == null)
2389      this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
2390    return this.relatesTo;
2391  }
2392
2393  /**
2394   * @return Returns a reference to <code>this</code> for easy method chaining
2395   */
2396  public DocumentReference setRelatesTo(List<DocumentReferenceRelatesToComponent> theRelatesTo) {
2397    this.relatesTo = theRelatesTo;
2398    return this;
2399  }
2400
2401  public boolean hasRelatesTo() {
2402    if (this.relatesTo == null)
2403      return false;
2404    for (DocumentReferenceRelatesToComponent item : this.relatesTo)
2405      if (!item.isEmpty())
2406        return true;
2407    return false;
2408  }
2409
2410  public DocumentReferenceRelatesToComponent addRelatesTo() { // 3
2411    DocumentReferenceRelatesToComponent t = new DocumentReferenceRelatesToComponent();
2412    if (this.relatesTo == null)
2413      this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
2414    this.relatesTo.add(t);
2415    return t;
2416  }
2417
2418  public DocumentReference addRelatesTo(DocumentReferenceRelatesToComponent t) { // 3
2419    if (t == null)
2420      return this;
2421    if (this.relatesTo == null)
2422      this.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
2423    this.relatesTo.add(t);
2424    return this;
2425  }
2426
2427  /**
2428   * @return The first repetition of repeating field {@link #relatesTo}, creating
2429   *         it if it does not already exist
2430   */
2431  public DocumentReferenceRelatesToComponent getRelatesToFirstRep() {
2432    if (getRelatesTo().isEmpty()) {
2433      addRelatesTo();
2434    }
2435    return getRelatesTo().get(0);
2436  }
2437
2438  /**
2439   * @return {@link #description} (Human-readable description of the source
2440   *         document.). This is the underlying object with id, value and
2441   *         extensions. The accessor "getDescription" gives direct access to the
2442   *         value
2443   */
2444  public StringType getDescriptionElement() {
2445    if (this.description == null)
2446      if (Configuration.errorOnAutoCreate())
2447        throw new Error("Attempt to auto-create DocumentReference.description");
2448      else if (Configuration.doAutoCreate())
2449        this.description = new StringType(); // bb
2450    return this.description;
2451  }
2452
2453  public boolean hasDescriptionElement() {
2454    return this.description != null && !this.description.isEmpty();
2455  }
2456
2457  public boolean hasDescription() {
2458    return this.description != null && !this.description.isEmpty();
2459  }
2460
2461  /**
2462   * @param value {@link #description} (Human-readable description of the source
2463   *              document.). This is the underlying object with id, value and
2464   *              extensions. The accessor "getDescription" gives direct access to
2465   *              the value
2466   */
2467  public DocumentReference setDescriptionElement(StringType value) {
2468    this.description = value;
2469    return this;
2470  }
2471
2472  /**
2473   * @return Human-readable description of the source document.
2474   */
2475  public String getDescription() {
2476    return this.description == null ? null : this.description.getValue();
2477  }
2478
2479  /**
2480   * @param value Human-readable description of the source document.
2481   */
2482  public DocumentReference setDescription(String value) {
2483    if (Utilities.noString(value))
2484      this.description = null;
2485    else {
2486      if (this.description == null)
2487        this.description = new StringType();
2488      this.description.setValue(value);
2489    }
2490    return this;
2491  }
2492
2493  /**
2494   * @return {@link #securityLabel} (A set of Security-Tag codes specifying the
2495   *         level of privacy/security of the Document. Note that
2496   *         DocumentReference.meta.security contains the security labels of the
2497   *         "reference" to the document, while DocumentReference.securityLabel
2498   *         contains a snapshot of the security labels on the document the
2499   *         reference refers to.)
2500   */
2501  public List<CodeableConcept> getSecurityLabel() {
2502    if (this.securityLabel == null)
2503      this.securityLabel = new ArrayList<CodeableConcept>();
2504    return this.securityLabel;
2505  }
2506
2507  /**
2508   * @return Returns a reference to <code>this</code> for easy method chaining
2509   */
2510  public DocumentReference setSecurityLabel(List<CodeableConcept> theSecurityLabel) {
2511    this.securityLabel = theSecurityLabel;
2512    return this;
2513  }
2514
2515  public boolean hasSecurityLabel() {
2516    if (this.securityLabel == null)
2517      return false;
2518    for (CodeableConcept item : this.securityLabel)
2519      if (!item.isEmpty())
2520        return true;
2521    return false;
2522  }
2523
2524  public CodeableConcept addSecurityLabel() { // 3
2525    CodeableConcept t = new CodeableConcept();
2526    if (this.securityLabel == null)
2527      this.securityLabel = new ArrayList<CodeableConcept>();
2528    this.securityLabel.add(t);
2529    return t;
2530  }
2531
2532  public DocumentReference addSecurityLabel(CodeableConcept t) { // 3
2533    if (t == null)
2534      return this;
2535    if (this.securityLabel == null)
2536      this.securityLabel = new ArrayList<CodeableConcept>();
2537    this.securityLabel.add(t);
2538    return this;
2539  }
2540
2541  /**
2542   * @return The first repetition of repeating field {@link #securityLabel},
2543   *         creating it if it does not already exist
2544   */
2545  public CodeableConcept getSecurityLabelFirstRep() {
2546    if (getSecurityLabel().isEmpty()) {
2547      addSecurityLabel();
2548    }
2549    return getSecurityLabel().get(0);
2550  }
2551
2552  /**
2553   * @return {@link #content} (The document and format referenced. There may be
2554   *         multiple content element repetitions, each with a different format.)
2555   */
2556  public List<DocumentReferenceContentComponent> getContent() {
2557    if (this.content == null)
2558      this.content = new ArrayList<DocumentReferenceContentComponent>();
2559    return this.content;
2560  }
2561
2562  /**
2563   * @return Returns a reference to <code>this</code> for easy method chaining
2564   */
2565  public DocumentReference setContent(List<DocumentReferenceContentComponent> theContent) {
2566    this.content = theContent;
2567    return this;
2568  }
2569
2570  public boolean hasContent() {
2571    if (this.content == null)
2572      return false;
2573    for (DocumentReferenceContentComponent item : this.content)
2574      if (!item.isEmpty())
2575        return true;
2576    return false;
2577  }
2578
2579  public DocumentReferenceContentComponent addContent() { // 3
2580    DocumentReferenceContentComponent t = new DocumentReferenceContentComponent();
2581    if (this.content == null)
2582      this.content = new ArrayList<DocumentReferenceContentComponent>();
2583    this.content.add(t);
2584    return t;
2585  }
2586
2587  public DocumentReference addContent(DocumentReferenceContentComponent t) { // 3
2588    if (t == null)
2589      return this;
2590    if (this.content == null)
2591      this.content = new ArrayList<DocumentReferenceContentComponent>();
2592    this.content.add(t);
2593    return this;
2594  }
2595
2596  /**
2597   * @return The first repetition of repeating field {@link #content}, creating it
2598   *         if it does not already exist
2599   */
2600  public DocumentReferenceContentComponent getContentFirstRep() {
2601    if (getContent().isEmpty()) {
2602      addContent();
2603    }
2604    return getContent().get(0);
2605  }
2606
2607  /**
2608   * @return {@link #context} (The clinical context in which the document was
2609   *         prepared.)
2610   */
2611  public DocumentReferenceContextComponent getContext() {
2612    if (this.context == null)
2613      if (Configuration.errorOnAutoCreate())
2614        throw new Error("Attempt to auto-create DocumentReference.context");
2615      else if (Configuration.doAutoCreate())
2616        this.context = new DocumentReferenceContextComponent(); // cc
2617    return this.context;
2618  }
2619
2620  public boolean hasContext() {
2621    return this.context != null && !this.context.isEmpty();
2622  }
2623
2624  /**
2625   * @param value {@link #context} (The clinical context in which the document was
2626   *              prepared.)
2627   */
2628  public DocumentReference setContext(DocumentReferenceContextComponent value) {
2629    this.context = value;
2630    return this;
2631  }
2632
2633  protected void listChildren(List<Property> children) {
2634    super.listChildren(children);
2635    children.add(new Property("masterIdentifier", "Identifier",
2636        "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.",
2637        0, 1, masterIdentifier));
2638    children.add(new Property("identifier", "Identifier",
2639        "Other identifiers associated with the document, including version independent identifiers.", 0,
2640        java.lang.Integer.MAX_VALUE, identifier));
2641    children.add(new Property("status", "code", "The status of this document reference.", 0, 1, status));
2642    children.add(new Property("docStatus", "code", "The status of the underlying document.", 0, 1, docStatus));
2643    children.add(new Property("type", "CodeableConcept",
2644        "Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.",
2645        0, 1, type));
2646    children.add(new Property("category", "CodeableConcept",
2647        "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.",
2648        0, java.lang.Integer.MAX_VALUE, category));
2649    children.add(new Property("subject", "Reference(Patient|Practitioner|Group|Device)",
2650        "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a 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).",
2651        0, 1, subject));
2652    children.add(new Property("date", "instant", "When the document reference was created.", 0, 1, date));
2653    children.add(
2654        new Property("author", "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson)",
2655            "Identifies who is responsible for adding the information to the document.", 0, java.lang.Integer.MAX_VALUE,
2656            author));
2657    children.add(new Property("authenticator", "Reference(Practitioner|PractitionerRole|Organization)",
2658        "Which person or organization authenticates that this document is valid.", 0, 1, authenticator));
2659    children.add(new Property("custodian", "Reference(Organization)",
2660        "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.",
2661        0, 1, custodian));
2662    children.add(new Property("relatesTo", "",
2663        "Relationships that this document has with other document references that already exist.", 0,
2664        java.lang.Integer.MAX_VALUE, relatesTo));
2665    children.add(
2666        new Property("description", "string", "Human-readable description of the source document.", 0, 1, description));
2667    children.add(new Property("securityLabel", "CodeableConcept",
2668        "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.",
2669        0, java.lang.Integer.MAX_VALUE, securityLabel));
2670    children.add(new Property("content", "",
2671        "The document and format referenced. There may be multiple content element repetitions, each with a different format.",
2672        0, java.lang.Integer.MAX_VALUE, content));
2673    children
2674        .add(new Property("context", "", "The clinical context in which the document was prepared.", 0, 1, context));
2675  }
2676
2677  @Override
2678  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2679    switch (_hash) {
2680    case 243769515:
2681      /* masterIdentifier */ return new Property("masterIdentifier", "Identifier",
2682          "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.",
2683          0, 1, masterIdentifier);
2684    case -1618432855:
2685      /* identifier */ return new Property("identifier", "Identifier",
2686          "Other identifiers associated with the document, including version independent identifiers.", 0,
2687          java.lang.Integer.MAX_VALUE, identifier);
2688    case -892481550:
2689      /* status */ return new Property("status", "code", "The status of this document reference.", 0, 1, status);
2690    case -23496886:
2691      /* docStatus */ return new Property("docStatus", "code", "The status of the underlying document.", 0, 1,
2692          docStatus);
2693    case 3575610:
2694      /* type */ return new Property("type", "CodeableConcept",
2695          "Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.",
2696          0, 1, type);
2697    case 50511102:
2698      /* category */ return new Property("category", "CodeableConcept",
2699          "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.",
2700          0, java.lang.Integer.MAX_VALUE, category);
2701    case -1867885268:
2702      /* subject */ return new Property("subject", "Reference(Patient|Practitioner|Group|Device)",
2703          "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a 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).",
2704          0, 1, subject);
2705    case 3076014:
2706      /* date */ return new Property("date", "instant", "When the document reference was created.", 0, 1, date);
2707    case -1406328437:
2708      /* author */ return new Property("author",
2709          "Reference(Practitioner|PractitionerRole|Organization|Device|Patient|RelatedPerson)",
2710          "Identifies who is responsible for adding the information to the document.", 0, java.lang.Integer.MAX_VALUE,
2711          author);
2712    case 1815000435:
2713      /* authenticator */ return new Property("authenticator", "Reference(Practitioner|PractitionerRole|Organization)",
2714          "Which person or organization authenticates that this document is valid.", 0, 1, authenticator);
2715    case 1611297262:
2716      /* custodian */ return new Property("custodian", "Reference(Organization)",
2717          "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.",
2718          0, 1, custodian);
2719    case -7765931:
2720      /* relatesTo */ return new Property("relatesTo", "",
2721          "Relationships that this document has with other document references that already exist.", 0,
2722          java.lang.Integer.MAX_VALUE, relatesTo);
2723    case -1724546052:
2724      /* description */ return new Property("description", "string",
2725          "Human-readable description of the source document.", 0, 1, description);
2726    case -722296940:
2727      /* securityLabel */ return new Property("securityLabel", "CodeableConcept",
2728          "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.",
2729          0, java.lang.Integer.MAX_VALUE, securityLabel);
2730    case 951530617:
2731      /* content */ return new Property("content", "",
2732          "The document and format referenced. There may be multiple content element repetitions, each with a different format.",
2733          0, java.lang.Integer.MAX_VALUE, content);
2734    case 951530927:
2735      /* context */ return new Property("context", "", "The clinical context in which the document was prepared.", 0, 1,
2736          context);
2737    default:
2738      return super.getNamedProperty(_hash, _name, _checkValid);
2739    }
2740
2741  }
2742
2743  @Override
2744  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2745    switch (hash) {
2746    case 243769515:
2747      /* masterIdentifier */ return this.masterIdentifier == null ? new Base[0] : new Base[] { this.masterIdentifier }; // Identifier
2748    case -1618432855:
2749      /* identifier */ return this.identifier == null ? new Base[0]
2750          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2751    case -892481550:
2752      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DocumentReferenceStatus>
2753    case -23496886:
2754      /* docStatus */ return this.docStatus == null ? new Base[0] : new Base[] { this.docStatus }; // Enumeration<ReferredDocumentStatus>
2755    case 3575610:
2756      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2757    case 50511102:
2758      /* category */ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
2759    case -1867885268:
2760      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2761    case 3076014:
2762      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // InstantType
2763    case -1406328437:
2764      /* author */ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
2765    case 1815000435:
2766      /* authenticator */ return this.authenticator == null ? new Base[0] : new Base[] { this.authenticator }; // Reference
2767    case 1611297262:
2768      /* custodian */ return this.custodian == null ? new Base[0] : new Base[] { this.custodian }; // Reference
2769    case -7765931:
2770      /* relatesTo */ return this.relatesTo == null ? new Base[0]
2771          : this.relatesTo.toArray(new Base[this.relatesTo.size()]); // DocumentReferenceRelatesToComponent
2772    case -1724546052:
2773      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
2774    case -722296940:
2775      /* securityLabel */ return this.securityLabel == null ? new Base[0]
2776          : this.securityLabel.toArray(new Base[this.securityLabel.size()]); // CodeableConcept
2777    case 951530617:
2778      /* content */ return this.content == null ? new Base[0] : this.content.toArray(new Base[this.content.size()]); // DocumentReferenceContentComponent
2779    case 951530927:
2780      /* context */ return this.context == null ? new Base[0] : new Base[] { this.context }; // DocumentReferenceContextComponent
2781    default:
2782      return super.getProperty(hash, name, checkValid);
2783    }
2784
2785  }
2786
2787  @Override
2788  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2789    switch (hash) {
2790    case 243769515: // masterIdentifier
2791      this.masterIdentifier = castToIdentifier(value); // Identifier
2792      return value;
2793    case -1618432855: // identifier
2794      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2795      return value;
2796    case -892481550: // status
2797      value = new DocumentReferenceStatusEnumFactory().fromType(castToCode(value));
2798      this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
2799      return value;
2800    case -23496886: // docStatus
2801      value = new ReferredDocumentStatusEnumFactory().fromType(castToCode(value));
2802      this.docStatus = (Enumeration) value; // Enumeration<ReferredDocumentStatus>
2803      return value;
2804    case 3575610: // type
2805      this.type = castToCodeableConcept(value); // CodeableConcept
2806      return value;
2807    case 50511102: // category
2808      this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept
2809      return value;
2810    case -1867885268: // subject
2811      this.subject = castToReference(value); // Reference
2812      return value;
2813    case 3076014: // date
2814      this.date = castToInstant(value); // InstantType
2815      return value;
2816    case -1406328437: // author
2817      this.getAuthor().add(castToReference(value)); // Reference
2818      return value;
2819    case 1815000435: // authenticator
2820      this.authenticator = castToReference(value); // Reference
2821      return value;
2822    case 1611297262: // custodian
2823      this.custodian = castToReference(value); // Reference
2824      return value;
2825    case -7765931: // relatesTo
2826      this.getRelatesTo().add((DocumentReferenceRelatesToComponent) value); // DocumentReferenceRelatesToComponent
2827      return value;
2828    case -1724546052: // description
2829      this.description = castToString(value); // StringType
2830      return value;
2831    case -722296940: // securityLabel
2832      this.getSecurityLabel().add(castToCodeableConcept(value)); // CodeableConcept
2833      return value;
2834    case 951530617: // content
2835      this.getContent().add((DocumentReferenceContentComponent) value); // DocumentReferenceContentComponent
2836      return value;
2837    case 951530927: // context
2838      this.context = (DocumentReferenceContextComponent) value; // DocumentReferenceContextComponent
2839      return value;
2840    default:
2841      return super.setProperty(hash, name, value);
2842    }
2843
2844  }
2845
2846  @Override
2847  public Base setProperty(String name, Base value) throws FHIRException {
2848    if (name.equals("masterIdentifier")) {
2849      this.masterIdentifier = castToIdentifier(value); // Identifier
2850    } else if (name.equals("identifier")) {
2851      this.getIdentifier().add(castToIdentifier(value));
2852    } else if (name.equals("status")) {
2853      value = new DocumentReferenceStatusEnumFactory().fromType(castToCode(value));
2854      this.status = (Enumeration) value; // Enumeration<DocumentReferenceStatus>
2855    } else if (name.equals("docStatus")) {
2856      value = new ReferredDocumentStatusEnumFactory().fromType(castToCode(value));
2857      this.docStatus = (Enumeration) value; // Enumeration<ReferredDocumentStatus>
2858    } else if (name.equals("type")) {
2859      this.type = castToCodeableConcept(value); // CodeableConcept
2860    } else if (name.equals("category")) {
2861      this.getCategory().add(castToCodeableConcept(value));
2862    } else if (name.equals("subject")) {
2863      this.subject = castToReference(value); // Reference
2864    } else if (name.equals("date")) {
2865      this.date = castToInstant(value); // InstantType
2866    } else if (name.equals("author")) {
2867      this.getAuthor().add(castToReference(value));
2868    } else if (name.equals("authenticator")) {
2869      this.authenticator = castToReference(value); // Reference
2870    } else if (name.equals("custodian")) {
2871      this.custodian = castToReference(value); // Reference
2872    } else if (name.equals("relatesTo")) {
2873      this.getRelatesTo().add((DocumentReferenceRelatesToComponent) value);
2874    } else if (name.equals("description")) {
2875      this.description = castToString(value); // StringType
2876    } else if (name.equals("securityLabel")) {
2877      this.getSecurityLabel().add(castToCodeableConcept(value));
2878    } else if (name.equals("content")) {
2879      this.getContent().add((DocumentReferenceContentComponent) value);
2880    } else if (name.equals("context")) {
2881      this.context = (DocumentReferenceContextComponent) value; // DocumentReferenceContextComponent
2882    } else
2883      return super.setProperty(name, value);
2884    return value;
2885  }
2886
2887  @Override
2888  public void removeChild(String name, Base value) throws FHIRException {
2889    if (name.equals("masterIdentifier")) {
2890      this.masterIdentifier = null;
2891    } else if (name.equals("identifier")) {
2892      this.getIdentifier().remove(castToIdentifier(value));
2893    } else if (name.equals("status")) {
2894      this.status = null;
2895    } else if (name.equals("docStatus")) {
2896      this.docStatus = null;
2897    } else if (name.equals("type")) {
2898      this.type = null;
2899    } else if (name.equals("category")) {
2900      this.getCategory().remove(castToCodeableConcept(value));
2901    } else if (name.equals("subject")) {
2902      this.subject = null;
2903    } else if (name.equals("date")) {
2904      this.date = null;
2905    } else if (name.equals("author")) {
2906      this.getAuthor().remove(castToReference(value));
2907    } else if (name.equals("authenticator")) {
2908      this.authenticator = null;
2909    } else if (name.equals("custodian")) {
2910      this.custodian = null;
2911    } else if (name.equals("relatesTo")) {
2912      this.getRelatesTo().remove((DocumentReferenceRelatesToComponent) value);
2913    } else if (name.equals("description")) {
2914      this.description = null;
2915    } else if (name.equals("securityLabel")) {
2916      this.getSecurityLabel().remove(castToCodeableConcept(value));
2917    } else if (name.equals("content")) {
2918      this.getContent().remove((DocumentReferenceContentComponent) value);
2919    } else if (name.equals("context")) {
2920      this.context = (DocumentReferenceContextComponent) value; // DocumentReferenceContextComponent
2921    } else
2922      super.removeChild(name, value);
2923    
2924  }
2925
2926  @Override
2927  public Base makeProperty(int hash, String name) throws FHIRException {
2928    switch (hash) {
2929    case 243769515:
2930      return getMasterIdentifier();
2931    case -1618432855:
2932      return addIdentifier();
2933    case -892481550:
2934      return getStatusElement();
2935    case -23496886:
2936      return getDocStatusElement();
2937    case 3575610:
2938      return getType();
2939    case 50511102:
2940      return addCategory();
2941    case -1867885268:
2942      return getSubject();
2943    case 3076014:
2944      return getDateElement();
2945    case -1406328437:
2946      return addAuthor();
2947    case 1815000435:
2948      return getAuthenticator();
2949    case 1611297262:
2950      return getCustodian();
2951    case -7765931:
2952      return addRelatesTo();
2953    case -1724546052:
2954      return getDescriptionElement();
2955    case -722296940:
2956      return addSecurityLabel();
2957    case 951530617:
2958      return addContent();
2959    case 951530927:
2960      return getContext();
2961    default:
2962      return super.makeProperty(hash, name);
2963    }
2964
2965  }
2966
2967  @Override
2968  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2969    switch (hash) {
2970    case 243769515:
2971      /* masterIdentifier */ return new String[] { "Identifier" };
2972    case -1618432855:
2973      /* identifier */ return new String[] { "Identifier" };
2974    case -892481550:
2975      /* status */ return new String[] { "code" };
2976    case -23496886:
2977      /* docStatus */ return new String[] { "code" };
2978    case 3575610:
2979      /* type */ return new String[] { "CodeableConcept" };
2980    case 50511102:
2981      /* category */ return new String[] { "CodeableConcept" };
2982    case -1867885268:
2983      /* subject */ return new String[] { "Reference" };
2984    case 3076014:
2985      /* date */ return new String[] { "instant" };
2986    case -1406328437:
2987      /* author */ return new String[] { "Reference" };
2988    case 1815000435:
2989      /* authenticator */ return new String[] { "Reference" };
2990    case 1611297262:
2991      /* custodian */ return new String[] { "Reference" };
2992    case -7765931:
2993      /* relatesTo */ return new String[] {};
2994    case -1724546052:
2995      /* description */ return new String[] { "string" };
2996    case -722296940:
2997      /* securityLabel */ return new String[] { "CodeableConcept" };
2998    case 951530617:
2999      /* content */ return new String[] {};
3000    case 951530927:
3001      /* context */ return new String[] {};
3002    default:
3003      return super.getTypesForProperty(hash, name);
3004    }
3005
3006  }
3007
3008  @Override
3009  public Base addChild(String name) throws FHIRException {
3010    if (name.equals("masterIdentifier")) {
3011      this.masterIdentifier = new Identifier();
3012      return this.masterIdentifier;
3013    } else if (name.equals("identifier")) {
3014      return addIdentifier();
3015    } else if (name.equals("status")) {
3016      throw new FHIRException("Cannot call addChild on a singleton property DocumentReference.status");
3017    } else if (name.equals("docStatus")) {
3018      throw new FHIRException("Cannot call addChild on a singleton property DocumentReference.docStatus");
3019    } else if (name.equals("type")) {
3020      this.type = new CodeableConcept();
3021      return this.type;
3022    } else if (name.equals("category")) {
3023      return addCategory();
3024    } else if (name.equals("subject")) {
3025      this.subject = new Reference();
3026      return this.subject;
3027    } else if (name.equals("date")) {
3028      throw new FHIRException("Cannot call addChild on a singleton property DocumentReference.date");
3029    } else if (name.equals("author")) {
3030      return addAuthor();
3031    } else if (name.equals("authenticator")) {
3032      this.authenticator = new Reference();
3033      return this.authenticator;
3034    } else if (name.equals("custodian")) {
3035      this.custodian = new Reference();
3036      return this.custodian;
3037    } else if (name.equals("relatesTo")) {
3038      return addRelatesTo();
3039    } else if (name.equals("description")) {
3040      throw new FHIRException("Cannot call addChild on a singleton property DocumentReference.description");
3041    } else if (name.equals("securityLabel")) {
3042      return addSecurityLabel();
3043    } else if (name.equals("content")) {
3044      return addContent();
3045    } else if (name.equals("context")) {
3046      this.context = new DocumentReferenceContextComponent();
3047      return this.context;
3048    } else
3049      return super.addChild(name);
3050  }
3051
3052  public String fhirType() {
3053    return "DocumentReference";
3054
3055  }
3056
3057  public DocumentReference copy() {
3058    DocumentReference dst = new DocumentReference();
3059    copyValues(dst);
3060    return dst;
3061  }
3062
3063  public void copyValues(DocumentReference dst) {
3064    super.copyValues(dst);
3065    dst.masterIdentifier = masterIdentifier == null ? null : masterIdentifier.copy();
3066    if (identifier != null) {
3067      dst.identifier = new ArrayList<Identifier>();
3068      for (Identifier i : identifier)
3069        dst.identifier.add(i.copy());
3070    }
3071    ;
3072    dst.status = status == null ? null : status.copy();
3073    dst.docStatus = docStatus == null ? null : docStatus.copy();
3074    dst.type = type == null ? null : type.copy();
3075    if (category != null) {
3076      dst.category = new ArrayList<CodeableConcept>();
3077      for (CodeableConcept i : category)
3078        dst.category.add(i.copy());
3079    }
3080    ;
3081    dst.subject = subject == null ? null : subject.copy();
3082    dst.date = date == null ? null : date.copy();
3083    if (author != null) {
3084      dst.author = new ArrayList<Reference>();
3085      for (Reference i : author)
3086        dst.author.add(i.copy());
3087    }
3088    ;
3089    dst.authenticator = authenticator == null ? null : authenticator.copy();
3090    dst.custodian = custodian == null ? null : custodian.copy();
3091    if (relatesTo != null) {
3092      dst.relatesTo = new ArrayList<DocumentReferenceRelatesToComponent>();
3093      for (DocumentReferenceRelatesToComponent i : relatesTo)
3094        dst.relatesTo.add(i.copy());
3095    }
3096    ;
3097    dst.description = description == null ? null : description.copy();
3098    if (securityLabel != null) {
3099      dst.securityLabel = new ArrayList<CodeableConcept>();
3100      for (CodeableConcept i : securityLabel)
3101        dst.securityLabel.add(i.copy());
3102    }
3103    ;
3104    if (content != null) {
3105      dst.content = new ArrayList<DocumentReferenceContentComponent>();
3106      for (DocumentReferenceContentComponent i : content)
3107        dst.content.add(i.copy());
3108    }
3109    ;
3110    dst.context = context == null ? null : context.copy();
3111  }
3112
3113  protected DocumentReference typedCopy() {
3114    return copy();
3115  }
3116
3117  @Override
3118  public boolean equalsDeep(Base other_) {
3119    if (!super.equalsDeep(other_))
3120      return false;
3121    if (!(other_ instanceof DocumentReference))
3122      return false;
3123    DocumentReference o = (DocumentReference) other_;
3124    return compareDeep(masterIdentifier, o.masterIdentifier, true) && compareDeep(identifier, o.identifier, true)
3125        && compareDeep(status, o.status, true) && compareDeep(docStatus, o.docStatus, true)
3126        && compareDeep(type, o.type, true) && compareDeep(category, o.category, true)
3127        && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true)
3128        && compareDeep(author, o.author, true) && compareDeep(authenticator, o.authenticator, true)
3129        && compareDeep(custodian, o.custodian, true) && compareDeep(relatesTo, o.relatesTo, true)
3130        && compareDeep(description, o.description, true) && compareDeep(securityLabel, o.securityLabel, true)
3131        && compareDeep(content, o.content, true) && compareDeep(context, o.context, true);
3132  }
3133
3134  @Override
3135  public boolean equalsShallow(Base other_) {
3136    if (!super.equalsShallow(other_))
3137      return false;
3138    if (!(other_ instanceof DocumentReference))
3139      return false;
3140    DocumentReference o = (DocumentReference) other_;
3141    return compareValues(status, o.status, true) && compareValues(docStatus, o.docStatus, true)
3142        && compareValues(date, o.date, true) && compareValues(description, o.description, true);
3143  }
3144
3145  public boolean isEmpty() {
3146    return super.isEmpty()
3147        && ca.uhn.fhir.util.ElementUtil.isEmpty(masterIdentifier, identifier, status, docStatus, type, category,
3148            subject, date, author, authenticator, custodian, relatesTo, description, securityLabel, content, context);
3149  }
3150
3151  @Override
3152  public ResourceType getResourceType() {
3153    return ResourceType.DocumentReference;
3154  }
3155
3156  /**
3157   * Search parameter: <b>date</b>
3158   * <p>
3159   * Description: <b>When this document reference was created</b><br>
3160   * Type: <b>date</b><br>
3161   * Path: <b>DocumentReference.date</b><br>
3162   * </p>
3163   */
3164  @SearchParamDefinition(name = "date", path = "DocumentReference.date", description = "When this document reference was created", type = "date")
3165  public static final String SP_DATE = "date";
3166  /**
3167   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3168   * <p>
3169   * Description: <b>When this document reference was created</b><br>
3170   * Type: <b>date</b><br>
3171   * Path: <b>DocumentReference.date</b><br>
3172   * </p>
3173   */
3174  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3175      SP_DATE);
3176
3177  /**
3178   * Search parameter: <b>subject</b>
3179   * <p>
3180   * Description: <b>Who/what is the subject of the document</b><br>
3181   * Type: <b>reference</b><br>
3182   * Path: <b>DocumentReference.subject</b><br>
3183   * </p>
3184   */
3185  @SearchParamDefinition(name = "subject", path = "DocumentReference.subject", description = "Who/what is the subject of the document", type = "reference", providesMembershipIn = {
3186      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3187      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3188      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class, Group.class,
3189          Patient.class, Practitioner.class })
3190  public static final String SP_SUBJECT = "subject";
3191  /**
3192   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3193   * <p>
3194   * Description: <b>Who/what is the subject of the document</b><br>
3195   * Type: <b>reference</b><br>
3196   * Path: <b>DocumentReference.subject</b><br>
3197   * </p>
3198   */
3199  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3200      SP_SUBJECT);
3201
3202  /**
3203   * Constant for fluent queries to be used to add include statements. Specifies
3204   * the path value of "<b>DocumentReference:subject</b>".
3205   */
3206  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
3207      "DocumentReference:subject").toLocked();
3208
3209  /**
3210   * Search parameter: <b>description</b>
3211   * <p>
3212   * Description: <b>Human-readable description</b><br>
3213   * Type: <b>string</b><br>
3214   * Path: <b>DocumentReference.description</b><br>
3215   * </p>
3216   */
3217  @SearchParamDefinition(name = "description", path = "DocumentReference.description", description = "Human-readable description", type = "string")
3218  public static final String SP_DESCRIPTION = "description";
3219  /**
3220   * <b>Fluent Client</b> search parameter constant for <b>description</b>
3221   * <p>
3222   * Description: <b>Human-readable description</b><br>
3223   * Type: <b>string</b><br>
3224   * Path: <b>DocumentReference.description</b><br>
3225   * </p>
3226   */
3227  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(
3228      SP_DESCRIPTION);
3229
3230  /**
3231   * Search parameter: <b>language</b>
3232   * <p>
3233   * Description: <b>Human language of the content (BCP-47)</b><br>
3234   * Type: <b>token</b><br>
3235   * Path: <b>DocumentReference.content.attachment.language</b><br>
3236   * </p>
3237   */
3238  @SearchParamDefinition(name = "language", path = "DocumentReference.content.attachment.language", description = "Human language of the content (BCP-47)", type = "token")
3239  public static final String SP_LANGUAGE = "language";
3240  /**
3241   * <b>Fluent Client</b> search parameter constant for <b>language</b>
3242   * <p>
3243   * Description: <b>Human language of the content (BCP-47)</b><br>
3244   * Type: <b>token</b><br>
3245   * Path: <b>DocumentReference.content.attachment.language</b><br>
3246   * </p>
3247   */
3248  public static final ca.uhn.fhir.rest.gclient.TokenClientParam LANGUAGE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3249      SP_LANGUAGE);
3250
3251  /**
3252   * Search parameter: <b>type</b>
3253   * <p>
3254   * Description: <b>Kind of document (LOINC if possible)</b><br>
3255   * Type: <b>token</b><br>
3256   * Path: <b>DocumentReference.type</b><br>
3257   * </p>
3258   */
3259  @SearchParamDefinition(name = "type", path = "DocumentReference.type", description = "Kind of document (LOINC if possible)", type = "token")
3260  public static final String SP_TYPE = "type";
3261  /**
3262   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3263   * <p>
3264   * Description: <b>Kind of document (LOINC if possible)</b><br>
3265   * Type: <b>token</b><br>
3266   * Path: <b>DocumentReference.type</b><br>
3267   * </p>
3268   */
3269  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3270      SP_TYPE);
3271
3272  /**
3273   * Search parameter: <b>relation</b>
3274   * <p>
3275   * Description: <b>replaces | transforms | signs | appends</b><br>
3276   * Type: <b>token</b><br>
3277   * Path: <b>DocumentReference.relatesTo.code</b><br>
3278   * </p>
3279   */
3280  @SearchParamDefinition(name = "relation", path = "DocumentReference.relatesTo.code", description = "replaces | transforms | signs | appends", type = "token")
3281  public static final String SP_RELATION = "relation";
3282  /**
3283   * <b>Fluent Client</b> search parameter constant for <b>relation</b>
3284   * <p>
3285   * Description: <b>replaces | transforms | signs | appends</b><br>
3286   * Type: <b>token</b><br>
3287   * Path: <b>DocumentReference.relatesTo.code</b><br>
3288   * </p>
3289   */
3290  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3291      SP_RELATION);
3292
3293  /**
3294   * Search parameter: <b>setting</b>
3295   * <p>
3296   * Description: <b>Additional details about where the content was created (e.g.
3297   * clinical specialty)</b><br>
3298   * Type: <b>token</b><br>
3299   * Path: <b>DocumentReference.context.practiceSetting</b><br>
3300   * </p>
3301   */
3302  @SearchParamDefinition(name = "setting", path = "DocumentReference.context.practiceSetting", description = "Additional details about where the content was created (e.g. clinical specialty)", type = "token")
3303  public static final String SP_SETTING = "setting";
3304  /**
3305   * <b>Fluent Client</b> search parameter constant for <b>setting</b>
3306   * <p>
3307   * Description: <b>Additional details about where the content was created (e.g.
3308   * clinical specialty)</b><br>
3309   * Type: <b>token</b><br>
3310   * Path: <b>DocumentReference.context.practiceSetting</b><br>
3311   * </p>
3312   */
3313  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SETTING = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3314      SP_SETTING);
3315
3316  /**
3317   * Search parameter: <b>related</b>
3318   * <p>
3319   * Description: <b>Related identifiers or resources</b><br>
3320   * Type: <b>reference</b><br>
3321   * Path: <b>DocumentReference.context.related</b><br>
3322   * </p>
3323   */
3324  @SearchParamDefinition(name = "related", path = "DocumentReference.context.related", description = "Related identifiers or resources", type = "reference")
3325  public static final String SP_RELATED = "related";
3326  /**
3327   * <b>Fluent Client</b> search parameter constant for <b>related</b>
3328   * <p>
3329   * Description: <b>Related identifiers or resources</b><br>
3330   * Type: <b>reference</b><br>
3331   * Path: <b>DocumentReference.context.related</b><br>
3332   * </p>
3333   */
3334  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3335      SP_RELATED);
3336
3337  /**
3338   * Constant for fluent queries to be used to add include statements. Specifies
3339   * the path value of "<b>DocumentReference:related</b>".
3340   */
3341  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED = new ca.uhn.fhir.model.api.Include(
3342      "DocumentReference:related").toLocked();
3343
3344  /**
3345   * Search parameter: <b>patient</b>
3346   * <p>
3347   * Description: <b>Who/what is the subject of the document</b><br>
3348   * Type: <b>reference</b><br>
3349   * Path: <b>DocumentReference.subject</b><br>
3350   * </p>
3351   */
3352  @SearchParamDefinition(name = "patient", path = "DocumentReference.subject.where(resolve() is Patient)", description = "Who/what is the subject of the document", type = "reference", target = {
3353      Patient.class })
3354  public static final String SP_PATIENT = "patient";
3355  /**
3356   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3357   * <p>
3358   * Description: <b>Who/what is the subject of the document</b><br>
3359   * Type: <b>reference</b><br>
3360   * Path: <b>DocumentReference.subject</b><br>
3361   * </p>
3362   */
3363  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3364      SP_PATIENT);
3365
3366  /**
3367   * Constant for fluent queries to be used to add include statements. Specifies
3368   * the path value of "<b>DocumentReference:patient</b>".
3369   */
3370  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3371      "DocumentReference:patient").toLocked();
3372
3373  /**
3374   * Search parameter: <b>relationship</b>
3375   * <p>
3376   * Description: <b>Combination of relation and relatesTo</b><br>
3377   * Type: <b>composite</b><br>
3378   * Path: <b></b><br>
3379   * </p>
3380   */
3381  @SearchParamDefinition(name = "relationship", path = "DocumentReference.relatesTo", description = "Combination of relation and relatesTo", type = "composite", compositeOf = {
3382      "relatesto", "relation" })
3383  public static final String SP_RELATIONSHIP = "relationship";
3384  /**
3385   * <b>Fluent Client</b> search parameter constant for <b>relationship</b>
3386   * <p>
3387   * Description: <b>Combination of relation and relatesTo</b><br>
3388   * Type: <b>composite</b><br>
3389   * Path: <b></b><br>
3390   * </p>
3391   */
3392  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> RELATIONSHIP = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.ReferenceClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(
3393      SP_RELATIONSHIP);
3394
3395  /**
3396   * Search parameter: <b>event</b>
3397   * <p>
3398   * Description: <b>Main clinical acts documented</b><br>
3399   * Type: <b>token</b><br>
3400   * Path: <b>DocumentReference.context.event</b><br>
3401   * </p>
3402   */
3403  @SearchParamDefinition(name = "event", path = "DocumentReference.context.event", description = "Main clinical acts documented", type = "token")
3404  public static final String SP_EVENT = "event";
3405  /**
3406   * <b>Fluent Client</b> search parameter constant for <b>event</b>
3407   * <p>
3408   * Description: <b>Main clinical acts documented</b><br>
3409   * Type: <b>token</b><br>
3410   * Path: <b>DocumentReference.context.event</b><br>
3411   * </p>
3412   */
3413  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3414      SP_EVENT);
3415
3416  /**
3417   * Search parameter: <b>authenticator</b>
3418   * <p>
3419   * Description: <b>Who/what authenticated the document</b><br>
3420   * Type: <b>reference</b><br>
3421   * Path: <b>DocumentReference.authenticator</b><br>
3422   * </p>
3423   */
3424  @SearchParamDefinition(name = "authenticator", path = "DocumentReference.authenticator", description = "Who/what authenticated the document", type = "reference", providesMembershipIn = {
3425      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
3426          Practitioner.class, PractitionerRole.class })
3427  public static final String SP_AUTHENTICATOR = "authenticator";
3428  /**
3429   * <b>Fluent Client</b> search parameter constant for <b>authenticator</b>
3430   * <p>
3431   * Description: <b>Who/what authenticated the document</b><br>
3432   * Type: <b>reference</b><br>
3433   * Path: <b>DocumentReference.authenticator</b><br>
3434   * </p>
3435   */
3436  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHENTICATOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3437      SP_AUTHENTICATOR);
3438
3439  /**
3440   * Constant for fluent queries to be used to add include statements. Specifies
3441   * the path value of "<b>DocumentReference:authenticator</b>".
3442   */
3443  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHENTICATOR = new ca.uhn.fhir.model.api.Include(
3444      "DocumentReference:authenticator").toLocked();
3445
3446  /**
3447   * Search parameter: <b>identifier</b>
3448   * <p>
3449   * Description: <b>Master Version Specific Identifier</b><br>
3450   * Type: <b>token</b><br>
3451   * Path: <b>DocumentReference.masterIdentifier,
3452   * DocumentReference.identifier</b><br>
3453   * </p>
3454   */
3455  @SearchParamDefinition(name = "identifier", path = "DocumentReference.masterIdentifier | DocumentReference.identifier", description = "Master Version Specific Identifier", type = "token")
3456  public static final String SP_IDENTIFIER = "identifier";
3457  /**
3458   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3459   * <p>
3460   * Description: <b>Master Version Specific Identifier</b><br>
3461   * Type: <b>token</b><br>
3462   * Path: <b>DocumentReference.masterIdentifier,
3463   * DocumentReference.identifier</b><br>
3464   * </p>
3465   */
3466  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3467      SP_IDENTIFIER);
3468
3469  /**
3470   * Search parameter: <b>period</b>
3471   * <p>
3472   * Description: <b>Time of service that is being documented</b><br>
3473   * Type: <b>date</b><br>
3474   * Path: <b>DocumentReference.context.period</b><br>
3475   * </p>
3476   */
3477  @SearchParamDefinition(name = "period", path = "DocumentReference.context.period", description = "Time of service that is being documented", type = "date")
3478  public static final String SP_PERIOD = "period";
3479  /**
3480   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3481   * <p>
3482   * Description: <b>Time of service that is being documented</b><br>
3483   * Type: <b>date</b><br>
3484   * Path: <b>DocumentReference.context.period</b><br>
3485   * </p>
3486   */
3487  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(
3488      SP_PERIOD);
3489
3490  /**
3491   * Search parameter: <b>custodian</b>
3492   * <p>
3493   * Description: <b>Organization which maintains the document</b><br>
3494   * Type: <b>reference</b><br>
3495   * Path: <b>DocumentReference.custodian</b><br>
3496   * </p>
3497   */
3498  @SearchParamDefinition(name = "custodian", path = "DocumentReference.custodian", description = "Organization which maintains the document", type = "reference", target = {
3499      Organization.class })
3500  public static final String SP_CUSTODIAN = "custodian";
3501  /**
3502   * <b>Fluent Client</b> search parameter constant for <b>custodian</b>
3503   * <p>
3504   * Description: <b>Organization which maintains the document</b><br>
3505   * Type: <b>reference</b><br>
3506   * Path: <b>DocumentReference.custodian</b><br>
3507   * </p>
3508   */
3509  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CUSTODIAN = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3510      SP_CUSTODIAN);
3511
3512  /**
3513   * Constant for fluent queries to be used to add include statements. Specifies
3514   * the path value of "<b>DocumentReference:custodian</b>".
3515   */
3516  public static final ca.uhn.fhir.model.api.Include INCLUDE_CUSTODIAN = new ca.uhn.fhir.model.api.Include(
3517      "DocumentReference:custodian").toLocked();
3518
3519  /**
3520   * Search parameter: <b>author</b>
3521   * <p>
3522   * Description: <b>Who and/or what authored the document</b><br>
3523   * Type: <b>reference</b><br>
3524   * Path: <b>DocumentReference.author</b><br>
3525   * </p>
3526   */
3527  @SearchParamDefinition(name = "author", path = "DocumentReference.author", description = "Who and/or what authored the document", type = "reference", providesMembershipIn = {
3528      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
3529      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
3530      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
3531      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
3532          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
3533  public static final String SP_AUTHOR = "author";
3534  /**
3535   * <b>Fluent Client</b> search parameter constant for <b>author</b>
3536   * <p>
3537   * Description: <b>Who and/or what authored the document</b><br>
3538   * Type: <b>reference</b><br>
3539   * Path: <b>DocumentReference.author</b><br>
3540   * </p>
3541   */
3542  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3543      SP_AUTHOR);
3544
3545  /**
3546   * Constant for fluent queries to be used to add include statements. Specifies
3547   * the path value of "<b>DocumentReference:author</b>".
3548   */
3549  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
3550      "DocumentReference:author").toLocked();
3551
3552  /**
3553   * Search parameter: <b>format</b>
3554   * <p>
3555   * Description: <b>Format/content rules for the document</b><br>
3556   * Type: <b>token</b><br>
3557   * Path: <b>DocumentReference.content.format</b><br>
3558   * </p>
3559   */
3560  @SearchParamDefinition(name = "format", path = "DocumentReference.content.format", description = "Format/content rules for the document", type = "token")
3561  public static final String SP_FORMAT = "format";
3562  /**
3563   * <b>Fluent Client</b> search parameter constant for <b>format</b>
3564   * <p>
3565   * Description: <b>Format/content rules for the document</b><br>
3566   * Type: <b>token</b><br>
3567   * Path: <b>DocumentReference.content.format</b><br>
3568   * </p>
3569   */
3570  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMAT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3571      SP_FORMAT);
3572
3573  /**
3574   * Search parameter: <b>encounter</b>
3575   * <p>
3576   * Description: <b>Context of the document content</b><br>
3577   * Type: <b>reference</b><br>
3578   * Path: <b>DocumentReference.context.encounter</b><br>
3579   * </p>
3580   */
3581  @SearchParamDefinition(name = "encounter", path = "DocumentReference.context.encounter", description = "Context of the document  content", type = "reference", providesMembershipIn = {
3582      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class,
3583          EpisodeOfCare.class })
3584  public static final String SP_ENCOUNTER = "encounter";
3585  /**
3586   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3587   * <p>
3588   * Description: <b>Context of the document content</b><br>
3589   * Type: <b>reference</b><br>
3590   * Path: <b>DocumentReference.context.encounter</b><br>
3591   * </p>
3592   */
3593  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3594      SP_ENCOUNTER);
3595
3596  /**
3597   * Constant for fluent queries to be used to add include statements. Specifies
3598   * the path value of "<b>DocumentReference:encounter</b>".
3599   */
3600  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
3601      "DocumentReference:encounter").toLocked();
3602
3603  /**
3604   * Search parameter: <b>contenttype</b>
3605   * <p>
3606   * Description: <b>Mime type of the content, with charset etc.</b><br>
3607   * Type: <b>token</b><br>
3608   * Path: <b>DocumentReference.content.attachment.contentType</b><br>
3609   * </p>
3610   */
3611  @SearchParamDefinition(name = "contenttype", path = "DocumentReference.content.attachment.contentType", description = "Mime type of the content, with charset etc.", type = "token")
3612  public static final String SP_CONTENTTYPE = "contenttype";
3613  /**
3614   * <b>Fluent Client</b> search parameter constant for <b>contenttype</b>
3615   * <p>
3616   * Description: <b>Mime type of the content, with charset etc.</b><br>
3617   * Type: <b>token</b><br>
3618   * Path: <b>DocumentReference.content.attachment.contentType</b><br>
3619   * </p>
3620   */
3621  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTENTTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3622      SP_CONTENTTYPE);
3623
3624  /**
3625   * Search parameter: <b>security-label</b>
3626   * <p>
3627   * Description: <b>Document security-tags</b><br>
3628   * Type: <b>token</b><br>
3629   * Path: <b>DocumentReference.securityLabel</b><br>
3630   * </p>
3631   */
3632  @SearchParamDefinition(name = "security-label", path = "DocumentReference.securityLabel", description = "Document security-tags", type = "token")
3633  public static final String SP_SECURITY_LABEL = "security-label";
3634  /**
3635   * <b>Fluent Client</b> search parameter constant for <b>security-label</b>
3636   * <p>
3637   * Description: <b>Document security-tags</b><br>
3638   * Type: <b>token</b><br>
3639   * Path: <b>DocumentReference.securityLabel</b><br>
3640   * </p>
3641   */
3642  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECURITY_LABEL = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3643      SP_SECURITY_LABEL);
3644
3645  /**
3646   * Search parameter: <b>location</b>
3647   * <p>
3648   * Description: <b>Uri where the data can be found</b><br>
3649   * Type: <b>uri</b><br>
3650   * Path: <b>DocumentReference.content.attachment.url</b><br>
3651   * </p>
3652   */
3653  @SearchParamDefinition(name = "location", path = "DocumentReference.content.attachment.url", description = "Uri where the data can be found", type = "uri")
3654  public static final String SP_LOCATION = "location";
3655  /**
3656   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3657   * <p>
3658   * Description: <b>Uri where the data can be found</b><br>
3659   * Type: <b>uri</b><br>
3660   * Path: <b>DocumentReference.content.attachment.url</b><br>
3661   * </p>
3662   */
3663  public static final ca.uhn.fhir.rest.gclient.UriClientParam LOCATION = new ca.uhn.fhir.rest.gclient.UriClientParam(
3664      SP_LOCATION);
3665
3666  /**
3667   * Search parameter: <b>category</b>
3668   * <p>
3669   * Description: <b>Categorization of document</b><br>
3670   * Type: <b>token</b><br>
3671   * Path: <b>DocumentReference.category</b><br>
3672   * </p>
3673   */
3674  @SearchParamDefinition(name = "category", path = "DocumentReference.category", description = "Categorization of document", type = "token")
3675  public static final String SP_CATEGORY = "category";
3676  /**
3677   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3678   * <p>
3679   * Description: <b>Categorization of document</b><br>
3680   * Type: <b>token</b><br>
3681   * Path: <b>DocumentReference.category</b><br>
3682   * </p>
3683   */
3684  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3685      SP_CATEGORY);
3686
3687  /**
3688   * Search parameter: <b>relatesto</b>
3689   * <p>
3690   * Description: <b>Target of the relationship</b><br>
3691   * Type: <b>reference</b><br>
3692   * Path: <b>DocumentReference.relatesTo.target</b><br>
3693   * </p>
3694   */
3695  @SearchParamDefinition(name = "relatesto", path = "DocumentReference.relatesTo.target", description = "Target of the relationship", type = "reference", target = {
3696      DocumentReference.class })
3697  public static final String SP_RELATESTO = "relatesto";
3698  /**
3699   * <b>Fluent Client</b> search parameter constant for <b>relatesto</b>
3700   * <p>
3701   * Description: <b>Target of the relationship</b><br>
3702   * Type: <b>reference</b><br>
3703   * Path: <b>DocumentReference.relatesTo.target</b><br>
3704   * </p>
3705   */
3706  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATESTO = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3707      SP_RELATESTO);
3708
3709  /**
3710   * Constant for fluent queries to be used to add include statements. Specifies
3711   * the path value of "<b>DocumentReference:relatesto</b>".
3712   */
3713  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATESTO = new ca.uhn.fhir.model.api.Include(
3714      "DocumentReference:relatesto").toLocked();
3715
3716  /**
3717   * Search parameter: <b>facility</b>
3718   * <p>
3719   * Description: <b>Kind of facility where patient was seen</b><br>
3720   * Type: <b>token</b><br>
3721   * Path: <b>DocumentReference.context.facilityType</b><br>
3722   * </p>
3723   */
3724  @SearchParamDefinition(name = "facility", path = "DocumentReference.context.facilityType", description = "Kind of facility where patient was seen", type = "token")
3725  public static final String SP_FACILITY = "facility";
3726  /**
3727   * <b>Fluent Client</b> search parameter constant for <b>facility</b>
3728   * <p>
3729   * Description: <b>Kind of facility where patient was seen</b><br>
3730   * Type: <b>token</b><br>
3731   * Path: <b>DocumentReference.context.facilityType</b><br>
3732   * </p>
3733   */
3734  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FACILITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3735      SP_FACILITY);
3736
3737  /**
3738   * Search parameter: <b>status</b>
3739   * <p>
3740   * Description: <b>current | superseded | entered-in-error</b><br>
3741   * Type: <b>token</b><br>
3742   * Path: <b>DocumentReference.status</b><br>
3743   * </p>
3744   */
3745  @SearchParamDefinition(name = "status", path = "DocumentReference.status", description = "current | superseded | entered-in-error", type = "token")
3746  public static final String SP_STATUS = "status";
3747  /**
3748   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3749   * <p>
3750   * Description: <b>current | superseded | entered-in-error</b><br>
3751   * Type: <b>token</b><br>
3752   * Path: <b>DocumentReference.status</b><br>
3753   * </p>
3754   */
3755  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3756      SP_STATUS);
3757
3758}