001package org.hl7.fhir.dstu2.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Block;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.exceptions.FHIRException;
044import org.hl7.fhir.utilities.Utilities;
045
046/**
047 * A structured set of questions and their answers. The questions are ordered
048 * and grouped into coherent subsets, corresponding to the structure of the
049 * grouping of the underlying questions.
050 */
051@ResourceDef(name = "QuestionnaireResponse", profile = "http://hl7.org/fhir/Profile/QuestionnaireResponse")
052public class QuestionnaireResponse extends DomainResource {
053
054  public enum QuestionnaireResponseStatus {
055    /**
056     * This QuestionnaireResponse has been partially filled out with answers, but
057     * changes or additions are still expected to be made to it.
058     */
059    INPROGRESS,
060    /**
061     * This QuestionnaireResponse has been filled out with answers, and the current
062     * content is regarded as definitive.
063     */
064    COMPLETED,
065    /**
066     * This QuestionnaireResponse has been filled out with answers, then marked as
067     * complete, yet changes or additions have been made to it afterwards.
068     */
069    AMENDED,
070    /**
071     * added to help the parsers
072     */
073    NULL;
074
075    public static QuestionnaireResponseStatus fromCode(String codeString) throws FHIRException {
076      if (codeString == null || "".equals(codeString))
077        return null;
078      if ("in-progress".equals(codeString))
079        return INPROGRESS;
080      if ("completed".equals(codeString))
081        return COMPLETED;
082      if ("amended".equals(codeString))
083        return AMENDED;
084      throw new FHIRException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
085    }
086
087    public String toCode() {
088      switch (this) {
089      case INPROGRESS:
090        return "in-progress";
091      case COMPLETED:
092        return "completed";
093      case AMENDED:
094        return "amended";
095      case NULL:
096        return null;
097      default:
098        return "?";
099      }
100    }
101
102    public String getSystem() {
103      switch (this) {
104      case INPROGRESS:
105        return "http://hl7.org/fhir/questionnaire-answers-status";
106      case COMPLETED:
107        return "http://hl7.org/fhir/questionnaire-answers-status";
108      case AMENDED:
109        return "http://hl7.org/fhir/questionnaire-answers-status";
110      case NULL:
111        return null;
112      default:
113        return "?";
114      }
115    }
116
117    public String getDefinition() {
118      switch (this) {
119      case INPROGRESS:
120        return "This QuestionnaireResponse has been partially filled out with answers, but changes or additions are still expected to be made to it.";
121      case COMPLETED:
122        return "This QuestionnaireResponse has been filled out with answers, and the current content is regarded as definitive.";
123      case AMENDED:
124        return "This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.";
125      case NULL:
126        return null;
127      default:
128        return "?";
129      }
130    }
131
132    public String getDisplay() {
133      switch (this) {
134      case INPROGRESS:
135        return "In Progress";
136      case COMPLETED:
137        return "Completed";
138      case AMENDED:
139        return "Amended";
140      case NULL:
141        return null;
142      default:
143        return "?";
144      }
145    }
146  }
147
148  public static class QuestionnaireResponseStatusEnumFactory implements EnumFactory<QuestionnaireResponseStatus> {
149    public QuestionnaireResponseStatus fromCode(String codeString) throws IllegalArgumentException {
150      if (codeString == null || "".equals(codeString))
151        if (codeString == null || "".equals(codeString))
152          return null;
153      if ("in-progress".equals(codeString))
154        return QuestionnaireResponseStatus.INPROGRESS;
155      if ("completed".equals(codeString))
156        return QuestionnaireResponseStatus.COMPLETED;
157      if ("amended".equals(codeString))
158        return QuestionnaireResponseStatus.AMENDED;
159      throw new IllegalArgumentException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
160    }
161
162    public Enumeration<QuestionnaireResponseStatus> fromType(Base code) throws FHIRException {
163      if (code == null || code.isEmpty())
164        return null;
165      String codeString = ((PrimitiveType) code).asStringValue();
166      if (codeString == null || "".equals(codeString))
167        return null;
168      if ("in-progress".equals(codeString))
169        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.INPROGRESS);
170      if ("completed".equals(codeString))
171        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.COMPLETED);
172      if ("amended".equals(codeString))
173        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.AMENDED);
174      throw new FHIRException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
175    }
176
177    public String toCode(QuestionnaireResponseStatus code) {
178      if (code == QuestionnaireResponseStatus.INPROGRESS)
179        return "in-progress";
180      if (code == QuestionnaireResponseStatus.COMPLETED)
181        return "completed";
182      if (code == QuestionnaireResponseStatus.AMENDED)
183        return "amended";
184      return "?";
185    }
186  }
187
188  @Block()
189  public static class GroupComponent extends BackboneElement implements IBaseBackboneElement {
190    /**
191     * Identifies the group from the Questionnaire that corresponds to this group in
192     * the QuestionnaireResponse resource.
193     */
194    @Child(name = "linkId", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
195    @Description(shortDefinition = "Corresponding group within Questionnaire", formalDefinition = "Identifies the group from the Questionnaire that corresponds to this group in the QuestionnaireResponse resource.")
196    protected StringType linkId;
197
198    /**
199     * Text that is displayed above the contents of the group.
200     */
201    @Child(name = "title", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
202    @Description(shortDefinition = "Name for this group", formalDefinition = "Text that is displayed above the contents of the group.")
203    protected StringType title;
204
205    /**
206     * Additional text for the group, used for display purposes.
207     */
208    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
209    @Description(shortDefinition = "Additional text for the group", formalDefinition = "Additional text for the group, used for display purposes.")
210    protected StringType text;
211
212    /**
213     * More specific subject this section's answers are about, details the subject
214     * given in QuestionnaireResponse.
215     */
216    @Child(name = "subject", type = {}, order = 4, min = 0, max = 1, modifier = false, summary = false)
217    @Description(shortDefinition = "The subject this group's answers are about", formalDefinition = "More specific subject this section's answers are about, details the subject given in QuestionnaireResponse.")
218    protected Reference subject;
219
220    /**
221     * The actual object that is the target of the reference (More specific subject
222     * this section's answers are about, details the subject given in
223     * QuestionnaireResponse.)
224     */
225    protected Resource subjectTarget;
226
227    /**
228     * A sub-group within a group. The ordering of groups within this group is
229     * relevant.
230     */
231    @Child(name = "group", type = {
232        GroupComponent.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
233    @Description(shortDefinition = "Nested questionnaire response group", formalDefinition = "A sub-group within a group. The ordering of groups within this group is relevant.")
234    protected List<GroupComponent> group;
235
236    /**
237     * Set of questions within this group. The order of questions within the group
238     * is relevant.
239     */
240    @Child(name = "question", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
241    @Description(shortDefinition = "Questions in this group", formalDefinition = "Set of questions within this group. The order of questions within the group is relevant.")
242    protected List<QuestionComponent> question;
243
244    private static final long serialVersionUID = -1045990435L;
245
246    /*
247     * Constructor
248     */
249    public GroupComponent() {
250      super();
251    }
252
253    /**
254     * @return {@link #linkId} (Identifies the group from the Questionnaire that
255     *         corresponds to this group in the QuestionnaireResponse resource.).
256     *         This is the underlying object with id, value and extensions. The
257     *         accessor "getLinkId" gives direct access to the value
258     */
259    public StringType getLinkIdElement() {
260      if (this.linkId == null)
261        if (Configuration.errorOnAutoCreate())
262          throw new Error("Attempt to auto-create GroupComponent.linkId");
263        else if (Configuration.doAutoCreate())
264          this.linkId = new StringType(); // bb
265      return this.linkId;
266    }
267
268    public boolean hasLinkIdElement() {
269      return this.linkId != null && !this.linkId.isEmpty();
270    }
271
272    public boolean hasLinkId() {
273      return this.linkId != null && !this.linkId.isEmpty();
274    }
275
276    /**
277     * @param value {@link #linkId} (Identifies the group from the Questionnaire
278     *              that corresponds to this group in the QuestionnaireResponse
279     *              resource.). This is the underlying object with id, value and
280     *              extensions. The accessor "getLinkId" gives direct access to the
281     *              value
282     */
283    public GroupComponent setLinkIdElement(StringType value) {
284      this.linkId = value;
285      return this;
286    }
287
288    /**
289     * @return Identifies the group from the Questionnaire that corresponds to this
290     *         group in the QuestionnaireResponse resource.
291     */
292    public String getLinkId() {
293      return this.linkId == null ? null : this.linkId.getValue();
294    }
295
296    /**
297     * @param value Identifies the group from the Questionnaire that corresponds to
298     *              this group in the QuestionnaireResponse resource.
299     */
300    public GroupComponent setLinkId(String value) {
301      if (Utilities.noString(value))
302        this.linkId = null;
303      else {
304        if (this.linkId == null)
305          this.linkId = new StringType();
306        this.linkId.setValue(value);
307      }
308      return this;
309    }
310
311    /**
312     * @return {@link #title} (Text that is displayed above the contents of the
313     *         group.). This is the underlying object with id, value and extensions.
314     *         The accessor "getTitle" gives direct access to the value
315     */
316    public StringType getTitleElement() {
317      if (this.title == null)
318        if (Configuration.errorOnAutoCreate())
319          throw new Error("Attempt to auto-create GroupComponent.title");
320        else if (Configuration.doAutoCreate())
321          this.title = new StringType(); // bb
322      return this.title;
323    }
324
325    public boolean hasTitleElement() {
326      return this.title != null && !this.title.isEmpty();
327    }
328
329    public boolean hasTitle() {
330      return this.title != null && !this.title.isEmpty();
331    }
332
333    /**
334     * @param value {@link #title} (Text that is displayed above the contents of the
335     *              group.). This is the underlying object with id, value and
336     *              extensions. The accessor "getTitle" gives direct access to the
337     *              value
338     */
339    public GroupComponent setTitleElement(StringType value) {
340      this.title = value;
341      return this;
342    }
343
344    /**
345     * @return Text that is displayed above the contents of the group.
346     */
347    public String getTitle() {
348      return this.title == null ? null : this.title.getValue();
349    }
350
351    /**
352     * @param value Text that is displayed above the contents of the group.
353     */
354    public GroupComponent setTitle(String value) {
355      if (Utilities.noString(value))
356        this.title = null;
357      else {
358        if (this.title == null)
359          this.title = new StringType();
360        this.title.setValue(value);
361      }
362      return this;
363    }
364
365    /**
366     * @return {@link #text} (Additional text for the group, used for display
367     *         purposes.). This is the underlying object with id, value and
368     *         extensions. The accessor "getText" gives direct access to the value
369     */
370    public StringType getTextElement() {
371      if (this.text == null)
372        if (Configuration.errorOnAutoCreate())
373          throw new Error("Attempt to auto-create GroupComponent.text");
374        else if (Configuration.doAutoCreate())
375          this.text = new StringType(); // bb
376      return this.text;
377    }
378
379    public boolean hasTextElement() {
380      return this.text != null && !this.text.isEmpty();
381    }
382
383    public boolean hasText() {
384      return this.text != null && !this.text.isEmpty();
385    }
386
387    /**
388     * @param value {@link #text} (Additional text for the group, used for display
389     *              purposes.). This is the underlying object with id, value and
390     *              extensions. The accessor "getText" gives direct access to the
391     *              value
392     */
393    public GroupComponent setTextElement(StringType value) {
394      this.text = value;
395      return this;
396    }
397
398    /**
399     * @return Additional text for the group, used for display purposes.
400     */
401    public String getText() {
402      return this.text == null ? null : this.text.getValue();
403    }
404
405    /**
406     * @param value Additional text for the group, used for display purposes.
407     */
408    public GroupComponent setText(String value) {
409      if (Utilities.noString(value))
410        this.text = null;
411      else {
412        if (this.text == null)
413          this.text = new StringType();
414        this.text.setValue(value);
415      }
416      return this;
417    }
418
419    /**
420     * @return {@link #subject} (More specific subject this section's answers are
421     *         about, details the subject given in QuestionnaireResponse.)
422     */
423    public Reference getSubject() {
424      if (this.subject == null)
425        if (Configuration.errorOnAutoCreate())
426          throw new Error("Attempt to auto-create GroupComponent.subject");
427        else if (Configuration.doAutoCreate())
428          this.subject = new Reference(); // cc
429      return this.subject;
430    }
431
432    public boolean hasSubject() {
433      return this.subject != null && !this.subject.isEmpty();
434    }
435
436    /**
437     * @param value {@link #subject} (More specific subject this section's answers
438     *              are about, details the subject given in QuestionnaireResponse.)
439     */
440    public GroupComponent setSubject(Reference value) {
441      this.subject = value;
442      return this;
443    }
444
445    /**
446     * @return {@link #subject} The actual object that is the target of the
447     *         reference. The reference library doesn't populate this, but you can
448     *         use it to hold the resource if you resolve it. (More specific subject
449     *         this section's answers are about, details the subject given in
450     *         QuestionnaireResponse.)
451     */
452    public Resource getSubjectTarget() {
453      return this.subjectTarget;
454    }
455
456    /**
457     * @param value {@link #subject} The actual object that is the target of the
458     *              reference. The reference library doesn't use these, but you can
459     *              use it to hold the resource if you resolve it. (More specific
460     *              subject this section's answers are about, details the subject
461     *              given in QuestionnaireResponse.)
462     */
463    public GroupComponent setSubjectTarget(Resource value) {
464      this.subjectTarget = value;
465      return this;
466    }
467
468    /**
469     * @return {@link #group} (A sub-group within a group. The ordering of groups
470     *         within this group is relevant.)
471     */
472    public List<GroupComponent> getGroup() {
473      if (this.group == null)
474        this.group = new ArrayList<GroupComponent>();
475      return this.group;
476    }
477
478    public boolean hasGroup() {
479      if (this.group == null)
480        return false;
481      for (GroupComponent item : this.group)
482        if (!item.isEmpty())
483          return true;
484      return false;
485    }
486
487    /**
488     * @return {@link #group} (A sub-group within a group. The ordering of groups
489     *         within this group is relevant.)
490     */
491    // syntactic sugar
492    public GroupComponent addGroup() { // 3
493      GroupComponent t = new GroupComponent();
494      if (this.group == null)
495        this.group = new ArrayList<GroupComponent>();
496      this.group.add(t);
497      return t;
498    }
499
500    // syntactic sugar
501    public GroupComponent addGroup(GroupComponent t) { // 3
502      if (t == null)
503        return this;
504      if (this.group == null)
505        this.group = new ArrayList<GroupComponent>();
506      this.group.add(t);
507      return this;
508    }
509
510    /**
511     * @return {@link #question} (Set of questions within this group. The order of
512     *         questions within the group is relevant.)
513     */
514    public List<QuestionComponent> getQuestion() {
515      if (this.question == null)
516        this.question = new ArrayList<QuestionComponent>();
517      return this.question;
518    }
519
520    public boolean hasQuestion() {
521      if (this.question == null)
522        return false;
523      for (QuestionComponent item : this.question)
524        if (!item.isEmpty())
525          return true;
526      return false;
527    }
528
529    /**
530     * @return {@link #question} (Set of questions within this group. The order of
531     *         questions within the group is relevant.)
532     */
533    // syntactic sugar
534    public QuestionComponent addQuestion() { // 3
535      QuestionComponent t = new QuestionComponent();
536      if (this.question == null)
537        this.question = new ArrayList<QuestionComponent>();
538      this.question.add(t);
539      return t;
540    }
541
542    // syntactic sugar
543    public GroupComponent addQuestion(QuestionComponent t) { // 3
544      if (t == null)
545        return this;
546      if (this.question == null)
547        this.question = new ArrayList<QuestionComponent>();
548      this.question.add(t);
549      return this;
550    }
551
552    protected void listChildren(List<Property> childrenList) {
553      super.listChildren(childrenList);
554      childrenList.add(new Property("linkId", "string",
555          "Identifies the group from the Questionnaire that corresponds to this group in the QuestionnaireResponse resource.",
556          0, java.lang.Integer.MAX_VALUE, linkId));
557      childrenList.add(new Property("title", "string", "Text that is displayed above the contents of the group.", 0,
558          java.lang.Integer.MAX_VALUE, title));
559      childrenList.add(new Property("text", "string", "Additional text for the group, used for display purposes.", 0,
560          java.lang.Integer.MAX_VALUE, text));
561      childrenList.add(new Property("subject", "Reference(Any)",
562          "More specific subject this section's answers are about, details the subject given in QuestionnaireResponse.",
563          0, java.lang.Integer.MAX_VALUE, subject));
564      childrenList.add(new Property("group", "@QuestionnaireResponse.group",
565          "A sub-group within a group. The ordering of groups within this group is relevant.", 0,
566          java.lang.Integer.MAX_VALUE, group));
567      childrenList.add(new Property("question", "",
568          "Set of questions within this group. The order of questions within the group is relevant.", 0,
569          java.lang.Integer.MAX_VALUE, question));
570    }
571
572    @Override
573    public void setProperty(String name, Base value) throws FHIRException {
574      if (name.equals("linkId"))
575        this.linkId = castToString(value); // StringType
576      else if (name.equals("title"))
577        this.title = castToString(value); // StringType
578      else if (name.equals("text"))
579        this.text = castToString(value); // StringType
580      else if (name.equals("subject"))
581        this.subject = castToReference(value); // Reference
582      else if (name.equals("group"))
583        this.getGroup().add((GroupComponent) value);
584      else if (name.equals("question"))
585        this.getQuestion().add((QuestionComponent) value);
586      else
587        super.setProperty(name, value);
588    }
589
590    @Override
591    public Base addChild(String name) throws FHIRException {
592      if (name.equals("linkId")) {
593        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.linkId");
594      } else if (name.equals("title")) {
595        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.title");
596      } else if (name.equals("text")) {
597        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.text");
598      } else if (name.equals("subject")) {
599        this.subject = new Reference();
600        return this.subject;
601      } else if (name.equals("group")) {
602        return addGroup();
603      } else if (name.equals("question")) {
604        return addQuestion();
605      } else
606        return super.addChild(name);
607    }
608
609    public GroupComponent copy() {
610      GroupComponent dst = new GroupComponent();
611      copyValues(dst);
612      dst.linkId = linkId == null ? null : linkId.copy();
613      dst.title = title == null ? null : title.copy();
614      dst.text = text == null ? null : text.copy();
615      dst.subject = subject == null ? null : subject.copy();
616      if (group != null) {
617        dst.group = new ArrayList<GroupComponent>();
618        for (GroupComponent i : group)
619          dst.group.add(i.copy());
620      }
621      ;
622      if (question != null) {
623        dst.question = new ArrayList<QuestionComponent>();
624        for (QuestionComponent i : question)
625          dst.question.add(i.copy());
626      }
627      ;
628      return dst;
629    }
630
631    @Override
632    public boolean equalsDeep(Base other) {
633      if (!super.equalsDeep(other))
634        return false;
635      if (!(other instanceof GroupComponent))
636        return false;
637      GroupComponent o = (GroupComponent) other;
638      return compareDeep(linkId, o.linkId, true) && compareDeep(title, o.title, true) && compareDeep(text, o.text, true)
639          && compareDeep(subject, o.subject, true) && compareDeep(group, o.group, true)
640          && compareDeep(question, o.question, true);
641    }
642
643    @Override
644    public boolean equalsShallow(Base other) {
645      if (!super.equalsShallow(other))
646        return false;
647      if (!(other instanceof GroupComponent))
648        return false;
649      GroupComponent o = (GroupComponent) other;
650      return compareValues(linkId, o.linkId, true) && compareValues(title, o.title, true)
651          && compareValues(text, o.text, true);
652    }
653
654    public boolean isEmpty() {
655      return super.isEmpty() && (linkId == null || linkId.isEmpty()) && (title == null || title.isEmpty())
656          && (text == null || text.isEmpty()) && (subject == null || subject.isEmpty())
657          && (group == null || group.isEmpty()) && (question == null || question.isEmpty());
658    }
659
660    public String fhirType() {
661      return "QuestionnaireResponse.group";
662
663    }
664
665  }
666
667  @Block()
668  public static class QuestionComponent extends BackboneElement implements IBaseBackboneElement {
669    /**
670     * Identifies the question from the Questionnaire that corresponds to this
671     * question in the QuestionnaireResponse resource.
672     */
673    @Child(name = "linkId", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
674    @Description(shortDefinition = "Corresponding question within Questionnaire", formalDefinition = "Identifies the question from the Questionnaire that corresponds to this question in the QuestionnaireResponse resource.")
675    protected StringType linkId;
676
677    /**
678     * The actual question as shown to the user to prompt them for an answer.
679     */
680    @Child(name = "text", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
681    @Description(shortDefinition = "Text of the question as it is shown to the user", formalDefinition = "The actual question as shown to the user to prompt them for an answer.")
682    protected StringType text;
683
684    /**
685     * The respondent's answer(s) to the question.
686     */
687    @Child(name = "answer", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
688    @Description(shortDefinition = "The response(s) to the question", formalDefinition = "The respondent's answer(s) to the question.")
689    protected List<QuestionAnswerComponent> answer;
690
691    private static final long serialVersionUID = -265263901L;
692
693    /*
694     * Constructor
695     */
696    public QuestionComponent() {
697      super();
698    }
699
700    /**
701     * @return {@link #linkId} (Identifies the question from the Questionnaire that
702     *         corresponds to this question in the QuestionnaireResponse resource.).
703     *         This is the underlying object with id, value and extensions. The
704     *         accessor "getLinkId" gives direct access to the value
705     */
706    public StringType getLinkIdElement() {
707      if (this.linkId == null)
708        if (Configuration.errorOnAutoCreate())
709          throw new Error("Attempt to auto-create QuestionComponent.linkId");
710        else if (Configuration.doAutoCreate())
711          this.linkId = new StringType(); // bb
712      return this.linkId;
713    }
714
715    public boolean hasLinkIdElement() {
716      return this.linkId != null && !this.linkId.isEmpty();
717    }
718
719    public boolean hasLinkId() {
720      return this.linkId != null && !this.linkId.isEmpty();
721    }
722
723    /**
724     * @param value {@link #linkId} (Identifies the question from the Questionnaire
725     *              that corresponds to this question in the QuestionnaireResponse
726     *              resource.). This is the underlying object with id, value and
727     *              extensions. The accessor "getLinkId" gives direct access to the
728     *              value
729     */
730    public QuestionComponent setLinkIdElement(StringType value) {
731      this.linkId = value;
732      return this;
733    }
734
735    /**
736     * @return Identifies the question from the Questionnaire that corresponds to
737     *         this question in the QuestionnaireResponse resource.
738     */
739    public String getLinkId() {
740      return this.linkId == null ? null : this.linkId.getValue();
741    }
742
743    /**
744     * @param value Identifies the question from the Questionnaire that corresponds
745     *              to this question in the QuestionnaireResponse resource.
746     */
747    public QuestionComponent setLinkId(String value) {
748      if (Utilities.noString(value))
749        this.linkId = null;
750      else {
751        if (this.linkId == null)
752          this.linkId = new StringType();
753        this.linkId.setValue(value);
754      }
755      return this;
756    }
757
758    /**
759     * @return {@link #text} (The actual question as shown to the user to prompt
760     *         them for an answer.). This is the underlying object with id, value
761     *         and extensions. The accessor "getText" gives direct access to the
762     *         value
763     */
764    public StringType getTextElement() {
765      if (this.text == null)
766        if (Configuration.errorOnAutoCreate())
767          throw new Error("Attempt to auto-create QuestionComponent.text");
768        else if (Configuration.doAutoCreate())
769          this.text = new StringType(); // bb
770      return this.text;
771    }
772
773    public boolean hasTextElement() {
774      return this.text != null && !this.text.isEmpty();
775    }
776
777    public boolean hasText() {
778      return this.text != null && !this.text.isEmpty();
779    }
780
781    /**
782     * @param value {@link #text} (The actual question as shown to the user to
783     *              prompt them for an answer.). This is the underlying object with
784     *              id, value and extensions. The accessor "getText" gives direct
785     *              access to the value
786     */
787    public QuestionComponent setTextElement(StringType value) {
788      this.text = value;
789      return this;
790    }
791
792    /**
793     * @return The actual question as shown to the user to prompt them for an
794     *         answer.
795     */
796    public String getText() {
797      return this.text == null ? null : this.text.getValue();
798    }
799
800    /**
801     * @param value The actual question as shown to the user to prompt them for an
802     *              answer.
803     */
804    public QuestionComponent setText(String value) {
805      if (Utilities.noString(value))
806        this.text = null;
807      else {
808        if (this.text == null)
809          this.text = new StringType();
810        this.text.setValue(value);
811      }
812      return this;
813    }
814
815    /**
816     * @return {@link #answer} (The respondent's answer(s) to the question.)
817     */
818    public List<QuestionAnswerComponent> getAnswer() {
819      if (this.answer == null)
820        this.answer = new ArrayList<QuestionAnswerComponent>();
821      return this.answer;
822    }
823
824    public boolean hasAnswer() {
825      if (this.answer == null)
826        return false;
827      for (QuestionAnswerComponent item : this.answer)
828        if (!item.isEmpty())
829          return true;
830      return false;
831    }
832
833    /**
834     * @return {@link #answer} (The respondent's answer(s) to the question.)
835     */
836    // syntactic sugar
837    public QuestionAnswerComponent addAnswer() { // 3
838      QuestionAnswerComponent t = new QuestionAnswerComponent();
839      if (this.answer == null)
840        this.answer = new ArrayList<QuestionAnswerComponent>();
841      this.answer.add(t);
842      return t;
843    }
844
845    // syntactic sugar
846    public QuestionComponent addAnswer(QuestionAnswerComponent t) { // 3
847      if (t == null)
848        return this;
849      if (this.answer == null)
850        this.answer = new ArrayList<QuestionAnswerComponent>();
851      this.answer.add(t);
852      return this;
853    }
854
855    protected void listChildren(List<Property> childrenList) {
856      super.listChildren(childrenList);
857      childrenList.add(new Property("linkId", "string",
858          "Identifies the question from the Questionnaire that corresponds to this question in the QuestionnaireResponse resource.",
859          0, java.lang.Integer.MAX_VALUE, linkId));
860      childrenList
861          .add(new Property("text", "string", "The actual question as shown to the user to prompt them for an answer.",
862              0, java.lang.Integer.MAX_VALUE, text));
863      childrenList.add(new Property("answer", "", "The respondent's answer(s) to the question.", 0,
864          java.lang.Integer.MAX_VALUE, answer));
865    }
866
867    @Override
868    public void setProperty(String name, Base value) throws FHIRException {
869      if (name.equals("linkId"))
870        this.linkId = castToString(value); // StringType
871      else if (name.equals("text"))
872        this.text = castToString(value); // StringType
873      else if (name.equals("answer"))
874        this.getAnswer().add((QuestionAnswerComponent) value);
875      else
876        super.setProperty(name, value);
877    }
878
879    @Override
880    public Base addChild(String name) throws FHIRException {
881      if (name.equals("linkId")) {
882        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.linkId");
883      } else if (name.equals("text")) {
884        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.text");
885      } else if (name.equals("answer")) {
886        return addAnswer();
887      } else
888        return super.addChild(name);
889    }
890
891    public QuestionComponent copy() {
892      QuestionComponent dst = new QuestionComponent();
893      copyValues(dst);
894      dst.linkId = linkId == null ? null : linkId.copy();
895      dst.text = text == null ? null : text.copy();
896      if (answer != null) {
897        dst.answer = new ArrayList<QuestionAnswerComponent>();
898        for (QuestionAnswerComponent i : answer)
899          dst.answer.add(i.copy());
900      }
901      ;
902      return dst;
903    }
904
905    @Override
906    public boolean equalsDeep(Base other) {
907      if (!super.equalsDeep(other))
908        return false;
909      if (!(other instanceof QuestionComponent))
910        return false;
911      QuestionComponent o = (QuestionComponent) other;
912      return compareDeep(linkId, o.linkId, true) && compareDeep(text, o.text, true)
913          && compareDeep(answer, o.answer, true);
914    }
915
916    @Override
917    public boolean equalsShallow(Base other) {
918      if (!super.equalsShallow(other))
919        return false;
920      if (!(other instanceof QuestionComponent))
921        return false;
922      QuestionComponent o = (QuestionComponent) other;
923      return compareValues(linkId, o.linkId, true) && compareValues(text, o.text, true);
924    }
925
926    public boolean isEmpty() {
927      return super.isEmpty() && (linkId == null || linkId.isEmpty()) && (text == null || text.isEmpty())
928          && (answer == null || answer.isEmpty());
929    }
930
931    public String fhirType() {
932      return "QuestionnaireResponse.group.question";
933
934    }
935
936  }
937
938  @Block()
939  public static class QuestionAnswerComponent extends BackboneElement implements IBaseBackboneElement {
940    /**
941     * The answer (or one of the answers) provided by the respondent to the
942     * question.
943     */
944    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
945        DateTimeType.class, InstantType.class, TimeType.class, StringType.class, UriType.class, Attachment.class,
946        Coding.class, Quantity.class, Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
947    @Description(shortDefinition = "Single-valued answer to the question", formalDefinition = "The answer (or one of the answers) provided by the respondent to the question.")
948    protected Type value;
949
950    /**
951     * Nested group, containing nested question for this question. The order of
952     * groups within the question is relevant.
953     */
954    @Child(name = "group", type = {
955        GroupComponent.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
956    @Description(shortDefinition = "Nested questionnaire group", formalDefinition = "Nested group, containing nested question for this question. The order of groups within the question is relevant.")
957    protected List<GroupComponent> group;
958
959    private static final long serialVersionUID = -1223680118L;
960
961    /*
962     * Constructor
963     */
964    public QuestionAnswerComponent() {
965      super();
966    }
967
968    /**
969     * @return {@link #value} (The answer (or one of the answers) provided by the
970     *         respondent to the question.)
971     */
972    public Type getValue() {
973      return this.value;
974    }
975
976    /**
977     * @return {@link #value} (The answer (or one of the answers) provided by the
978     *         respondent to the question.)
979     */
980    public BooleanType getValueBooleanType() throws FHIRException {
981      if (!(this.value instanceof BooleanType))
982        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
983            + this.value.getClass().getName() + " was encountered");
984      return (BooleanType) this.value;
985    }
986
987    public boolean hasValueBooleanType() {
988      return this.value instanceof BooleanType;
989    }
990
991    /**
992     * @return {@link #value} (The answer (or one of the answers) provided by the
993     *         respondent to the question.)
994     */
995    public DecimalType getValueDecimalType() throws FHIRException {
996      if (!(this.value instanceof DecimalType))
997        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
998            + this.value.getClass().getName() + " was encountered");
999      return (DecimalType) this.value;
1000    }
1001
1002    public boolean hasValueDecimalType() {
1003      return this.value instanceof DecimalType;
1004    }
1005
1006    /**
1007     * @return {@link #value} (The answer (or one of the answers) provided by the
1008     *         respondent to the question.)
1009     */
1010    public IntegerType getValueIntegerType() throws FHIRException {
1011      if (!(this.value instanceof IntegerType))
1012        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
1013            + this.value.getClass().getName() + " was encountered");
1014      return (IntegerType) this.value;
1015    }
1016
1017    public boolean hasValueIntegerType() {
1018      return this.value instanceof IntegerType;
1019    }
1020
1021    /**
1022     * @return {@link #value} (The answer (or one of the answers) provided by the
1023     *         respondent to the question.)
1024     */
1025    public DateType getValueDateType() throws FHIRException {
1026      if (!(this.value instanceof DateType))
1027        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
1028            + " was encountered");
1029      return (DateType) this.value;
1030    }
1031
1032    public boolean hasValueDateType() {
1033      return this.value instanceof DateType;
1034    }
1035
1036    /**
1037     * @return {@link #value} (The answer (or one of the answers) provided by the
1038     *         respondent to the question.)
1039     */
1040    public DateTimeType getValueDateTimeType() throws FHIRException {
1041      if (!(this.value instanceof DateTimeType))
1042        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1043            + this.value.getClass().getName() + " was encountered");
1044      return (DateTimeType) this.value;
1045    }
1046
1047    public boolean hasValueDateTimeType() {
1048      return this.value instanceof DateTimeType;
1049    }
1050
1051    /**
1052     * @return {@link #value} (The answer (or one of the answers) provided by the
1053     *         respondent to the question.)
1054     */
1055    public InstantType getValueInstantType() throws FHIRException {
1056      if (!(this.value instanceof InstantType))
1057        throw new FHIRException("Type mismatch: the type InstantType was expected, but "
1058            + this.value.getClass().getName() + " was encountered");
1059      return (InstantType) this.value;
1060    }
1061
1062    public boolean hasValueInstantType() {
1063      return this.value instanceof InstantType;
1064    }
1065
1066    /**
1067     * @return {@link #value} (The answer (or one of the answers) provided by the
1068     *         respondent to the question.)
1069     */
1070    public TimeType getValueTimeType() throws FHIRException {
1071      if (!(this.value instanceof TimeType))
1072        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
1073            + " was encountered");
1074      return (TimeType) this.value;
1075    }
1076
1077    public boolean hasValueTimeType() {
1078      return this.value instanceof TimeType;
1079    }
1080
1081    /**
1082     * @return {@link #value} (The answer (or one of the answers) provided by the
1083     *         respondent to the question.)
1084     */
1085    public StringType getValueStringType() throws FHIRException {
1086      if (!(this.value instanceof StringType))
1087        throw new FHIRException("Type mismatch: the type StringType was expected, but "
1088            + this.value.getClass().getName() + " was encountered");
1089      return (StringType) this.value;
1090    }
1091
1092    public boolean hasValueStringType() {
1093      return this.value instanceof StringType;
1094    }
1095
1096    /**
1097     * @return {@link #value} (The answer (or one of the answers) provided by the
1098     *         respondent to the question.)
1099     */
1100    public UriType getValueUriType() throws FHIRException {
1101      if (!(this.value instanceof UriType))
1102        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
1103            + " was encountered");
1104      return (UriType) this.value;
1105    }
1106
1107    public boolean hasValueUriType() {
1108      return this.value instanceof UriType;
1109    }
1110
1111    /**
1112     * @return {@link #value} (The answer (or one of the answers) provided by the
1113     *         respondent to the question.)
1114     */
1115    public Attachment getValueAttachment() throws FHIRException {
1116      if (!(this.value instanceof Attachment))
1117        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
1118            + this.value.getClass().getName() + " was encountered");
1119      return (Attachment) this.value;
1120    }
1121
1122    public boolean hasValueAttachment() {
1123      return this.value instanceof Attachment;
1124    }
1125
1126    /**
1127     * @return {@link #value} (The answer (or one of the answers) provided by the
1128     *         respondent to the question.)
1129     */
1130    public Coding getValueCoding() throws FHIRException {
1131      if (!(this.value instanceof Coding))
1132        throw new FHIRException(
1133            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
1134      return (Coding) this.value;
1135    }
1136
1137    public boolean hasValueCoding() {
1138      return this.value instanceof Coding;
1139    }
1140
1141    /**
1142     * @return {@link #value} (The answer (or one of the answers) provided by the
1143     *         respondent to the question.)
1144     */
1145    public Quantity getValueQuantity() throws FHIRException {
1146      if (!(this.value instanceof Quantity))
1147        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1148            + " was encountered");
1149      return (Quantity) this.value;
1150    }
1151
1152    public boolean hasValueQuantity() {
1153      return this.value instanceof Quantity;
1154    }
1155
1156    /**
1157     * @return {@link #value} (The answer (or one of the answers) provided by the
1158     *         respondent to the question.)
1159     */
1160    public Reference getValueReference() throws FHIRException {
1161      if (!(this.value instanceof Reference))
1162        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1163            + " was encountered");
1164      return (Reference) this.value;
1165    }
1166
1167    public boolean hasValueReference() {
1168      return this.value instanceof Reference;
1169    }
1170
1171    public boolean hasValue() {
1172      return this.value != null && !this.value.isEmpty();
1173    }
1174
1175    /**
1176     * @param value {@link #value} (The answer (or one of the answers) provided by
1177     *              the respondent to the question.)
1178     */
1179    public QuestionAnswerComponent setValue(Type value) {
1180      this.value = value;
1181      return this;
1182    }
1183
1184    /**
1185     * @return {@link #group} (Nested group, containing nested question for this
1186     *         question. The order of groups within the question is relevant.)
1187     */
1188    public List<GroupComponent> getGroup() {
1189      if (this.group == null)
1190        this.group = new ArrayList<GroupComponent>();
1191      return this.group;
1192    }
1193
1194    public boolean hasGroup() {
1195      if (this.group == null)
1196        return false;
1197      for (GroupComponent item : this.group)
1198        if (!item.isEmpty())
1199          return true;
1200      return false;
1201    }
1202
1203    /**
1204     * @return {@link #group} (Nested group, containing nested question for this
1205     *         question. The order of groups within the question is relevant.)
1206     */
1207    // syntactic sugar
1208    public GroupComponent addGroup() { // 3
1209      GroupComponent t = new GroupComponent();
1210      if (this.group == null)
1211        this.group = new ArrayList<GroupComponent>();
1212      this.group.add(t);
1213      return t;
1214    }
1215
1216    // syntactic sugar
1217    public QuestionAnswerComponent addGroup(GroupComponent t) { // 3
1218      if (t == null)
1219        return this;
1220      if (this.group == null)
1221        this.group = new ArrayList<GroupComponent>();
1222      this.group.add(t);
1223      return this;
1224    }
1225
1226    protected void listChildren(List<Property> childrenList) {
1227      super.listChildren(childrenList);
1228      childrenList.add(new Property("value[x]",
1229          "boolean|decimal|integer|date|dateTime|instant|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1230          "The answer (or one of the answers) provided by the respondent to the question.", 0,
1231          java.lang.Integer.MAX_VALUE, value));
1232      childrenList.add(new Property("group", "@QuestionnaireResponse.group",
1233          "Nested group, containing nested question for this question. The order of groups within the question is relevant.",
1234          0, java.lang.Integer.MAX_VALUE, group));
1235    }
1236
1237    @Override
1238    public void setProperty(String name, Base value) throws FHIRException {
1239      if (name.equals("value[x]"))
1240        this.value = (Type) value; // Type
1241      else if (name.equals("group"))
1242        this.getGroup().add((GroupComponent) value);
1243      else
1244        super.setProperty(name, value);
1245    }
1246
1247    @Override
1248    public Base addChild(String name) throws FHIRException {
1249      if (name.equals("valueBoolean")) {
1250        this.value = new BooleanType();
1251        return this.value;
1252      } else if (name.equals("valueDecimal")) {
1253        this.value = new DecimalType();
1254        return this.value;
1255      } else if (name.equals("valueInteger")) {
1256        this.value = new IntegerType();
1257        return this.value;
1258      } else if (name.equals("valueDate")) {
1259        this.value = new DateType();
1260        return this.value;
1261      } else if (name.equals("valueDateTime")) {
1262        this.value = new DateTimeType();
1263        return this.value;
1264      } else if (name.equals("valueInstant")) {
1265        this.value = new InstantType();
1266        return this.value;
1267      } else if (name.equals("valueTime")) {
1268        this.value = new TimeType();
1269        return this.value;
1270      } else if (name.equals("valueString")) {
1271        this.value = new StringType();
1272        return this.value;
1273      } else if (name.equals("valueUri")) {
1274        this.value = new UriType();
1275        return this.value;
1276      } else if (name.equals("valueAttachment")) {
1277        this.value = new Attachment();
1278        return this.value;
1279      } else if (name.equals("valueCoding")) {
1280        this.value = new Coding();
1281        return this.value;
1282      } else if (name.equals("valueQuantity")) {
1283        this.value = new Quantity();
1284        return this.value;
1285      } else if (name.equals("valueReference")) {
1286        this.value = new Reference();
1287        return this.value;
1288      } else if (name.equals("group")) {
1289        return addGroup();
1290      } else
1291        return super.addChild(name);
1292    }
1293
1294    public QuestionAnswerComponent copy() {
1295      QuestionAnswerComponent dst = new QuestionAnswerComponent();
1296      copyValues(dst);
1297      dst.value = value == null ? null : value.copy();
1298      if (group != null) {
1299        dst.group = new ArrayList<GroupComponent>();
1300        for (GroupComponent i : group)
1301          dst.group.add(i.copy());
1302      }
1303      ;
1304      return dst;
1305    }
1306
1307    @Override
1308    public boolean equalsDeep(Base other) {
1309      if (!super.equalsDeep(other))
1310        return false;
1311      if (!(other instanceof QuestionAnswerComponent))
1312        return false;
1313      QuestionAnswerComponent o = (QuestionAnswerComponent) other;
1314      return compareDeep(value, o.value, true) && compareDeep(group, o.group, true);
1315    }
1316
1317    @Override
1318    public boolean equalsShallow(Base other) {
1319      if (!super.equalsShallow(other))
1320        return false;
1321      if (!(other instanceof QuestionAnswerComponent))
1322        return false;
1323      QuestionAnswerComponent o = (QuestionAnswerComponent) other;
1324      return true;
1325    }
1326
1327    public boolean isEmpty() {
1328      return super.isEmpty() && (value == null || value.isEmpty()) && (group == null || group.isEmpty());
1329    }
1330
1331    public String fhirType() {
1332      return "QuestionnaireResponse.group.question.answer";
1333
1334    }
1335
1336  }
1337
1338  /**
1339   * A business identifier assigned to a particular completed (or partially
1340   * completed) questionnaire.
1341   */
1342  @Child(name = "identifier", type = {
1343      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
1344  @Description(shortDefinition = "Unique id for this set of answers", formalDefinition = "A business identifier assigned to a particular completed (or partially completed) questionnaire.")
1345  protected Identifier identifier;
1346
1347  /**
1348   * Indicates the Questionnaire resource that defines the form for which answers
1349   * are being provided.
1350   */
1351  @Child(name = "questionnaire", type = {
1352      Questionnaire.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1353  @Description(shortDefinition = "Form being answered", formalDefinition = "Indicates the Questionnaire resource that defines the form for which answers are being provided.")
1354  protected Reference questionnaire;
1355
1356  /**
1357   * The actual object that is the target of the reference (Indicates the
1358   * Questionnaire resource that defines the form for which answers are being
1359   * provided.)
1360   */
1361  protected Questionnaire questionnaireTarget;
1362
1363  /**
1364   * The lifecycle status of the questionnaire response as a whole.
1365   */
1366  @Child(name = "status", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
1367  @Description(shortDefinition = "in-progress | completed | amended", formalDefinition = "The lifecycle status of the questionnaire response as a whole.")
1368  protected Enumeration<QuestionnaireResponseStatus> status;
1369
1370  /**
1371   * The subject of the questionnaire response. This could be a patient,
1372   * organization, practitioner, device, etc. This is who/what the answers apply
1373   * to, but is not necessarily the source of information.
1374   */
1375  @Child(name = "subject", type = {}, order = 3, min = 0, max = 1, modifier = false, summary = true)
1376  @Description(shortDefinition = "The subject of the questions", formalDefinition = "The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.")
1377  protected Reference subject;
1378
1379  /**
1380   * The actual object that is the target of the reference (The subject of the
1381   * questionnaire response. This could be a patient, organization, practitioner,
1382   * device, etc. This is who/what the answers apply to, but is not necessarily
1383   * the source of information.)
1384   */
1385  protected Resource subjectTarget;
1386
1387  /**
1388   * Person who received the answers to the questions in the QuestionnaireResponse
1389   * and recorded them in the system.
1390   */
1391  @Child(name = "author", type = { Device.class, Practitioner.class, Patient.class,
1392      RelatedPerson.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1393  @Description(shortDefinition = "Person who received and recorded the answers", formalDefinition = "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.")
1394  protected Reference author;
1395
1396  /**
1397   * The actual object that is the target of the reference (Person who received
1398   * the answers to the questions in the QuestionnaireResponse and recorded them
1399   * in the system.)
1400   */
1401  protected Resource authorTarget;
1402
1403  /**
1404   * The date and/or time that this version of the questionnaire response was
1405   * authored.
1406   */
1407  @Child(name = "authored", type = {
1408      DateTimeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1409  @Description(shortDefinition = "Date this version was authored", formalDefinition = "The date and/or time that this version of the questionnaire response was authored.")
1410  protected DateTimeType authored;
1411
1412  /**
1413   * The person who answered the questions about the subject.
1414   */
1415  @Child(name = "source", type = { Patient.class, Practitioner.class,
1416      RelatedPerson.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1417  @Description(shortDefinition = "The person who answered the questions", formalDefinition = "The person who answered the questions about the subject.")
1418  protected Reference source;
1419
1420  /**
1421   * The actual object that is the target of the reference (The person who
1422   * answered the questions about the subject.)
1423   */
1424  protected Resource sourceTarget;
1425
1426  /**
1427   * Encounter during which this set of questionnaire response were collected.
1428   * When there were multiple encounters, this is the one considered most relevant
1429   * to the context of the answers.
1430   */
1431  @Child(name = "encounter", type = { Encounter.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1432  @Description(shortDefinition = "Primary encounter during which the answers were collected", formalDefinition = "Encounter during which this set of questionnaire response were collected. When there were multiple encounters, this is the one considered most relevant to the context of the answers.")
1433  protected Reference encounter;
1434
1435  /**
1436   * The actual object that is the target of the reference (Encounter during which
1437   * this set of questionnaire response were collected. When there were multiple
1438   * encounters, this is the one considered most relevant to the context of the
1439   * answers.)
1440   */
1441  protected Encounter encounterTarget;
1442
1443  /**
1444   * A group of questions to a possibly similarly grouped set of questions in the
1445   * questionnaire response.
1446   */
1447  @Child(name = "group", type = {}, order = 8, min = 0, max = 1, modifier = false, summary = false)
1448  @Description(shortDefinition = "Grouped questions", formalDefinition = "A group of questions to a possibly similarly grouped set of questions in the questionnaire response.")
1449  protected GroupComponent group;
1450
1451  private static final long serialVersionUID = -1081988635L;
1452
1453  /*
1454   * Constructor
1455   */
1456  public QuestionnaireResponse() {
1457    super();
1458  }
1459
1460  /*
1461   * Constructor
1462   */
1463  public QuestionnaireResponse(Enumeration<QuestionnaireResponseStatus> status) {
1464    super();
1465    this.status = status;
1466  }
1467
1468  /**
1469   * @return {@link #identifier} (A business identifier assigned to a particular
1470   *         completed (or partially completed) questionnaire.)
1471   */
1472  public Identifier getIdentifier() {
1473    if (this.identifier == null)
1474      if (Configuration.errorOnAutoCreate())
1475        throw new Error("Attempt to auto-create QuestionnaireResponse.identifier");
1476      else if (Configuration.doAutoCreate())
1477        this.identifier = new Identifier(); // cc
1478    return this.identifier;
1479  }
1480
1481  public boolean hasIdentifier() {
1482    return this.identifier != null && !this.identifier.isEmpty();
1483  }
1484
1485  /**
1486   * @param value {@link #identifier} (A business identifier assigned to a
1487   *              particular completed (or partially completed) questionnaire.)
1488   */
1489  public QuestionnaireResponse setIdentifier(Identifier value) {
1490    this.identifier = value;
1491    return this;
1492  }
1493
1494  /**
1495   * @return {@link #questionnaire} (Indicates the Questionnaire resource that
1496   *         defines the form for which answers are being provided.)
1497   */
1498  public Reference getQuestionnaire() {
1499    if (this.questionnaire == null)
1500      if (Configuration.errorOnAutoCreate())
1501        throw new Error("Attempt to auto-create QuestionnaireResponse.questionnaire");
1502      else if (Configuration.doAutoCreate())
1503        this.questionnaire = new Reference(); // cc
1504    return this.questionnaire;
1505  }
1506
1507  public boolean hasQuestionnaire() {
1508    return this.questionnaire != null && !this.questionnaire.isEmpty();
1509  }
1510
1511  /**
1512   * @param value {@link #questionnaire} (Indicates the Questionnaire resource
1513   *              that defines the form for which answers are being provided.)
1514   */
1515  public QuestionnaireResponse setQuestionnaire(Reference value) {
1516    this.questionnaire = value;
1517    return this;
1518  }
1519
1520  /**
1521   * @return {@link #questionnaire} The actual object that is the target of the
1522   *         reference. The reference library doesn't populate this, but you can
1523   *         use it to hold the resource if you resolve it. (Indicates the
1524   *         Questionnaire resource that defines the form for which answers are
1525   *         being provided.)
1526   */
1527  public Questionnaire getQuestionnaireTarget() {
1528    if (this.questionnaireTarget == null)
1529      if (Configuration.errorOnAutoCreate())
1530        throw new Error("Attempt to auto-create QuestionnaireResponse.questionnaire");
1531      else if (Configuration.doAutoCreate())
1532        this.questionnaireTarget = new Questionnaire(); // aa
1533    return this.questionnaireTarget;
1534  }
1535
1536  /**
1537   * @param value {@link #questionnaire} The actual object that is the target of
1538   *              the reference. The reference library doesn't use these, but you
1539   *              can use it to hold the resource if you resolve it. (Indicates
1540   *              the Questionnaire resource that defines the form for which
1541   *              answers are being provided.)
1542   */
1543  public QuestionnaireResponse setQuestionnaireTarget(Questionnaire value) {
1544    this.questionnaireTarget = value;
1545    return this;
1546  }
1547
1548  /**
1549   * @return {@link #status} (The lifecycle status of the questionnaire response
1550   *         as a whole.). This is the underlying object with id, value and
1551   *         extensions. The accessor "getStatus" gives direct access to the value
1552   */
1553  public Enumeration<QuestionnaireResponseStatus> getStatusElement() {
1554    if (this.status == null)
1555      if (Configuration.errorOnAutoCreate())
1556        throw new Error("Attempt to auto-create QuestionnaireResponse.status");
1557      else if (Configuration.doAutoCreate())
1558        this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory()); // bb
1559    return this.status;
1560  }
1561
1562  public boolean hasStatusElement() {
1563    return this.status != null && !this.status.isEmpty();
1564  }
1565
1566  public boolean hasStatus() {
1567    return this.status != null && !this.status.isEmpty();
1568  }
1569
1570  /**
1571   * @param value {@link #status} (The lifecycle status of the questionnaire
1572   *              response as a whole.). This is the underlying object with id,
1573   *              value and extensions. The accessor "getStatus" gives direct
1574   *              access to the value
1575   */
1576  public QuestionnaireResponse setStatusElement(Enumeration<QuestionnaireResponseStatus> value) {
1577    this.status = value;
1578    return this;
1579  }
1580
1581  /**
1582   * @return The lifecycle status of the questionnaire response as a whole.
1583   */
1584  public QuestionnaireResponseStatus getStatus() {
1585    return this.status == null ? null : this.status.getValue();
1586  }
1587
1588  /**
1589   * @param value The lifecycle status of the questionnaire response as a whole.
1590   */
1591  public QuestionnaireResponse setStatus(QuestionnaireResponseStatus value) {
1592    if (this.status == null)
1593      this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory());
1594    this.status.setValue(value);
1595    return this;
1596  }
1597
1598  /**
1599   * @return {@link #subject} (The subject of the questionnaire response. This
1600   *         could be a patient, organization, practitioner, device, etc. This is
1601   *         who/what the answers apply to, but is not necessarily the source of
1602   *         information.)
1603   */
1604  public Reference getSubject() {
1605    if (this.subject == null)
1606      if (Configuration.errorOnAutoCreate())
1607        throw new Error("Attempt to auto-create QuestionnaireResponse.subject");
1608      else if (Configuration.doAutoCreate())
1609        this.subject = new Reference(); // cc
1610    return this.subject;
1611  }
1612
1613  public boolean hasSubject() {
1614    return this.subject != null && !this.subject.isEmpty();
1615  }
1616
1617  /**
1618   * @param value {@link #subject} (The subject of the questionnaire response.
1619   *              This could be a patient, organization, practitioner, device,
1620   *              etc. This is who/what the answers apply to, but is not
1621   *              necessarily the source of information.)
1622   */
1623  public QuestionnaireResponse setSubject(Reference value) {
1624    this.subject = value;
1625    return this;
1626  }
1627
1628  /**
1629   * @return {@link #subject} The actual object that is the target of the
1630   *         reference. The reference library doesn't populate this, but you can
1631   *         use it to hold the resource if you resolve it. (The subject of the
1632   *         questionnaire response. This could be a patient, organization,
1633   *         practitioner, device, etc. This is who/what the answers apply to, but
1634   *         is not necessarily the source of information.)
1635   */
1636  public Resource getSubjectTarget() {
1637    return this.subjectTarget;
1638  }
1639
1640  /**
1641   * @param value {@link #subject} The actual object that is the target of the
1642   *              reference. The reference library doesn't use these, but you can
1643   *              use it to hold the resource if you resolve it. (The subject of
1644   *              the questionnaire response. This could be a patient,
1645   *              organization, practitioner, device, etc. This is who/what the
1646   *              answers apply to, but is not necessarily the source of
1647   *              information.)
1648   */
1649  public QuestionnaireResponse setSubjectTarget(Resource value) {
1650    this.subjectTarget = value;
1651    return this;
1652  }
1653
1654  /**
1655   * @return {@link #author} (Person who received the answers to the questions in
1656   *         the QuestionnaireResponse and recorded them in the system.)
1657   */
1658  public Reference getAuthor() {
1659    if (this.author == null)
1660      if (Configuration.errorOnAutoCreate())
1661        throw new Error("Attempt to auto-create QuestionnaireResponse.author");
1662      else if (Configuration.doAutoCreate())
1663        this.author = new Reference(); // cc
1664    return this.author;
1665  }
1666
1667  public boolean hasAuthor() {
1668    return this.author != null && !this.author.isEmpty();
1669  }
1670
1671  /**
1672   * @param value {@link #author} (Person who received the answers to the
1673   *              questions in the QuestionnaireResponse and recorded them in the
1674   *              system.)
1675   */
1676  public QuestionnaireResponse setAuthor(Reference value) {
1677    this.author = value;
1678    return this;
1679  }
1680
1681  /**
1682   * @return {@link #author} The actual object that is the target of the
1683   *         reference. The reference library doesn't populate this, but you can
1684   *         use it to hold the resource if you resolve it. (Person who received
1685   *         the answers to the questions in the QuestionnaireResponse and
1686   *         recorded them in the system.)
1687   */
1688  public Resource getAuthorTarget() {
1689    return this.authorTarget;
1690  }
1691
1692  /**
1693   * @param value {@link #author} The actual object that is the target of the
1694   *              reference. The reference library doesn't use these, but you can
1695   *              use it to hold the resource if you resolve it. (Person who
1696   *              received the answers to the questions in the
1697   *              QuestionnaireResponse and recorded them in the system.)
1698   */
1699  public QuestionnaireResponse setAuthorTarget(Resource value) {
1700    this.authorTarget = value;
1701    return this;
1702  }
1703
1704  /**
1705   * @return {@link #authored} (The date and/or time that this version of the
1706   *         questionnaire response was authored.). This is the underlying object
1707   *         with id, value and extensions. The accessor "getAuthored" gives
1708   *         direct access to the value
1709   */
1710  public DateTimeType getAuthoredElement() {
1711    if (this.authored == null)
1712      if (Configuration.errorOnAutoCreate())
1713        throw new Error("Attempt to auto-create QuestionnaireResponse.authored");
1714      else if (Configuration.doAutoCreate())
1715        this.authored = new DateTimeType(); // bb
1716    return this.authored;
1717  }
1718
1719  public boolean hasAuthoredElement() {
1720    return this.authored != null && !this.authored.isEmpty();
1721  }
1722
1723  public boolean hasAuthored() {
1724    return this.authored != null && !this.authored.isEmpty();
1725  }
1726
1727  /**
1728   * @param value {@link #authored} (The date and/or time that this version of the
1729   *              questionnaire response was authored.). This is the underlying
1730   *              object with id, value and extensions. The accessor "getAuthored"
1731   *              gives direct access to the value
1732   */
1733  public QuestionnaireResponse setAuthoredElement(DateTimeType value) {
1734    this.authored = value;
1735    return this;
1736  }
1737
1738  /**
1739   * @return The date and/or time that this version of the questionnaire response
1740   *         was authored.
1741   */
1742  public Date getAuthored() {
1743    return this.authored == null ? null : this.authored.getValue();
1744  }
1745
1746  /**
1747   * @param value The date and/or time that this version of the questionnaire
1748   *              response was authored.
1749   */
1750  public QuestionnaireResponse setAuthored(Date value) {
1751    if (value == null)
1752      this.authored = null;
1753    else {
1754      if (this.authored == null)
1755        this.authored = new DateTimeType();
1756      this.authored.setValue(value);
1757    }
1758    return this;
1759  }
1760
1761  /**
1762   * @return {@link #source} (The person who answered the questions about the
1763   *         subject.)
1764   */
1765  public Reference getSource() {
1766    if (this.source == null)
1767      if (Configuration.errorOnAutoCreate())
1768        throw new Error("Attempt to auto-create QuestionnaireResponse.source");
1769      else if (Configuration.doAutoCreate())
1770        this.source = new Reference(); // cc
1771    return this.source;
1772  }
1773
1774  public boolean hasSource() {
1775    return this.source != null && !this.source.isEmpty();
1776  }
1777
1778  /**
1779   * @param value {@link #source} (The person who answered the questions about the
1780   *              subject.)
1781   */
1782  public QuestionnaireResponse setSource(Reference value) {
1783    this.source = value;
1784    return this;
1785  }
1786
1787  /**
1788   * @return {@link #source} The actual object that is the target of the
1789   *         reference. The reference library doesn't populate this, but you can
1790   *         use it to hold the resource if you resolve it. (The person who
1791   *         answered the questions about the subject.)
1792   */
1793  public Resource getSourceTarget() {
1794    return this.sourceTarget;
1795  }
1796
1797  /**
1798   * @param value {@link #source} The actual object that is the target of the
1799   *              reference. The reference library doesn't use these, but you can
1800   *              use it to hold the resource if you resolve it. (The person who
1801   *              answered the questions about the subject.)
1802   */
1803  public QuestionnaireResponse setSourceTarget(Resource value) {
1804    this.sourceTarget = value;
1805    return this;
1806  }
1807
1808  /**
1809   * @return {@link #encounter} (Encounter during which this set of questionnaire
1810   *         response were collected. When there were multiple encounters, this is
1811   *         the one considered most relevant to the context of the answers.)
1812   */
1813  public Reference getEncounter() {
1814    if (this.encounter == null)
1815      if (Configuration.errorOnAutoCreate())
1816        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1817      else if (Configuration.doAutoCreate())
1818        this.encounter = new Reference(); // cc
1819    return this.encounter;
1820  }
1821
1822  public boolean hasEncounter() {
1823    return this.encounter != null && !this.encounter.isEmpty();
1824  }
1825
1826  /**
1827   * @param value {@link #encounter} (Encounter during which this set of
1828   *              questionnaire response were collected. When there were multiple
1829   *              encounters, this is the one considered most relevant to the
1830   *              context of the answers.)
1831   */
1832  public QuestionnaireResponse setEncounter(Reference value) {
1833    this.encounter = value;
1834    return this;
1835  }
1836
1837  /**
1838   * @return {@link #encounter} The actual object that is the target of the
1839   *         reference. The reference library doesn't populate this, but you can
1840   *         use it to hold the resource if you resolve it. (Encounter during
1841   *         which this set of questionnaire response were collected. When there
1842   *         were multiple encounters, this is the one considered most relevant to
1843   *         the context of the answers.)
1844   */
1845  public Encounter getEncounterTarget() {
1846    if (this.encounterTarget == null)
1847      if (Configuration.errorOnAutoCreate())
1848        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1849      else if (Configuration.doAutoCreate())
1850        this.encounterTarget = new Encounter(); // aa
1851    return this.encounterTarget;
1852  }
1853
1854  /**
1855   * @param value {@link #encounter} The actual object that is the target of the
1856   *              reference. The reference library doesn't use these, but you can
1857   *              use it to hold the resource if you resolve it. (Encounter during
1858   *              which this set of questionnaire response were collected. When
1859   *              there were multiple encounters, this is the one considered most
1860   *              relevant to the context of the answers.)
1861   */
1862  public QuestionnaireResponse setEncounterTarget(Encounter value) {
1863    this.encounterTarget = value;
1864    return this;
1865  }
1866
1867  /**
1868   * @return {@link #group} (A group of questions to a possibly similarly grouped
1869   *         set of questions in the questionnaire response.)
1870   */
1871  public GroupComponent getGroup() {
1872    if (this.group == null)
1873      if (Configuration.errorOnAutoCreate())
1874        throw new Error("Attempt to auto-create QuestionnaireResponse.group");
1875      else if (Configuration.doAutoCreate())
1876        this.group = new GroupComponent(); // cc
1877    return this.group;
1878  }
1879
1880  public boolean hasGroup() {
1881    return this.group != null && !this.group.isEmpty();
1882  }
1883
1884  /**
1885   * @param value {@link #group} (A group of questions to a possibly similarly
1886   *              grouped set of questions in the questionnaire response.)
1887   */
1888  public QuestionnaireResponse setGroup(GroupComponent value) {
1889    this.group = value;
1890    return this;
1891  }
1892
1893  protected void listChildren(List<Property> childrenList) {
1894    super.listChildren(childrenList);
1895    childrenList.add(new Property("identifier", "Identifier",
1896        "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0,
1897        java.lang.Integer.MAX_VALUE, identifier));
1898    childrenList.add(new Property("questionnaire", "Reference(Questionnaire)",
1899        "Indicates the Questionnaire resource that defines the form for which answers are being provided.", 0,
1900        java.lang.Integer.MAX_VALUE, questionnaire));
1901    childrenList.add(new Property("status", "code", "The lifecycle status of the questionnaire response as a whole.", 0,
1902        java.lang.Integer.MAX_VALUE, status));
1903    childrenList.add(new Property("subject", "Reference(Any)",
1904        "The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.",
1905        0, java.lang.Integer.MAX_VALUE, subject));
1906    childrenList.add(new Property("author", "Reference(Device|Practitioner|Patient|RelatedPerson)",
1907        "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
1908        0, java.lang.Integer.MAX_VALUE, author));
1909    childrenList.add(new Property("authored", "dateTime",
1910        "The date and/or time that this version of the questionnaire response was authored.", 0,
1911        java.lang.Integer.MAX_VALUE, authored));
1912    childrenList.add(new Property("source", "Reference(Patient|Practitioner|RelatedPerson)",
1913        "The person who answered the questions about the subject.", 0, java.lang.Integer.MAX_VALUE, source));
1914    childrenList.add(new Property("encounter", "Reference(Encounter)",
1915        "Encounter during which this set of questionnaire response were collected. When there were multiple encounters, this is the one considered most relevant to the context of the answers.",
1916        0, java.lang.Integer.MAX_VALUE, encounter));
1917    childrenList.add(new Property("group", "",
1918        "A group of questions to a possibly similarly grouped set of questions in the questionnaire response.", 0,
1919        java.lang.Integer.MAX_VALUE, group));
1920  }
1921
1922  @Override
1923  public void setProperty(String name, Base value) throws FHIRException {
1924    if (name.equals("identifier"))
1925      this.identifier = castToIdentifier(value); // Identifier
1926    else if (name.equals("questionnaire"))
1927      this.questionnaire = castToReference(value); // Reference
1928    else if (name.equals("status"))
1929      this.status = new QuestionnaireResponseStatusEnumFactory().fromType(value); // Enumeration<QuestionnaireResponseStatus>
1930    else if (name.equals("subject"))
1931      this.subject = castToReference(value); // Reference
1932    else if (name.equals("author"))
1933      this.author = castToReference(value); // Reference
1934    else if (name.equals("authored"))
1935      this.authored = castToDateTime(value); // DateTimeType
1936    else if (name.equals("source"))
1937      this.source = castToReference(value); // Reference
1938    else if (name.equals("encounter"))
1939      this.encounter = castToReference(value); // Reference
1940    else if (name.equals("group"))
1941      this.group = (GroupComponent) value; // GroupComponent
1942    else
1943      super.setProperty(name, value);
1944  }
1945
1946  @Override
1947  public Base addChild(String name) throws FHIRException {
1948    if (name.equals("identifier")) {
1949      this.identifier = new Identifier();
1950      return this.identifier;
1951    } else if (name.equals("questionnaire")) {
1952      this.questionnaire = new Reference();
1953      return this.questionnaire;
1954    } else if (name.equals("status")) {
1955      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.status");
1956    } else if (name.equals("subject")) {
1957      this.subject = new Reference();
1958      return this.subject;
1959    } else if (name.equals("author")) {
1960      this.author = new Reference();
1961      return this.author;
1962    } else if (name.equals("authored")) {
1963      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.authored");
1964    } else if (name.equals("source")) {
1965      this.source = new Reference();
1966      return this.source;
1967    } else if (name.equals("encounter")) {
1968      this.encounter = new Reference();
1969      return this.encounter;
1970    } else if (name.equals("group")) {
1971      this.group = new GroupComponent();
1972      return this.group;
1973    } else
1974      return super.addChild(name);
1975  }
1976
1977  public String fhirType() {
1978    return "QuestionnaireResponse";
1979
1980  }
1981
1982  public QuestionnaireResponse copy() {
1983    QuestionnaireResponse dst = new QuestionnaireResponse();
1984    copyValues(dst);
1985    dst.identifier = identifier == null ? null : identifier.copy();
1986    dst.questionnaire = questionnaire == null ? null : questionnaire.copy();
1987    dst.status = status == null ? null : status.copy();
1988    dst.subject = subject == null ? null : subject.copy();
1989    dst.author = author == null ? null : author.copy();
1990    dst.authored = authored == null ? null : authored.copy();
1991    dst.source = source == null ? null : source.copy();
1992    dst.encounter = encounter == null ? null : encounter.copy();
1993    dst.group = group == null ? null : group.copy();
1994    return dst;
1995  }
1996
1997  protected QuestionnaireResponse typedCopy() {
1998    return copy();
1999  }
2000
2001  @Override
2002  public boolean equalsDeep(Base other) {
2003    if (!super.equalsDeep(other))
2004      return false;
2005    if (!(other instanceof QuestionnaireResponse))
2006      return false;
2007    QuestionnaireResponse o = (QuestionnaireResponse) other;
2008    return compareDeep(identifier, o.identifier, true) && compareDeep(questionnaire, o.questionnaire, true)
2009        && compareDeep(status, o.status, true) && compareDeep(subject, o.subject, true)
2010        && compareDeep(author, o.author, true) && compareDeep(authored, o.authored, true)
2011        && compareDeep(source, o.source, true) && compareDeep(encounter, o.encounter, true)
2012        && compareDeep(group, o.group, true);
2013  }
2014
2015  @Override
2016  public boolean equalsShallow(Base other) {
2017    if (!super.equalsShallow(other))
2018      return false;
2019    if (!(other instanceof QuestionnaireResponse))
2020      return false;
2021    QuestionnaireResponse o = (QuestionnaireResponse) other;
2022    return compareValues(status, o.status, true) && compareValues(authored, o.authored, true);
2023  }
2024
2025  public boolean isEmpty() {
2026    return super.isEmpty() && (identifier == null || identifier.isEmpty())
2027        && (questionnaire == null || questionnaire.isEmpty()) && (status == null || status.isEmpty())
2028        && (subject == null || subject.isEmpty()) && (author == null || author.isEmpty())
2029        && (authored == null || authored.isEmpty()) && (source == null || source.isEmpty())
2030        && (encounter == null || encounter.isEmpty()) && (group == null || group.isEmpty());
2031  }
2032
2033  @Override
2034  public ResourceType getResourceType() {
2035    return ResourceType.QuestionnaireResponse;
2036  }
2037
2038  @SearchParamDefinition(name = "authored", path = "QuestionnaireResponse.authored", description = "When the questionnaire was authored", type = "date")
2039  public static final String SP_AUTHORED = "authored";
2040  @SearchParamDefinition(name = "questionnaire", path = "QuestionnaireResponse.questionnaire", description = "The questionnaire the answers are provided for", type = "reference")
2041  public static final String SP_QUESTIONNAIRE = "questionnaire";
2042  @SearchParamDefinition(name = "subject", path = "QuestionnaireResponse.subject", description = "The subject of the questionnaire", type = "reference")
2043  public static final String SP_SUBJECT = "subject";
2044  @SearchParamDefinition(name = "author", path = "QuestionnaireResponse.author", description = "The author of the questionnaire", type = "reference")
2045  public static final String SP_AUTHOR = "author";
2046  @SearchParamDefinition(name = "patient", path = "QuestionnaireResponse.subject", description = "The patient that is the subject of the questionnaire", type = "reference")
2047  public static final String SP_PATIENT = "patient";
2048  @SearchParamDefinition(name = "encounter", path = "QuestionnaireResponse.encounter", description = "Encounter during which questionnaire was authored", type = "reference")
2049  public static final String SP_ENCOUNTER = "encounter";
2050  @SearchParamDefinition(name = "source", path = "QuestionnaireResponse.source", description = "The person who answered the questions", type = "reference")
2051  public static final String SP_SOURCE = "source";
2052  @SearchParamDefinition(name = "status", path = "QuestionnaireResponse.status", description = "The status of the questionnaire response", type = "token")
2053  public static final String SP_STATUS = "status";
2054
2055}