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