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