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