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