001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * 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.
051 */
052@ResourceDef(name="Composition", profile="http://hl7.org/fhir/Profile/Composition")
053public class Composition extends DomainResource {
054
055    public enum CompositionStatus {
056        /**
057         * This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.
058         */
059        PRELIMINARY, 
060        /**
061         * 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.
062         */
063        FINAL, 
064        /**
065         * 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.
066         */
067        AMENDED, 
068        /**
069         * 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.
070         */
071        ENTEREDINERROR, 
072        /**
073         * added to help the parsers
074         */
075        NULL;
076        public static CompositionStatus fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("preliminary".equals(codeString))
080          return PRELIMINARY;
081        if ("final".equals(codeString))
082          return FINAL;
083        if ("amended".equals(codeString))
084          return AMENDED;
085        if ("entered-in-error".equals(codeString))
086          return ENTEREDINERROR;
087        throw new FHIRException("Unknown CompositionStatus code '"+codeString+"'");
088        }
089        public String toCode() {
090          switch (this) {
091            case PRELIMINARY: return "preliminary";
092            case FINAL: return "final";
093            case AMENDED: return "amended";
094            case ENTEREDINERROR: return "entered-in-error";
095            case NULL: return null;
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case PRELIMINARY: return "http://hl7.org/fhir/composition-status";
102            case FINAL: return "http://hl7.org/fhir/composition-status";
103            case AMENDED: return "http://hl7.org/fhir/composition-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/composition-status";
105            case NULL: return null;
106            default: return "?";
107          }
108        }
109        public String getDefinition() {
110          switch (this) {
111            case PRELIMINARY: return "This is a preliminary composition or document (also known as initial or interim). The content may be incomplete or unverified.";
112            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.";
113            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.";
114            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.";
115            case NULL: return null;
116            default: return "?";
117          }
118        }
119        public String getDisplay() {
120          switch (this) {
121            case PRELIMINARY: return "Preliminary";
122            case FINAL: return "Final";
123            case AMENDED: return "Amended";
124            case ENTEREDINERROR: return "Entered in Error";
125            case NULL: return null;
126            default: return "?";
127          }
128        }
129    }
130
131  public static class CompositionStatusEnumFactory implements EnumFactory<CompositionStatus> {
132    public CompositionStatus fromCode(String codeString) throws IllegalArgumentException {
133      if (codeString == null || "".equals(codeString))
134            if (codeString == null || "".equals(codeString))
135                return null;
136        if ("preliminary".equals(codeString))
137          return CompositionStatus.PRELIMINARY;
138        if ("final".equals(codeString))
139          return CompositionStatus.FINAL;
140        if ("amended".equals(codeString))
141          return CompositionStatus.AMENDED;
142        if ("entered-in-error".equals(codeString))
143          return CompositionStatus.ENTEREDINERROR;
144        throw new IllegalArgumentException("Unknown CompositionStatus code '"+codeString+"'");
145        }
146        public Enumeration<CompositionStatus> fromType(Base code) throws FHIRException {
147          if (code == null || code.isEmpty())
148            return null;
149          String codeString = ((PrimitiveType) code).asStringValue();
150          if (codeString == null || "".equals(codeString))
151            return null;
152        if ("preliminary".equals(codeString))
153          return new Enumeration<CompositionStatus>(this, CompositionStatus.PRELIMINARY);
154        if ("final".equals(codeString))
155          return new Enumeration<CompositionStatus>(this, CompositionStatus.FINAL);
156        if ("amended".equals(codeString))
157          return new Enumeration<CompositionStatus>(this, CompositionStatus.AMENDED);
158        if ("entered-in-error".equals(codeString))
159          return new Enumeration<CompositionStatus>(this, CompositionStatus.ENTEREDINERROR);
160        throw new FHIRException("Unknown CompositionStatus code '"+codeString+"'");
161        }
162    public String toCode(CompositionStatus code) {
163      if (code == CompositionStatus.PRELIMINARY)
164        return "preliminary";
165      if (code == CompositionStatus.FINAL)
166        return "final";
167      if (code == CompositionStatus.AMENDED)
168        return "amended";
169      if (code == CompositionStatus.ENTEREDINERROR)
170        return "entered-in-error";
171      return "?";
172      }
173    public String toSystem(CompositionStatus code) {
174      return code.getSystem();
175      }
176    }
177
178    public enum CompositionAttestationMode {
179        /**
180         * The person authenticated the content in their personal capacity.
181         */
182        PERSONAL, 
183        /**
184         * The person authenticated the content in their professional capacity.
185         */
186        PROFESSIONAL, 
187        /**
188         * The person authenticated the content and accepted legal responsibility for its content.
189         */
190        LEGAL, 
191        /**
192         * The organization authenticated the content as consistent with their policies and procedures.
193         */
194        OFFICIAL, 
195        /**
196         * added to help the parsers
197         */
198        NULL;
199        public static CompositionAttestationMode fromCode(String codeString) throws FHIRException {
200            if (codeString == null || "".equals(codeString))
201                return null;
202        if ("personal".equals(codeString))
203          return PERSONAL;
204        if ("professional".equals(codeString))
205          return PROFESSIONAL;
206        if ("legal".equals(codeString))
207          return LEGAL;
208        if ("official".equals(codeString))
209          return OFFICIAL;
210        throw new FHIRException("Unknown CompositionAttestationMode code '"+codeString+"'");
211        }
212        public String toCode() {
213          switch (this) {
214            case PERSONAL: return "personal";
215            case PROFESSIONAL: return "professional";
216            case LEGAL: return "legal";
217            case OFFICIAL: return "official";
218            case NULL: return null;
219            default: return "?";
220          }
221        }
222        public String getSystem() {
223          switch (this) {
224            case PERSONAL: return "http://hl7.org/fhir/composition-attestation-mode";
225            case PROFESSIONAL: return "http://hl7.org/fhir/composition-attestation-mode";
226            case LEGAL: return "http://hl7.org/fhir/composition-attestation-mode";
227            case OFFICIAL: return "http://hl7.org/fhir/composition-attestation-mode";
228            case NULL: return null;
229            default: return "?";
230          }
231        }
232        public String getDefinition() {
233          switch (this) {
234            case PERSONAL: return "The person authenticated the content in their personal capacity.";
235            case PROFESSIONAL: return "The person authenticated the content in their professional capacity.";
236            case LEGAL: return "The person authenticated the content and accepted legal responsibility for its content.";
237            case OFFICIAL: return "The organization authenticated the content as consistent with their policies and procedures.";
238            case NULL: return null;
239            default: return "?";
240          }
241        }
242        public String getDisplay() {
243          switch (this) {
244            case PERSONAL: return "Personal";
245            case PROFESSIONAL: return "Professional";
246            case LEGAL: return "Legal";
247            case OFFICIAL: return "Official";
248            case NULL: return null;
249            default: return "?";
250          }
251        }
252    }
253
254  public static class CompositionAttestationModeEnumFactory implements EnumFactory<CompositionAttestationMode> {
255    public CompositionAttestationMode fromCode(String codeString) throws IllegalArgumentException {
256      if (codeString == null || "".equals(codeString))
257            if (codeString == null || "".equals(codeString))
258                return null;
259        if ("personal".equals(codeString))
260          return CompositionAttestationMode.PERSONAL;
261        if ("professional".equals(codeString))
262          return CompositionAttestationMode.PROFESSIONAL;
263        if ("legal".equals(codeString))
264          return CompositionAttestationMode.LEGAL;
265        if ("official".equals(codeString))
266          return CompositionAttestationMode.OFFICIAL;
267        throw new IllegalArgumentException("Unknown CompositionAttestationMode code '"+codeString+"'");
268        }
269        public Enumeration<CompositionAttestationMode> fromType(Base code) throws FHIRException {
270          if (code == null || code.isEmpty())
271            return null;
272          String codeString = ((PrimitiveType) code).asStringValue();
273          if (codeString == null || "".equals(codeString))
274            return null;
275        if ("personal".equals(codeString))
276          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PERSONAL);
277        if ("professional".equals(codeString))
278          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.PROFESSIONAL);
279        if ("legal".equals(codeString))
280          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.LEGAL);
281        if ("official".equals(codeString))
282          return new Enumeration<CompositionAttestationMode>(this, CompositionAttestationMode.OFFICIAL);
283        throw new FHIRException("Unknown CompositionAttestationMode code '"+codeString+"'");
284        }
285    public String toCode(CompositionAttestationMode code) {
286      if (code == CompositionAttestationMode.PERSONAL)
287        return "personal";
288      if (code == CompositionAttestationMode.PROFESSIONAL)
289        return "professional";
290      if (code == CompositionAttestationMode.LEGAL)
291        return "legal";
292      if (code == CompositionAttestationMode.OFFICIAL)
293        return "official";
294      return "?";
295      }
296    public String toSystem(CompositionAttestationMode code) {
297      return code.getSystem();
298      }
299    }
300
301    @Block()
302    public static class CompositionAttesterComponent extends BackboneElement implements IBaseBackboneElement {
303        /**
304         * The type of attestation the authenticator offers.
305         */
306        @Child(name = "mode", type = {CodeType.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
307        @Description(shortDefinition="personal | professional | legal | official", formalDefinition="The type of attestation the authenticator offers." )
308        protected List<Enumeration<CompositionAttestationMode>> mode;
309
310        /**
311         * When composition was attested by the party.
312         */
313        @Child(name = "time", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
314        @Description(shortDefinition="When composition attested", formalDefinition="When composition was attested by the party." )
315        protected DateTimeType time;
316
317        /**
318         * Who attested the composition in the specified way.
319         */
320        @Child(name = "party", type = {Patient.class, Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
321        @Description(shortDefinition="Who attested the composition", formalDefinition="Who attested the composition in the specified way." )
322        protected Reference party;
323
324        /**
325         * The actual object that is the target of the reference (Who attested the composition in the specified way.)
326         */
327        protected Resource partyTarget;
328
329        private static final long serialVersionUID = -436604745L;
330
331    /**
332     * Constructor
333     */
334      public CompositionAttesterComponent() {
335        super();
336      }
337
338        /**
339         * @return {@link #mode} (The type of attestation the authenticator offers.)
340         */
341        public List<Enumeration<CompositionAttestationMode>> getMode() { 
342          if (this.mode == null)
343            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
344          return this.mode;
345        }
346
347        public boolean hasMode() { 
348          if (this.mode == null)
349            return false;
350          for (Enumeration<CompositionAttestationMode> item : this.mode)
351            if (!item.isEmpty())
352              return true;
353          return false;
354        }
355
356        /**
357         * @return {@link #mode} (The type of attestation the authenticator offers.)
358         */
359    // syntactic sugar
360        public Enumeration<CompositionAttestationMode> addModeElement() {//2 
361          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
362          if (this.mode == null)
363            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
364          this.mode.add(t);
365          return t;
366        }
367
368        /**
369         * @param value {@link #mode} (The type of attestation the authenticator offers.)
370         */
371        public CompositionAttesterComponent addMode(CompositionAttestationMode value) { //1
372          Enumeration<CompositionAttestationMode> t = new Enumeration<CompositionAttestationMode>(new CompositionAttestationModeEnumFactory());
373          t.setValue(value);
374          if (this.mode == null)
375            this.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
376          this.mode.add(t);
377          return this;
378        }
379
380        /**
381         * @param value {@link #mode} (The type of attestation the authenticator offers.)
382         */
383        public boolean hasMode(CompositionAttestationMode value) { 
384          if (this.mode == null)
385            return false;
386          for (Enumeration<CompositionAttestationMode> v : this.mode)
387            if (v.getValue().equals(value)) // code
388              return true;
389          return false;
390        }
391
392        /**
393         * @return {@link #time} (When 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
394         */
395        public DateTimeType getTimeElement() { 
396          if (this.time == null)
397            if (Configuration.errorOnAutoCreate())
398              throw new Error("Attempt to auto-create CompositionAttesterComponent.time");
399            else if (Configuration.doAutoCreate())
400              this.time = new DateTimeType(); // bb
401          return this.time;
402        }
403
404        public boolean hasTimeElement() { 
405          return this.time != null && !this.time.isEmpty();
406        }
407
408        public boolean hasTime() { 
409          return this.time != null && !this.time.isEmpty();
410        }
411
412        /**
413         * @param value {@link #time} (When 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
414         */
415        public CompositionAttesterComponent setTimeElement(DateTimeType value) { 
416          this.time = value;
417          return this;
418        }
419
420        /**
421         * @return When composition was attested by the party.
422         */
423        public Date getTime() { 
424          return this.time == null ? null : this.time.getValue();
425        }
426
427        /**
428         * @param value When composition was attested by the party.
429         */
430        public CompositionAttesterComponent setTime(Date value) { 
431          if (value == null)
432            this.time = null;
433          else {
434            if (this.time == null)
435              this.time = new DateTimeType();
436            this.time.setValue(value);
437          }
438          return this;
439        }
440
441        /**
442         * @return {@link #party} (Who attested the composition in the specified way.)
443         */
444        public Reference getParty() { 
445          if (this.party == null)
446            if (Configuration.errorOnAutoCreate())
447              throw new Error("Attempt to auto-create CompositionAttesterComponent.party");
448            else if (Configuration.doAutoCreate())
449              this.party = new Reference(); // cc
450          return this.party;
451        }
452
453        public boolean hasParty() { 
454          return this.party != null && !this.party.isEmpty();
455        }
456
457        /**
458         * @param value {@link #party} (Who attested the composition in the specified way.)
459         */
460        public CompositionAttesterComponent setParty(Reference value) { 
461          this.party = value;
462          return this;
463        }
464
465        /**
466         * @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.)
467         */
468        public Resource getPartyTarget() { 
469          return this.partyTarget;
470        }
471
472        /**
473         * @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.)
474         */
475        public CompositionAttesterComponent setPartyTarget(Resource value) { 
476          this.partyTarget = value;
477          return this;
478        }
479
480        protected void listChildren(List<Property> childrenList) {
481          super.listChildren(childrenList);
482          childrenList.add(new Property("mode", "code", "The type of attestation the authenticator offers.", 0, java.lang.Integer.MAX_VALUE, mode));
483          childrenList.add(new Property("time", "dateTime", "When composition was attested by the party.", 0, java.lang.Integer.MAX_VALUE, time));
484          childrenList.add(new Property("party", "Reference(Patient|Practitioner|Organization)", "Who attested the composition in the specified way.", 0, java.lang.Integer.MAX_VALUE, party));
485        }
486
487      @Override
488      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
489        switch (hash) {
490        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : this.mode.toArray(new Base[this.mode.size()]); // Enumeration<CompositionAttestationMode>
491        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType
492        case 106437350: /*party*/ return this.party == null ? new Base[0] : new Base[] {this.party}; // Reference
493        default: return super.getProperty(hash, name, checkValid);
494        }
495
496      }
497
498      @Override
499      public void setProperty(int hash, String name, Base value) throws FHIRException {
500        switch (hash) {
501        case 3357091: // mode
502          this.getMode().add(new CompositionAttestationModeEnumFactory().fromType(value)); // Enumeration<CompositionAttestationMode>
503          break;
504        case 3560141: // time
505          this.time = castToDateTime(value); // DateTimeType
506          break;
507        case 106437350: // party
508          this.party = castToReference(value); // Reference
509          break;
510        default: super.setProperty(hash, name, value);
511        }
512
513      }
514
515      @Override
516      public void setProperty(String name, Base value) throws FHIRException {
517        if (name.equals("mode"))
518          this.getMode().add(new CompositionAttestationModeEnumFactory().fromType(value));
519        else if (name.equals("time"))
520          this.time = castToDateTime(value); // DateTimeType
521        else if (name.equals("party"))
522          this.party = castToReference(value); // Reference
523        else
524          super.setProperty(name, value);
525      }
526
527      @Override
528      public Base makeProperty(int hash, String name) throws FHIRException {
529        switch (hash) {
530        case 3357091: throw new FHIRException("Cannot make property mode as it is not a complex type"); // Enumeration<CompositionAttestationMode>
531        case 3560141: throw new FHIRException("Cannot make property time as it is not a complex type"); // DateTimeType
532        case 106437350:  return getParty(); // Reference
533        default: return super.makeProperty(hash, name);
534        }
535
536      }
537
538      @Override
539      public Base addChild(String name) throws FHIRException {
540        if (name.equals("mode")) {
541          throw new FHIRException("Cannot call addChild on a primitive type Composition.mode");
542        }
543        else if (name.equals("time")) {
544          throw new FHIRException("Cannot call addChild on a primitive type Composition.time");
545        }
546        else if (name.equals("party")) {
547          this.party = new Reference();
548          return this.party;
549        }
550        else
551          return super.addChild(name);
552      }
553
554      public CompositionAttesterComponent copy() {
555        CompositionAttesterComponent dst = new CompositionAttesterComponent();
556        copyValues(dst);
557        if (mode != null) {
558          dst.mode = new ArrayList<Enumeration<CompositionAttestationMode>>();
559          for (Enumeration<CompositionAttestationMode> i : mode)
560            dst.mode.add(i.copy());
561        };
562        dst.time = time == null ? null : time.copy();
563        dst.party = party == null ? null : party.copy();
564        return dst;
565      }
566
567      @Override
568      public boolean equalsDeep(Base other) {
569        if (!super.equalsDeep(other))
570          return false;
571        if (!(other instanceof CompositionAttesterComponent))
572          return false;
573        CompositionAttesterComponent o = (CompositionAttesterComponent) other;
574        return compareDeep(mode, o.mode, true) && compareDeep(time, o.time, true) && compareDeep(party, o.party, true)
575          ;
576      }
577
578      @Override
579      public boolean equalsShallow(Base other) {
580        if (!super.equalsShallow(other))
581          return false;
582        if (!(other instanceof CompositionAttesterComponent))
583          return false;
584        CompositionAttesterComponent o = (CompositionAttesterComponent) other;
585        return compareValues(mode, o.mode, true) && compareValues(time, o.time, true);
586      }
587
588      public boolean isEmpty() {
589        return super.isEmpty() && (mode == null || mode.isEmpty()) && (time == null || time.isEmpty())
590           && (party == null || party.isEmpty());
591      }
592
593  public String fhirType() {
594    return "Composition.attester";
595
596  }
597
598  }
599
600    @Block()
601    public static class CompositionEventComponent extends BackboneElement implements IBaseBackboneElement {
602        /**
603         * 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.
604         */
605        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
606        @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." )
607        protected List<CodeableConcept> code;
608
609        /**
610         * 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.
611         */
612        @Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
613        @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." )
614        protected Period period;
615
616        /**
617         * 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.
618         */
619        @Child(name = "detail", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
620        @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." )
621        protected List<Reference> detail;
622        /**
623         * 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.)
624         */
625        protected List<Resource> detailTarget;
626
627
628        private static final long serialVersionUID = -1581379774L;
629
630    /**
631     * Constructor
632     */
633      public CompositionEventComponent() {
634        super();
635      }
636
637        /**
638         * @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.)
639         */
640        public List<CodeableConcept> getCode() { 
641          if (this.code == null)
642            this.code = new ArrayList<CodeableConcept>();
643          return this.code;
644        }
645
646        public boolean hasCode() { 
647          if (this.code == null)
648            return false;
649          for (CodeableConcept item : this.code)
650            if (!item.isEmpty())
651              return true;
652          return false;
653        }
654
655        /**
656         * @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.)
657         */
658    // syntactic sugar
659        public CodeableConcept addCode() { //3
660          CodeableConcept t = new CodeableConcept();
661          if (this.code == null)
662            this.code = new ArrayList<CodeableConcept>();
663          this.code.add(t);
664          return t;
665        }
666
667    // syntactic sugar
668        public CompositionEventComponent addCode(CodeableConcept t) { //3
669          if (t == null)
670            return this;
671          if (this.code == null)
672            this.code = new ArrayList<CodeableConcept>();
673          this.code.add(t);
674          return this;
675        }
676
677        /**
678         * @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.)
679         */
680        public Period getPeriod() { 
681          if (this.period == null)
682            if (Configuration.errorOnAutoCreate())
683              throw new Error("Attempt to auto-create CompositionEventComponent.period");
684            else if (Configuration.doAutoCreate())
685              this.period = new Period(); // cc
686          return this.period;
687        }
688
689        public boolean hasPeriod() { 
690          return this.period != null && !this.period.isEmpty();
691        }
692
693        /**
694         * @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.)
695         */
696        public CompositionEventComponent setPeriod(Period value) { 
697          this.period = value;
698          return this;
699        }
700
701        /**
702         * @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.)
703         */
704        public List<Reference> getDetail() { 
705          if (this.detail == null)
706            this.detail = new ArrayList<Reference>();
707          return this.detail;
708        }
709
710        public boolean hasDetail() { 
711          if (this.detail == null)
712            return false;
713          for (Reference item : this.detail)
714            if (!item.isEmpty())
715              return true;
716          return false;
717        }
718
719        /**
720         * @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.)
721         */
722    // syntactic sugar
723        public Reference addDetail() { //3
724          Reference t = new Reference();
725          if (this.detail == null)
726            this.detail = new ArrayList<Reference>();
727          this.detail.add(t);
728          return t;
729        }
730
731    // syntactic sugar
732        public CompositionEventComponent addDetail(Reference t) { //3
733          if (t == null)
734            return this;
735          if (this.detail == null)
736            this.detail = new ArrayList<Reference>();
737          this.detail.add(t);
738          return this;
739        }
740
741        /**
742         * @return {@link #detail} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. 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.)
743         */
744        public List<Resource> getDetailTarget() { 
745          if (this.detailTarget == null)
746            this.detailTarget = new ArrayList<Resource>();
747          return this.detailTarget;
748        }
749
750        protected void listChildren(List<Property> childrenList) {
751          super.listChildren(childrenList);
752          childrenList.add(new Property("code", "CodeableConcept", "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", 0, java.lang.Integer.MAX_VALUE, code));
753          childrenList.add(new Property("period", "Period", "The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.", 0, java.lang.Integer.MAX_VALUE, period));
754          childrenList.add(new Property("detail", "Reference(Any)", "The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.", 0, java.lang.Integer.MAX_VALUE, detail));
755        }
756
757      @Override
758      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
759        switch (hash) {
760        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
761        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
762        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
763        default: return super.getProperty(hash, name, checkValid);
764        }
765
766      }
767
768      @Override
769      public void setProperty(int hash, String name, Base value) throws FHIRException {
770        switch (hash) {
771        case 3059181: // code
772          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
773          break;
774        case -991726143: // period
775          this.period = castToPeriod(value); // Period
776          break;
777        case -1335224239: // detail
778          this.getDetail().add(castToReference(value)); // Reference
779          break;
780        default: super.setProperty(hash, name, value);
781        }
782
783      }
784
785      @Override
786      public void setProperty(String name, Base value) throws FHIRException {
787        if (name.equals("code"))
788          this.getCode().add(castToCodeableConcept(value));
789        else if (name.equals("period"))
790          this.period = castToPeriod(value); // Period
791        else if (name.equals("detail"))
792          this.getDetail().add(castToReference(value));
793        else
794          super.setProperty(name, value);
795      }
796
797      @Override
798      public Base makeProperty(int hash, String name) throws FHIRException {
799        switch (hash) {
800        case 3059181:  return addCode(); // CodeableConcept
801        case -991726143:  return getPeriod(); // Period
802        case -1335224239:  return addDetail(); // Reference
803        default: return super.makeProperty(hash, name);
804        }
805
806      }
807
808      @Override
809      public Base addChild(String name) throws FHIRException {
810        if (name.equals("code")) {
811          return addCode();
812        }
813        else if (name.equals("period")) {
814          this.period = new Period();
815          return this.period;
816        }
817        else if (name.equals("detail")) {
818          return addDetail();
819        }
820        else
821          return super.addChild(name);
822      }
823
824      public CompositionEventComponent copy() {
825        CompositionEventComponent dst = new CompositionEventComponent();
826        copyValues(dst);
827        if (code != null) {
828          dst.code = new ArrayList<CodeableConcept>();
829          for (CodeableConcept i : code)
830            dst.code.add(i.copy());
831        };
832        dst.period = period == null ? null : period.copy();
833        if (detail != null) {
834          dst.detail = new ArrayList<Reference>();
835          for (Reference i : detail)
836            dst.detail.add(i.copy());
837        };
838        return dst;
839      }
840
841      @Override
842      public boolean equalsDeep(Base other) {
843        if (!super.equalsDeep(other))
844          return false;
845        if (!(other instanceof CompositionEventComponent))
846          return false;
847        CompositionEventComponent o = (CompositionEventComponent) other;
848        return compareDeep(code, o.code, true) && compareDeep(period, o.period, true) && compareDeep(detail, o.detail, true)
849          ;
850      }
851
852      @Override
853      public boolean equalsShallow(Base other) {
854        if (!super.equalsShallow(other))
855          return false;
856        if (!(other instanceof CompositionEventComponent))
857          return false;
858        CompositionEventComponent o = (CompositionEventComponent) other;
859        return true;
860      }
861
862      public boolean isEmpty() {
863        return super.isEmpty() && (code == null || code.isEmpty()) && (period == null || period.isEmpty())
864           && (detail == null || detail.isEmpty());
865      }
866
867  public String fhirType() {
868    return "Composition.event";
869
870  }
871
872  }
873
874    @Block()
875    public static class SectionComponent extends BackboneElement implements IBaseBackboneElement {
876        /**
877         * 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.
878         */
879        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
880        @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." )
881        protected StringType title;
882
883        /**
884         * A code identifying the kind of content contained within the section. This must be consistent with the section title.
885         */
886        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
887        @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." )
888        protected CodeableConcept code;
889
890        /**
891         * 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.
892         */
893        @Child(name = "text", type = {Narrative.class}, order=3, min=0, max=1, modifier=false, summary=false)
894        @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." )
895        protected Narrative text;
896
897        /**
898         * 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.
899         */
900        @Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
901        @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." )
902        protected CodeType mode;
903
904        /**
905         * Specifies the order applied to the items in the section entries.
906         */
907        @Child(name = "orderedBy", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
908        @Description(shortDefinition="Order of section entries", formalDefinition="Specifies the order applied to the items in the section entries." )
909        protected CodeableConcept orderedBy;
910
911        /**
912         * A reference to the actual resource from which the narrative in the section is derived.
913         */
914        @Child(name = "entry", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
915        @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." )
916        protected List<Reference> entry;
917        /**
918         * 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.)
919         */
920        protected List<Resource> entryTarget;
921
922
923        /**
924         * If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.
925         */
926        @Child(name = "emptyReason", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
927        @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." )
928        protected CodeableConcept emptyReason;
929
930        /**
931         * A nested sub-section within this section.
932         */
933        @Child(name = "section", type = {SectionComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
934        @Description(shortDefinition="Nested Section", formalDefinition="A nested sub-section within this section." )
935        protected List<SectionComponent> section;
936
937        private static final long serialVersionUID = -726390626L;
938
939    /**
940     * Constructor
941     */
942      public SectionComponent() {
943        super();
944      }
945
946        /**
947         * @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
948         */
949        public StringType getTitleElement() { 
950          if (this.title == null)
951            if (Configuration.errorOnAutoCreate())
952              throw new Error("Attempt to auto-create SectionComponent.title");
953            else if (Configuration.doAutoCreate())
954              this.title = new StringType(); // bb
955          return this.title;
956        }
957
958        public boolean hasTitleElement() { 
959          return this.title != null && !this.title.isEmpty();
960        }
961
962        public boolean hasTitle() { 
963          return this.title != null && !this.title.isEmpty();
964        }
965
966        /**
967         * @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
968         */
969        public SectionComponent setTitleElement(StringType value) { 
970          this.title = value;
971          return this;
972        }
973
974        /**
975         * @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.
976         */
977        public String getTitle() { 
978          return this.title == null ? null : this.title.getValue();
979        }
980
981        /**
982         * @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.
983         */
984        public SectionComponent setTitle(String value) { 
985          if (Utilities.noString(value))
986            this.title = null;
987          else {
988            if (this.title == null)
989              this.title = new StringType();
990            this.title.setValue(value);
991          }
992          return this;
993        }
994
995        /**
996         * @return {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
997         */
998        public CodeableConcept getCode() { 
999          if (this.code == null)
1000            if (Configuration.errorOnAutoCreate())
1001              throw new Error("Attempt to auto-create SectionComponent.code");
1002            else if (Configuration.doAutoCreate())
1003              this.code = new CodeableConcept(); // cc
1004          return this.code;
1005        }
1006
1007        public boolean hasCode() { 
1008          return this.code != null && !this.code.isEmpty();
1009        }
1010
1011        /**
1012         * @param value {@link #code} (A code identifying the kind of content contained within the section. This must be consistent with the section title.)
1013         */
1014        public SectionComponent setCode(CodeableConcept value) { 
1015          this.code = value;
1016          return this;
1017        }
1018
1019        /**
1020         * @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.)
1021         */
1022        public Narrative getText() { 
1023          if (this.text == null)
1024            if (Configuration.errorOnAutoCreate())
1025              throw new Error("Attempt to auto-create SectionComponent.text");
1026            else if (Configuration.doAutoCreate())
1027              this.text = new Narrative(); // cc
1028          return this.text;
1029        }
1030
1031        public boolean hasText() { 
1032          return this.text != null && !this.text.isEmpty();
1033        }
1034
1035        /**
1036         * @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.)
1037         */
1038        public SectionComponent setText(Narrative value) { 
1039          this.text = value;
1040          return this;
1041        }
1042
1043        /**
1044         * @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
1045         */
1046        public CodeType getModeElement() { 
1047          if (this.mode == null)
1048            if (Configuration.errorOnAutoCreate())
1049              throw new Error("Attempt to auto-create SectionComponent.mode");
1050            else if (Configuration.doAutoCreate())
1051              this.mode = new CodeType(); // bb
1052          return this.mode;
1053        }
1054
1055        public boolean hasModeElement() { 
1056          return this.mode != null && !this.mode.isEmpty();
1057        }
1058
1059        public boolean hasMode() { 
1060          return this.mode != null && !this.mode.isEmpty();
1061        }
1062
1063        /**
1064         * @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
1065         */
1066        public SectionComponent setModeElement(CodeType value) { 
1067          this.mode = value;
1068          return this;
1069        }
1070
1071        /**
1072         * @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.
1073         */
1074        public String getMode() { 
1075          return this.mode == null ? null : this.mode.getValue();
1076        }
1077
1078        /**
1079         * @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.
1080         */
1081        public SectionComponent setMode(String value) { 
1082          if (Utilities.noString(value))
1083            this.mode = null;
1084          else {
1085            if (this.mode == null)
1086              this.mode = new CodeType();
1087            this.mode.setValue(value);
1088          }
1089          return this;
1090        }
1091
1092        /**
1093         * @return {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1094         */
1095        public CodeableConcept getOrderedBy() { 
1096          if (this.orderedBy == null)
1097            if (Configuration.errorOnAutoCreate())
1098              throw new Error("Attempt to auto-create SectionComponent.orderedBy");
1099            else if (Configuration.doAutoCreate())
1100              this.orderedBy = new CodeableConcept(); // cc
1101          return this.orderedBy;
1102        }
1103
1104        public boolean hasOrderedBy() { 
1105          return this.orderedBy != null && !this.orderedBy.isEmpty();
1106        }
1107
1108        /**
1109         * @param value {@link #orderedBy} (Specifies the order applied to the items in the section entries.)
1110         */
1111        public SectionComponent setOrderedBy(CodeableConcept value) { 
1112          this.orderedBy = value;
1113          return this;
1114        }
1115
1116        /**
1117         * @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
1118         */
1119        public List<Reference> getEntry() { 
1120          if (this.entry == null)
1121            this.entry = new ArrayList<Reference>();
1122          return this.entry;
1123        }
1124
1125        public boolean hasEntry() { 
1126          if (this.entry == null)
1127            return false;
1128          for (Reference item : this.entry)
1129            if (!item.isEmpty())
1130              return true;
1131          return false;
1132        }
1133
1134        /**
1135         * @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
1136         */
1137    // syntactic sugar
1138        public Reference addEntry() { //3
1139          Reference t = new Reference();
1140          if (this.entry == null)
1141            this.entry = new ArrayList<Reference>();
1142          this.entry.add(t);
1143          return t;
1144        }
1145
1146    // syntactic sugar
1147        public SectionComponent addEntry(Reference t) { //3
1148          if (t == null)
1149            return this;
1150          if (this.entry == null)
1151            this.entry = new ArrayList<Reference>();
1152          this.entry.add(t);
1153          return this;
1154        }
1155
1156        /**
1157         * @return {@link #entry} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A reference to the actual resource from which the narrative in the section is derived.)
1158         */
1159        public List<Resource> getEntryTarget() { 
1160          if (this.entryTarget == null)
1161            this.entryTarget = new ArrayList<Resource>();
1162          return this.entryTarget;
1163        }
1164
1165        /**
1166         * @return {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
1167         */
1168        public CodeableConcept getEmptyReason() { 
1169          if (this.emptyReason == null)
1170            if (Configuration.errorOnAutoCreate())
1171              throw new Error("Attempt to auto-create SectionComponent.emptyReason");
1172            else if (Configuration.doAutoCreate())
1173              this.emptyReason = new CodeableConcept(); // cc
1174          return this.emptyReason;
1175        }
1176
1177        public boolean hasEmptyReason() { 
1178          return this.emptyReason != null && !this.emptyReason.isEmpty();
1179        }
1180
1181        /**
1182         * @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.)
1183         */
1184        public SectionComponent setEmptyReason(CodeableConcept value) { 
1185          this.emptyReason = value;
1186          return this;
1187        }
1188
1189        /**
1190         * @return {@link #section} (A nested sub-section within this section.)
1191         */
1192        public List<SectionComponent> getSection() { 
1193          if (this.section == null)
1194            this.section = new ArrayList<SectionComponent>();
1195          return this.section;
1196        }
1197
1198        public boolean hasSection() { 
1199          if (this.section == null)
1200            return false;
1201          for (SectionComponent item : this.section)
1202            if (!item.isEmpty())
1203              return true;
1204          return false;
1205        }
1206
1207        /**
1208         * @return {@link #section} (A nested sub-section within this section.)
1209         */
1210    // syntactic sugar
1211        public SectionComponent addSection() { //3
1212          SectionComponent t = new SectionComponent();
1213          if (this.section == null)
1214            this.section = new ArrayList<SectionComponent>();
1215          this.section.add(t);
1216          return t;
1217        }
1218
1219    // syntactic sugar
1220        public SectionComponent addSection(SectionComponent t) { //3
1221          if (t == null)
1222            return this;
1223          if (this.section == null)
1224            this.section = new ArrayList<SectionComponent>();
1225          this.section.add(t);
1226          return this;
1227        }
1228
1229        protected void listChildren(List<Property> childrenList) {
1230          super.listChildren(childrenList);
1231          childrenList.add(new Property("title", "string", "The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, java.lang.Integer.MAX_VALUE, title));
1232          childrenList.add(new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, java.lang.Integer.MAX_VALUE, code));
1233          childrenList.add(new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative.", 0, java.lang.Integer.MAX_VALUE, text));
1234          childrenList.add(new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, java.lang.Integer.MAX_VALUE, mode));
1235          childrenList.add(new Property("orderedBy", "CodeableConcept", "Specifies the order applied to the items in the section entries.", 0, java.lang.Integer.MAX_VALUE, orderedBy));
1236          childrenList.add(new Property("entry", "Reference(Any)", "A reference to the actual resource from which the narrative in the section is derived.", 0, java.lang.Integer.MAX_VALUE, entry));
1237          childrenList.add(new Property("emptyReason", "CodeableConcept", "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.", 0, java.lang.Integer.MAX_VALUE, emptyReason));
1238          childrenList.add(new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, java.lang.Integer.MAX_VALUE, section));
1239        }
1240
1241      @Override
1242      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1243        switch (hash) {
1244        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1245        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1246        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // Narrative
1247        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // CodeType
1248        case -391079516: /*orderedBy*/ return this.orderedBy == null ? new Base[0] : new Base[] {this.orderedBy}; // CodeableConcept
1249        case 96667762: /*entry*/ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // Reference
1250        case 1140135409: /*emptyReason*/ return this.emptyReason == null ? new Base[0] : new Base[] {this.emptyReason}; // CodeableConcept
1251        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
1252        default: return super.getProperty(hash, name, checkValid);
1253        }
1254
1255      }
1256
1257      @Override
1258      public void setProperty(int hash, String name, Base value) throws FHIRException {
1259        switch (hash) {
1260        case 110371416: // title
1261          this.title = castToString(value); // StringType
1262          break;
1263        case 3059181: // code
1264          this.code = castToCodeableConcept(value); // CodeableConcept
1265          break;
1266        case 3556653: // text
1267          this.text = castToNarrative(value); // Narrative
1268          break;
1269        case 3357091: // mode
1270          this.mode = castToCode(value); // CodeType
1271          break;
1272        case -391079516: // orderedBy
1273          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1274          break;
1275        case 96667762: // entry
1276          this.getEntry().add(castToReference(value)); // Reference
1277          break;
1278        case 1140135409: // emptyReason
1279          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
1280          break;
1281        case 1970241253: // section
1282          this.getSection().add((SectionComponent) value); // SectionComponent
1283          break;
1284        default: super.setProperty(hash, name, value);
1285        }
1286
1287      }
1288
1289      @Override
1290      public void setProperty(String name, Base value) throws FHIRException {
1291        if (name.equals("title"))
1292          this.title = castToString(value); // StringType
1293        else if (name.equals("code"))
1294          this.code = castToCodeableConcept(value); // CodeableConcept
1295        else if (name.equals("text"))
1296          this.text = castToNarrative(value); // Narrative
1297        else if (name.equals("mode"))
1298          this.mode = castToCode(value); // CodeType
1299        else if (name.equals("orderedBy"))
1300          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1301        else if (name.equals("entry"))
1302          this.getEntry().add(castToReference(value));
1303        else if (name.equals("emptyReason"))
1304          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
1305        else if (name.equals("section"))
1306          this.getSection().add((SectionComponent) value);
1307        else
1308          super.setProperty(name, value);
1309      }
1310
1311      @Override
1312      public Base makeProperty(int hash, String name) throws FHIRException {
1313        switch (hash) {
1314        case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
1315        case 3059181:  return getCode(); // CodeableConcept
1316        case 3556653:  return getText(); // Narrative
1317        case 3357091: throw new FHIRException("Cannot make property mode as it is not a complex type"); // CodeType
1318        case -391079516:  return getOrderedBy(); // CodeableConcept
1319        case 96667762:  return addEntry(); // Reference
1320        case 1140135409:  return getEmptyReason(); // CodeableConcept
1321        case 1970241253:  return addSection(); // SectionComponent
1322        default: return super.makeProperty(hash, name);
1323        }
1324
1325      }
1326
1327      @Override
1328      public Base addChild(String name) throws FHIRException {
1329        if (name.equals("title")) {
1330          throw new FHIRException("Cannot call addChild on a primitive type Composition.title");
1331        }
1332        else if (name.equals("code")) {
1333          this.code = new CodeableConcept();
1334          return this.code;
1335        }
1336        else if (name.equals("text")) {
1337          this.text = new Narrative();
1338          return this.text;
1339        }
1340        else if (name.equals("mode")) {
1341          throw new FHIRException("Cannot call addChild on a primitive type Composition.mode");
1342        }
1343        else if (name.equals("orderedBy")) {
1344          this.orderedBy = new CodeableConcept();
1345          return this.orderedBy;
1346        }
1347        else if (name.equals("entry")) {
1348          return addEntry();
1349        }
1350        else if (name.equals("emptyReason")) {
1351          this.emptyReason = new CodeableConcept();
1352          return this.emptyReason;
1353        }
1354        else if (name.equals("section")) {
1355          return addSection();
1356        }
1357        else
1358          return super.addChild(name);
1359      }
1360
1361      public SectionComponent copy() {
1362        SectionComponent dst = new SectionComponent();
1363        copyValues(dst);
1364        dst.title = title == null ? null : title.copy();
1365        dst.code = code == null ? null : code.copy();
1366        dst.text = text == null ? null : text.copy();
1367        dst.mode = mode == null ? null : mode.copy();
1368        dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
1369        if (entry != null) {
1370          dst.entry = new ArrayList<Reference>();
1371          for (Reference i : entry)
1372            dst.entry.add(i.copy());
1373        };
1374        dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
1375        if (section != null) {
1376          dst.section = new ArrayList<SectionComponent>();
1377          for (SectionComponent i : section)
1378            dst.section.add(i.copy());
1379        };
1380        return dst;
1381      }
1382
1383      @Override
1384      public boolean equalsDeep(Base other) {
1385        if (!super.equalsDeep(other))
1386          return false;
1387        if (!(other instanceof SectionComponent))
1388          return false;
1389        SectionComponent o = (SectionComponent) other;
1390        return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
1391           && compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(entry, o.entry, true)
1392           && compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true);
1393      }
1394
1395      @Override
1396      public boolean equalsShallow(Base other) {
1397        if (!super.equalsShallow(other))
1398          return false;
1399        if (!(other instanceof SectionComponent))
1400          return false;
1401        SectionComponent o = (SectionComponent) other;
1402        return compareValues(title, o.title, true) && compareValues(mode, o.mode, true);
1403      }
1404
1405      public boolean isEmpty() {
1406        return super.isEmpty() && (title == null || title.isEmpty()) && (code == null || code.isEmpty())
1407           && (text == null || text.isEmpty()) && (mode == null || mode.isEmpty()) && (orderedBy == null || orderedBy.isEmpty())
1408           && (entry == null || entry.isEmpty()) && (emptyReason == null || emptyReason.isEmpty()) && (section == null || section.isEmpty())
1409          ;
1410      }
1411
1412  public String fhirType() {
1413    return "Composition.section";
1414
1415  }
1416
1417  }
1418
1419    /**
1420     * Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.
1421     */
1422    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1423    @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." )
1424    protected Identifier identifier;
1425
1426    /**
1427     * The composition editing time, when the composition was last logically changed by the author.
1428     */
1429    @Child(name = "date", type = {DateTimeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1430    @Description(shortDefinition="Composition editing time", formalDefinition="The composition editing time, when the composition was last logically changed by the author." )
1431    protected DateTimeType date;
1432
1433    /**
1434     * 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.
1435     */
1436    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
1437    @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." )
1438    protected CodeableConcept type;
1439
1440    /**
1441     * 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.
1442     */
1443    @Child(name = "class", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1444    @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." )
1445    protected CodeableConcept class_;
1446
1447    /**
1448     * Official human-readable label for the composition.
1449     */
1450    @Child(name = "title", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1451    @Description(shortDefinition="Human Readable name/title", formalDefinition="Official human-readable label for the composition." )
1452    protected StringType title;
1453
1454    /**
1455     * The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
1456     */
1457    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
1458    @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." )
1459    protected Enumeration<CompositionStatus> status;
1460
1461    /**
1462     * The code specifying the level of confidentiality of the Composition.
1463     */
1464    @Child(name = "confidentiality", type = {CodeType.class}, order=6, min=0, max=1, modifier=true, summary=true)
1465    @Description(shortDefinition="As defined by affinity domain", formalDefinition="The code specifying the level of confidentiality of the Composition." )
1466    protected CodeType confidentiality;
1467
1468    /**
1469     * 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).
1470     */
1471    @Child(name = "subject", type = {}, order=7, min=1, max=1, modifier=false, summary=true)
1472    @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)." )
1473    protected Reference subject;
1474
1475    /**
1476     * 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).)
1477     */
1478    protected Resource subjectTarget;
1479
1480    /**
1481     * Identifies who is responsible for the information in the composition, not necessarily who typed it in.
1482     */
1483    @Child(name = "author", type = {Practitioner.class, Device.class, Patient.class, RelatedPerson.class}, order=8, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1484    @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." )
1485    protected List<Reference> author;
1486    /**
1487     * 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.)
1488     */
1489    protected List<Resource> authorTarget;
1490
1491
1492    /**
1493     * A participant who has attested to the accuracy of the composition/document.
1494     */
1495    @Child(name = "attester", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1496    @Description(shortDefinition="Attests to accuracy of composition", formalDefinition="A participant who has attested to the accuracy of the composition/document." )
1497    protected List<CompositionAttesterComponent> attester;
1498
1499    /**
1500     * Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.
1501     */
1502    @Child(name = "custodian", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
1503    @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." )
1504    protected Reference custodian;
1505
1506    /**
1507     * 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.)
1508     */
1509    protected Organization custodianTarget;
1510
1511    /**
1512     * The clinical service, such as a colonoscopy or an appendectomy, being documented.
1513     */
1514    @Child(name = "event", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1515    @Description(shortDefinition="The clinical service(s) being documented", formalDefinition="The clinical service, such as a colonoscopy or an appendectomy, being documented." )
1516    protected List<CompositionEventComponent> event;
1517
1518    /**
1519     * Describes the clinical encounter or type of care this documentation is associated with.
1520     */
1521    @Child(name = "encounter", type = {Encounter.class}, order=12, min=0, max=1, modifier=false, summary=true)
1522    @Description(shortDefinition="Context of the Composition", formalDefinition="Describes the clinical encounter or type of care this documentation is associated with." )
1523    protected Reference encounter;
1524
1525    /**
1526     * The actual object that is the target of the reference (Describes the clinical encounter or type of care this documentation is associated with.)
1527     */
1528    protected Encounter encounterTarget;
1529
1530    /**
1531     * The root of the sections that make up the composition.
1532     */
1533    @Child(name = "section", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1534    @Description(shortDefinition="Composition is broken into sections", formalDefinition="The root of the sections that make up the composition." )
1535    protected List<SectionComponent> section;
1536
1537    private static final long serialVersionUID = 2127852326L;
1538
1539  /**
1540   * Constructor
1541   */
1542    public Composition() {
1543      super();
1544    }
1545
1546  /**
1547   * Constructor
1548   */
1549    public Composition(DateTimeType date, CodeableConcept type, StringType title, Enumeration<CompositionStatus> status, Reference subject) {
1550      super();
1551      this.date = date;
1552      this.type = type;
1553      this.title = title;
1554      this.status = status;
1555      this.subject = subject;
1556    }
1557
1558    /**
1559     * @return {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
1560     */
1561    public Identifier getIdentifier() { 
1562      if (this.identifier == null)
1563        if (Configuration.errorOnAutoCreate())
1564          throw new Error("Attempt to auto-create Composition.identifier");
1565        else if (Configuration.doAutoCreate())
1566          this.identifier = new Identifier(); // cc
1567      return this.identifier;
1568    }
1569
1570    public boolean hasIdentifier() { 
1571      return this.identifier != null && !this.identifier.isEmpty();
1572    }
1573
1574    /**
1575     * @param value {@link #identifier} (Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.)
1576     */
1577    public Composition setIdentifier(Identifier value) { 
1578      this.identifier = value;
1579      return this;
1580    }
1581
1582    /**
1583     * @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
1584     */
1585    public DateTimeType getDateElement() { 
1586      if (this.date == null)
1587        if (Configuration.errorOnAutoCreate())
1588          throw new Error("Attempt to auto-create Composition.date");
1589        else if (Configuration.doAutoCreate())
1590          this.date = new DateTimeType(); // bb
1591      return this.date;
1592    }
1593
1594    public boolean hasDateElement() { 
1595      return this.date != null && !this.date.isEmpty();
1596    }
1597
1598    public boolean hasDate() { 
1599      return this.date != null && !this.date.isEmpty();
1600    }
1601
1602    /**
1603     * @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
1604     */
1605    public Composition setDateElement(DateTimeType value) { 
1606      this.date = value;
1607      return this;
1608    }
1609
1610    /**
1611     * @return The composition editing time, when the composition was last logically changed by the author.
1612     */
1613    public Date getDate() { 
1614      return this.date == null ? null : this.date.getValue();
1615    }
1616
1617    /**
1618     * @param value The composition editing time, when the composition was last logically changed by the author.
1619     */
1620    public Composition setDate(Date value) { 
1621        if (this.date == null)
1622          this.date = new DateTimeType();
1623        this.date.setValue(value);
1624      return this;
1625    }
1626
1627    /**
1628     * @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.)
1629     */
1630    public CodeableConcept getType() { 
1631      if (this.type == null)
1632        if (Configuration.errorOnAutoCreate())
1633          throw new Error("Attempt to auto-create Composition.type");
1634        else if (Configuration.doAutoCreate())
1635          this.type = new CodeableConcept(); // cc
1636      return this.type;
1637    }
1638
1639    public boolean hasType() { 
1640      return this.type != null && !this.type.isEmpty();
1641    }
1642
1643    /**
1644     * @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.)
1645     */
1646    public Composition setType(CodeableConcept value) { 
1647      this.type = value;
1648      return this;
1649    }
1650
1651    /**
1652     * @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.)
1653     */
1654    public CodeableConcept getClass_() { 
1655      if (this.class_ == null)
1656        if (Configuration.errorOnAutoCreate())
1657          throw new Error("Attempt to auto-create Composition.class_");
1658        else if (Configuration.doAutoCreate())
1659          this.class_ = new CodeableConcept(); // cc
1660      return this.class_;
1661    }
1662
1663    public boolean hasClass_() { 
1664      return this.class_ != null && !this.class_.isEmpty();
1665    }
1666
1667    /**
1668     * @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.)
1669     */
1670    public Composition setClass_(CodeableConcept value) { 
1671      this.class_ = value;
1672      return this;
1673    }
1674
1675    /**
1676     * @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
1677     */
1678    public StringType getTitleElement() { 
1679      if (this.title == null)
1680        if (Configuration.errorOnAutoCreate())
1681          throw new Error("Attempt to auto-create Composition.title");
1682        else if (Configuration.doAutoCreate())
1683          this.title = new StringType(); // bb
1684      return this.title;
1685    }
1686
1687    public boolean hasTitleElement() { 
1688      return this.title != null && !this.title.isEmpty();
1689    }
1690
1691    public boolean hasTitle() { 
1692      return this.title != null && !this.title.isEmpty();
1693    }
1694
1695    /**
1696     * @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
1697     */
1698    public Composition setTitleElement(StringType value) { 
1699      this.title = value;
1700      return this;
1701    }
1702
1703    /**
1704     * @return Official human-readable label for the composition.
1705     */
1706    public String getTitle() { 
1707      return this.title == null ? null : this.title.getValue();
1708    }
1709
1710    /**
1711     * @param value Official human-readable label for the composition.
1712     */
1713    public Composition setTitle(String value) { 
1714        if (this.title == null)
1715          this.title = new StringType();
1716        this.title.setValue(value);
1717      return this;
1718    }
1719
1720    /**
1721     * @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
1722     */
1723    public Enumeration<CompositionStatus> getStatusElement() { 
1724      if (this.status == null)
1725        if (Configuration.errorOnAutoCreate())
1726          throw new Error("Attempt to auto-create Composition.status");
1727        else if (Configuration.doAutoCreate())
1728          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory()); // bb
1729      return this.status;
1730    }
1731
1732    public boolean hasStatusElement() { 
1733      return this.status != null && !this.status.isEmpty();
1734    }
1735
1736    public boolean hasStatus() { 
1737      return this.status != null && !this.status.isEmpty();
1738    }
1739
1740    /**
1741     * @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
1742     */
1743    public Composition setStatusElement(Enumeration<CompositionStatus> value) { 
1744      this.status = value;
1745      return this;
1746    }
1747
1748    /**
1749     * @return The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
1750     */
1751    public CompositionStatus getStatus() { 
1752      return this.status == null ? null : this.status.getValue();
1753    }
1754
1755    /**
1756     * @param value The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.
1757     */
1758    public Composition setStatus(CompositionStatus value) { 
1759        if (this.status == null)
1760          this.status = new Enumeration<CompositionStatus>(new CompositionStatusEnumFactory());
1761        this.status.setValue(value);
1762      return this;
1763    }
1764
1765    /**
1766     * @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
1767     */
1768    public CodeType getConfidentialityElement() { 
1769      if (this.confidentiality == null)
1770        if (Configuration.errorOnAutoCreate())
1771          throw new Error("Attempt to auto-create Composition.confidentiality");
1772        else if (Configuration.doAutoCreate())
1773          this.confidentiality = new CodeType(); // bb
1774      return this.confidentiality;
1775    }
1776
1777    public boolean hasConfidentialityElement() { 
1778      return this.confidentiality != null && !this.confidentiality.isEmpty();
1779    }
1780
1781    public boolean hasConfidentiality() { 
1782      return this.confidentiality != null && !this.confidentiality.isEmpty();
1783    }
1784
1785    /**
1786     * @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
1787     */
1788    public Composition setConfidentialityElement(CodeType value) { 
1789      this.confidentiality = value;
1790      return this;
1791    }
1792
1793    /**
1794     * @return The code specifying the level of confidentiality of the Composition.
1795     */
1796    public String getConfidentiality() { 
1797      return this.confidentiality == null ? null : this.confidentiality.getValue();
1798    }
1799
1800    /**
1801     * @param value The code specifying the level of confidentiality of the Composition.
1802     */
1803    public Composition setConfidentiality(String value) { 
1804      if (Utilities.noString(value))
1805        this.confidentiality = null;
1806      else {
1807        if (this.confidentiality == null)
1808          this.confidentiality = new CodeType();
1809        this.confidentiality.setValue(value);
1810      }
1811      return this;
1812    }
1813
1814    /**
1815     * @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).)
1816     */
1817    public Reference getSubject() { 
1818      if (this.subject == null)
1819        if (Configuration.errorOnAutoCreate())
1820          throw new Error("Attempt to auto-create Composition.subject");
1821        else if (Configuration.doAutoCreate())
1822          this.subject = new Reference(); // cc
1823      return this.subject;
1824    }
1825
1826    public boolean hasSubject() { 
1827      return this.subject != null && !this.subject.isEmpty();
1828    }
1829
1830    /**
1831     * @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).)
1832     */
1833    public Composition setSubject(Reference value) { 
1834      this.subject = value;
1835      return this;
1836    }
1837
1838    /**
1839     * @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).)
1840     */
1841    public Resource getSubjectTarget() { 
1842      return this.subjectTarget;
1843    }
1844
1845    /**
1846     * @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).)
1847     */
1848    public Composition setSubjectTarget(Resource value) { 
1849      this.subjectTarget = value;
1850      return this;
1851    }
1852
1853    /**
1854     * @return {@link #author} (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
1855     */
1856    public List<Reference> getAuthor() { 
1857      if (this.author == null)
1858        this.author = new ArrayList<Reference>();
1859      return this.author;
1860    }
1861
1862    public boolean hasAuthor() { 
1863      if (this.author == null)
1864        return false;
1865      for (Reference item : this.author)
1866        if (!item.isEmpty())
1867          return true;
1868      return false;
1869    }
1870
1871    /**
1872     * @return {@link #author} (Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
1873     */
1874    // syntactic sugar
1875    public Reference addAuthor() { //3
1876      Reference t = new Reference();
1877      if (this.author == null)
1878        this.author = new ArrayList<Reference>();
1879      this.author.add(t);
1880      return t;
1881    }
1882
1883    // syntactic sugar
1884    public Composition addAuthor(Reference t) { //3
1885      if (t == null)
1886        return this;
1887      if (this.author == null)
1888        this.author = new ArrayList<Reference>();
1889      this.author.add(t);
1890      return this;
1891    }
1892
1893    /**
1894     * @return {@link #author} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Identifies who is responsible for the information in the composition, not necessarily who typed it in.)
1895     */
1896    public List<Resource> getAuthorTarget() { 
1897      if (this.authorTarget == null)
1898        this.authorTarget = new ArrayList<Resource>();
1899      return this.authorTarget;
1900    }
1901
1902    /**
1903     * @return {@link #attester} (A participant who has attested to the accuracy of the composition/document.)
1904     */
1905    public List<CompositionAttesterComponent> getAttester() { 
1906      if (this.attester == null)
1907        this.attester = new ArrayList<CompositionAttesterComponent>();
1908      return this.attester;
1909    }
1910
1911    public boolean hasAttester() { 
1912      if (this.attester == null)
1913        return false;
1914      for (CompositionAttesterComponent item : this.attester)
1915        if (!item.isEmpty())
1916          return true;
1917      return false;
1918    }
1919
1920    /**
1921     * @return {@link #attester} (A participant who has attested to the accuracy of the composition/document.)
1922     */
1923    // syntactic sugar
1924    public CompositionAttesterComponent addAttester() { //3
1925      CompositionAttesterComponent t = new CompositionAttesterComponent();
1926      if (this.attester == null)
1927        this.attester = new ArrayList<CompositionAttesterComponent>();
1928      this.attester.add(t);
1929      return t;
1930    }
1931
1932    // syntactic sugar
1933    public Composition addAttester(CompositionAttesterComponent t) { //3
1934      if (t == null)
1935        return this;
1936      if (this.attester == null)
1937        this.attester = new ArrayList<CompositionAttesterComponent>();
1938      this.attester.add(t);
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
1944     */
1945    public Reference getCustodian() { 
1946      if (this.custodian == null)
1947        if (Configuration.errorOnAutoCreate())
1948          throw new Error("Attempt to auto-create Composition.custodian");
1949        else if (Configuration.doAutoCreate())
1950          this.custodian = new Reference(); // cc
1951      return this.custodian;
1952    }
1953
1954    public boolean hasCustodian() { 
1955      return this.custodian != null && !this.custodian.isEmpty();
1956    }
1957
1958    /**
1959     * @param value {@link #custodian} (Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.)
1960     */
1961    public Composition setCustodian(Reference value) { 
1962      this.custodian = value;
1963      return this;
1964    }
1965
1966    /**
1967     * @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.)
1968     */
1969    public Organization getCustodianTarget() { 
1970      if (this.custodianTarget == null)
1971        if (Configuration.errorOnAutoCreate())
1972          throw new Error("Attempt to auto-create Composition.custodian");
1973        else if (Configuration.doAutoCreate())
1974          this.custodianTarget = new Organization(); // aa
1975      return this.custodianTarget;
1976    }
1977
1978    /**
1979     * @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.)
1980     */
1981    public Composition setCustodianTarget(Organization value) { 
1982      this.custodianTarget = value;
1983      return this;
1984    }
1985
1986    /**
1987     * @return {@link #event} (The clinical service, such as a colonoscopy or an appendectomy, being documented.)
1988     */
1989    public List<CompositionEventComponent> getEvent() { 
1990      if (this.event == null)
1991        this.event = new ArrayList<CompositionEventComponent>();
1992      return this.event;
1993    }
1994
1995    public boolean hasEvent() { 
1996      if (this.event == null)
1997        return false;
1998      for (CompositionEventComponent item : this.event)
1999        if (!item.isEmpty())
2000          return true;
2001      return false;
2002    }
2003
2004    /**
2005     * @return {@link #event} (The clinical service, such as a colonoscopy or an appendectomy, being documented.)
2006     */
2007    // syntactic sugar
2008    public CompositionEventComponent addEvent() { //3
2009      CompositionEventComponent t = new CompositionEventComponent();
2010      if (this.event == null)
2011        this.event = new ArrayList<CompositionEventComponent>();
2012      this.event.add(t);
2013      return t;
2014    }
2015
2016    // syntactic sugar
2017    public Composition addEvent(CompositionEventComponent t) { //3
2018      if (t == null)
2019        return this;
2020      if (this.event == null)
2021        this.event = new ArrayList<CompositionEventComponent>();
2022      this.event.add(t);
2023      return this;
2024    }
2025
2026    /**
2027     * @return {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2028     */
2029    public Reference getEncounter() { 
2030      if (this.encounter == null)
2031        if (Configuration.errorOnAutoCreate())
2032          throw new Error("Attempt to auto-create Composition.encounter");
2033        else if (Configuration.doAutoCreate())
2034          this.encounter = new Reference(); // cc
2035      return this.encounter;
2036    }
2037
2038    public boolean hasEncounter() { 
2039      return this.encounter != null && !this.encounter.isEmpty();
2040    }
2041
2042    /**
2043     * @param value {@link #encounter} (Describes the clinical encounter or type of care this documentation is associated with.)
2044     */
2045    public Composition setEncounter(Reference value) { 
2046      this.encounter = value;
2047      return this;
2048    }
2049
2050    /**
2051     * @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.)
2052     */
2053    public Encounter getEncounterTarget() { 
2054      if (this.encounterTarget == null)
2055        if (Configuration.errorOnAutoCreate())
2056          throw new Error("Attempt to auto-create Composition.encounter");
2057        else if (Configuration.doAutoCreate())
2058          this.encounterTarget = new Encounter(); // aa
2059      return this.encounterTarget;
2060    }
2061
2062    /**
2063     * @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.)
2064     */
2065    public Composition setEncounterTarget(Encounter value) { 
2066      this.encounterTarget = value;
2067      return this;
2068    }
2069
2070    /**
2071     * @return {@link #section} (The root of the sections that make up the composition.)
2072     */
2073    public List<SectionComponent> getSection() { 
2074      if (this.section == null)
2075        this.section = new ArrayList<SectionComponent>();
2076      return this.section;
2077    }
2078
2079    public boolean hasSection() { 
2080      if (this.section == null)
2081        return false;
2082      for (SectionComponent item : this.section)
2083        if (!item.isEmpty())
2084          return true;
2085      return false;
2086    }
2087
2088    /**
2089     * @return {@link #section} (The root of the sections that make up the composition.)
2090     */
2091    // syntactic sugar
2092    public SectionComponent addSection() { //3
2093      SectionComponent t = new SectionComponent();
2094      if (this.section == null)
2095        this.section = new ArrayList<SectionComponent>();
2096      this.section.add(t);
2097      return t;
2098    }
2099
2100    // syntactic sugar
2101    public Composition addSection(SectionComponent t) { //3
2102      if (t == null)
2103        return this;
2104      if (this.section == null)
2105        this.section = new ArrayList<SectionComponent>();
2106      this.section.add(t);
2107      return this;
2108    }
2109
2110      protected void listChildren(List<Property> childrenList) {
2111        super.listChildren(childrenList);
2112        childrenList.add(new Property("identifier", "Identifier", "Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.", 0, java.lang.Integer.MAX_VALUE, identifier));
2113        childrenList.add(new Property("date", "dateTime", "The composition editing time, when the composition was last logically changed by the author.", 0, java.lang.Integer.MAX_VALUE, date));
2114        childrenList.add(new Property("type", "CodeableConcept", "Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.", 0, java.lang.Integer.MAX_VALUE, type));
2115        childrenList.add(new Property("class", "CodeableConcept", "A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.", 0, java.lang.Integer.MAX_VALUE, class_));
2116        childrenList.add(new Property("title", "string", "Official human-readable label for the composition.", 0, java.lang.Integer.MAX_VALUE, title));
2117        childrenList.add(new Property("status", "code", "The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.", 0, java.lang.Integer.MAX_VALUE, status));
2118        childrenList.add(new Property("confidentiality", "code", "The code specifying the level of confidentiality of the Composition.", 0, java.lang.Integer.MAX_VALUE, confidentiality));
2119        childrenList.add(new Property("subject", "Reference(Any)", "Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).", 0, java.lang.Integer.MAX_VALUE, subject));
2120        childrenList.add(new Property("author", "Reference(Practitioner|Device|Patient|RelatedPerson)", "Identifies who is responsible for the information in the composition, not necessarily who typed it in.", 0, java.lang.Integer.MAX_VALUE, author));
2121        childrenList.add(new Property("attester", "", "A participant who has attested to the accuracy of the composition/document.", 0, java.lang.Integer.MAX_VALUE, attester));
2122        childrenList.add(new Property("custodian", "Reference(Organization)", "Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.", 0, java.lang.Integer.MAX_VALUE, custodian));
2123        childrenList.add(new Property("event", "", "The clinical service, such as a colonoscopy or an appendectomy, being documented.", 0, java.lang.Integer.MAX_VALUE, event));
2124        childrenList.add(new Property("encounter", "Reference(Encounter)", "Describes the clinical encounter or type of care this documentation is associated with.", 0, java.lang.Integer.MAX_VALUE, encounter));
2125        childrenList.add(new Property("section", "", "The root of the sections that make up the composition.", 0, java.lang.Integer.MAX_VALUE, section));
2126      }
2127
2128      @Override
2129      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2130        switch (hash) {
2131        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2132        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2133        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2134        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept
2135        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
2136        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<CompositionStatus>
2137        case -1923018202: /*confidentiality*/ return this.confidentiality == null ? new Base[0] : new Base[] {this.confidentiality}; // CodeType
2138        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
2139        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // Reference
2140        case 542920370: /*attester*/ return this.attester == null ? new Base[0] : this.attester.toArray(new Base[this.attester.size()]); // CompositionAttesterComponent
2141        case 1611297262: /*custodian*/ return this.custodian == null ? new Base[0] : new Base[] {this.custodian}; // Reference
2142        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // CompositionEventComponent
2143        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2144        case 1970241253: /*section*/ return this.section == null ? new Base[0] : this.section.toArray(new Base[this.section.size()]); // SectionComponent
2145        default: return super.getProperty(hash, name, checkValid);
2146        }
2147
2148      }
2149
2150      @Override
2151      public void setProperty(int hash, String name, Base value) throws FHIRException {
2152        switch (hash) {
2153        case -1618432855: // identifier
2154          this.identifier = castToIdentifier(value); // Identifier
2155          break;
2156        case 3076014: // date
2157          this.date = castToDateTime(value); // DateTimeType
2158          break;
2159        case 3575610: // type
2160          this.type = castToCodeableConcept(value); // CodeableConcept
2161          break;
2162        case 94742904: // class
2163          this.class_ = castToCodeableConcept(value); // CodeableConcept
2164          break;
2165        case 110371416: // title
2166          this.title = castToString(value); // StringType
2167          break;
2168        case -892481550: // status
2169          this.status = new CompositionStatusEnumFactory().fromType(value); // Enumeration<CompositionStatus>
2170          break;
2171        case -1923018202: // confidentiality
2172          this.confidentiality = castToCode(value); // CodeType
2173          break;
2174        case -1867885268: // subject
2175          this.subject = castToReference(value); // Reference
2176          break;
2177        case -1406328437: // author
2178          this.getAuthor().add(castToReference(value)); // Reference
2179          break;
2180        case 542920370: // attester
2181          this.getAttester().add((CompositionAttesterComponent) value); // CompositionAttesterComponent
2182          break;
2183        case 1611297262: // custodian
2184          this.custodian = castToReference(value); // Reference
2185          break;
2186        case 96891546: // event
2187          this.getEvent().add((CompositionEventComponent) value); // CompositionEventComponent
2188          break;
2189        case 1524132147: // encounter
2190          this.encounter = castToReference(value); // Reference
2191          break;
2192        case 1970241253: // section
2193          this.getSection().add((SectionComponent) value); // SectionComponent
2194          break;
2195        default: super.setProperty(hash, name, value);
2196        }
2197
2198      }
2199
2200      @Override
2201      public void setProperty(String name, Base value) throws FHIRException {
2202        if (name.equals("identifier"))
2203          this.identifier = castToIdentifier(value); // Identifier
2204        else if (name.equals("date"))
2205          this.date = castToDateTime(value); // DateTimeType
2206        else if (name.equals("type"))
2207          this.type = castToCodeableConcept(value); // CodeableConcept
2208        else if (name.equals("class"))
2209          this.class_ = castToCodeableConcept(value); // CodeableConcept
2210        else if (name.equals("title"))
2211          this.title = castToString(value); // StringType
2212        else if (name.equals("status"))
2213          this.status = new CompositionStatusEnumFactory().fromType(value); // Enumeration<CompositionStatus>
2214        else if (name.equals("confidentiality"))
2215          this.confidentiality = castToCode(value); // CodeType
2216        else if (name.equals("subject"))
2217          this.subject = castToReference(value); // Reference
2218        else if (name.equals("author"))
2219          this.getAuthor().add(castToReference(value));
2220        else if (name.equals("attester"))
2221          this.getAttester().add((CompositionAttesterComponent) value);
2222        else if (name.equals("custodian"))
2223          this.custodian = castToReference(value); // Reference
2224        else if (name.equals("event"))
2225          this.getEvent().add((CompositionEventComponent) value);
2226        else if (name.equals("encounter"))
2227          this.encounter = castToReference(value); // Reference
2228        else if (name.equals("section"))
2229          this.getSection().add((SectionComponent) value);
2230        else
2231          super.setProperty(name, value);
2232      }
2233
2234      @Override
2235      public Base makeProperty(int hash, String name) throws FHIRException {
2236        switch (hash) {
2237        case -1618432855:  return getIdentifier(); // Identifier
2238        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
2239        case 3575610:  return getType(); // CodeableConcept
2240        case 94742904:  return getClass_(); // CodeableConcept
2241        case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
2242        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<CompositionStatus>
2243        case -1923018202: throw new FHIRException("Cannot make property confidentiality as it is not a complex type"); // CodeType
2244        case -1867885268:  return getSubject(); // Reference
2245        case -1406328437:  return addAuthor(); // Reference
2246        case 542920370:  return addAttester(); // CompositionAttesterComponent
2247        case 1611297262:  return getCustodian(); // Reference
2248        case 96891546:  return addEvent(); // CompositionEventComponent
2249        case 1524132147:  return getEncounter(); // Reference
2250        case 1970241253:  return addSection(); // SectionComponent
2251        default: return super.makeProperty(hash, name);
2252        }
2253
2254      }
2255
2256      @Override
2257      public Base addChild(String name) throws FHIRException {
2258        if (name.equals("identifier")) {
2259          this.identifier = new Identifier();
2260          return this.identifier;
2261        }
2262        else if (name.equals("date")) {
2263          throw new FHIRException("Cannot call addChild on a primitive type Composition.date");
2264        }
2265        else if (name.equals("type")) {
2266          this.type = new CodeableConcept();
2267          return this.type;
2268        }
2269        else if (name.equals("class")) {
2270          this.class_ = new CodeableConcept();
2271          return this.class_;
2272        }
2273        else if (name.equals("title")) {
2274          throw new FHIRException("Cannot call addChild on a primitive type Composition.title");
2275        }
2276        else if (name.equals("status")) {
2277          throw new FHIRException("Cannot call addChild on a primitive type Composition.status");
2278        }
2279        else if (name.equals("confidentiality")) {
2280          throw new FHIRException("Cannot call addChild on a primitive type Composition.confidentiality");
2281        }
2282        else if (name.equals("subject")) {
2283          this.subject = new Reference();
2284          return this.subject;
2285        }
2286        else if (name.equals("author")) {
2287          return addAuthor();
2288        }
2289        else if (name.equals("attester")) {
2290          return addAttester();
2291        }
2292        else if (name.equals("custodian")) {
2293          this.custodian = new Reference();
2294          return this.custodian;
2295        }
2296        else if (name.equals("event")) {
2297          return addEvent();
2298        }
2299        else if (name.equals("encounter")) {
2300          this.encounter = new Reference();
2301          return this.encounter;
2302        }
2303        else if (name.equals("section")) {
2304          return addSection();
2305        }
2306        else
2307          return super.addChild(name);
2308      }
2309
2310  public String fhirType() {
2311    return "Composition";
2312
2313  }
2314
2315      public Composition copy() {
2316        Composition dst = new Composition();
2317        copyValues(dst);
2318        dst.identifier = identifier == null ? null : identifier.copy();
2319        dst.date = date == null ? null : date.copy();
2320        dst.type = type == null ? null : type.copy();
2321        dst.class_ = class_ == null ? null : class_.copy();
2322        dst.title = title == null ? null : title.copy();
2323        dst.status = status == null ? null : status.copy();
2324        dst.confidentiality = confidentiality == null ? null : confidentiality.copy();
2325        dst.subject = subject == null ? null : subject.copy();
2326        if (author != null) {
2327          dst.author = new ArrayList<Reference>();
2328          for (Reference i : author)
2329            dst.author.add(i.copy());
2330        };
2331        if (attester != null) {
2332          dst.attester = new ArrayList<CompositionAttesterComponent>();
2333          for (CompositionAttesterComponent i : attester)
2334            dst.attester.add(i.copy());
2335        };
2336        dst.custodian = custodian == null ? null : custodian.copy();
2337        if (event != null) {
2338          dst.event = new ArrayList<CompositionEventComponent>();
2339          for (CompositionEventComponent i : event)
2340            dst.event.add(i.copy());
2341        };
2342        dst.encounter = encounter == null ? null : encounter.copy();
2343        if (section != null) {
2344          dst.section = new ArrayList<SectionComponent>();
2345          for (SectionComponent i : section)
2346            dst.section.add(i.copy());
2347        };
2348        return dst;
2349      }
2350
2351      protected Composition typedCopy() {
2352        return copy();
2353      }
2354
2355      @Override
2356      public boolean equalsDeep(Base other) {
2357        if (!super.equalsDeep(other))
2358          return false;
2359        if (!(other instanceof Composition))
2360          return false;
2361        Composition o = (Composition) other;
2362        return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) && compareDeep(type, o.type, true)
2363           && compareDeep(class_, o.class_, true) && compareDeep(title, o.title, true) && compareDeep(status, o.status, true)
2364           && compareDeep(confidentiality, o.confidentiality, true) && compareDeep(subject, o.subject, true)
2365           && compareDeep(author, o.author, true) && compareDeep(attester, o.attester, true) && compareDeep(custodian, o.custodian, true)
2366           && compareDeep(event, o.event, true) && compareDeep(encounter, o.encounter, true) && compareDeep(section, o.section, true)
2367          ;
2368      }
2369
2370      @Override
2371      public boolean equalsShallow(Base other) {
2372        if (!super.equalsShallow(other))
2373          return false;
2374        if (!(other instanceof Composition))
2375          return false;
2376        Composition o = (Composition) other;
2377        return compareValues(date, o.date, true) && compareValues(title, o.title, true) && compareValues(status, o.status, true)
2378           && compareValues(confidentiality, o.confidentiality, true);
2379      }
2380
2381      public boolean isEmpty() {
2382        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty())
2383           && (type == null || type.isEmpty()) && (class_ == null || class_.isEmpty()) && (title == null || title.isEmpty())
2384           && (status == null || status.isEmpty()) && (confidentiality == null || confidentiality.isEmpty())
2385           && (subject == null || subject.isEmpty()) && (author == null || author.isEmpty()) && (attester == null || attester.isEmpty())
2386           && (custodian == null || custodian.isEmpty()) && (event == null || event.isEmpty()) && (encounter == null || encounter.isEmpty())
2387           && (section == null || section.isEmpty());
2388      }
2389
2390  @Override
2391  public ResourceType getResourceType() {
2392    return ResourceType.Composition;
2393   }
2394
2395 /**
2396   * Search parameter: <b>status</b>
2397   * <p>
2398   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
2399   * Type: <b>token</b><br>
2400   * Path: <b>Composition.status</b><br>
2401   * </p>
2402   */
2403  @SearchParamDefinition(name="status", path="Composition.status", description="preliminary | final | amended | entered-in-error", type="token" )
2404  public static final String SP_STATUS = "status";
2405 /**
2406   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2407   * <p>
2408   * Description: <b>preliminary | final | amended | entered-in-error</b><br>
2409   * Type: <b>token</b><br>
2410   * Path: <b>Composition.status</b><br>
2411   * </p>
2412   */
2413  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2414
2415 /**
2416   * Search parameter: <b>subject</b>
2417   * <p>
2418   * Description: <b>Who and/or what the composition is about</b><br>
2419   * Type: <b>reference</b><br>
2420   * Path: <b>Composition.subject</b><br>
2421   * </p>
2422   */
2423  @SearchParamDefinition(name="subject", path="Composition.subject", description="Who and/or what the composition is about", type="reference" )
2424  public static final String SP_SUBJECT = "subject";
2425 /**
2426   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2427   * <p>
2428   * Description: <b>Who and/or what the composition is about</b><br>
2429   * Type: <b>reference</b><br>
2430   * Path: <b>Composition.subject</b><br>
2431   * </p>
2432   */
2433  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2434
2435/**
2436   * Constant for fluent queries to be used to add include statements. Specifies
2437   * the path value of "<b>Composition:subject</b>".
2438   */
2439  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Composition:subject").toLocked();
2440
2441 /**
2442   * Search parameter: <b>class</b>
2443   * <p>
2444   * Description: <b>Categorization of Composition</b><br>
2445   * Type: <b>token</b><br>
2446   * Path: <b>Composition.class</b><br>
2447   * </p>
2448   */
2449  @SearchParamDefinition(name="class", path="Composition.class", description="Categorization of Composition", type="token" )
2450  public static final String SP_CLASS = "class";
2451 /**
2452   * <b>Fluent Client</b> search parameter constant for <b>class</b>
2453   * <p>
2454   * Description: <b>Categorization of Composition</b><br>
2455   * Type: <b>token</b><br>
2456   * Path: <b>Composition.class</b><br>
2457   * </p>
2458   */
2459  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASS);
2460
2461 /**
2462   * Search parameter: <b>encounter</b>
2463   * <p>
2464   * Description: <b>Context of the Composition</b><br>
2465   * Type: <b>reference</b><br>
2466   * Path: <b>Composition.encounter</b><br>
2467   * </p>
2468   */
2469  @SearchParamDefinition(name="encounter", path="Composition.encounter", description="Context of the Composition", type="reference" )
2470  public static final String SP_ENCOUNTER = "encounter";
2471 /**
2472   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2473   * <p>
2474   * Description: <b>Context of the Composition</b><br>
2475   * Type: <b>reference</b><br>
2476   * Path: <b>Composition.encounter</b><br>
2477   * </p>
2478   */
2479  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
2480
2481/**
2482   * Constant for fluent queries to be used to add include statements. Specifies
2483   * the path value of "<b>Composition:encounter</b>".
2484   */
2485  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("Composition:encounter").toLocked();
2486
2487 /**
2488   * Search parameter: <b>period</b>
2489   * <p>
2490   * Description: <b>The period covered by the documentation</b><br>
2491   * Type: <b>date</b><br>
2492   * Path: <b>Composition.event.period</b><br>
2493   * </p>
2494   */
2495  @SearchParamDefinition(name="period", path="Composition.event.period", description="The period covered by the documentation", type="date" )
2496  public static final String SP_PERIOD = "period";
2497 /**
2498   * <b>Fluent Client</b> search parameter constant for <b>period</b>
2499   * <p>
2500   * Description: <b>The period covered by the documentation</b><br>
2501   * Type: <b>date</b><br>
2502   * Path: <b>Composition.event.period</b><br>
2503   * </p>
2504   */
2505  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
2506
2507 /**
2508   * Search parameter: <b>type</b>
2509   * <p>
2510   * Description: <b>Kind of composition (LOINC if possible)</b><br>
2511   * Type: <b>token</b><br>
2512   * Path: <b>Composition.type</b><br>
2513   * </p>
2514   */
2515  @SearchParamDefinition(name="type", path="Composition.type", description="Kind of composition (LOINC if possible)", type="token" )
2516  public static final String SP_TYPE = "type";
2517 /**
2518   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2519   * <p>
2520   * Description: <b>Kind of composition (LOINC if possible)</b><br>
2521   * Type: <b>token</b><br>
2522   * Path: <b>Composition.type</b><br>
2523   * </p>
2524   */
2525  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2526
2527 /**
2528   * Search parameter: <b>date</b>
2529   * <p>
2530   * Description: <b>Composition editing time</b><br>
2531   * Type: <b>date</b><br>
2532   * Path: <b>Composition.date</b><br>
2533   * </p>
2534   */
2535  @SearchParamDefinition(name="date", path="Composition.date", description="Composition editing time", type="date" )
2536  public static final String SP_DATE = "date";
2537 /**
2538   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2539   * <p>
2540   * Description: <b>Composition editing time</b><br>
2541   * Type: <b>date</b><br>
2542   * Path: <b>Composition.date</b><br>
2543   * </p>
2544   */
2545  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2546
2547 /**
2548   * Search parameter: <b>section</b>
2549   * <p>
2550   * Description: <b>Classification of section (recommended)</b><br>
2551   * Type: <b>token</b><br>
2552   * Path: <b>Composition.section.code</b><br>
2553   * </p>
2554   */
2555  @SearchParamDefinition(name="section", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
2556  public static final String SP_SECTION = "section";
2557 /**
2558   * <b>Fluent Client</b> search parameter constant for <b>section</b>
2559   * <p>
2560   * Description: <b>Classification of section (recommended)</b><br>
2561   * Type: <b>token</b><br>
2562   * Path: <b>Composition.section.code</b><br>
2563   * </p>
2564   */
2565  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SECTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SECTION);
2566
2567 /**
2568   * Search parameter: <b>author</b>
2569   * <p>
2570   * Description: <b>Who and/or what authored the composition</b><br>
2571   * Type: <b>reference</b><br>
2572   * Path: <b>Composition.author</b><br>
2573   * </p>
2574   */
2575  @SearchParamDefinition(name="author", path="Composition.author", description="Who and/or what authored the composition", type="reference" )
2576  public static final String SP_AUTHOR = "author";
2577 /**
2578   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2579   * <p>
2580   * Description: <b>Who and/or what authored the composition</b><br>
2581   * Type: <b>reference</b><br>
2582   * Path: <b>Composition.author</b><br>
2583   * </p>
2584   */
2585  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
2586
2587/**
2588   * Constant for fluent queries to be used to add include statements. Specifies
2589   * the path value of "<b>Composition:author</b>".
2590   */
2591  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Composition:author").toLocked();
2592
2593 /**
2594   * Search parameter: <b>title</b>
2595   * <p>
2596   * Description: <b>Human Readable name/title</b><br>
2597   * Type: <b>string</b><br>
2598   * Path: <b>Composition.title</b><br>
2599   * </p>
2600   */
2601  @SearchParamDefinition(name="title", path="Composition.title", description="Human Readable name/title", type="string" )
2602  public static final String SP_TITLE = "title";
2603 /**
2604   * <b>Fluent Client</b> search parameter constant for <b>title</b>
2605   * <p>
2606   * Description: <b>Human Readable name/title</b><br>
2607   * Type: <b>string</b><br>
2608   * Path: <b>Composition.title</b><br>
2609   * </p>
2610   */
2611  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
2612
2613 /**
2614   * Search parameter: <b>patient</b>
2615   * <p>
2616   * Description: <b>Who and/or what the composition is about</b><br>
2617   * Type: <b>reference</b><br>
2618   * Path: <b>Composition.subject</b><br>
2619   * </p>
2620   */
2621  @SearchParamDefinition(name="patient", path="Composition.subject", description="Who and/or what the composition is about", type="reference" )
2622  public static final String SP_PATIENT = "patient";
2623 /**
2624   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2625   * <p>
2626   * Description: <b>Who and/or what the composition is about</b><br>
2627   * Type: <b>reference</b><br>
2628   * Path: <b>Composition.subject</b><br>
2629   * </p>
2630   */
2631  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2632
2633/**
2634   * Constant for fluent queries to be used to add include statements. Specifies
2635   * the path value of "<b>Composition:patient</b>".
2636   */
2637  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Composition:patient").toLocked();
2638
2639 /**
2640   * Search parameter: <b>confidentiality</b>
2641   * <p>
2642   * Description: <b>As defined by affinity domain</b><br>
2643   * Type: <b>token</b><br>
2644   * Path: <b>Composition.confidentiality</b><br>
2645   * </p>
2646   */
2647  @SearchParamDefinition(name="confidentiality", path="Composition.confidentiality", description="As defined by affinity domain", type="token" )
2648  public static final String SP_CONFIDENTIALITY = "confidentiality";
2649 /**
2650   * <b>Fluent Client</b> search parameter constant for <b>confidentiality</b>
2651   * <p>
2652   * Description: <b>As defined by affinity domain</b><br>
2653   * Type: <b>token</b><br>
2654   * Path: <b>Composition.confidentiality</b><br>
2655   * </p>
2656   */
2657  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONFIDENTIALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONFIDENTIALITY);
2658
2659 /**
2660   * Search parameter: <b>attester</b>
2661   * <p>
2662   * Description: <b>Who attested the composition</b><br>
2663   * Type: <b>reference</b><br>
2664   * Path: <b>Composition.attester.party</b><br>
2665   * </p>
2666   */
2667  @SearchParamDefinition(name="attester", path="Composition.attester.party", description="Who attested the composition", type="reference" )
2668  public static final String SP_ATTESTER = "attester";
2669 /**
2670   * <b>Fluent Client</b> search parameter constant for <b>attester</b>
2671   * <p>
2672   * Description: <b>Who attested the composition</b><br>
2673   * Type: <b>reference</b><br>
2674   * Path: <b>Composition.attester.party</b><br>
2675   * </p>
2676   */
2677  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ATTESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ATTESTER);
2678
2679/**
2680   * Constant for fluent queries to be used to add include statements. Specifies
2681   * the path value of "<b>Composition:attester</b>".
2682   */
2683  public static final ca.uhn.fhir.model.api.Include INCLUDE_ATTESTER = new ca.uhn.fhir.model.api.Include("Composition:attester").toLocked();
2684
2685 /**
2686   * Search parameter: <b>entry</b>
2687   * <p>
2688   * Description: <b>A reference to data that supports this section</b><br>
2689   * Type: <b>reference</b><br>
2690   * Path: <b>Composition.section.entry</b><br>
2691   * </p>
2692   */
2693  @SearchParamDefinition(name="entry", path="Composition.section.entry", description="A reference to data that supports this section", type="reference" )
2694  public static final String SP_ENTRY = "entry";
2695 /**
2696   * <b>Fluent Client</b> search parameter constant for <b>entry</b>
2697   * <p>
2698   * Description: <b>A reference to data that supports this section</b><br>
2699   * Type: <b>reference</b><br>
2700   * Path: <b>Composition.section.entry</b><br>
2701   * </p>
2702   */
2703  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTRY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENTRY);
2704
2705/**
2706   * Constant for fluent queries to be used to add include statements. Specifies
2707   * the path value of "<b>Composition:entry</b>".
2708   */
2709  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTRY = new ca.uhn.fhir.model.api.Include("Composition:entry").toLocked();
2710
2711 /**
2712   * Search parameter: <b>context</b>
2713   * <p>
2714   * Description: <b>Code(s) that apply to the event being documented</b><br>
2715   * Type: <b>token</b><br>
2716   * Path: <b>Composition.event.code</b><br>
2717   * </p>
2718   */
2719  @SearchParamDefinition(name="context", path="Composition.event.code", description="Code(s) that apply to the event being documented", type="token" )
2720  public static final String SP_CONTEXT = "context";
2721 /**
2722   * <b>Fluent Client</b> search parameter constant for <b>context</b>
2723   * <p>
2724   * Description: <b>Code(s) that apply to the event being documented</b><br>
2725   * Type: <b>token</b><br>
2726   * Path: <b>Composition.event.code</b><br>
2727   * </p>
2728   */
2729  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
2730
2731 /**
2732   * Search parameter: <b>identifier</b>
2733   * <p>
2734   * Description: <b>Logical identifier of composition (version-independent)</b><br>
2735   * Type: <b>token</b><br>
2736   * Path: <b>Composition.identifier</b><br>
2737   * </p>
2738   */
2739  @SearchParamDefinition(name="identifier", path="Composition.identifier", description="Logical identifier of composition (version-independent)", type="token" )
2740  public static final String SP_IDENTIFIER = "identifier";
2741 /**
2742   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2743   * <p>
2744   * Description: <b>Logical identifier of composition (version-independent)</b><br>
2745   * Type: <b>token</b><br>
2746   * Path: <b>Composition.identifier</b><br>
2747   * </p>
2748   */
2749  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2750
2751
2752}