001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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 document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.
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 list that indicates where changes have been made or recommended
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 list that indicates where changes have been made or recommended";
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=Child.MAX_UNLIMITED, 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 List<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, Practitioner.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 = -436604745L;
717
718    /**
719     * Constructor
720     */
721      public CompositionAttesterComponent() {
722        super();
723      }
724
725        /**
726         * @return {@link #mode} (The type of attestation the authenticator offers.)
727         */
728        public List<Enumeration<CompositionAttestationMode>> getMode() { 
729          if (this.mode == null)
730            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
731          return this.mode;
732        }
733
734        /**
735         * @return Returns a reference to <code>this</code> for easy method chaining
736         */
737        public CompositionAttesterComponent setMode(List<Enumeration<CompositionAttestationMode>> theMode) { 
738          this.mode = theMode;
739          return this;
740        }
741
742        public boolean hasMode() { 
743          if (this.mode == null)
744            return false;
745          for (Enumeration<CompositionAttestationMode> item : this.mode)
746            if (!item.isEmpty())
747              return true;
748          return false;
749        }
750
751        /**
752         * @return {@link #mode} (The type of attestation the authenticator offers.)
753         */
754        public Enumeration<CompositionAttestationMode> addModeElement() {//2 
755          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
756          if (this.mode == null)
757            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
758          this.mode.add(t);
759          return t;
760        }
761
762        /**
763         * @param value {@link #mode} (The type of attestation the authenticator offers.)
764         */
765        public CompositionAttesterComponent addMode(CompositionAttestationMode value) { //1
766          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
767          t.setValue(value);
768          if (this.mode == null)
769            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
770          this.mode.add(t);
771          return this;
772        }
773
774        /**
775         * @param value {@link #mode} (The type of attestation the authenticator offers.)
776         */
777        public boolean hasMode(CompositionAttestationMode value) { 
778          if (this.mode == null)
779            return false;
780          for (Enumeration<CompositionAttestationMode> v : this.mode)
781            if (v.getValue().equals(value)) // code
782              return true;
783          return false;
784        }
785
786        /**
787         * @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
788         */
789        public DateTimeType getTimeElement() { 
790          if (this.time == null)
791            if (Configuration.errorOnAutoCreate())
792              throw new Error("Attempt to auto-create CompositionAttesterComponent.time");
793            else if (Configuration.doAutoCreate())
794              this.time = new DateTimeType(); // bb
795          return this.time;
796        }
797
798        public boolean hasTimeElement() { 
799          return this.time != null && !this.time.isEmpty();
800        }
801
802        public boolean hasTime() { 
803          return this.time != null && !this.time.isEmpty();
804        }
805
806        /**
807         * @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
808         */
809        public CompositionAttesterComponent setTimeElement(DateTimeType value) { 
810          this.time = value;
811          return this;
812        }
813
814        /**
815         * @return When the composition was attested by the party.
816         */
817        public Date getTime() { 
818          return this.time == null ? null : this.time.getValue();
819        }
820
821        /**
822         * @param value When the composition was attested by the party.
823         */
824        public CompositionAttesterComponent setTime(Date value) { 
825          if (value == null)
826            this.time = null;
827          else {
828            if (this.time == null)
829              this.time = new DateTimeType();
830            this.time.setValue(value);
831          }
832          return this;
833        }
834
835        /**
836         * @return {@link #party} (Who attested the composition in the specified way.)
837         */
838        public Reference getParty() { 
839          if (this.party == null)
840            if (Configuration.errorOnAutoCreate())
841              throw new Error("Attempt to auto-create CompositionAttesterComponent.party");
842            else if (Configuration.doAutoCreate())
843              this.party = new Reference(); // cc
844          return this.party;
845        }
846
847        public boolean hasParty() { 
848          return this.party != null && !this.party.isEmpty();
849        }
850
851        /**
852         * @param value {@link #party} (Who attested the composition in the specified way.)
853         */
854        public CompositionAttesterComponent setParty(Reference value) { 
855          this.party = value;
856          return this;
857        }
858
859        /**
860         * @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.)
861         */
862        public Resource getPartyTarget() { 
863          return this.partyTarget;
864        }
865
866        /**
867         * @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.)
868         */
869        public CompositionAttesterComponent setPartyTarget(Resource value) { 
870          this.partyTarget = value;
871          return this;
872        }
873
874        protected void listChildren(List<Property> childrenList) {
875          super.listChildren(childrenList);
876          childrenList.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode));
877          childrenList.add(new Property("time", "dateTime", "When the composition was attested by the party.", 0, java.lang.Integer.MAX_VALUE, time));
878          childrenList.add(new Property("party", "Reference(Patient|Practitioner|Organization)", "Who attested the composition in the specified way.", 0, java.lang.Integer.MAX_VALUE, party));
879        }
880
881      @Override
882      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
883        switch (hash) {
884        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : this.mode.toArray(new Base[this.mode.size()]); // Enumeration<CompositionAttestationMode>
885        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType
886        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
887        default: return super.getProperty(hash, name, checkValid);
888        }
889
890      }
891
892      @Override
893      public Base setProperty(int hash, String name, Base value) throws FHIRException {
894        switch (hash) {
895        case 3357091: // mode
896          value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
897          this.getMode().add((Enumeration) value); // Enumeration<CompositionAttestationMode>
898          return value;
899        case 3560141: // time
900          this.time = castToDateTime(value); // DateTimeType
901          return value;
902        case 106437350: // party
903          this.party = castToReference(value); // Reference
904          return value;
905        default: return super.setProperty(hash, name, value);
906        }
907
908      }
909
910      @Override
911      public Base setProperty(String name, Base value) throws FHIRException {
912        if (name.equals("mode")) {
913          value = new CompositionAttestationModeEnumFactory().fromType(castToCode(value));
914          this.getMode().add((Enumeration) value);
915        } else if (name.equals("time")) {
916          this.time = castToDateTime(value); // DateTimeType
917        } else if (name.equals("party")) {
918          this.party = castToReference(value); // Reference
919        } else
920          return super.setProperty(name, value);
921        return value;
922      }
923
924      @Override
925      public Base makeProperty(int hash, String name) throws FHIRException {
926        switch (hash) {
927        case 3357091:  return addModeElement();
928        case 3560141:  return getTimeElement();
929        case 106437350:  return getParty(); 
930        default: return super.makeProperty(hash, name);
931        }
932
933      }
934
935      @Override
936      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
937        switch (hash) {
938        case 3357091: /*mode*/ return new String[] {"code"};
939        case 3560141: /*time*/ return new String[] {"dateTime"};
940        case 106437350: /*party*/ return new String[] {"Reference"};
941        default: return super.getTypesForProperty(hash, name);
942        }
943
944      }
945
946      @Override
947      public Base addChild(String name) throws FHIRException {
948        if (name.equals("mode")) {
949          throw new FHIRException("Cannot call addChild on a primitive type Composition.mode");
950        }
951        else if (name.equals("time")) {
952          throw new FHIRException("Cannot call addChild on a primitive type Composition.time");
953        }
954        else if (name.equals("party")) {
955          this.party = new Reference();
956          return this.party;
957        }
958        else
959          return super.addChild(name);
960      }
961
962      public CompositionAttesterComponent copy() {
963        CompositionAttesterComponent dst = new CompositionAttesterComponent();
964        copyValues(dst);
965        if (mode != null) {
966          dst.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
967          for (Enumeration<CompositionAttestationMode> i : mode)
968            dst.mode.add(i.copy());
969        };
970        dst.time = time == null ? null : time.copy();
971        dst.party = party == null ? null : party.copy();
972        return dst;
973      }
974
975      @Override
976      public boolean equalsDeep(Base other) {
977        if (!super.equalsDeep(other))
978          return false;
979        if (!(other instanceof CompositionAttesterComponent))
980          return false;
981        CompositionAttesterComponent o = (CompositionAttesterComponent) other;
982        return compareDeep(mode, o.mode, true) && compareDeep(time, o.time, true) && compareDeep(party, o.party, true)
983          ;
984      }
985
986      @Override
987      public boolean equalsShallow(Base other) {
988        if (!super.equalsShallow(other))
989          return false;
990        if (!(other instanceof CompositionAttesterComponent))
991          return false;
992        CompositionAttesterComponent o = (CompositionAttesterComponent) other;
993        return compareValues(mode, o.mode, true) && compareValues(time, o.time, true);
994      }
995
996      public boolean isEmpty() {
997        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(mode, time, party);
998      }
999
1000  public String fhirType() {
1001    return "Composition.attester";
1002
1003  }
1004
1005  }
1006
1007    @Block()
1008    public static class CompositionRelatesToComponent extends BackboneElement implements IBaseBackboneElement {
1009        /**
1010         * The type of relationship that this composition has with anther composition or document.
1011         */
1012        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1013        @Description(shortDefinition="replaces | transforms | signs | appends", formalDefinition="The type of relationship that this composition has with anther composition or document." )
1014        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/document-relationship-type")
1015        protected Enumeration<DocumentRelationshipType> code;
1016
1017        /**
1018         * The target composition/document of this relationship.
1019         */
1020        @Child(name = "target", type = {Identifier.class, Composition.class}, order=2, min=1, max=1, modifier=false, summary=true)
1021        @Description(shortDefinition="Target of the relationship", formalDefinition="The target composition/document of this relationship." )
1022        protected Type target;
1023
1024        private static final long serialVersionUID = 1536930280L;
1025
1026    /**
1027     * Constructor
1028     */
1029      public CompositionRelatesToComponent() {
1030        super();
1031      }
1032
1033    /**
1034     * Constructor
1035     */
1036      public CompositionRelatesToComponent(Enumeration<DocumentRelationshipType> code, Type target) {
1037        super();
1038        this.code = code;
1039        this.target = target;
1040      }
1041
1042        /**
1043         * @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
1044         */
1045        public Enumeration<DocumentRelationshipType> getCodeElement() { 
1046          if (this.code == null)
1047            if (Configuration.errorOnAutoCreate())
1048              throw new Error("Attempt to auto-create CompositionRelatesToComponent.code");
1049            else if (Configuration.doAutoCreate())
1050              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory()); // bb
1051          return this.code;
1052        }
1053
1054        public boolean hasCodeElement() { 
1055          return this.code != null && !this.code.isEmpty();
1056        }
1057
1058        public boolean hasCode() { 
1059          return this.code != null && !this.code.isEmpty();
1060        }
1061
1062        /**
1063         * @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
1064         */
1065        public CompositionRelatesToComponent setCodeElement(Enumeration<DocumentRelationshipType> value) { 
1066          this.code = value;
1067          return this;
1068        }
1069
1070        /**
1071         * @return The type of relationship that this composition has with anther composition or document.
1072         */
1073        public DocumentRelationshipType getCode() { 
1074          return this.code == null ? null : this.code.getValue();
1075        }
1076
1077        /**
1078         * @param value The type of relationship that this composition has with anther composition or document.
1079         */
1080        public CompositionRelatesToComponent setCode(DocumentRelationshipType value) { 
1081            if (this.code == null)
1082              this.code = new Enumeration<DocumentRelationshipType>(new DocumentRelationshipTypeEnumFactory());
1083            this.code.setValue(value);
1084          return this;
1085        }
1086
1087        /**
1088         * @return {@link #target} (The target composition/document of this relationship.)
1089         */
1090        public Type getTarget() { 
1091          return this.target;
1092        }
1093
1094        /**
1095         * @return {@link #target} (The target composition/document of this relationship.)
1096         */
1097        public Identifier getTargetIdentifier() throws FHIRException { 
1098          if (!(this.target instanceof Identifier))
1099            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.target.getClass().getName()+" was encountered");
1100          return (Identifier) this.target;
1101        }
1102
1103        public boolean hasTargetIdentifier() { 
1104          return this.target instanceof Identifier;
1105        }
1106
1107        /**
1108         * @return {@link #target} (The target composition/document of this relationship.)
1109         */
1110        public Reference getTargetReference() throws FHIRException { 
1111          if (!(this.target instanceof Reference))
1112            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.target.getClass().getName()+" was encountered");
1113          return (Reference) this.target;
1114        }
1115
1116        public boolean hasTargetReference() { 
1117          return this.target instanceof Reference;
1118        }
1119
1120        public boolean hasTarget() { 
1121          return this.target != null && !this.target.isEmpty();
1122        }
1123
1124        /**
1125         * @param value {@link #target} (The target composition/document of this relationship.)
1126         */
1127        public CompositionRelatesToComponent setTarget(Type value) { 
1128          this.target = value;
1129          return this;
1130        }
1131
1132        protected void listChildren(List<Property> childrenList) {
1133          super.listChildren(childrenList);
1134          childrenList.add(new Property("code", "code", "The type of relationship that this composition has with anther composition or document.", 0, java.lang.Integer.MAX_VALUE, code));
1135          childrenList.add(new Property("target[x]", "Identifier|Reference(Composition)", "The target composition/document of this relationship.", 0, java.lang.Integer.MAX_VALUE, target));
1136        }
1137
1138      @Override
1139      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1140        switch (hash) {
1141        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<DocumentRelationshipType>
1142        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Type
1143        default: return super.getProperty(hash, name, checkValid);
1144        }
1145
1146      }
1147
1148      @Override
1149      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1150        switch (hash) {
1151        case 3059181: // code
1152          value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
1153          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
1154          return value;
1155        case -880905839: // target
1156          this.target = castToType(value); // Type
1157          return value;
1158        default: return super.setProperty(hash, name, value);
1159        }
1160
1161      }
1162
1163      @Override
1164      public Base setProperty(String name, Base value) throws FHIRException {
1165        if (name.equals("code")) {
1166          value = new DocumentRelationshipTypeEnumFactory().fromType(castToCode(value));
1167          this.code = (Enumeration) value; // Enumeration<DocumentRelationshipType>
1168        } else if (name.equals("target[x]")) {
1169          this.target = castToType(value); // Type
1170        } else
1171          return super.setProperty(name, value);
1172        return value;
1173      }
1174
1175      @Override
1176      public Base makeProperty(int hash, String name) throws FHIRException {
1177        switch (hash) {
1178        case 3059181:  return getCodeElement();
1179        case -815579825:  return getTarget(); 
1180        case -880905839:  return getTarget(); 
1181        default: return super.makeProperty(hash, name);
1182        }
1183
1184      }
1185
1186      @Override
1187      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1188        switch (hash) {
1189        case 3059181: /*code*/ return new String[] {"code"};
1190        case -880905839: /*target*/ return new String[] {"Identifier", "Reference"};
1191        default: return super.getTypesForProperty(hash, name);
1192        }
1193
1194      }
1195
1196      @Override
1197      public Base addChild(String name) throws FHIRException {
1198        if (name.equals("code")) {
1199          throw new FHIRException("Cannot call addChild on a primitive type Composition.code");
1200        }
1201        else if (name.equals("targetIdentifier")) {
1202          this.target = new Identifier();
1203          return this.target;
1204        }
1205        else if (name.equals("targetReference")) {
1206          this.target = new Reference();
1207          return this.target;
1208        }
1209        else
1210          return super.addChild(name);
1211      }
1212
1213      public CompositionRelatesToComponent copy() {
1214        CompositionRelatesToComponent dst = new CompositionRelatesToComponent();
1215        copyValues(dst);
1216        dst.code = code == null ? null : code.copy();
1217        dst.target = target == null ? null : target.copy();
1218        return dst;
1219      }
1220
1221      @Override
1222      public boolean equalsDeep(Base other) {
1223        if (!super.equalsDeep(other))
1224          return false;
1225        if (!(other instanceof CompositionRelatesToComponent))
1226          return false;
1227        CompositionRelatesToComponent o = (CompositionRelatesToComponent) other;
1228        return compareDeep(code, o.code, true) && compareDeep(target, o.target, true);
1229      }
1230
1231      @Override
1232      public boolean equalsShallow(Base other) {
1233        if (!super.equalsShallow(other))
1234          return false;
1235        if (!(other instanceof CompositionRelatesToComponent))
1236          return false;
1237        CompositionRelatesToComponent o = (CompositionRelatesToComponent) other;
1238        return compareValues(code, o.code, true);
1239      }
1240
1241      public boolean isEmpty() {
1242        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, target);
1243      }
1244
1245  public String fhirType() {
1246    return "Composition.relatesTo";
1247
1248  }
1249
1250  }
1251
1252    @Block()
1253    public static class CompositionEventComponent extends BackboneElement implements IBaseBackboneElement {
1254        /**
1255         * 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.
1256         */
1257        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1258        @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." )
1259        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ActCode")
1260        protected List<CodeableConcept> code;
1261
1262        /**
1263         * 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.
1264         */
1265        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
1266        @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." )
1267        protected Period period;
1268
1269        /**
1270         * 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.
1271         */
1272        @Child(name = "detail", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1273        @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." )
1274        protected List<Reference> detail;
1275        /**
1276         * 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.)
1277         */
1278        protected List<Resource> detailTarget;
1279
1280
1281        private static final long serialVersionUID = -1581379774L;
1282
1283    /**
1284     * Constructor
1285     */
1286      public CompositionEventComponent() {
1287        super();
1288      }
1289
1290        /**
1291         * @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.)
1292         */
1293        public List<CodeableConcept> getCode() { 
1294          if (this.code == null)
1295            this.code = new ArrayList<CodeableConcept>();
1296          return this.code;
1297        }
1298
1299        /**
1300         * @return Returns a reference to <code>this</code> for easy method chaining
1301         */
1302        public CompositionEventComponent setCode(List<CodeableConcept> theCode) { 
1303          this.code = theCode;
1304          return this;
1305        }
1306
1307        public boolean hasCode() { 
1308          if (this.code == null)
1309            return false;
1310          for (CodeableConcept item : this.code)
1311            if (!item.isEmpty())
1312              return true;
1313          return false;
1314        }
1315
1316        public CodeableConcept addCode() { //3
1317          CodeableConcept t = new CodeableConcept();
1318          if (this.code == null)
1319            this.code = new ArrayList<CodeableConcept>();
1320          this.code.add(t);
1321          return t;
1322        }
1323
1324        public CompositionEventComponent addCode(CodeableConcept t) { //3
1325          if (t == null)
1326            return this;
1327          if (this.code == null)
1328            this.code = new ArrayList<CodeableConcept>();
1329          this.code.add(t);
1330          return this;
1331        }
1332
1333        /**
1334         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
1335         */
1336        public CodeableConcept getCodeFirstRep() { 
1337          if (getCode().isEmpty()) {
1338            addCode();
1339          }
1340          return getCode().get(0);
1341        }
1342
1343        /**
1344         * @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.)
1345         */
1346        public Period getPeriod() { 
1347          if (this.period == null)
1348            if (Configuration.errorOnAutoCreate())
1349              throw new Error("Attempt to auto-create CompositionEventComponent.period");
1350            else if (Configuration.doAutoCreate())
1351              this.period = new Period(); // cc
1352          return this.period;
1353        }
1354
1355        public boolean hasPeriod() { 
1356          return this.period != null && !this.period.isEmpty();
1357        }
1358
1359        /**
1360         * @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.)
1361         */
1362        public CompositionEventComponent setPeriod(Period value) { 
1363          this.period = value;
1364          return this;
1365        }
1366
1367        /**
1368         * @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.)
1369         */
1370        public List<Reference> getDetail() { 
1371          if (this.detail == null)
1372            this.detail = new ArrayList<Reference>();
1373          return this.detail;
1374        }
1375
1376        /**
1377         * @return Returns a reference to <code>this</code> for easy method chaining
1378         */
1379        public CompositionEventComponent setDetail(List<Reference> theDetail) { 
1380          this.detail = theDetail;
1381          return this;
1382        }
1383
1384        public boolean hasDetail() { 
1385          if (this.detail == null)
1386            return false;
1387          for (Reference item : this.detail)
1388            if (!item.isEmpty())
1389              return true;
1390          return false;
1391        }
1392
1393        public Reference addDetail() { //3
1394          Reference t = new Reference();
1395          if (this.detail == null)
1396            this.detail = new ArrayList<Reference>();
1397          this.detail.add(t);
1398          return t;
1399        }
1400
1401        public CompositionEventComponent addDetail(Reference t) { //3
1402          if (t == null)
1403            return this;
1404          if (this.detail == null)
1405            this.detail = new ArrayList<Reference>();
1406          this.detail.add(t);
1407          return this;
1408        }
1409
1410        /**
1411         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
1412         */
1413        public Reference getDetailFirstRep() { 
1414          if (getDetail().isEmpty()) {
1415            addDetail();
1416          }
1417          return getDetail().get(0);
1418        }
1419
1420        /**
1421         * @deprecated Use Reference#setResource(IBaseResource) instead
1422         */
1423        @Deprecated
1424        public List<Resource> getDetailTarget() { 
1425          if (this.detailTarget == null)
1426            this.detailTarget = new ArrayList<Resource>();
1427          return this.detailTarget;
1428        }
1429
1430        protected void listChildren(List<Property> childrenList) {
1431          super.listChildren(childrenList);
1432          childrenList.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));
1433          childrenList.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, java.lang.Integer.MAX_VALUE, period));
1434          childrenList.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));
1435        }
1436
1437      @Override
1438      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1439        switch (hash) {
1440        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
1441        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
1442        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
1443        default: return super.getProperty(hash, name, checkValid);
1444        }
1445
1446      }
1447
1448      @Override
1449      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1450        switch (hash) {
1451        case 3059181: // code
1452          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
1453          return value;
1454        case -991726143: // period
1455          this.period = castToPeriod(value); // Period
1456          return value;
1457        case -1335224239: // detail
1458          this.getDetail().add(castToReference(value)); // Reference
1459          return value;
1460        default: return super.setProperty(hash, name, value);
1461        }
1462
1463      }
1464
1465      @Override
1466      public Base setProperty(String name, Base value) throws FHIRException {
1467        if (name.equals("code")) {
1468          this.getCode().add(castToCodeableConcept(value));
1469        } else if (name.equals("period")) {
1470          this.period = castToPeriod(value); // Period
1471        } else if (name.equals("detail")) {
1472          this.getDetail().add(castToReference(value));
1473        } else
1474          return super.setProperty(name, value);
1475        return value;
1476      }
1477
1478      @Override
1479      public Base makeProperty(int hash, String name) throws FHIRException {
1480        switch (hash) {
1481        case 3059181:  return addCode(); 
1482        case -991726143:  return getPeriod(); 
1483        case -1335224239:  return addDetail(); 
1484        default: return super.makeProperty(hash, name);
1485        }
1486
1487      }
1488
1489      @Override
1490      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1491        switch (hash) {
1492        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1493        case -991726143: /*period*/ return new String[] {"Period"};
1494        case -1335224239: /*detail*/ return new String[] {"Reference"};
1495        default: return super.getTypesForProperty(hash, name);
1496        }
1497
1498      }
1499
1500      @Override
1501      public Base addChild(String name) throws FHIRException {
1502        if (name.equals("code")) {
1503          return addCode();
1504        }
1505        else if (name.equals("period")) {
1506          this.period = new Period();
1507          return this.period;
1508        }
1509        else if (name.equals("detail")) {
1510          return addDetail();
1511        }
1512        else
1513          return super.addChild(name);
1514      }
1515
1516      public CompositionEventComponent copy() {
1517        CompositionEventComponent dst = new CompositionEventComponent();
1518        copyValues(dst);
1519        if (code != null) {
1520          dst.code = new ArrayList<CodeableConcept>();
1521          for (CodeableConcept i : code)
1522            dst.code.add(i.copy());
1523        };
1524        dst.period = period == null ? null : period.copy();
1525        if (detail != null) {
1526          dst.detail = new ArrayList<Reference>();
1527          for (Reference i : detail)
1528            dst.detail.add(i.copy());
1529        };
1530        return dst;
1531      }
1532
1533      @Override
1534      public boolean equalsDeep(Base other) {
1535        if (!super.equalsDeep(other))
1536          return false;
1537        if (!(other instanceof CompositionEventComponent))
1538          return false;
1539        CompositionEventComponent o = (CompositionEventComponent) other;
1540        return compareDeep(code, o.code, true) && compareDeep(period, o.period, true) && compareDeep(detail, o.detail, true)
1541          ;
1542      }
1543
1544      @Override
1545      public boolean equalsShallow(Base other) {
1546        if (!super.equalsShallow(other))
1547          return false;
1548        if (!(other instanceof CompositionEventComponent))
1549          return false;
1550        CompositionEventComponent o = (CompositionEventComponent) other;
1551        return true;
1552      }
1553
1554      public boolean isEmpty() {
1555        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, period, detail);
1556      }
1557
1558  public String fhirType() {
1559    return "Composition.event";
1560
1561  }
1562
1563  }
1564
1565    @Block()
1566    public static class SectionComponent extends BackboneElement implements IBaseBackboneElement {
1567        /**
1568         * 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.
1569         */
1570        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1571        @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." )
1572        protected StringType title;
1573
1574        /**
1575         * A code identifying the kind of content contained within the section. This must be consistent with the section title.
1576         */
1577        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1578        @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." )
1579        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-section-codes")
1580        protected CodeableConcept code;
1581
1582        /**
1583         * 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.
1584         */
1585        @Child(name = "text", type = {Narrative.class}, order=3, min=0, max=1, modifier=false, summary=false)
1586        @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." )
1587        protected Narrative text;
1588
1589        /**
1590         * 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.
1591         */
1592        @Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
1593        @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." )
1594        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-mode")
1595        protected Enumeration<SectionMode> mode;
1596
1597        /**
1598         * Specifies the order applied to the items in the section entries.
1599         */
1600        @Child(name = "orderedBy", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
1601        @Description(shortDefinition="Order of section entries", formalDefinition="Specifies the order applied to the items in the section entries." )
1602        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-order")
1603        protected CodeableConcept orderedBy;
1604
1605        /**
1606         * A reference to the actual resource from which the narrative in the section is derived.
1607         */
1608        @Child(name = "entry", type = {Reference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1609        @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." )
1610        protected List<Reference> entry;
1611        /**
1612         * 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.)
1613         */
1614        protected List<Resource> entryTarget;
1615
1616
1617        /**
1618         * If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.
1619         */
1620        @Child(name = "emptyReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1621        @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." )
1622        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/list-empty-reason")
1623        protected CodeableConcept emptyReason;
1624
1625        /**
1626         * A nested sub-section within this section.
1627         */
1628        @Child(name = "section", type = {SectionComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1629        @Description(shortDefinition="Nested Section", formalDefinition="A nested sub-section within this section." )
1630        protected List<SectionComponent> section;
1631
1632        private static final long serialVersionUID = -128426142L;
1633
1634    /**
1635     * Constructor
1636     */
1637      public SectionComponent() {
1638        super();
1639      }
1640
1641        /**
1642         * @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
1643         */
1644        public StringType getTitleElement() { 
1645          if (this.title == null)
1646            if (Configuration.errorOnAutoCreate())
1647              throw new Error("Attempt to auto-create SectionComponent.title");
1648            else if (Configuration.doAutoCreate())
1649              this.title = new StringType(); // bb
1650          return this.title;
1651        }
1652
1653        public boolean hasTitleElement() { 
1654          return this.title != null && !this.title.isEmpty();
1655        }
1656
1657        public boolean hasTitle() { 
1658          return this.title != null && !this.title.isEmpty();
1659        }
1660
1661        /**
1662         * @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
1663         */
1664        public SectionComponent setTitleElement(StringType value) { 
1665          this.title = value;
1666          return this;
1667        }
1668
1669        /**
1670         * @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.
1671         */
1672        public String getTitle() { 
1673          return this.title == null ? null : this.title.getValue();
1674        }
1675
1676        /**
1677         * @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.
1678         */
1679        public SectionComponent setTitle(String value) { 
1680          if (Utilities.noString(value))
1681            this.title = null;
1682          else {
1683            if (this.title == null)
1684              this.title = new StringType();
1685            this.title.setValue(value);
1686          }
1687          return this;
1688        }
1689
1690        /**
1691         * @return {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
1692         */
1693        public CodeableConcept getCode() { 
1694          if (this.code == null)
1695            if (Configuration.errorOnAutoCreate())
1696              throw new Error("Attempt to auto-create SectionComponent.code");
1697            else if (Configuration.doAutoCreate())
1698              this.code = new CodeableConcept(); // cc
1699          return this.code;
1700        }
1701
1702        public boolean hasCode() { 
1703          return this.code != null && !this.code.isEmpty();
1704        }
1705
1706        /**
1707         * @param value {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
1708         */
1709        public SectionComponent setCode(CodeableConcept value) { 
1710          this.code = value;
1711          return this;
1712        }
1713
1714        /**
1715         * @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.)
1716         */
1717        public Narrative getText() { 
1718          if (this.text == null)
1719            if (Configuration.errorOnAutoCreate())
1720              throw new Error("Attempt to auto-create SectionComponent.text");
1721            else if (Configuration.doAutoCreate())
1722              this.text = new Narrative(); // cc
1723          return this.text;
1724        }
1725
1726        public boolean hasText() { 
1727          return this.text != null && !this.text.isEmpty();
1728        }
1729
1730        /**
1731         * @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.)
1732         */
1733        public SectionComponent setText(Narrative value) { 
1734          this.text = value;
1735          return this;
1736        }
1737
1738        /**
1739         * @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
1740         */
1741        public Enumeration<SectionMode> getModeElement() { 
1742          if (this.mode == null)
1743            if (Configuration.errorOnAutoCreate())
1744              throw new Error("Attempt to auto-create SectionComponent.mode");
1745            else if (Configuration.doAutoCreate())
1746              this.mode = new Enumeration<SectionMode>(new SectionModeEnumFactory()); // bb
1747          return this.mode;
1748        }
1749
1750        public boolean hasModeElement() { 
1751          return this.mode != null && !this.mode.isEmpty();
1752        }
1753
1754        public boolean hasMode() { 
1755          return this.mode != null && !this.mode.isEmpty();
1756        }
1757
1758        /**
1759         * @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
1760         */
1761        public SectionComponent setModeElement(Enumeration<SectionMode> value) { 
1762          this.mode = value;
1763          return this;
1764        }
1765
1766        /**
1767         * @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.
1768         */
1769        public SectionMode getMode() { 
1770          return this.mode == null ? null : this.mode.getValue();
1771        }
1772
1773        /**
1774         * @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.
1775         */
1776        public SectionComponent setMode(SectionMode value) { 
1777          if (value == null)
1778            this.mode = null;
1779          else {
1780            if (this.mode == null)
1781              this.mode = new Enumeration<SectionMode>(new SectionModeEnumFactory());
1782            this.mode.setValue(value);
1783          }
1784          return this;
1785        }
1786
1787        /**
1788         * @return {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1789         */
1790        public CodeableConcept getOrderedBy() { 
1791          if (this.orderedBy == null)
1792            if (Configuration.errorOnAutoCreate())
1793              throw new Error("Attempt to auto-create SectionComponent.orderedBy");
1794            else if (Configuration.doAutoCreate())
1795              this.orderedBy = new CodeableConcept(); // cc
1796          return this.orderedBy;
1797        }
1798
1799        public boolean hasOrderedBy() { 
1800          return this.orderedBy != null && !this.orderedBy.isEmpty();
1801        }
1802
1803        /**
1804         * @param value {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1805         */
1806        public SectionComponent setOrderedBy(CodeableConcept value) { 
1807          this.orderedBy = value;
1808          return this;
1809        }
1810
1811        /**
1812         * @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
1813         */
1814        public List<Reference> getEntry() { 
1815          if (this.entry == null)
1816            this.entry = new ArrayList<Reference>();
1817          return this.entry;
1818        }
1819
1820        /**
1821         * @return Returns a reference to <code>this</code> for easy method chaining
1822         */
1823        public SectionComponent setEntry(List<Reference> theEntry) { 
1824          this.entry = theEntry;
1825          return this;
1826        }
1827
1828        public boolean hasEntry() { 
1829          if (this.entry == null)
1830            return false;
1831          for (Reference item : this.entry)
1832            if (!item.isEmpty())
1833              return true;
1834          return false;
1835        }
1836
1837        public Reference addEntry() { //3
1838          Reference t = new Reference();
1839          if (this.entry == null)
1840            this.entry = new ArrayList<Reference>();
1841          this.entry.add(t);
1842          return t;
1843        }
1844
1845        public SectionComponent addEntry(Reference t) { //3
1846          if (t == null)
1847            return this;
1848          if (this.entry == null)
1849            this.entry = new ArrayList<Reference>();
1850          this.entry.add(t);
1851          return this;
1852        }
1853
1854        /**
1855         * @return The first repetition of repeating field {@link #entry}, creating it if it does not already exist
1856         */
1857        public Reference getEntryFirstRep() { 
1858          if (getEntry().isEmpty()) {
1859            addEntry();
1860          }
1861          return getEntry().get(0);
1862        }
1863
1864        /**
1865         * @deprecated Use Reference#setResource(IBaseResource) instead
1866         */
1867        @Deprecated
1868        public List<Resource> getEntryTarget() { 
1869          if (this.entryTarget == null)
1870            this.entryTarget = new ArrayList<Resource>();
1871          return this.entryTarget;
1872        }
1873
1874        /**
1875         * @return {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
1876         */
1877        public CodeableConcept getEmptyReason() { 
1878          if (this.emptyReason == null)
1879            if (Configuration.errorOnAutoCreate())
1880              throw new Error("Attempt to auto-create SectionComponent.emptyReason");
1881            else if (Configuration.doAutoCreate())
1882              this.emptyReason = new CodeableConcept(); // cc
1883          return this.emptyReason;
1884        }
1885
1886        public boolean hasEmptyReason() { 
1887          return this.emptyReason != null && !this.emptyReason.isEmpty();
1888        }
1889
1890        /**
1891         * @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.)
1892         */
1893        public SectionComponent setEmptyReason(CodeableConcept value) { 
1894          this.emptyReason = value;
1895          return this;
1896        }
1897
1898        /**
1899         * @return {@link #section} (A nested sub-section within this section.)
1900         */
1901        public List<SectionComponent> getSection() { 
1902          if (this.section == null)
1903            this.section = new ArrayList<SectionComponent>();
1904          return this.section;
1905        }
1906
1907        /**
1908         * @return Returns a reference to <code>this</code> for easy method chaining
1909         */
1910        public SectionComponent setSection(List<SectionComponent> theSection) { 
1911          this.section = theSection;
1912          return this;
1913        }
1914
1915        public boolean hasSection() { 
1916          if (this.section == null)
1917            return false;
1918          for (SectionComponent item : this.section)
1919            if (!item.isEmpty())
1920              return true;
1921          return false;
1922        }
1923
1924        public SectionComponent addSection() { //3
1925          SectionComponent t = new SectionComponent();
1926          if (this.section == null)
1927            this.section = new ArrayList<SectionComponent>();
1928          this.section.add(t);
1929          return t;
1930        }
1931
1932        public SectionComponent addSection(SectionComponent t) { //3
1933          if (t == null)
1934            return this;
1935          if (this.section == null)
1936            this.section = new ArrayList<SectionComponent>();
1937          this.section.add(t);
1938          return this;
1939        }
1940
1941        /**
1942         * @return The first repetition of repeating field {@link #section}, creating it if it does not already exist
1943         */
1944        public SectionComponent getSectionFirstRep() { 
1945          if (getSection().isEmpty()) {
1946            addSection();
1947          }
1948          return getSection().get(0);
1949        }
1950
1951        protected void listChildren(List<Property> childrenList) {
1952          super.listChildren(childrenList);
1953          childrenList.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, java.lang.Integer.MAX_VALUE, title));
1954          childrenList.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, java.lang.Integer.MAX_VALUE, code));
1955          childrenList.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, java.lang.Integer.MAX_VALUE, text));
1956          childrenList.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, java.lang.Integer.MAX_VALUE, mode));
1957          childrenList.add(new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, java.lang.Integer.MAX_VALUE, orderedBy));
1958          childrenList.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));
1959          childrenList.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, java.lang.Integer.MAX_VALUE, emptyReason));
1960          childrenList.add(new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, java.lang.Integer.MAX_VALUE, section));
1961        }
1962
1963      @Override
1964      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1965        switch (hash) {
1966        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1967        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1968        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // Narrative
1969        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<SectionMode>
1970        case -391079516: /*orderedBy*/ return this.orderedBy == null ? new Base[0] : new Base[] {this.orderedBy}; // CodeableConcept
1971        case 96667762: /*entry*/ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // Reference
1972        case 1140135409: /*emptyReason*/ return this.emptyReason == null ? new Base[0] : new Base[] {this.emptyReason}; // CodeableConcept
1973        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
1974        default: return super.getProperty(hash, name, checkValid);
1975        }
1976
1977      }
1978
1979      @Override
1980      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1981        switch (hash) {
1982        case 110371416: // title
1983          this.title = castToString(value); // StringType
1984          return value;
1985        case 3059181: // code
1986          this.code = castToCodeableConcept(value); // CodeableConcept
1987          return value;
1988        case 3556653: // text
1989          this.text = castToNarrative(value); // Narrative
1990          return value;
1991        case 3357091: // mode
1992          value = new SectionModeEnumFactory().fromType(castToCode(value));
1993          this.mode = (Enumeration) value; // Enumeration<SectionMode>
1994          return value;
1995        case -391079516: // orderedBy
1996          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1997          return value;
1998        case 96667762: // entry
1999          this.getEntry().add(castToReference(value)); // Reference
2000          return value;
2001        case 1140135409: // emptyReason
2002          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
2003          return value;
2004        case 1970241253: // section
2005          this.getSection().add((SectionComponent) value); // SectionComponent
2006          return value;
2007        default: return super.setProperty(hash, name, value);
2008        }
2009
2010      }
2011
2012      @Override
2013      public Base setProperty(String name, Base value) throws FHIRException {
2014        if (name.equals("title")) {
2015          this.title = castToString(value); // StringType
2016        } else if (name.equals("code")) {
2017          this.code = castToCodeableConcept(value); // CodeableConcept
2018        } else if (name.equals("text")) {
2019          this.text = castToNarrative(value); // Narrative
2020        } else if (name.equals("mode")) {
2021          value = new SectionModeEnumFactory().fromType(castToCode(value));
2022          this.mode = (Enumeration) value; // Enumeration<SectionMode>
2023        } else if (name.equals("orderedBy")) {
2024          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
2025        } else if (name.equals("entry")) {
2026          this.getEntry().add(castToReference(value));
2027        } else if (name.equals("emptyReason")) {
2028          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
2029        } else if (name.equals("section")) {
2030          this.getSection().add((SectionComponent) value);
2031        } else
2032          return super.setProperty(name, value);
2033        return value;
2034      }
2035
2036      @Override
2037      public Base makeProperty(int hash, String name) throws FHIRException {
2038        switch (hash) {
2039        case 110371416:  return getTitleElement();
2040        case 3059181:  return getCode(); 
2041        case 3556653:  return getText(); 
2042        case 3357091:  return getModeElement();
2043        case -391079516:  return getOrderedBy(); 
2044        case 96667762:  return addEntry(); 
2045        case 1140135409:  return getEmptyReason(); 
2046        case 1970241253:  return addSection(); 
2047        default: return super.makeProperty(hash, name);
2048        }
2049
2050      }
2051
2052      @Override
2053      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2054        switch (hash) {
2055        case 110371416: /*title*/ return new String[] {"string"};
2056        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2057        case 3556653: /*text*/ return new String[] {"Narrative"};
2058        case 3357091: /*mode*/ return new String[] {"code"};
2059        case -391079516: /*orderedBy*/ return new String[] {"CodeableConcept"};
2060        case 96667762: /*entry*/ return new String[] {"Reference"};
2061        case 1140135409: /*emptyReason*/ return new String[] {"CodeableConcept"};
2062        case 1970241253: /*section*/ return new String[] {"@Composition.section"};
2063        default: return super.getTypesForProperty(hash, name);
2064        }
2065
2066      }
2067
2068      @Override
2069      public Base addChild(String name) throws FHIRException {
2070        if (name.equals("title")) {
2071          throw new FHIRException("Cannot call addChild on a primitive type Composition.title");
2072        }
2073        else if (name.equals("code")) {
2074          this.code = new CodeableConcept();
2075          return this.code;
2076        }
2077        else if (name.equals("text")) {
2078          this.text = new Narrative();
2079          return this.text;
2080        }
2081        else if (name.equals("mode")) {
2082          throw new FHIRException("Cannot call addChild on a primitive type Composition.mode");
2083        }
2084        else if (name.equals("orderedBy")) {
2085          this.orderedBy = new CodeableConcept();
2086          return this.orderedBy;
2087        }
2088        else if (name.equals("entry")) {
2089          return addEntry();
2090        }
2091        else if (name.equals("emptyReason")) {
2092          this.emptyReason = new CodeableConcept();
2093          return this.emptyReason;
2094        }
2095        else if (name.equals("section")) {
2096          return addSection();
2097        }
2098        else
2099          return super.addChild(name);
2100      }
2101
2102      public SectionComponent copy() {
2103        SectionComponent dst = new SectionComponent();
2104        copyValues(dst);
2105        dst.title = title == null ? null : title.copy();
2106        dst.code = code == null ? null : code.copy();
2107        dst.text = text == null ? null : text.copy();
2108        dst.mode = mode == null ? null : mode.copy();
2109        dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
2110        if (entry != null) {
2111          dst.entry = new ArrayList<Reference>();
2112          for (Reference i : entry)
2113            dst.entry.add(i.copy());
2114        };
2115        dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
2116        if (section != null) {
2117          dst.section = new ArrayList<SectionComponent>();
2118          for (SectionComponent i : section)
2119            dst.section.add(i.copy());
2120        };
2121        return dst;
2122      }
2123
2124      @Override
2125      public boolean equalsDeep(Base other) {
2126        if (!super.equalsDeep(other))
2127          return false;
2128        if (!(other instanceof SectionComponent))
2129          return false;
2130        SectionComponent o = (SectionComponent) other;
2131        return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
2132           && compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(entry, o.entry, true)
2133           && compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true);
2134      }
2135
2136      @Override
2137      public boolean equalsShallow(Base other) {
2138        if (!super.equalsShallow(other))
2139          return false;
2140        if (!(other instanceof SectionComponent))
2141          return false;
2142        SectionComponent o = (SectionComponent) other;
2143        return compareValues(title, o.title, true) && compareValues(mode, o.mode, true);
2144      }
2145
2146      public boolean isEmpty() {
2147        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, code, text, mode
2148          , orderedBy, entry, emptyReason, section);
2149      }
2150
2151  public String fhirType() {
2152    return "Composition.section";
2153
2154  }
2155
2156  }
2157
2158    /**
2159     * Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.
2160     */
2161    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
2162    @Description(shortDefinition="Logical identifier of composition (version-independent)", formalDefinition="Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time." )
2163    protected Identifier identifier;
2164
2165    /**
2166     * The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2167     */
2168    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
2169    @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." )
2170    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/composition-status")
2171    protected Enumeration<CompositionStatus> status;
2172
2173    /**
2174     * 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.
2175     */
2176    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
2177    @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." )
2178    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-typecodes")
2179    protected CodeableConcept type;
2180
2181    /**
2182     * 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.
2183     */
2184    @Child(name = "class", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
2185    @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." )
2186    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/doc-classcodes")
2187    protected CodeableConcept class_;
2188
2189    /**
2190     * 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).
2191     */
2192    @Child(name = "subject", type = {Reference.class}, order=4, min=1, max=1, modifier=false, summary=true)
2193    @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)." )
2194    protected Reference subject;
2195
2196    /**
2197     * 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).)
2198     */
2199    protected Resource subjectTarget;
2200
2201    /**
2202     * Describes the clinical encounter or type of care this documentation is associated with.
2203     */
2204    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
2205    @Description(shortDefinition="Context of the Composition", formalDefinition="Describes the clinical encounter or type of care this documentation is associated with." )
2206    protected Reference encounter;
2207
2208    /**
2209     * The actual object that is the target of the reference (Describes the clinical encounter or type of care this documentation is associated with.)
2210     */
2211    protected Encounter encounterTarget;
2212
2213    /**
2214     * The composition editing time, when the composition was last logically changed by the author.
2215     */
2216    @Child(name = "date", type = {DateTimeType.class}, order=6, min=1, max=1, modifier=false, summary=true)
2217    @Description(shortDefinition="Composition editing time", formalDefinition="The composition editing time, when the composition was last logically changed by the author." )
2218    protected DateTimeType date;
2219
2220    /**
2221     * Identifies who is responsible for the information in the composition, not necessarily who typed it in.
2222     */
2223    @Child(name = "author", type = {Practitioner.class, Device.class, Patient.class, RelatedPerson.class}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2224    @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." )
2225    protected List<Reference> author;
2226    /**
2227     * 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.)
2228     */
2229    protected List<Resource> authorTarget;
2230
2231
2232    /**
2233     * Official human-readable label for the composition.
2234     */
2235    @Child(name = "title", type = {StringType.class}, order=8, min=1, max=1, modifier=false, summary=true)
2236    @Description(shortDefinition="Human Readable name/title", formalDefinition="Official human-readable label for the composition." )
2237    protected StringType title;
2238
2239    /**
2240     * The code specifying the level of confidentiality of the Composition.
2241     */
2242    @Child(name = "confidentiality", type = {CodeType.class}, order=9, min=0, max=1, modifier=true, summary=true)
2243    @Description(shortDefinition="As defined by affinity domain", formalDefinition="The code specifying the level of confidentiality of the Composition." )
2244    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification")
2245    protected Enumeration<DocumentConfidentiality> confidentiality;
2246
2247    /**
2248     * A participant who has attested to the accuracy of the composition/document.
2249     */
2250    @Child(name = "attester", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2251    @Description(shortDefinition="Attests to accuracy of composition", formalDefinition="A participant who has attested to the accuracy of the composition/document." )
2252    protected List<CompositionAttesterComponent> attester;
2253
2254    /**
2255     * Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.
2256     */
2257    @Child(name = "custodian", type = {Organization.class}, order=11, min=0, max=1, modifier=false, summary=true)
2258    @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." )
2259    protected Reference custodian;
2260
2261    /**
2262     * 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.)
2263     */
2264    protected Organization custodianTarget;
2265
2266    /**
2267     * Relationships that this composition has with other compositions or documents that already exist.
2268     */
2269    @Child(name = "relatesTo", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2270    @Description(shortDefinition="Relationships to other compositions/documents", formalDefinition="Relationships that this composition has with other compositions or documents that already exist." )
2271    protected List<CompositionRelatesToComponent> relatesTo;
2272
2273    /**
2274     * The clinical service, such as a colonoscopy or an appendectomy, being documented.
2275     */
2276    @Child(name = "event", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2277    @Description(shortDefinition="The clinical service(s) being documented", formalDefinition="The clinical service, such as a colonoscopy or an appendectomy, being documented." )
2278    protected List<CompositionEventComponent> event;
2279
2280    /**
2281     * The root of the sections that make up the composition.
2282     */
2283    @Child(name = "section", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2284    @Description(shortDefinition="Composition is broken into sections", formalDefinition="The root of the sections that make up the composition." )
2285    protected List<SectionComponent> section;
2286
2287    private static final long serialVersionUID = -1422555114L;
2288
2289  /**
2290   * Constructor
2291   */
2292    public Composition() {
2293      super();
2294    }
2295
2296  /**
2297   * Constructor
2298   */
2299    public Composition(Enumeration<CompositionStatus> status, CodeableConcept type, Reference subject, DateTimeType date, StringType title) {
2300      super();
2301      this.status = status;
2302      this.type = type;
2303      this.subject = subject;
2304      this.date = date;
2305      this.title = title;
2306    }
2307
2308    /**
2309     * @return {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
2310     */
2311    public Identifier getIdentifier() { 
2312      if (this.identifier == null)
2313        if (Configuration.errorOnAutoCreate())
2314          throw new Error("Attempt to auto-create Composition.identifier");
2315        else if (Configuration.doAutoCreate())
2316          this.identifier = new Identifier(); // cc
2317      return this.identifier;
2318    }
2319
2320    public boolean hasIdentifier() { 
2321      return this.identifier != null && !this.identifier.isEmpty();
2322    }
2323
2324    /**
2325     * @param value {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
2326     */
2327    public Composition setIdentifier(Identifier value) { 
2328      this.identifier = value;
2329      return this;
2330    }
2331
2332    /**
2333     * @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
2334     */
2335    public Enumeration<CompositionStatus> getStatusElement() { 
2336      if (this.status == null)
2337        if (Configuration.errorOnAutoCreate())
2338          throw new Error("Attempt to auto-create Composition.status");
2339        else if (Configuration.doAutoCreate())
2340          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); // bb
2341      return this.status;
2342    }
2343
2344    public boolean hasStatusElement() { 
2345      return this.status != null && !this.status.isEmpty();
2346    }
2347
2348    public boolean hasStatus() { 
2349      return this.status != null && !this.status.isEmpty();
2350    }
2351
2352    /**
2353     * @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
2354     */
2355    public Composition setStatusElement(Enumeration<CompositionStatus> value) { 
2356      this.status = value;
2357      return this;
2358    }
2359
2360    /**
2361     * @return The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2362     */
2363    public CompositionStatus getStatus() { 
2364      return this.status == null ? null : this.status.getValue();
2365    }
2366
2367    /**
2368     * @param value The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
2369     */
2370    public Composition setStatus(CompositionStatus value) { 
2371        if (this.status == null)
2372          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory());
2373        this.status.setValue(value);
2374      return this;
2375    }
2376
2377    /**
2378     * @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.)
2379     */
2380    public CodeableConcept getType() { 
2381      if (this.type == null)
2382        if (Configuration.errorOnAutoCreate())
2383          throw new Error("Attempt to auto-create Composition.type");
2384        else if (Configuration.doAutoCreate())
2385          this.type = new CodeableConcept(); // cc
2386      return this.type;
2387    }
2388
2389    public boolean hasType() { 
2390      return this.type != null && !this.type.isEmpty();
2391    }
2392
2393    /**
2394     * @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.)
2395     */
2396    public Composition setType(CodeableConcept value) { 
2397      this.type = value;
2398      return this;
2399    }
2400
2401    /**
2402     * @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.)
2403     */
2404    public CodeableConcept getClass_() { 
2405      if (this.class_ == null)
2406        if (Configuration.errorOnAutoCreate())
2407          throw new Error("Attempt to auto-create Composition.class_");
2408        else if (Configuration.doAutoCreate())
2409          this.class_ = new CodeableConcept(); // cc
2410      return this.class_;
2411    }
2412
2413    public boolean hasClass_() { 
2414      return this.class_ != null && !this.class_.isEmpty();
2415    }
2416
2417    /**
2418     * @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.)
2419     */
2420    public Composition setClass_(CodeableConcept value) { 
2421      this.class_ = value;
2422      return this;
2423    }
2424
2425    /**
2426     * @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).)
2427     */
2428    public Reference getSubject() { 
2429      if (this.subject == null)
2430        if (Configuration.errorOnAutoCreate())
2431          throw new Error("Attempt to auto-create Composition.subject");
2432        else if (Configuration.doAutoCreate())
2433          this.subject = new Reference(); // cc
2434      return this.subject;
2435    }
2436
2437    public boolean hasSubject() { 
2438      return this.subject != null && !this.subject.isEmpty();
2439    }
2440
2441    /**
2442     * @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).)
2443     */
2444    public Composition setSubject(Reference value) { 
2445      this.subject = value;
2446      return this;
2447    }
2448
2449    /**
2450     * @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).)
2451     */
2452    public Resource getSubjectTarget() { 
2453      return this.subjectTarget;
2454    }
2455
2456    /**
2457     * @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).)
2458     */
2459    public Composition setSubjectTarget(Resource value) { 
2460      this.subjectTarget = value;
2461      return this;
2462    }
2463
2464    /**
2465     * @return {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2466     */
2467    public Reference getEncounter() { 
2468      if (this.encounter == null)
2469        if (Configuration.errorOnAutoCreate())
2470          throw new Error("Attempt to auto-create Composition.encounter");
2471        else if (Configuration.doAutoCreate())
2472          this.encounter = new Reference(); // cc
2473      return this.encounter;
2474    }
2475
2476    public boolean hasEncounter() { 
2477      return this.encounter != null && !this.encounter.isEmpty();
2478    }
2479
2480    /**
2481     * @param value {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2482     */
2483    public Composition setEncounter(Reference value) { 
2484      this.encounter = value;
2485      return this;
2486    }
2487
2488    /**
2489     * @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.)
2490     */
2491    public Encounter getEncounterTarget() { 
2492      if (this.encounterTarget == null)
2493        if (Configuration.errorOnAutoCreate())
2494          throw new Error("Attempt to auto-create Composition.encounter");
2495        else if (Configuration.doAutoCreate())
2496          this.encounterTarget = new Encounter(); // aa
2497      return this.encounterTarget;
2498    }
2499
2500    /**
2501     * @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.)
2502     */
2503    public Composition setEncounterTarget(Encounter value) { 
2504      this.encounterTarget = value;
2505      return this;
2506    }
2507
2508    /**
2509     * @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
2510     */
2511    public DateTimeType getDateElement() { 
2512      if (this.date == null)
2513        if (Configuration.errorOnAutoCreate())
2514          throw new Error("Attempt to auto-create Composition.date");
2515        else if (Configuration.doAutoCreate())
2516          this.date = new DateTimeType(); // bb
2517      return this.date;
2518    }
2519
2520    public boolean hasDateElement() { 
2521      return this.date != null && !this.date.isEmpty();
2522    }
2523
2524    public boolean hasDate() { 
2525      return this.date != null && !this.date.isEmpty();
2526    }
2527
2528    /**
2529     * @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
2530     */
2531    public Composition setDateElement(DateTimeType value) { 
2532      this.date = value;
2533      return this;
2534    }
2535
2536    /**
2537     * @return The composition editing time, when the composition was last logically changed by the author.
2538     */
2539    public Date getDate() { 
2540      return this.date == null ? null : this.date.getValue();
2541    }
2542
2543    /**
2544     * @param value The composition editing time, when the composition was last logically changed by the author.
2545     */
2546    public Composition setDate(Date value) { 
2547        if (this.date == null)
2548          this.date = new DateTimeType();
2549        this.date.setValue(value);
2550      return this;
2551    }
2552
2553    /**
2554     * @return {@link #author} (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
2555     */
2556    public List<Reference> getAuthor() { 
2557      if (this.author == null)
2558        this.author = new ArrayList<Reference>();
2559      return this.author;
2560    }
2561
2562    /**
2563     * @return Returns a reference to <code>this</code> for easy method chaining
2564     */
2565    public Composition setAuthor(List<Reference> theAuthor) { 
2566      this.author = theAuthor;
2567      return this;
2568    }
2569
2570    public boolean hasAuthor() { 
2571      if (this.author == null)
2572        return false;
2573      for (Reference item : this.author)
2574        if (!item.isEmpty())
2575          return true;
2576      return false;
2577    }
2578
2579    public Reference addAuthor() { //3
2580      Reference t = new Reference();
2581      if (this.author == null)
2582        this.author = new ArrayList<Reference>();
2583      this.author.add(t);
2584      return t;
2585    }
2586
2587    public Composition addAuthor(Reference t) { //3
2588      if (t == null)
2589        return this;
2590      if (this.author == null)
2591        this.author = new ArrayList<Reference>();
2592      this.author.add(t);
2593      return this;
2594    }
2595
2596    /**
2597     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
2598     */
2599    public Reference getAuthorFirstRep() { 
2600      if (getAuthor().isEmpty()) {
2601        addAuthor();
2602      }
2603      return getAuthor().get(0);
2604    }
2605
2606    /**
2607     * @deprecated Use Reference#setResource(IBaseResource) instead
2608     */
2609    @Deprecated
2610    public List<Resource> getAuthorTarget() { 
2611      if (this.authorTarget == null)
2612        this.authorTarget = new ArrayList<Resource>();
2613      return this.authorTarget;
2614    }
2615
2616    /**
2617     * @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
2618     */
2619    public StringType getTitleElement() { 
2620      if (this.title == null)
2621        if (Configuration.errorOnAutoCreate())
2622          throw new Error("Attempt to auto-create Composition.title");
2623        else if (Configuration.doAutoCreate())
2624          this.title = new StringType(); // bb
2625      return this.title;
2626    }
2627
2628    public boolean hasTitleElement() { 
2629      return this.title != null && !this.title.isEmpty();
2630    }
2631
2632    public boolean hasTitle() { 
2633      return this.title != null && !this.title.isEmpty();
2634    }
2635
2636    /**
2637     * @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
2638     */
2639    public Composition setTitleElement(StringType value) { 
2640      this.title = value;
2641      return this;
2642    }
2643
2644    /**
2645     * @return Official human-readable label for the composition.
2646     */
2647    public String getTitle() { 
2648      return this.title == null ? null : this.title.getValue();
2649    }
2650
2651    /**
2652     * @param value Official human-readable label for the composition.
2653     */
2654    public Composition setTitle(String value) { 
2655        if (this.title == null)
2656          this.title = new StringType();
2657        this.title.setValue(value);
2658      return this;
2659    }
2660
2661    /**
2662     * @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
2663     */
2664    public Enumeration<DocumentConfidentiality> getConfidentialityElement() { 
2665      if (this.confidentiality == null)
2666        if (Configuration.errorOnAutoCreate())
2667          throw new Error("Attempt to auto-create Composition.confidentiality");
2668        else if (Configuration.doAutoCreate())
2669          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory()); // bb
2670      return this.confidentiality;
2671    }
2672
2673    public boolean hasConfidentialityElement() { 
2674      return this.confidentiality != null && !this.confidentiality.isEmpty();
2675    }
2676
2677    public boolean hasConfidentiality() { 
2678      return this.confidentiality != null && !this.confidentiality.isEmpty();
2679    }
2680
2681    /**
2682     * @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
2683     */
2684    public Composition setConfidentialityElement(Enumeration<DocumentConfidentiality> value) { 
2685      this.confidentiality = value;
2686      return this;
2687    }
2688
2689    /**
2690     * @return The code specifying the level of confidentiality of the Composition.
2691     */
2692    public DocumentConfidentiality getConfidentiality() { 
2693      return this.confidentiality == null ? null : this.confidentiality.getValue();
2694    }
2695
2696    /**
2697     * @param value The code specifying the level of confidentiality of the Composition.
2698     */
2699    public Composition setConfidentiality(DocumentConfidentiality value) { 
2700      if (value == null)
2701        this.confidentiality = null;
2702      else {
2703        if (this.confidentiality == null)
2704          this.confidentiality = new Enumeration<DocumentConfidentiality>(new DocumentConfidentialityEnumFactory());
2705        this.confidentiality.setValue(value);
2706      }
2707      return this;
2708    }
2709
2710    /**
2711     * @return {@link #attester} (A participant who has attested to the accuracy of the composition/document.)
2712     */
2713    public List<CompositionAttesterComponent> getAttester() { 
2714      if (this.attester == null)
2715        this.attester = new ArrayList<CompositionAttesterComponent>();
2716      return this.attester;
2717    }
2718
2719    /**
2720     * @return Returns a reference to <code>this</code> for easy method chaining
2721     */
2722    public Composition setAttester(List<CompositionAttesterComponent> theAttester) { 
2723      this.attester = theAttester;
2724      return this;
2725    }
2726
2727    public boolean hasAttester() { 
2728      if (this.attester == null)
2729        return false;
2730      for (CompositionAttesterComponent item : this.attester)
2731        if (!item.isEmpty())
2732          return true;
2733      return false;
2734    }
2735
2736    public CompositionAttesterComponent addAttester() { //3
2737      CompositionAttesterComponent t = new CompositionAttesterComponent();
2738      if (this.attester == null)
2739        this.attester = new ArrayList<CompositionAttesterComponent>();
2740      this.attester.add(t);
2741      return t;
2742    }
2743
2744    public Composition addAttester(CompositionAttesterComponent t) { //3
2745      if (t == null)
2746        return this;
2747      if (this.attester == null)
2748        this.attester = new ArrayList<CompositionAttesterComponent>();
2749      this.attester.add(t);
2750      return this;
2751    }
2752
2753    /**
2754     * @return The first repetition of repeating field {@link #attester}, creating it if it does not already exist
2755     */
2756    public CompositionAttesterComponent getAttesterFirstRep() { 
2757      if (getAttester().isEmpty()) {
2758        addAttester();
2759      }
2760      return getAttester().get(0);
2761    }
2762
2763    /**
2764     * @return {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2765     */
2766    public Reference getCustodian() { 
2767      if (this.custodian == null)
2768        if (Configuration.errorOnAutoCreate())
2769          throw new Error("Attempt to auto-create Composition.custodian");
2770        else if (Configuration.doAutoCreate())
2771          this.custodian = new Reference(); // cc
2772      return this.custodian;
2773    }
2774
2775    public boolean hasCustodian() { 
2776      return this.custodian != null && !this.custodian.isEmpty();
2777    }
2778
2779    /**
2780     * @param value {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
2781     */
2782    public Composition setCustodian(Reference value) { 
2783      this.custodian = value;
2784      return this;
2785    }
2786
2787    /**
2788     * @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.)
2789     */
2790    public Organization getCustodianTarget() { 
2791      if (this.custodianTarget == null)
2792        if (Configuration.errorOnAutoCreate())
2793          throw new Error("Attempt to auto-create Composition.custodian");
2794        else if (Configuration.doAutoCreate())
2795          this.custodianTarget = new Organization(); // aa
2796      return this.custodianTarget;
2797    }
2798
2799    /**
2800     * @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.)
2801     */
2802    public Composition setCustodianTarget(Organization value) { 
2803      this.custodianTarget = value;
2804      return this;
2805    }
2806
2807    /**
2808     * @return {@link #relatesTo} (Relationships that this composition has with other compositions or documents that already exist.)
2809     */
2810    public List<CompositionRelatesToComponent> getRelatesTo() { 
2811      if (this.relatesTo == null)
2812        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2813      return this.relatesTo;
2814    }
2815
2816    /**
2817     * @return Returns a reference to <code>this</code> for easy method chaining
2818     */
2819    public Composition setRelatesTo(List<CompositionRelatesToComponent> theRelatesTo) { 
2820      this.relatesTo = theRelatesTo;
2821      return this;
2822    }
2823
2824    public boolean hasRelatesTo() { 
2825      if (this.relatesTo == null)
2826        return false;
2827      for (CompositionRelatesToComponent item : this.relatesTo)
2828        if (!item.isEmpty())
2829          return true;
2830      return false;
2831    }
2832
2833    public CompositionRelatesToComponent addRelatesTo() { //3
2834      CompositionRelatesToComponent t = new CompositionRelatesToComponent();
2835      if (this.relatesTo == null)
2836        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2837      this.relatesTo.add(t);
2838      return t;
2839    }
2840
2841    public Composition addRelatesTo(CompositionRelatesToComponent t) { //3
2842      if (t == null)
2843        return this;
2844      if (this.relatesTo == null)
2845        this.relatesTo = new ArrayList<CompositionRelatesToComponent>();
2846      this.relatesTo.add(t);
2847      return this;
2848    }
2849
2850    /**
2851     * @return The first repetition of repeating field {@link #relatesTo}, creating it if it does not already exist
2852     */
2853    public CompositionRelatesToComponent getRelatesToFirstRep() { 
2854      if (getRelatesTo().isEmpty()) {
2855        addRelatesTo();
2856      }
2857      return getRelatesTo().get(0);
2858    }
2859
2860    /**
2861     * @return {@link #event} (The clinical service, such as a colonoscopy or an appendectomy, being documented.)
2862     */
2863    public List<CompositionEventComponent> getEvent() { 
2864      if (this.event == null)
2865        this.event = new ArrayList<CompositionEventComponent>();
2866      return this.event;
2867    }
2868
2869    /**
2870     * @return Returns a reference to <code>this</code> for easy method chaining
2871     */
2872    public Composition setEvent(List<CompositionEventComponent> theEvent) { 
2873      this.event = theEvent;
2874      return this;
2875    }
2876
2877    public boolean hasEvent() { 
2878      if (this.event == null)
2879        return false;
2880      for (CompositionEventComponent item : this.event)
2881        if (!item.isEmpty())
2882          return true;
2883      return false;
2884    }
2885
2886    public CompositionEventComponent addEvent() { //3
2887      CompositionEventComponent t = new CompositionEventComponent();
2888      if (this.event == null)
2889        this.event = new ArrayList<CompositionEventComponent>();
2890      this.event.add(t);
2891      return t;
2892    }
2893
2894    public Composition addEvent(CompositionEventComponent t) { //3
2895      if (t == null)
2896        return this;
2897      if (this.event == null)
2898        this.event = new ArrayList<CompositionEventComponent>();
2899      this.event.add(t);
2900      return this;
2901    }
2902
2903    /**
2904     * @return The first repetition of repeating field {@link #event}, creating it if it does not already exist
2905     */
2906    public CompositionEventComponent getEventFirstRep() { 
2907      if (getEvent().isEmpty()) {
2908        addEvent();
2909      }
2910      return getEvent().get(0);
2911    }
2912
2913    /**
2914     * @return {@link #section} (The root of the sections that make up the composition.)
2915     */
2916    public List<SectionComponent> getSection() { 
2917      if (this.section == null)
2918        this.section = new ArrayList<SectionComponent>();
2919      return this.section;
2920    }
2921
2922    /**
2923     * @return Returns a reference to <code>this</code> for easy method chaining
2924     */
2925    public Composition setSection(List<SectionComponent> theSection) { 
2926      this.section = theSection;
2927      return this;
2928    }
2929
2930    public boolean hasSection() { 
2931      if (this.section == null)
2932        return false;
2933      for (SectionComponent item : this.section)
2934        if (!item.isEmpty())
2935          return true;
2936      return false;
2937    }
2938
2939    public SectionComponent addSection() { //3
2940      SectionComponent t = new SectionComponent();
2941      if (this.section == null)
2942        this.section = new ArrayList<SectionComponent>();
2943      this.section.add(t);
2944      return t;
2945    }
2946
2947    public Composition addSection(SectionComponent t) { //3
2948      if (t == null)
2949        return this;
2950      if (this.section == null)
2951        this.section = new ArrayList<SectionComponent>();
2952      this.section.add(t);
2953      return this;
2954    }
2955
2956    /**
2957     * @return The first repetition of repeating field {@link #section}, creating it if it does not already exist
2958     */
2959    public SectionComponent getSectionFirstRep() { 
2960      if (getSection().isEmpty()) {
2961        addSection();
2962      }
2963      return getSection().get(0);
2964    }
2965
2966      protected void listChildren(List<Property> childrenList) {
2967        super.listChildren(childrenList);
2968        childrenList.add(new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, java.lang.Integer.MAX_VALUE, identifier));
2969        childrenList.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, java.lang.Integer.MAX_VALUE, status));
2970        childrenList.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, java.lang.Integer.MAX_VALUE, type));
2971        childrenList.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, java.lang.Integer.MAX_VALUE, class_));
2972        childrenList.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, java.lang.Integer.MAX_VALUE, subject));
2973        childrenList.add(new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care this documentation is associated with.", 0, java.lang.Integer.MAX_VALUE, encounter));
2974        childrenList.add(new Property("date", "dateTime", "The composition editing time, when the composition was last logically changed by the author.", 0, java.lang.Integer.MAX_VALUE, date));
2975        childrenList.add(new Property("author", "Reference(Practitioner|Device|Patient|RelatedPerson)", "Identifies who is responsible for the information in the composition, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author));
2976        childrenList.add(new Property("title", "string", "Official human-readable label for the composition.", 0, java.lang.Integer.MAX_VALUE, title));
2977        childrenList.add(new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, java.lang.Integer.MAX_VALUE, confidentiality));
2978        childrenList.add(new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 0, java.lang.Integer.MAX_VALUE, attester));
2979        childrenList.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, java.lang.Integer.MAX_VALUE, custodian));
2980        childrenList.add(new Property("relatesTo", "", "Relationships that this composition has with other compositions or documents that already exist.", 0, java.lang.Integer.MAX_VALUE, relatesTo));
2981        childrenList.add(new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 0, java.lang.Integer.MAX_VALUE, event));
2982        childrenList.add(new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section));
2983      }
2984
2985      @Override
2986      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2987        switch (hash) {
2988        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2989        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CompositionStatus>
2990        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2991        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept
2992        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2993        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2994        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2995        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
2996        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
2997        case -1923018202: /*confidentiality*/ return this.confidentiality == null ? new Base[0] : new Base[] {this.confidentiality}; // Enumeration<DocumentConfidentiality>
2998        case 542920370: /*attester*/ return this.attester == null ? new Base[0] : this.attester.toArray(new Base[this.attester.size()]); // CompositionAttesterComponent
2999        case 1611297262: /*custodian*/ return this.custodian == null ? new Base[0] : new Base[] {this.custodian}; // Reference
3000        case -7765931: /*relatesTo*/ return this.relatesTo == null ? new Base[0] : this.relatesTo.toArray(new Base[this.relatesTo.size()]); // CompositionRelatesToComponent
3001        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CompositionEventComponent
3002        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
3003        default: return super.getProperty(hash, name, checkValid);
3004        }
3005
3006      }
3007
3008      @Override
3009      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3010        switch (hash) {
3011        case -1618432855: // identifier
3012          this.identifier = castToIdentifier(value); // Identifier
3013          return value;
3014        case -892481550: // status
3015          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3016          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3017          return value;
3018        case 3575610: // type
3019          this.type = castToCodeableConcept(value); // CodeableConcept
3020          return value;
3021        case 94742904: // class
3022          this.class_ = castToCodeableConcept(value); // CodeableConcept
3023          return value;
3024        case -1867885268: // subject
3025          this.subject = castToReference(value); // Reference
3026          return value;
3027        case 1524132147: // encounter
3028          this.encounter = castToReference(value); // Reference
3029          return value;
3030        case 3076014: // date
3031          this.date = castToDateTime(value); // DateTimeType
3032          return value;
3033        case -1406328437: // author
3034          this.getAuthor().add(castToReference(value)); // Reference
3035          return value;
3036        case 110371416: // title
3037          this.title = castToString(value); // StringType
3038          return value;
3039        case -1923018202: // confidentiality
3040          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3041          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3042          return value;
3043        case 542920370: // attester
3044          this.getAttester().add((CompositionAttesterComponent) value); // CompositionAttesterComponent
3045          return value;
3046        case 1611297262: // custodian
3047          this.custodian = castToReference(value); // Reference
3048          return value;
3049        case -7765931: // relatesTo
3050          this.getRelatesTo().add((CompositionRelatesToComponent) value); // CompositionRelatesToComponent
3051          return value;
3052        case 96891546: // event
3053          this.getEvent().add((CompositionEventComponent) value); // CompositionEventComponent
3054          return value;
3055        case 1970241253: // section
3056          this.getSection().add((SectionComponent) value); // SectionComponent
3057          return value;
3058        default: return super.setProperty(hash, name, value);
3059        }
3060
3061      }
3062
3063      @Override
3064      public Base setProperty(String name, Base value) throws FHIRException {
3065        if (name.equals("identifier")) {
3066          this.identifier = castToIdentifier(value); // Identifier
3067        } else if (name.equals("status")) {
3068          value = new CompositionStatusEnumFactory().fromType(castToCode(value));
3069          this.status = (Enumeration) value; // Enumeration<CompositionStatus>
3070        } else if (name.equals("type")) {
3071          this.type = castToCodeableConcept(value); // CodeableConcept
3072        } else if (name.equals("class")) {
3073          this.class_ = castToCodeableConcept(value); // CodeableConcept
3074        } else if (name.equals("subject")) {
3075          this.subject = castToReference(value); // Reference
3076        } else if (name.equals("encounter")) {
3077          this.encounter = castToReference(value); // Reference
3078        } else if (name.equals("date")) {
3079          this.date = castToDateTime(value); // DateTimeType
3080        } else if (name.equals("author")) {
3081          this.getAuthor().add(castToReference(value));
3082        } else if (name.equals("title")) {
3083          this.title = castToString(value); // StringType
3084        } else if (name.equals("confidentiality")) {
3085          value = new DocumentConfidentialityEnumFactory().fromType(castToCode(value));
3086          this.confidentiality = (Enumeration) value; // Enumeration<DocumentConfidentiality>
3087        } else if (name.equals("attester")) {
3088          this.getAttester().add((CompositionAttesterComponent) value);
3089        } else if (name.equals("custodian")) {
3090          this.custodian = castToReference(value); // Reference
3091        } else if (name.equals("relatesTo")) {
3092          this.getRelatesTo().add((CompositionRelatesToComponent) value);
3093        } else if (name.equals("event")) {
3094          this.getEvent().add((CompositionEventComponent) value);
3095        } else if (name.equals("section")) {
3096          this.getSection().add((SectionComponent) value);
3097        } else
3098          return super.setProperty(name, value);
3099        return value;
3100      }
3101
3102      @Override
3103      public Base makeProperty(int hash, String name) throws FHIRException {
3104        switch (hash) {
3105        case -1618432855:  return getIdentifier(); 
3106        case -892481550:  return getStatusElement();
3107        case 3575610:  return getType(); 
3108        case 94742904:  return getClass_(); 
3109        case -1867885268:  return getSubject(); 
3110        case 1524132147:  return getEncounter(); 
3111        case 3076014:  return getDateElement();
3112        case -1406328437:  return addAuthor(); 
3113        case 110371416:  return getTitleElement();
3114        case -1923018202:  return getConfidentialityElement();
3115        case 542920370:  return addAttester(); 
3116        case 1611297262:  return getCustodian(); 
3117        case -7765931:  return addRelatesTo(); 
3118        case 96891546:  return addEvent(); 
3119        case 1970241253:  return addSection(); 
3120        default: return super.makeProperty(hash, name);
3121        }
3122
3123      }
3124
3125      @Override
3126      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3127        switch (hash) {
3128        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3129        case -892481550: /*status*/ return new String[] {"code"};
3130        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3131        case 94742904: /*class*/ return new String[] {"CodeableConcept"};
3132        case -1867885268: /*subject*/ return new String[] {"Reference"};
3133        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3134        case 3076014: /*date*/ return new String[] {"dateTime"};
3135        case -1406328437: /*author*/ return new String[] {"Reference"};
3136        case 110371416: /*title*/ return new String[] {"string"};
3137        case -1923018202: /*confidentiality*/ return new String[] {"code"};
3138        case 542920370: /*attester*/ return new String[] {};
3139        case 1611297262: /*custodian*/ return new String[] {"Reference"};
3140        case -7765931: /*relatesTo*/ return new String[] {};
3141        case 96891546: /*event*/ return new String[] {};
3142        case 1970241253: /*section*/ return new String[] {};
3143        default: return super.getTypesForProperty(hash, name);
3144        }
3145
3146      }
3147
3148      @Override
3149      public Base addChild(String name) throws FHIRException {
3150        if (name.equals("identifier")) {
3151          this.identifier = new Identifier();
3152          return this.identifier;
3153        }
3154        else if (name.equals("status")) {
3155          throw new FHIRException("Cannot call addChild on a primitive type Composition.status");
3156        }
3157        else if (name.equals("type")) {
3158          this.type = new CodeableConcept();
3159          return this.type;
3160        }
3161        else if (name.equals("class")) {
3162          this.class_ = new CodeableConcept();
3163          return this.class_;
3164        }
3165        else if (name.equals("subject")) {
3166          this.subject = new Reference();
3167          return this.subject;
3168        }
3169        else if (name.equals("encounter")) {
3170          this.encounter = new Reference();
3171          return this.encounter;
3172        }
3173        else if (name.equals("date")) {
3174          throw new FHIRException("Cannot call addChild on a primitive type Composition.date");
3175        }
3176        else if (name.equals("author")) {
3177          return addAuthor();
3178        }
3179        else if (name.equals("title")) {
3180          throw new FHIRException("Cannot call addChild on a primitive type Composition.title");
3181        }
3182        else if (name.equals("confidentiality")) {
3183          throw new FHIRException("Cannot call addChild on a primitive type Composition.confidentiality");
3184        }
3185        else if (name.equals("attester")) {
3186          return addAttester();
3187        }
3188        else if (name.equals("custodian")) {
3189          this.custodian = new Reference();
3190          return this.custodian;
3191        }
3192        else if (name.equals("relatesTo")) {
3193          return addRelatesTo();
3194        }
3195        else if (name.equals("event")) {
3196          return addEvent();
3197        }
3198        else if (name.equals("section")) {
3199          return addSection();
3200        }
3201        else
3202          return super.addChild(name);
3203      }
3204
3205  public String fhirType() {
3206    return "Composition";
3207
3208  }
3209
3210      public Composition copy() {
3211        Composition dst = new Composition();
3212        copyValues(dst);
3213        dst.identifier = identifier == null ? null : identifier.copy();
3214        dst.status = status == null ? null : status.copy();
3215        dst.type = type == null ? null : type.copy();
3216        dst.class_ = class_ == null ? null : class_.copy();
3217        dst.subject = subject == null ? null : subject.copy();
3218        dst.encounter = encounter == null ? null : encounter.copy();
3219        dst.date = date == null ? null : date.copy();
3220        if (author != null) {
3221          dst.author = new ArrayList<Reference>();
3222          for (Reference i : author)
3223            dst.author.add(i.copy());
3224        };
3225        dst.title = title == null ? null : title.copy();
3226        dst.confidentiality = confidentiality == null ? null : confidentiality.copy();
3227        if (attester != null) {
3228          dst.attester = new ArrayList<CompositionAttesterComponent>();
3229          for (CompositionAttesterComponent i : attester)
3230            dst.attester.add(i.copy());
3231        };
3232        dst.custodian = custodian == null ? null : custodian.copy();
3233        if (relatesTo != null) {
3234          dst.relatesTo = new ArrayList<CompositionRelatesToComponent>();
3235          for (CompositionRelatesToComponent i : relatesTo)
3236            dst.relatesTo.add(i.copy());
3237        };
3238        if (event != null) {
3239          dst.event = new ArrayList<CompositionEventComponent>();
3240          for (CompositionEventComponent i : event)
3241            dst.event.add(i.copy());
3242        };
3243        if (section != null) {
3244          dst.section = new ArrayList<SectionComponent>();
3245          for (SectionComponent i : section)
3246            dst.section.add(i.copy());
3247        };
3248        return dst;
3249      }
3250
3251      protected Composition typedCopy() {
3252        return copy();
3253      }
3254
3255      @Override
3256      public boolean equalsDeep(Base other) {
3257        if (!super.equalsDeep(other))
3258          return false;
3259        if (!(other instanceof Composition))
3260          return false;
3261        Composition o = (Composition) other;
3262        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
3263           && compareDeep(class_, o.class_, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
3264           && compareDeep(date, o.date, true) && compareDeep(author, o.author, true) && compareDeep(title, o.title, true)
3265           && compareDeep(confidentiality, o.confidentiality, true) && compareDeep(attester, o.attester, true)
3266           && compareDeep(custodian, o.custodian, true) && compareDeep(relatesTo, o.relatesTo, true) && compareDeep(event, o.event, true)
3267           && compareDeep(section, o.section, true);
3268      }
3269
3270      @Override
3271      public boolean equalsShallow(Base other) {
3272        if (!super.equalsShallow(other))
3273          return false;
3274        if (!(other instanceof Composition))
3275          return false;
3276        Composition o = (Composition) other;
3277        return compareValues(status, o.status, true) && compareValues(date, o.date, true) && compareValues(title, o.title, true)
3278           && compareValues(confidentiality, o.confidentiality, true);
3279      }
3280
3281      public boolean isEmpty() {
3282        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
3283          , class_, subject, encounter, date, author, title, confidentiality, attester
3284          , custodian, relatesTo, event, section);
3285      }
3286
3287  @Override
3288  public ResourceType getResourceType() {
3289    return ResourceType.Composition;
3290   }
3291
3292 /**
3293   * Search parameter: <b>date</b>
3294   * <p>
3295   * Description: <b>Composition editing time</b><br>
3296   * Type: <b>date</b><br>
3297   * Path: <b>Composition.date</b><br>
3298   * </p>
3299   */
3300  @SearchParamDefinition(name="date", path="Composition.date", description="Composition editing time", type="date" )
3301  public static final String SP_DATE = "date";
3302 /**
3303   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3304   * <p>
3305   * Description: <b>Composition editing time</b><br>
3306   * Type: <b>date</b><br>
3307   * Path: <b>Composition.date</b><br>
3308   * </p>
3309   */
3310  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3311
3312 /**
3313   * Search parameter: <b>identifier</b>
3314   * <p>
3315   * Description: <b>Logical identifier of composition (version-independent)</b><br>
3316   * Type: <b>token</b><br>
3317   * Path: <b>Composition.identifier</b><br>
3318   * </p>
3319   */
3320  @SearchParamDefinition(name="identifier", path="Composition.identifier", description="Logical identifier of composition (version-independent)", type="token" )
3321  public static final String SP_IDENTIFIER = "identifier";
3322 /**
3323   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3324   * <p>
3325   * Description: <b>Logical identifier of composition (version-independent)</b><br>
3326   * Type: <b>token</b><br>
3327   * Path: <b>Composition.identifier</b><br>
3328   * </p>
3329   */
3330  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3331
3332 /**
3333   * Search parameter: <b>period</b>
3334   * <p>
3335   * Description: <b>The period covered by the documentation</b><br>
3336   * Type: <b>date</b><br>
3337   * Path: <b>Composition.event.period</b><br>
3338   * </p>
3339   */
3340  @SearchParamDefinition(name="period", path="Composition.event.period", description="The period covered by the documentation", type="date" )
3341  public static final String SP_PERIOD = "period";
3342 /**
3343   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3344   * <p>
3345   * Description: <b>The period covered by the documentation</b><br>
3346   * Type: <b>date</b><br>
3347   * Path: <b>Composition.event.period</b><br>
3348   * </p>
3349   */
3350  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
3351
3352 /**
3353   * Search parameter: <b>related-id</b>
3354   * <p>
3355   * Description: <b>Target of the relationship</b><br>
3356   * Type: <b>token</b><br>
3357   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3358   * </p>
3359   */
3360  @SearchParamDefinition(name="related-id", path="Composition.relatesTo.target.as(Identifier)", description="Target of the relationship", type="token" )
3361  public static final String SP_RELATED_ID = "related-id";
3362 /**
3363   * <b>Fluent Client</b> search parameter constant for <b>related-id</b>
3364   * <p>
3365   * Description: <b>Target of the relationship</b><br>
3366   * Type: <b>token</b><br>
3367   * Path: <b>Composition.relatesTo.targetIdentifier</b><br>
3368   * </p>
3369   */
3370  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RELATED_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_RELATED_ID);
3371
3372 /**
3373   * Search parameter: <b>subject</b>
3374   * <p>
3375   * Description: <b>Who and/or what the composition is about</b><br>
3376   * Type: <b>reference</b><br>
3377   * Path: <b>Composition.subject</b><br>
3378   * </p>
3379   */
3380  @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") } )
3381  public static final String SP_SUBJECT = "subject";
3382 /**
3383   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3384   * <p>
3385   * Description: <b>Who and/or what the composition is about</b><br>
3386   * Type: <b>reference</b><br>
3387   * Path: <b>Composition.subject</b><br>
3388   * </p>
3389   */
3390  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3391
3392/**
3393   * Constant for fluent queries to be used to add include statements. Specifies
3394   * the path value of "<b>Composition:subject</b>".
3395   */
3396  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Composition:subject").toLocked();
3397
3398 /**
3399   * Search parameter: <b>author</b>
3400   * <p>
3401   * Description: <b>Who and/or what authored the composition</b><br>
3402   * Type: <b>reference</b><br>
3403   * Path: <b>Composition.author</b><br>
3404   * </p>
3405   */
3406  @SearchParamDefinition(name="author", path="Composition.author", description="Who and/or what authored the composition", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3407  public static final String SP_AUTHOR = "author";
3408 /**
3409   * <b>Fluent Client</b> search parameter constant for <b>author</b>
3410   * <p>
3411   * Description: <b>Who and/or what authored the composition</b><br>
3412   * Type: <b>reference</b><br>
3413   * Path: <b>Composition.author</b><br>
3414   * </p>
3415   */
3416  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
3417
3418/**
3419   * Constant for fluent queries to be used to add include statements. Specifies
3420   * the path value of "<b>Composition:author</b>".
3421   */
3422  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Composition:author").toLocked();
3423
3424 /**
3425   * Search parameter: <b>confidentiality</b>
3426   * <p>
3427   * Description: <b>As defined by affinity domain</b><br>
3428   * Type: <b>token</b><br>
3429   * Path: <b>Composition.confidentiality</b><br>
3430   * </p>
3431   */
3432  @SearchParamDefinition(name="confidentiality", path="Composition.confidentiality", description="As defined by affinity domain", type="token" )
3433  public static final String SP_CONFIDENTIALITY = "confidentiality";
3434 /**
3435   * <b>Fluent Client</b> search parameter constant for <b>confidentiality</b>
3436   * <p>
3437   * Description: <b>As defined by affinity domain</b><br>
3438   * Type: <b>token</b><br>
3439   * Path: <b>Composition.confidentiality</b><br>
3440   * </p>
3441   */
3442  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONFIDENTIALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONFIDENTIALITY);
3443
3444 /**
3445   * Search parameter: <b>section</b>
3446   * <p>
3447   * Description: <b>Classification of section (recommended)</b><br>
3448   * Type: <b>token</b><br>
3449   * Path: <b>Composition.section.code</b><br>
3450   * </p>
3451   */
3452  @SearchParamDefinition(name="section", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
3453  public static final String SP_SECTION = "section";
3454 /**
3455   * <b>Fluent Client</b> search parameter constant for <b>section</b>
3456   * <p>
3457   * Description: <b>Classification of section (recommended)</b><br>
3458   * Type: <b>token</b><br>
3459   * Path: <b>Composition.section.code</b><br>
3460   * </p>
3461   */
3462  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECTION);
3463
3464 /**
3465   * Search parameter: <b>encounter</b>
3466   * <p>
3467   * Description: <b>Context of the Composition</b><br>
3468   * Type: <b>reference</b><br>
3469   * Path: <b>Composition.encounter</b><br>
3470   * </p>
3471   */
3472  @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 } )
3473  public static final String SP_ENCOUNTER = "encounter";
3474 /**
3475   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3476   * <p>
3477   * Description: <b>Context of the Composition</b><br>
3478   * Type: <b>reference</b><br>
3479   * Path: <b>Composition.encounter</b><br>
3480   * </p>
3481   */
3482  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3483
3484/**
3485   * Constant for fluent queries to be used to add include statements. Specifies
3486   * the path value of "<b>Composition:encounter</b>".
3487   */
3488  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Composition:encounter").toLocked();
3489
3490 /**
3491   * Search parameter: <b>type</b>
3492   * <p>
3493   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3494   * Type: <b>token</b><br>
3495   * Path: <b>Composition.type</b><br>
3496   * </p>
3497   */
3498  @SearchParamDefinition(name="type", path="Composition.type", description="Kind of composition (LOINC if possible)", type="token" )
3499  public static final String SP_TYPE = "type";
3500 /**
3501   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3502   * <p>
3503   * Description: <b>Kind of composition (LOINC if possible)</b><br>
3504   * Type: <b>token</b><br>
3505   * Path: <b>Composition.type</b><br>
3506   * </p>
3507   */
3508  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3509
3510 /**
3511   * Search parameter: <b>title</b>
3512   * <p>
3513   * Description: <b>Human Readable name/title</b><br>
3514   * Type: <b>string</b><br>
3515   * Path: <b>Composition.title</b><br>
3516   * </p>
3517   */
3518  @SearchParamDefinition(name="title", path="Composition.title", description="Human Readable name/title", type="string" )
3519  public static final String SP_TITLE = "title";
3520 /**
3521   * <b>Fluent Client</b> search parameter constant for <b>title</b>
3522   * <p>
3523   * Description: <b>Human Readable name/title</b><br>
3524   * Type: <b>string</b><br>
3525   * Path: <b>Composition.title</b><br>
3526   * </p>
3527   */
3528  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
3529
3530 /**
3531   * Search parameter: <b>attester</b>
3532   * <p>
3533   * Description: <b>Who attested the composition</b><br>
3534   * Type: <b>reference</b><br>
3535   * Path: <b>Composition.attester.party</b><br>
3536   * </p>
3537   */
3538  @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 } )
3539  public static final String SP_ATTESTER = "attester";
3540 /**
3541   * <b>Fluent Client</b> search parameter constant for <b>attester</b>
3542   * <p>
3543   * Description: <b>Who attested the composition</b><br>
3544   * Type: <b>reference</b><br>
3545   * Path: <b>Composition.attester.party</b><br>
3546   * </p>
3547   */
3548  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ATTESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ATTESTER);
3549
3550/**
3551   * Constant for fluent queries to be used to add include statements. Specifies
3552   * the path value of "<b>Composition:attester</b>".
3553   */
3554  public static final ca.uhn.fhir.model.api.Include INCLUDE_ATTESTER = new ca.uhn.fhir.model.api.Include("Composition:attester").toLocked();
3555
3556 /**
3557   * Search parameter: <b>entry</b>
3558   * <p>
3559   * Description: <b>A reference to data that supports this section</b><br>
3560   * Type: <b>reference</b><br>
3561   * Path: <b>Composition.section.entry</b><br>
3562   * </p>
3563   */
3564  @SearchParamDefinition(name="entry", path="Composition.section.entry", description="A reference to data that supports this section", type="reference" )
3565  public static final String SP_ENTRY = "entry";
3566 /**
3567   * <b>Fluent Client</b> search parameter constant for <b>entry</b>
3568   * <p>
3569   * Description: <b>A reference to data that supports this section</b><br>
3570   * Type: <b>reference</b><br>
3571   * Path: <b>Composition.section.entry</b><br>
3572   * </p>
3573   */
3574  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTRY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTRY);
3575
3576/**
3577   * Constant for fluent queries to be used to add include statements. Specifies
3578   * the path value of "<b>Composition:entry</b>".
3579   */
3580  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTRY = new ca.uhn.fhir.model.api.Include("Composition:entry").toLocked();
3581
3582 /**
3583   * Search parameter: <b>related-ref</b>
3584   * <p>
3585   * Description: <b>Target of the relationship</b><br>
3586   * Type: <b>reference</b><br>
3587   * Path: <b>Composition.relatesTo.targetReference</b><br>
3588   * </p>
3589   */
3590  @SearchParamDefinition(name="related-ref", path="Composition.relatesTo.target.as(Reference)", description="Target of the relationship", type="reference", target={Composition.class } )
3591  public static final String SP_RELATED_REF = "related-ref";
3592 /**
3593   * <b>Fluent Client</b> search parameter constant for <b>related-ref</b>
3594   * <p>
3595   * Description: <b>Target of the relationship</b><br>
3596   * Type: <b>reference</b><br>
3597   * Path: <b>Composition.relatesTo.targetReference</b><br>
3598   * </p>
3599   */
3600  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RELATED_REF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RELATED_REF);
3601
3602/**
3603   * Constant for fluent queries to be used to add include statements. Specifies
3604   * the path value of "<b>Composition:related-ref</b>".
3605   */
3606  public static final ca.uhn.fhir.model.api.Include INCLUDE_RELATED_REF = new ca.uhn.fhir.model.api.Include("Composition:related-ref").toLocked();
3607
3608 /**
3609   * Search parameter: <b>patient</b>
3610   * <p>
3611   * Description: <b>Who and/or what the composition is about</b><br>
3612   * Type: <b>reference</b><br>
3613   * Path: <b>Composition.subject</b><br>
3614   * </p>
3615   */
3616  @SearchParamDefinition(name="patient", path="Composition.subject", description="Who and/or what the composition is about", type="reference", target={Patient.class } )
3617  public static final String SP_PATIENT = "patient";
3618 /**
3619   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3620   * <p>
3621   * Description: <b>Who and/or what the composition is about</b><br>
3622   * Type: <b>reference</b><br>
3623   * Path: <b>Composition.subject</b><br>
3624   * </p>
3625   */
3626  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3627
3628/**
3629   * Constant for fluent queries to be used to add include statements. Specifies
3630   * the path value of "<b>Composition:patient</b>".
3631   */
3632  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Composition:patient").toLocked();
3633
3634 /**
3635   * Search parameter: <b>context</b>
3636   * <p>
3637   * Description: <b>Code(s) that apply to the event being documented</b><br>
3638   * Type: <b>token</b><br>
3639   * Path: <b>Composition.event.code</b><br>
3640   * </p>
3641   */
3642  @SearchParamDefinition(name="context", path="Composition.event.code", description="Code(s) that apply to the event being documented", type="token" )
3643  public static final String SP_CONTEXT = "context";
3644 /**
3645   * <b>Fluent Client</b> search parameter constant for <b>context</b>
3646   * <p>
3647   * Description: <b>Code(s) that apply to the event being documented</b><br>
3648   * Type: <b>token</b><br>
3649   * Path: <b>Composition.event.code</b><br>
3650   * </p>
3651   */
3652  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
3653
3654 /**
3655   * Search parameter: <b>class</b>
3656   * <p>
3657   * Description: <b>Categorization of Composition</b><br>
3658   * Type: <b>token</b><br>
3659   * Path: <b>Composition.class</b><br>
3660   * </p>
3661   */
3662  @SearchParamDefinition(name="class", path="Composition.class", description="Categorization of Composition", type="token" )
3663  public static final String SP_CLASS = "class";
3664 /**
3665   * <b>Fluent Client</b> search parameter constant for <b>class</b>
3666   * <p>
3667   * Description: <b>Categorization of Composition</b><br>
3668   * Type: <b>token</b><br>
3669   * Path: <b>Composition.class</b><br>
3670   * </p>
3671   */
3672  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS);
3673
3674 /**
3675   * Search parameter: <b>status</b>
3676   * <p>
3677   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3678   * Type: <b>token</b><br>
3679   * Path: <b>Composition.status</b><br>
3680   * </p>
3681   */
3682  @SearchParamDefinition(name="status", path="Composition.status", description="preliminary | final | amended | entered-in-error", type="token" )
3683  public static final String SP_STATUS = "status";
3684 /**
3685   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3686   * <p>
3687   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
3688   * Type: <b>token</b><br>
3689   * Path: <b>Composition.status</b><br>
3690   * </p>
3691   */
3692  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3693
3694
3695}
3696