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