001package org.hl7.fhir.dstu3.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.
051 */
052@ResourceDef(name="Composition", profile="http://hl7.org/fhir/Profile/Composition")
053public class Composition extends DomainResource {
054
055    public enum CompositionStatus {
056        /**
057         * This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.
058         */
059        PRELIMINARY, 
060        /**
061         * This version of the composition is complete and verified by an appropriate person and no further work is planned. Any subsequent updates would be on a new version of the composition.
062         */
063        FINAL, 
064        /**
065         * The composition content or the referenced resources have been modified (edited or added to) subsequent to being released as "final" and the composition is complete and verified by an authorized person.
066         */
067        AMENDED, 
068        /**
069         * The composition or document was originally created/issued in error, and this is an amendment that marks that the entire series should not be considered as valid.
070         */
071        ENTEREDINERROR, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static CompositionStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("preliminary".equals(codeString))
080          return PRELIMINARY;
081        if ("final".equals(codeString))
082          return FINAL;
083        if ("amended".equals(codeString))
084          return AMENDED;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        if (Configuration.isAcceptInvalidEnums())
088          return null;
089        else
090          throw new FHIRException("Unknown CompositionStatus code '"+codeString+"'");
091        }
092        public String toCode() {
093          switch (this) {
094            case PRELIMINARY: return "preliminary";
095            case FINAL: return "final";
096            case AMENDED: return "amended";
097            case ENTEREDINERROR: return "entered-in-error";
098            case NULL: return null;
099            default: return "?";
100          }
101        }
102        public String getSystem() {
103          switch (this) {
104            case PRELIMINARY: return "http://hl7.org/fhir/composition-status";
105            case FINAL: return "http://hl7.org/fhir/composition-status";
106            case AMENDED: return "http://hl7.org/fhir/composition-status";
107            case ENTEREDINERROR: return "http://hl7.org/fhir/composition-status";
108            case NULL: return null;
109            default: return "?";
110          }
111        }
112        public String getDefinition() {
113          switch (this) {
114            case PRELIMINARY: return "This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.";
115            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.";
116            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.";
117            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.";
118            case NULL: return null;
119            default: return "?";
120          }
121        }
122        public String getDisplay() {
123          switch (this) {
124            case PRELIMINARY: return "Preliminary";
125            case FINAL: return "Final";
126            case AMENDED: return "Amended";
127            case ENTEREDINERROR: return "Entered in Error";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132    }
133
134  public static class CompositionStatusEnumFactory implements EnumFactory<CompositionStatus> {
135    public CompositionStatus fromCode(String codeString) throws IllegalArgumentException {
136      if (codeString == null || "".equals(codeString))
137            if (codeString == null || "".equals(codeString))
138                return null;
139        if ("preliminary".equals(codeString))
140          return CompositionStatus.PRELIMINARY;
141        if ("final".equals(codeString))
142          return CompositionStatus.FINAL;
143        if ("amended".equals(codeString))
144          return CompositionStatus.AMENDED;
145        if ("entered-in-error".equals(codeString))
146          return CompositionStatus.ENTEREDINERROR;
147        throw new IllegalArgumentException("Unknown CompositionStatus code '"+codeString+"'");
148        }
149        public Enumeration<CompositionStatus> fromType(PrimitiveType<?> code) throws FHIRException {
150          if (code == null)
151            return null;
152          if (code.isEmpty())
153            return new Enumeration<CompositionStatus>(this);
154          String codeString = code.asStringValue();
155          if (codeString == null || "".equals(codeString))
156            return null;
157        if ("preliminary".equals(codeString))
158          return new Enumeration<CompositionStatus>(this, CompositionStatus.PRELIMINARY);
159        if ("final".equals(codeString))
160          return new Enumeration<CompositionStatus>(this, CompositionStatus.FINAL);
161        if ("amended".equals(codeString))
162          return new Enumeration<CompositionStatus>(this, CompositionStatus.AMENDED);
163        if ("entered-in-error".equals(codeString))
164          return new Enumeration<CompositionStatus>(this, CompositionStatus.ENTEREDINERROR);
165        throw new FHIRException("Unknown CompositionStatus code '"+codeString+"'");
166        }
167    public String toCode(CompositionStatus code) {
168      if (code == CompositionStatus.PRELIMINARY)
169        return "preliminary";
170      if (code == CompositionStatus.FINAL)
171        return "final";
172      if (code == CompositionStatus.AMENDED)
173        return "amended";
174      if (code == CompositionStatus.ENTEREDINERROR)
175        return "entered-in-error";
176      return "?";
177      }
178    public String toSystem(CompositionStatus code) {
179      return code.getSystem();
180      }
181    }
182
183    public enum DocumentConfidentiality {
184        /**
185         * null
186         */
187        U, 
188        /**
189         * null
190         */
191        L, 
192        /**
193         * null
194         */
195        M, 
196        /**
197         * null
198         */
199        N, 
200        /**
201         * null
202         */
203        R, 
204        /**
205         * null
206         */
207        V, 
208        /**
209         * added to help the parsers with the generic types
210         */
211        NULL;
212        public static DocumentConfidentiality fromCode(String codeString) throws FHIRException {
213            if (codeString == null || "".equals(codeString))
214                return null;
215        if ("U".equals(codeString))
216          return U;
217        if ("L".equals(codeString))
218          return L;
219        if ("M".equals(codeString))
220          return M;
221        if ("N".equals(codeString))
222          return N;
223        if ("R".equals(codeString))
224          return R;
225        if ("V".equals(codeString))
226          return V;
227        if (Configuration.isAcceptInvalidEnums())
228          return null;
229        else
230          throw new FHIRException("Unknown DocumentConfidentiality code '"+codeString+"'");
231        }
232        public String toCode() {
233          switch (this) {
234            case U: return "U";
235            case L: return "L";
236            case M: return "M";
237            case N: return "N";
238            case R: return "R";
239            case V: return "V";
240            case NULL: return null;
241            default: return "?";
242          }
243        }
244        public String getSystem() {
245          switch (this) {
246            case U: return "http://hl7.org/fhir/v3/Confidentiality";
247            case L: return "http://hl7.org/fhir/v3/Confidentiality";
248            case M: return "http://hl7.org/fhir/v3/Confidentiality";
249            case N: return "http://hl7.org/fhir/v3/Confidentiality";
250            case R: return "http://hl7.org/fhir/v3/Confidentiality";
251            case V: return "http://hl7.org/fhir/v3/Confidentiality";
252            case NULL: return null;
253            default: return "?";
254          }
255        }
256        public String getDefinition() {
257          switch (this) {
258            case U: return "";
259            case L: return "";
260            case M: return "";
261            case N: return "";
262            case R: return "";
263            case V: return "";
264            case NULL: return null;
265            default: return "?";
266          }
267        }
268        public String getDisplay() {
269          switch (this) {
270            case U: return "U";
271            case L: return "L";
272            case M: return "M";
273            case N: return "N";
274            case R: return "R";
275            case V: return "V";
276            case NULL: return null;
277            default: return "?";
278          }
279        }
280    }
281
282  public static class DocumentConfidentialityEnumFactory implements EnumFactory<DocumentConfidentiality> {
283    public DocumentConfidentiality fromCode(String codeString) throws IllegalArgumentException {
284      if (codeString == null || "".equals(codeString))
285            if (codeString == null || "".equals(codeString))
286                return null;
287        if ("U".equals(codeString))
288          return DocumentConfidentiality.U;
289        if ("L".equals(codeString))
290          return DocumentConfidentiality.L;
291        if ("M".equals(codeString))
292          return DocumentConfidentiality.M;
293        if ("N".equals(codeString))
294          return DocumentConfidentiality.N;
295        if ("R".equals(codeString))
296          return DocumentConfidentiality.R;
297        if ("V".equals(codeString))
298          return DocumentConfidentiality.V;
299        throw new IllegalArgumentException("Unknown DocumentConfidentiality code '"+codeString+"'");
300        }
301        public Enumeration<DocumentConfidentiality> fromType(PrimitiveType<?> code) throws FHIRException {
302          if (code == null)
303            return null;
304          if (code.isEmpty())
305            return new Enumeration<DocumentConfidentiality>(this);
306          String codeString = code.asStringValue();
307          if (codeString == null || "".equals(codeString))
308            return null;
309        if ("U".equals(codeString))
310          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.U);
311        if ("L".equals(codeString))
312          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.L);
313        if ("M".equals(codeString))
314          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.M);
315        if ("N".equals(codeString))
316          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.N);
317        if ("R".equals(codeString))
318          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.R);
319        if ("V".equals(codeString))
320          return new Enumeration<DocumentConfidentiality>(this, DocumentConfidentiality.V);
321        throw new FHIRException("Unknown DocumentConfidentiality code '"+codeString+"'");
322        }
323    public String toCode(DocumentConfidentiality code) {
324      if (code == DocumentConfidentiality.U)
325        return "U";
326      if (code == DocumentConfidentiality.L)
327        return "L";
328      if (code == DocumentConfidentiality.M)
329        return "M";
330      if (code == DocumentConfidentiality.N)
331        return "N";
332      if (code == DocumentConfidentiality.R)
333        return "R";
334      if (code == DocumentConfidentiality.V)
335        return "V";
336      return "?";
337      }
338    public String toSystem(DocumentConfidentiality code) {
339      return code.getSystem();
340      }
341    }
342
343    public enum CompositionAttestationMode {
344        /**
345         * The person authenticated the content in their personal capacity.
346         */
347        PERSONAL, 
348        /**
349         * The person authenticated the content in their professional capacity.
350         */
351        PROFESSIONAL, 
352        /**
353         * The person authenticated the content and accepted legal responsibility for its content.
354         */
355        LEGAL, 
356        /**
357         * The organization authenticated the content as consistent with their policies and procedures.
358         */
359        OFFICIAL, 
360        /**
361         * added to help the parsers with the generic types
362         */
363        NULL;
364        public static CompositionAttestationMode fromCode(String codeString) throws FHIRException {
365            if (codeString == null || "".equals(codeString))
366                return null;
367        if ("personal".equals(codeString))
368          return PERSONAL;
369        if ("professional".equals(codeString))
370          return PROFESSIONAL;
371        if ("legal".equals(codeString))
372          return LEGAL;
373        if ("official".equals(codeString))
374          return OFFICIAL;
375        if (Configuration.isAcceptInvalidEnums())
376          return null;
377        else
378          throw new FHIRException("Unknown CompositionAttestationMode code '"+codeString+"'");
379        }
380        public String toCode() {
381          switch (this) {
382            case PERSONAL: return "personal";
383            case PROFESSIONAL: return "professional";
384            case LEGAL: return "legal";
385            case OFFICIAL: return "official";
386            case NULL: return null;
387            default: return "?";
388          }
389        }
390        public String getSystem() {
391          switch (this) {
392            case PERSONAL: return "http://hl7.org/fhir/composition-attestation-mode";
393            case PROFESSIONAL: return "http://hl7.org/fhir/composition-attestation-mode";
394            case LEGAL: return "http://hl7.org/fhir/composition-attestation-mode";
395            case OFFICIAL: return "http://hl7.org/fhir/composition-attestation-mode";
396            case NULL: return null;
397            default: return "?";
398          }
399        }
400        public String getDefinition() {
401          switch (this) {
402            case PERSONAL: return "The person authenticated the content in their personal capacity.";
403            case PROFESSIONAL: return "The person authenticated the content in their professional capacity.";
404            case LEGAL: return "The person authenticated the content and accepted legal responsibility for its content.";
405            case OFFICIAL: return "The organization authenticated the content as consistent with their policies and procedures.";
406            case NULL: return null;
407            default: return "?";
408          }
409        }
410        public String getDisplay() {
411          switch (this) {
412            case PERSONAL: return "Personal";
413            case PROFESSIONAL: return "Professional";
414            case LEGAL: return "Legal";
415            case OFFICIAL: return "Official";
416            case NULL: return null;
417            default: return "?";
418          }
419        }
420    }
421
422  public static class CompositionAttestationModeEnumFactory implements EnumFactory<CompositionAttestationMode> {
423    public CompositionAttestationMode fromCode(String codeString) throws IllegalArgumentException {
424      if (codeString == null || "".equals(codeString))
425            if (codeString == null || "".equals(codeString))
426                return null;
427        if ("personal".equals(codeString))
428          return CompositionAttestationMode.PERSONAL;
429        if ("professional".equals(codeString))
430          return CompositionAttestationMode.PROFESSIONAL;
431        if ("legal".equals(codeString))
432          return CompositionAttestationMode.LEGAL;
433        if ("official".equals(codeString))
434          return CompositionAttestationMode.OFFICIAL;
435        throw new IllegalArgumentException("Unknown CompositionAttestationMode code '"+codeString+"'");
436        }
437        public Enumeration<CompositionAttestationMode> fromType(PrimitiveType<?> code) throws FHIRException {
438          if (code == null)
439            return null;
440          if (code.isEmpty())
441            return new Enumeration<CompositionAttestationMode>(this);
442          String codeString = code.asStringValue();
443          if (codeString == null || "".equals(codeString))
444            return null;
445        if ("personal".equals(codeString))
446          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PERSONAL);
447        if ("professional".equals(codeString))
448          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PROFESSIONAL);
449        if ("legal".equals(codeString))
450          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.LEGAL);
451        if ("official".equals(codeString))
452          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.OFFICIAL);
453        throw new FHIRException("Unknown CompositionAttestationMode code '"+codeString+"'");
454        }
455    public String toCode(CompositionAttestationMode code) {
456      if (code == CompositionAttestationMode.PERSONAL)
457        return "personal";
458      if (code == CompositionAttestationMode.PROFESSIONAL)
459        return "professional";
460      if (code == CompositionAttestationMode.LEGAL)
461        return "legal";
462      if (code == CompositionAttestationMode.OFFICIAL)
463        return "official";
464      return "?";
465      }
466    public String toSystem(CompositionAttestationMode code) {
467      return code.getSystem();
468      }
469    }
470
471    public enum DocumentRelationshipType {
472        /**
473         * This document logically replaces or supersedes the target document.
474         */
475        REPLACES, 
476        /**
477         * This document was generated by transforming the target document (e.g. format or language conversion).
478         */
479        TRANSFORMS, 
480        /**
481         * This document is a signature of the target document.
482         */
483        SIGNS, 
484        /**
485         * This document adds additional information to the target document.
486         */
487        APPENDS, 
488        /**
489         * added to help the parsers with the generic types
490         */
491        NULL;
492        public static DocumentRelationshipType fromCode(String codeString) throws FHIRException {
493            if (codeString == null || "".equals(codeString))
494                return null;
495        if ("replaces".equals(codeString))
496          return REPLACES;
497        if ("transforms".equals(codeString))
498          return TRANSFORMS;
499        if ("signs".equals(codeString))
500          return SIGNS;
501        if ("appends".equals(codeString))
502          return APPENDS;
503        if (Configuration.isAcceptInvalidEnums())
504          return null;
505        else
506          throw new FHIRException("Unknown DocumentRelationshipType code '"+codeString+"'");
507        }
508        public String toCode() {
509          switch (this) {
510            case REPLACES: return "replaces";
511            case TRANSFORMS: return "transforms";
512            case SIGNS: return "signs";
513            case APPENDS: return "appends";
514            case NULL: return null;
515            default: return "?";
516          }
517        }
518        public String getSystem() {
519          switch (this) {
520            case REPLACES: return "http://hl7.org/fhir/document-relationship-type";
521            case TRANSFORMS: return "http://hl7.org/fhir/document-relationship-type";
522            case SIGNS: return "http://hl7.org/fhir/document-relationship-type";
523            case APPENDS: return "http://hl7.org/fhir/document-relationship-type";
524            case NULL: return null;
525            default: return "?";
526          }
527        }
528        public String getDefinition() {
529          switch (this) {
530            case REPLACES: return "This document logically replaces or supersedes the target document.";
531            case TRANSFORMS: return "This document was generated by transforming the target document (e.g. format or language conversion).";
532            case SIGNS: return "This document is a signature of the target document.";
533            case APPENDS: return "This document adds additional information to the target document.";
534            case NULL: return null;
535            default: return "?";
536          }
537        }
538        public String getDisplay() {
539          switch (this) {
540            case REPLACES: return "Replaces";
541            case TRANSFORMS: return "Transforms";
542            case SIGNS: return "Signs";
543            case APPENDS: return "Appends";
544            case NULL: return null;
545            default: return "?";
546          }
547        }
548    }
549
550  public static class DocumentRelationshipTypeEnumFactory implements EnumFactory<DocumentRelationshipType> {
551    public DocumentRelationshipType fromCode(String codeString) throws IllegalArgumentException {
552      if (codeString == null || "".equals(codeString))
553            if (codeString == null || "".equals(codeString))
554                return null;
555        if ("replaces".equals(codeString))
556          return DocumentRelationshipType.REPLACES;
557        if ("transforms".equals(codeString))
558          return DocumentRelationshipType.TRANSFORMS;
559        if ("signs".equals(codeString))
560          return DocumentRelationshipType.SIGNS;
561        if ("appends".equals(codeString))
562          return DocumentRelationshipType.APPENDS;
563        throw new IllegalArgumentException("Unknown DocumentRelationshipType code '"+codeString+"'");
564        }
565        public Enumeration<DocumentRelationshipType> fromType(PrimitiveType<?> code) throws FHIRException {
566          if (code == null)
567            return null;
568          if (code.isEmpty())
569            return new Enumeration<DocumentRelationshipType>(this);
570          String codeString = code.asStringValue();
571          if (codeString == null || "".equals(codeString))
572            return null;
573        if ("replaces".equals(codeString))
574          return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.REPLACES);
575        if ("transforms".equals(codeString))
576          return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.TRANSFORMS);
577        if ("signs".equals(codeString))
578          return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.SIGNS);
579        if ("appends".equals(codeString))
580          return new Enumeration<DocumentRelationshipType>(this, DocumentRelationshipType.APPENDS);
581        throw new FHIRException("Unknown DocumentRelationshipType code '"+codeString+"'");
582        }
583    public String toCode(DocumentRelationshipType code) {
584      if (code == DocumentRelationshipType.REPLACES)
585        return "replaces";
586      if (code == DocumentRelationshipType.TRANSFORMS)
587        return "transforms";
588      if (code == DocumentRelationshipType.SIGNS)
589        return "signs";
590      if (code == DocumentRelationshipType.APPENDS)
591        return "appends";
592      return "?";
593      }
594    public String toSystem(DocumentRelationshipType code) {
595      return code.getSystem();
596      }
597    }
598
599    public enum SectionMode {
600        /**
601         * This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes
602         */
603        WORKING, 
604        /**
605         * This list was prepared as a snapshot. It should not be assumed to be current
606         */
607        SNAPSHOT, 
608        /**
609         * A list that indicates where changes have been made or recommended
610         */
611        CHANGES, 
612        /**
613         * added to help the parsers with the generic types
614         */
615        NULL;
616        public static SectionMode fromCode(String codeString) throws FHIRException {
617            if (codeString == null || "".equals(codeString))
618                return null;
619        if ("working".equals(codeString))
620          return WORKING;
621        if ("snapshot".equals(codeString))
622          return SNAPSHOT;
623        if ("changes".equals(codeString))
624          return CHANGES;
625        if (Configuration.isAcceptInvalidEnums())
626          return null;
627        else
628          throw new FHIRException("Unknown SectionMode code '"+codeString+"'");
629        }
630        public String toCode() {
631          switch (this) {
632            case WORKING: return "working";
633            case SNAPSHOT: return "snapshot";
634            case CHANGES: return "changes";
635            case NULL: return null;
636            default: return "?";
637          }
638        }
639        public String getSystem() {
640          switch (this) {
641            case WORKING: return "http://hl7.org/fhir/list-mode";
642            case SNAPSHOT: return "http://hl7.org/fhir/list-mode";
643            case CHANGES: return "http://hl7.org/fhir/list-mode";
644            case NULL: return null;
645            default: return "?";
646          }
647        }
648        public String getDefinition() {
649          switch (this) {
650            case WORKING: return "This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes";
651            case SNAPSHOT: return "This list was prepared as a snapshot. It should not be assumed to be current";
652            case CHANGES: return "A list that indicates where changes have been made or recommended";
653            case NULL: return null;
654            default: return "?";
655          }
656        }
657        public String getDisplay() {
658          switch (this) {
659            case WORKING: return "Working List";
660            case SNAPSHOT: return "Snapshot List";
661            case CHANGES: return "Change List";
662            case NULL: return null;
663            default: return "?";
664          }
665        }
666    }
667
668  public static class SectionModeEnumFactory implements EnumFactory<SectionMode> {
669    public SectionMode fromCode(String codeString) throws IllegalArgumentException {
670      if (codeString == null || "".equals(codeString))
671            if (codeString == null || "".equals(codeString))
672                return null;
673        if ("working".equals(codeString))
674          return SectionMode.WORKING;
675        if ("snapshot".equals(codeString))
676          return SectionMode.SNAPSHOT;
677        if ("changes".equals(codeString))
678          return SectionMode.CHANGES;
679        throw new IllegalArgumentException("Unknown SectionMode code '"+codeString+"'");
680        }
681        public Enumeration<SectionMode> fromType(PrimitiveType<?> code) throws FHIRException {
682          if (code == null)
683            return null;
684          if (code.isEmpty())
685            return new Enumeration<SectionMode>(this);
686          String codeString = code.asStringValue();
687          if (codeString == null || "".equals(codeString))
688            return null;
689        if ("working".equals(codeString))
690          return new Enumeration<SectionMode>(this, SectionMode.WORKING);
691        if ("snapshot".equals(codeString))
692          return new Enumeration<SectionMode>(this, SectionMode.SNAPSHOT);
693        if ("changes".equals(codeString))
694          return new Enumeration<SectionMode>(this, SectionMode.CHANGES);
695        throw new FHIRException("Unknown SectionMode code '"+codeString+"'");
696        }
697    public String toCode(SectionMode code) {
698      if (code == SectionMode.WORKING)
699        return "working";
700      if (code == SectionMode.SNAPSHOT)
701        return "snapshot";
702      if (code == SectionMode.CHANGES)
703        return "changes";
704      return "?";
705      }
706    public String toSystem(SectionMode code) {
707      return code.getSystem();
708      }
709    }
710
711    @Block()
712    public static class CompositionAttesterComponent extends BackboneElement implements IBaseBackboneElement {
713        /**
714         * The type of attestation the authenticator offers.
715         */
716        @Child(name = "mode", type = {CodeType.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
717        @Description(shortDefinition="personal | professional | legal | official", formalDefinition="The type of attestation the authenticator offers." )
718        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/composition-attestation-mode")
719        protected List<Enumeration<CompositionAttestationMode>> mode;
720
721        /**
722         * When the composition was attested by the party.
723         */
724        @Child(name = "time", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
725        @Description(shortDefinition="When the composition was attested", formalDefinition="When the composition was attested by the party." )
726        protected DateTimeType time;
727
728        /**
729         * Who attested the composition in the specified way.
730         */
731        @Child(name = "party", type = {Patient.class, Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
732        @Description(shortDefinition="Who attested the composition", formalDefinition="Who attested the composition in the specified way." )
733        protected Reference party;
734
735        /**
736         * The actual object that is the target of the reference (Who attested the composition in the specified way.)
737         */
738        protected Resource partyTarget;
739
740        private static final long serialVersionUID = -436604745L;
741
742    /**
743     * Constructor
744     */
745      public CompositionAttesterComponent() {
746        super();
747      }
748
749        /**
750         * @return {@link #mode} (The type of attestation the authenticator offers.)
751         */
752        public List<Enumeration<CompositionAttestationMode>> getMode() { 
753          if (this.mode == null)
754            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
755          return this.mode;
756        }
757
758        /**
759         * @return Returns a reference to <code>this</code> for easy method chaining
760         */
761        public CompositionAttesterComponent setMode(List<Enumeration<CompositionAttestationMode>> theMode) { 
762          this.mode = theMode;
763          return this;
764        }
765
766        public boolean hasMode() { 
767          if (this.mode == null)
768            return false;
769          for (Enumeration<CompositionAttestationMode> item : this.mode)
770            if (!item.isEmpty())
771              return true;
772          return false;
773        }
774
775        /**
776         * @return {@link #mode} (The type of attestation the authenticator offers.)
777         */
778        public Enumeration<CompositionAttestationMode> addModeElement() {//2 
779          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
780          if (this.mode == null)
781            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
782          this.mode.add(t);
783          return t;
784        }
785
786        /**
787         * @param value {@link #mode} (The type of attestation the authenticator offers.)
788         */
789        public CompositionAttesterComponent addMode(CompositionAttestationMode value) { //1
790          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
791          t.setValue(value);
792          if (this.mode == null)
793            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
794          this.mode.add(t);
795          return this;
796        }
797
798        /**
799         * @param value {@link #mode} (The type of attestation the authenticator offers.)
800         */
801        public boolean hasMode(CompositionAttestationMode value) { 
802          if (this.mode == null)
803            return false;
804          for (Enumeration<CompositionAttestationMode> v : this.mode)
805            if (v.getValue().equals(value)) // code
806              return true;
807          return false;
808        }
809
810        /**
811         * @return {@link #time} (When the composition was attested by the party.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
812         */
813        public DateTimeType getTimeElement() { 
814          if (this.time == null)
815            if (Configuration.errorOnAutoCreate())
816              throw new Error("Attempt to auto-create CompositionAttesterComponent.time");
817            else if (Configuration.doAutoCreate())
818              this.time = new DateTimeType(); // bb
819          return this.time;
820        }
821
822        public boolean hasTimeElement() { 
823          return this.time != null && !this.time.isEmpty();
824        }
825
826        public boolean hasTime() { 
827          return this.time != null && !this.time.isEmpty();
828        }
829
830        /**
831         * @param value {@link #time} (When the composition was attested by the party.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
832         */
833        public CompositionAttesterComponent setTimeElement(DateTimeType value) { 
834          this.time = value;
835          return this;
836        }
837
838        /**
839         * @return When the composition was attested by the party.
840         */
841        public Date getTime() { 
842          return this.time == null ? null : this.time.getValue();
843        }
844
845        /**
846         * @param value When the composition was attested by the party.
847         */
848        public CompositionAttesterComponent setTime(Date value) { 
849          if (value == null)
850            this.time = null;
851          else {
852            if (this.time == null)
853              this.time = new DateTimeType();
854            this.time.setValue(value);
855          }
856          return this;
857        }
858
859        /**
860         * @return {@link #party} (Who attested the composition in the specified way.)
861         */
862        public Reference getParty() { 
863          if (this.party == null)
864            if (Configuration.errorOnAutoCreate())
865              throw new Error("Attempt to auto-create CompositionAttesterComponent.party");
866            else if (Configuration.doAutoCreate())
867              this.party = new Reference(); // cc
868          return this.party;
869        }
870
871        public boolean hasParty() { 
872          return this.party != null && !this.party.isEmpty();
873        }
874
875        /**
876         * @param value {@link #party} (Who attested the composition in the specified way.)
877         */
878        public CompositionAttesterComponent setParty(Reference value)  { 
879          this.party = value;
880          return this;
881        }
882
883        /**
884         * @return {@link #party} 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 attested the composition in the specified way.)
885         */
886        public Resource getPartyTarget() { 
887          return this.partyTarget;
888        }
889
890        /**
891         * @param value {@link #party} 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 attested the composition in the specified way.)
892         */
893        public CompositionAttesterComponent setPartyTarget(Resource value) { 
894          this.partyTarget = value;
895          return this;
896        }
897
898        protected void listChildren(List<Property> children) {
899          super.listChildren(children);
900          children.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode));
901          children.add(new Property("time", "dateTime", "When the composition was attested by the party.", 0, 1, time));
902          children.add(new Property("party", "Reference(Patient|Practitioner|Organization)", "Who attested the composition in the specified way.", 0, 1, party));
903        }
904
905        @Override
906        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
907          switch (_hash) {
908          case 3357091: /*mode*/  return new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode);
909          case 3560141: /*time*/  return new Property("time", "dateTime", "When the composition was attested by the party.", 0, 1, time);
910          case 106437350: /*party*/  return new Property("party", "Reference(Patient|Practitioner|Organization)", "Who attested the composition in the specified way.", 0, 1, party);
911          default: return super.getNamedProperty(_hash, _name, _checkValid);
912          }
913
914        }
915
916      @Override
917      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
918        switch (hash) {
919        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : this.mode.toArray(new Base[this.mode.size()]); // Enumeration<CompositionAttestationMode>
920        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType
921        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
922        default: return super.getProperty(hash, name, checkValid);
923        }
924
925      }
926
927      @Override
928      public Base setProperty(int hash, String name, Base value) throws FHIRException {
929        switch (hash) {
930        case 3357091: // mode
931          value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
932          this.getMode().add((Enumeration) value); // Enumeration<CompositionAttestationMode>
933          return value;
934        case 3560141: // time
935          this.time = castToDateTime(value); // DateTimeType
936          return value;
937        case 106437350: // party
938          this.party = castToReference(value); // Reference
939          return value;
940        default: return super.setProperty(hash, name, value);
941        }
942
943      }
944
945      @Override
946      public Base setProperty(String name, Base value) throws FHIRException {
947        if (name.equals("mode")) {
948          value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
949          this.getMode().add((Enumeration) value);
950        } else if (name.equals("time")) {
951          this.time = castToDateTime(value); // DateTimeType
952        } else if (name.equals("party")) {
953          this.party = castToReference(value); // Reference
954        } else
955          return super.setProperty(name, value);
956        return value;
957      }
958
959      @Override
960      public Base makeProperty(int hash, String name) throws FHIRException {
961        switch (hash) {
962        case 3357091:  return addModeElement();
963        case 3560141:  return getTimeElement();
964        case 106437350:  return getParty(); 
965        default: return super.makeProperty(hash, name);
966        }
967
968      }
969
970      @Override
971      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
972        switch (hash) {
973        case 3357091: /*mode*/ return new String[] {"code"};
974        case 3560141: /*time*/ return new String[] {"dateTime"};
975        case 106437350: /*party*/ return new String[] {"Reference"};
976        default: return super.getTypesForProperty(hash, name);
977        }
978
979      }
980
981      @Override
982      public Base addChild(String name) throws FHIRException {
983        if (name.equals("mode")) {
984          throw new FHIRException("Cannot call addChild on a singleton property Composition.mode");
985        }
986        else if (name.equals("time")) {
987          throw new FHIRException("Cannot call addChild on a singleton property Composition.time");
988        }
989        else if (name.equals("party")) {
990          this.party = new Reference();
991          return this.party;
992        }
993        else
994          return super.addChild(name);
995      }
996
997      public CompositionAttesterComponent copy() {
998        CompositionAttesterComponent dst = new CompositionAttesterComponent();
999        copyValues(dst);
1000        if (mode != null) {
1001          dst.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
1002          for (Enumeration<CompositionAttestationMode> i : mode)
1003            dst.mode.add(i.copy());
1004        };
1005        dst.time = time == null ? null : time.copy();
1006        dst.party = party == null ? null : party.copy();
1007        return dst;
1008      }
1009
1010      @Override
1011      public boolean equalsDeep(Base other_) {
1012        if (!super.equalsDeep(other_))
1013          return false;
1014        if (!(other_ instanceof CompositionAttesterComponent))
1015          return false;
1016        CompositionAttesterComponent o = (CompositionAttesterComponent) other_;
1017        return compareDeep(mode, o.mode, true) && compareDeep(time, o.time, true) && compareDeep(party, o.party, true)
1018          ;
1019      }
1020
1021      @Override
1022      public boolean equalsShallow(Base other_) {
1023        if (!super.equalsShallow(other_))
1024          return false;
1025        if (!(other_ instanceof CompositionAttesterComponent))
1026          return false;
1027        CompositionAttesterComponent o = (CompositionAttesterComponent) other_;
1028        return compareValues(mode, o.mode, true) && compareValues(time, o.time, true);
1029      }
1030
1031      public boolean isEmpty() {
1032        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(mode, time, party);
1033      }
1034
1035  public String fhirType() {
1036    return "Composition.attester";
1037
1038  }
1039
1040  }
1041
1042    @Block()
1043    public static class CompositionRelatesToComponent extends BackboneElement implements IBaseBackboneElement {
1044        /**
1045         * The type of relationship that this composition has with anther composition or document.
1046         */
1047        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1048        @Description(shortDefinition="replaces | transforms | signs | appends", formalDefinition="The type of relationship that this composition has with anther composition or document." )
1049        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/document-relationship-type")
1050        protected Enumeration<DocumentRelationshipType> code;
1051
1052        /**
1053         * The target composition/document of this relationship.
1054         */
1055        @Child(name = "target", type = {Identifier.class, Composition.class}, order=2, min=1, max=1, modifier=false, summary=true)
1056        @Description(shortDefinition="Target of the relationship", formalDefinition="The target composition/document of this relationship." )
1057        protected Type target;
1058
1059        private static final long serialVersionUID = 1536930280L;
1060
1061    /**
1062     * Constructor
1063     */
1064      public CompositionRelatesToComponent() {
1065        super();
1066      }
1067
1068    /**
1069     * Constructor
1070     */
1071      public CompositionRelatesToComponent(Enumeration<DocumentRelationshipType> code, Type target) {
1072        super();
1073        this.code = code;
1074        this.target = target;
1075      }
1076
1077        /**
1078         * @return {@link #code} (The type of relationship that this composition has with anther composition or document.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1079         */
1080        public Enumeration<DocumentRelationshipType> getCodeElement() { 
1081          if (this.code == null)
1082            if (Configuration.errorOnAutoCreate())
1083              throw new Error("Attempt to auto-create CompositionRelatesToComponent.code");
1084            else if (Configuration.doAutoCreate())
1085              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory()); // bb
1086          return this.code;
1087        }
1088
1089        public boolean hasCodeElement() { 
1090          return this.code != null && !this.code.isEmpty();
1091        }
1092
1093        public boolean hasCode() { 
1094          return this.code != null && !this.code.isEmpty();
1095        }
1096
1097        /**
1098         * @param value {@link #code} (The type of relationship that this composition has with anther composition or document.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1099         */
1100        public CompositionRelatesToComponent setCodeElement(Enumeration<DocumentRelationshipType> value) { 
1101          this.code = value;
1102          return this;
1103        }
1104
1105        /**
1106         * @return The type of relationship that this composition has with anther composition or document.
1107         */
1108        public DocumentRelationshipType getCode() { 
1109          return this.code == null ? null : this.code.getValue();
1110        }
1111
1112        /**
1113         * @param value The type of relationship that this composition has with anther composition or document.
1114         */
1115        public CompositionRelatesToComponent setCode(DocumentRelationshipType value) { 
1116            if (this.code == null)
1117              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory());
1118            this.code.setValue(value);
1119          return this;
1120        }
1121
1122        /**
1123         * @return {@link #target} (The target composition/document of this relationship.)
1124         */
1125        public Type getTarget() { 
1126          return this.target;
1127        }
1128
1129        /**
1130         * @return {@link #target} (The target composition/document of this relationship.)
1131         */
1132        public Identifier getTargetIdentifier() throws FHIRException { 
1133          if (this.target == null)
1134            return null;
1135          if (!(this.target instanceof Identifier))
1136            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.target.getClass().getName()+" was encountered");
1137          return (Identifier) this.target;
1138        }
1139
1140        public boolean hasTargetIdentifier() { 
1141          return this != null && this.target instanceof Identifier;
1142        }
1143
1144        /**
1145         * @return {@link #target} (The target composition/document of this relationship.)
1146         */
1147        public Reference getTargetReference() throws FHIRException { 
1148          if (this.target == null)
1149            return null;
1150          if (!(this.target instanceof Reference))
1151            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.target.getClass().getName()+" was encountered");
1152          return (Reference) this.target;
1153        }
1154
1155        public boolean hasTargetReference() { 
1156          return this != null && this.target instanceof Reference;
1157        }
1158
1159        public boolean hasTarget() { 
1160          return this.target != null && !this.target.isEmpty();
1161        }
1162
1163        /**
1164         * @param value {@link #target} (The target composition/document of this relationship.)
1165         */
1166        public CompositionRelatesToComponent setTarget(Type value) throws FHIRFormatError { 
1167          if (value != null && !(value instanceof Identifier || value instanceof Reference))
1168            throw new FHIRFormatError("Not the right type for Composition.relatesTo.target[x]: "+value.fhirType());
1169          this.target = value;
1170          return this;
1171        }
1172
1173        protected void listChildren(List<Property> children) {
1174          super.listChildren(children);
1175          children.add(new Property("code", "code", "The type of relationship that this composition has with anther composition or document.", 0, 1, code));
1176          children.add(new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, 1, target));
1177        }
1178
1179        @Override
1180        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1181          switch (_hash) {
1182          case 3059181: /*code*/  return new Property("code", "code", "The type of relationship that this composition has with anther composition or document.", 0, 1, code);
1183          case -815579825: /*target[x]*/  return new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, 1, target);
1184          case -880905839: /*target*/  return new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, 1, target);
1185          case 1690892570: /*targetIdentifier*/  return new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, 1, target);
1186          case 1259806906: /*targetReference*/  return new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, 1, target);
1187          default: return super.getNamedProperty(_hash, _name, _checkValid);
1188          }
1189
1190        }
1191
1192      @Override
1193      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1194        switch (hash) {
1195        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<DocumentRelationshipType>
1196        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Type
1197        default: return super.getProperty(hash, name, checkValid);
1198        }
1199
1200      }
1201
1202      @Override
1203      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1204        switch (hash) {
1205        case 3059181: // code
1206          value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
1207          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
1208          return value;
1209        case -880905839: // target
1210          this.target = castToType(value); // Type
1211          return value;
1212        default: return super.setProperty(hash, name, value);
1213        }
1214
1215      }
1216
1217      @Override
1218      public Base setProperty(String name, Base value) throws FHIRException {
1219        if (name.equals("code")) {
1220          value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
1221          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
1222        } else if (name.equals("target[x]")) {
1223          this.target = castToType(value); // Type
1224        } else
1225          return super.setProperty(name, value);
1226        return value;
1227      }
1228
1229      @Override
1230      public Base makeProperty(int hash, String name) throws FHIRException {
1231        switch (hash) {
1232        case 3059181:  return getCodeElement();
1233        case -815579825:  return getTarget(); 
1234        case -880905839:  return getTarget(); 
1235        default: return super.makeProperty(hash, name);
1236        }
1237
1238      }
1239
1240      @Override
1241      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1242        switch (hash) {
1243        case 3059181: /*code*/ return new String[] {"code"};
1244        case -880905839: /*target*/ return new String[] {"Identifier", "Reference"};
1245        default: return super.getTypesForProperty(hash, name);
1246        }
1247
1248      }
1249
1250      @Override
1251      public Base addChild(String name) throws FHIRException {
1252        if (name.equals("code")) {
1253          throw new FHIRException("Cannot call addChild on a singleton property Composition.code");
1254        }
1255        else if (name.equals("targetIdentifier")) {
1256          this.target = new Identifier();
1257          return this.target;
1258        }
1259        else if (name.equals("targetReference")) {
1260          this.target = new Reference();
1261          return this.target;
1262        }
1263        else
1264          return super.addChild(name);
1265      }
1266
1267      public CompositionRelatesToComponent copy() {
1268        CompositionRelatesToComponent dst = new CompositionRelatesToComponent();
1269        copyValues(dst);
1270        dst.code = code == null ? null : code.copy();
1271        dst.target = target == null ? null : target.copy();
1272        return dst;
1273      }
1274
1275      @Override
1276      public boolean equalsDeep(Base other_) {
1277        if (!super.equalsDeep(other_))
1278          return false;
1279        if (!(other_ instanceof CompositionRelatesToComponent))
1280          return false;
1281        CompositionRelatesToComponent o = (CompositionRelatesToComponent) other_;
1282        return compareDeep(code, o.code, true) && compareDeep(target, o.target, true);
1283      }
1284
1285      @Override
1286      public boolean equalsShallow(Base other_) {
1287        if (!super.equalsShallow(other_))
1288          return false;
1289        if (!(other_ instanceof CompositionRelatesToComponent))
1290          return false;
1291        CompositionRelatesToComponent o = (CompositionRelatesToComponent) other_;
1292        return compareValues(code, o.code, true);
1293      }
1294
1295      public boolean isEmpty() {
1296        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, target);
1297      }
1298
1299  public String fhirType() {
1300    return "Composition.relatesTo";
1301
1302  }
1303
1304  }
1305
1306    @Block()
1307    public static class CompositionEventComponent extends BackboneElement implements IBaseBackboneElement {
1308        /**
1309         * This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.
1310         */
1311        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1312        @Description(shortDefinition="Code(s) that apply to the event being documented", formalDefinition="This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act." )
1313        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActCode")
1314        protected List<CodeableConcept> code;
1315
1316        /**
1317         * The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.
1318         */
1319        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
1320        @Description(shortDefinition="The period covered by the documentation", formalDefinition="The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time." )
1321        protected Period period;
1322
1323        /**
1324         * The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.
1325         */
1326        @Child(name = "detail", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1327        @Description(shortDefinition="The event(s) being documented", formalDefinition="The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy." )
1328        protected List<Reference> detail;
1329        /**
1330         * The actual objects that are the target of the reference (The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.)
1331         */
1332        protected List<Resource> detailTarget;
1333
1334
1335        private static final long serialVersionUID = -1581379774L;
1336
1337    /**
1338     * Constructor
1339     */
1340      public CompositionEventComponent() {
1341        super();
1342      }
1343
1344        /**
1345         * @return {@link #code} (This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.)
1346         */
1347        public List<CodeableConcept> getCode() { 
1348          if (this.code == null)
1349            this.code = new ArrayList<CodeableConcept>();
1350          return this.code;
1351        }
1352
1353        /**
1354         * @return Returns a reference to <code>this</code> for easy method chaining
1355         */
1356        public CompositionEventComponent setCode(List<CodeableConcept> theCode) { 
1357          this.code = theCode;
1358          return this;
1359        }
1360
1361        public boolean hasCode() { 
1362          if (this.code == null)
1363            return false;
1364          for (CodeableConcept item : this.code)
1365            if (!item.isEmpty())
1366              return true;
1367          return false;
1368        }
1369
1370        public CodeableConcept addCode() { //3
1371          CodeableConcept t = new CodeableConcept();
1372          if (this.code == null)
1373            this.code = new ArrayList<CodeableConcept>();
1374          this.code.add(t);
1375          return t;
1376        }
1377
1378        public CompositionEventComponent addCode(CodeableConcept t) { //3
1379          if (t == null)
1380            return this;
1381          if (this.code == null)
1382            this.code = new ArrayList<CodeableConcept>();
1383          this.code.add(t);
1384          return this;
1385        }
1386
1387        /**
1388         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
1389         */
1390        public CodeableConcept getCodeFirstRep() { 
1391          if (getCode().isEmpty()) {
1392            addCode();
1393          }
1394          return getCode().get(0);
1395        }
1396
1397        /**
1398         * @return {@link #period} (The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.)
1399         */
1400        public Period getPeriod() { 
1401          if (this.period == null)
1402            if (Configuration.errorOnAutoCreate())
1403              throw new Error("Attempt to auto-create CompositionEventComponent.period");
1404            else if (Configuration.doAutoCreate())
1405              this.period = new Period(); // cc
1406          return this.period;
1407        }
1408
1409        public boolean hasPeriod() { 
1410          return this.period != null && !this.period.isEmpty();
1411        }
1412
1413        /**
1414         * @param value {@link #period} (The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.)
1415         */
1416        public CompositionEventComponent setPeriod(Period value)  { 
1417          this.period = value;
1418          return this;
1419        }
1420
1421        /**
1422         * @return {@link #detail} (The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.)
1423         */
1424        public List<Reference> getDetail() { 
1425          if (this.detail == null)
1426            this.detail = new ArrayList<Reference>();
1427          return this.detail;
1428        }
1429
1430        /**
1431         * @return Returns a reference to <code>this</code> for easy method chaining
1432         */
1433        public CompositionEventComponent setDetail(List<Reference> theDetail) { 
1434          this.detail = theDetail;
1435          return this;
1436        }
1437
1438        public boolean hasDetail() { 
1439          if (this.detail == null)
1440            return false;
1441          for (Reference item : this.detail)
1442            if (!item.isEmpty())
1443              return true;
1444          return false;
1445        }
1446
1447        public Reference addDetail() { //3
1448          Reference t = new Reference();
1449          if (this.detail == null)
1450            this.detail = new ArrayList<Reference>();
1451          this.detail.add(t);
1452          return t;
1453        }
1454
1455        public CompositionEventComponent addDetail(Reference t) { //3
1456          if (t == null)
1457            return this;
1458          if (this.detail == null)
1459            this.detail = new ArrayList<Reference>();
1460          this.detail.add(t);
1461          return this;
1462        }
1463
1464        /**
1465         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
1466         */
1467        public Reference getDetailFirstRep() { 
1468          if (getDetail().isEmpty()) {
1469            addDetail();
1470          }
1471          return getDetail().get(0);
1472        }
1473
1474        /**
1475         * @deprecated Use Reference#setResource(IBaseResource) instead
1476         */
1477        @Deprecated
1478        public List<Resource> getDetailTarget() { 
1479          if (this.detailTarget == null)
1480            this.detailTarget = new ArrayList<Resource>();
1481          return this.detailTarget;
1482        }
1483
1484        protected void listChildren(List<Property> children) {
1485          super.listChildren(children);
1486          children.add(new Property("code", "CodeableConcept", "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 0, java.lang.Integer.MAX_VALUE, code));
1487          children.add(new Property("period", "Period", "The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.", 0, 1, period));
1488          children.add(new Property("detail", "Reference(Any)", "The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.", 0, java.lang.Integer.MAX_VALUE, detail));
1489        }
1490
1491        @Override
1492        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1493          switch (_hash) {
1494          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 0, java.lang.Integer.MAX_VALUE, code);
1495          case -991726143: /*period*/  return new Property("period", "Period", "The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.", 0, 1, period);
1496          case -1335224239: /*detail*/  return new Property("detail", "Reference(Any)", "The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.", 0, java.lang.Integer.MAX_VALUE, detail);
1497          default: return super.getNamedProperty(_hash, _name, _checkValid);
1498          }
1499
1500        }
1501
1502      @Override
1503      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1504        switch (hash) {
1505        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
1506        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1507        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
1508        default: return super.getProperty(hash, name, checkValid);
1509        }
1510
1511      }
1512
1513      @Override
1514      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1515        switch (hash) {
1516        case 3059181: // code
1517          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
1518          return value;
1519        case -991726143: // period
1520          this.period = castToPeriod(value); // Period
1521          return value;
1522        case -1335224239: // detail
1523          this.getDetail().add(castToReference(value)); // Reference
1524          return value;
1525        default: return super.setProperty(hash, name, value);
1526        }
1527
1528      }
1529
1530      @Override
1531      public Base setProperty(String name, Base value) throws FHIRException {
1532        if (name.equals("code")) {
1533          this.getCode().add(castToCodeableConcept(value));
1534        } else if (name.equals("period")) {
1535          this.period = castToPeriod(value); // Period
1536        } else if (name.equals("detail")) {
1537          this.getDetail().add(castToReference(value));
1538        } else
1539          return super.setProperty(name, value);
1540        return value;
1541      }
1542
1543      @Override
1544      public Base makeProperty(int hash, String name) throws FHIRException {
1545        switch (hash) {
1546        case 3059181:  return addCode(); 
1547        case -991726143:  return getPeriod(); 
1548        case -1335224239:  return addDetail(); 
1549        default: return super.makeProperty(hash, name);
1550        }
1551
1552      }
1553
1554      @Override
1555      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1556        switch (hash) {
1557        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1558        case -991726143: /*period*/ return new String[] {"Period"};
1559        case -1335224239: /*detail*/ return new String[] {"Reference"};
1560        default: return super.getTypesForProperty(hash, name);
1561        }
1562
1563      }
1564
1565      @Override
1566      public Base addChild(String name) throws FHIRException {
1567        if (name.equals("code")) {
1568          return addCode();
1569        }
1570        else if (name.equals("period")) {
1571          this.period = new Period();
1572          return this.period;
1573        }
1574        else if (name.equals("detail")) {
1575          return addDetail();
1576        }
1577        else
1578          return super.addChild(name);
1579      }
1580
1581      public CompositionEventComponent copy() {
1582        CompositionEventComponent dst = new CompositionEventComponent();
1583        copyValues(dst);
1584        if (code != null) {
1585          dst.code = new ArrayList<CodeableConcept>();
1586          for (CodeableConcept i : code)
1587            dst.code.add(i.copy());
1588        };
1589        dst.period = period == null ? null : period.copy();
1590        if (detail != null) {
1591          dst.detail = new ArrayList<Reference>();
1592          for (Reference i : detail)
1593            dst.detail.add(i.copy());
1594        };
1595        return dst;
1596      }
1597
1598      @Override
1599      public boolean equalsDeep(Base other_) {
1600        if (!super.equalsDeep(other_))
1601          return false;
1602        if (!(other_ instanceof CompositionEventComponent))
1603          return false;
1604        CompositionEventComponent o = (CompositionEventComponent) other_;
1605        return compareDeep(code, o.code, true) && compareDeep(period, o.period, true) && compareDeep(detail, o.detail, true)
1606          ;
1607      }
1608
1609      @Override
1610      public boolean equalsShallow(Base other_) {
1611        if (!super.equalsShallow(other_))
1612          return false;
1613        if (!(other_ instanceof CompositionEventComponent))
1614          return false;
1615        CompositionEventComponent o = (CompositionEventComponent) other_;
1616        return true;
1617      }
1618
1619      public boolean isEmpty() {
1620        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, period, detail);
1621      }
1622
1623  public String fhirType() {
1624    return "Composition.event";
1625
1626  }
1627
1628  }
1629
1630    @Block()
1631    public static class SectionComponent extends BackboneElement implements IBaseBackboneElement {
1632        /**
1633         * The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.
1634         */
1635        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1636        @Description(shortDefinition="Label for section (e.g. for ToC)", formalDefinition="The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents." )
1637        protected StringType title;
1638
1639        /**
1640         * A code identifying the kind of content contained within the section. This must be consistent with the section title.
1641         */
1642        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1643        @Description(shortDefinition="Classification of section (recommended)", formalDefinition="A code identifying the kind of content contained within the section. This must be consistent with the section title." )
1644        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-section-codes")
1645        protected CodeableConcept code;
1646
1647        /**
1648         * A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.
1649         */
1650        @Child(name = "text", type = {Narrative.class}, order=3, min=0, max=1, modifier=false, summary=false)
1651        @Description(shortDefinition="Text summary of the section, for human interpretation", formalDefinition="A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative." )
1652        protected Narrative text;
1653
1654        /**
1655         * How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
1656         */
1657        @Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
1658        @Description(shortDefinition="working | snapshot | changes", formalDefinition="How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted." )
1659        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-mode")
1660        protected Enumeration<SectionMode> mode;
1661
1662        /**
1663         * Specifies the order applied to the items in the section entries.
1664         */
1665        @Child(name = "orderedBy", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1666        @Description(shortDefinition="Order of section entries", formalDefinition="Specifies the order applied to the items in the section entries." )
1667        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-order")
1668        protected CodeableConcept orderedBy;
1669
1670        /**
1671         * A reference to the actual resource from which the narrative in the section is derived.
1672         */
1673        @Child(name = "entry", type = {Reference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1674        @Description(shortDefinition="A reference to data that supports this section", formalDefinition="A reference to the actual resource from which the narrative in the section is derived." )
1675        protected List<Reference> entry;
1676        /**
1677         * The actual objects that are the target of the reference (A reference to the actual resource from which the narrative in the section is derived.)
1678         */
1679        protected List<Resource> entryTarget;
1680
1681
1682        /**
1683         * If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.
1684         */
1685        @Child(name = "emptyReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1686        @Description(shortDefinition="Why the section is empty", formalDefinition="If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason." )
1687        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-empty-reason")
1688        protected CodeableConcept emptyReason;
1689
1690        /**
1691         * A nested sub-section within this section.
1692         */
1693        @Child(name = "section", type = {SectionComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1694        @Description(shortDefinition="Nested Section", formalDefinition="A nested sub-section within this section." )
1695        protected List<SectionComponent> section;
1696
1697        private static final long serialVersionUID = -128426142L;
1698
1699    /**
1700     * Constructor
1701     */
1702      public SectionComponent() {
1703        super();
1704      }
1705
1706        /**
1707         * @return {@link #title} (The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1708         */
1709        public StringType getTitleElement() { 
1710          if (this.title == null)
1711            if (Configuration.errorOnAutoCreate())
1712              throw new Error("Attempt to auto-create SectionComponent.title");
1713            else if (Configuration.doAutoCreate())
1714              this.title = new StringType(); // bb
1715          return this.title;
1716        }
1717
1718        public boolean hasTitleElement() { 
1719          return this.title != null && !this.title.isEmpty();
1720        }
1721
1722        public boolean hasTitle() { 
1723          return this.title != null && !this.title.isEmpty();
1724        }
1725
1726        /**
1727         * @param value {@link #title} (The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1728         */
1729        public SectionComponent setTitleElement(StringType value) { 
1730          this.title = value;
1731          return this;
1732        }
1733
1734        /**
1735         * @return The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.
1736         */
1737        public String getTitle() { 
1738          return this.title == null ? null : this.title.getValue();
1739        }
1740
1741        /**
1742         * @param value The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.
1743         */
1744        public SectionComponent setTitle(String value) { 
1745          if (Utilities.noString(value))
1746            this.title = null;
1747          else {
1748            if (this.title == null)
1749              this.title = new StringType();
1750            this.title.setValue(value);
1751          }
1752          return this;
1753        }
1754
1755        /**
1756         * @return {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
1757         */
1758        public CodeableConcept getCode() { 
1759          if (this.code == null)
1760            if (Configuration.errorOnAutoCreate())
1761              throw new Error("Attempt to auto-create SectionComponent.code");
1762            else if (Configuration.doAutoCreate())
1763              this.code = new CodeableConcept(); // cc
1764          return this.code;
1765        }
1766
1767        public boolean hasCode() { 
1768          return this.code != null && !this.code.isEmpty();
1769        }
1770
1771        /**
1772         * @param value {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
1773         */
1774        public SectionComponent setCode(CodeableConcept value)  { 
1775          this.code = value;
1776          return this;
1777        }
1778
1779        /**
1780         * @return {@link #text} (A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.)
1781         */
1782        public Narrative getText() { 
1783          if (this.text == null)
1784            if (Configuration.errorOnAutoCreate())
1785              throw new Error("Attempt to auto-create SectionComponent.text");
1786            else if (Configuration.doAutoCreate())
1787              this.text = new Narrative(); // cc
1788          return this.text;
1789        }
1790
1791        public boolean hasText() { 
1792          return this.text != null && !this.text.isEmpty();
1793        }
1794
1795        /**
1796         * @param value {@link #text} (A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.)
1797         */
1798        public SectionComponent setText(Narrative value)  { 
1799          this.text = value;
1800          return this;
1801        }
1802
1803        /**
1804         * @return {@link #mode} (How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1805         */
1806        public Enumeration<SectionMode> getModeElement() { 
1807          if (this.mode == null)
1808            if (Configuration.errorOnAutoCreate())
1809              throw new Error("Attempt to auto-create SectionComponent.mode");
1810            else if (Configuration.doAutoCreate())
1811              this.mode = new Enumeration<SectionMode>(new SectionModeEnumFactory()); // bb
1812          return this.mode;
1813        }
1814
1815        public boolean hasModeElement() { 
1816          return this.mode != null && !this.mode.isEmpty();
1817        }
1818
1819        public boolean hasMode() { 
1820          return this.mode != null && !this.mode.isEmpty();
1821        }
1822
1823        /**
1824         * @param value {@link #mode} (How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1825         */
1826        public SectionComponent setModeElement(Enumeration<SectionMode> value) { 
1827          this.mode = value;
1828          return this;
1829        }
1830
1831        /**
1832         * @return How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
1833         */
1834        public SectionMode getMode() { 
1835          return this.mode == null ? null : this.mode.getValue();
1836        }
1837
1838        /**
1839         * @param value How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
1840         */
1841        public SectionComponent setMode(SectionMode value) { 
1842          if (value == null)
1843            this.mode = null;
1844          else {
1845            if (this.mode == null)
1846              this.mode = new Enumeration<SectionMode>(new SectionModeEnumFactory());
1847            this.mode.setValue(value);
1848          }
1849          return this;
1850        }
1851
1852        /**
1853         * @return {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1854         */
1855        public CodeableConcept getOrderedBy() { 
1856          if (this.orderedBy == null)
1857            if (Configuration.errorOnAutoCreate())
1858              throw new Error("Attempt to auto-create SectionComponent.orderedBy");
1859            else if (Configuration.doAutoCreate())
1860              this.orderedBy = new CodeableConcept(); // cc
1861          return this.orderedBy;
1862        }
1863
1864        public boolean hasOrderedBy() { 
1865          return this.orderedBy != null && !this.orderedBy.isEmpty();
1866        }
1867
1868        /**
1869         * @param value {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1870         */
1871        public SectionComponent setOrderedBy(CodeableConcept value)  { 
1872          this.orderedBy = value;
1873          return this;
1874        }
1875
1876        /**
1877         * @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
1878         */
1879        public List<Reference> getEntry() { 
1880          if (this.entry == null)
1881            this.entry = new ArrayList<Reference>();
1882          return this.entry;
1883        }
1884
1885        /**
1886         * @return Returns a reference to <code>this</code> for easy method chaining
1887         */
1888        public SectionComponent setEntry(List<Reference> theEntry) { 
1889          this.entry = theEntry;
1890          return this;
1891        }
1892
1893        public boolean hasEntry() { 
1894          if (this.entry == null)
1895            return false;
1896          for (Reference item : this.entry)
1897            if (!item.isEmpty())
1898              return true;
1899          return false;
1900        }
1901
1902        public Reference addEntry() { //3
1903          Reference t = new Reference();
1904          if (this.entry == null)
1905            this.entry = new ArrayList<Reference>();
1906          this.entry.add(t);
1907          return t;
1908        }
1909
1910        public SectionComponent addEntry(Reference t) { //3
1911          if (t == null)
1912            return this;
1913          if (this.entry == null)
1914            this.entry = new ArrayList<Reference>();
1915          this.entry.add(t);
1916          return this;
1917        }
1918
1919        /**
1920         * @return The first repetition of repeating field {@link #entry}, creating it if it does not already exist
1921         */
1922        public Reference getEntryFirstRep() { 
1923          if (getEntry().isEmpty()) {
1924            addEntry();
1925          }
1926          return getEntry().get(0);
1927        }
1928
1929        /**
1930         * @deprecated Use Reference#setResource(IBaseResource) instead
1931         */
1932        @Deprecated
1933        public List<Resource> getEntryTarget() { 
1934          if (this.entryTarget == null)
1935            this.entryTarget = new ArrayList<Resource>();
1936          return this.entryTarget;
1937        }
1938
1939        /**
1940         * @return {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
1941         */
1942        public CodeableConcept getEmptyReason() { 
1943          if (this.emptyReason == null)
1944            if (Configuration.errorOnAutoCreate())
1945              throw new Error("Attempt to auto-create SectionComponent.emptyReason");
1946            else if (Configuration.doAutoCreate())
1947              this.emptyReason = new CodeableConcept(); // cc
1948          return this.emptyReason;
1949        }
1950
1951        public boolean hasEmptyReason() { 
1952          return this.emptyReason != null && !this.emptyReason.isEmpty();
1953        }
1954
1955        /**
1956         * @param value {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
1957         */
1958        public SectionComponent setEmptyReason(CodeableConcept value)  { 
1959          this.emptyReason = value;
1960          return this;
1961        }
1962
1963        /**
1964         * @return {@link #section} (A nested sub-section within this section.)
1965         */
1966        public List<SectionComponent> getSection() { 
1967          if (this.section == null)
1968            this.section = new ArrayList<SectionComponent>();
1969          return this.section;
1970        }
1971
1972        /**
1973         * @return Returns a reference to <code>this</code> for easy method chaining
1974         */
1975        public SectionComponent setSection(List<SectionComponent> theSection) { 
1976          this.section = theSection;
1977          return this;
1978        }
1979
1980        public boolean hasSection() { 
1981          if (this.section == null)
1982            return false;
1983          for (SectionComponent item : this.section)
1984            if (!item.isEmpty())
1985              return true;
1986          return false;
1987        }
1988
1989        public SectionComponent addSection() { //3
1990          SectionComponent t = new SectionComponent();
1991          if (this.section == null)
1992            this.section = new ArrayList<SectionComponent>();
1993          this.section.add(t);
1994          return t;
1995        }
1996
1997        public SectionComponent addSection(SectionComponent t) { //3
1998          if (t == null)
1999            return this;
2000          if (this.section == null)
2001            this.section = new ArrayList<SectionComponent>();
2002          this.section.add(t);
2003          return this;
2004        }
2005
2006        /**
2007         * @return The first repetition of repeating field {@link #section}, creating it if it does not already exist
2008         */
2009        public SectionComponent getSectionFirstRep() { 
2010          if (getSection().isEmpty()) {
2011            addSection();
2012          }
2013          return getSection().get(0);
2014        }
2015
2016        protected void listChildren(List<Property> children) {
2017          super.listChildren(children);
2018          children.add(new Property("title", "string", "The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, 1, title));
2019          children.add(new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, 1, code));
2020          children.add(new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 0, 1, text));
2021          children.add(new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, 1, mode));
2022          children.add(new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, 1, orderedBy));
2023          children.add(new Property("entry", "Reference(Any)", "A reference to the actual resource from which the narrative in the section is derived.", 0, java.lang.Integer.MAX_VALUE, entry));
2024          children.add(new Property("emptyReason", "CodeableConcept", "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.", 0, 1, emptyReason));
2025          children.add(new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, java.lang.Integer.MAX_VALUE, section));
2026        }
2027
2028        @Override
2029        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2030          switch (_hash) {
2031          case 110371416: /*title*/  return new Property("title", "string", "The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, 1, title);
2032          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, 1, code);
2033          case 3556653: /*text*/  return new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 0, 1, text);
2034          case 3357091: /*mode*/  return new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, 1, mode);
2035          case -391079516: /*orderedBy*/  return new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, 1, orderedBy);
2036          case 96667762: /*entry*/  return new Property("entry", "Reference(Any)", "A reference to the actual resource from which the narrative in the section is derived.", 0, java.lang.Integer.MAX_VALUE, entry);
2037          case 1140135409: /*emptyReason*/  return new Property("emptyReason", "CodeableConcept", "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.", 0, 1, emptyReason);
2038          case 1970241253: /*section*/  return new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, java.lang.Integer.MAX_VALUE, section);
2039          default: return super.getNamedProperty(_hash, _name, _checkValid);
2040          }
2041
2042        }
2043
2044      @Override
2045      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2046        switch (hash) {
2047        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
2048        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2049        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // Narrative
2050        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<SectionMode>
2051        case -391079516: /*orderedBy*/ return this.orderedBy == null ? new Base[0] : new Base[] {this.orderedBy}; // CodeableConcept
2052        case 96667762: /*entry*/ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // Reference
2053        case 1140135409: /*emptyReason*/ return this.emptyReason == null ? new Base[0] : new Base[] {this.emptyReason}; // CodeableConcept
2054        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
2055        default: return super.getProperty(hash, name, checkValid);
2056        }
2057
2058      }
2059
2060      @Override
2061      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2062        switch (hash) {
2063        case 110371416: // title
2064          this.title = castToString(value); // StringType
2065          return value;
2066        case 3059181: // code
2067          this.code = castToCodeableConcept(value); // CodeableConcept
2068          return value;
2069        case 3556653: // text
2070          this.text = castToNarrative(value); // Narrative
2071          return value;
2072        case 3357091: // mode
2073          value = new SectionModeEnumFactory().fromType(castToCode(value));
2074          this.mode = (Enumeration) value; // Enumeration<SectionMode>
2075          return value;
2076        case -391079516: // orderedBy
2077          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
2078          return value;
2079        case 96667762: // entry
2080          this.getEntry().add(castToReference(value)); // Reference
2081          return value;
2082        case 1140135409: // emptyReason
2083          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
2084          return value;
2085        case 1970241253: // section
2086          this.getSection().add((SectionComponent) value); // SectionComponent
2087          return value;
2088        default: return super.setProperty(hash, name, value);
2089        }
2090
2091      }
2092
2093      @Override
2094      public Base setProperty(String name, Base value) throws FHIRException {
2095        if (name.equals("title")) {
2096          this.title = castToString(value); // StringType
2097        } else if (name.equals("code")) {
2098          this.code = castToCodeableConcept(value); // CodeableConcept
2099        } else if (name.equals("text")) {
2100          this.text = castToNarrative(value); // Narrative
2101        } else if (name.equals("mode")) {
2102          value = new SectionModeEnumFactory().fromType(castToCode(value));
2103          this.mode = (Enumeration) value; // Enumeration<SectionMode>
2104        } else if (name.equals("orderedBy")) {
2105          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
2106        } else if (name.equals("entry")) {
2107          this.getEntry().add(castToReference(value));
2108        } else if (name.equals("emptyReason")) {
2109          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
2110        } else if (name.equals("section")) {
2111          this.getSection().add((SectionComponent) value);
2112        } else
2113          return super.setProperty(name, value);
2114        return value;
2115      }
2116
2117      @Override
2118      public Base makeProperty(int hash, String name) throws FHIRException {
2119        switch (hash) {
2120        case 110371416:  return getTitleElement();
2121        case 3059181:  return getCode(); 
2122        case 3556653:  return getText(); 
2123        case 3357091:  return getModeElement();
2124        case -391079516:  return getOrderedBy(); 
2125        case 96667762:  return addEntry(); 
2126        case 1140135409:  return getEmptyReason(); 
2127        case 1970241253:  return addSection(); 
2128        default: return super.makeProperty(hash, name);
2129        }
2130
2131      }
2132
2133      @Override
2134      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2135        switch (hash) {
2136        case 110371416: /*title*/ return new String[] {"string"};
2137        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2138        case 3556653: /*text*/ return new String[] {"Narrative"};
2139        case 3357091: /*mode*/ return new String[] {"code"};
2140        case -391079516: /*orderedBy*/ return new String[] {"CodeableConcept"};
2141        case 96667762: /*entry*/ return new String[] {"Reference"};
2142        case 1140135409: /*emptyReason*/ return new String[] {"CodeableConcept"};
2143        case 1970241253: /*section*/ return new String[] {"@Composition.section"};
2144        default: return super.getTypesForProperty(hash, name);
2145        }
2146
2147      }
2148
2149      @Override
2150      public Base addChild(String name) throws FHIRException {
2151        if (name.equals("title")) {
2152          throw new FHIRException("Cannot call addChild on a singleton property Composition.title");
2153        }
2154        else if (name.equals("code")) {
2155          this.code = new CodeableConcept();
2156          return this.code;
2157        }
2158        else if (name.equals("text")) {
2159          this.text = new Narrative();
2160          return this.text;
2161        }
2162        else if (name.equals("mode")) {
2163          throw new FHIRException("Cannot call addChild on a singleton property Composition.mode");
2164        }
2165        else if (name.equals("orderedBy")) {
2166          this.orderedBy = new CodeableConcept();
2167          return this.orderedBy;
2168        }
2169        else if (name.equals("entry")) {
2170          return addEntry();
2171        }
2172        else if (name.equals("emptyReason")) {
2173          this.emptyReason = new CodeableConcept();
2174          return this.emptyReason;
2175        }
2176        else if (name.equals("section")) {
2177          return addSection();
2178        }
2179        else
2180          return super.addChild(name);
2181      }
2182
2183      public SectionComponent copy() {
2184        SectionComponent dst = new SectionComponent();
2185        copyValues(dst);
2186        dst.title = title == null ? null : title.copy();
2187        dst.code = code == null ? null : code.copy();
2188        dst.text = text == null ? null : text.copy();
2189        dst.mode = mode == null ? null : mode.copy();
2190        dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
2191        if (entry != null) {
2192          dst.entry = new ArrayList<Reference>();
2193          for (Reference i : entry)
2194            dst.entry.add(i.copy());
2195        };
2196        dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
2197        if (section != null) {
2198          dst.section = new ArrayList<SectionComponent>();
2199          for (SectionComponent i : section)
2200            dst.section.add(i.copy());
2201        };
2202        return dst;
2203      }
2204
2205      @Override
2206      public boolean equalsDeep(Base other_) {
2207        if (!super.equalsDeep(other_))
2208          return false;
2209        if (!(other_ instanceof SectionComponent))
2210          return false;
2211        SectionComponent o = (SectionComponent) other_;
2212        return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
2213           && compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(entry, o.entry, true)
2214           && compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true);
2215      }
2216
2217      @Override
2218      public boolean equalsShallow(Base other_) {
2219        if (!super.equalsShallow(other_))
2220          return false;
2221        if (!(other_ instanceof SectionComponent))
2222          return false;
2223        SectionComponent o = (SectionComponent) other_;
2224        return compareValues(title, o.title, true) && compareValues(mode, o.mode, true);
2225      }
2226
2227      public boolean isEmpty() {
2228        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, code, text, mode
2229          , orderedBy, entry, emptyReason, section);
2230      }
2231
2232  public String fhirType() {
2233    return "Composition.section";
2234
2235  }
2236
2237  }
2238
2239    /**
2240     * Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.
2241     */
2242    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
2243    @Description(shortDefinition="Logical identifier of composition (version-independent)", formalDefinition="Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time." )
2244    protected Identifier identifier;
2245
2246    /**
2247     * The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2248     */
2249    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
2250    @Description(shortDefinition="preliminary | final | amended | entered-in-error", formalDefinition="The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document." )
2251    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/composition-status")
2252    protected Enumeration<CompositionStatus> status;
2253
2254    /**
2255     * Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.
2256     */
2257    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
2258    @Description(shortDefinition="Kind of composition (LOINC if possible)", formalDefinition="Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition." )
2259    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-typecodes")
2260    protected CodeableConcept type;
2261
2262    /**
2263     * A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.
2264     */
2265    @Child(name = "class", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
2266    @Description(shortDefinition="Categorization of Composition", formalDefinition="A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type." )
2267    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-classcodes")
2268    protected CodeableConcept class_;
2269
2270    /**
2271     * Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).
2272     */
2273    @Child(name = "subject", type = {Reference.class}, order=4, min=1, max=1, modifier=false, summary=true)
2274    @Description(shortDefinition="Who and/or what the composition is about", formalDefinition="Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure)." )
2275    protected Reference subject;
2276
2277    /**
2278     * The actual object that is the target of the reference (Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).)
2279     */
2280    protected Resource subjectTarget;
2281
2282    /**
2283     * Describes the clinical encounter or type of care this documentation is associated with.
2284     */
2285    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
2286    @Description(shortDefinition="Context of the Composition", formalDefinition="Describes the clinical encounter or type of care this documentation is associated with." )
2287    protected Reference encounter;
2288
2289    /**
2290     * The actual object that is the target of the reference (Describes the clinical encounter or type of care this documentation is associated with.)
2291     */
2292    protected Encounter encounterTarget;
2293
2294    /**
2295     * The composition editing time, when the composition was last logically changed by the author.
2296     */
2297    @Child(name = "date", type = {DateTimeType.class}, order=6, min=1, max=1, modifier=false, summary=true)
2298    @Description(shortDefinition="Composition editing time", formalDefinition="The composition editing time, when the composition was last logically changed by the author." )
2299    protected DateTimeType date;
2300
2301    /**
2302     * Identifies who is responsible for the information in the composition, not necessarily who typed it in.
2303     */
2304    @Child(name = "author", type = {Practitioner.class, Device.class, Patient.class, RelatedPerson.class}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2305    @Description(shortDefinition="Who and/or what authored the composition", formalDefinition="Identifies who is responsible for the information in the composition, not necessarily who typed it in." )
2306    protected List<Reference> author;
2307    /**
2308     * The actual objects that are the target of the reference (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
2309     */
2310    protected List<Resource> authorTarget;
2311
2312
2313    /**
2314     * Official human-readable label for the composition.
2315     */
2316    @Child(name = "title", type = {StringType.class}, order=8, min=1, max=1, modifier=false, summary=true)
2317    @Description(shortDefinition="Human Readable name/title", formalDefinition="Official human-readable label for the composition." )
2318    protected StringType title;
2319
2320    /**
2321     * The code specifying the level of confidentiality of the Composition.
2322     */
2323    @Child(name = "confidentiality", type = {CodeType.class}, order=9, min=0, max=1, modifier=true, summary=true)
2324    @Description(shortDefinition="As defined by affinity domain", formalDefinition="The code specifying the level of confidentiality of the Composition." )
2325    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification")
2326    protected Enumeration<DocumentConfidentiality> confidentiality;
2327
2328    /**
2329     * A participant who has attested to the accuracy of the composition/document.
2330     */
2331    @Child(name = "attester", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2332    @Description(shortDefinition="Attests to accuracy of composition", formalDefinition="A participant who has attested to the accuracy of the composition/document." )
2333    protected List<CompositionAttesterComponent> attester;
2334
2335    /**
2336     * Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.
2337     */
2338    @Child(name = "custodian", type = {Organization.class}, order=11, min=0, max=1, modifier=false, summary=true)
2339    @Description(shortDefinition="Organization which maintains the composition", formalDefinition="Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information." )
2340    protected Reference custodian;
2341
2342    /**
2343     * 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 composition/document information.)
2344     */
2345    protected Organization custodianTarget;
2346
2347    /**
2348     * Relationships that this composition has with other compositions or documents that already exist.
2349     */
2350    @Child(name = "relatesTo", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2351    @Description(shortDefinition="Relationships to other compositions/documents", formalDefinition="Relationships that this composition has with other compositions or documents that already exist." )
2352    protected List<CompositionRelatesToComponent> relatesTo;
2353
2354    /**
2355     * The clinical service, such as a colonoscopy or an appendectomy, being documented.
2356     */
2357    @Child(name = "event", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2358    @Description(shortDefinition="The clinical service(s) being documented", formalDefinition="The clinical service, such as a colonoscopy or an appendectomy, being documented." )
2359    protected List<CompositionEventComponent> event;
2360
2361    /**
2362     * The root of the sections that make up the composition.
2363     */
2364    @Child(name = "section", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2365    @Description(shortDefinition="Composition is broken into sections", formalDefinition="The root of the sections that make up the composition." )
2366    protected List<SectionComponent> section;
2367
2368    private static final long serialVersionUID = -1422555114L;
2369
2370  /**
2371   * Constructor
2372   */
2373    public Composition() {
2374      super();
2375    }
2376
2377  /**
2378   * Constructor
2379   */
2380    public Composition(Enumeration<CompositionStatus> status, CodeableConcept type, Reference subject, DateTimeType date, StringType title) {
2381      super();
2382      this.status = status;
2383      this.type = type;
2384      this.subject = subject;
2385      this.date = date;
2386      this.title = title;
2387    }
2388
2389    /**
2390     * @return {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
2391     */
2392    public Identifier getIdentifier() { 
2393      if (this.identifier == null)
2394        if (Configuration.errorOnAutoCreate())
2395          throw new Error("Attempt to auto-create Composition.identifier");
2396        else if (Configuration.doAutoCreate())
2397          this.identifier = new Identifier(); // cc
2398      return this.identifier;
2399    }
2400
2401    public boolean hasIdentifier() { 
2402      return this.identifier != null && !this.identifier.isEmpty();
2403    }
2404
2405    /**
2406     * @param value {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
2407     */
2408    public Composition setIdentifier(Identifier value)  { 
2409      this.identifier = value;
2410      return this;
2411    }
2412
2413    /**
2414     * @return {@link #status} (The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2415     */
2416    public Enumeration<CompositionStatus> getStatusElement() { 
2417      if (this.status == null)
2418        if (Configuration.errorOnAutoCreate())
2419          throw new Error("Attempt to auto-create Composition.status");
2420        else if (Configuration.doAutoCreate())
2421          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); // bb
2422      return this.status;
2423    }
2424
2425    public boolean hasStatusElement() { 
2426      return this.status != null && !this.status.isEmpty();
2427    }
2428
2429    public boolean hasStatus() { 
2430      return this.status != null && !this.status.isEmpty();
2431    }
2432
2433    /**
2434     * @param value {@link #status} (The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2435     */
2436    public Composition setStatusElement(Enumeration<CompositionStatus> value) { 
2437      this.status = value;
2438      return this;
2439    }
2440
2441    /**
2442     * @return The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2443     */
2444    public CompositionStatus getStatus() { 
2445      return this.status == null ? null : this.status.getValue();
2446    }
2447
2448    /**
2449     * @param value The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2450     */
2451    public Composition setStatus(CompositionStatus value) { 
2452        if (this.status == null)
2453          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory());
2454        this.status.setValue(value);
2455      return this;
2456    }
2457
2458    /**
2459     * @return {@link #type} (Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.)
2460     */
2461    public CodeableConcept getType() { 
2462      if (this.type == null)
2463        if (Configuration.errorOnAutoCreate())
2464          throw new Error("Attempt to auto-create Composition.type");
2465        else if (Configuration.doAutoCreate())
2466          this.type = new CodeableConcept(); // cc
2467      return this.type;
2468    }
2469
2470    public boolean hasType() { 
2471      return this.type != null && !this.type.isEmpty();
2472    }
2473
2474    /**
2475     * @param value {@link #type} (Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.)
2476     */
2477    public Composition setType(CodeableConcept value)  { 
2478      this.type = value;
2479      return this;
2480    }
2481
2482    /**
2483     * @return {@link #class_} (A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.)
2484     */
2485    public CodeableConcept getClass_() { 
2486      if (this.class_ == null)
2487        if (Configuration.errorOnAutoCreate())
2488          throw new Error("Attempt to auto-create Composition.class_");
2489        else if (Configuration.doAutoCreate())
2490          this.class_ = new CodeableConcept(); // cc
2491      return this.class_;
2492    }
2493
2494    public boolean hasClass_() { 
2495      return this.class_ != null && !this.class_.isEmpty();
2496    }
2497
2498    /**
2499     * @param value {@link #class_} (A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.)
2500     */
2501    public Composition setClass_(CodeableConcept value)  { 
2502      this.class_ = value;
2503      return this;
2504    }
2505
2506    /**
2507     * @return {@link #subject} (Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).)
2508     */
2509    public Reference getSubject() { 
2510      if (this.subject == null)
2511        if (Configuration.errorOnAutoCreate())
2512          throw new Error("Attempt to auto-create Composition.subject");
2513        else if (Configuration.doAutoCreate())
2514          this.subject = new Reference(); // cc
2515      return this.subject;
2516    }
2517
2518    public boolean hasSubject() { 
2519      return this.subject != null && !this.subject.isEmpty();
2520    }
2521
2522    /**
2523     * @param value {@link #subject} (Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).)
2524     */
2525    public Composition setSubject(Reference value)  { 
2526      this.subject = value;
2527      return this;
2528    }
2529
2530    /**
2531     * @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 composition is about. The composition 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 livestock, or a set of patients that share a common exposure).)
2532     */
2533    public Resource getSubjectTarget() { 
2534      return this.subjectTarget;
2535    }
2536
2537    /**
2538     * @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 composition is about. The composition 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 livestock, or a set of patients that share a common exposure).)
2539     */
2540    public Composition setSubjectTarget(Resource value) { 
2541      this.subjectTarget = value;
2542      return this;
2543    }
2544
2545    /**
2546     * @return {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2547     */
2548    public Reference getEncounter() { 
2549      if (this.encounter == null)
2550        if (Configuration.errorOnAutoCreate())
2551          throw new Error("Attempt to auto-create Composition.encounter");
2552        else if (Configuration.doAutoCreate())
2553          this.encounter = new Reference(); // cc
2554      return this.encounter;
2555    }
2556
2557    public boolean hasEncounter() { 
2558      return this.encounter != null && !this.encounter.isEmpty();
2559    }
2560
2561    /**
2562     * @param value {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2563     */
2564    public Composition setEncounter(Reference value)  { 
2565      this.encounter = value;
2566      return this;
2567    }
2568
2569    /**
2570     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the clinical encounter or type of care this documentation is associated with.)
2571     */
2572    public Encounter getEncounterTarget() { 
2573      if (this.encounterTarget == null)
2574        if (Configuration.errorOnAutoCreate())
2575          throw new Error("Attempt to auto-create Composition.encounter");
2576        else if (Configuration.doAutoCreate())
2577          this.encounterTarget = new Encounter(); // aa
2578      return this.encounterTarget;
2579    }
2580
2581    /**
2582     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the clinical encounter or type of care this documentation is associated with.)
2583     */
2584    public Composition setEncounterTarget(Encounter value) { 
2585      this.encounterTarget = value;
2586      return this;
2587    }
2588
2589    /**
2590     * @return {@link #date} (The composition editing time, when the composition was last logically changed by the author.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2591     */
2592    public DateTimeType getDateElement() { 
2593      if (this.date == null)
2594        if (Configuration.errorOnAutoCreate())
2595          throw new Error("Attempt to auto-create Composition.date");
2596        else if (Configuration.doAutoCreate())
2597          this.date = new DateTimeType(); // bb
2598      return this.date;
2599    }
2600
2601    public boolean hasDateElement() { 
2602      return this.date != null && !this.date.isEmpty();
2603    }
2604
2605    public boolean hasDate() { 
2606      return this.date != null && !this.date.isEmpty();
2607    }
2608
2609    /**
2610     * @param value {@link #date} (The composition editing time, when the composition was last logically changed by the author.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2611     */
2612    public Composition setDateElement(DateTimeType value) { 
2613      this.date = value;
2614      return this;
2615    }
2616
2617    /**
2618     * @return The composition editing time, when the composition was last logically changed by the author.
2619     */
2620    public Date getDate() { 
2621      return this.date == null ? null : this.date.getValue();
2622    }
2623
2624    /**
2625     * @param value The composition editing time, when the composition was last logically changed by the author.
2626     */
2627    public Composition setDate(Date value) { 
2628        if (this.date == null)
2629          this.date = new DateTimeType();
2630        this.date.setValue(value);
2631      return this;
2632    }
2633
2634    /**
2635     * @return {@link #author} (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
2636     */
2637    public List<Reference> getAuthor() { 
2638      if (this.author == null)
2639        this.author = new ArrayList<Reference>();
2640      return this.author;
2641    }
2642
2643    /**
2644     * @return Returns a reference to <code>this</code> for easy method chaining
2645     */
2646    public Composition setAuthor(List<Reference> theAuthor) { 
2647      this.author = theAuthor;
2648      return this;
2649    }
2650
2651    public boolean hasAuthor() { 
2652      if (this.author == null)
2653        return false;
2654      for (Reference item : this.author)
2655        if (!item.isEmpty())
2656          return true;
2657      return false;
2658    }
2659
2660    public Reference addAuthor() { //3
2661      Reference t = new Reference();
2662      if (this.author == null)
2663        this.author = new ArrayList<Reference>();
2664      this.author.add(t);
2665      return t;
2666    }
2667
2668    public Composition addAuthor(Reference t) { //3
2669      if (t == null)
2670        return this;
2671      if (this.author == null)
2672        this.author = new ArrayList<Reference>();
2673      this.author.add(t);
2674      return this;
2675    }
2676
2677    /**
2678     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
2679     */
2680    public Reference getAuthorFirstRep() { 
2681      if (getAuthor().isEmpty()) {
2682        addAuthor();
2683      }
2684      return getAuthor().get(0);
2685    }
2686
2687    /**
2688     * @deprecated Use Reference#setResource(IBaseResource) instead
2689     */
2690    @Deprecated
2691    public List<Resource> getAuthorTarget() { 
2692      if (this.authorTarget == null)
2693        this.authorTarget = new ArrayList<Resource>();
2694      return this.authorTarget;
2695    }
2696
2697    /**
2698     * @return {@link #title} (Official human-readable label for the composition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2699     */
2700    public StringType getTitleElement() { 
2701      if (this.title == null)
2702        if (Configuration.errorOnAutoCreate())
2703          throw new Error("Attempt to auto-create Composition.title");
2704        else if (Configuration.doAutoCreate())
2705          this.title = new StringType(); // bb
2706      return this.title;
2707    }
2708
2709    public boolean hasTitleElement() { 
2710      return this.title != null && !this.title.isEmpty();
2711    }
2712
2713    public boolean hasTitle() { 
2714      return this.title != null && !this.title.isEmpty();
2715    }
2716
2717    /**
2718     * @param value {@link #title} (Official human-readable label for the composition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2719     */
2720    public Composition setTitleElement(StringType value) { 
2721      this.title = value;
2722      return this;
2723    }
2724
2725    /**
2726     * @return Official human-readable label for the composition.
2727     */
2728    public String getTitle() { 
2729      return this.title == null ? null : this.title.getValue();
2730    }
2731
2732    /**
2733     * @param value Official human-readable label for the composition.
2734     */
2735    public Composition setTitle(String value) { 
2736        if (this.title == null)
2737          this.title = new StringType();
2738        this.title.setValue(value);
2739      return this;
2740    }
2741
2742    /**
2743     * @return {@link #confidentiality} (The code specifying the level of confidentiality of the Composition.). This is the underlying object with id, value and extensions. The accessor "getConfidentiality" gives direct access to the value
2744     */
2745    public Enumeration<DocumentConfidentiality> getConfidentialityElement() { 
2746      if (this.confidentiality == null)
2747        if (Configuration.errorOnAutoCreate())
2748          throw new Error("Attempt to auto-create Composition.confidentiality");
2749        else if (Configuration.doAutoCreate())
2750          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory()); // bb
2751      return this.confidentiality;
2752    }
2753
2754    public boolean hasConfidentialityElement() { 
2755      return this.confidentiality != null && !this.confidentiality.isEmpty();
2756    }
2757
2758    public boolean hasConfidentiality() { 
2759      return this.confidentiality != null && !this.confidentiality.isEmpty();
2760    }
2761
2762    /**
2763     * @param value {@link #confidentiality} (The code specifying the level of confidentiality of the Composition.). This is the underlying object with id, value and extensions. The accessor "getConfidentiality" gives direct access to the value
2764     */
2765    public Composition setConfidentialityElement(Enumeration<DocumentConfidentiality> value) { 
2766      this.confidentiality = value;
2767      return this;
2768    }
2769
2770    /**
2771     * @return The code specifying the level of confidentiality of the Composition.
2772     */
2773    public DocumentConfidentiality getConfidentiality() { 
2774      return this.confidentiality == null ? null : this.confidentiality.getValue();
2775    }
2776
2777    /**
2778     * @param value The code specifying the level of confidentiality of the Composition.
2779     */
2780    public Composition setConfidentiality(DocumentConfidentiality value) { 
2781      if (value == null)
2782        this.confidentiality = null;
2783      else {
2784        if (this.confidentiality == null)
2785          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory());
2786        this.confidentiality.setValue(value);
2787      }
2788      return this;
2789    }
2790
2791    /**
2792     * @return {@link #attester} (A participant who has attested to the accuracy of the composition/document.)
2793     */
2794    public List<CompositionAttesterComponent> getAttester() { 
2795      if (this.attester == null)
2796        this.attester = new ArrayList<CompositionAttesterComponent>();
2797      return this.attester;
2798    }
2799
2800    /**
2801     * @return Returns a reference to <code>this</code> for easy method chaining
2802     */
2803    public Composition setAttester(List<CompositionAttesterComponent> theAttester) { 
2804      this.attester = theAttester;
2805      return this;
2806    }
2807
2808    public boolean hasAttester() { 
2809      if (this.attester == null)
2810        return false;
2811      for (CompositionAttesterComponent item : this.attester)
2812        if (!item.isEmpty())
2813          return true;
2814      return false;
2815    }
2816
2817    public CompositionAttesterComponent addAttester() { //3
2818      CompositionAttesterComponent t = new CompositionAttesterComponent();
2819      if (this.attester == null)
2820        this.attester = new ArrayList<CompositionAttesterComponent>();
2821      this.attester.add(t);
2822      return t;
2823    }
2824
2825    public Composition addAttester(CompositionAttesterComponent t) { //3
2826      if (t == null)
2827        return this;
2828      if (this.attester == null)
2829        this.attester = new ArrayList<CompositionAttesterComponent>();
2830      this.attester.add(t);
2831      return this;
2832    }
2833
2834    /**
2835     * @return The first repetition of repeating field {@link #attester}, creating it if it does not already exist
2836     */
2837    public CompositionAttesterComponent getAttesterFirstRep() { 
2838      if (getAttester().isEmpty()) {
2839        addAttester();
2840      }
2841      return getAttester().get(0);
2842    }
2843
2844    /**
2845     * @return {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2846     */
2847    public Reference getCustodian() { 
2848      if (this.custodian == null)
2849        if (Configuration.errorOnAutoCreate())
2850          throw new Error("Attempt to auto-create Composition.custodian");
2851        else if (Configuration.doAutoCreate())
2852          this.custodian = new Reference(); // cc
2853      return this.custodian;
2854    }
2855
2856    public boolean hasCustodian() { 
2857      return this.custodian != null && !this.custodian.isEmpty();
2858    }
2859
2860    /**
2861     * @param value {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2862     */
2863    public Composition setCustodian(Reference value)  { 
2864      this.custodian = value;
2865      return this;
2866    }
2867
2868    /**
2869     * @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 composition/document information.)
2870     */
2871    public Organization getCustodianTarget() { 
2872      if (this.custodianTarget == null)
2873        if (Configuration.errorOnAutoCreate())
2874          throw new Error("Attempt to auto-create Composition.custodian");
2875        else if (Configuration.doAutoCreate())
2876          this.custodianTarget = new Organization(); // aa
2877      return this.custodianTarget;
2878    }
2879
2880    /**
2881     * @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 composition/document information.)
2882     */
2883    public Composition setCustodianTarget(Organization value) { 
2884      this.custodianTarget = value;
2885      return this;
2886    }
2887
2888    /**
2889     * @return {@link #relatesTo} (Relationships that this composition has with other compositions or documents that already exist.)
2890     */
2891    public List<CompositionRelatesToComponent> getRelatesTo() { 
2892      if (this.relatesTo == null)
2893        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2894      return this.relatesTo;
2895    }
2896
2897    /**
2898     * @return Returns a reference to <code>this</code> for easy method chaining
2899     */
2900    public Composition setRelatesTo(List<CompositionRelatesToComponent> theRelatesTo) { 
2901      this.relatesTo = theRelatesTo;
2902      return this;
2903    }
2904
2905    public boolean hasRelatesTo() { 
2906      if (this.relatesTo == null)
2907        return false;
2908      for (CompositionRelatesToComponent item : this.relatesTo)
2909        if (!item.isEmpty())
2910          return true;
2911      return false;
2912    }
2913
2914    public CompositionRelatesToComponent addRelatesTo() { //3
2915      CompositionRelatesToComponent t = new CompositionRelatesToComponent();
2916      if (this.relatesTo == null)
2917        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2918      this.relatesTo.add(t);
2919      return t;
2920    }
2921
2922    public Composition addRelatesTo(CompositionRelatesToComponent t) { //3
2923      if (t == null)
2924        return this;
2925      if (this.relatesTo == null)
2926        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2927      this.relatesTo.add(t);
2928      return this;
2929    }
2930
2931    /**
2932     * @return The first repetition of repeating field {@link #relatesTo}, creating it if it does not already exist
2933     */
2934    public CompositionRelatesToComponent getRelatesToFirstRep() { 
2935      if (getRelatesTo().isEmpty()) {
2936        addRelatesTo();
2937      }
2938      return getRelatesTo().get(0);
2939    }
2940
2941    /**
2942     * @return {@link #event} (The clinical service, such as a colonoscopy or an appendectomy, being documented.)
2943     */
2944    public List<CompositionEventComponent> getEvent() { 
2945      if (this.event == null)
2946        this.event = new ArrayList<CompositionEventComponent>();
2947      return this.event;
2948    }
2949
2950    /**
2951     * @return Returns a reference to <code>this</code> for easy method chaining
2952     */
2953    public Composition setEvent(List<CompositionEventComponent> theEvent) { 
2954      this.event = theEvent;
2955      return this;
2956    }
2957
2958    public boolean hasEvent() { 
2959      if (this.event == null)
2960        return false;
2961      for (CompositionEventComponent item : this.event)
2962        if (!item.isEmpty())
2963          return true;
2964      return false;
2965    }
2966
2967    public CompositionEventComponent addEvent() { //3
2968      CompositionEventComponent t = new CompositionEventComponent();
2969      if (this.event == null)
2970        this.event = new ArrayList<CompositionEventComponent>();
2971      this.event.add(t);
2972      return t;
2973    }
2974
2975    public Composition addEvent(CompositionEventComponent t) { //3
2976      if (t == null)
2977        return this;
2978      if (this.event == null)
2979        this.event = new ArrayList<CompositionEventComponent>();
2980      this.event.add(t);
2981      return this;
2982    }
2983
2984    /**
2985     * @return The first repetition of repeating field {@link #event}, creating it if it does not already exist
2986     */
2987    public CompositionEventComponent getEventFirstRep() { 
2988      if (getEvent().isEmpty()) {
2989        addEvent();
2990      }
2991      return getEvent().get(0);
2992    }
2993
2994    /**
2995     * @return {@link #section} (The root of the sections that make up the composition.)
2996     */
2997    public List<SectionComponent> getSection() { 
2998      if (this.section == null)
2999        this.section = new ArrayList<SectionComponent>();
3000      return this.section;
3001    }
3002
3003    /**
3004     * @return Returns a reference to <code>this</code> for easy method chaining
3005     */
3006    public Composition setSection(List<SectionComponent> theSection) { 
3007      this.section = theSection;
3008      return this;
3009    }
3010
3011    public boolean hasSection() { 
3012      if (this.section == null)
3013        return false;
3014      for (SectionComponent item : this.section)
3015        if (!item.isEmpty())
3016          return true;
3017      return false;
3018    }
3019
3020    public SectionComponent addSection() { //3
3021      SectionComponent t = new SectionComponent();
3022      if (this.section == null)
3023        this.section = new ArrayList<SectionComponent>();
3024      this.section.add(t);
3025      return t;
3026    }
3027
3028    public Composition addSection(SectionComponent t) { //3
3029      if (t == null)
3030        return this;
3031      if (this.section == null)
3032        this.section = new ArrayList<SectionComponent>();
3033      this.section.add(t);
3034      return this;
3035    }
3036
3037    /**
3038     * @return The first repetition of repeating field {@link #section}, creating it if it does not already exist
3039     */
3040    public SectionComponent getSectionFirstRep() { 
3041      if (getSection().isEmpty()) {
3042        addSection();
3043      }
3044      return getSection().get(0);
3045    }
3046
3047      protected void listChildren(List<Property> children) {
3048        super.listChildren(children);
3049        children.add(new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, 1, identifier));
3050        children.add(new Property("status", "code", "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 0, 1, status));
3051        children.add(new Property("type", "CodeableConcept", "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 0, 1, type));
3052        children.add(new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_));
3053        children.add(new Property("subject", "Reference(Any)", "Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).", 0, 1, subject));
3054        children.add(new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care this documentation is associated with.", 0, 1, encounter));
3055        children.add(new Property("date", "dateTime", "The composition editing time, when the composition was last logically changed by the author.", 0, 1, date));
3056        children.add(new Property("author", "Reference(Practitioner|Device|Patient|RelatedPerson)", "Identifies who is responsible for the information in the composition, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author));
3057        children.add(new Property("title", "string", "Official human-readable label for the composition.", 0, 1, title));
3058        children.add(new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, 1, confidentiality));
3059        children.add(new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 0, java.lang.Integer.MAX_VALUE, attester));
3060        children.add(new Property("custodian", "Reference(Organization)", "Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.", 0, 1, custodian));
3061        children.add(new Property("relatesTo", "", "Relationships that this composition has with other compositions or documents that already exist.", 0, java.lang.Integer.MAX_VALUE, relatesTo));
3062        children.add(new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 0, java.lang.Integer.MAX_VALUE, event));
3063        children.add(new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section));
3064      }
3065
3066      @Override
3067      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3068        switch (_hash) {
3069        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, 1, identifier);
3070        case -892481550: /*status*/  return new Property("status", "code", "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 0, 1, status);
3071        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 0, 1, type);
3072        case 94742904: /*class*/  return new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_);
3073        case -1867885268: /*subject*/  return new Property("subject", "Reference(Any)", "Who or what the composition is about. The composition 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 livestock, or a set of patients that share a common exposure).", 0, 1, subject);
3074        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care this documentation is associated with.", 0, 1, encounter);
3075        case 3076014: /*date*/  return new Property("date", "dateTime", "The composition editing time, when the composition was last logically changed by the author.", 0, 1, date);
3076        case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|Device|Patient|RelatedPerson)", "Identifies who is responsible for the information in the composition, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author);
3077        case 110371416: /*title*/  return new Property("title", "string", "Official human-readable label for the composition.", 0, 1, title);
3078        case -1923018202: /*confidentiality*/  return new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, 1, confidentiality);
3079        case 542920370: /*attester*/  return new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 0, java.lang.Integer.MAX_VALUE, attester);
3080        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 composition/document information.", 0, 1, custodian);
3081        case -7765931: /*relatesTo*/  return new Property("relatesTo", "", "Relationships that this composition has with other compositions or documents that already exist.", 0, java.lang.Integer.MAX_VALUE, relatesTo);
3082        case 96891546: /*event*/  return new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 0, java.lang.Integer.MAX_VALUE, event);
3083        case 1970241253: /*section*/  return new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section);
3084        default: return super.getNamedProperty(_hash, _name, _checkValid);
3085        }
3086
3087      }
3088
3089      @Override
3090      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3091        switch (hash) {
3092        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3093        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CompositionStatus>
3094        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3095        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept
3096        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3097        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3098        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3099        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
3100        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3101        case -1923018202: /*confidentiality*/ return this.confidentiality == null ? new Base[0] : new Base[] {this.confidentiality}; // Enumeration<DocumentConfidentiality>
3102        case 542920370: /*attester*/ return this.attester == null ? new Base[0] : this.attester.toArray(new Base[this.attester.size()]); // CompositionAttesterComponent
3103        case 1611297262: /*custodian*/ return this.custodian == null ? new Base[0] : new Base[] {this.custodian}; // Reference
3104        case -7765931: /*relatesTo*/ return this.relatesTo == null ? new Base[0] : this.relatesTo.toArray(new Base[this.relatesTo.size()]); // CompositionRelatesToComponent
3105        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CompositionEventComponent
3106        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
3107        default: return super.getProperty(hash, name, checkValid);
3108        }
3109
3110      }
3111
3112      @Override
3113      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3114        switch (hash) {
3115        case -1618432855: // identifier
3116          this.identifier = castToIdentifier(value); // Identifier
3117          return value;
3118        case -892481550: // status
3119          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3120          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3121          return value;
3122        case 3575610: // type
3123          this.type = castToCodeableConcept(value); // CodeableConcept
3124          return value;
3125        case 94742904: // class
3126          this.class_ = castToCodeableConcept(value); // CodeableConcept
3127          return value;
3128        case -1867885268: // subject
3129          this.subject = castToReference(value); // Reference
3130          return value;
3131        case 1524132147: // encounter
3132          this.encounter = castToReference(value); // Reference
3133          return value;
3134        case 3076014: // date
3135          this.date = castToDateTime(value); // DateTimeType
3136          return value;
3137        case -1406328437: // author
3138          this.getAuthor().add(castToReference(value)); // Reference
3139          return value;
3140        case 110371416: // title
3141          this.title = castToString(value); // StringType
3142          return value;
3143        case -1923018202: // confidentiality
3144          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3145          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3146          return value;
3147        case 542920370: // attester
3148          this.getAttester().add((CompositionAttesterComponent) value); // CompositionAttesterComponent
3149          return value;
3150        case 1611297262: // custodian
3151          this.custodian = castToReference(value); // Reference
3152          return value;
3153        case -7765931: // relatesTo
3154          this.getRelatesTo().add((CompositionRelatesToComponent) value); // CompositionRelatesToComponent
3155          return value;
3156        case 96891546: // event
3157          this.getEvent().add((CompositionEventComponent) value); // CompositionEventComponent
3158          return value;
3159        case 1970241253: // section
3160          this.getSection().add((SectionComponent) value); // SectionComponent
3161          return value;
3162        default: return super.setProperty(hash, name, value);
3163        }
3164
3165      }
3166
3167      @Override
3168      public Base setProperty(String name, Base value) throws FHIRException {
3169        if (name.equals("identifier")) {
3170          this.identifier = castToIdentifier(value); // Identifier
3171        } else if (name.equals("status")) {
3172          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3173          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3174        } else if (name.equals("type")) {
3175          this.type = castToCodeableConcept(value); // CodeableConcept
3176        } else if (name.equals("class")) {
3177          this.class_ = castToCodeableConcept(value); // CodeableConcept
3178        } else if (name.equals("subject")) {
3179          this.subject = castToReference(value); // Reference
3180        } else if (name.equals("encounter")) {
3181          this.encounter = castToReference(value); // Reference
3182        } else if (name.equals("date")) {
3183          this.date = castToDateTime(value); // DateTimeType
3184        } else if (name.equals("author")) {
3185          this.getAuthor().add(castToReference(value));
3186        } else if (name.equals("title")) {
3187          this.title = castToString(value); // StringType
3188        } else if (name.equals("confidentiality")) {
3189          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3190          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3191        } else if (name.equals("attester")) {
3192          this.getAttester().add((CompositionAttesterComponent) value);
3193        } else if (name.equals("custodian")) {
3194          this.custodian = castToReference(value); // Reference
3195        } else if (name.equals("relatesTo")) {
3196          this.getRelatesTo().add((CompositionRelatesToComponent) value);
3197        } else if (name.equals("event")) {
3198          this.getEvent().add((CompositionEventComponent) value);
3199        } else if (name.equals("section")) {
3200          this.getSection().add((SectionComponent) value);
3201        } else
3202          return super.setProperty(name, value);
3203        return value;
3204      }
3205
3206      @Override
3207      public Base makeProperty(int hash, String name) throws FHIRException {
3208        switch (hash) {
3209        case -1618432855:  return getIdentifier(); 
3210        case -892481550:  return getStatusElement();
3211        case 3575610:  return getType(); 
3212        case 94742904:  return getClass_(); 
3213        case -1867885268:  return getSubject(); 
3214        case 1524132147:  return getEncounter(); 
3215        case 3076014:  return getDateElement();
3216        case -1406328437:  return addAuthor(); 
3217        case 110371416:  return getTitleElement();
3218        case -1923018202:  return getConfidentialityElement();
3219        case 542920370:  return addAttester(); 
3220        case 1611297262:  return getCustodian(); 
3221        case -7765931:  return addRelatesTo(); 
3222        case 96891546:  return addEvent(); 
3223        case 1970241253:  return addSection(); 
3224        default: return super.makeProperty(hash, name);
3225        }
3226
3227      }
3228
3229      @Override
3230      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3231        switch (hash) {
3232        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3233        case -892481550: /*status*/ return new String[] {"code"};
3234        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3235        case 94742904: /*class*/ return new String[] {"CodeableConcept"};
3236        case -1867885268: /*subject*/ return new String[] {"Reference"};
3237        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3238        case 3076014: /*date*/ return new String[] {"dateTime"};
3239        case -1406328437: /*author*/ return new String[] {"Reference"};
3240        case 110371416: /*title*/ return new String[] {"string"};
3241        case -1923018202: /*confidentiality*/ return new String[] {"code"};
3242        case 542920370: /*attester*/ return new String[] {};
3243        case 1611297262: /*custodian*/ return new String[] {"Reference"};
3244        case -7765931: /*relatesTo*/ return new String[] {};
3245        case 96891546: /*event*/ return new String[] {};
3246        case 1970241253: /*section*/ return new String[] {};
3247        default: return super.getTypesForProperty(hash, name);
3248        }
3249
3250      }
3251
3252      @Override
3253      public Base addChild(String name) throws FHIRException {
3254        if (name.equals("identifier")) {
3255          this.identifier = new Identifier();
3256          return this.identifier;
3257        }
3258        else if (name.equals("status")) {
3259          throw new FHIRException("Cannot call addChild on a singleton property Composition.status");
3260        }
3261        else if (name.equals("type")) {
3262          this.type = new CodeableConcept();
3263          return this.type;
3264        }
3265        else if (name.equals("class")) {
3266          this.class_ = new CodeableConcept();
3267          return this.class_;
3268        }
3269        else if (name.equals("subject")) {
3270          this.subject = new Reference();
3271          return this.subject;
3272        }
3273        else if (name.equals("encounter")) {
3274          this.encounter = new Reference();
3275          return this.encounter;
3276        }
3277        else if (name.equals("date")) {
3278          throw new FHIRException("Cannot call addChild on a singleton property Composition.date");
3279        }
3280        else if (name.equals("author")) {
3281          return addAuthor();
3282        }
3283        else if (name.equals("title")) {
3284          throw new FHIRException("Cannot call addChild on a singleton property Composition.title");
3285        }
3286        else if (name.equals("confidentiality")) {
3287          throw new FHIRException("Cannot call addChild on a singleton property Composition.confidentiality");
3288        }
3289        else if (name.equals("attester")) {
3290          return addAttester();
3291        }
3292        else if (name.equals("custodian")) {
3293          this.custodian = new Reference();
3294          return this.custodian;
3295        }
3296        else if (name.equals("relatesTo")) {
3297          return addRelatesTo();
3298        }
3299        else if (name.equals("event")) {
3300          return addEvent();
3301        }
3302        else if (name.equals("section")) {
3303          return addSection();
3304        }
3305        else
3306          return super.addChild(name);
3307      }
3308
3309  public String fhirType() {
3310    return "Composition";
3311
3312  }
3313
3314      public Composition copy() {
3315        Composition dst = new Composition();
3316        copyValues(dst);
3317        dst.identifier = identifier == null ? null : identifier.copy();
3318        dst.status = status == null ? null : status.copy();
3319        dst.type = type == null ? null : type.copy();
3320        dst.class_ = class_ == null ? null : class_.copy();
3321        dst.subject = subject == null ? null : subject.copy();
3322        dst.encounter = encounter == null ? null : encounter.copy();
3323        dst.date = date == null ? null : date.copy();
3324        if (author != null) {
3325          dst.author = new ArrayList<Reference>();
3326          for (Reference i : author)
3327            dst.author.add(i.copy());
3328        };
3329        dst.title = title == null ? null : title.copy();
3330        dst.confidentiality = confidentiality == null ? null : confidentiality.copy();
3331        if (attester != null) {
3332          dst.attester = new ArrayList<CompositionAttesterComponent>();
3333          for (CompositionAttesterComponent i : attester)
3334            dst.attester.add(i.copy());
3335        };
3336        dst.custodian = custodian == null ? null : custodian.copy();
3337        if (relatesTo != null) {
3338          dst.relatesTo = new ArrayList<CompositionRelatesToComponent>();
3339          for (CompositionRelatesToComponent i : relatesTo)
3340            dst.relatesTo.add(i.copy());
3341        };
3342        if (event != null) {
3343          dst.event = new ArrayList<CompositionEventComponent>();
3344          for (CompositionEventComponent i : event)
3345            dst.event.add(i.copy());
3346        };
3347        if (section != null) {
3348          dst.section = new ArrayList<SectionComponent>();
3349          for (SectionComponent i : section)
3350            dst.section.add(i.copy());
3351        };
3352        return dst;
3353      }
3354
3355      protected Composition typedCopy() {
3356        return copy();
3357      }
3358
3359      @Override
3360      public boolean equalsDeep(Base other_) {
3361        if (!super.equalsDeep(other_))
3362          return false;
3363        if (!(other_ instanceof Composition))
3364          return false;
3365        Composition o = (Composition) other_;
3366        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
3367           && compareDeep(class_, o.class_, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
3368           && compareDeep(date, o.date, true) && compareDeep(author, o.author, true) && compareDeep(title, o.title, true)
3369           && compareDeep(confidentiality, o.confidentiality, true) && compareDeep(attester, o.attester, true)
3370           && compareDeep(custodian, o.custodian, true) && compareDeep(relatesTo, o.relatesTo, true) && compareDeep(event, o.event, true)
3371           && compareDeep(section, o.section, true);
3372      }
3373
3374      @Override
3375      public boolean equalsShallow(Base other_) {
3376        if (!super.equalsShallow(other_))
3377          return false;
3378        if (!(other_ instanceof Composition))
3379          return false;
3380        Composition o = (Composition) other_;
3381        return compareValues(status, o.status, true) && compareValues(date, o.date, true) && compareValues(title, o.title, true)
3382           && compareValues(confidentiality, o.confidentiality, true);
3383      }
3384
3385      public boolean isEmpty() {
3386        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
3387          , class_, subject, encounter, date, author, title, confidentiality, attester
3388          , custodian, relatesTo, event, section);
3389      }
3390
3391  @Override
3392  public ResourceType getResourceType() {
3393    return ResourceType.Composition;
3394   }
3395
3396 /**
3397   * Search parameter: <b>date</b>
3398   * <p>
3399   * Description: <b>Composition editing time</b><br>
3400   * Type: <b>date</b><br>
3401   * Path: <b>Composition.date</b><br>
3402   * </p>
3403   */
3404  @SearchParamDefinition(name="date", path="Composition.date", description="Composition editing time", type="date" )
3405  public static final String SP_DATE = "date";
3406 /**
3407   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3408   * <p>
3409   * Description: <b>Composition editing time</b><br>
3410   * Type: <b>date</b><br>
3411   * Path: <b>Composition.date</b><br>
3412   * </p>
3413   */
3414  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3415
3416 /**
3417   * Search parameter: <b>identifier</b>
3418   * <p>
3419   * Description: <b>Logical identifier of composition (version-independent)</b><br>
3420   * Type: <b>token</b><br>
3421   * Path: <b>Composition.identifier</b><br>
3422   * </p>
3423   */
3424  @SearchParamDefinition(name="identifier", path="Composition.identifier", description="Logical identifier of composition (version-independent)", type="token" )
3425  public static final String SP_IDENTIFIER = "identifier";
3426 /**
3427   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3428   * <p>
3429   * Description: <b>Logical identifier of composition (version-independent)</b><br>
3430   * Type: <b>token</b><br>
3431   * Path: <b>Composition.identifier</b><br>
3432   * </p>
3433   */
3434  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3435
3436 /**
3437   * Search parameter: <b>period</b>
3438   * <p>
3439   * Description: <b>The period covered by the documentation</b><br>
3440   * Type: <b>date</b><br>
3441   * Path: <b>Composition.event.period</b><br>
3442   * </p>
3443   */
3444  @SearchParamDefinition(name="period", path="Composition.event.period", description="The period covered by the documentation", type="date" )
3445  public static final String SP_PERIOD = "period";
3446 /**
3447   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3448   * <p>
3449   * Description: <b>The period covered by the documentation</b><br>
3450   * Type: <b>date</b><br>
3451   * Path: <b>Composition.event.period</b><br>
3452   * </p>
3453   */
3454  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
3455
3456 /**
3457   * Search parameter: <b>related-id</b>
3458   * <p>
3459   * Description: <b>Target of the relationship</b><br>
3460   * Type: <b>token</b><br>
3461   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3462   * </p>
3463   */
3464  @SearchParamDefinition(name="related-id", path="Composition.relatesTo.target.as(Identifier)", description="Target of the relationship", type="token" )
3465  public static final String SP_RELATED_ID = "related-id";
3466 /**
3467   * <b>Fluent Client</b> search parameter constant for <b>related-id</b>
3468   * <p>
3469   * Description: <b>Target of the relationship</b><br>
3470   * Type: <b>token</b><br>
3471   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3472   * </p>
3473   */
3474  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATED_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATED_ID);
3475
3476 /**
3477   * Search parameter: <b>subject</b>
3478   * <p>
3479   * Description: <b>Who and/or what the composition is about</b><br>
3480   * Type: <b>reference</b><br>
3481   * Path: <b>Composition.subject</b><br>
3482   * </p>
3483   */
3484  @SearchParamDefinition(name="subject", path="Composition.subject", description="Who and/or what the composition is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") } )
3485  public static final String SP_SUBJECT = "subject";
3486 /**
3487   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3488   * <p>
3489   * Description: <b>Who and/or what the composition is about</b><br>
3490   * Type: <b>reference</b><br>
3491   * Path: <b>Composition.subject</b><br>
3492   * </p>
3493   */
3494  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3495
3496/**
3497   * Constant for fluent queries to be used to add include statements. Specifies
3498   * the path value of "<b>Composition:subject</b>".
3499   */
3500  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Composition:subject").toLocked();
3501
3502 /**
3503   * Search parameter: <b>author</b>
3504   * <p>
3505   * Description: <b>Who and/or what authored the composition</b><br>
3506   * Type: <b>reference</b><br>
3507   * Path: <b>Composition.author</b><br>
3508   * </p>
3509   */
3510  @SearchParamDefinition(name="author", path="Composition.author", description="Who and/or what authored the composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3511  public static final String SP_AUTHOR = "author";
3512 /**
3513   * <b>Fluent Client</b> search parameter constant for <b>author</b>
3514   * <p>
3515   * Description: <b>Who and/or what authored the composition</b><br>
3516   * Type: <b>reference</b><br>
3517   * Path: <b>Composition.author</b><br>
3518   * </p>
3519   */
3520  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
3521
3522/**
3523   * Constant for fluent queries to be used to add include statements. Specifies
3524   * the path value of "<b>Composition:author</b>".
3525   */
3526  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Composition:author").toLocked();
3527
3528 /**
3529   * Search parameter: <b>confidentiality</b>
3530   * <p>
3531   * Description: <b>As defined by affinity domain</b><br>
3532   * Type: <b>token</b><br>
3533   * Path: <b>Composition.confidentiality</b><br>
3534   * </p>
3535   */
3536  @SearchParamDefinition(name="confidentiality", path="Composition.confidentiality", description="As defined by affinity domain", type="token" )
3537  public static final String SP_CONFIDENTIALITY = "confidentiality";
3538 /**
3539   * <b>Fluent Client</b> search parameter constant for <b>confidentiality</b>
3540   * <p>
3541   * Description: <b>As defined by affinity domain</b><br>
3542   * Type: <b>token</b><br>
3543   * Path: <b>Composition.confidentiality</b><br>
3544   * </p>
3545   */
3546  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONFIDENTIALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONFIDENTIALITY);
3547
3548 /**
3549   * Search parameter: <b>section</b>
3550   * <p>
3551   * Description: <b>Classification of section (recommended)</b><br>
3552   * Type: <b>token</b><br>
3553   * Path: <b>Composition.section.code</b><br>
3554   * </p>
3555   */
3556  @SearchParamDefinition(name="section", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
3557  public static final String SP_SECTION = "section";
3558 /**
3559   * <b>Fluent Client</b> search parameter constant for <b>section</b>
3560   * <p>
3561   * Description: <b>Classification of section (recommended)</b><br>
3562   * Type: <b>token</b><br>
3563   * Path: <b>Composition.section.code</b><br>
3564   * </p>
3565   */
3566  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECTION);
3567
3568 /**
3569   * Search parameter: <b>encounter</b>
3570   * <p>
3571   * Description: <b>Context of the Composition</b><br>
3572   * Type: <b>reference</b><br>
3573   * Path: <b>Composition.encounter</b><br>
3574   * </p>
3575   */
3576  @SearchParamDefinition(name="encounter", path="Composition.encounter", description="Context of the Composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
3577  public static final String SP_ENCOUNTER = "encounter";
3578 /**
3579   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3580   * <p>
3581   * Description: <b>Context of the Composition</b><br>
3582   * Type: <b>reference</b><br>
3583   * Path: <b>Composition.encounter</b><br>
3584   * </p>
3585   */
3586  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3587
3588/**
3589   * Constant for fluent queries to be used to add include statements. Specifies
3590   * the path value of "<b>Composition:encounter</b>".
3591   */
3592  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Composition:encounter").toLocked();
3593
3594 /**
3595   * Search parameter: <b>type</b>
3596   * <p>
3597   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3598   * Type: <b>token</b><br>
3599   * Path: <b>Composition.type</b><br>
3600   * </p>
3601   */
3602  @SearchParamDefinition(name="type", path="Composition.type", description="Kind of composition (LOINC if possible)", type="token" )
3603  public static final String SP_TYPE = "type";
3604 /**
3605   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3606   * <p>
3607   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3608   * Type: <b>token</b><br>
3609   * Path: <b>Composition.type</b><br>
3610   * </p>
3611   */
3612  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3613
3614 /**
3615   * Search parameter: <b>title</b>
3616   * <p>
3617   * Description: <b>Human Readable name/title</b><br>
3618   * Type: <b>string</b><br>
3619   * Path: <b>Composition.title</b><br>
3620   * </p>
3621   */
3622  @SearchParamDefinition(name="title", path="Composition.title", description="Human Readable name/title", type="string" )
3623  public static final String SP_TITLE = "title";
3624 /**
3625   * <b>Fluent Client</b> search parameter constant for <b>title</b>
3626   * <p>
3627   * Description: <b>Human Readable name/title</b><br>
3628   * Type: <b>string</b><br>
3629   * Path: <b>Composition.title</b><br>
3630   * </p>
3631   */
3632  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
3633
3634 /**
3635   * Search parameter: <b>attester</b>
3636   * <p>
3637   * Description: <b>Who attested the composition</b><br>
3638   * Type: <b>reference</b><br>
3639   * Path: <b>Composition.attester.party</b><br>
3640   * </p>
3641   */
3642  @SearchParamDefinition(name="attester", path="Composition.attester.party", description="Who attested the composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Patient.class, Practitioner.class } )
3643  public static final String SP_ATTESTER = "attester";
3644 /**
3645   * <b>Fluent Client</b> search parameter constant for <b>attester</b>
3646   * <p>
3647   * Description: <b>Who attested the composition</b><br>
3648   * Type: <b>reference</b><br>
3649   * Path: <b>Composition.attester.party</b><br>
3650   * </p>
3651   */
3652  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ATTESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ATTESTER);
3653
3654/**
3655   * Constant for fluent queries to be used to add include statements. Specifies
3656   * the path value of "<b>Composition:attester</b>".
3657   */
3658  public static final ca.uhn.fhir.model.api.Include INCLUDE_ATTESTER = new ca.uhn.fhir.model.api.Include("Composition:attester").toLocked();
3659
3660 /**
3661   * Search parameter: <b>entry</b>
3662   * <p>
3663   * Description: <b>A reference to data that supports this section</b><br>
3664   * Type: <b>reference</b><br>
3665   * Path: <b>Composition.section.entry</b><br>
3666   * </p>
3667   */
3668  @SearchParamDefinition(name="entry", path="Composition.section.entry", description="A reference to data that supports this section", type="reference" )
3669  public static final String SP_ENTRY = "entry";
3670 /**
3671   * <b>Fluent Client</b> search parameter constant for <b>entry</b>
3672   * <p>
3673   * Description: <b>A reference to data that supports this section</b><br>
3674   * Type: <b>reference</b><br>
3675   * Path: <b>Composition.section.entry</b><br>
3676   * </p>
3677   */
3678  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTRY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTRY);
3679
3680/**
3681   * Constant for fluent queries to be used to add include statements. Specifies
3682   * the path value of "<b>Composition:entry</b>".
3683   */
3684  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTRY = new ca.uhn.fhir.model.api.Include("Composition:entry").toLocked();
3685
3686 /**
3687   * Search parameter: <b>related-ref</b>
3688   * <p>
3689   * Description: <b>Target of the relationship</b><br>
3690   * Type: <b>reference</b><br>
3691   * Path: <b>Composition.relatesTo.targetReference</b><br>
3692   * </p>
3693   */
3694  @SearchParamDefinition(name="related-ref", path="Composition.relatesTo.target.as(Reference)", description="Target of the relationship", type="reference", target={Composition.class } )
3695  public static final String SP_RELATED_REF = "related-ref";
3696 /**
3697   * <b>Fluent Client</b> search parameter constant for <b>related-ref</b>
3698   * <p>
3699   * Description: <b>Target of the relationship</b><br>
3700   * Type: <b>reference</b><br>
3701   * Path: <b>Composition.relatesTo.targetReference</b><br>
3702   * </p>
3703   */
3704  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATED_REF);
3705
3706/**
3707   * Constant for fluent queries to be used to add include statements. Specifies
3708   * the path value of "<b>Composition:related-ref</b>".
3709   */
3710  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED_REF = new ca.uhn.fhir.model.api.Include("Composition:related-ref").toLocked();
3711
3712 /**
3713   * Search parameter: <b>patient</b>
3714   * <p>
3715   * Description: <b>Who and/or what the composition is about</b><br>
3716   * Type: <b>reference</b><br>
3717   * Path: <b>Composition.subject</b><br>
3718   * </p>
3719   */
3720  @SearchParamDefinition(name="patient", path="Composition.subject", description="Who and/or what the composition is about", type="reference", target={Patient.class } )
3721  public static final String SP_PATIENT = "patient";
3722 /**
3723   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3724   * <p>
3725   * Description: <b>Who and/or what the composition is about</b><br>
3726   * Type: <b>reference</b><br>
3727   * Path: <b>Composition.subject</b><br>
3728   * </p>
3729   */
3730  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3731
3732/**
3733   * Constant for fluent queries to be used to add include statements. Specifies
3734   * the path value of "<b>Composition:patient</b>".
3735   */
3736  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Composition:patient").toLocked();
3737
3738 /**
3739   * Search parameter: <b>context</b>
3740   * <p>
3741   * Description: <b>Code(s) that apply to the event being documented</b><br>
3742   * Type: <b>token</b><br>
3743   * Path: <b>Composition.event.code</b><br>
3744   * </p>
3745   */
3746  @SearchParamDefinition(name="context", path="Composition.event.code", description="Code(s) that apply to the event being documented", type="token" )
3747  public static final String SP_CONTEXT = "context";
3748 /**
3749   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3750   * <p>
3751   * Description: <b>Code(s) that apply to the event being documented</b><br>
3752   * Type: <b>token</b><br>
3753   * Path: <b>Composition.event.code</b><br>
3754   * </p>
3755   */
3756  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
3757
3758 /**
3759   * Search parameter: <b>class</b>
3760   * <p>
3761   * Description: <b>Categorization of Composition</b><br>
3762   * Type: <b>token</b><br>
3763   * Path: <b>Composition.class</b><br>
3764   * </p>
3765   */
3766  @SearchParamDefinition(name="class", path="Composition.class", description="Categorization of Composition", type="token" )
3767  public static final String SP_CLASS = "class";
3768 /**
3769   * <b>Fluent Client</b> search parameter constant for <b>class</b>
3770   * <p>
3771   * Description: <b>Categorization of Composition</b><br>
3772   * Type: <b>token</b><br>
3773   * Path: <b>Composition.class</b><br>
3774   * </p>
3775   */
3776  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS);
3777
3778 /**
3779   * Search parameter: <b>status</b>
3780   * <p>
3781   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3782   * Type: <b>token</b><br>
3783   * Path: <b>Composition.status</b><br>
3784   * </p>
3785   */
3786  @SearchParamDefinition(name="status", path="Composition.status", description="preliminary | final | amended | entered-in-error", type="token" )
3787  public static final String SP_STATUS = "status";
3788 /**
3789   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3790   * <p>
3791   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3792   * Type: <b>token</b><br>
3793   * Path: <b>Composition.status</b><br>
3794   * </p>
3795   */
3796  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3797
3798
3799}