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