001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * A set of information summarized from a list of other resources.
042 */
043@ResourceDef(name="List", profile="http://hl7.org/fhir/Profile/List_")
044public class List_ extends DomainResource {
045
046    public enum ListStatus {
047        /**
048         * The list is considered to be an active part of the patient's record.
049         */
050        CURRENT, 
051        /**
052         * The list is "old" and should no longer be considered accurate or relevant.
053         */
054        RETIRED, 
055        /**
056         * The list was never accurate.  It is retained for medico-legal purposes only.
057         */
058        ENTEREDINERROR, 
059        /**
060         * added to help the parsers
061         */
062        NULL;
063        public static ListStatus fromCode(String codeString) throws FHIRException {
064            if (codeString == null || "".equals(codeString))
065                return null;
066        if ("current".equals(codeString))
067          return CURRENT;
068        if ("retired".equals(codeString))
069          return RETIRED;
070        if ("entered-in-error".equals(codeString))
071          return ENTEREDINERROR;
072        throw new FHIRException("Unknown ListStatus code '"+codeString+"'");
073        }
074        public String toCode() {
075          switch (this) {
076            case CURRENT: return "current";
077            case RETIRED: return "retired";
078            case ENTEREDINERROR: return "entered-in-error";
079            default: return "?";
080          }
081        }
082        public String getSystem() {
083          switch (this) {
084            case CURRENT: return "http://hl7.org/fhir/list-status";
085            case RETIRED: return "http://hl7.org/fhir/list-status";
086            case ENTEREDINERROR: return "http://hl7.org/fhir/list-status";
087            default: return "?";
088          }
089        }
090        public String getDefinition() {
091          switch (this) {
092            case CURRENT: return "The list is considered to be an active part of the patient's record.";
093            case RETIRED: return "The list is \"old\" and should no longer be considered accurate or relevant.";
094            case ENTEREDINERROR: return "The list was never accurate.  It is retained for medico-legal purposes only.";
095            default: return "?";
096          }
097        }
098        public String getDisplay() {
099          switch (this) {
100            case CURRENT: return "Current";
101            case RETIRED: return "Retired";
102            case ENTEREDINERROR: return "Entered In Error";
103            default: return "?";
104          }
105        }
106    }
107
108  public static class ListStatusEnumFactory implements EnumFactory<ListStatus> {
109    public ListStatus fromCode(String codeString) throws IllegalArgumentException {
110      if (codeString == null || "".equals(codeString))
111            if (codeString == null || "".equals(codeString))
112                return null;
113        if ("current".equals(codeString))
114          return ListStatus.CURRENT;
115        if ("retired".equals(codeString))
116          return ListStatus.RETIRED;
117        if ("entered-in-error".equals(codeString))
118          return ListStatus.ENTEREDINERROR;
119        throw new IllegalArgumentException("Unknown ListStatus code '"+codeString+"'");
120        }
121        public Enumeration<ListStatus> fromType(Base code) throws FHIRException {
122          if (code == null || code.isEmpty())
123            return null;
124          String codeString = ((PrimitiveType) code).asStringValue();
125          if (codeString == null || "".equals(codeString))
126            return null;
127        if ("current".equals(codeString))
128          return new Enumeration<ListStatus>(this, ListStatus.CURRENT);
129        if ("retired".equals(codeString))
130          return new Enumeration<ListStatus>(this, ListStatus.RETIRED);
131        if ("entered-in-error".equals(codeString))
132          return new Enumeration<ListStatus>(this, ListStatus.ENTEREDINERROR);
133        throw new FHIRException("Unknown ListStatus code '"+codeString+"'");
134        }
135    public String toCode(ListStatus code) {
136      if (code == ListStatus.CURRENT)
137        return "current";
138      if (code == ListStatus.RETIRED)
139        return "retired";
140      if (code == ListStatus.ENTEREDINERROR)
141        return "entered-in-error";
142      return "?";
143      }
144    }
145
146    public enum ListMode {
147        /**
148         * This list is the master list, maintained in an ongoing fashion with regular updates as the real world list it is tracking changes
149         */
150        WORKING, 
151        /**
152         * This list was prepared as a snapshot. It should not be assumed to be current
153         */
154        SNAPSHOT, 
155        /**
156         * A list that indicates where changes have been made or recommended
157         */
158        CHANGES, 
159        /**
160         * added to help the parsers
161         */
162        NULL;
163        public static ListMode fromCode(String codeString) throws FHIRException {
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("working".equals(codeString))
167          return WORKING;
168        if ("snapshot".equals(codeString))
169          return SNAPSHOT;
170        if ("changes".equals(codeString))
171          return CHANGES;
172        throw new FHIRException("Unknown ListMode code '"+codeString+"'");
173        }
174        public String toCode() {
175          switch (this) {
176            case WORKING: return "working";
177            case SNAPSHOT: return "snapshot";
178            case CHANGES: return "changes";
179            default: return "?";
180          }
181        }
182        public String getSystem() {
183          switch (this) {
184            case WORKING: return "http://hl7.org/fhir/list-mode";
185            case SNAPSHOT: return "http://hl7.org/fhir/list-mode";
186            case CHANGES: return "http://hl7.org/fhir/list-mode";
187            default: return "?";
188          }
189        }
190        public String getDefinition() {
191          switch (this) {
192            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";
193            case SNAPSHOT: return "This list was prepared as a snapshot. It should not be assumed to be current";
194            case CHANGES: return "A list that indicates where changes have been made or recommended";
195            default: return "?";
196          }
197        }
198        public String getDisplay() {
199          switch (this) {
200            case WORKING: return "Working List";
201            case SNAPSHOT: return "Snapshot List";
202            case CHANGES: return "Change List";
203            default: return "?";
204          }
205        }
206    }
207
208  public static class ListModeEnumFactory implements EnumFactory<ListMode> {
209    public ListMode fromCode(String codeString) throws IllegalArgumentException {
210      if (codeString == null || "".equals(codeString))
211            if (codeString == null || "".equals(codeString))
212                return null;
213        if ("working".equals(codeString))
214          return ListMode.WORKING;
215        if ("snapshot".equals(codeString))
216          return ListMode.SNAPSHOT;
217        if ("changes".equals(codeString))
218          return ListMode.CHANGES;
219        throw new IllegalArgumentException("Unknown ListMode code '"+codeString+"'");
220        }
221        public Enumeration<ListMode> fromType(Base code) throws FHIRException {
222          if (code == null || code.isEmpty())
223            return null;
224          String codeString = ((PrimitiveType) code).asStringValue();
225          if (codeString == null || "".equals(codeString))
226            return null;
227        if ("working".equals(codeString))
228          return new Enumeration<ListMode>(this, ListMode.WORKING);
229        if ("snapshot".equals(codeString))
230          return new Enumeration<ListMode>(this, ListMode.SNAPSHOT);
231        if ("changes".equals(codeString))
232          return new Enumeration<ListMode>(this, ListMode.CHANGES);
233        throw new FHIRException("Unknown ListMode code '"+codeString+"'");
234        }
235    public String toCode(ListMode code) {
236      if (code == ListMode.WORKING)
237        return "working";
238      if (code == ListMode.SNAPSHOT)
239        return "snapshot";
240      if (code == ListMode.CHANGES)
241        return "changes";
242      return "?";
243      }
244    }
245
246    @Block()
247    public static class ListEntryComponent extends BackboneElement implements IBaseBackboneElement {
248        /**
249         * The flag allows the system constructing the list to indicate the role and significance of the item in the list.
250         */
251        @Child(name = "flag", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
252        @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." )
253        protected CodeableConcept flag;
254
255        /**
256         * True if this item is marked as deleted in the list.
257         */
258        @Child(name = "deleted", type = {BooleanType.class}, order=2, min=0, max=1, modifier=true, summary=false)
259        @Description(shortDefinition="If this item is actually marked as deleted", formalDefinition="True if this item is marked as deleted in the list." )
260        protected BooleanType deleted;
261
262        /**
263         * When this item was added to the list.
264         */
265        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
266        @Description(shortDefinition="When item added to list", formalDefinition="When this item was added to the list." )
267        protected DateTimeType date;
268
269        /**
270         * A reference to the actual resource from which data was derived.
271         */
272        @Child(name = "item", type = {}, order=4, min=1, max=1, modifier=false, summary=false)
273        @Description(shortDefinition="Actual entry", formalDefinition="A reference to the actual resource from which data was derived." )
274        protected Reference item;
275
276        /**
277         * The actual object that is the target of the reference (A reference to the actual resource from which data was derived.)
278         */
279        protected Resource itemTarget;
280
281        private static final long serialVersionUID = -758164425L;
282
283    /*
284     * Constructor
285     */
286      public ListEntryComponent() {
287        super();
288      }
289
290    /*
291     * Constructor
292     */
293      public ListEntryComponent(Reference item) {
294        super();
295        this.item = item;
296      }
297
298        /**
299         * @return {@link #flag} (The flag allows the system constructing the list to indicate the role and significance of the item in the list.)
300         */
301        public CodeableConcept getFlag() { 
302          if (this.flag == null)
303            if (Configuration.errorOnAutoCreate())
304              throw new Error("Attempt to auto-create ListEntryComponent.flag");
305            else if (Configuration.doAutoCreate())
306              this.flag = new CodeableConcept(); // cc
307          return this.flag;
308        }
309
310        public boolean hasFlag() { 
311          return this.flag != null && !this.flag.isEmpty();
312        }
313
314        /**
315         * @param value {@link #flag} (The flag allows the system constructing the list to indicate the role and significance of the item in the list.)
316         */
317        public ListEntryComponent setFlag(CodeableConcept value) { 
318          this.flag = value;
319          return this;
320        }
321
322        /**
323         * @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
324         */
325        public BooleanType getDeletedElement() { 
326          if (this.deleted == null)
327            if (Configuration.errorOnAutoCreate())
328              throw new Error("Attempt to auto-create ListEntryComponent.deleted");
329            else if (Configuration.doAutoCreate())
330              this.deleted = new BooleanType(); // bb
331          return this.deleted;
332        }
333
334        public boolean hasDeletedElement() { 
335          return this.deleted != null && !this.deleted.isEmpty();
336        }
337
338        public boolean hasDeleted() { 
339          return this.deleted != null && !this.deleted.isEmpty();
340        }
341
342        /**
343         * @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
344         */
345        public ListEntryComponent setDeletedElement(BooleanType value) { 
346          this.deleted = value;
347          return this;
348        }
349
350        /**
351         * @return True if this item is marked as deleted in the list.
352         */
353        public boolean getDeleted() { 
354          return this.deleted == null || this.deleted.isEmpty() ? false : this.deleted.getValue();
355        }
356
357        /**
358         * @param value True if this item is marked as deleted in the list.
359         */
360        public ListEntryComponent setDeleted(boolean value) { 
361            if (this.deleted == null)
362              this.deleted = new BooleanType();
363            this.deleted.setValue(value);
364          return this;
365        }
366
367        /**
368         * @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
369         */
370        public DateTimeType getDateElement() { 
371          if (this.date == null)
372            if (Configuration.errorOnAutoCreate())
373              throw new Error("Attempt to auto-create ListEntryComponent.date");
374            else if (Configuration.doAutoCreate())
375              this.date = new DateTimeType(); // bb
376          return this.date;
377        }
378
379        public boolean hasDateElement() { 
380          return this.date != null && !this.date.isEmpty();
381        }
382
383        public boolean hasDate() { 
384          return this.date != null && !this.date.isEmpty();
385        }
386
387        /**
388         * @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
389         */
390        public ListEntryComponent setDateElement(DateTimeType value) { 
391          this.date = value;
392          return this;
393        }
394
395        /**
396         * @return When this item was added to the list.
397         */
398        public Date getDate() { 
399          return this.date == null ? null : this.date.getValue();
400        }
401
402        /**
403         * @param value When this item was added to the list.
404         */
405        public ListEntryComponent setDate(Date value) { 
406          if (value == null)
407            this.date = null;
408          else {
409            if (this.date == null)
410              this.date = new DateTimeType();
411            this.date.setValue(value);
412          }
413          return this;
414        }
415
416        /**
417         * @return {@link #item} (A reference to the actual resource from which data was derived.)
418         */
419        public Reference getItem() { 
420          if (this.item == null)
421            if (Configuration.errorOnAutoCreate())
422              throw new Error("Attempt to auto-create ListEntryComponent.item");
423            else if (Configuration.doAutoCreate())
424              this.item = new Reference(); // cc
425          return this.item;
426        }
427
428        public boolean hasItem() { 
429          return this.item != null && !this.item.isEmpty();
430        }
431
432        /**
433         * @param value {@link #item} (A reference to the actual resource from which data was derived.)
434         */
435        public ListEntryComponent setItem(Reference value) { 
436          this.item = value;
437          return this;
438        }
439
440        /**
441         * @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.)
442         */
443        public Resource getItemTarget() { 
444          return this.itemTarget;
445        }
446
447        /**
448         * @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.)
449         */
450        public ListEntryComponent setItemTarget(Resource value) { 
451          this.itemTarget = value;
452          return this;
453        }
454
455        protected void listChildren(List<Property> childrenList) {
456          super.listChildren(childrenList);
457          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));
458          childrenList.add(new Property("deleted", "boolean", "True if this item is marked as deleted in the list.", 0, java.lang.Integer.MAX_VALUE, deleted));
459          childrenList.add(new Property("date", "dateTime", "When this item was added to the list.", 0, java.lang.Integer.MAX_VALUE, date));
460          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));
461        }
462
463      @Override
464      public void setProperty(String name, Base value) throws FHIRException {
465        if (name.equals("flag"))
466          this.flag = castToCodeableConcept(value); // CodeableConcept
467        else if (name.equals("deleted"))
468          this.deleted = castToBoolean(value); // BooleanType
469        else if (name.equals("date"))
470          this.date = castToDateTime(value); // DateTimeType
471        else if (name.equals("item"))
472          this.item = castToReference(value); // Reference
473        else
474          super.setProperty(name, value);
475      }
476
477      @Override
478      public Base addChild(String name) throws FHIRException {
479        if (name.equals("flag")) {
480          this.flag = new CodeableConcept();
481          return this.flag;
482        }
483        else if (name.equals("deleted")) {
484          throw new FHIRException("Cannot call addChild on a primitive type List_.deleted");
485        }
486        else if (name.equals("date")) {
487          throw new FHIRException("Cannot call addChild on a primitive type List_.date");
488        }
489        else if (name.equals("item")) {
490          this.item = new Reference();
491          return this.item;
492        }
493        else
494          return super.addChild(name);
495      }
496
497      public ListEntryComponent copy() {
498        ListEntryComponent dst = new ListEntryComponent();
499        copyValues(dst);
500        dst.flag = flag == null ? null : flag.copy();
501        dst.deleted = deleted == null ? null : deleted.copy();
502        dst.date = date == null ? null : date.copy();
503        dst.item = item == null ? null : item.copy();
504        return dst;
505      }
506
507      @Override
508      public boolean equalsDeep(Base other) {
509        if (!super.equalsDeep(other))
510          return false;
511        if (!(other instanceof ListEntryComponent))
512          return false;
513        ListEntryComponent o = (ListEntryComponent) other;
514        return compareDeep(flag, o.flag, true) && compareDeep(deleted, o.deleted, true) && compareDeep(date, o.date, true)
515           && compareDeep(item, o.item, true);
516      }
517
518      @Override
519      public boolean equalsShallow(Base other) {
520        if (!super.equalsShallow(other))
521          return false;
522        if (!(other instanceof ListEntryComponent))
523          return false;
524        ListEntryComponent o = (ListEntryComponent) other;
525        return compareValues(deleted, o.deleted, true) && compareValues(date, o.date, true);
526      }
527
528      public boolean isEmpty() {
529        return super.isEmpty() && (flag == null || flag.isEmpty()) && (deleted == null || deleted.isEmpty())
530           && (date == null || date.isEmpty()) && (item == null || item.isEmpty());
531      }
532
533  public String fhirType() {
534    return "List.entry";
535
536  }
537
538  }
539
540    /**
541     * Identifier for the List assigned for business purposes outside the context of FHIR.
542     */
543    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
544    @Description(shortDefinition="Business identifier", formalDefinition="Identifier for the List assigned for business purposes outside the context of FHIR." )
545    protected List<Identifier> identifier;
546
547    /**
548     * A label for the list assigned by the author.
549     */
550    @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
551    @Description(shortDefinition="Descriptive name for the list", formalDefinition="A label for the list assigned by the author." )
552    protected StringType title;
553
554    /**
555     * This code defines the purpose of the list - why it was created.
556     */
557    @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
558    @Description(shortDefinition="What the purpose of this list is", formalDefinition="This code defines the purpose of the list - why it was created." )
559    protected CodeableConcept code;
560
561    /**
562     * The common subject (or patient) of the resources that are in the list, if there is one.
563     */
564    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Location.class}, order=3, min=0, max=1, modifier=false, summary=true)
565    @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." )
566    protected Reference subject;
567
568    /**
569     * 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.)
570     */
571    protected Resource subjectTarget;
572
573    /**
574     * 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.
575     */
576    @Child(name = "source", type = {Practitioner.class, Patient.class, Device.class}, order=4, min=0, max=1, modifier=false, summary=true)
577    @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." )
578    protected Reference source;
579
580    /**
581     * 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.)
582     */
583    protected Resource sourceTarget;
584
585    /**
586     * The encounter that is the context in which this list was created.
587     */
588    @Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=false)
589    @Description(shortDefinition="Context in which list created", formalDefinition="The encounter that is the context in which this list was created." )
590    protected Reference encounter;
591
592    /**
593     * The actual object that is the target of the reference (The encounter that is the context in which this list was created.)
594     */
595    protected Encounter encounterTarget;
596
597    /**
598     * Indicates the current state of this list.
599     */
600    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
601    @Description(shortDefinition="current | retired | entered-in-error", formalDefinition="Indicates the current state of this list." )
602    protected Enumeration<ListStatus> status;
603
604    /**
605     * The date that the list was prepared.
606     */
607    @Child(name = "date", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
608    @Description(shortDefinition="When the list was prepared", formalDefinition="The date that the list was prepared." )
609    protected DateTimeType date;
610
611    /**
612     * What order applies to the items in the list.
613     */
614    @Child(name = "orderedBy", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
615    @Description(shortDefinition="What order the list has", formalDefinition="What order applies to the items in the list." )
616    protected CodeableConcept orderedBy;
617
618    /**
619     * 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.
620     */
621    @Child(name = "mode", type = {CodeType.class}, order=9, min=1, max=1, modifier=true, summary=true)
622    @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." )
623    protected Enumeration<ListMode> mode;
624
625    /**
626     * Comments that apply to the overall list.
627     */
628    @Child(name = "note", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
629    @Description(shortDefinition="Comments about the list", formalDefinition="Comments that apply to the overall list." )
630    protected StringType note;
631
632    /**
633     * Entries in this list.
634     */
635    @Child(name = "entry", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
636    @Description(shortDefinition="Entries in the list", formalDefinition="Entries in this list." )
637    protected List<ListEntryComponent> entry;
638
639    /**
640     * If the list is empty, why the list is empty.
641     */
642    @Child(name = "emptyReason", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
643    @Description(shortDefinition="Why list is empty", formalDefinition="If the list is empty, why the list is empty." )
644    protected CodeableConcept emptyReason;
645
646    private static final long serialVersionUID = 1819128642L;
647
648  /*
649   * Constructor
650   */
651    public List_() {
652      super();
653    }
654
655  /*
656   * Constructor
657   */
658    public List_(Enumeration<ListStatus> status, Enumeration<ListMode> mode) {
659      super();
660      this.status = status;
661      this.mode = mode;
662    }
663
664    /**
665     * @return {@link #identifier} (Identifier for the List assigned for business purposes outside the context of FHIR.)
666     */
667    public List<Identifier> getIdentifier() { 
668      if (this.identifier == null)
669        this.identifier = new ArrayList<Identifier>();
670      return this.identifier;
671    }
672
673    public boolean hasIdentifier() { 
674      if (this.identifier == null)
675        return false;
676      for (Identifier item : this.identifier)
677        if (!item.isEmpty())
678          return true;
679      return false;
680    }
681
682    /**
683     * @return {@link #identifier} (Identifier for the List assigned for business purposes outside the context of FHIR.)
684     */
685    // syntactic sugar
686    public Identifier addIdentifier() { //3
687      Identifier t = new Identifier();
688      if (this.identifier == null)
689        this.identifier = new ArrayList<Identifier>();
690      this.identifier.add(t);
691      return t;
692    }
693
694    // syntactic sugar
695    public List_ addIdentifier(Identifier t) { //3
696      if (t == null)
697        return this;
698      if (this.identifier == null)
699        this.identifier = new ArrayList<Identifier>();
700      this.identifier.add(t);
701      return this;
702    }
703
704    /**
705     * @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
706     */
707    public StringType getTitleElement() { 
708      if (this.title == null)
709        if (Configuration.errorOnAutoCreate())
710          throw new Error("Attempt to auto-create List_.title");
711        else if (Configuration.doAutoCreate())
712          this.title = new StringType(); // bb
713      return this.title;
714    }
715
716    public boolean hasTitleElement() { 
717      return this.title != null && !this.title.isEmpty();
718    }
719
720    public boolean hasTitle() { 
721      return this.title != null && !this.title.isEmpty();
722    }
723
724    /**
725     * @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
726     */
727    public List_ setTitleElement(StringType value) { 
728      this.title = value;
729      return this;
730    }
731
732    /**
733     * @return A label for the list assigned by the author.
734     */
735    public String getTitle() { 
736      return this.title == null ? null : this.title.getValue();
737    }
738
739    /**
740     * @param value A label for the list assigned by the author.
741     */
742    public List_ setTitle(String value) { 
743      if (Utilities.noString(value))
744        this.title = null;
745      else {
746        if (this.title == null)
747          this.title = new StringType();
748        this.title.setValue(value);
749      }
750      return this;
751    }
752
753    /**
754     * @return {@link #code} (This code defines the purpose of the list - why it was created.)
755     */
756    public CodeableConcept getCode() { 
757      if (this.code == null)
758        if (Configuration.errorOnAutoCreate())
759          throw new Error("Attempt to auto-create List_.code");
760        else if (Configuration.doAutoCreate())
761          this.code = new CodeableConcept(); // cc
762      return this.code;
763    }
764
765    public boolean hasCode() { 
766      return this.code != null && !this.code.isEmpty();
767    }
768
769    /**
770     * @param value {@link #code} (This code defines the purpose of the list - why it was created.)
771     */
772    public List_ setCode(CodeableConcept value) { 
773      this.code = value;
774      return this;
775    }
776
777    /**
778     * @return {@link #subject} (The common subject (or patient) of the resources that are in the list, if there is one.)
779     */
780    public Reference getSubject() { 
781      if (this.subject == null)
782        if (Configuration.errorOnAutoCreate())
783          throw new Error("Attempt to auto-create List_.subject");
784        else if (Configuration.doAutoCreate())
785          this.subject = new Reference(); // cc
786      return this.subject;
787    }
788
789    public boolean hasSubject() { 
790      return this.subject != null && !this.subject.isEmpty();
791    }
792
793    /**
794     * @param value {@link #subject} (The common subject (or patient) of the resources that are in the list, if there is one.)
795     */
796    public List_ setSubject(Reference value) { 
797      this.subject = value;
798      return this;
799    }
800
801    /**
802     * @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.)
803     */
804    public Resource getSubjectTarget() { 
805      return this.subjectTarget;
806    }
807
808    /**
809     * @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.)
810     */
811    public List_ setSubjectTarget(Resource value) { 
812      this.subjectTarget = value;
813      return this;
814    }
815
816    /**
817     * @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.)
818     */
819    public Reference getSource() { 
820      if (this.source == null)
821        if (Configuration.errorOnAutoCreate())
822          throw new Error("Attempt to auto-create List_.source");
823        else if (Configuration.doAutoCreate())
824          this.source = new Reference(); // cc
825      return this.source;
826    }
827
828    public boolean hasSource() { 
829      return this.source != null && !this.source.isEmpty();
830    }
831
832    /**
833     * @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.)
834     */
835    public List_ setSource(Reference value) { 
836      this.source = value;
837      return this;
838    }
839
840    /**
841     * @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.)
842     */
843    public Resource getSourceTarget() { 
844      return this.sourceTarget;
845    }
846
847    /**
848     * @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.)
849     */
850    public List_ setSourceTarget(Resource value) { 
851      this.sourceTarget = value;
852      return this;
853    }
854
855    /**
856     * @return {@link #encounter} (The encounter that is the context in which this list was created.)
857     */
858    public Reference getEncounter() { 
859      if (this.encounter == null)
860        if (Configuration.errorOnAutoCreate())
861          throw new Error("Attempt to auto-create List_.encounter");
862        else if (Configuration.doAutoCreate())
863          this.encounter = new Reference(); // cc
864      return this.encounter;
865    }
866
867    public boolean hasEncounter() { 
868      return this.encounter != null && !this.encounter.isEmpty();
869    }
870
871    /**
872     * @param value {@link #encounter} (The encounter that is the context in which this list was created.)
873     */
874    public List_ setEncounter(Reference value) { 
875      this.encounter = value;
876      return this;
877    }
878
879    /**
880     * @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.)
881     */
882    public Encounter getEncounterTarget() { 
883      if (this.encounterTarget == null)
884        if (Configuration.errorOnAutoCreate())
885          throw new Error("Attempt to auto-create List_.encounter");
886        else if (Configuration.doAutoCreate())
887          this.encounterTarget = new Encounter(); // aa
888      return this.encounterTarget;
889    }
890
891    /**
892     * @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.)
893     */
894    public List_ setEncounterTarget(Encounter value) { 
895      this.encounterTarget = value;
896      return this;
897    }
898
899    /**
900     * @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
901     */
902    public Enumeration<ListStatus> getStatusElement() { 
903      if (this.status == null)
904        if (Configuration.errorOnAutoCreate())
905          throw new Error("Attempt to auto-create List_.status");
906        else if (Configuration.doAutoCreate())
907          this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory()); // bb
908      return this.status;
909    }
910
911    public boolean hasStatusElement() { 
912      return this.status != null && !this.status.isEmpty();
913    }
914
915    public boolean hasStatus() { 
916      return this.status != null && !this.status.isEmpty();
917    }
918
919    /**
920     * @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
921     */
922    public List_ setStatusElement(Enumeration<ListStatus> value) { 
923      this.status = value;
924      return this;
925    }
926
927    /**
928     * @return Indicates the current state of this list.
929     */
930    public ListStatus getStatus() { 
931      return this.status == null ? null : this.status.getValue();
932    }
933
934    /**
935     * @param value Indicates the current state of this list.
936     */
937    public List_ setStatus(ListStatus value) { 
938        if (this.status == null)
939          this.status = new Enumeration<ListStatus>(new ListStatusEnumFactory());
940        this.status.setValue(value);
941      return this;
942    }
943
944    /**
945     * @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
946     */
947    public DateTimeType getDateElement() { 
948      if (this.date == null)
949        if (Configuration.errorOnAutoCreate())
950          throw new Error("Attempt to auto-create List_.date");
951        else if (Configuration.doAutoCreate())
952          this.date = new DateTimeType(); // bb
953      return this.date;
954    }
955
956    public boolean hasDateElement() { 
957      return this.date != null && !this.date.isEmpty();
958    }
959
960    public boolean hasDate() { 
961      return this.date != null && !this.date.isEmpty();
962    }
963
964    /**
965     * @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
966     */
967    public List_ setDateElement(DateTimeType value) { 
968      this.date = value;
969      return this;
970    }
971
972    /**
973     * @return The date that the list was prepared.
974     */
975    public Date getDate() { 
976      return this.date == null ? null : this.date.getValue();
977    }
978
979    /**
980     * @param value The date that the list was prepared.
981     */
982    public List_ setDate(Date value) { 
983      if (value == null)
984        this.date = null;
985      else {
986        if (this.date == null)
987          this.date = new DateTimeType();
988        this.date.setValue(value);
989      }
990      return this;
991    }
992
993    /**
994     * @return {@link #orderedBy} (What order applies to the items in the list.)
995     */
996    public CodeableConcept getOrderedBy() { 
997      if (this.orderedBy == null)
998        if (Configuration.errorOnAutoCreate())
999          throw new Error("Attempt to auto-create List_.orderedBy");
1000        else if (Configuration.doAutoCreate())
1001          this.orderedBy = new CodeableConcept(); // cc
1002      return this.orderedBy;
1003    }
1004
1005    public boolean hasOrderedBy() { 
1006      return this.orderedBy != null && !this.orderedBy.isEmpty();
1007    }
1008
1009    /**
1010     * @param value {@link #orderedBy} (What order applies to the items in the list.)
1011     */
1012    public List_ setOrderedBy(CodeableConcept value) { 
1013      this.orderedBy = value;
1014      return this;
1015    }
1016
1017    /**
1018     * @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
1019     */
1020    public Enumeration<ListMode> getModeElement() { 
1021      if (this.mode == null)
1022        if (Configuration.errorOnAutoCreate())
1023          throw new Error("Attempt to auto-create List_.mode");
1024        else if (Configuration.doAutoCreate())
1025          this.mode = new Enumeration<ListMode>(new ListModeEnumFactory()); // bb
1026      return this.mode;
1027    }
1028
1029    public boolean hasModeElement() { 
1030      return this.mode != null && !this.mode.isEmpty();
1031    }
1032
1033    public boolean hasMode() { 
1034      return this.mode != null && !this.mode.isEmpty();
1035    }
1036
1037    /**
1038     * @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
1039     */
1040    public List_ setModeElement(Enumeration<ListMode> value) { 
1041      this.mode = value;
1042      return this;
1043    }
1044
1045    /**
1046     * @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.
1047     */
1048    public ListMode getMode() { 
1049      return this.mode == null ? null : this.mode.getValue();
1050    }
1051
1052    /**
1053     * @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.
1054     */
1055    public List_ setMode(ListMode value) { 
1056        if (this.mode == null)
1057          this.mode = new Enumeration<ListMode>(new ListModeEnumFactory());
1058        this.mode.setValue(value);
1059      return this;
1060    }
1061
1062    /**
1063     * @return {@link #note} (Comments that apply to the overall list.). This is the underlying object with id, value and extensions. The accessor "getNote" gives direct access to the value
1064     */
1065    public StringType getNoteElement() { 
1066      if (this.note == null)
1067        if (Configuration.errorOnAutoCreate())
1068          throw new Error("Attempt to auto-create List_.note");
1069        else if (Configuration.doAutoCreate())
1070          this.note = new StringType(); // bb
1071      return this.note;
1072    }
1073
1074    public boolean hasNoteElement() { 
1075      return this.note != null && !this.note.isEmpty();
1076    }
1077
1078    public boolean hasNote() { 
1079      return this.note != null && !this.note.isEmpty();
1080    }
1081
1082    /**
1083     * @param value {@link #note} (Comments that apply to the overall list.). This is the underlying object with id, value and extensions. The accessor "getNote" gives direct access to the value
1084     */
1085    public List_ setNoteElement(StringType value) { 
1086      this.note = value;
1087      return this;
1088    }
1089
1090    /**
1091     * @return Comments that apply to the overall list.
1092     */
1093    public String getNote() { 
1094      return this.note == null ? null : this.note.getValue();
1095    }
1096
1097    /**
1098     * @param value Comments that apply to the overall list.
1099     */
1100    public List_ setNote(String value) { 
1101      if (Utilities.noString(value))
1102        this.note = null;
1103      else {
1104        if (this.note == null)
1105          this.note = new StringType();
1106        this.note.setValue(value);
1107      }
1108      return this;
1109    }
1110
1111    /**
1112     * @return {@link #entry} (Entries in this list.)
1113     */
1114    public List<ListEntryComponent> getEntry() { 
1115      if (this.entry == null)
1116        this.entry = new ArrayList<ListEntryComponent>();
1117      return this.entry;
1118    }
1119
1120    public boolean hasEntry() { 
1121      if (this.entry == null)
1122        return false;
1123      for (ListEntryComponent item : this.entry)
1124        if (!item.isEmpty())
1125          return true;
1126      return false;
1127    }
1128
1129    /**
1130     * @return {@link #entry} (Entries in this list.)
1131     */
1132    // syntactic sugar
1133    public ListEntryComponent addEntry() { //3
1134      ListEntryComponent t = new ListEntryComponent();
1135      if (this.entry == null)
1136        this.entry = new ArrayList<ListEntryComponent>();
1137      this.entry.add(t);
1138      return t;
1139    }
1140
1141    // syntactic sugar
1142    public List_ addEntry(ListEntryComponent t) { //3
1143      if (t == null)
1144        return this;
1145      if (this.entry == null)
1146        this.entry = new ArrayList<ListEntryComponent>();
1147      this.entry.add(t);
1148      return this;
1149    }
1150
1151    /**
1152     * @return {@link #emptyReason} (If the list is empty, why the list is empty.)
1153     */
1154    public CodeableConcept getEmptyReason() { 
1155      if (this.emptyReason == null)
1156        if (Configuration.errorOnAutoCreate())
1157          throw new Error("Attempt to auto-create List_.emptyReason");
1158        else if (Configuration.doAutoCreate())
1159          this.emptyReason = new CodeableConcept(); // cc
1160      return this.emptyReason;
1161    }
1162
1163    public boolean hasEmptyReason() { 
1164      return this.emptyReason != null && !this.emptyReason.isEmpty();
1165    }
1166
1167    /**
1168     * @param value {@link #emptyReason} (If the list is empty, why the list is empty.)
1169     */
1170    public List_ setEmptyReason(CodeableConcept value) { 
1171      this.emptyReason = value;
1172      return this;
1173    }
1174
1175      protected void listChildren(List<Property> childrenList) {
1176        super.listChildren(childrenList);
1177        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));
1178        childrenList.add(new Property("title", "string", "A label for the list assigned by the author.", 0, java.lang.Integer.MAX_VALUE, title));
1179        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));
1180        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));
1181        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));
1182        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));
1183        childrenList.add(new Property("status", "code", "Indicates the current state of this list.", 0, java.lang.Integer.MAX_VALUE, status));
1184        childrenList.add(new Property("date", "dateTime", "The date that the list was prepared.", 0, java.lang.Integer.MAX_VALUE, date));
1185        childrenList.add(new Property("orderedBy", "CodeableConcept", "What order applies to the items in the list.", 0, java.lang.Integer.MAX_VALUE, orderedBy));
1186        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));
1187        childrenList.add(new Property("note", "string", "Comments that apply to the overall list.", 0, java.lang.Integer.MAX_VALUE, note));
1188        childrenList.add(new Property("entry", "", "Entries in this list.", 0, java.lang.Integer.MAX_VALUE, entry));
1189        childrenList.add(new Property("emptyReason", "CodeableConcept", "If the list is empty, why the list is empty.", 0, java.lang.Integer.MAX_VALUE, emptyReason));
1190      }
1191
1192      @Override
1193      public void setProperty(String name, Base value) throws FHIRException {
1194        if (name.equals("identifier"))
1195          this.getIdentifier().add(castToIdentifier(value));
1196        else if (name.equals("title"))
1197          this.title = castToString(value); // StringType
1198        else if (name.equals("code"))
1199          this.code = castToCodeableConcept(value); // CodeableConcept
1200        else if (name.equals("subject"))
1201          this.subject = castToReference(value); // Reference
1202        else if (name.equals("source"))
1203          this.source = castToReference(value); // Reference
1204        else if (name.equals("encounter"))
1205          this.encounter = castToReference(value); // Reference
1206        else if (name.equals("status"))
1207          this.status = new ListStatusEnumFactory().fromType(value); // Enumeration<ListStatus>
1208        else if (name.equals("date"))
1209          this.date = castToDateTime(value); // DateTimeType
1210        else if (name.equals("orderedBy"))
1211          this.orderedBy = castToCodeableConcept(value); // CodeableConcept
1212        else if (name.equals("mode"))
1213          this.mode = new ListModeEnumFactory().fromType(value); // Enumeration<ListMode>
1214        else if (name.equals("note"))
1215          this.note = castToString(value); // StringType
1216        else if (name.equals("entry"))
1217          this.getEntry().add((ListEntryComponent) value);
1218        else if (name.equals("emptyReason"))
1219          this.emptyReason = castToCodeableConcept(value); // CodeableConcept
1220        else
1221          super.setProperty(name, value);
1222      }
1223
1224      @Override
1225      public Base addChild(String name) throws FHIRException {
1226        if (name.equals("identifier")) {
1227          return addIdentifier();
1228        }
1229        else if (name.equals("title")) {
1230          throw new FHIRException("Cannot call addChild on a primitive type List_.title");
1231        }
1232        else if (name.equals("code")) {
1233          this.code = new CodeableConcept();
1234          return this.code;
1235        }
1236        else if (name.equals("subject")) {
1237          this.subject = new Reference();
1238          return this.subject;
1239        }
1240        else if (name.equals("source")) {
1241          this.source = new Reference();
1242          return this.source;
1243        }
1244        else if (name.equals("encounter")) {
1245          this.encounter = new Reference();
1246          return this.encounter;
1247        }
1248        else if (name.equals("status")) {
1249          throw new FHIRException("Cannot call addChild on a primitive type List_.status");
1250        }
1251        else if (name.equals("date")) {
1252          throw new FHIRException("Cannot call addChild on a primitive type List_.date");
1253        }
1254        else if (name.equals("orderedBy")) {
1255          this.orderedBy = new CodeableConcept();
1256          return this.orderedBy;
1257        }
1258        else if (name.equals("mode")) {
1259          throw new FHIRException("Cannot call addChild on a primitive type List_.mode");
1260        }
1261        else if (name.equals("note")) {
1262          throw new FHIRException("Cannot call addChild on a primitive type List_.note");
1263        }
1264        else if (name.equals("entry")) {
1265          return addEntry();
1266        }
1267        else if (name.equals("emptyReason")) {
1268          this.emptyReason = new CodeableConcept();
1269          return this.emptyReason;
1270        }
1271        else
1272          return super.addChild(name);
1273      }
1274
1275  public String fhirType() {
1276    return "List";
1277
1278  }
1279
1280      public List_ copy() {
1281        List_ dst = new List_();
1282        copyValues(dst);
1283        if (identifier != null) {
1284          dst.identifier = new ArrayList<Identifier>();
1285          for (Identifier i : identifier)
1286            dst.identifier.add(i.copy());
1287        };
1288        dst.title = title == null ? null : title.copy();
1289        dst.code = code == null ? null : code.copy();
1290        dst.subject = subject == null ? null : subject.copy();
1291        dst.source = source == null ? null : source.copy();
1292        dst.encounter = encounter == null ? null : encounter.copy();
1293        dst.status = status == null ? null : status.copy();
1294        dst.date = date == null ? null : date.copy();
1295        dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
1296        dst.mode = mode == null ? null : mode.copy();
1297        dst.note = note == null ? null : note.copy();
1298        if (entry != null) {
1299          dst.entry = new ArrayList<ListEntryComponent>();
1300          for (ListEntryComponent i : entry)
1301            dst.entry.add(i.copy());
1302        };
1303        dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
1304        return dst;
1305      }
1306
1307      protected List_ typedCopy() {
1308        return copy();
1309      }
1310
1311      @Override
1312      public boolean equalsDeep(Base other) {
1313        if (!super.equalsDeep(other))
1314          return false;
1315        if (!(other instanceof List_))
1316          return false;
1317        List_ o = (List_) other;
1318        return compareDeep(identifier, o.identifier, true) && compareDeep(title, o.title, true) && compareDeep(code, o.code, true)
1319           && compareDeep(subject, o.subject, true) && compareDeep(source, o.source, true) && compareDeep(encounter, o.encounter, true)
1320           && compareDeep(status, o.status, true) && compareDeep(date, o.date, true) && compareDeep(orderedBy, o.orderedBy, true)
1321           && compareDeep(mode, o.mode, true) && compareDeep(note, o.note, true) && compareDeep(entry, o.entry, true)
1322           && compareDeep(emptyReason, o.emptyReason, true);
1323      }
1324
1325      @Override
1326      public boolean equalsShallow(Base other) {
1327        if (!super.equalsShallow(other))
1328          return false;
1329        if (!(other instanceof List_))
1330          return false;
1331        List_ o = (List_) other;
1332        return compareValues(title, o.title, true) && compareValues(status, o.status, true) && compareValues(date, o.date, true)
1333           && compareValues(mode, o.mode, true) && compareValues(note, o.note, true);
1334      }
1335
1336      public boolean isEmpty() {
1337        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (title == null || title.isEmpty())
1338           && (code == null || code.isEmpty()) && (subject == null || subject.isEmpty()) && (source == null || source.isEmpty())
1339           && (encounter == null || encounter.isEmpty()) && (status == null || status.isEmpty()) && (date == null || date.isEmpty())
1340           && (orderedBy == null || orderedBy.isEmpty()) && (mode == null || mode.isEmpty()) && (note == null || note.isEmpty())
1341           && (entry == null || entry.isEmpty()) && (emptyReason == null || emptyReason.isEmpty());
1342      }
1343
1344  @Override
1345  public ResourceType getResourceType() {
1346    return ResourceType.List;
1347   }
1348
1349  @SearchParamDefinition(name="date", path="List.date", description="When the list was prepared", type="date" )
1350  public static final String SP_DATE = "date";
1351  @SearchParamDefinition(name="item", path="List.entry.item", description="Actual entry", type="reference" )
1352  public static final String SP_ITEM = "item";
1353  @SearchParamDefinition(name="empty-reason", path="List.emptyReason", description="Why list is empty", type="token" )
1354  public static final String SP_EMPTYREASON = "empty-reason";
1355  @SearchParamDefinition(name="code", path="List.code", description="What the purpose of this list is", type="token" )
1356  public static final String SP_CODE = "code";
1357  @SearchParamDefinition(name="notes", path="List.note", description="Comments about the list", type="string" )
1358  public static final String SP_NOTES = "notes";
1359  @SearchParamDefinition(name="subject", path="List.subject", description="If all resources have the same subject", type="reference" )
1360  public static final String SP_SUBJECT = "subject";
1361  @SearchParamDefinition(name="patient", path="List.subject", description="If all resources have the same subject", type="reference" )
1362  public static final String SP_PATIENT = "patient";
1363  @SearchParamDefinition(name="source", path="List.source", description="Who and/or what defined the list contents (aka Author)", type="reference" )
1364  public static final String SP_SOURCE = "source";
1365  @SearchParamDefinition(name="encounter", path="List.encounter", description="Context in which list created", type="reference" )
1366  public static final String SP_ENCOUNTER = "encounter";
1367  @SearchParamDefinition(name="title", path="List.title", description="Descriptive name for the list", type="string" )
1368  public static final String SP_TITLE = "title";
1369  @SearchParamDefinition(name="status", path="List.status", description="current | retired | entered-in-error", type="token" )
1370  public static final String SP_STATUS = "status";
1371
1372}
1373