001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * A set of information summarized from a list of other resources.
051 */
052@ResourceDef(name="List", profile="http://hl7.org/fhir/Profile/ListResource")
053public class ListResource extends DomainResource {
054
055    public enum ListStatus {
056        /**
057         * The list is considered to be an active part of the patient's record.
058         */
059        CURRENT, 
060        /**
061         * The list is "old" and should no longer be considered accurate or relevant.
062         */
063        RETIRED, 
064        /**
065         * The list was never accurate.  It is retained for medico-legal purposes only.
066         */
067        ENTEREDINERROR, 
068        /**
069         * added to help the parsers
070         */
071        NULL;
072        public static ListStatus fromCode(String codeString) throws FHIRException {
073            if (codeString == null || "".equals(codeString))
074                return null;
075        if ("current".equals(codeString))
076          return CURRENT;
077        if ("retired".equals(codeString))
078          return RETIRED;
079        if ("entered-in-error".equals(codeString))
080          return ENTEREDINERROR;
081        throw new FHIRException("Unknown ListStatus code '"+codeString+"'");
082        }
083        public String toCode() {
084          switch (this) {
085            case CURRENT: return "current";
086            case RETIRED: return "retired";
087            case ENTEREDINERROR: return "entered-in-error";
088            case NULL: return null;
089            default: return "?";
090          }
091        }
092        public String getSystem() {
093          switch (this) {
094            case CURRENT: return "http://hl7.org/fhir/list-status";
095            case RETIRED: return "http://hl7.org/fhir/list-status";
096            case ENTEREDINERROR: return "http://hl7.org/fhir/list-status";
097            case NULL: return null;
098            default: return "?";
099          }
100        }
101        public String getDefinition() {
102          switch (this) {
103            case CURRENT: return "The list is considered to be an active part of the patient's record.";
104            case RETIRED: return "The list is \"old\" and should no longer be considered accurate or relevant.";
105            case ENTEREDINERROR: return "The list was never accurate.  It is retained for medico-legal purposes only.";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getDisplay() {
111          switch (this) {
112            case CURRENT: return "Current";
113            case RETIRED: return "Retired";
114            case ENTEREDINERROR: return "Entered In Error";
115            case NULL: return null;
116            default: return "?";
117          }
118        }
119    }
120
121  public static class ListStatusEnumFactory implements EnumFactory<ListStatus> {
122    public ListStatus fromCode(String codeString) throws IllegalArgumentException {
123      if (codeString == null || "".equals(codeString))
124            if (codeString == null || "".equals(codeString))
125                return null;
126        if ("current".equals(codeString))
127          return ListStatus.CURRENT;
128        if ("retired".equals(codeString))
129          return ListStatus.RETIRED;
130        if ("entered-in-error".equals(codeString))
131          return ListStatus.ENTEREDINERROR;
132        throw new IllegalArgumentException("Unknown ListStatus code '"+codeString+"'");
133        }
134        public Enumeration<ListStatus> fromType(Base code) throws FHIRException {
135          if (code == null || code.isEmpty())
136            return null;
137          String codeString = ((PrimitiveType) code).asStringValue();
138          if (codeString == null || "".equals(codeString))
139            return null;
140        if ("current".equals(codeString))
141          return new Enumeration<ListStatus>(this, ListStatus.CURRENT);
142        if ("retired".equals(codeString))
143          return new Enumeration<ListStatus>(this, ListStatus.RETIRED);
144        if ("entered-in-error".equals(codeString))
145          return new Enumeration<ListStatus>(this, ListStatus.ENTEREDINERROR);
146        throw new FHIRException("Unknown ListStatus code '"+codeString+"'");
147        }
148    public String toCode(ListStatus code) {
149      if (code == ListStatus.CURRENT)
150        return "current";
151      if (code == ListStatus.RETIRED)
152        return "retired";
153      if (code == ListStatus.ENTEREDINERROR)
154        return "entered-in-error";
155      return "?";
156      }
157    public String toSystem(ListStatus code) {
158      return code.getSystem();
159      }
160    }
161
162    public enum ListMode {
163        /**
164         * This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes
165         */
166        WORKING, 
167        /**
168         * This list was prepared as a snapshot. It should not be assumed to be current
169         */
170        SNAPSHOT, 
171        /**
172         * A list that indicates where changes have been made or recommended
173         */
174        CHANGES, 
175        /**
176         * added to help the parsers
177         */
178        NULL;
179        public static ListMode fromCode(String codeString) throws FHIRException {
180            if (codeString == null || "".equals(codeString))
181                return null;
182        if ("working".equals(codeString))
183          return WORKING;
184        if ("snapshot".equals(codeString))
185          return SNAPSHOT;
186        if ("changes".equals(codeString))
187          return CHANGES;
188        throw new FHIRException("Unknown ListMode code '"+codeString+"'");
189        }
190        public String toCode() {
191          switch (this) {
192            case WORKING: return "working";
193            case SNAPSHOT: return "snapshot";
194            case CHANGES: return "changes";
195            case NULL: return null;
196            default: return "?";
197          }
198        }
199        public String getSystem() {
200          switch (this) {
201            case WORKING: return "http://hl7.org/fhir/list-mode";
202            case SNAPSHOT: return "http://hl7.org/fhir/list-mode";
203            case CHANGES: return "http://hl7.org/fhir/list-mode";
204            case NULL: return null;
205            default: return "?";
206          }
207        }
208        public String getDefinition() {
209          switch (this) {
210            case WORKING: return "This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes";
211            case SNAPSHOT: return "This list was prepared as a snapshot. It should not be assumed to be current";
212            case CHANGES: return "A list that indicates where changes have been made or recommended";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDisplay() {
218          switch (this) {
219            case WORKING: return "Working List";
220            case SNAPSHOT: return "Snapshot List";
221            case CHANGES: return "Change List";
222            case NULL: return null;
223            default: return "?";
224          }
225        }
226    }
227
228  public static class ListModeEnumFactory implements EnumFactory<ListMode> {
229    public ListMode fromCode(String codeString) throws IllegalArgumentException {
230      if (codeString == null || "".equals(codeString))
231            if (codeString == null || "".equals(codeString))
232                return null;
233        if ("working".equals(codeString))
234          return ListMode.WORKING;
235        if ("snapshot".equals(codeString))
236          return ListMode.SNAPSHOT;
237        if ("changes".equals(codeString))
238          return ListMode.CHANGES;
239        throw new IllegalArgumentException("Unknown ListMode code '"+codeString+"'");
240        }
241        public Enumeration<ListMode> fromType(Base code) throws FHIRException {
242          if (code == null || code.isEmpty())
243            return null;
244          String codeString = ((PrimitiveType) code).asStringValue();
245          if (codeString == null || "".equals(codeString))
246            return null;
247        if ("working".equals(codeString))
248          return new Enumeration<ListMode>(this, ListMode.WORKING);
249        if ("snapshot".equals(codeString))
250          return new Enumeration<ListMode>(this, ListMode.SNAPSHOT);
251        if ("changes".equals(codeString))
252          return new Enumeration<ListMode>(this, ListMode.CHANGES);
253        throw new FHIRException("Unknown ListMode code '"+codeString+"'");
254        }
255    public String toCode(ListMode code) {
256      if (code == ListMode.WORKING)
257        return "working";
258      if (code == ListMode.SNAPSHOT)
259        return "snapshot";
260      if (code == ListMode.CHANGES)
261        return "changes";
262      return "?";
263      }
264    public String toSystem(ListMode code) {
265      return code.getSystem();
266      }
267    }
268
269    @Block()
270    public static class ListEntryComponent extends BackboneElement implements IBaseBackboneElement {
271        /**
272         * The flag allows the system constructing the list to indicate the role and significance of the item in the list.
273         */
274        @Child(name = "flag", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
275        @Description(shortDefinition="Status/Workflow information about this item", formalDefinition="The flag allows the system constructing the list to indicate the role and significance of the item in the list." )
276        protected CodeableConcept flag;
277
278        /**
279         * True if this item is marked as deleted in the list.
280         */
281        @Child(name = "deleted", type = {BooleanType.class}, order=2, min=0, max=1, modifier=true, summary=false)
282        @Description(shortDefinition="If this item is actually marked as deleted", formalDefinition="True if this item is marked as deleted in the list." )
283        protected BooleanType deleted;
284
285        /**
286         * When this item was added to the list.
287         */
288        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
289        @Description(shortDefinition="When item added to list", formalDefinition="When this item was added to the list." )
290        protected DateTimeType date;
291
292        /**
293         * A reference to the actual resource from which data was derived.
294         */
295        @Child(name = "item", type = {}, order=4, min=1, max=1, modifier=false, summary=false)
296        @Description(shortDefinition="Actual entry", formalDefinition="A reference to the actual resource from which data was derived." )
297        protected Reference item;
298
299        /**
300         * The actual object that is the target of the reference (A reference to the actual resource from which data was derived.)
301         */
302        protected Resource itemTarget;
303
304        private static final long serialVersionUID = -758164425L;
305
306    /**
307     * Constructor
308     */
309      public ListEntryComponent() {
310        super();
311      }
312
313    /**
314     * Constructor
315     */
316      public ListEntryComponent(Reference item) {
317        super();
318        this.item = item;
319      }
320
321        /**
322         * @return {@link #flag} (The flag allows the system constructing the list to indicate the role and significance of the item in the list.)
323         */
324        public CodeableConcept getFlag() { 
325          if (this.flag == null)
326            if (Configuration.errorOnAutoCreate())
327              throw new Error("Attempt to auto-create ListEntryComponent.flag");
328            else if (Configuration.doAutoCreate())
329              this.flag = new CodeableConcept(); // cc
330          return this.flag;
331        }
332
333        public boolean hasFlag() { 
334          return this.flag != null && !this.flag.isEmpty();
335        }
336
337        /**
338         * @param value {@link #flag} (The flag allows the system constructing the list to indicate the role and significance of the item in the list.)
339         */
340        public ListEntryComponent setFlag(CodeableConcept value) { 
341          this.flag = value;
342          return this;
343        }
344
345        /**
346         * @return {@link #deleted} (True if this item is marked as deleted in the list.). This is the underlying object with id, value and extensions. The accessor "getDeleted" gives direct access to the value
347         */
348        public BooleanType getDeletedElement() { 
349          if (this.deleted == null)
350            if (Configuration.errorOnAutoCreate())
351              throw new Error("Attempt to auto-create ListEntryComponent.deleted");
352            else if (Configuration.doAutoCreate())
353              this.deleted = new BooleanType(); // bb
354          return this.deleted;
355        }
356
357        public boolean hasDeletedElement() { 
358          return this.deleted != null && !this.deleted.isEmpty();
359        }
360
361        public boolean hasDeleted() { 
362          return this.deleted != null && !this.deleted.isEmpty();
363        }
364
365        /**
366         * @param value {@link #deleted} (True if this item is marked as deleted in the list.). This is the underlying object with id, value and extensions. The accessor "getDeleted" gives direct access to the value
367         */
368        public ListEntryComponent setDeletedElement(BooleanType value) { 
369          this.deleted = value;
370          return this;
371        }
372
373        /**
374         * @return True if this item is marked as deleted in the list.
375         */
376        public boolean getDeleted() { 
377          return this.deleted == null || this.deleted.isEmpty() ? false : this.deleted.getValue();
378        }
379
380        /**
381         * @param value True if this item is marked as deleted in the list.
382         */
383        public ListEntryComponent setDeleted(boolean value) { 
384            if (this.deleted == null)
385              this.deleted = new BooleanType();
386            this.deleted.setValue(value);
387          return this;
388        }
389
390        /**
391         * @return {@link #date} (When this item was added to the list.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
392         */
393        public DateTimeType getDateElement() { 
394          if (this.date == null)
395            if (Configuration.errorOnAutoCreate())
396              throw new Error("Attempt to auto-create ListEntryComponent.date");
397            else if (Configuration.doAutoCreate())
398              this.date = new DateTimeType(); // bb
399          return this.date;
400        }
401
402        public boolean hasDateElement() { 
403          return this.date != null && !this.date.isEmpty();
404        }
405
406        public boolean hasDate() { 
407          return this.date != null && !this.date.isEmpty();
408        }
409
410        /**
411         * @param value {@link #date} (When this item was added to the list.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
412         */
413        public ListEntryComponent setDateElement(DateTimeType value) { 
414          this.date = value;
415          return this;
416        }
417
418        /**
419         * @return When this item was added to the list.
420         */
421        public Date getDate() { 
422          return this.date == null ? null : this.date.getValue();
423        }
424
425        /**
426         * @param value When this item was added to the list.
427         */
428        public ListEntryComponent setDate(Date value) { 
429          if (value == null)
430            this.date = null;
431          else {
432            if (this.date == null)
433              this.date = new DateTimeType();
434            this.date.setValue(value);
435          }
436          return this;
437        }
438
439        /**
440         * @return {@link #item} (A reference to the actual resource from which data was derived.)
441         */
442        public Reference getItem() { 
443          if (this.item == null)
444            if (Configuration.errorOnAutoCreate())
445              throw new Error("Attempt to auto-create ListEntryComponent.item");
446            else if (Configuration.doAutoCreate())
447              this.item = new Reference(); // cc
448          return this.item;
449        }
450
451        public boolean hasItem() { 
452          return this.item != null && !this.item.isEmpty();
453        }
454
455        /**
456         * @param value {@link #item} (A reference to the actual resource from which data was derived.)
457         */
458        public ListEntryComponent setItem(Reference value) { 
459          this.item = value;
460          return this;
461        }
462
463        /**
464         * @return {@link #item} 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. (A reference to the actual resource from which data was derived.)
465         */
466        public Resource getItemTarget() { 
467          return this.itemTarget;
468        }
469
470        /**
471         * @param value {@link #item} 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. (A reference to the actual resource from which data was derived.)
472         */
473        public ListEntryComponent setItemTarget(Resource value) { 
474          this.itemTarget = value;
475          return this;
476        }
477
478        protected void listChildren(List<Property> childrenList) {
479          super.listChildren(childrenList);
480          childrenList.add(new Property("flag", "CodeableConcept", "The flag allows the system constructing the list to indicate the role and significance of the item in the list.", 0, java.lang.Integer.MAX_VALUE, flag));
481          childrenList.add(new Property("deleted", "boolean", "True if this item is marked as deleted in the list.", 0, java.lang.Integer.MAX_VALUE, deleted));
482          childrenList.add(new Property("date", "dateTime", "When this item was added to the list.", 0, java.lang.Integer.MAX_VALUE, date));
483          childrenList.add(new Property("item", "Reference(Any)", "A reference to the actual resource from which data was derived.", 0, java.lang.Integer.MAX_VALUE, item));
484        }
485
486      @Override
487      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
488        switch (hash) {
489        case 3145580: /*flag*/ return this.flag == null ? new Base[0] : new Base[] {this.flag}; // CodeableConcept
490        case 1550463001: /*deleted*/ return this.deleted == null ? new Base[0] : new Base[] {this.deleted}; // BooleanType
491        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
492        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Reference
493        default: return super.getProperty(hash, name, checkValid);
494        }
495
496      }
497
498      @Override
499      public void setProperty(int hash, String name, Base value) throws FHIRException {
500        switch (hash) {
501        case 3145580: // flag
502          this.flag = castToCodeableConcept(value); // CodeableConcept
503          break;
504        case 1550463001: // deleted
505          this.deleted = castToBoolean(value); // BooleanType
506          break;
507        case 3076014: // date
508          this.date = castToDateTime(value); // DateTimeType
509          break;
510        case 3242771: // item
511          this.item = castToReference(value); // Reference
512          break;
513        default: super.setProperty(hash, name, value);
514        }
515
516      }
517
518      @Override
519      public void setProperty(String name, Base value) throws FHIRException {
520        if (name.equals("flag"))
521          this.flag = castToCodeableConcept(value); // CodeableConcept
522        else if (name.equals("deleted"))
523          this.deleted = castToBoolean(value); // BooleanType
524        else if (name.equals("date"))
525          this.date = castToDateTime(value); // DateTimeType
526        else if (name.equals("item"))
527          this.item = castToReference(value); // Reference
528        else
529          super.setProperty(name, value);
530      }
531
532      @Override
533      public Base makeProperty(int hash, String name) throws FHIRException {
534        switch (hash) {
535        case 3145580:  return getFlag(); // CodeableConcept
536        case 1550463001: throw new FHIRException("Cannot make property deleted as it is not a complex type"); // BooleanType
537        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
538        case 3242771:  return getItem(); // Reference
539        default: return super.makeProperty(hash, name);
540        }
541
542      }
543
544      @Override
545      public Base addChild(String name) throws FHIRException {
546        if (name.equals("flag")) {
547          this.flag = new CodeableConcept();
548          return this.flag;
549        }
550        else if (name.equals("deleted")) {
551          throw new FHIRException("Cannot call addChild on a primitive type ListResource.deleted");
552        }
553        else if (name.equals("date")) {
554          throw new FHIRException("Cannot call addChild on a primitive type ListResource.date");
555        }
556        else if (name.equals("item")) {
557          this.item = new Reference();
558          return this.item;
559        }
560        else
561          return super.addChild(name);
562      }
563
564      public ListEntryComponent copy() {
565        ListEntryComponent dst = new ListEntryComponent();
566        copyValues(dst);
567        dst.flag = flag == null ? null : flag.copy();
568        dst.deleted = deleted == null ? null : deleted.copy();
569        dst.date = date == null ? null : date.copy();
570        dst.item = item == null ? null : item.copy();
571        return dst;
572      }
573
574      @Override
575      public boolean equalsDeep(Base other) {
576        if (!super.equalsDeep(other))
577          return false;
578        if (!(other instanceof ListEntryComponent))
579          return false;
580        ListEntryComponent o = (ListEntryComponent) other;
581        return compareDeep(flag, o.flag, true) && compareDeep(deleted, o.deleted, true) && compareDeep(date, o.date, true)
582           && compareDeep(item, o.item, true);
583      }
584
585      @Override
586      public boolean equalsShallow(Base other) {
587        if (!super.equalsShallow(other))
588          return false;
589        if (!(other instanceof ListEntryComponent))
590          return false;
591        ListEntryComponent o = (ListEntryComponent) other;
592        return compareValues(deleted, o.deleted, true) && compareValues(date, o.date, true);
593      }
594
595      public boolean isEmpty() {
596        return super.isEmpty() && (flag == null || flag.isEmpty()) && (deleted == null || deleted.isEmpty())
597           && (date == null || date.isEmpty()) && (item == null || item.isEmpty());
598      }
599
600  public String fhirType() {
601    return "List.entry";
602
603  }
604
605  }
606
607    /**
608     * Identifier for the List assigned for business purposes outside the context of FHIR.
609     */
610    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
611    @Description(shortDefinition="Business identifier", formalDefinition="Identifier for the List assigned for business purposes outside the context of FHIR." )
612    protected List<Identifier> identifier;
613
614    /**
615     * Indicates the current state of this list.
616     */
617    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
618    @Description(shortDefinition="current | retired | entered-in-error", formalDefinition="Indicates the current state of this list." )
619    protected Enumeration<ListStatus> status;
620
621    /**
622     * How this 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.
623     */
624    @Child(name = "mode", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
625    @Description(shortDefinition="working | snapshot | changes", formalDefinition="How this 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." )
626    protected Enumeration<ListMode> mode;
627
628    /**
629     * A label for the list assigned by the author.
630     */
631    @Child(name = "title", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
632    @Description(shortDefinition="Descriptive name for the list", formalDefinition="A label for the list assigned by the author." )
633    protected StringType title;
634
635    /**
636     * This code defines the purpose of the list - why it was created.
637     */
638    @Child(name = "code", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
639    @Description(shortDefinition="What the purpose of this list is", formalDefinition="This code defines the purpose of the list - why it was created." )
640    protected CodeableConcept code;
641
642    /**
643     * The common subject (or patient) of the resources that are in the list, if there is one.
644     */
645    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=5, min=0, max=1, modifier=false, summary=true)
646    @Description(shortDefinition="If all resources have the same subject", formalDefinition="The common subject (or patient) of the resources that are in the list, if there is one." )
647    protected Reference subject;
648
649    /**
650     * The actual object that is the target of the reference (The common subject (or patient) of the resources that are in the list, if there is one.)
651     */
652    protected Resource subjectTarget;
653
654    /**
655     * The encounter that is the context in which this list was created.
656     */
657    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=false)
658    @Description(shortDefinition="Context in which list created", formalDefinition="The encounter that is the context in which this list was created." )
659    protected Reference encounter;
660
661    /**
662     * The actual object that is the target of the reference (The encounter that is the context in which this list was created.)
663     */
664    protected Encounter encounterTarget;
665
666    /**
667     * The date that the list was prepared.
668     */
669    @Child(name = "date", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
670    @Description(shortDefinition="When the list was prepared", formalDefinition="The date that the list was prepared." )
671    protected DateTimeType date;
672
673    /**
674     * The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.
675     */
676    @Child(name = "source", type = {Practitioner.class, Patient.class, Device.class}, order=8, min=0, max=1, modifier=false, summary=true)
677    @Description(shortDefinition="Who and/or what defined the list contents (aka Author)", formalDefinition="The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list." )
678    protected Reference source;
679
680    /**
681     * The actual object that is the target of the reference (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
682     */
683    protected Resource sourceTarget;
684
685    /**
686     * What order applies to the items in the list.
687     */
688    @Child(name = "orderedBy", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=false)
689    @Description(shortDefinition="What order the list has", formalDefinition="What order applies to the items in the list." )
690    protected CodeableConcept orderedBy;
691
692    /**
693     * Comments that apply to the overall list.
694     */
695    @Child(name = "note", type = {Annotation.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
696    @Description(shortDefinition="Comments about the list", formalDefinition="Comments that apply to the overall list." )
697    protected List<Annotation> note;
698
699    /**
700     * Entries in this list.
701     */
702    @Child(name = "entry", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
703    @Description(shortDefinition="Entries in the list", formalDefinition="Entries in this list." )
704    protected List<ListEntryComponent> entry;
705
706    /**
707     * If the list is empty, why the list is empty.
708     */
709    @Child(name = "emptyReason", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
710    @Description(shortDefinition="Why list is empty", formalDefinition="If the list is empty, why the list is empty." )
711    protected CodeableConcept emptyReason;
712
713    private static final long serialVersionUID = 2071342704L;
714
715  /**
716   * Constructor
717   */
718    public ListResource() {
719      super();
720    }
721
722  /**
723   * Constructor
724   */
725    public ListResource(Enumeration<ListStatus> status, Enumeration<ListMode> mode) {
726      super();
727      this.status = status;
728      this.mode = mode;
729    }
730
731    /**
732     * @return {@link #identifier} (Identifier for the List assigned for business purposes outside the context of FHIR.)
733     */
734    public List<Identifier> getIdentifier() { 
735      if (this.identifier == null)
736        this.identifier = new ArrayList<Identifier>();
737      return this.identifier;
738    }
739
740    public boolean hasIdentifier() { 
741      if (this.identifier == null)
742        return false;
743      for (Identifier item : this.identifier)
744        if (!item.isEmpty())
745          return true;
746      return false;
747    }
748
749    /**
750     * @return {@link #identifier} (Identifier for the List assigned for business purposes outside the context of FHIR.)
751     */
752    // syntactic sugar
753    public Identifier addIdentifier() { //3
754      Identifier t = new Identifier();
755      if (this.identifier == null)
756        this.identifier = new ArrayList<Identifier>();
757      this.identifier.add(t);
758      return t;
759    }
760
761    // syntactic sugar
762    public ListResource addIdentifier(Identifier t) { //3
763      if (t == null)
764        return this;
765      if (this.identifier == null)
766        this.identifier = new ArrayList<Identifier>();
767      this.identifier.add(t);
768      return this;
769    }
770
771    /**
772     * @return {@link #status} (Indicates the current state of this list.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
773     */
774    public Enumeration<ListStatus> getStatusElement() { 
775      if (this.status == null)
776        if (Configuration.errorOnAutoCreate())
777          throw new Error("Attempt to auto-create ListResource.status");
778        else if (Configuration.doAutoCreate())
779          this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory()); // bb
780      return this.status;
781    }
782
783    public boolean hasStatusElement() { 
784      return this.status != null && !this.status.isEmpty();
785    }
786
787    public boolean hasStatus() { 
788      return this.status != null && !this.status.isEmpty();
789    }
790
791    /**
792     * @param value {@link #status} (Indicates the current state of this list.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
793     */
794    public ListResource setStatusElement(Enumeration<ListStatus> value) { 
795      this.status = value;
796      return this;
797    }
798
799    /**
800     * @return Indicates the current state of this list.
801     */
802    public ListStatus getStatus() { 
803      return this.status == null ? null : this.status.getValue();
804    }
805
806    /**
807     * @param value Indicates the current state of this list.
808     */
809    public ListResource setStatus(ListStatus value) { 
810        if (this.status == null)
811          this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory());
812        this.status.setValue(value);
813      return this;
814    }
815
816    /**
817     * @return {@link #mode} (How this 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
818     */
819    public Enumeration<ListMode> getModeElement() { 
820      if (this.mode == null)
821        if (Configuration.errorOnAutoCreate())
822          throw new Error("Attempt to auto-create ListResource.mode");
823        else if (Configuration.doAutoCreate())
824          this.mode = new Enumeration<ListMode>(new ListModeEnumFactory()); // bb
825      return this.mode;
826    }
827
828    public boolean hasModeElement() { 
829      return this.mode != null && !this.mode.isEmpty();
830    }
831
832    public boolean hasMode() { 
833      return this.mode != null && !this.mode.isEmpty();
834    }
835
836    /**
837     * @param value {@link #mode} (How this 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
838     */
839    public ListResource setModeElement(Enumeration<ListMode> value) { 
840      this.mode = value;
841      return this;
842    }
843
844    /**
845     * @return How this 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.
846     */
847    public ListMode getMode() { 
848      return this.mode == null ? null : this.mode.getValue();
849    }
850
851    /**
852     * @param value How this 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.
853     */
854    public ListResource setMode(ListMode value) { 
855        if (this.mode == null)
856          this.mode = new Enumeration<ListMode>(new ListModeEnumFactory());
857        this.mode.setValue(value);
858      return this;
859    }
860
861    /**
862     * @return {@link #title} (A label for the list assigned by the author.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
863     */
864    public StringType getTitleElement() { 
865      if (this.title == null)
866        if (Configuration.errorOnAutoCreate())
867          throw new Error("Attempt to auto-create ListResource.title");
868        else if (Configuration.doAutoCreate())
869          this.title = new StringType(); // bb
870      return this.title;
871    }
872
873    public boolean hasTitleElement() { 
874      return this.title != null && !this.title.isEmpty();
875    }
876
877    public boolean hasTitle() { 
878      return this.title != null && !this.title.isEmpty();
879    }
880
881    /**
882     * @param value {@link #title} (A label for the list assigned by the author.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
883     */
884    public ListResource setTitleElement(StringType value) { 
885      this.title = value;
886      return this;
887    }
888
889    /**
890     * @return A label for the list assigned by the author.
891     */
892    public String getTitle() { 
893      return this.title == null ? null : this.title.getValue();
894    }
895
896    /**
897     * @param value A label for the list assigned by the author.
898     */
899    public ListResource setTitle(String value) { 
900      if (Utilities.noString(value))
901        this.title = null;
902      else {
903        if (this.title == null)
904          this.title = new StringType();
905        this.title.setValue(value);
906      }
907      return this;
908    }
909
910    /**
911     * @return {@link #code} (This code defines the purpose of the list - why it was created.)
912     */
913    public CodeableConcept getCode() { 
914      if (this.code == null)
915        if (Configuration.errorOnAutoCreate())
916          throw new Error("Attempt to auto-create ListResource.code");
917        else if (Configuration.doAutoCreate())
918          this.code = new CodeableConcept(); // cc
919      return this.code;
920    }
921
922    public boolean hasCode() { 
923      return this.code != null && !this.code.isEmpty();
924    }
925
926    /**
927     * @param value {@link #code} (This code defines the purpose of the list - why it was created.)
928     */
929    public ListResource setCode(CodeableConcept value) { 
930      this.code = value;
931      return this;
932    }
933
934    /**
935     * @return {@link #subject} (The common subject (or patient) of the resources that are in the list, if there is one.)
936     */
937    public Reference getSubject() { 
938      if (this.subject == null)
939        if (Configuration.errorOnAutoCreate())
940          throw new Error("Attempt to auto-create ListResource.subject");
941        else if (Configuration.doAutoCreate())
942          this.subject = new Reference(); // cc
943      return this.subject;
944    }
945
946    public boolean hasSubject() { 
947      return this.subject != null && !this.subject.isEmpty();
948    }
949
950    /**
951     * @param value {@link #subject} (The common subject (or patient) of the resources that are in the list, if there is one.)
952     */
953    public ListResource setSubject(Reference value) { 
954      this.subject = value;
955      return this;
956    }
957
958    /**
959     * @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. (The common subject (or patient) of the resources that are in the list, if there is one.)
960     */
961    public Resource getSubjectTarget() { 
962      return this.subjectTarget;
963    }
964
965    /**
966     * @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. (The common subject (or patient) of the resources that are in the list, if there is one.)
967     */
968    public ListResource setSubjectTarget(Resource value) { 
969      this.subjectTarget = value;
970      return this;
971    }
972
973    /**
974     * @return {@link #encounter} (The encounter that is the context in which this list was created.)
975     */
976    public Reference getEncounter() { 
977      if (this.encounter == null)
978        if (Configuration.errorOnAutoCreate())
979          throw new Error("Attempt to auto-create ListResource.encounter");
980        else if (Configuration.doAutoCreate())
981          this.encounter = new Reference(); // cc
982      return this.encounter;
983    }
984
985    public boolean hasEncounter() { 
986      return this.encounter != null && !this.encounter.isEmpty();
987    }
988
989    /**
990     * @param value {@link #encounter} (The encounter that is the context in which this list was created.)
991     */
992    public ListResource setEncounter(Reference value) { 
993      this.encounter = value;
994      return this;
995    }
996
997    /**
998     * @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. (The encounter that is the context in which this list was created.)
999     */
1000    public Encounter getEncounterTarget() { 
1001      if (this.encounterTarget == null)
1002        if (Configuration.errorOnAutoCreate())
1003          throw new Error("Attempt to auto-create ListResource.encounter");
1004        else if (Configuration.doAutoCreate())
1005          this.encounterTarget = new Encounter(); // aa
1006      return this.encounterTarget;
1007    }
1008
1009    /**
1010     * @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. (The encounter that is the context in which this list was created.)
1011     */
1012    public ListResource setEncounterTarget(Encounter value) { 
1013      this.encounterTarget = value;
1014      return this;
1015    }
1016
1017    /**
1018     * @return {@link #date} (The date that the list was prepared.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1019     */
1020    public DateTimeType getDateElement() { 
1021      if (this.date == null)
1022        if (Configuration.errorOnAutoCreate())
1023          throw new Error("Attempt to auto-create ListResource.date");
1024        else if (Configuration.doAutoCreate())
1025          this.date = new DateTimeType(); // bb
1026      return this.date;
1027    }
1028
1029    public boolean hasDateElement() { 
1030      return this.date != null && !this.date.isEmpty();
1031    }
1032
1033    public boolean hasDate() { 
1034      return this.date != null && !this.date.isEmpty();
1035    }
1036
1037    /**
1038     * @param value {@link #date} (The date that the list was prepared.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1039     */
1040    public ListResource setDateElement(DateTimeType value) { 
1041      this.date = value;
1042      return this;
1043    }
1044
1045    /**
1046     * @return The date that the list was prepared.
1047     */
1048    public Date getDate() { 
1049      return this.date == null ? null : this.date.getValue();
1050    }
1051
1052    /**
1053     * @param value The date that the list was prepared.
1054     */
1055    public ListResource setDate(Date value) { 
1056      if (value == null)
1057        this.date = null;
1058      else {
1059        if (this.date == null)
1060          this.date = new DateTimeType();
1061        this.date.setValue(value);
1062      }
1063      return this;
1064    }
1065
1066    /**
1067     * @return {@link #source} (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
1068     */
1069    public Reference getSource() { 
1070      if (this.source == null)
1071        if (Configuration.errorOnAutoCreate())
1072          throw new Error("Attempt to auto-create ListResource.source");
1073        else if (Configuration.doAutoCreate())
1074          this.source = new Reference(); // cc
1075      return this.source;
1076    }
1077
1078    public boolean hasSource() { 
1079      return this.source != null && !this.source.isEmpty();
1080    }
1081
1082    /**
1083     * @param value {@link #source} (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
1084     */
1085    public ListResource setSource(Reference value) { 
1086      this.source = value;
1087      return this;
1088    }
1089
1090    /**
1091     * @return {@link #source} 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. (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
1092     */
1093    public Resource getSourceTarget() { 
1094      return this.sourceTarget;
1095    }
1096
1097    /**
1098     * @param value {@link #source} 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. (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
1099     */
1100    public ListResource setSourceTarget(Resource value) { 
1101      this.sourceTarget = value;
1102      return this;
1103    }
1104
1105    /**
1106     * @return {@link #orderedBy} (What order applies to the items in the list.)
1107     */
1108    public CodeableConcept getOrderedBy() { 
1109      if (this.orderedBy == null)
1110        if (Configuration.errorOnAutoCreate())
1111          throw new Error("Attempt to auto-create ListResource.orderedBy");
1112        else if (Configuration.doAutoCreate())
1113          this.orderedBy = new CodeableConcept(); // cc
1114      return this.orderedBy;
1115    }
1116
1117    public boolean hasOrderedBy() { 
1118      return this.orderedBy != null && !this.orderedBy.isEmpty();
1119    }
1120
1121    /**
1122     * @param value {@link #orderedBy} (What order applies to the items in the list.)
1123     */
1124    public ListResource setOrderedBy(CodeableConcept value) { 
1125      this.orderedBy = value;
1126      return this;
1127    }
1128
1129    /**
1130     * @return {@link #note} (Comments that apply to the overall list.)
1131     */
1132    public List<Annotation> getNote() { 
1133      if (this.note == null)
1134        this.note = new ArrayList<Annotation>();
1135      return this.note;
1136    }
1137
1138    public boolean hasNote() { 
1139      if (this.note == null)
1140        return false;
1141      for (Annotation item : this.note)
1142        if (!item.isEmpty())
1143          return true;
1144      return false;
1145    }
1146
1147    /**
1148     * @return {@link #note} (Comments that apply to the overall list.)
1149     */
1150    // syntactic sugar
1151    public Annotation addNote() { //3
1152      Annotation t = new Annotation();
1153      if (this.note == null)
1154        this.note = new ArrayList<Annotation>();
1155      this.note.add(t);
1156      return t;
1157    }
1158
1159    // syntactic sugar
1160    public ListResource addNote(Annotation t) { //3
1161      if (t == null)
1162        return this;
1163      if (this.note == null)
1164        this.note = new ArrayList<Annotation>();
1165      this.note.add(t);
1166      return this;
1167    }
1168
1169    /**
1170     * @return {@link #entry} (Entries in this list.)
1171     */
1172    public List<ListEntryComponent> getEntry() { 
1173      if (this.entry == null)
1174        this.entry = new ArrayList<ListEntryComponent>();
1175      return this.entry;
1176    }
1177
1178    public boolean hasEntry() { 
1179      if (this.entry == null)
1180        return false;
1181      for (ListEntryComponent item : this.entry)
1182        if (!item.isEmpty())
1183          return true;
1184      return false;
1185    }
1186
1187    /**
1188     * @return {@link #entry} (Entries in this list.)
1189     */
1190    // syntactic sugar
1191    public ListEntryComponent addEntry() { //3
1192      ListEntryComponent t = new ListEntryComponent();
1193      if (this.entry == null)
1194        this.entry = new ArrayList<ListEntryComponent>();
1195      this.entry.add(t);
1196      return t;
1197    }
1198
1199    // syntactic sugar
1200    public ListResource addEntry(ListEntryComponent t) { //3
1201      if (t == null)
1202        return this;
1203      if (this.entry == null)
1204        this.entry = new ArrayList<ListEntryComponent>();
1205      this.entry.add(t);
1206      return this;
1207    }
1208
1209    /**
1210     * @return {@link #emptyReason} (If the list is empty, why the list is empty.)
1211     */
1212    public CodeableConcept getEmptyReason() { 
1213      if (this.emptyReason == null)
1214        if (Configuration.errorOnAutoCreate())
1215          throw new Error("Attempt to auto-create ListResource.emptyReason");
1216        else if (Configuration.doAutoCreate())
1217          this.emptyReason = new CodeableConcept(); // cc
1218      return this.emptyReason;
1219    }
1220
1221    public boolean hasEmptyReason() { 
1222      return this.emptyReason != null && !this.emptyReason.isEmpty();
1223    }
1224
1225    /**
1226     * @param value {@link #emptyReason} (If the list is empty, why the list is empty.)
1227     */
1228    public ListResource setEmptyReason(CodeableConcept value) { 
1229      this.emptyReason = value;
1230      return this;
1231    }
1232
1233      protected void listChildren(List<Property> childrenList) {
1234        super.listChildren(childrenList);
1235        childrenList.add(new Property("identifier", "Identifier", "Identifier for the List assigned for business purposes outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier));
1236        childrenList.add(new Property("status", "code", "Indicates the current state of this list.", 0, java.lang.Integer.MAX_VALUE, status));
1237        childrenList.add(new Property("mode", "code", "How this 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));
1238        childrenList.add(new Property("title", "string", "A label for the list assigned by the author.", 0, java.lang.Integer.MAX_VALUE, title));
1239        childrenList.add(new Property("code", "CodeableConcept", "This code defines the purpose of the list - why it was created.", 0, java.lang.Integer.MAX_VALUE, code));
1240        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)", "The common subject (or patient) of the resources that are in the list, if there is one.", 0, java.lang.Integer.MAX_VALUE, subject));
1241        childrenList.add(new Property("encounter", "Reference(Encounter)", "The encounter that is the context in which this list was created.", 0, java.lang.Integer.MAX_VALUE, encounter));
1242        childrenList.add(new Property("date", "dateTime", "The date that the list was prepared.", 0, java.lang.Integer.MAX_VALUE, date));
1243        childrenList.add(new Property("source", "Reference(Practitioner|Patient|Device)", "The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.", 0, java.lang.Integer.MAX_VALUE, source));
1244        childrenList.add(new Property("orderedBy", "CodeableConcept", "What order applies to the items in the list.", 0, java.lang.Integer.MAX_VALUE, orderedBy));
1245        childrenList.add(new Property("note", "Annotation", "Comments that apply to the overall list.", 0, java.lang.Integer.MAX_VALUE, note));
1246        childrenList.add(new Property("entry", "", "Entries in this list.", 0, java.lang.Integer.MAX_VALUE, entry));
1247        childrenList.add(new Property("emptyReason", "CodeableConcept", "If the list is empty, why the list is empty.", 0, java.lang.Integer.MAX_VALUE, emptyReason));
1248      }
1249
1250      @Override
1251      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1252        switch (hash) {
1253        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1254        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ListStatus>
1255        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<ListMode>
1256        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1257        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1258        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
1259        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
1260        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
1261        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference
1262        case -391079516: /*orderedBy*/ return this.orderedBy == null ? new Base[0] : new Base[] {this.orderedBy}; // CodeableConcept
1263        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1264        case 96667762: /*entry*/ return this.entry == null ? new Base[0] : this.entry.toArray(new Base[this.entry.size()]); // ListEntryComponent
1265        case 1140135409: /*emptyReason*/ return this.emptyReason == null ? new Base[0] : new Base[] {this.emptyReason}; // CodeableConcept
1266        default: return super.getProperty(hash, name, checkValid);
1267        }
1268
1269      }
1270
1271      @Override
1272      public void setProperty(int hash, String name, Base value) throws FHIRException {
1273        switch (hash) {
1274        case -1618432855: // identifier
1275          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1276          break;
1277        case -892481550: // status
1278          this.status = new ListStatusEnumFactory().fromType(value); // Enumeration<ListStatus>
1279          break;
1280        case 3357091: // mode
1281          this.mode = new ListModeEnumFactory().fromType(value); // Enumeration<ListMode>
1282          break;
1283        case 110371416: // title
1284          this.title = castToString(value); // StringType
1285          break;
1286        case 3059181: // code
1287          this.code = castToCodeableConcept(value); // CodeableConcept
1288          break;
1289        case -1867885268: // subject
1290          this.subject = castToReference(value); // Reference
1291          break;
1292        case 1524132147: // encounter
1293          this.encounter = castToReference(value); // Reference
1294          break;
1295        case 3076014: // date
1296          this.date = castToDateTime(value); // DateTimeType
1297          break;
1298        case -896505829: // source
1299          this.source = castToReference(value); // Reference
1300          break;
1301        case -391079516: // orderedBy
1302          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1303          break;
1304        case 3387378: // note
1305          this.getNote().add(castToAnnotation(value)); // Annotation
1306          break;
1307        case 96667762: // entry
1308          this.getEntry().add((ListEntryComponent) value); // ListEntryComponent
1309          break;
1310        case 1140135409: // emptyReason
1311          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
1312          break;
1313        default: super.setProperty(hash, name, value);
1314        }
1315
1316      }
1317
1318      @Override
1319      public void setProperty(String name, Base value) throws FHIRException {
1320        if (name.equals("identifier"))
1321          this.getIdentifier().add(castToIdentifier(value));
1322        else if (name.equals("status"))
1323          this.status = new ListStatusEnumFactory().fromType(value); // Enumeration<ListStatus>
1324        else if (name.equals("mode"))
1325          this.mode = new ListModeEnumFactory().fromType(value); // Enumeration<ListMode>
1326        else if (name.equals("title"))
1327          this.title = castToString(value); // StringType
1328        else if (name.equals("code"))
1329          this.code = castToCodeableConcept(value); // CodeableConcept
1330        else if (name.equals("subject"))
1331          this.subject = castToReference(value); // Reference
1332        else if (name.equals("encounter"))
1333          this.encounter = castToReference(value); // Reference
1334        else if (name.equals("date"))
1335          this.date = castToDateTime(value); // DateTimeType
1336        else if (name.equals("source"))
1337          this.source = castToReference(value); // Reference
1338        else if (name.equals("orderedBy"))
1339          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1340        else if (name.equals("note"))
1341          this.getNote().add(castToAnnotation(value));
1342        else if (name.equals("entry"))
1343          this.getEntry().add((ListEntryComponent) value);
1344        else if (name.equals("emptyReason"))
1345          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
1346        else
1347          super.setProperty(name, value);
1348      }
1349
1350      @Override
1351      public Base makeProperty(int hash, String name) throws FHIRException {
1352        switch (hash) {
1353        case -1618432855:  return addIdentifier(); // Identifier
1354        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<ListStatus>
1355        case 3357091: throw new FHIRException("Cannot make property mode as it is not a complex type"); // Enumeration<ListMode>
1356        case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
1357        case 3059181:  return getCode(); // CodeableConcept
1358        case -1867885268:  return getSubject(); // Reference
1359        case 1524132147:  return getEncounter(); // Reference
1360        case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType
1361        case -896505829:  return getSource(); // Reference
1362        case -391079516:  return getOrderedBy(); // CodeableConcept
1363        case 3387378:  return addNote(); // Annotation
1364        case 96667762:  return addEntry(); // ListEntryComponent
1365        case 1140135409:  return getEmptyReason(); // CodeableConcept
1366        default: return super.makeProperty(hash, name);
1367        }
1368
1369      }
1370
1371      @Override
1372      public Base addChild(String name) throws FHIRException {
1373        if (name.equals("identifier")) {
1374          return addIdentifier();
1375        }
1376        else if (name.equals("status")) {
1377          throw new FHIRException("Cannot call addChild on a primitive type ListResource.status");
1378        }
1379        else if (name.equals("mode")) {
1380          throw new FHIRException("Cannot call addChild on a primitive type ListResource.mode");
1381        }
1382        else if (name.equals("title")) {
1383          throw new FHIRException("Cannot call addChild on a primitive type ListResource.title");
1384        }
1385        else if (name.equals("code")) {
1386          this.code = new CodeableConcept();
1387          return this.code;
1388        }
1389        else if (name.equals("subject")) {
1390          this.subject = new Reference();
1391          return this.subject;
1392        }
1393        else if (name.equals("encounter")) {
1394          this.encounter = new Reference();
1395          return this.encounter;
1396        }
1397        else if (name.equals("date")) {
1398          throw new FHIRException("Cannot call addChild on a primitive type ListResource.date");
1399        }
1400        else if (name.equals("source")) {
1401          this.source = new Reference();
1402          return this.source;
1403        }
1404        else if (name.equals("orderedBy")) {
1405          this.orderedBy = new CodeableConcept();
1406          return this.orderedBy;
1407        }
1408        else if (name.equals("note")) {
1409          return addNote();
1410        }
1411        else if (name.equals("entry")) {
1412          return addEntry();
1413        }
1414        else if (name.equals("emptyReason")) {
1415          this.emptyReason = new CodeableConcept();
1416          return this.emptyReason;
1417        }
1418        else
1419          return super.addChild(name);
1420      }
1421
1422  public String fhirType() {
1423    return "List";
1424
1425  }
1426
1427      public ListResource copy() {
1428        ListResource dst = new ListResource();
1429        copyValues(dst);
1430        if (identifier != null) {
1431          dst.identifier = new ArrayList<Identifier>();
1432          for (Identifier i : identifier)
1433            dst.identifier.add(i.copy());
1434        };
1435        dst.status = status == null ? null : status.copy();
1436        dst.mode = mode == null ? null : mode.copy();
1437        dst.title = title == null ? null : title.copy();
1438        dst.code = code == null ? null : code.copy();
1439        dst.subject = subject == null ? null : subject.copy();
1440        dst.encounter = encounter == null ? null : encounter.copy();
1441        dst.date = date == null ? null : date.copy();
1442        dst.source = source == null ? null : source.copy();
1443        dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
1444        if (note != null) {
1445          dst.note = new ArrayList<Annotation>();
1446          for (Annotation i : note)
1447            dst.note.add(i.copy());
1448        };
1449        if (entry != null) {
1450          dst.entry = new ArrayList<ListEntryComponent>();
1451          for (ListEntryComponent i : entry)
1452            dst.entry.add(i.copy());
1453        };
1454        dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
1455        return dst;
1456      }
1457
1458      protected ListResource typedCopy() {
1459        return copy();
1460      }
1461
1462      @Override
1463      public boolean equalsDeep(Base other) {
1464        if (!super.equalsDeep(other))
1465          return false;
1466        if (!(other instanceof ListResource))
1467          return false;
1468        ListResource o = (ListResource) other;
1469        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(mode, o.mode, true)
1470           && compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
1471           && compareDeep(encounter, o.encounter, true) && compareDeep(date, o.date, true) && compareDeep(source, o.source, true)
1472           && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(note, o.note, true) && compareDeep(entry, o.entry, true)
1473           && compareDeep(emptyReason, o.emptyReason, true);
1474      }
1475
1476      @Override
1477      public boolean equalsShallow(Base other) {
1478        if (!super.equalsShallow(other))
1479          return false;
1480        if (!(other instanceof ListResource))
1481          return false;
1482        ListResource o = (ListResource) other;
1483        return compareValues(status, o.status, true) && compareValues(mode, o.mode, true) && compareValues(title, o.title, true)
1484           && compareValues(date, o.date, true);
1485      }
1486
1487      public boolean isEmpty() {
1488        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1489           && (mode == null || mode.isEmpty()) && (title == null || title.isEmpty()) && (code == null || code.isEmpty())
1490           && (subject == null || subject.isEmpty()) && (encounter == null || encounter.isEmpty()) && (date == null || date.isEmpty())
1491           && (source == null || source.isEmpty()) && (orderedBy == null || orderedBy.isEmpty()) && (note == null || note.isEmpty())
1492           && (entry == null || entry.isEmpty()) && (emptyReason == null || emptyReason.isEmpty());
1493      }
1494
1495  @Override
1496  public ResourceType getResourceType() {
1497    return ResourceType.List;
1498   }
1499
1500 /**
1501   * Search parameter: <b>title</b>
1502   * <p>
1503   * Description: <b>Descriptive name for the list</b><br>
1504   * Type: <b>string</b><br>
1505   * Path: <b>List.title</b><br>
1506   * </p>
1507   */
1508  @SearchParamDefinition(name="title", path="List.title", description="Descriptive name for the list", type="string" )
1509  public static final String SP_TITLE = "title";
1510 /**
1511   * <b>Fluent Client</b> search parameter constant for <b>title</b>
1512   * <p>
1513   * Description: <b>Descriptive name for the list</b><br>
1514   * Type: <b>string</b><br>
1515   * Path: <b>List.title</b><br>
1516   * </p>
1517   */
1518  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
1519
1520 /**
1521   * Search parameter: <b>patient</b>
1522   * <p>
1523   * Description: <b>If all resources have the same subject</b><br>
1524   * Type: <b>reference</b><br>
1525   * Path: <b>List.subject</b><br>
1526   * </p>
1527   */
1528  @SearchParamDefinition(name="patient", path="List.subject", description="If all resources have the same subject", type="reference" )
1529  public static final String SP_PATIENT = "patient";
1530 /**
1531   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1532   * <p>
1533   * Description: <b>If all resources have the same subject</b><br>
1534   * Type: <b>reference</b><br>
1535   * Path: <b>List.subject</b><br>
1536   * </p>
1537   */
1538  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1539
1540/**
1541   * Constant for fluent queries to be used to add include statements. Specifies
1542   * the path value of "<b>ListResource:patient</b>".
1543   */
1544  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ListResource:patient").toLocked();
1545
1546 /**
1547   * Search parameter: <b>source</b>
1548   * <p>
1549   * Description: <b>Who and/or what defined the list contents (aka Author)</b><br>
1550   * Type: <b>reference</b><br>
1551   * Path: <b>List.source</b><br>
1552   * </p>
1553   */
1554  @SearchParamDefinition(name="source", path="List.source", description="Who and/or what defined the list contents (aka Author)", type="reference" )
1555  public static final String SP_SOURCE = "source";
1556 /**
1557   * <b>Fluent Client</b> search parameter constant for <b>source</b>
1558   * <p>
1559   * Description: <b>Who and/or what defined the list contents (aka Author)</b><br>
1560   * Type: <b>reference</b><br>
1561   * Path: <b>List.source</b><br>
1562   * </p>
1563   */
1564  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
1565
1566/**
1567   * Constant for fluent queries to be used to add include statements. Specifies
1568   * the path value of "<b>ListResource:source</b>".
1569   */
1570  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("ListResource:source").toLocked();
1571
1572 /**
1573   * Search parameter: <b>status</b>
1574   * <p>
1575   * Description: <b>current | retired | entered-in-error</b><br>
1576   * Type: <b>token</b><br>
1577   * Path: <b>List.status</b><br>
1578   * </p>
1579   */
1580  @SearchParamDefinition(name="status", path="List.status", description="current | retired | entered-in-error", type="token" )
1581  public static final String SP_STATUS = "status";
1582 /**
1583   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1584   * <p>
1585   * Description: <b>current | retired | entered-in-error</b><br>
1586   * Type: <b>token</b><br>
1587   * Path: <b>List.status</b><br>
1588   * </p>
1589   */
1590  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1591
1592 /**
1593   * Search parameter: <b>subject</b>
1594   * <p>
1595   * Description: <b>If all resources have the same subject</b><br>
1596   * Type: <b>reference</b><br>
1597   * Path: <b>List.subject</b><br>
1598   * </p>
1599   */
1600  @SearchParamDefinition(name="subject", path="List.subject", description="If all resources have the same subject", type="reference" )
1601  public static final String SP_SUBJECT = "subject";
1602 /**
1603   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1604   * <p>
1605   * Description: <b>If all resources have the same subject</b><br>
1606   * Type: <b>reference</b><br>
1607   * Path: <b>List.subject</b><br>
1608   * </p>
1609   */
1610  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1611
1612/**
1613   * Constant for fluent queries to be used to add include statements. Specifies
1614   * the path value of "<b>ListResource:subject</b>".
1615   */
1616  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ListResource:subject").toLocked();
1617
1618 /**
1619   * Search parameter: <b>item</b>
1620   * <p>
1621   * Description: <b>Actual entry</b><br>
1622   * Type: <b>reference</b><br>
1623   * Path: <b>List.entry.item</b><br>
1624   * </p>
1625   */
1626  @SearchParamDefinition(name="item", path="List.entry.item", description="Actual entry", type="reference" )
1627  public static final String SP_ITEM = "item";
1628 /**
1629   * <b>Fluent Client</b> search parameter constant for <b>item</b>
1630   * <p>
1631   * Description: <b>Actual entry</b><br>
1632   * Type: <b>reference</b><br>
1633   * Path: <b>List.entry.item</b><br>
1634   * </p>
1635   */
1636  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ITEM);
1637
1638/**
1639   * Constant for fluent queries to be used to add include statements. Specifies
1640   * the path value of "<b>ListResource:item</b>".
1641   */
1642  public static final ca.uhn.fhir.model.api.Include INCLUDE_ITEM = new ca.uhn.fhir.model.api.Include("ListResource:item").toLocked();
1643
1644 /**
1645   * Search parameter: <b>encounter</b>
1646   * <p>
1647   * Description: <b>Context in which list created</b><br>
1648   * Type: <b>reference</b><br>
1649   * Path: <b>List.encounter</b><br>
1650   * </p>
1651   */
1652  @SearchParamDefinition(name="encounter", path="List.encounter", description="Context in which list created", type="reference" )
1653  public static final String SP_ENCOUNTER = "encounter";
1654 /**
1655   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
1656   * <p>
1657   * Description: <b>Context in which list created</b><br>
1658   * Type: <b>reference</b><br>
1659   * Path: <b>List.encounter</b><br>
1660   * </p>
1661   */
1662  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
1663
1664/**
1665   * Constant for fluent queries to be used to add include statements. Specifies
1666   * the path value of "<b>ListResource:encounter</b>".
1667   */
1668  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("ListResource:encounter").toLocked();
1669
1670 /**
1671   * Search parameter: <b>code</b>
1672   * <p>
1673   * Description: <b>What the purpose of this list is</b><br>
1674   * Type: <b>token</b><br>
1675   * Path: <b>List.code</b><br>
1676   * </p>
1677   */
1678  @SearchParamDefinition(name="code", path="List.code", description="What the purpose of this list is", type="token" )
1679  public static final String SP_CODE = "code";
1680 /**
1681   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1682   * <p>
1683   * Description: <b>What the purpose of this list is</b><br>
1684   * Type: <b>token</b><br>
1685   * Path: <b>List.code</b><br>
1686   * </p>
1687   */
1688  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1689
1690 /**
1691   * Search parameter: <b>notes</b>
1692   * <p>
1693   * Description: <b>The annotation  - text content</b><br>
1694   * Type: <b>string</b><br>
1695   * Path: <b>List.note.text</b><br>
1696   * </p>
1697   */
1698  @SearchParamDefinition(name="notes", path="List.note.text", description="The annotation  - text content", type="string" )
1699  public static final String SP_NOTES = "notes";
1700 /**
1701   * <b>Fluent Client</b> search parameter constant for <b>notes</b>
1702   * <p>
1703   * Description: <b>The annotation  - text content</b><br>
1704   * Type: <b>string</b><br>
1705   * Path: <b>List.note.text</b><br>
1706   * </p>
1707   */
1708  public static final ca.uhn.fhir.rest.gclient.StringClientParam NOTES = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NOTES);
1709
1710 /**
1711   * Search parameter: <b>date</b>
1712   * <p>
1713   * Description: <b>When the list was prepared</b><br>
1714   * Type: <b>date</b><br>
1715   * Path: <b>List.date</b><br>
1716   * </p>
1717   */
1718  @SearchParamDefinition(name="date", path="List.date", description="When the list was prepared", type="date" )
1719  public static final String SP_DATE = "date";
1720 /**
1721   * <b>Fluent Client</b> search parameter constant for <b>date</b>
1722   * <p>
1723   * Description: <b>When the list was prepared</b><br>
1724   * Type: <b>date</b><br>
1725   * Path: <b>List.date</b><br>
1726   * </p>
1727   */
1728  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
1729
1730 /**
1731   * Search parameter: <b>empty-reason</b>
1732   * <p>
1733   * Description: <b>Why list is empty</b><br>
1734   * Type: <b>token</b><br>
1735   * Path: <b>List.emptyReason</b><br>
1736   * </p>
1737   */
1738  @SearchParamDefinition(name="empty-reason", path="List.emptyReason", description="Why list is empty", type="token" )
1739  public static final String SP_EMPTY_REASON = "empty-reason";
1740 /**
1741   * <b>Fluent Client</b> search parameter constant for <b>empty-reason</b>
1742   * <p>
1743   * Description: <b>Why list is empty</b><br>
1744   * Type: <b>token</b><br>
1745   * Path: <b>List.emptyReason</b><br>
1746   * </p>
1747   */
1748  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EMPTY_REASON = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EMPTY_REASON);
1749
1750 /**
1751   * Search parameter: <b>identifier</b>
1752   * <p>
1753   * Description: <b>Business identifier</b><br>
1754   * Type: <b>token</b><br>
1755   * Path: <b>List.identifier</b><br>
1756   * </p>
1757   */
1758  @SearchParamDefinition(name="identifier", path="List.identifier", description="Business identifier", type="token" )
1759  public static final String SP_IDENTIFIER = "identifier";
1760 /**
1761   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1762   * <p>
1763   * Description: <b>Business identifier</b><br>
1764   * Type: <b>token</b><br>
1765   * Path: <b>List.identifier</b><br>
1766   * </p>
1767   */
1768  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1769
1770
1771}