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