001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * A structured set of questions and their answers. The questions are ordered
049 * and grouped into coherent subsets, corresponding to the structure of the
050 * grouping of the questionnaire being responded to.
051 */
052@ResourceDef(name = "QuestionnaireResponse", profile = "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse")
053public class QuestionnaireResponse extends DomainResource {
054
055  public enum QuestionnaireResponseStatus {
056    /**
057     * This QuestionnaireResponse has been partially filled out with answers but
058     * changes or additions are still expected to be made to it.
059     */
060    INPROGRESS,
061    /**
062     * This QuestionnaireResponse has been filled out with answers and the current
063     * content is regarded as definitive.
064     */
065    COMPLETED,
066    /**
067     * This QuestionnaireResponse has been filled out with answers, then marked as
068     * complete, yet changes or additions have been made to it afterwards.
069     */
070    AMENDED,
071    /**
072     * This QuestionnaireResponse was entered in error and voided.
073     */
074    ENTEREDINERROR,
075    /**
076     * This QuestionnaireResponse has been partially filled out with answers but has
077     * been abandoned. It is unknown whether changes or additions are expected to be
078     * made to it.
079     */
080    STOPPED,
081    /**
082     * added to help the parsers with the generic types
083     */
084    NULL;
085
086    public static QuestionnaireResponseStatus fromCode(String codeString) throws FHIRException {
087      if (codeString == null || "".equals(codeString))
088        return null;
089      if ("in-progress".equals(codeString))
090        return INPROGRESS;
091      if ("completed".equals(codeString))
092        return COMPLETED;
093      if ("amended".equals(codeString))
094        return AMENDED;
095      if ("entered-in-error".equals(codeString))
096        return ENTEREDINERROR;
097      if ("stopped".equals(codeString))
098        return STOPPED;
099      if (Configuration.isAcceptInvalidEnums())
100        return null;
101      else
102        throw new FHIRException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
103    }
104
105    public String toCode() {
106      switch (this) {
107      case INPROGRESS:
108        return "in-progress";
109      case COMPLETED:
110        return "completed";
111      case AMENDED:
112        return "amended";
113      case ENTEREDINERROR:
114        return "entered-in-error";
115      case STOPPED:
116        return "stopped";
117      case NULL:
118        return null;
119      default:
120        return "?";
121      }
122    }
123
124    public String getSystem() {
125      switch (this) {
126      case INPROGRESS:
127        return "http://hl7.org/fhir/questionnaire-answers-status";
128      case COMPLETED:
129        return "http://hl7.org/fhir/questionnaire-answers-status";
130      case AMENDED:
131        return "http://hl7.org/fhir/questionnaire-answers-status";
132      case ENTEREDINERROR:
133        return "http://hl7.org/fhir/questionnaire-answers-status";
134      case STOPPED:
135        return "http://hl7.org/fhir/questionnaire-answers-status";
136      case NULL:
137        return null;
138      default:
139        return "?";
140      }
141    }
142
143    public String getDefinition() {
144      switch (this) {
145      case INPROGRESS:
146        return "This QuestionnaireResponse has been partially filled out with answers but changes or additions are still expected to be made to it.";
147      case COMPLETED:
148        return "This QuestionnaireResponse has been filled out with answers and the current content is regarded as definitive.";
149      case AMENDED:
150        return "This QuestionnaireResponse has been filled out with answers, then marked as complete, yet changes or additions have been made to it afterwards.";
151      case ENTEREDINERROR:
152        return "This QuestionnaireResponse was entered in error and voided.";
153      case STOPPED:
154        return "This QuestionnaireResponse has been partially filled out with answers but has been abandoned. It is unknown whether changes or additions are expected to be made to it.";
155      case NULL:
156        return null;
157      default:
158        return "?";
159      }
160    }
161
162    public String getDisplay() {
163      switch (this) {
164      case INPROGRESS:
165        return "In Progress";
166      case COMPLETED:
167        return "Completed";
168      case AMENDED:
169        return "Amended";
170      case ENTEREDINERROR:
171        return "Entered in Error";
172      case STOPPED:
173        return "Stopped";
174      case NULL:
175        return null;
176      default:
177        return "?";
178      }
179    }
180  }
181
182  public static class QuestionnaireResponseStatusEnumFactory implements EnumFactory<QuestionnaireResponseStatus> {
183    public QuestionnaireResponseStatus fromCode(String codeString) throws IllegalArgumentException {
184      if (codeString == null || "".equals(codeString))
185        if (codeString == null || "".equals(codeString))
186          return null;
187      if ("in-progress".equals(codeString))
188        return QuestionnaireResponseStatus.INPROGRESS;
189      if ("completed".equals(codeString))
190        return QuestionnaireResponseStatus.COMPLETED;
191      if ("amended".equals(codeString))
192        return QuestionnaireResponseStatus.AMENDED;
193      if ("entered-in-error".equals(codeString))
194        return QuestionnaireResponseStatus.ENTEREDINERROR;
195      if ("stopped".equals(codeString))
196        return QuestionnaireResponseStatus.STOPPED;
197      throw new IllegalArgumentException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
198    }
199
200    public Enumeration<QuestionnaireResponseStatus> fromType(PrimitiveType<?> code) throws FHIRException {
201      if (code == null)
202        return null;
203      if (code.isEmpty())
204        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.NULL, code);
205      String codeString = code.asStringValue();
206      if (codeString == null || "".equals(codeString))
207        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.NULL, code);
208      if ("in-progress".equals(codeString))
209        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.INPROGRESS, code);
210      if ("completed".equals(codeString))
211        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.COMPLETED, code);
212      if ("amended".equals(codeString))
213        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.AMENDED, code);
214      if ("entered-in-error".equals(codeString))
215        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.ENTEREDINERROR, code);
216      if ("stopped".equals(codeString))
217        return new Enumeration<QuestionnaireResponseStatus>(this, QuestionnaireResponseStatus.STOPPED, code);
218      throw new FHIRException("Unknown QuestionnaireResponseStatus code '" + codeString + "'");
219    }
220
221    public String toCode(QuestionnaireResponseStatus code) {
222      if (code == QuestionnaireResponseStatus.INPROGRESS)
223        return "in-progress";
224      if (code == QuestionnaireResponseStatus.COMPLETED)
225        return "completed";
226      if (code == QuestionnaireResponseStatus.AMENDED)
227        return "amended";
228      if (code == QuestionnaireResponseStatus.ENTEREDINERROR)
229        return "entered-in-error";
230      if (code == QuestionnaireResponseStatus.STOPPED)
231        return "stopped";
232      return "?";
233    }
234
235    public String toSystem(QuestionnaireResponseStatus code) {
236      return code.getSystem();
237    }
238  }
239
240  @Block()
241  public static class QuestionnaireResponseItemComponent extends BackboneElement implements IBaseBackboneElement {
242    /**
243     * The item from the Questionnaire that corresponds to this item in the
244     * QuestionnaireResponse resource.
245     */
246    @Child(name = "linkId", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
247    @Description(shortDefinition = "Pointer to specific item from Questionnaire", formalDefinition = "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.")
248    protected StringType linkId;
249
250    /**
251     * A reference to an [[[ElementDefinition]]] that provides the details for the
252     * item.
253     */
254    @Child(name = "definition", type = {
255        UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
256    @Description(shortDefinition = "ElementDefinition - details for the item", formalDefinition = "A reference to an [[[ElementDefinition]]] that provides the details for the item.")
257    protected UriType definition;
258
259    /**
260     * Text that is displayed above the contents of the group or as the text of the
261     * question being answered.
262     */
263    @Child(name = "text", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
264    @Description(shortDefinition = "Name for group or question text", formalDefinition = "Text that is displayed above the contents of the group or as the text of the question being answered.")
265    protected StringType text;
266
267    /**
268     * The respondent's answer(s) to the question.
269     */
270    @Child(name = "answer", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
271    @Description(shortDefinition = "The response(s) to the question", formalDefinition = "The respondent's answer(s) to the question.")
272    protected List<QuestionnaireResponseItemAnswerComponent> answer;
273
274    /**
275     * Questions or sub-groups nested beneath a question or group.
276     */
277    @Child(name = "item", type = {
278        QuestionnaireResponseItemComponent.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
279    @Description(shortDefinition = "Nested questionnaire response items", formalDefinition = "Questions or sub-groups nested beneath a question or group.")
280    protected List<QuestionnaireResponseItemComponent> item;
281
282    private static final long serialVersionUID = -1395483402L;
283
284    /**
285     * Constructor
286     */
287    public QuestionnaireResponseItemComponent() {
288      super();
289    }
290
291    /**
292     * Constructor
293     */
294    public QuestionnaireResponseItemComponent(StringType linkId) {
295      super();
296      this.linkId = linkId;
297    }
298
299    /**
300     * @return {@link #linkId} (The item from the Questionnaire that corresponds to
301     *         this item in the QuestionnaireResponse resource.). This is the
302     *         underlying object with id, value and extensions. The accessor
303     *         "getLinkId" gives direct access to the value
304     */
305    public StringType getLinkIdElement() {
306      if (this.linkId == null)
307        if (Configuration.errorOnAutoCreate())
308          throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.linkId");
309        else if (Configuration.doAutoCreate())
310          this.linkId = new StringType(); // bb
311      return this.linkId;
312    }
313
314    public boolean hasLinkIdElement() {
315      return this.linkId != null && !this.linkId.isEmpty();
316    }
317
318    public boolean hasLinkId() {
319      return this.linkId != null && !this.linkId.isEmpty();
320    }
321
322    /**
323     * @param value {@link #linkId} (The item from the Questionnaire that
324     *              corresponds to this item in the QuestionnaireResponse
325     *              resource.). This is the underlying object with id, value and
326     *              extensions. The accessor "getLinkId" gives direct access to the
327     *              value
328     */
329    public QuestionnaireResponseItemComponent setLinkIdElement(StringType value) {
330      this.linkId = value;
331      return this;
332    }
333
334    /**
335     * @return The item from the Questionnaire that corresponds to this item in the
336     *         QuestionnaireResponse resource.
337     */
338    public String getLinkId() {
339      return this.linkId == null ? null : this.linkId.getValue();
340    }
341
342    /**
343     * @param value The item from the Questionnaire that corresponds to this item in
344     *              the QuestionnaireResponse resource.
345     */
346    public QuestionnaireResponseItemComponent setLinkId(String value) {
347      if (this.linkId == null)
348        this.linkId = new StringType();
349      this.linkId.setValue(value);
350      return this;
351    }
352
353    /**
354     * @return {@link #definition} (A reference to an [[[ElementDefinition]]] that
355     *         provides the details for the item.). This is the underlying object
356     *         with id, value and extensions. The accessor "getDefinition" gives
357     *         direct access to the value
358     */
359    public UriType getDefinitionElement() {
360      if (this.definition == null)
361        if (Configuration.errorOnAutoCreate())
362          throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.definition");
363        else if (Configuration.doAutoCreate())
364          this.definition = new UriType(); // bb
365      return this.definition;
366    }
367
368    public boolean hasDefinitionElement() {
369      return this.definition != null && !this.definition.isEmpty();
370    }
371
372    public boolean hasDefinition() {
373      return this.definition != null && !this.definition.isEmpty();
374    }
375
376    /**
377     * @param value {@link #definition} (A reference to an [[[ElementDefinition]]]
378     *              that provides the details for the item.). This is the underlying
379     *              object with id, value and extensions. The accessor
380     *              "getDefinition" gives direct access to the value
381     */
382    public QuestionnaireResponseItemComponent setDefinitionElement(UriType value) {
383      this.definition = value;
384      return this;
385    }
386
387    /**
388     * @return A reference to an [[[ElementDefinition]]] that provides the details
389     *         for the item.
390     */
391    public String getDefinition() {
392      return this.definition == null ? null : this.definition.getValue();
393    }
394
395    /**
396     * @param value A reference to an [[[ElementDefinition]]] that provides the
397     *              details for the item.
398     */
399    public QuestionnaireResponseItemComponent setDefinition(String value) {
400      if (Utilities.noString(value))
401        this.definition = null;
402      else {
403        if (this.definition == null)
404          this.definition = new UriType();
405        this.definition.setValue(value);
406      }
407      return this;
408    }
409
410    /**
411     * @return {@link #text} (Text that is displayed above the contents of the group
412     *         or as the text of the question being answered.). This is the
413     *         underlying object with id, value and extensions. The accessor
414     *         "getText" gives direct access to the value
415     */
416    public StringType getTextElement() {
417      if (this.text == null)
418        if (Configuration.errorOnAutoCreate())
419          throw new Error("Attempt to auto-create QuestionnaireResponseItemComponent.text");
420        else if (Configuration.doAutoCreate())
421          this.text = new StringType(); // bb
422      return this.text;
423    }
424
425    public boolean hasTextElement() {
426      return this.text != null && !this.text.isEmpty();
427    }
428
429    public boolean hasText() {
430      return this.text != null && !this.text.isEmpty();
431    }
432
433    /**
434     * @param value {@link #text} (Text that is displayed above the contents of the
435     *              group or as the text of the question being answered.). This is
436     *              the underlying object with id, value and extensions. The
437     *              accessor "getText" gives direct access to the value
438     */
439    public QuestionnaireResponseItemComponent setTextElement(StringType value) {
440      this.text = value;
441      return this;
442    }
443
444    /**
445     * @return Text that is displayed above the contents of the group or as the text
446     *         of the question being answered.
447     */
448    public String getText() {
449      return this.text == null ? null : this.text.getValue();
450    }
451
452    /**
453     * @param value Text that is displayed above the contents of the group or as the
454     *              text of the question being answered.
455     */
456    public QuestionnaireResponseItemComponent setText(String value) {
457      if (Utilities.noString(value))
458        this.text = null;
459      else {
460        if (this.text == null)
461          this.text = new StringType();
462        this.text.setValue(value);
463      }
464      return this;
465    }
466
467    /**
468     * @return {@link #answer} (The respondent's answer(s) to the question.)
469     */
470    public List<QuestionnaireResponseItemAnswerComponent> getAnswer() {
471      if (this.answer == null)
472        this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
473      return this.answer;
474    }
475
476    /**
477     * @return Returns a reference to <code>this</code> for easy method chaining
478     */
479    public QuestionnaireResponseItemComponent setAnswer(List<QuestionnaireResponseItemAnswerComponent> theAnswer) {
480      this.answer = theAnswer;
481      return this;
482    }
483
484    public boolean hasAnswer() {
485      if (this.answer == null)
486        return false;
487      for (QuestionnaireResponseItemAnswerComponent item : this.answer)
488        if (!item.isEmpty())
489          return true;
490      return false;
491    }
492
493    public QuestionnaireResponseItemAnswerComponent addAnswer() { // 3
494      QuestionnaireResponseItemAnswerComponent t = new QuestionnaireResponseItemAnswerComponent();
495      if (this.answer == null)
496        this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
497      this.answer.add(t);
498      return t;
499    }
500
501    public QuestionnaireResponseItemComponent addAnswer(QuestionnaireResponseItemAnswerComponent t) { // 3
502      if (t == null)
503        return this;
504      if (this.answer == null)
505        this.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
506      this.answer.add(t);
507      return this;
508    }
509
510    /**
511     * @return The first repetition of repeating field {@link #answer}, creating it
512     *         if it does not already exist
513     */
514    public QuestionnaireResponseItemAnswerComponent getAnswerFirstRep() {
515      if (getAnswer().isEmpty()) {
516        addAnswer();
517      }
518      return getAnswer().get(0);
519    }
520
521    /**
522     * @return {@link #item} (Questions or sub-groups nested beneath a question or
523     *         group.)
524     */
525    public List<QuestionnaireResponseItemComponent> getItem() {
526      if (this.item == null)
527        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
528      return this.item;
529    }
530
531    /**
532     * @return Returns a reference to <code>this</code> for easy method chaining
533     */
534    public QuestionnaireResponseItemComponent setItem(List<QuestionnaireResponseItemComponent> theItem) {
535      this.item = theItem;
536      return this;
537    }
538
539    public boolean hasItem() {
540      if (this.item == null)
541        return false;
542      for (QuestionnaireResponseItemComponent item : this.item)
543        if (!item.isEmpty())
544          return true;
545      return false;
546    }
547
548    public QuestionnaireResponseItemComponent addItem() { // 3
549      QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
550      if (this.item == null)
551        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
552      this.item.add(t);
553      return t;
554    }
555
556    public QuestionnaireResponseItemComponent addItem(QuestionnaireResponseItemComponent t) { // 3
557      if (t == null)
558        return this;
559      if (this.item == null)
560        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
561      this.item.add(t);
562      return this;
563    }
564
565    /**
566     * @return The first repetition of repeating field {@link #item}, creating it if
567     *         it does not already exist
568     */
569    public QuestionnaireResponseItemComponent getItemFirstRep() {
570      if (getItem().isEmpty()) {
571        addItem();
572      }
573      return getItem().get(0);
574    }
575
576    protected void listChildren(List<Property> children) {
577      super.listChildren(children);
578      children.add(new Property("linkId", "string",
579          "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.", 0, 1,
580          linkId));
581      children.add(new Property("definition", "uri",
582          "A reference to an [[[ElementDefinition]]] that provides the details for the item.", 0, 1, definition));
583      children.add(new Property("text", "string",
584          "Text that is displayed above the contents of the group or as the text of the question being answered.", 0, 1,
585          text));
586      children.add(new Property("answer", "", "The respondent's answer(s) to the question.", 0,
587          java.lang.Integer.MAX_VALUE, answer));
588      children.add(new Property("item", "@QuestionnaireResponse.item",
589          "Questions or sub-groups nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item));
590    }
591
592    @Override
593    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
594      switch (_hash) {
595      case -1102667083:
596        /* linkId */ return new Property("linkId", "string",
597            "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.", 0,
598            1, linkId);
599      case -1014418093:
600        /* definition */ return new Property("definition", "uri",
601            "A reference to an [[[ElementDefinition]]] that provides the details for the item.", 0, 1, definition);
602      case 3556653:
603        /* text */ return new Property("text", "string",
604            "Text that is displayed above the contents of the group or as the text of the question being answered.", 0,
605            1, text);
606      case -1412808770:
607        /* answer */ return new Property("answer", "", "The respondent's answer(s) to the question.", 0,
608            java.lang.Integer.MAX_VALUE, answer);
609      case 3242771:
610        /* item */ return new Property("item", "@QuestionnaireResponse.item",
611            "Questions or sub-groups nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item);
612      default:
613        return super.getNamedProperty(_hash, _name, _checkValid);
614      }
615
616    }
617
618    @Override
619    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
620      switch (hash) {
621      case -1102667083:
622        /* linkId */ return this.linkId == null ? new Base[0] : new Base[] { this.linkId }; // StringType
623      case -1014418093:
624        /* definition */ return this.definition == null ? new Base[0] : new Base[] { this.definition }; // UriType
625      case 3556653:
626        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
627      case -1412808770:
628        /* answer */ return this.answer == null ? new Base[0] : this.answer.toArray(new Base[this.answer.size()]); // QuestionnaireResponseItemAnswerComponent
629      case 3242771:
630        /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
631      default:
632        return super.getProperty(hash, name, checkValid);
633      }
634
635    }
636
637    @Override
638    public Base setProperty(int hash, String name, Base value) throws FHIRException {
639      switch (hash) {
640      case -1102667083: // linkId
641        this.linkId = castToString(value); // StringType
642        return value;
643      case -1014418093: // definition
644        this.definition = castToUri(value); // UriType
645        return value;
646      case 3556653: // text
647        this.text = castToString(value); // StringType
648        return value;
649      case -1412808770: // answer
650        this.getAnswer().add((QuestionnaireResponseItemAnswerComponent) value); // QuestionnaireResponseItemAnswerComponent
651        return value;
652      case 3242771: // item
653        this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
654        return value;
655      default:
656        return super.setProperty(hash, name, value);
657      }
658
659    }
660
661    @Override
662    public Base setProperty(String name, Base value) throws FHIRException {
663      if (name.equals("linkId")) {
664        this.linkId = castToString(value); // StringType
665      } else if (name.equals("definition")) {
666        this.definition = castToUri(value); // UriType
667      } else if (name.equals("text")) {
668        this.text = castToString(value); // StringType
669      } else if (name.equals("answer")) {
670        this.getAnswer().add((QuestionnaireResponseItemAnswerComponent) value);
671      } else if (name.equals("item")) {
672        this.getItem().add((QuestionnaireResponseItemComponent) value);
673      } else
674        return super.setProperty(name, value);
675      return value;
676    }
677
678    @Override
679    public Base makeProperty(int hash, String name) throws FHIRException {
680      switch (hash) {
681      case -1102667083:
682        return getLinkIdElement();
683      case -1014418093:
684        return getDefinitionElement();
685      case 3556653:
686        return getTextElement();
687      case -1412808770:
688        return addAnswer();
689      case 3242771:
690        return addItem();
691      default:
692        return super.makeProperty(hash, name);
693      }
694
695    }
696
697    @Override
698    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
699      switch (hash) {
700      case -1102667083:
701        /* linkId */ return new String[] { "string" };
702      case -1014418093:
703        /* definition */ return new String[] { "uri" };
704      case 3556653:
705        /* text */ return new String[] { "string" };
706      case -1412808770:
707        /* answer */ return new String[] {};
708      case 3242771:
709        /* item */ return new String[] { "@QuestionnaireResponse.item" };
710      default:
711        return super.getTypesForProperty(hash, name);
712      }
713
714    }
715
716    @Override
717    public Base addChild(String name) throws FHIRException {
718      if (name.equals("linkId")) {
719        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.linkId");
720      } else if (name.equals("definition")) {
721        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.definition");
722      } else if (name.equals("text")) {
723        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.text");
724      } else if (name.equals("answer")) {
725        return addAnswer();
726      } else if (name.equals("item")) {
727        return addItem();
728      } else
729        return super.addChild(name);
730    }
731
732    public QuestionnaireResponseItemComponent copy() {
733      QuestionnaireResponseItemComponent dst = new QuestionnaireResponseItemComponent();
734      copyValues(dst);
735      return dst;
736    }
737
738    public void copyValues(QuestionnaireResponseItemComponent dst) {
739      super.copyValues(dst);
740      dst.linkId = linkId == null ? null : linkId.copy();
741      dst.definition = definition == null ? null : definition.copy();
742      dst.text = text == null ? null : text.copy();
743      if (answer != null) {
744        dst.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
745        for (QuestionnaireResponseItemAnswerComponent i : answer)
746          dst.answer.add(i.copy());
747      }
748      ;
749      if (item != null) {
750        dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
751        for (QuestionnaireResponseItemComponent i : item)
752          dst.item.add(i.copy());
753      }
754      ;
755    }
756
757    @Override
758    public boolean equalsDeep(Base other_) {
759      if (!super.equalsDeep(other_))
760        return false;
761      if (!(other_ instanceof QuestionnaireResponseItemComponent))
762        return false;
763      QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
764      return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true)
765          && compareDeep(text, o.text, true) && compareDeep(answer, o.answer, true) && compareDeep(item, o.item, true);
766    }
767
768    @Override
769    public boolean equalsShallow(Base other_) {
770      if (!super.equalsShallow(other_))
771        return false;
772      if (!(other_ instanceof QuestionnaireResponseItemComponent))
773        return false;
774      QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
775      return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true)
776          && compareValues(text, o.text, true);
777    }
778
779    public boolean isEmpty() {
780      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, text, answer, item);
781    }
782
783    public String fhirType() {
784      return "QuestionnaireResponse.item";
785
786    }
787
788  }
789
790  @Block()
791  public static class QuestionnaireResponseItemAnswerComponent extends BackboneElement implements IBaseBackboneElement {
792    /**
793     * The answer (or one of the answers) provided by the respondent to the
794     * question.
795     */
796    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
797        DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class,
798        Quantity.class, Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
799    @Description(shortDefinition = "Single-valued answer to the question", formalDefinition = "The answer (or one of the answers) provided by the respondent to the question.")
800    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers")
801    protected Type value;
802
803    /**
804     * Nested groups and/or questions found within this particular answer.
805     */
806    @Child(name = "item", type = {
807        QuestionnaireResponseItemComponent.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
808    @Description(shortDefinition = "Nested groups and questions", formalDefinition = "Nested groups and/or questions found within this particular answer.")
809    protected List<QuestionnaireResponseItemComponent> item;
810
811    private static final long serialVersionUID = 2052422636L;
812
813    /**
814     * Constructor
815     */
816    public QuestionnaireResponseItemAnswerComponent() {
817      super();
818    }
819
820    /**
821     * @return {@link #value} (The answer (or one of the answers) provided by the
822     *         respondent to the question.)
823     */
824    public Type getValue() {
825      return this.value;
826    }
827
828    /**
829     * @return {@link #value} (The answer (or one of the answers) provided by the
830     *         respondent to the question.)
831     */
832    public BooleanType getValueBooleanType() throws FHIRException {
833      if (this.value == null)
834        this.value = new BooleanType();
835      if (!(this.value instanceof BooleanType))
836        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
837            + this.value.getClass().getName() + " was encountered");
838      return (BooleanType) this.value;
839    }
840
841    public boolean hasValueBooleanType() {
842      return this != null && this.value instanceof BooleanType;
843    }
844
845    /**
846     * @return {@link #value} (The answer (or one of the answers) provided by the
847     *         respondent to the question.)
848     */
849    public DecimalType getValueDecimalType() throws FHIRException {
850      if (this.value == null)
851        this.value = new DecimalType();
852      if (!(this.value instanceof DecimalType))
853        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
854            + this.value.getClass().getName() + " was encountered");
855      return (DecimalType) this.value;
856    }
857
858    public boolean hasValueDecimalType() {
859      return this != null && this.value instanceof DecimalType;
860    }
861
862    /**
863     * @return {@link #value} (The answer (or one of the answers) provided by the
864     *         respondent to the question.)
865     */
866    public IntegerType getValueIntegerType() throws FHIRException {
867      if (this.value == null)
868        this.value = new IntegerType();
869      if (!(this.value instanceof IntegerType))
870        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
871            + this.value.getClass().getName() + " was encountered");
872      return (IntegerType) this.value;
873    }
874
875    public boolean hasValueIntegerType() {
876      return this != null && this.value instanceof IntegerType;
877    }
878
879    /**
880     * @return {@link #value} (The answer (or one of the answers) provided by the
881     *         respondent to the question.)
882     */
883    public DateType getValueDateType() throws FHIRException {
884      if (this.value == null)
885        this.value = new DateType();
886      if (!(this.value instanceof DateType))
887        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
888            + " was encountered");
889      return (DateType) this.value;
890    }
891
892    public boolean hasValueDateType() {
893      return this != null && this.value instanceof DateType;
894    }
895
896    /**
897     * @return {@link #value} (The answer (or one of the answers) provided by the
898     *         respondent to the question.)
899     */
900    public DateTimeType getValueDateTimeType() throws FHIRException {
901      if (this.value == null)
902        this.value = new DateTimeType();
903      if (!(this.value instanceof DateTimeType))
904        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
905            + this.value.getClass().getName() + " was encountered");
906      return (DateTimeType) this.value;
907    }
908
909    public boolean hasValueDateTimeType() {
910      return this != null && this.value instanceof DateTimeType;
911    }
912
913    /**
914     * @return {@link #value} (The answer (or one of the answers) provided by the
915     *         respondent to the question.)
916     */
917    public TimeType getValueTimeType() throws FHIRException {
918      if (this.value == null)
919        this.value = new TimeType();
920      if (!(this.value instanceof TimeType))
921        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
922            + " was encountered");
923      return (TimeType) this.value;
924    }
925
926    public boolean hasValueTimeType() {
927      return this != null && this.value instanceof TimeType;
928    }
929
930    /**
931     * @return {@link #value} (The answer (or one of the answers) provided by the
932     *         respondent to the question.)
933     */
934    public StringType getValueStringType() throws FHIRException {
935      if (this.value == null)
936        this.value = new StringType();
937      if (!(this.value instanceof StringType))
938        throw new FHIRException("Type mismatch: the type StringType was expected, but "
939            + this.value.getClass().getName() + " was encountered");
940      return (StringType) this.value;
941    }
942
943    public boolean hasValueStringType() {
944      return this != null && this.value instanceof StringType;
945    }
946
947    /**
948     * @return {@link #value} (The answer (or one of the answers) provided by the
949     *         respondent to the question.)
950     */
951    public UriType getValueUriType() throws FHIRException {
952      if (this.value == null)
953        this.value = new UriType();
954      if (!(this.value instanceof UriType))
955        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
956            + " was encountered");
957      return (UriType) this.value;
958    }
959
960    public boolean hasValueUriType() {
961      return this != null && this.value instanceof UriType;
962    }
963
964    /**
965     * @return {@link #value} (The answer (or one of the answers) provided by the
966     *         respondent to the question.)
967     */
968    public Attachment getValueAttachment() throws FHIRException {
969      if (this.value == null)
970        this.value = new Attachment();
971      if (!(this.value instanceof Attachment))
972        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
973            + this.value.getClass().getName() + " was encountered");
974      return (Attachment) this.value;
975    }
976
977    public boolean hasValueAttachment() {
978      return this != null && this.value instanceof Attachment;
979    }
980
981    /**
982     * @return {@link #value} (The answer (or one of the answers) provided by the
983     *         respondent to the question.)
984     */
985    public Coding getValueCoding() throws FHIRException {
986      if (this.value == null)
987        this.value = new Coding();
988      if (!(this.value instanceof Coding))
989        throw new FHIRException(
990            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
991      return (Coding) this.value;
992    }
993
994    public boolean hasValueCoding() {
995      return this != null && this.value instanceof Coding;
996    }
997
998    /**
999     * @return {@link #value} (The answer (or one of the answers) provided by the
1000     *         respondent to the question.)
1001     */
1002    public Quantity getValueQuantity() throws FHIRException {
1003      if (this.value == null)
1004        this.value = new Quantity();
1005      if (!(this.value instanceof Quantity))
1006        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1007            + " was encountered");
1008      return (Quantity) this.value;
1009    }
1010
1011    public boolean hasValueQuantity() {
1012      return this != null && this.value instanceof Quantity;
1013    }
1014
1015    /**
1016     * @return {@link #value} (The answer (or one of the answers) provided by the
1017     *         respondent to the question.)
1018     */
1019    public Reference getValueReference() throws FHIRException {
1020      if (this.value == null)
1021        this.value = new Reference();
1022      if (!(this.value instanceof Reference))
1023        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1024            + " was encountered");
1025      return (Reference) this.value;
1026    }
1027
1028    public boolean hasValueReference() {
1029      return this != null && this.value instanceof Reference;
1030    }
1031
1032    public boolean hasValue() {
1033      return this.value != null && !this.value.isEmpty();
1034    }
1035
1036    /**
1037     * @param value {@link #value} (The answer (or one of the answers) provided by
1038     *              the respondent to the question.)
1039     */
1040    public QuestionnaireResponseItemAnswerComponent setValue(Type value) {
1041      if (value != null
1042          && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType
1043              || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType
1044              || value instanceof StringType || value instanceof UriType || value instanceof Attachment
1045              || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
1046        throw new Error("Not the right type for QuestionnaireResponse.item.answer.value[x]: " + value.fhirType());
1047      this.value = value;
1048      return this;
1049    }
1050
1051    /**
1052     * @return {@link #item} (Nested groups and/or questions found within this
1053     *         particular answer.)
1054     */
1055    public List<QuestionnaireResponseItemComponent> getItem() {
1056      if (this.item == null)
1057        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1058      return this.item;
1059    }
1060
1061    /**
1062     * @return Returns a reference to <code>this</code> for easy method chaining
1063     */
1064    public QuestionnaireResponseItemAnswerComponent setItem(List<QuestionnaireResponseItemComponent> theItem) {
1065      this.item = theItem;
1066      return this;
1067    }
1068
1069    public boolean hasItem() {
1070      if (this.item == null)
1071        return false;
1072      for (QuestionnaireResponseItemComponent item : this.item)
1073        if (!item.isEmpty())
1074          return true;
1075      return false;
1076    }
1077
1078    public QuestionnaireResponseItemComponent addItem() { // 3
1079      QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
1080      if (this.item == null)
1081        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1082      this.item.add(t);
1083      return t;
1084    }
1085
1086    public QuestionnaireResponseItemAnswerComponent addItem(QuestionnaireResponseItemComponent t) { // 3
1087      if (t == null)
1088        return this;
1089      if (this.item == null)
1090        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1091      this.item.add(t);
1092      return this;
1093    }
1094
1095    /**
1096     * @return The first repetition of repeating field {@link #item}, creating it if
1097     *         it does not already exist
1098     */
1099    public QuestionnaireResponseItemComponent getItemFirstRep() {
1100      if (getItem().isEmpty()) {
1101        addItem();
1102      }
1103      return getItem().get(0);
1104    }
1105
1106    protected void listChildren(List<Property> children) {
1107      super.listChildren(children);
1108      children.add(new Property("value[x]",
1109          "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1110          "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value));
1111      children.add(new Property("item", "@QuestionnaireResponse.item",
1112          "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE, item));
1113    }
1114
1115    @Override
1116    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1117      switch (_hash) {
1118      case -1410166417:
1119        /* value[x] */ return new Property("value[x]",
1120            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1121            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1122      case 111972721:
1123        /* value */ return new Property("value[x]",
1124            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1125            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1126      case 733421943:
1127        /* valueBoolean */ return new Property("value[x]",
1128            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1129            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1130      case -2083993440:
1131        /* valueDecimal */ return new Property("value[x]",
1132            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1133            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1134      case -1668204915:
1135        /* valueInteger */ return new Property("value[x]",
1136            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1137            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1138      case -766192449:
1139        /* valueDate */ return new Property("value[x]",
1140            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1141            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1142      case 1047929900:
1143        /* valueDateTime */ return new Property("value[x]",
1144            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1145            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1146      case -765708322:
1147        /* valueTime */ return new Property("value[x]",
1148            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1149            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1150      case -1424603934:
1151        /* valueString */ return new Property("value[x]",
1152            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1153            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1154      case -1410172357:
1155        /* valueUri */ return new Property("value[x]",
1156            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1157            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1158      case -475566732:
1159        /* valueAttachment */ return new Property("value[x]",
1160            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1161            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1162      case -1887705029:
1163        /* valueCoding */ return new Property("value[x]",
1164            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1165            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1166      case -2029823716:
1167        /* valueQuantity */ return new Property("value[x]",
1168            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1169            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1170      case 1755241690:
1171        /* valueReference */ return new Property("value[x]",
1172            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1173            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1174      case 3242771:
1175        /* item */ return new Property("item", "@QuestionnaireResponse.item",
1176            "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE,
1177            item);
1178      default:
1179        return super.getNamedProperty(_hash, _name, _checkValid);
1180      }
1181
1182    }
1183
1184    @Override
1185    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1186      switch (hash) {
1187      case 111972721:
1188        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
1189      case 3242771:
1190        /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
1191      default:
1192        return super.getProperty(hash, name, checkValid);
1193      }
1194
1195    }
1196
1197    @Override
1198    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1199      switch (hash) {
1200      case 111972721: // value
1201        this.value = castToType(value); // Type
1202        return value;
1203      case 3242771: // item
1204        this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
1205        return value;
1206      default:
1207        return super.setProperty(hash, name, value);
1208      }
1209
1210    }
1211
1212    @Override
1213    public Base setProperty(String name, Base value) throws FHIRException {
1214      if (name.equals("value[x]")) {
1215        this.value = castToType(value); // Type
1216      } else if (name.equals("item")) {
1217        this.getItem().add((QuestionnaireResponseItemComponent) value);
1218      } else
1219        return super.setProperty(name, value);
1220      return value;
1221    }
1222
1223    @Override
1224    public Base makeProperty(int hash, String name) throws FHIRException {
1225      switch (hash) {
1226      case -1410166417:
1227        return getValue();
1228      case 111972721:
1229        return getValue();
1230      case 3242771:
1231        return addItem();
1232      default:
1233        return super.makeProperty(hash, name);
1234      }
1235
1236    }
1237
1238    @Override
1239    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1240      switch (hash) {
1241      case 111972721:
1242        /* value */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri",
1243            "Attachment", "Coding", "Quantity", "Reference" };
1244      case 3242771:
1245        /* item */ return new String[] { "@QuestionnaireResponse.item" };
1246      default:
1247        return super.getTypesForProperty(hash, name);
1248      }
1249
1250    }
1251
1252    @Override
1253    public Base addChild(String name) throws FHIRException {
1254      if (name.equals("valueBoolean")) {
1255        this.value = new BooleanType();
1256        return this.value;
1257      } else if (name.equals("valueDecimal")) {
1258        this.value = new DecimalType();
1259        return this.value;
1260      } else if (name.equals("valueInteger")) {
1261        this.value = new IntegerType();
1262        return this.value;
1263      } else if (name.equals("valueDate")) {
1264        this.value = new DateType();
1265        return this.value;
1266      } else if (name.equals("valueDateTime")) {
1267        this.value = new DateTimeType();
1268        return this.value;
1269      } else if (name.equals("valueTime")) {
1270        this.value = new TimeType();
1271        return this.value;
1272      } else if (name.equals("valueString")) {
1273        this.value = new StringType();
1274        return this.value;
1275      } else if (name.equals("valueUri")) {
1276        this.value = new UriType();
1277        return this.value;
1278      } else if (name.equals("valueAttachment")) {
1279        this.value = new Attachment();
1280        return this.value;
1281      } else if (name.equals("valueCoding")) {
1282        this.value = new Coding();
1283        return this.value;
1284      } else if (name.equals("valueQuantity")) {
1285        this.value = new Quantity();
1286        return this.value;
1287      } else if (name.equals("valueReference")) {
1288        this.value = new Reference();
1289        return this.value;
1290      } else if (name.equals("item")) {
1291        return addItem();
1292      } else
1293        return super.addChild(name);
1294    }
1295
1296    public QuestionnaireResponseItemAnswerComponent copy() {
1297      QuestionnaireResponseItemAnswerComponent dst = new QuestionnaireResponseItemAnswerComponent();
1298      copyValues(dst);
1299      return dst;
1300    }
1301
1302    public void copyValues(QuestionnaireResponseItemAnswerComponent dst) {
1303      super.copyValues(dst);
1304      dst.value = value == null ? null : value.copy();
1305      if (item != null) {
1306        dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
1307        for (QuestionnaireResponseItemComponent i : item)
1308          dst.item.add(i.copy());
1309      }
1310      ;
1311    }
1312
1313    @Override
1314    public boolean equalsDeep(Base other_) {
1315      if (!super.equalsDeep(other_))
1316        return false;
1317      if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1318        return false;
1319      QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1320      return compareDeep(value, o.value, true) && compareDeep(item, o.item, true);
1321    }
1322
1323    @Override
1324    public boolean equalsShallow(Base other_) {
1325      if (!super.equalsShallow(other_))
1326        return false;
1327      if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1328        return false;
1329      QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1330      return true;
1331    }
1332
1333    public boolean isEmpty() {
1334      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, item);
1335    }
1336
1337    public String fhirType() {
1338      return "QuestionnaireResponse.item.answer";
1339
1340    }
1341
1342  }
1343
1344  /**
1345   * A business identifier assigned to a particular completed (or partially
1346   * completed) questionnaire.
1347   */
1348  @Child(name = "identifier", type = {
1349      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
1350  @Description(shortDefinition = "Unique id for this set of answers", formalDefinition = "A business identifier assigned to a particular completed (or partially completed) questionnaire.")
1351  protected Identifier identifier;
1352
1353  /**
1354   * The order, proposal or plan that is fulfilled in whole or in part by this
1355   * QuestionnaireResponse. For example, a ServiceRequest seeking an intake
1356   * assessment or a decision support recommendation to assess for post-partum
1357   * depression.
1358   */
1359  @Child(name = "basedOn", type = { CarePlan.class,
1360      ServiceRequest.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1361  @Description(shortDefinition = "Request fulfilled by this QuestionnaireResponse", formalDefinition = "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.")
1362  protected List<Reference> basedOn;
1363  /**
1364   * The actual objects that are the target of the reference (The order, proposal
1365   * or plan that is fulfilled in whole or in part by this QuestionnaireResponse.
1366   * For example, a ServiceRequest seeking an intake assessment or a decision
1367   * support recommendation to assess for post-partum depression.)
1368   */
1369  protected List<Resource> basedOnTarget;
1370
1371  /**
1372   * A procedure or observation that this questionnaire was performed as part of
1373   * the execution of. For example, the surgery a checklist was executed as part
1374   * of.
1375   */
1376  @Child(name = "partOf", type = { Observation.class,
1377      Procedure.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1378  @Description(shortDefinition = "Part of this action", formalDefinition = "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.")
1379  protected List<Reference> partOf;
1380  /**
1381   * The actual objects that are the target of the reference (A procedure or
1382   * observation that this questionnaire was performed as part of the execution
1383   * of. For example, the surgery a checklist was executed as part of.)
1384   */
1385  protected List<Resource> partOfTarget;
1386
1387  /**
1388   * The Questionnaire that defines and organizes the questions for which answers
1389   * are being provided.
1390   */
1391  @Child(name = "questionnaire", type = {
1392      CanonicalType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1393  @Description(shortDefinition = "Form being answered", formalDefinition = "The Questionnaire that defines and organizes the questions for which answers are being provided.")
1394  protected CanonicalType questionnaire;
1395
1396  /**
1397   * The position of the questionnaire response within its overall lifecycle.
1398   */
1399  @Child(name = "status", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = true, summary = true)
1400  @Description(shortDefinition = "in-progress | completed | amended | entered-in-error | stopped", formalDefinition = "The position of the questionnaire response within its overall lifecycle.")
1401  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers-status")
1402  protected Enumeration<QuestionnaireResponseStatus> status;
1403
1404  /**
1405   * The subject of the questionnaire response. This could be a patient,
1406   * organization, practitioner, device, etc. This is who/what the answers apply
1407   * to, but is not necessarily the source of information.
1408   */
1409  @Child(name = "subject", type = { Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1410  @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.")
1411  protected Reference subject;
1412
1413  /**
1414   * The actual object that is the target of the reference (The subject of the
1415   * questionnaire response. This could be a patient, organization, practitioner,
1416   * device, etc. This is who/what the answers apply to, but is not necessarily
1417   * the source of information.)
1418   */
1419  protected Resource subjectTarget;
1420
1421  /**
1422   * The Encounter during which this questionnaire response was created or to
1423   * which the creation of this record is tightly associated.
1424   */
1425  @Child(name = "encounter", type = { Encounter.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1426  @Description(shortDefinition = "Encounter created as part of", formalDefinition = "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.")
1427  protected Reference encounter;
1428
1429  /**
1430   * The actual object that is the target of the reference (The Encounter during
1431   * which this questionnaire response was created or to which the creation of
1432   * this record is tightly associated.)
1433   */
1434  protected Encounter encounterTarget;
1435
1436  /**
1437   * The date and/or time that this set of answers were last changed.
1438   */
1439  @Child(name = "authored", type = {
1440      DateTimeType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1441  @Description(shortDefinition = "Date the answers were gathered", formalDefinition = "The date and/or time that this set of answers were last changed.")
1442  protected DateTimeType authored;
1443
1444  /**
1445   * Person who received the answers to the questions in the QuestionnaireResponse
1446   * and recorded them in the system.
1447   */
1448  @Child(name = "author", type = { Device.class, Practitioner.class, PractitionerRole.class, Patient.class,
1449      RelatedPerson.class, Organization.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1450  @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.")
1451  protected Reference author;
1452
1453  /**
1454   * The actual object that is the target of the reference (Person who received
1455   * the answers to the questions in the QuestionnaireResponse and recorded them
1456   * in the system.)
1457   */
1458  protected Resource authorTarget;
1459
1460  /**
1461   * The person who answered the questions about the subject.
1462   */
1463  @Child(name = "source", type = { Patient.class, Practitioner.class, PractitionerRole.class,
1464      RelatedPerson.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1465  @Description(shortDefinition = "The person who answered the questions", formalDefinition = "The person who answered the questions about the subject.")
1466  protected Reference source;
1467
1468  /**
1469   * The actual object that is the target of the reference (The person who
1470   * answered the questions about the subject.)
1471   */
1472  protected Resource sourceTarget;
1473
1474  /**
1475   * A group or question item from the original questionnaire for which answers
1476   * are provided.
1477   */
1478  @Child(name = "item", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1479  @Description(shortDefinition = "Groups and questions", formalDefinition = "A group or question item from the original questionnaire for which answers are provided.")
1480  protected List<QuestionnaireResponseItemComponent> item;
1481
1482  private static final long serialVersionUID = -259908687L;
1483
1484  /**
1485   * Constructor
1486   */
1487  public QuestionnaireResponse() {
1488    super();
1489  }
1490
1491  /**
1492   * Constructor
1493   */
1494  public QuestionnaireResponse(Enumeration<QuestionnaireResponseStatus> status) {
1495    super();
1496    this.status = status;
1497  }
1498
1499  /**
1500   * @return {@link #identifier} (A business identifier assigned to a particular
1501   *         completed (or partially completed) questionnaire.)
1502   */
1503  public Identifier getIdentifier() {
1504    if (this.identifier == null)
1505      if (Configuration.errorOnAutoCreate())
1506        throw new Error("Attempt to auto-create QuestionnaireResponse.identifier");
1507      else if (Configuration.doAutoCreate())
1508        this.identifier = new Identifier(); // cc
1509    return this.identifier;
1510  }
1511
1512  public boolean hasIdentifier() {
1513    return this.identifier != null && !this.identifier.isEmpty();
1514  }
1515
1516  /**
1517   * @param value {@link #identifier} (A business identifier assigned to a
1518   *              particular completed (or partially completed) questionnaire.)
1519   */
1520  public QuestionnaireResponse setIdentifier(Identifier value) {
1521    this.identifier = value;
1522    return this;
1523  }
1524
1525  /**
1526   * @return {@link #basedOn} (The order, proposal or plan that is fulfilled in
1527   *         whole or in part by this QuestionnaireResponse. For example, a
1528   *         ServiceRequest seeking an intake assessment or a decision support
1529   *         recommendation to assess for post-partum depression.)
1530   */
1531  public List<Reference> getBasedOn() {
1532    if (this.basedOn == null)
1533      this.basedOn = new ArrayList<Reference>();
1534    return this.basedOn;
1535  }
1536
1537  /**
1538   * @return Returns a reference to <code>this</code> for easy method chaining
1539   */
1540  public QuestionnaireResponse setBasedOn(List<Reference> theBasedOn) {
1541    this.basedOn = theBasedOn;
1542    return this;
1543  }
1544
1545  public boolean hasBasedOn() {
1546    if (this.basedOn == null)
1547      return false;
1548    for (Reference item : this.basedOn)
1549      if (!item.isEmpty())
1550        return true;
1551    return false;
1552  }
1553
1554  public Reference addBasedOn() { // 3
1555    Reference t = new Reference();
1556    if (this.basedOn == null)
1557      this.basedOn = new ArrayList<Reference>();
1558    this.basedOn.add(t);
1559    return t;
1560  }
1561
1562  public QuestionnaireResponse addBasedOn(Reference t) { // 3
1563    if (t == null)
1564      return this;
1565    if (this.basedOn == null)
1566      this.basedOn = new ArrayList<Reference>();
1567    this.basedOn.add(t);
1568    return this;
1569  }
1570
1571  /**
1572   * @return The first repetition of repeating field {@link #basedOn}, creating it
1573   *         if it does not already exist
1574   */
1575  public Reference getBasedOnFirstRep() {
1576    if (getBasedOn().isEmpty()) {
1577      addBasedOn();
1578    }
1579    return getBasedOn().get(0);
1580  }
1581
1582  /**
1583   * @deprecated Use Reference#setResource(IBaseResource) instead
1584   */
1585  @Deprecated
1586  public List<Resource> getBasedOnTarget() {
1587    if (this.basedOnTarget == null)
1588      this.basedOnTarget = new ArrayList<Resource>();
1589    return this.basedOnTarget;
1590  }
1591
1592  /**
1593   * @return {@link #partOf} (A procedure or observation that this questionnaire
1594   *         was performed as part of the execution of. For example, the surgery a
1595   *         checklist was executed as part of.)
1596   */
1597  public List<Reference> getPartOf() {
1598    if (this.partOf == null)
1599      this.partOf = new ArrayList<Reference>();
1600    return this.partOf;
1601  }
1602
1603  /**
1604   * @return Returns a reference to <code>this</code> for easy method chaining
1605   */
1606  public QuestionnaireResponse setPartOf(List<Reference> thePartOf) {
1607    this.partOf = thePartOf;
1608    return this;
1609  }
1610
1611  public boolean hasPartOf() {
1612    if (this.partOf == null)
1613      return false;
1614    for (Reference item : this.partOf)
1615      if (!item.isEmpty())
1616        return true;
1617    return false;
1618  }
1619
1620  public Reference addPartOf() { // 3
1621    Reference t = new Reference();
1622    if (this.partOf == null)
1623      this.partOf = new ArrayList<Reference>();
1624    this.partOf.add(t);
1625    return t;
1626  }
1627
1628  public QuestionnaireResponse addPartOf(Reference t) { // 3
1629    if (t == null)
1630      return this;
1631    if (this.partOf == null)
1632      this.partOf = new ArrayList<Reference>();
1633    this.partOf.add(t);
1634    return this;
1635  }
1636
1637  /**
1638   * @return The first repetition of repeating field {@link #partOf}, creating it
1639   *         if it does not already exist
1640   */
1641  public Reference getPartOfFirstRep() {
1642    if (getPartOf().isEmpty()) {
1643      addPartOf();
1644    }
1645    return getPartOf().get(0);
1646  }
1647
1648  /**
1649   * @deprecated Use Reference#setResource(IBaseResource) instead
1650   */
1651  @Deprecated
1652  public List<Resource> getPartOfTarget() {
1653    if (this.partOfTarget == null)
1654      this.partOfTarget = new ArrayList<Resource>();
1655    return this.partOfTarget;
1656  }
1657
1658  /**
1659   * @return {@link #questionnaire} (The Questionnaire that defines and organizes
1660   *         the questions for which answers are being provided.). This is the
1661   *         underlying object with id, value and extensions. The accessor
1662   *         "getQuestionnaire" gives direct access to the value
1663   */
1664  public CanonicalType getQuestionnaireElement() {
1665    if (this.questionnaire == null)
1666      if (Configuration.errorOnAutoCreate())
1667        throw new Error("Attempt to auto-create QuestionnaireResponse.questionnaire");
1668      else if (Configuration.doAutoCreate())
1669        this.questionnaire = new CanonicalType(); // bb
1670    return this.questionnaire;
1671  }
1672
1673  public boolean hasQuestionnaireElement() {
1674    return this.questionnaire != null && !this.questionnaire.isEmpty();
1675  }
1676
1677  public boolean hasQuestionnaire() {
1678    return this.questionnaire != null && !this.questionnaire.isEmpty();
1679  }
1680
1681  /**
1682   * @param value {@link #questionnaire} (The Questionnaire that defines and
1683   *              organizes the questions for which answers are being provided.).
1684   *              This is the underlying object with id, value and extensions. The
1685   *              accessor "getQuestionnaire" gives direct access to the value
1686   */
1687  public QuestionnaireResponse setQuestionnaireElement(CanonicalType value) {
1688    this.questionnaire = value;
1689    return this;
1690  }
1691
1692  /**
1693   * @return The Questionnaire that defines and organizes the questions for which
1694   *         answers are being provided.
1695   */
1696  public String getQuestionnaire() {
1697    return this.questionnaire == null ? null : this.questionnaire.getValue();
1698  }
1699
1700  /**
1701   * @param value The Questionnaire that defines and organizes the questions for
1702   *              which answers are being provided.
1703   */
1704  public QuestionnaireResponse setQuestionnaire(String value) {
1705    if (Utilities.noString(value))
1706      this.questionnaire = null;
1707    else {
1708      if (this.questionnaire == null)
1709        this.questionnaire = new CanonicalType();
1710      this.questionnaire.setValue(value);
1711    }
1712    return this;
1713  }
1714
1715  /**
1716   * @return {@link #status} (The position of the questionnaire response within
1717   *         its overall lifecycle.). This is the underlying object with id, value
1718   *         and extensions. The accessor "getStatus" gives direct access to the
1719   *         value
1720   */
1721  public Enumeration<QuestionnaireResponseStatus> getStatusElement() {
1722    if (this.status == null)
1723      if (Configuration.errorOnAutoCreate())
1724        throw new Error("Attempt to auto-create QuestionnaireResponse.status");
1725      else if (Configuration.doAutoCreate())
1726        this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory()); // bb
1727    return this.status;
1728  }
1729
1730  public boolean hasStatusElement() {
1731    return this.status != null && !this.status.isEmpty();
1732  }
1733
1734  public boolean hasStatus() {
1735    return this.status != null && !this.status.isEmpty();
1736  }
1737
1738  /**
1739   * @param value {@link #status} (The position of the questionnaire response
1740   *              within its overall lifecycle.). This is the underlying object
1741   *              with id, value and extensions. The accessor "getStatus" gives
1742   *              direct access to the value
1743   */
1744  public QuestionnaireResponse setStatusElement(Enumeration<QuestionnaireResponseStatus> value) {
1745    this.status = value;
1746    return this;
1747  }
1748
1749  /**
1750   * @return The position of the questionnaire response within its overall
1751   *         lifecycle.
1752   */
1753  public QuestionnaireResponseStatus getStatus() {
1754    return this.status == null ? null : this.status.getValue();
1755  }
1756
1757  /**
1758   * @param value The position of the questionnaire response within its overall
1759   *              lifecycle.
1760   */
1761  public QuestionnaireResponse setStatus(QuestionnaireResponseStatus value) {
1762    if (this.status == null)
1763      this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory());
1764    this.status.setValue(value);
1765    return this;
1766  }
1767
1768  /**
1769   * @return {@link #subject} (The subject of the questionnaire response. This
1770   *         could be a patient, organization, practitioner, device, etc. This is
1771   *         who/what the answers apply to, but is not necessarily the source of
1772   *         information.)
1773   */
1774  public Reference getSubject() {
1775    if (this.subject == null)
1776      if (Configuration.errorOnAutoCreate())
1777        throw new Error("Attempt to auto-create QuestionnaireResponse.subject");
1778      else if (Configuration.doAutoCreate())
1779        this.subject = new Reference(); // cc
1780    return this.subject;
1781  }
1782
1783  public boolean hasSubject() {
1784    return this.subject != null && !this.subject.isEmpty();
1785  }
1786
1787  /**
1788   * @param value {@link #subject} (The subject of the questionnaire response.
1789   *              This could be a patient, organization, practitioner, device,
1790   *              etc. This is who/what the answers apply to, but is not
1791   *              necessarily the source of information.)
1792   */
1793  public QuestionnaireResponse setSubject(Reference value) {
1794    this.subject = value;
1795    return this;
1796  }
1797
1798  /**
1799   * @return {@link #subject} The actual object that is the target of the
1800   *         reference. The reference library doesn't populate this, but you can
1801   *         use it to hold the resource if you resolve it. (The subject of the
1802   *         questionnaire response. This could be a patient, organization,
1803   *         practitioner, device, etc. This is who/what the answers apply to, but
1804   *         is not necessarily the source of information.)
1805   */
1806  public Resource getSubjectTarget() {
1807    return this.subjectTarget;
1808  }
1809
1810  /**
1811   * @param value {@link #subject} The actual object that is the target of the
1812   *              reference. The reference library doesn't use these, but you can
1813   *              use it to hold the resource if you resolve it. (The subject of
1814   *              the questionnaire response. This could be a patient,
1815   *              organization, practitioner, device, etc. This is who/what the
1816   *              answers apply to, but is not necessarily the source of
1817   *              information.)
1818   */
1819  public QuestionnaireResponse setSubjectTarget(Resource value) {
1820    this.subjectTarget = value;
1821    return this;
1822  }
1823
1824  /**
1825   * @return {@link #encounter} (The Encounter during which this questionnaire
1826   *         response was created or to which the creation of this record is
1827   *         tightly associated.)
1828   */
1829  public Reference getEncounter() {
1830    if (this.encounter == null)
1831      if (Configuration.errorOnAutoCreate())
1832        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1833      else if (Configuration.doAutoCreate())
1834        this.encounter = new Reference(); // cc
1835    return this.encounter;
1836  }
1837
1838  public boolean hasEncounter() {
1839    return this.encounter != null && !this.encounter.isEmpty();
1840  }
1841
1842  /**
1843   * @param value {@link #encounter} (The Encounter during which this
1844   *              questionnaire response was created or to which the creation of
1845   *              this record is tightly associated.)
1846   */
1847  public QuestionnaireResponse setEncounter(Reference value) {
1848    this.encounter = value;
1849    return this;
1850  }
1851
1852  /**
1853   * @return {@link #encounter} The actual object that is the target of the
1854   *         reference. The reference library doesn't populate this, but you can
1855   *         use it to hold the resource if you resolve it. (The Encounter during
1856   *         which this questionnaire response was created or to which the
1857   *         creation of this record is tightly associated.)
1858   */
1859  public Encounter getEncounterTarget() {
1860    if (this.encounterTarget == null)
1861      if (Configuration.errorOnAutoCreate())
1862        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1863      else if (Configuration.doAutoCreate())
1864        this.encounterTarget = new Encounter(); // aa
1865    return this.encounterTarget;
1866  }
1867
1868  /**
1869   * @param value {@link #encounter} The actual object that is the target of the
1870   *              reference. The reference library doesn't use these, but you can
1871   *              use it to hold the resource if you resolve it. (The Encounter
1872   *              during which this questionnaire response was created or to which
1873   *              the creation of this record is tightly associated.)
1874   */
1875  public QuestionnaireResponse setEncounterTarget(Encounter value) {
1876    this.encounterTarget = value;
1877    return this;
1878  }
1879
1880  /**
1881   * @return {@link #authored} (The date and/or time that this set of answers were
1882   *         last changed.). This is the underlying object with id, value and
1883   *         extensions. The accessor "getAuthored" gives direct access to the
1884   *         value
1885   */
1886  public DateTimeType getAuthoredElement() {
1887    if (this.authored == null)
1888      if (Configuration.errorOnAutoCreate())
1889        throw new Error("Attempt to auto-create QuestionnaireResponse.authored");
1890      else if (Configuration.doAutoCreate())
1891        this.authored = new DateTimeType(); // bb
1892    return this.authored;
1893  }
1894
1895  public boolean hasAuthoredElement() {
1896    return this.authored != null && !this.authored.isEmpty();
1897  }
1898
1899  public boolean hasAuthored() {
1900    return this.authored != null && !this.authored.isEmpty();
1901  }
1902
1903  /**
1904   * @param value {@link #authored} (The date and/or time that this set of answers
1905   *              were last changed.). This is the underlying object with id,
1906   *              value and extensions. The accessor "getAuthored" gives direct
1907   *              access to the value
1908   */
1909  public QuestionnaireResponse setAuthoredElement(DateTimeType value) {
1910    this.authored = value;
1911    return this;
1912  }
1913
1914  /**
1915   * @return The date and/or time that this set of answers were last changed.
1916   */
1917  public Date getAuthored() {
1918    return this.authored == null ? null : this.authored.getValue();
1919  }
1920
1921  /**
1922   * @param value The date and/or time that this set of answers were last changed.
1923   */
1924  public QuestionnaireResponse setAuthored(Date value) {
1925    if (value == null)
1926      this.authored = null;
1927    else {
1928      if (this.authored == null)
1929        this.authored = new DateTimeType();
1930      this.authored.setValue(value);
1931    }
1932    return this;
1933  }
1934
1935  /**
1936   * @return {@link #author} (Person who received the answers to the questions in
1937   *         the QuestionnaireResponse and recorded them in the system.)
1938   */
1939  public Reference getAuthor() {
1940    if (this.author == null)
1941      if (Configuration.errorOnAutoCreate())
1942        throw new Error("Attempt to auto-create QuestionnaireResponse.author");
1943      else if (Configuration.doAutoCreate())
1944        this.author = new Reference(); // cc
1945    return this.author;
1946  }
1947
1948  public boolean hasAuthor() {
1949    return this.author != null && !this.author.isEmpty();
1950  }
1951
1952  /**
1953   * @param value {@link #author} (Person who received the answers to the
1954   *              questions in the QuestionnaireResponse and recorded them in the
1955   *              system.)
1956   */
1957  public QuestionnaireResponse setAuthor(Reference value) {
1958    this.author = value;
1959    return this;
1960  }
1961
1962  /**
1963   * @return {@link #author} The actual object that is the target of the
1964   *         reference. The reference library doesn't populate this, but you can
1965   *         use it to hold the resource if you resolve it. (Person who received
1966   *         the answers to the questions in the QuestionnaireResponse and
1967   *         recorded them in the system.)
1968   */
1969  public Resource getAuthorTarget() {
1970    return this.authorTarget;
1971  }
1972
1973  /**
1974   * @param value {@link #author} The actual object that is the target of the
1975   *              reference. The reference library doesn't use these, but you can
1976   *              use it to hold the resource if you resolve it. (Person who
1977   *              received the answers to the questions in the
1978   *              QuestionnaireResponse and recorded them in the system.)
1979   */
1980  public QuestionnaireResponse setAuthorTarget(Resource value) {
1981    this.authorTarget = value;
1982    return this;
1983  }
1984
1985  /**
1986   * @return {@link #source} (The person who answered the questions about the
1987   *         subject.)
1988   */
1989  public Reference getSource() {
1990    if (this.source == null)
1991      if (Configuration.errorOnAutoCreate())
1992        throw new Error("Attempt to auto-create QuestionnaireResponse.source");
1993      else if (Configuration.doAutoCreate())
1994        this.source = new Reference(); // cc
1995    return this.source;
1996  }
1997
1998  public boolean hasSource() {
1999    return this.source != null && !this.source.isEmpty();
2000  }
2001
2002  /**
2003   * @param value {@link #source} (The person who answered the questions about the
2004   *              subject.)
2005   */
2006  public QuestionnaireResponse setSource(Reference value) {
2007    this.source = value;
2008    return this;
2009  }
2010
2011  /**
2012   * @return {@link #source} The actual object that is the target of the
2013   *         reference. The reference library doesn't populate this, but you can
2014   *         use it to hold the resource if you resolve it. (The person who
2015   *         answered the questions about the subject.)
2016   */
2017  public Resource getSourceTarget() {
2018    return this.sourceTarget;
2019  }
2020
2021  /**
2022   * @param value {@link #source} The actual object that is the target of the
2023   *              reference. The reference library doesn't use these, but you can
2024   *              use it to hold the resource if you resolve it. (The person who
2025   *              answered the questions about the subject.)
2026   */
2027  public QuestionnaireResponse setSourceTarget(Resource value) {
2028    this.sourceTarget = value;
2029    return this;
2030  }
2031
2032  /**
2033   * @return {@link #item} (A group or question item from the original
2034   *         questionnaire for which answers are provided.)
2035   */
2036  public List<QuestionnaireResponseItemComponent> getItem() {
2037    if (this.item == null)
2038      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2039    return this.item;
2040  }
2041
2042  /**
2043   * @return Returns a reference to <code>this</code> for easy method chaining
2044   */
2045  public QuestionnaireResponse setItem(List<QuestionnaireResponseItemComponent> theItem) {
2046    this.item = theItem;
2047    return this;
2048  }
2049
2050  public boolean hasItem() {
2051    if (this.item == null)
2052      return false;
2053    for (QuestionnaireResponseItemComponent item : this.item)
2054      if (!item.isEmpty())
2055        return true;
2056    return false;
2057  }
2058
2059  public QuestionnaireResponseItemComponent addItem() { // 3
2060    QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
2061    if (this.item == null)
2062      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2063    this.item.add(t);
2064    return t;
2065  }
2066
2067  public QuestionnaireResponse addItem(QuestionnaireResponseItemComponent t) { // 3
2068    if (t == null)
2069      return this;
2070    if (this.item == null)
2071      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2072    this.item.add(t);
2073    return this;
2074  }
2075
2076  /**
2077   * @return The first repetition of repeating field {@link #item}, creating it if
2078   *         it does not already exist
2079   */
2080  public QuestionnaireResponseItemComponent getItemFirstRep() {
2081    if (getItem().isEmpty()) {
2082      addItem();
2083    }
2084    return getItem().get(0);
2085  }
2086
2087  protected void listChildren(List<Property> children) {
2088    super.listChildren(children);
2089    children.add(new Property("identifier", "Identifier",
2090        "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1,
2091        identifier));
2092    children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest)",
2093        "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.",
2094        0, java.lang.Integer.MAX_VALUE, basedOn));
2095    children.add(new Property("partOf", "Reference(Observation|Procedure)",
2096        "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.",
2097        0, java.lang.Integer.MAX_VALUE, partOf));
2098    children.add(new Property("questionnaire", "canonical(Questionnaire)",
2099        "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1,
2100        questionnaire));
2101    children.add(new Property("status", "code",
2102        "The position of the questionnaire response within its overall lifecycle.", 0, 1, status));
2103    children.add(new Property("subject", "Reference(Any)",
2104        "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.",
2105        0, 1, subject));
2106    children.add(new Property("encounter", "Reference(Encounter)",
2107        "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.",
2108        0, 1, encounter));
2109    children.add(new Property("authored", "dateTime",
2110        "The date and/or time that this set of answers were last changed.", 0, 1, authored));
2111    children.add(new Property("author",
2112        "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)",
2113        "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
2114        0, 1, author));
2115    children.add(new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
2116        "The person who answered the questions about the subject.", 0, 1, source));
2117    children.add(new Property("item", "",
2118        "A group or question item from the original questionnaire for which answers are provided.", 0,
2119        java.lang.Integer.MAX_VALUE, item));
2120  }
2121
2122  @Override
2123  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2124    switch (_hash) {
2125    case -1618432855:
2126      /* identifier */ return new Property("identifier", "Identifier",
2127          "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1,
2128          identifier);
2129    case -332612366:
2130      /* basedOn */ return new Property("basedOn", "Reference(CarePlan|ServiceRequest)",
2131          "The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ServiceRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.",
2132          0, java.lang.Integer.MAX_VALUE, basedOn);
2133    case -995410646:
2134      /* partOf */ return new Property("partOf", "Reference(Observation|Procedure)",
2135          "A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.",
2136          0, java.lang.Integer.MAX_VALUE, partOf);
2137    case -1017049693:
2138      /* questionnaire */ return new Property("questionnaire", "canonical(Questionnaire)",
2139          "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1,
2140          questionnaire);
2141    case -892481550:
2142      /* status */ return new Property("status", "code",
2143          "The position of the questionnaire response within its overall lifecycle.", 0, 1, status);
2144    case -1867885268:
2145      /* subject */ return new Property("subject", "Reference(Any)",
2146          "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.",
2147          0, 1, subject);
2148    case 1524132147:
2149      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2150          "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.",
2151          0, 1, encounter);
2152    case 1433073514:
2153      /* authored */ return new Property("authored", "dateTime",
2154          "The date and/or time that this set of answers were last changed.", 0, 1, authored);
2155    case -1406328437:
2156      /* author */ return new Property("author",
2157          "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)",
2158          "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
2159          0, 1, author);
2160    case -896505829:
2161      /* source */ return new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
2162          "The person who answered the questions about the subject.", 0, 1, source);
2163    case 3242771:
2164      /* item */ return new Property("item", "",
2165          "A group or question item from the original questionnaire for which answers are provided.", 0,
2166          java.lang.Integer.MAX_VALUE, item);
2167    default:
2168      return super.getNamedProperty(_hash, _name, _checkValid);
2169    }
2170
2171  }
2172
2173  @Override
2174  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2175    switch (hash) {
2176    case -1618432855:
2177      /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
2178    case -332612366:
2179      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2180    case -995410646:
2181      /* partOf */ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2182    case -1017049693:
2183      /* questionnaire */ return this.questionnaire == null ? new Base[0] : new Base[] { this.questionnaire }; // CanonicalType
2184    case -892481550:
2185      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<QuestionnaireResponseStatus>
2186    case -1867885268:
2187      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2188    case 1524132147:
2189      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2190    case 1433073514:
2191      /* authored */ return this.authored == null ? new Base[0] : new Base[] { this.authored }; // DateTimeType
2192    case -1406328437:
2193      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
2194    case -896505829:
2195      /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // Reference
2196    case 3242771:
2197      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
2198    default:
2199      return super.getProperty(hash, name, checkValid);
2200    }
2201
2202  }
2203
2204  @Override
2205  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2206    switch (hash) {
2207    case -1618432855: // identifier
2208      this.identifier = castToIdentifier(value); // Identifier
2209      return value;
2210    case -332612366: // basedOn
2211      this.getBasedOn().add(castToReference(value)); // Reference
2212      return value;
2213    case -995410646: // partOf
2214      this.getPartOf().add(castToReference(value)); // Reference
2215      return value;
2216    case -1017049693: // questionnaire
2217      this.questionnaire = castToCanonical(value); // CanonicalType
2218      return value;
2219    case -892481550: // status
2220      value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
2221      this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
2222      return value;
2223    case -1867885268: // subject
2224      this.subject = castToReference(value); // Reference
2225      return value;
2226    case 1524132147: // encounter
2227      this.encounter = castToReference(value); // Reference
2228      return value;
2229    case 1433073514: // authored
2230      this.authored = castToDateTime(value); // DateTimeType
2231      return value;
2232    case -1406328437: // author
2233      this.author = castToReference(value); // Reference
2234      return value;
2235    case -896505829: // source
2236      this.source = castToReference(value); // Reference
2237      return value;
2238    case 3242771: // item
2239      this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
2240      return value;
2241    default:
2242      return super.setProperty(hash, name, value);
2243    }
2244
2245  }
2246
2247  @Override
2248  public Base setProperty(String name, Base value) throws FHIRException {
2249    if (name.equals("identifier")) {
2250      this.identifier = castToIdentifier(value); // Identifier
2251    } else if (name.equals("basedOn")) {
2252      this.getBasedOn().add(castToReference(value));
2253    } else if (name.equals("partOf")) {
2254      this.getPartOf().add(castToReference(value));
2255    } else if (name.equals("questionnaire")) {
2256      this.questionnaire = castToCanonical(value); // CanonicalType
2257    } else if (name.equals("status")) {
2258      value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
2259      this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
2260    } else if (name.equals("subject")) {
2261      this.subject = castToReference(value); // Reference
2262    } else if (name.equals("encounter")) {
2263      this.encounter = castToReference(value); // Reference
2264    } else if (name.equals("authored")) {
2265      this.authored = castToDateTime(value); // DateTimeType
2266    } else if (name.equals("author")) {
2267      this.author = castToReference(value); // Reference
2268    } else if (name.equals("source")) {
2269      this.source = castToReference(value); // Reference
2270    } else if (name.equals("item")) {
2271      this.getItem().add((QuestionnaireResponseItemComponent) value);
2272    } else
2273      return super.setProperty(name, value);
2274    return value;
2275  }
2276
2277  @Override
2278  public Base makeProperty(int hash, String name) throws FHIRException {
2279    switch (hash) {
2280    case -1618432855:
2281      return getIdentifier();
2282    case -332612366:
2283      return addBasedOn();
2284    case -995410646:
2285      return addPartOf();
2286    case -1017049693:
2287      return getQuestionnaireElement();
2288    case -892481550:
2289      return getStatusElement();
2290    case -1867885268:
2291      return getSubject();
2292    case 1524132147:
2293      return getEncounter();
2294    case 1433073514:
2295      return getAuthoredElement();
2296    case -1406328437:
2297      return getAuthor();
2298    case -896505829:
2299      return getSource();
2300    case 3242771:
2301      return addItem();
2302    default:
2303      return super.makeProperty(hash, name);
2304    }
2305
2306  }
2307
2308  @Override
2309  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2310    switch (hash) {
2311    case -1618432855:
2312      /* identifier */ return new String[] { "Identifier" };
2313    case -332612366:
2314      /* basedOn */ return new String[] { "Reference" };
2315    case -995410646:
2316      /* partOf */ return new String[] { "Reference" };
2317    case -1017049693:
2318      /* questionnaire */ return new String[] { "canonical" };
2319    case -892481550:
2320      /* status */ return new String[] { "code" };
2321    case -1867885268:
2322      /* subject */ return new String[] { "Reference" };
2323    case 1524132147:
2324      /* encounter */ return new String[] { "Reference" };
2325    case 1433073514:
2326      /* authored */ return new String[] { "dateTime" };
2327    case -1406328437:
2328      /* author */ return new String[] { "Reference" };
2329    case -896505829:
2330      /* source */ return new String[] { "Reference" };
2331    case 3242771:
2332      /* item */ return new String[] {};
2333    default:
2334      return super.getTypesForProperty(hash, name);
2335    }
2336
2337  }
2338
2339  @Override
2340  public Base addChild(String name) throws FHIRException {
2341    if (name.equals("identifier")) {
2342      this.identifier = new Identifier();
2343      return this.identifier;
2344    } else if (name.equals("basedOn")) {
2345      return addBasedOn();
2346    } else if (name.equals("partOf")) {
2347      return addPartOf();
2348    } else if (name.equals("questionnaire")) {
2349      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.questionnaire");
2350    } else if (name.equals("status")) {
2351      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.status");
2352    } else if (name.equals("subject")) {
2353      this.subject = new Reference();
2354      return this.subject;
2355    } else if (name.equals("encounter")) {
2356      this.encounter = new Reference();
2357      return this.encounter;
2358    } else if (name.equals("authored")) {
2359      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.authored");
2360    } else if (name.equals("author")) {
2361      this.author = new Reference();
2362      return this.author;
2363    } else if (name.equals("source")) {
2364      this.source = new Reference();
2365      return this.source;
2366    } else if (name.equals("item")) {
2367      return addItem();
2368    } else
2369      return super.addChild(name);
2370  }
2371
2372  public String fhirType() {
2373    return "QuestionnaireResponse";
2374
2375  }
2376
2377  public QuestionnaireResponse copy() {
2378    QuestionnaireResponse dst = new QuestionnaireResponse();
2379    copyValues(dst);
2380    return dst;
2381  }
2382
2383  public void copyValues(QuestionnaireResponse dst) {
2384    super.copyValues(dst);
2385    dst.identifier = identifier == null ? null : identifier.copy();
2386    if (basedOn != null) {
2387      dst.basedOn = new ArrayList<Reference>();
2388      for (Reference i : basedOn)
2389        dst.basedOn.add(i.copy());
2390    }
2391    ;
2392    if (partOf != null) {
2393      dst.partOf = new ArrayList<Reference>();
2394      for (Reference i : partOf)
2395        dst.partOf.add(i.copy());
2396    }
2397    ;
2398    dst.questionnaire = questionnaire == null ? null : questionnaire.copy();
2399    dst.status = status == null ? null : status.copy();
2400    dst.subject = subject == null ? null : subject.copy();
2401    dst.encounter = encounter == null ? null : encounter.copy();
2402    dst.authored = authored == null ? null : authored.copy();
2403    dst.author = author == null ? null : author.copy();
2404    dst.source = source == null ? null : source.copy();
2405    if (item != null) {
2406      dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
2407      for (QuestionnaireResponseItemComponent i : item)
2408        dst.item.add(i.copy());
2409    }
2410    ;
2411  }
2412
2413  protected QuestionnaireResponse typedCopy() {
2414    return copy();
2415  }
2416
2417  @Override
2418  public boolean equalsDeep(Base other_) {
2419    if (!super.equalsDeep(other_))
2420      return false;
2421    if (!(other_ instanceof QuestionnaireResponse))
2422      return false;
2423    QuestionnaireResponse o = (QuestionnaireResponse) other_;
2424    return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true)
2425        && compareDeep(partOf, o.partOf, true) && compareDeep(questionnaire, o.questionnaire, true)
2426        && compareDeep(status, o.status, true) && compareDeep(subject, o.subject, true)
2427        && compareDeep(encounter, o.encounter, true) && compareDeep(authored, o.authored, true)
2428        && compareDeep(author, o.author, true) && compareDeep(source, o.source, true)
2429        && compareDeep(item, o.item, true);
2430  }
2431
2432  @Override
2433  public boolean equalsShallow(Base other_) {
2434    if (!super.equalsShallow(other_))
2435      return false;
2436    if (!(other_ instanceof QuestionnaireResponse))
2437      return false;
2438    QuestionnaireResponse o = (QuestionnaireResponse) other_;
2439    return compareValues(status, o.status, true) && compareValues(authored, o.authored, true);
2440  }
2441
2442  public boolean isEmpty() {
2443    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf, questionnaire, status,
2444        subject, encounter, authored, author, source, item);
2445  }
2446
2447  @Override
2448  public ResourceType getResourceType() {
2449    return ResourceType.QuestionnaireResponse;
2450  }
2451
2452  /**
2453   * Search parameter: <b>authored</b>
2454   * <p>
2455   * Description: <b>When the questionnaire response was last changed</b><br>
2456   * Type: <b>date</b><br>
2457   * Path: <b>QuestionnaireResponse.authored</b><br>
2458   * </p>
2459   */
2460  @SearchParamDefinition(name = "authored", path = "QuestionnaireResponse.authored", description = "When the questionnaire response was last changed", type = "date")
2461  public static final String SP_AUTHORED = "authored";
2462  /**
2463   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
2464   * <p>
2465   * Description: <b>When the questionnaire response was last changed</b><br>
2466   * Type: <b>date</b><br>
2467   * Path: <b>QuestionnaireResponse.authored</b><br>
2468   * </p>
2469   */
2470  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(
2471      SP_AUTHORED);
2472
2473  /**
2474   * Search parameter: <b>identifier</b>
2475   * <p>
2476   * Description: <b>The unique identifier for the questionnaire response</b><br>
2477   * Type: <b>token</b><br>
2478   * Path: <b>QuestionnaireResponse.identifier</b><br>
2479   * </p>
2480   */
2481  @SearchParamDefinition(name = "identifier", path = "QuestionnaireResponse.identifier", description = "The unique identifier for the questionnaire response", type = "token")
2482  public static final String SP_IDENTIFIER = "identifier";
2483  /**
2484   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2485   * <p>
2486   * Description: <b>The unique identifier for the questionnaire response</b><br>
2487   * Type: <b>token</b><br>
2488   * Path: <b>QuestionnaireResponse.identifier</b><br>
2489   * </p>
2490   */
2491  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2492      SP_IDENTIFIER);
2493
2494  /**
2495   * Search parameter: <b>questionnaire</b>
2496   * <p>
2497   * Description: <b>The questionnaire the answers are provided for</b><br>
2498   * Type: <b>reference</b><br>
2499   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2500   * </p>
2501   */
2502  @SearchParamDefinition(name = "questionnaire", path = "QuestionnaireResponse.questionnaire", description = "The questionnaire the answers are provided for", type = "reference", target = {
2503      Questionnaire.class })
2504  public static final String SP_QUESTIONNAIRE = "questionnaire";
2505  /**
2506   * <b>Fluent Client</b> search parameter constant for <b>questionnaire</b>
2507   * <p>
2508   * Description: <b>The questionnaire the answers are provided for</b><br>
2509   * Type: <b>reference</b><br>
2510   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2511   * </p>
2512   */
2513  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam QUESTIONNAIRE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2514      SP_QUESTIONNAIRE);
2515
2516  /**
2517   * Constant for fluent queries to be used to add include statements. Specifies
2518   * the path value of "<b>QuestionnaireResponse:questionnaire</b>".
2519   */
2520  public static final ca.uhn.fhir.model.api.Include INCLUDE_QUESTIONNAIRE = new ca.uhn.fhir.model.api.Include(
2521      "QuestionnaireResponse:questionnaire").toLocked();
2522
2523  /**
2524   * Search parameter: <b>based-on</b>
2525   * <p>
2526   * Description: <b>Plan/proposal/order fulfilled by this questionnaire
2527   * response</b><br>
2528   * Type: <b>reference</b><br>
2529   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2530   * </p>
2531   */
2532  @SearchParamDefinition(name = "based-on", path = "QuestionnaireResponse.basedOn", description = "Plan/proposal/order fulfilled by this questionnaire response", type = "reference", target = {
2533      CarePlan.class, ServiceRequest.class })
2534  public static final String SP_BASED_ON = "based-on";
2535  /**
2536   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2537   * <p>
2538   * Description: <b>Plan/proposal/order fulfilled by this questionnaire
2539   * response</b><br>
2540   * Type: <b>reference</b><br>
2541   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2542   * </p>
2543   */
2544  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2545      SP_BASED_ON);
2546
2547  /**
2548   * Constant for fluent queries to be used to add include statements. Specifies
2549   * the path value of "<b>QuestionnaireResponse:based-on</b>".
2550   */
2551  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
2552      "QuestionnaireResponse:based-on").toLocked();
2553
2554  /**
2555   * Search parameter: <b>subject</b>
2556   * <p>
2557   * Description: <b>The subject of the questionnaire response</b><br>
2558   * Type: <b>reference</b><br>
2559   * Path: <b>QuestionnaireResponse.subject</b><br>
2560   * </p>
2561   */
2562  @SearchParamDefinition(name = "subject", path = "QuestionnaireResponse.subject", description = "The subject of the questionnaire response", type = "reference", providesMembershipIn = {
2563      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") })
2564  public static final String SP_SUBJECT = "subject";
2565  /**
2566   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2567   * <p>
2568   * Description: <b>The subject of the questionnaire response</b><br>
2569   * Type: <b>reference</b><br>
2570   * Path: <b>QuestionnaireResponse.subject</b><br>
2571   * </p>
2572   */
2573  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2574      SP_SUBJECT);
2575
2576  /**
2577   * Constant for fluent queries to be used to add include statements. Specifies
2578   * the path value of "<b>QuestionnaireResponse:subject</b>".
2579   */
2580  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
2581      "QuestionnaireResponse:subject").toLocked();
2582
2583  /**
2584   * Search parameter: <b>author</b>
2585   * <p>
2586   * Description: <b>The author of the questionnaire response</b><br>
2587   * Type: <b>reference</b><br>
2588   * Path: <b>QuestionnaireResponse.author</b><br>
2589   * </p>
2590   */
2591  @SearchParamDefinition(name = "author", path = "QuestionnaireResponse.author", description = "The author of the questionnaire response", type = "reference", providesMembershipIn = {
2592      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2593      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
2594      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
2595      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
2596          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
2597  public static final String SP_AUTHOR = "author";
2598  /**
2599   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2600   * <p>
2601   * Description: <b>The author of the questionnaire response</b><br>
2602   * Type: <b>reference</b><br>
2603   * Path: <b>QuestionnaireResponse.author</b><br>
2604   * </p>
2605   */
2606  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2607      SP_AUTHOR);
2608
2609  /**
2610   * Constant for fluent queries to be used to add include statements. Specifies
2611   * the path value of "<b>QuestionnaireResponse:author</b>".
2612   */
2613  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
2614      "QuestionnaireResponse:author").toLocked();
2615
2616  /**
2617   * Search parameter: <b>patient</b>
2618   * <p>
2619   * Description: <b>The patient that is the subject of the questionnaire
2620   * response</b><br>
2621   * Type: <b>reference</b><br>
2622   * Path: <b>QuestionnaireResponse.subject</b><br>
2623   * </p>
2624   */
2625  @SearchParamDefinition(name = "patient", path = "QuestionnaireResponse.subject.where(resolve() is Patient)", description = "The patient that is the subject of the questionnaire response", type = "reference", target = {
2626      Patient.class })
2627  public static final String SP_PATIENT = "patient";
2628  /**
2629   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2630   * <p>
2631   * Description: <b>The patient that is the subject of the questionnaire
2632   * response</b><br>
2633   * Type: <b>reference</b><br>
2634   * Path: <b>QuestionnaireResponse.subject</b><br>
2635   * </p>
2636   */
2637  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2638      SP_PATIENT);
2639
2640  /**
2641   * Constant for fluent queries to be used to add include statements. Specifies
2642   * the path value of "<b>QuestionnaireResponse:patient</b>".
2643   */
2644  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2645      "QuestionnaireResponse:patient").toLocked();
2646
2647  /**
2648   * Search parameter: <b>part-of</b>
2649   * <p>
2650   * Description: <b>Procedure or observation this questionnaire response was
2651   * performed as a part of</b><br>
2652   * Type: <b>reference</b><br>
2653   * Path: <b>QuestionnaireResponse.partOf</b><br>
2654   * </p>
2655   */
2656  @SearchParamDefinition(name = "part-of", path = "QuestionnaireResponse.partOf", description = "Procedure or observation this questionnaire response was performed as a part of", type = "reference", target = {
2657      Observation.class, Procedure.class })
2658  public static final String SP_PART_OF = "part-of";
2659  /**
2660   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
2661   * <p>
2662   * Description: <b>Procedure or observation this questionnaire response was
2663   * performed as a part of</b><br>
2664   * Type: <b>reference</b><br>
2665   * Path: <b>QuestionnaireResponse.partOf</b><br>
2666   * </p>
2667   */
2668  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2669      SP_PART_OF);
2670
2671  /**
2672   * Constant for fluent queries to be used to add include statements. Specifies
2673   * the path value of "<b>QuestionnaireResponse:part-of</b>".
2674   */
2675  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include(
2676      "QuestionnaireResponse:part-of").toLocked();
2677
2678  /**
2679   * Search parameter: <b>encounter</b>
2680   * <p>
2681   * Description: <b>Encounter associated with the questionnaire response</b><br>
2682   * Type: <b>reference</b><br>
2683   * Path: <b>QuestionnaireResponse.encounter</b><br>
2684   * </p>
2685   */
2686  @SearchParamDefinition(name = "encounter", path = "QuestionnaireResponse.encounter", description = "Encounter associated with the questionnaire response", type = "reference", providesMembershipIn = {
2687      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
2688  public static final String SP_ENCOUNTER = "encounter";
2689  /**
2690   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2691   * <p>
2692   * Description: <b>Encounter associated with the questionnaire response</b><br>
2693   * Type: <b>reference</b><br>
2694   * Path: <b>QuestionnaireResponse.encounter</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2698      SP_ENCOUNTER);
2699
2700  /**
2701   * Constant for fluent queries to be used to add include statements. Specifies
2702   * the path value of "<b>QuestionnaireResponse:encounter</b>".
2703   */
2704  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
2705      "QuestionnaireResponse:encounter").toLocked();
2706
2707  /**
2708   * Search parameter: <b>source</b>
2709   * <p>
2710   * Description: <b>The individual providing the information reflected in the
2711   * questionnaire respose</b><br>
2712   * Type: <b>reference</b><br>
2713   * Path: <b>QuestionnaireResponse.source</b><br>
2714   * </p>
2715   */
2716  @SearchParamDefinition(name = "source", path = "QuestionnaireResponse.source", description = "The individual providing the information reflected in the questionnaire respose", type = "reference", providesMembershipIn = {
2717      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
2718      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Patient.class,
2719          Practitioner.class, PractitionerRole.class, RelatedPerson.class })
2720  public static final String SP_SOURCE = "source";
2721  /**
2722   * <b>Fluent Client</b> search parameter constant for <b>source</b>
2723   * <p>
2724   * Description: <b>The individual providing the information reflected in the
2725   * questionnaire respose</b><br>
2726   * Type: <b>reference</b><br>
2727   * Path: <b>QuestionnaireResponse.source</b><br>
2728   * </p>
2729   */
2730  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2731      SP_SOURCE);
2732
2733  /**
2734   * Constant for fluent queries to be used to add include statements. Specifies
2735   * the path value of "<b>QuestionnaireResponse:source</b>".
2736   */
2737  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include(
2738      "QuestionnaireResponse:source").toLocked();
2739
2740  /**
2741   * Search parameter: <b>status</b>
2742   * <p>
2743   * Description: <b>The status of the questionnaire response</b><br>
2744   * Type: <b>token</b><br>
2745   * Path: <b>QuestionnaireResponse.status</b><br>
2746   * </p>
2747   */
2748  @SearchParamDefinition(name = "status", path = "QuestionnaireResponse.status", description = "The status of the questionnaire response", type = "token")
2749  public static final String SP_STATUS = "status";
2750  /**
2751   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2752   * <p>
2753   * Description: <b>The status of the questionnaire response</b><br>
2754   * Type: <b>token</b><br>
2755   * Path: <b>QuestionnaireResponse.status</b><br>
2756   * </p>
2757   */
2758  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2759      SP_STATUS);
2760
2761}