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