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