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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.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/Profile/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://hl7.org/fhir/v3/Confidentiality";
238            case L: return "http://hl7.org/fhir/v3/Confidentiality";
239            case M: return "http://hl7.org/fhir/v3/Confidentiality";
240            case N: return "http://hl7.org/fhir/v3/Confidentiality";
241            case R: return "http://hl7.org/fhir/v3/Confidentiality";
242            case V: return "http://hl7.org/fhir/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=true)
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=true)
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=true)
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=true)
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=true)
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://hl7.org/fhir/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=true)
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=true, summary=true)
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 = "class", type = {CodeableConcept.class}, order=3, min=0, max=1, 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/doc-classcodes")
2326    protected CodeableConcept class_;
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=true, 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://hl7.org/fhir/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=true)
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=true)
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 = -1422555114L;
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 #class_} (A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.)
2541     */
2542    public CodeableConcept getClass_() { 
2543      if (this.class_ == null)
2544        if (Configuration.errorOnAutoCreate())
2545          throw new Error("Attempt to auto-create Composition.class_");
2546        else if (Configuration.doAutoCreate())
2547          this.class_ = new CodeableConcept(); // cc
2548      return this.class_;
2549    }
2550
2551    public boolean hasClass_() { 
2552      return this.class_ != null && !this.class_.isEmpty();
2553    }
2554
2555    /**
2556     * @param value {@link #class_} (A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.)
2557     */
2558    public Composition setClass_(CodeableConcept value) { 
2559      this.class_ = value;
2560      return this;
2561    }
2562
2563    /**
2564     * @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).)
2565     */
2566    public Reference getSubject() { 
2567      if (this.subject == null)
2568        if (Configuration.errorOnAutoCreate())
2569          throw new Error("Attempt to auto-create Composition.subject");
2570        else if (Configuration.doAutoCreate())
2571          this.subject = new Reference(); // cc
2572      return this.subject;
2573    }
2574
2575    public boolean hasSubject() { 
2576      return this.subject != null && !this.subject.isEmpty();
2577    }
2578
2579    /**
2580     * @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).)
2581     */
2582    public Composition setSubject(Reference value) { 
2583      this.subject = value;
2584      return this;
2585    }
2586
2587    /**
2588     * @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).)
2589     */
2590    public Resource getSubjectTarget() { 
2591      return this.subjectTarget;
2592    }
2593
2594    /**
2595     * @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).)
2596     */
2597    public Composition setSubjectTarget(Resource value) { 
2598      this.subjectTarget = value;
2599      return this;
2600    }
2601
2602    /**
2603     * @return {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2604     */
2605    public Reference getEncounter() { 
2606      if (this.encounter == null)
2607        if (Configuration.errorOnAutoCreate())
2608          throw new Error("Attempt to auto-create Composition.encounter");
2609        else if (Configuration.doAutoCreate())
2610          this.encounter = new Reference(); // cc
2611      return this.encounter;
2612    }
2613
2614    public boolean hasEncounter() { 
2615      return this.encounter != null && !this.encounter.isEmpty();
2616    }
2617
2618    /**
2619     * @param value {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2620     */
2621    public Composition setEncounter(Reference value) { 
2622      this.encounter = value;
2623      return this;
2624    }
2625
2626    /**
2627     * @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.)
2628     */
2629    public Encounter getEncounterTarget() { 
2630      if (this.encounterTarget == null)
2631        if (Configuration.errorOnAutoCreate())
2632          throw new Error("Attempt to auto-create Composition.encounter");
2633        else if (Configuration.doAutoCreate())
2634          this.encounterTarget = new Encounter(); // aa
2635      return this.encounterTarget;
2636    }
2637
2638    /**
2639     * @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.)
2640     */
2641    public Composition setEncounterTarget(Encounter value) { 
2642      this.encounterTarget = value;
2643      return this;
2644    }
2645
2646    /**
2647     * @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
2648     */
2649    public DateTimeType getDateElement() { 
2650      if (this.date == null)
2651        if (Configuration.errorOnAutoCreate())
2652          throw new Error("Attempt to auto-create Composition.date");
2653        else if (Configuration.doAutoCreate())
2654          this.date = new DateTimeType(); // bb
2655      return this.date;
2656    }
2657
2658    public boolean hasDateElement() { 
2659      return this.date != null && !this.date.isEmpty();
2660    }
2661
2662    public boolean hasDate() { 
2663      return this.date != null && !this.date.isEmpty();
2664    }
2665
2666    /**
2667     * @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
2668     */
2669    public Composition setDateElement(DateTimeType value) { 
2670      this.date = value;
2671      return this;
2672    }
2673
2674    /**
2675     * @return The composition editing time, when the composition was last logically changed by the author.
2676     */
2677    public Date getDate() { 
2678      return this.date == null ? null : this.date.getValue();
2679    }
2680
2681    /**
2682     * @param value The composition editing time, when the composition was last logically changed by the author.
2683     */
2684    public Composition setDate(Date value) { 
2685        if (this.date == null)
2686          this.date = new DateTimeType();
2687        this.date.setValue(value);
2688      return this;
2689    }
2690
2691    /**
2692     * @return {@link #author} (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
2693     */
2694    public List<Reference> getAuthor() { 
2695      if (this.author == null)
2696        this.author = new ArrayList<Reference>();
2697      return this.author;
2698    }
2699
2700    /**
2701     * @return Returns a reference to <code>this</code> for easy method chaining
2702     */
2703    public Composition setAuthor(List<Reference> theAuthor) { 
2704      this.author = theAuthor;
2705      return this;
2706    }
2707
2708    public boolean hasAuthor() { 
2709      if (this.author == null)
2710        return false;
2711      for (Reference item : this.author)
2712        if (!item.isEmpty())
2713          return true;
2714      return false;
2715    }
2716
2717    public Reference addAuthor() { //3
2718      Reference t = new Reference();
2719      if (this.author == null)
2720        this.author = new ArrayList<Reference>();
2721      this.author.add(t);
2722      return t;
2723    }
2724
2725    public Composition addAuthor(Reference t) { //3
2726      if (t == null)
2727        return this;
2728      if (this.author == null)
2729        this.author = new ArrayList<Reference>();
2730      this.author.add(t);
2731      return this;
2732    }
2733
2734    /**
2735     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
2736     */
2737    public Reference getAuthorFirstRep() { 
2738      if (getAuthor().isEmpty()) {
2739        addAuthor();
2740      }
2741      return getAuthor().get(0);
2742    }
2743
2744    /**
2745     * @deprecated Use Reference#setResource(IBaseResource) instead
2746     */
2747    @Deprecated
2748    public List<Resource> getAuthorTarget() { 
2749      if (this.authorTarget == null)
2750        this.authorTarget = new ArrayList<Resource>();
2751      return this.authorTarget;
2752    }
2753
2754    /**
2755     * @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
2756     */
2757    public StringType getTitleElement() { 
2758      if (this.title == null)
2759        if (Configuration.errorOnAutoCreate())
2760          throw new Error("Attempt to auto-create Composition.title");
2761        else if (Configuration.doAutoCreate())
2762          this.title = new StringType(); // bb
2763      return this.title;
2764    }
2765
2766    public boolean hasTitleElement() { 
2767      return this.title != null && !this.title.isEmpty();
2768    }
2769
2770    public boolean hasTitle() { 
2771      return this.title != null && !this.title.isEmpty();
2772    }
2773
2774    /**
2775     * @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
2776     */
2777    public Composition setTitleElement(StringType value) { 
2778      this.title = value;
2779      return this;
2780    }
2781
2782    /**
2783     * @return Official human-readable label for the composition.
2784     */
2785    public String getTitle() { 
2786      return this.title == null ? null : this.title.getValue();
2787    }
2788
2789    /**
2790     * @param value Official human-readable label for the composition.
2791     */
2792    public Composition setTitle(String value) { 
2793        if (this.title == null)
2794          this.title = new StringType();
2795        this.title.setValue(value);
2796      return this;
2797    }
2798
2799    /**
2800     * @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
2801     */
2802    public Enumeration<DocumentConfidentiality> getConfidentialityElement() { 
2803      if (this.confidentiality == null)
2804        if (Configuration.errorOnAutoCreate())
2805          throw new Error("Attempt to auto-create Composition.confidentiality");
2806        else if (Configuration.doAutoCreate())
2807          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory()); // bb
2808      return this.confidentiality;
2809    }
2810
2811    public boolean hasConfidentialityElement() { 
2812      return this.confidentiality != null && !this.confidentiality.isEmpty();
2813    }
2814
2815    public boolean hasConfidentiality() { 
2816      return this.confidentiality != null && !this.confidentiality.isEmpty();
2817    }
2818
2819    /**
2820     * @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
2821     */
2822    public Composition setConfidentialityElement(Enumeration<DocumentConfidentiality> value) { 
2823      this.confidentiality = value;
2824      return this;
2825    }
2826
2827    /**
2828     * @return The code specifying the level of confidentiality of the Composition.
2829     */
2830    public DocumentConfidentiality getConfidentiality() { 
2831      return this.confidentiality == null ? null : this.confidentiality.getValue();
2832    }
2833
2834    /**
2835     * @param value The code specifying the level of confidentiality of the Composition.
2836     */
2837    public Composition setConfidentiality(DocumentConfidentiality value) { 
2838      if (value == null)
2839        this.confidentiality = null;
2840      else {
2841        if (this.confidentiality == null)
2842          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory());
2843        this.confidentiality.setValue(value);
2844      }
2845      return this;
2846    }
2847
2848    /**
2849     * @return {@link #attester} (A participant who has attested to the accuracy of the composition/document.)
2850     */
2851    public List<CompositionAttesterComponent> getAttester() { 
2852      if (this.attester == null)
2853        this.attester = new ArrayList<CompositionAttesterComponent>();
2854      return this.attester;
2855    }
2856
2857    /**
2858     * @return Returns a reference to <code>this</code> for easy method chaining
2859     */
2860    public Composition setAttester(List<CompositionAttesterComponent> theAttester) { 
2861      this.attester = theAttester;
2862      return this;
2863    }
2864
2865    public boolean hasAttester() { 
2866      if (this.attester == null)
2867        return false;
2868      for (CompositionAttesterComponent item : this.attester)
2869        if (!item.isEmpty())
2870          return true;
2871      return false;
2872    }
2873
2874    public CompositionAttesterComponent addAttester() { //3
2875      CompositionAttesterComponent t = new CompositionAttesterComponent();
2876      if (this.attester == null)
2877        this.attester = new ArrayList<CompositionAttesterComponent>();
2878      this.attester.add(t);
2879      return t;
2880    }
2881
2882    public Composition addAttester(CompositionAttesterComponent t) { //3
2883      if (t == null)
2884        return this;
2885      if (this.attester == null)
2886        this.attester = new ArrayList<CompositionAttesterComponent>();
2887      this.attester.add(t);
2888      return this;
2889    }
2890
2891    /**
2892     * @return The first repetition of repeating field {@link #attester}, creating it if it does not already exist
2893     */
2894    public CompositionAttesterComponent getAttesterFirstRep() { 
2895      if (getAttester().isEmpty()) {
2896        addAttester();
2897      }
2898      return getAttester().get(0);
2899    }
2900
2901    /**
2902     * @return {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2903     */
2904    public Reference getCustodian() { 
2905      if (this.custodian == null)
2906        if (Configuration.errorOnAutoCreate())
2907          throw new Error("Attempt to auto-create Composition.custodian");
2908        else if (Configuration.doAutoCreate())
2909          this.custodian = new Reference(); // cc
2910      return this.custodian;
2911    }
2912
2913    public boolean hasCustodian() { 
2914      return this.custodian != null && !this.custodian.isEmpty();
2915    }
2916
2917    /**
2918     * @param value {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2919     */
2920    public Composition setCustodian(Reference value) { 
2921      this.custodian = value;
2922      return this;
2923    }
2924
2925    /**
2926     * @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.)
2927     */
2928    public Organization getCustodianTarget() { 
2929      if (this.custodianTarget == null)
2930        if (Configuration.errorOnAutoCreate())
2931          throw new Error("Attempt to auto-create Composition.custodian");
2932        else if (Configuration.doAutoCreate())
2933          this.custodianTarget = new Organization(); // aa
2934      return this.custodianTarget;
2935    }
2936
2937    /**
2938     * @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.)
2939     */
2940    public Composition setCustodianTarget(Organization value) { 
2941      this.custodianTarget = value;
2942      return this;
2943    }
2944
2945    /**
2946     * @return {@link #relatesTo} (Relationships that this composition has with other compositions or documents that already exist.)
2947     */
2948    public List<CompositionRelatesToComponent> getRelatesTo() { 
2949      if (this.relatesTo == null)
2950        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2951      return this.relatesTo;
2952    }
2953
2954    /**
2955     * @return Returns a reference to <code>this</code> for easy method chaining
2956     */
2957    public Composition setRelatesTo(List<CompositionRelatesToComponent> theRelatesTo) { 
2958      this.relatesTo = theRelatesTo;
2959      return this;
2960    }
2961
2962    public boolean hasRelatesTo() { 
2963      if (this.relatesTo == null)
2964        return false;
2965      for (CompositionRelatesToComponent item : this.relatesTo)
2966        if (!item.isEmpty())
2967          return true;
2968      return false;
2969    }
2970
2971    public CompositionRelatesToComponent addRelatesTo() { //3
2972      CompositionRelatesToComponent t = new CompositionRelatesToComponent();
2973      if (this.relatesTo == null)
2974        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2975      this.relatesTo.add(t);
2976      return t;
2977    }
2978
2979    public Composition addRelatesTo(CompositionRelatesToComponent t) { //3
2980      if (t == null)
2981        return this;
2982      if (this.relatesTo == null)
2983        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2984      this.relatesTo.add(t);
2985      return this;
2986    }
2987
2988    /**
2989     * @return The first repetition of repeating field {@link #relatesTo}, creating it if it does not already exist
2990     */
2991    public CompositionRelatesToComponent getRelatesToFirstRep() { 
2992      if (getRelatesTo().isEmpty()) {
2993        addRelatesTo();
2994      }
2995      return getRelatesTo().get(0);
2996    }
2997
2998    /**
2999     * @return {@link #event} (The clinical service, such as a colonoscopy or an appendectomy, being documented.)
3000     */
3001    public List<CompositionEventComponent> getEvent() { 
3002      if (this.event == null)
3003        this.event = new ArrayList<CompositionEventComponent>();
3004      return this.event;
3005    }
3006
3007    /**
3008     * @return Returns a reference to <code>this</code> for easy method chaining
3009     */
3010    public Composition setEvent(List<CompositionEventComponent> theEvent) { 
3011      this.event = theEvent;
3012      return this;
3013    }
3014
3015    public boolean hasEvent() { 
3016      if (this.event == null)
3017        return false;
3018      for (CompositionEventComponent item : this.event)
3019        if (!item.isEmpty())
3020          return true;
3021      return false;
3022    }
3023
3024    public CompositionEventComponent addEvent() { //3
3025      CompositionEventComponent t = new CompositionEventComponent();
3026      if (this.event == null)
3027        this.event = new ArrayList<CompositionEventComponent>();
3028      this.event.add(t);
3029      return t;
3030    }
3031
3032    public Composition addEvent(CompositionEventComponent t) { //3
3033      if (t == null)
3034        return this;
3035      if (this.event == null)
3036        this.event = new ArrayList<CompositionEventComponent>();
3037      this.event.add(t);
3038      return this;
3039    }
3040
3041    /**
3042     * @return The first repetition of repeating field {@link #event}, creating it if it does not already exist
3043     */
3044    public CompositionEventComponent getEventFirstRep() { 
3045      if (getEvent().isEmpty()) {
3046        addEvent();
3047      }
3048      return getEvent().get(0);
3049    }
3050
3051    /**
3052     * @return {@link #section} (The root of the sections that make up the composition.)
3053     */
3054    public List<SectionComponent> getSection() { 
3055      if (this.section == null)
3056        this.section = new ArrayList<SectionComponent>();
3057      return this.section;
3058    }
3059
3060    /**
3061     * @return Returns a reference to <code>this</code> for easy method chaining
3062     */
3063    public Composition setSection(List<SectionComponent> theSection) { 
3064      this.section = theSection;
3065      return this;
3066    }
3067
3068    public boolean hasSection() { 
3069      if (this.section == null)
3070        return false;
3071      for (SectionComponent item : this.section)
3072        if (!item.isEmpty())
3073          return true;
3074      return false;
3075    }
3076
3077    public SectionComponent addSection() { //3
3078      SectionComponent t = new SectionComponent();
3079      if (this.section == null)
3080        this.section = new ArrayList<SectionComponent>();
3081      this.section.add(t);
3082      return t;
3083    }
3084
3085    public Composition addSection(SectionComponent t) { //3
3086      if (t == null)
3087        return this;
3088      if (this.section == null)
3089        this.section = new ArrayList<SectionComponent>();
3090      this.section.add(t);
3091      return this;
3092    }
3093
3094    /**
3095     * @return The first repetition of repeating field {@link #section}, creating it if it does not already exist
3096     */
3097    public SectionComponent getSectionFirstRep() { 
3098      if (getSection().isEmpty()) {
3099        addSection();
3100      }
3101      return getSection().get(0);
3102    }
3103
3104      protected void listChildren(List<Property> children) {
3105        super.listChildren(children);
3106        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));
3107        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));
3108        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));
3109        children.add(new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_));
3110        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));
3111        children.add(new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care this documentation is associated with.", 0, 1, encounter));
3112        children.add(new Property("date", "dateTime", "The composition editing time, when the composition was last logically changed by the author.", 0, 1, date));
3113        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));
3114        children.add(new Property("title", "string", "Official human-readable label for the composition.", 0, 1, title));
3115        children.add(new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, 1, confidentiality));
3116        children.add(new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 0, java.lang.Integer.MAX_VALUE, attester));
3117        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));
3118        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));
3119        children.add(new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 0, java.lang.Integer.MAX_VALUE, event));
3120        children.add(new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section));
3121      }
3122
3123      @Override
3124      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3125        switch (_hash) {
3126        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);
3127        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);
3128        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);
3129        case 94742904: /*class*/  return new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, 1, class_);
3130        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);
3131        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);
3132        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);
3133        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);
3134        case 110371416: /*title*/  return new Property("title", "string", "Official human-readable label for the composition.", 0, 1, title);
3135        case -1923018202: /*confidentiality*/  return new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, 1, confidentiality);
3136        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);
3137        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);
3138        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);
3139        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);
3140        case 1970241253: /*section*/  return new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section);
3141        default: return super.getNamedProperty(_hash, _name, _checkValid);
3142        }
3143
3144      }
3145
3146      @Override
3147      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3148        switch (hash) {
3149        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3150        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CompositionStatus>
3151        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3152        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept
3153        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3154        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3155        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3156        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
3157        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3158        case -1923018202: /*confidentiality*/ return this.confidentiality == null ? new Base[0] : new Base[] {this.confidentiality}; // Enumeration<DocumentConfidentiality>
3159        case 542920370: /*attester*/ return this.attester == null ? new Base[0] : this.attester.toArray(new Base[this.attester.size()]); // CompositionAttesterComponent
3160        case 1611297262: /*custodian*/ return this.custodian == null ? new Base[0] : new Base[] {this.custodian}; // Reference
3161        case -7765931: /*relatesTo*/ return this.relatesTo == null ? new Base[0] : this.relatesTo.toArray(new Base[this.relatesTo.size()]); // CompositionRelatesToComponent
3162        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CompositionEventComponent
3163        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
3164        default: return super.getProperty(hash, name, checkValid);
3165        }
3166
3167      }
3168
3169      @Override
3170      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3171        switch (hash) {
3172        case -1618432855: // identifier
3173          this.identifier = castToIdentifier(value); // Identifier
3174          return value;
3175        case -892481550: // status
3176          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3177          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3178          return value;
3179        case 3575610: // type
3180          this.type = castToCodeableConcept(value); // CodeableConcept
3181          return value;
3182        case 94742904: // class
3183          this.class_ = castToCodeableConcept(value); // CodeableConcept
3184          return value;
3185        case -1867885268: // subject
3186          this.subject = castToReference(value); // Reference
3187          return value;
3188        case 1524132147: // encounter
3189          this.encounter = castToReference(value); // Reference
3190          return value;
3191        case 3076014: // date
3192          this.date = castToDateTime(value); // DateTimeType
3193          return value;
3194        case -1406328437: // author
3195          this.getAuthor().add(castToReference(value)); // Reference
3196          return value;
3197        case 110371416: // title
3198          this.title = castToString(value); // StringType
3199          return value;
3200        case -1923018202: // confidentiality
3201          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3202          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3203          return value;
3204        case 542920370: // attester
3205          this.getAttester().add((CompositionAttesterComponent) value); // CompositionAttesterComponent
3206          return value;
3207        case 1611297262: // custodian
3208          this.custodian = castToReference(value); // Reference
3209          return value;
3210        case -7765931: // relatesTo
3211          this.getRelatesTo().add((CompositionRelatesToComponent) value); // CompositionRelatesToComponent
3212          return value;
3213        case 96891546: // event
3214          this.getEvent().add((CompositionEventComponent) value); // CompositionEventComponent
3215          return value;
3216        case 1970241253: // section
3217          this.getSection().add((SectionComponent) value); // SectionComponent
3218          return value;
3219        default: return super.setProperty(hash, name, value);
3220        }
3221
3222      }
3223
3224      @Override
3225      public Base setProperty(String name, Base value) throws FHIRException {
3226        if (name.equals("identifier")) {
3227          this.identifier = castToIdentifier(value); // Identifier
3228        } else if (name.equals("status")) {
3229          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3230          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3231        } else if (name.equals("type")) {
3232          this.type = castToCodeableConcept(value); // CodeableConcept
3233        } else if (name.equals("class")) {
3234          this.class_ = castToCodeableConcept(value); // CodeableConcept
3235        } else if (name.equals("subject")) {
3236          this.subject = castToReference(value); // Reference
3237        } else if (name.equals("encounter")) {
3238          this.encounter = castToReference(value); // Reference
3239        } else if (name.equals("date")) {
3240          this.date = castToDateTime(value); // DateTimeType
3241        } else if (name.equals("author")) {
3242          this.getAuthor().add(castToReference(value));
3243        } else if (name.equals("title")) {
3244          this.title = castToString(value); // StringType
3245        } else if (name.equals("confidentiality")) {
3246          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3247          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3248        } else if (name.equals("attester")) {
3249          this.getAttester().add((CompositionAttesterComponent) value);
3250        } else if (name.equals("custodian")) {
3251          this.custodian = castToReference(value); // Reference
3252        } else if (name.equals("relatesTo")) {
3253          this.getRelatesTo().add((CompositionRelatesToComponent) value);
3254        } else if (name.equals("event")) {
3255          this.getEvent().add((CompositionEventComponent) value);
3256        } else if (name.equals("section")) {
3257          this.getSection().add((SectionComponent) value);
3258        } else
3259          return super.setProperty(name, value);
3260        return value;
3261      }
3262
3263      @Override
3264      public Base makeProperty(int hash, String name) throws FHIRException {
3265        switch (hash) {
3266        case -1618432855:  return getIdentifier(); 
3267        case -892481550:  return getStatusElement();
3268        case 3575610:  return getType(); 
3269        case 94742904:  return getClass_(); 
3270        case -1867885268:  return getSubject(); 
3271        case 1524132147:  return getEncounter(); 
3272        case 3076014:  return getDateElement();
3273        case -1406328437:  return addAuthor(); 
3274        case 110371416:  return getTitleElement();
3275        case -1923018202:  return getConfidentialityElement();
3276        case 542920370:  return addAttester(); 
3277        case 1611297262:  return getCustodian(); 
3278        case -7765931:  return addRelatesTo(); 
3279        case 96891546:  return addEvent(); 
3280        case 1970241253:  return addSection(); 
3281        default: return super.makeProperty(hash, name);
3282        }
3283
3284      }
3285
3286      @Override
3287      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3288        switch (hash) {
3289        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3290        case -892481550: /*status*/ return new String[] {"code"};
3291        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3292        case 94742904: /*class*/ return new String[] {"CodeableConcept"};
3293        case -1867885268: /*subject*/ return new String[] {"Reference"};
3294        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3295        case 3076014: /*date*/ return new String[] {"dateTime"};
3296        case -1406328437: /*author*/ return new String[] {"Reference"};
3297        case 110371416: /*title*/ return new String[] {"string"};
3298        case -1923018202: /*confidentiality*/ return new String[] {"code"};
3299        case 542920370: /*attester*/ return new String[] {};
3300        case 1611297262: /*custodian*/ return new String[] {"Reference"};
3301        case -7765931: /*relatesTo*/ return new String[] {};
3302        case 96891546: /*event*/ return new String[] {};
3303        case 1970241253: /*section*/ return new String[] {};
3304        default: return super.getTypesForProperty(hash, name);
3305        }
3306
3307      }
3308
3309      @Override
3310      public Base addChild(String name) throws FHIRException {
3311        if (name.equals("identifier")) {
3312          this.identifier = new Identifier();
3313          return this.identifier;
3314        }
3315        else if (name.equals("status")) {
3316          throw new FHIRException("Cannot call addChild on a primitive type Composition.status");
3317        }
3318        else if (name.equals("type")) {
3319          this.type = new CodeableConcept();
3320          return this.type;
3321        }
3322        else if (name.equals("class")) {
3323          this.class_ = new CodeableConcept();
3324          return this.class_;
3325        }
3326        else if (name.equals("subject")) {
3327          this.subject = new Reference();
3328          return this.subject;
3329        }
3330        else if (name.equals("encounter")) {
3331          this.encounter = new Reference();
3332          return this.encounter;
3333        }
3334        else if (name.equals("date")) {
3335          throw new FHIRException("Cannot call addChild on a primitive type Composition.date");
3336        }
3337        else if (name.equals("author")) {
3338          return addAuthor();
3339        }
3340        else if (name.equals("title")) {
3341          throw new FHIRException("Cannot call addChild on a primitive type Composition.title");
3342        }
3343        else if (name.equals("confidentiality")) {
3344          throw new FHIRException("Cannot call addChild on a primitive type Composition.confidentiality");
3345        }
3346        else if (name.equals("attester")) {
3347          return addAttester();
3348        }
3349        else if (name.equals("custodian")) {
3350          this.custodian = new Reference();
3351          return this.custodian;
3352        }
3353        else if (name.equals("relatesTo")) {
3354          return addRelatesTo();
3355        }
3356        else if (name.equals("event")) {
3357          return addEvent();
3358        }
3359        else if (name.equals("section")) {
3360          return addSection();
3361        }
3362        else
3363          return super.addChild(name);
3364      }
3365
3366  public String fhirType() {
3367    return "Composition";
3368
3369  }
3370
3371      public Composition copy() {
3372        Composition dst = new Composition();
3373        copyValues(dst);
3374        dst.identifier = identifier == null ? null : identifier.copy();
3375        dst.status = status == null ? null : status.copy();
3376        dst.type = type == null ? null : type.copy();
3377        dst.class_ = class_ == null ? null : class_.copy();
3378        dst.subject = subject == null ? null : subject.copy();
3379        dst.encounter = encounter == null ? null : encounter.copy();
3380        dst.date = date == null ? null : date.copy();
3381        if (author != null) {
3382          dst.author = new ArrayList<Reference>();
3383          for (Reference i : author)
3384            dst.author.add(i.copy());
3385        };
3386        dst.title = title == null ? null : title.copy();
3387        dst.confidentiality = confidentiality == null ? null : confidentiality.copy();
3388        if (attester != null) {
3389          dst.attester = new ArrayList<CompositionAttesterComponent>();
3390          for (CompositionAttesterComponent i : attester)
3391            dst.attester.add(i.copy());
3392        };
3393        dst.custodian = custodian == null ? null : custodian.copy();
3394        if (relatesTo != null) {
3395          dst.relatesTo = new ArrayList<CompositionRelatesToComponent>();
3396          for (CompositionRelatesToComponent i : relatesTo)
3397            dst.relatesTo.add(i.copy());
3398        };
3399        if (event != null) {
3400          dst.event = new ArrayList<CompositionEventComponent>();
3401          for (CompositionEventComponent i : event)
3402            dst.event.add(i.copy());
3403        };
3404        if (section != null) {
3405          dst.section = new ArrayList<SectionComponent>();
3406          for (SectionComponent i : section)
3407            dst.section.add(i.copy());
3408        };
3409        return dst;
3410      }
3411
3412      protected Composition typedCopy() {
3413        return copy();
3414      }
3415
3416      @Override
3417      public boolean equalsDeep(Base other_) {
3418        if (!super.equalsDeep(other_))
3419          return false;
3420        if (!(other_ instanceof Composition))
3421          return false;
3422        Composition o = (Composition) other_;
3423        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
3424           && compareDeep(class_, o.class_, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
3425           && compareDeep(date, o.date, true) && compareDeep(author, o.author, true) && compareDeep(title, o.title, true)
3426           && compareDeep(confidentiality, o.confidentiality, true) && compareDeep(attester, o.attester, true)
3427           && compareDeep(custodian, o.custodian, true) && compareDeep(relatesTo, o.relatesTo, true) && compareDeep(event, o.event, true)
3428           && compareDeep(section, o.section, true);
3429      }
3430
3431      @Override
3432      public boolean equalsShallow(Base other_) {
3433        if (!super.equalsShallow(other_))
3434          return false;
3435        if (!(other_ instanceof Composition))
3436          return false;
3437        Composition o = (Composition) other_;
3438        return compareValues(status, o.status, true) && compareValues(date, o.date, true) && compareValues(title, o.title, true)
3439           && compareValues(confidentiality, o.confidentiality, true);
3440      }
3441
3442      public boolean isEmpty() {
3443        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
3444          , class_, subject, encounter, date, author, title, confidentiality, attester
3445          , custodian, relatesTo, event, section);
3446      }
3447
3448  @Override
3449  public ResourceType getResourceType() {
3450    return ResourceType.Composition;
3451   }
3452
3453 /**
3454   * Search parameter: <b>date</b>
3455   * <p>
3456   * Description: <b>Composition editing time</b><br>
3457   * Type: <b>date</b><br>
3458   * Path: <b>Composition.date</b><br>
3459   * </p>
3460   */
3461  @SearchParamDefinition(name="date", path="Composition.date", description="Composition editing time", type="date" )
3462  public static final String SP_DATE = "date";
3463 /**
3464   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3465   * <p>
3466   * Description: <b>Composition editing time</b><br>
3467   * Type: <b>date</b><br>
3468   * Path: <b>Composition.date</b><br>
3469   * </p>
3470   */
3471  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3472
3473 /**
3474   * Search parameter: <b>identifier</b>
3475   * <p>
3476   * Description: <b>Version-independent identifier for the Composition</b><br>
3477   * Type: <b>token</b><br>
3478   * Path: <b>Composition.identifier</b><br>
3479   * </p>
3480   */
3481  @SearchParamDefinition(name="identifier", path="Composition.identifier", description="Version-independent identifier for the Composition", type="token" )
3482  public static final String SP_IDENTIFIER = "identifier";
3483 /**
3484   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3485   * <p>
3486   * Description: <b>Version-independent identifier for the Composition</b><br>
3487   * Type: <b>token</b><br>
3488   * Path: <b>Composition.identifier</b><br>
3489   * </p>
3490   */
3491  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3492
3493 /**
3494   * Search parameter: <b>period</b>
3495   * <p>
3496   * Description: <b>The period covered by the documentation</b><br>
3497   * Type: <b>date</b><br>
3498   * Path: <b>Composition.event.period</b><br>
3499   * </p>
3500   */
3501  @SearchParamDefinition(name="period", path="Composition.event.period", description="The period covered by the documentation", type="date" )
3502  public static final String SP_PERIOD = "period";
3503 /**
3504   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3505   * <p>
3506   * Description: <b>The period covered by the documentation</b><br>
3507   * Type: <b>date</b><br>
3508   * Path: <b>Composition.event.period</b><br>
3509   * </p>
3510   */
3511  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
3512
3513 /**
3514   * Search parameter: <b>related-id</b>
3515   * <p>
3516   * Description: <b>Target of the relationship</b><br>
3517   * Type: <b>token</b><br>
3518   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3519   * </p>
3520   */
3521  @SearchParamDefinition(name="related-id", path="Composition.relatesTo.target.as(Identifier)", description="Target of the relationship", type="token" )
3522  public static final String SP_RELATED_ID = "related-id";
3523 /**
3524   * <b>Fluent Client</b> search parameter constant for <b>related-id</b>
3525   * <p>
3526   * Description: <b>Target of the relationship</b><br>
3527   * Type: <b>token</b><br>
3528   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3529   * </p>
3530   */
3531  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATED_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATED_ID);
3532
3533 /**
3534   * Search parameter: <b>subject</b>
3535   * <p>
3536   * Description: <b>Who and/or what the composition is about</b><br>
3537   * Type: <b>reference</b><br>
3538   * Path: <b>Composition.subject</b><br>
3539   * </p>
3540   */
3541  @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") } )
3542  public static final String SP_SUBJECT = "subject";
3543 /**
3544   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3545   * <p>
3546   * Description: <b>Who and/or what the composition is about</b><br>
3547   * Type: <b>reference</b><br>
3548   * Path: <b>Composition.subject</b><br>
3549   * </p>
3550   */
3551  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3552
3553/**
3554   * Constant for fluent queries to be used to add include statements. Specifies
3555   * the path value of "<b>Composition:subject</b>".
3556   */
3557  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Composition:subject").toLocked();
3558
3559 /**
3560   * Search parameter: <b>author</b>
3561   * <p>
3562   * Description: <b>Who and/or what authored the composition</b><br>
3563   * Type: <b>reference</b><br>
3564   * Path: <b>Composition.author</b><br>
3565   * </p>
3566   */
3567  @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 } )
3568  public static final String SP_AUTHOR = "author";
3569 /**
3570   * <b>Fluent Client</b> search parameter constant for <b>author</b>
3571   * <p>
3572   * Description: <b>Who and/or what authored the composition</b><br>
3573   * Type: <b>reference</b><br>
3574   * Path: <b>Composition.author</b><br>
3575   * </p>
3576   */
3577  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
3578
3579/**
3580   * Constant for fluent queries to be used to add include statements. Specifies
3581   * the path value of "<b>Composition:author</b>".
3582   */
3583  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Composition:author").toLocked();
3584
3585 /**
3586   * Search parameter: <b>confidentiality</b>
3587   * <p>
3588   * Description: <b>As defined by affinity domain</b><br>
3589   * Type: <b>token</b><br>
3590   * Path: <b>Composition.confidentiality</b><br>
3591   * </p>
3592   */
3593  @SearchParamDefinition(name="confidentiality", path="Composition.confidentiality", description="As defined by affinity domain", type="token" )
3594  public static final String SP_CONFIDENTIALITY = "confidentiality";
3595 /**
3596   * <b>Fluent Client</b> search parameter constant for <b>confidentiality</b>
3597   * <p>
3598   * Description: <b>As defined by affinity domain</b><br>
3599   * Type: <b>token</b><br>
3600   * Path: <b>Composition.confidentiality</b><br>
3601   * </p>
3602   */
3603  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONFIDENTIALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONFIDENTIALITY);
3604
3605 /**
3606   * Search parameter: <b>section</b>
3607   * <p>
3608   * Description: <b>Classification of section (recommended)</b><br>
3609   * Type: <b>token</b><br>
3610   * Path: <b>Composition.section.code</b><br>
3611   * </p>
3612   */
3613  @SearchParamDefinition(name="section", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
3614  public static final String SP_SECTION = "section";
3615 /**
3616   * <b>Fluent Client</b> search parameter constant for <b>section</b>
3617   * <p>
3618   * Description: <b>Classification of section (recommended)</b><br>
3619   * Type: <b>token</b><br>
3620   * Path: <b>Composition.section.code</b><br>
3621   * </p>
3622   */
3623  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECTION);
3624
3625 /**
3626   * Search parameter: <b>encounter</b>
3627   * <p>
3628   * Description: <b>Context of the Composition</b><br>
3629   * Type: <b>reference</b><br>
3630   * Path: <b>Composition.encounter</b><br>
3631   * </p>
3632   */
3633  @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 } )
3634  public static final String SP_ENCOUNTER = "encounter";
3635 /**
3636   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3637   * <p>
3638   * Description: <b>Context of the Composition</b><br>
3639   * Type: <b>reference</b><br>
3640   * Path: <b>Composition.encounter</b><br>
3641   * </p>
3642   */
3643  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3644
3645/**
3646   * Constant for fluent queries to be used to add include statements. Specifies
3647   * the path value of "<b>Composition:encounter</b>".
3648   */
3649  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Composition:encounter").toLocked();
3650
3651 /**
3652   * Search parameter: <b>type</b>
3653   * <p>
3654   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3655   * Type: <b>token</b><br>
3656   * Path: <b>Composition.type</b><br>
3657   * </p>
3658   */
3659  @SearchParamDefinition(name="type", path="Composition.type", description="Kind of composition (LOINC if possible)", type="token" )
3660  public static final String SP_TYPE = "type";
3661 /**
3662   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3663   * <p>
3664   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3665   * Type: <b>token</b><br>
3666   * Path: <b>Composition.type</b><br>
3667   * </p>
3668   */
3669  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3670
3671 /**
3672   * Search parameter: <b>title</b>
3673   * <p>
3674   * Description: <b>Human Readable name/title</b><br>
3675   * Type: <b>string</b><br>
3676   * Path: <b>Composition.title</b><br>
3677   * </p>
3678   */
3679  @SearchParamDefinition(name="title", path="Composition.title", description="Human Readable name/title", type="string" )
3680  public static final String SP_TITLE = "title";
3681 /**
3682   * <b>Fluent Client</b> search parameter constant for <b>title</b>
3683   * <p>
3684   * Description: <b>Human Readable name/title</b><br>
3685   * Type: <b>string</b><br>
3686   * Path: <b>Composition.title</b><br>
3687   * </p>
3688   */
3689  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
3690
3691 /**
3692   * Search parameter: <b>attester</b>
3693   * <p>
3694   * Description: <b>Who attested the composition</b><br>
3695   * Type: <b>reference</b><br>
3696   * Path: <b>Composition.attester.party</b><br>
3697   * </p>
3698   */
3699  @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 } )
3700  public static final String SP_ATTESTER = "attester";
3701 /**
3702   * <b>Fluent Client</b> search parameter constant for <b>attester</b>
3703   * <p>
3704   * Description: <b>Who attested the composition</b><br>
3705   * Type: <b>reference</b><br>
3706   * Path: <b>Composition.attester.party</b><br>
3707   * </p>
3708   */
3709  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ATTESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ATTESTER);
3710
3711/**
3712   * Constant for fluent queries to be used to add include statements. Specifies
3713   * the path value of "<b>Composition:attester</b>".
3714   */
3715  public static final ca.uhn.fhir.model.api.Include INCLUDE_ATTESTER = new ca.uhn.fhir.model.api.Include("Composition:attester").toLocked();
3716
3717 /**
3718   * Search parameter: <b>entry</b>
3719   * <p>
3720   * Description: <b>A reference to data that supports this section</b><br>
3721   * Type: <b>reference</b><br>
3722   * Path: <b>Composition.section.entry</b><br>
3723   * </p>
3724   */
3725  @SearchParamDefinition(name="entry", path="Composition.section.entry", description="A reference to data that supports this section", type="reference" )
3726  public static final String SP_ENTRY = "entry";
3727 /**
3728   * <b>Fluent Client</b> search parameter constant for <b>entry</b>
3729   * <p>
3730   * Description: <b>A reference to data that supports this section</b><br>
3731   * Type: <b>reference</b><br>
3732   * Path: <b>Composition.section.entry</b><br>
3733   * </p>
3734   */
3735  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTRY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTRY);
3736
3737/**
3738   * Constant for fluent queries to be used to add include statements. Specifies
3739   * the path value of "<b>Composition:entry</b>".
3740   */
3741  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTRY = new ca.uhn.fhir.model.api.Include("Composition:entry").toLocked();
3742
3743 /**
3744   * Search parameter: <b>related-ref</b>
3745   * <p>
3746   * Description: <b>Target of the relationship</b><br>
3747   * Type: <b>reference</b><br>
3748   * Path: <b>Composition.relatesTo.targetReference</b><br>
3749   * </p>
3750   */
3751  @SearchParamDefinition(name="related-ref", path="Composition.relatesTo.target.as(Reference)", description="Target of the relationship", type="reference", target={Composition.class } )
3752  public static final String SP_RELATED_REF = "related-ref";
3753 /**
3754   * <b>Fluent Client</b> search parameter constant for <b>related-ref</b>
3755   * <p>
3756   * Description: <b>Target of the relationship</b><br>
3757   * Type: <b>reference</b><br>
3758   * Path: <b>Composition.relatesTo.targetReference</b><br>
3759   * </p>
3760   */
3761  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATED_REF);
3762
3763/**
3764   * Constant for fluent queries to be used to add include statements. Specifies
3765   * the path value of "<b>Composition:related-ref</b>".
3766   */
3767  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED_REF = new ca.uhn.fhir.model.api.Include("Composition:related-ref").toLocked();
3768
3769 /**
3770   * Search parameter: <b>patient</b>
3771   * <p>
3772   * Description: <b>Who and/or what the composition is about</b><br>
3773   * Type: <b>reference</b><br>
3774   * Path: <b>Composition.subject</b><br>
3775   * </p>
3776   */
3777  @SearchParamDefinition(name="patient", path="Composition.subject", description="Who and/or what the composition is about", type="reference", target={Patient.class } )
3778  public static final String SP_PATIENT = "patient";
3779 /**
3780   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3781   * <p>
3782   * Description: <b>Who and/or what the composition is about</b><br>
3783   * Type: <b>reference</b><br>
3784   * Path: <b>Composition.subject</b><br>
3785   * </p>
3786   */
3787  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3788
3789/**
3790   * Constant for fluent queries to be used to add include statements. Specifies
3791   * the path value of "<b>Composition:patient</b>".
3792   */
3793  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Composition:patient").toLocked();
3794
3795 /**
3796   * Search parameter: <b>context</b>
3797   * <p>
3798   * Description: <b>Code(s) that apply to the event being documented</b><br>
3799   * Type: <b>token</b><br>
3800   * Path: <b>Composition.event.code</b><br>
3801   * </p>
3802   */
3803  @SearchParamDefinition(name="context", path="Composition.event.code", description="Code(s) that apply to the event being documented", type="token" )
3804  public static final String SP_CONTEXT = "context";
3805 /**
3806   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3807   * <p>
3808   * Description: <b>Code(s) that apply to the event being documented</b><br>
3809   * Type: <b>token</b><br>
3810   * Path: <b>Composition.event.code</b><br>
3811   * </p>
3812   */
3813  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
3814
3815 /**
3816   * Search parameter: <b>class</b>
3817   * <p>
3818   * Description: <b>Categorization of Composition</b><br>
3819   * Type: <b>token</b><br>
3820   * Path: <b>Composition.class</b><br>
3821   * </p>
3822   */
3823  @SearchParamDefinition(name="class", path="Composition.class", description="Categorization of Composition", type="token" )
3824  public static final String SP_CLASS = "class";
3825 /**
3826   * <b>Fluent Client</b> search parameter constant for <b>class</b>
3827   * <p>
3828   * Description: <b>Categorization of Composition</b><br>
3829   * Type: <b>token</b><br>
3830   * Path: <b>Composition.class</b><br>
3831   * </p>
3832   */
3833  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS);
3834
3835 /**
3836   * Search parameter: <b>status</b>
3837   * <p>
3838   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3839   * Type: <b>token</b><br>
3840   * Path: <b>Composition.status</b><br>
3841   * </p>
3842   */
3843  @SearchParamDefinition(name="status", path="Composition.status", description="preliminary | final | amended | entered-in-error", type="token" )
3844  public static final String SP_STATUS = "status";
3845 /**
3846   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3847   * <p>
3848   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3849   * Type: <b>token</b><br>
3850   * Path: <b>Composition.status</b><br>
3851   * </p>
3852   */
3853  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3854
3855
3856}
3857