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