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