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