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