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