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