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 void removeChild(String name, Base value) throws FHIRException {
680      if (name.equals("linkId")) {
681        this.linkId = null;
682      } else if (name.equals("definition")) {
683        this.definition = null;
684      } else if (name.equals("text")) {
685        this.text = null;
686      } else if (name.equals("answer")) {
687        this.getAnswer().remove((QuestionnaireResponseItemAnswerComponent) value);
688      } else if (name.equals("item")) {
689        this.getItem().remove((QuestionnaireResponseItemComponent) value);
690      } else
691        super.removeChild(name, value);
692      
693    }
694
695    @Override
696    public Base makeProperty(int hash, String name) throws FHIRException {
697      switch (hash) {
698      case -1102667083:
699        return getLinkIdElement();
700      case -1014418093:
701        return getDefinitionElement();
702      case 3556653:
703        return getTextElement();
704      case -1412808770:
705        return addAnswer();
706      case 3242771:
707        return addItem();
708      default:
709        return super.makeProperty(hash, name);
710      }
711
712    }
713
714    @Override
715    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
716      switch (hash) {
717      case -1102667083:
718        /* linkId */ return new String[] { "string" };
719      case -1014418093:
720        /* definition */ return new String[] { "uri" };
721      case 3556653:
722        /* text */ return new String[] { "string" };
723      case -1412808770:
724        /* answer */ return new String[] {};
725      case 3242771:
726        /* item */ return new String[] { "@QuestionnaireResponse.item" };
727      default:
728        return super.getTypesForProperty(hash, name);
729      }
730
731    }
732
733    @Override
734    public Base addChild(String name) throws FHIRException {
735      if (name.equals("linkId")) {
736        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.linkId");
737      } else if (name.equals("definition")) {
738        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.definition");
739      } else if (name.equals("text")) {
740        throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.text");
741      } else if (name.equals("answer")) {
742        return addAnswer();
743      } else if (name.equals("item")) {
744        return addItem();
745      } else
746        return super.addChild(name);
747    }
748
749    public QuestionnaireResponseItemComponent copy() {
750      QuestionnaireResponseItemComponent dst = new QuestionnaireResponseItemComponent();
751      copyValues(dst);
752      return dst;
753    }
754
755    public void copyValues(QuestionnaireResponseItemComponent dst) {
756      super.copyValues(dst);
757      dst.linkId = linkId == null ? null : linkId.copy();
758      dst.definition = definition == null ? null : definition.copy();
759      dst.text = text == null ? null : text.copy();
760      if (answer != null) {
761        dst.answer = new ArrayList<QuestionnaireResponseItemAnswerComponent>();
762        for (QuestionnaireResponseItemAnswerComponent i : answer)
763          dst.answer.add(i.copy());
764      }
765      ;
766      if (item != null) {
767        dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
768        for (QuestionnaireResponseItemComponent i : item)
769          dst.item.add(i.copy());
770      }
771      ;
772    }
773
774    @Override
775    public boolean equalsDeep(Base other_) {
776      if (!super.equalsDeep(other_))
777        return false;
778      if (!(other_ instanceof QuestionnaireResponseItemComponent))
779        return false;
780      QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
781      return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true)
782          && compareDeep(text, o.text, true) && compareDeep(answer, o.answer, true) && compareDeep(item, o.item, true);
783    }
784
785    @Override
786    public boolean equalsShallow(Base other_) {
787      if (!super.equalsShallow(other_))
788        return false;
789      if (!(other_ instanceof QuestionnaireResponseItemComponent))
790        return false;
791      QuestionnaireResponseItemComponent o = (QuestionnaireResponseItemComponent) other_;
792      return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true)
793          && compareValues(text, o.text, true);
794    }
795
796    public boolean isEmpty() {
797      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, text, answer, item);
798    }
799
800    public String fhirType() {
801      return "QuestionnaireResponse.item";
802
803    }
804
805  }
806
807  @Block()
808  public static class QuestionnaireResponseItemAnswerComponent extends BackboneElement implements IBaseBackboneElement {
809    /**
810     * The answer (or one of the answers) provided by the respondent to the
811     * question.
812     */
813    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
814        DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class,
815        Quantity.class, Reference.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
816    @Description(shortDefinition = "Single-valued answer to the question", formalDefinition = "The answer (or one of the answers) provided by the respondent to the question.")
817    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers")
818    protected Type value;
819
820    /**
821     * Nested groups and/or questions found within this particular answer.
822     */
823    @Child(name = "item", type = {
824        QuestionnaireResponseItemComponent.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
825    @Description(shortDefinition = "Nested groups and questions", formalDefinition = "Nested groups and/or questions found within this particular answer.")
826    protected List<QuestionnaireResponseItemComponent> item;
827
828    private static final long serialVersionUID = 2052422636L;
829
830    /**
831     * Constructor
832     */
833    public QuestionnaireResponseItemAnswerComponent() {
834      super();
835    }
836
837    /**
838     * @return {@link #value} (The answer (or one of the answers) provided by the
839     *         respondent to the question.)
840     */
841    public Type getValue() {
842      return this.value;
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 BooleanType getValueBooleanType() throws FHIRException {
850      if (this.value == null)
851        this.value = new BooleanType();
852      if (!(this.value instanceof BooleanType))
853        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
854            + this.value.getClass().getName() + " was encountered");
855      return (BooleanType) this.value;
856    }
857
858    public boolean hasValueBooleanType() {
859      return this != null && this.value instanceof BooleanType;
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 DecimalType getValueDecimalType() throws FHIRException {
867      if (this.value == null)
868        this.value = new DecimalType();
869      if (!(this.value instanceof DecimalType))
870        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
871            + this.value.getClass().getName() + " was encountered");
872      return (DecimalType) this.value;
873    }
874
875    public boolean hasValueDecimalType() {
876      return this != null && this.value instanceof DecimalType;
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 IntegerType getValueIntegerType() throws FHIRException {
884      if (this.value == null)
885        this.value = new IntegerType();
886      if (!(this.value instanceof IntegerType))
887        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
888            + this.value.getClass().getName() + " was encountered");
889      return (IntegerType) this.value;
890    }
891
892    public boolean hasValueIntegerType() {
893      return this != null && this.value instanceof IntegerType;
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 DateType getValueDateType() throws FHIRException {
901      if (this.value == null)
902        this.value = new DateType();
903      if (!(this.value instanceof DateType))
904        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
905            + " was encountered");
906      return (DateType) this.value;
907    }
908
909    public boolean hasValueDateType() {
910      return this != null && this.value instanceof DateType;
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 DateTimeType getValueDateTimeType() throws FHIRException {
918      if (this.value == null)
919        this.value = new DateTimeType();
920      if (!(this.value instanceof DateTimeType))
921        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
922            + this.value.getClass().getName() + " was encountered");
923      return (DateTimeType) this.value;
924    }
925
926    public boolean hasValueDateTimeType() {
927      return this != null && this.value instanceof DateTimeType;
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 TimeType getValueTimeType() throws FHIRException {
935      if (this.value == null)
936        this.value = new TimeType();
937      if (!(this.value instanceof TimeType))
938        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
939            + " was encountered");
940      return (TimeType) this.value;
941    }
942
943    public boolean hasValueTimeType() {
944      return this != null && this.value instanceof TimeType;
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 StringType getValueStringType() throws FHIRException {
952      if (this.value == null)
953        this.value = new StringType();
954      if (!(this.value instanceof StringType))
955        throw new FHIRException("Type mismatch: the type StringType was expected, but "
956            + this.value.getClass().getName() + " was encountered");
957      return (StringType) this.value;
958    }
959
960    public boolean hasValueStringType() {
961      return this != null && this.value instanceof StringType;
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 UriType getValueUriType() throws FHIRException {
969      if (this.value == null)
970        this.value = new UriType();
971      if (!(this.value instanceof UriType))
972        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
973            + " was encountered");
974      return (UriType) this.value;
975    }
976
977    public boolean hasValueUriType() {
978      return this != null && this.value instanceof UriType;
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 Attachment getValueAttachment() throws FHIRException {
986      if (this.value == null)
987        this.value = new Attachment();
988      if (!(this.value instanceof Attachment))
989        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
990            + this.value.getClass().getName() + " was encountered");
991      return (Attachment) this.value;
992    }
993
994    public boolean hasValueAttachment() {
995      return this != null && this.value instanceof Attachment;
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 Coding getValueCoding() throws FHIRException {
1003      if (this.value == null)
1004        this.value = new Coding();
1005      if (!(this.value instanceof Coding))
1006        throw new FHIRException(
1007            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
1008      return (Coding) this.value;
1009    }
1010
1011    public boolean hasValueCoding() {
1012      return this != null && this.value instanceof Coding;
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 Quantity getValueQuantity() throws FHIRException {
1020      if (this.value == null)
1021        this.value = new Quantity();
1022      if (!(this.value instanceof Quantity))
1023        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
1024            + " was encountered");
1025      return (Quantity) this.value;
1026    }
1027
1028    public boolean hasValueQuantity() {
1029      return this != null && this.value instanceof Quantity;
1030    }
1031
1032    /**
1033     * @return {@link #value} (The answer (or one of the answers) provided by the
1034     *         respondent to the question.)
1035     */
1036    public Reference getValueReference() throws FHIRException {
1037      if (this.value == null)
1038        this.value = new Reference();
1039      if (!(this.value instanceof Reference))
1040        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
1041            + " was encountered");
1042      return (Reference) this.value;
1043    }
1044
1045    public boolean hasValueReference() {
1046      return this != null && this.value instanceof Reference;
1047    }
1048
1049    public boolean hasValue() {
1050      return this.value != null && !this.value.isEmpty();
1051    }
1052
1053    /**
1054     * @param value {@link #value} (The answer (or one of the answers) provided by
1055     *              the respondent to the question.)
1056     */
1057    public QuestionnaireResponseItemAnswerComponent setValue(Type value) {
1058      if (value != null
1059          && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType
1060              || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType
1061              || value instanceof StringType || value instanceof UriType || value instanceof Attachment
1062              || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
1063        throw new Error("Not the right type for QuestionnaireResponse.item.answer.value[x]: " + value.fhirType());
1064      this.value = value;
1065      return this;
1066    }
1067
1068    /**
1069     * @return {@link #item} (Nested groups and/or questions found within this
1070     *         particular answer.)
1071     */
1072    public List<QuestionnaireResponseItemComponent> getItem() {
1073      if (this.item == null)
1074        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1075      return this.item;
1076    }
1077
1078    /**
1079     * @return Returns a reference to <code>this</code> for easy method chaining
1080     */
1081    public QuestionnaireResponseItemAnswerComponent setItem(List<QuestionnaireResponseItemComponent> theItem) {
1082      this.item = theItem;
1083      return this;
1084    }
1085
1086    public boolean hasItem() {
1087      if (this.item == null)
1088        return false;
1089      for (QuestionnaireResponseItemComponent item : this.item)
1090        if (!item.isEmpty())
1091          return true;
1092      return false;
1093    }
1094
1095    public QuestionnaireResponseItemComponent addItem() { // 3
1096      QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
1097      if (this.item == null)
1098        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1099      this.item.add(t);
1100      return t;
1101    }
1102
1103    public QuestionnaireResponseItemAnswerComponent addItem(QuestionnaireResponseItemComponent t) { // 3
1104      if (t == null)
1105        return this;
1106      if (this.item == null)
1107        this.item = new ArrayList<QuestionnaireResponseItemComponent>();
1108      this.item.add(t);
1109      return this;
1110    }
1111
1112    /**
1113     * @return The first repetition of repeating field {@link #item}, creating it if
1114     *         it does not already exist
1115     */
1116    public QuestionnaireResponseItemComponent getItemFirstRep() {
1117      if (getItem().isEmpty()) {
1118        addItem();
1119      }
1120      return getItem().get(0);
1121    }
1122
1123    protected void listChildren(List<Property> children) {
1124      super.listChildren(children);
1125      children.add(new Property("value[x]",
1126          "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1127          "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value));
1128      children.add(new Property("item", "@QuestionnaireResponse.item",
1129          "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE, item));
1130    }
1131
1132    @Override
1133    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1134      switch (_hash) {
1135      case -1410166417:
1136        /* value[x] */ return new Property("value[x]",
1137            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1138            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1139      case 111972721:
1140        /* value */ return new Property("value[x]",
1141            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1142            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1143      case 733421943:
1144        /* valueBoolean */ return new Property("value[x]",
1145            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1146            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1147      case -2083993440:
1148        /* valueDecimal */ return new Property("value[x]",
1149            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1150            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1151      case -1668204915:
1152        /* valueInteger */ return new Property("value[x]",
1153            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1154            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1155      case -766192449:
1156        /* valueDate */ return new Property("value[x]",
1157            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1158            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1159      case 1047929900:
1160        /* valueDateTime */ return new Property("value[x]",
1161            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1162            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1163      case -765708322:
1164        /* valueTime */ return new Property("value[x]",
1165            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1166            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1167      case -1424603934:
1168        /* valueString */ return new Property("value[x]",
1169            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1170            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1171      case -1410172357:
1172        /* valueUri */ return new Property("value[x]",
1173            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1174            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1175      case -475566732:
1176        /* valueAttachment */ return new Property("value[x]",
1177            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1178            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1179      case -1887705029:
1180        /* valueCoding */ return new Property("value[x]",
1181            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1182            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1183      case -2029823716:
1184        /* valueQuantity */ return new Property("value[x]",
1185            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1186            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1187      case 1755241690:
1188        /* valueReference */ return new Property("value[x]",
1189            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
1190            "The answer (or one of the answers) provided by the respondent to the question.", 0, 1, value);
1191      case 3242771:
1192        /* item */ return new Property("item", "@QuestionnaireResponse.item",
1193            "Nested groups and/or questions found within this particular answer.", 0, java.lang.Integer.MAX_VALUE,
1194            item);
1195      default:
1196        return super.getNamedProperty(_hash, _name, _checkValid);
1197      }
1198
1199    }
1200
1201    @Override
1202    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1203      switch (hash) {
1204      case 111972721:
1205        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
1206      case 3242771:
1207        /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
1208      default:
1209        return super.getProperty(hash, name, checkValid);
1210      }
1211
1212    }
1213
1214    @Override
1215    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1216      switch (hash) {
1217      case 111972721: // value
1218        this.value = castToType(value); // Type
1219        return value;
1220      case 3242771: // item
1221        this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
1222        return value;
1223      default:
1224        return super.setProperty(hash, name, value);
1225      }
1226
1227    }
1228
1229    @Override
1230    public Base setProperty(String name, Base value) throws FHIRException {
1231      if (name.equals("value[x]")) {
1232        this.value = castToType(value); // Type
1233      } else if (name.equals("item")) {
1234        this.getItem().add((QuestionnaireResponseItemComponent) value);
1235      } else
1236        return super.setProperty(name, value);
1237      return value;
1238    }
1239
1240  @Override
1241  public void removeChild(String name, Base value) throws FHIRException {
1242      if (name.equals("value[x]")) {
1243        this.value = null;
1244      } else if (name.equals("item")) {
1245        this.getItem().remove((QuestionnaireResponseItemComponent) value);
1246      } else
1247        super.removeChild(name, value);
1248      
1249    }
1250
1251    @Override
1252    public Base makeProperty(int hash, String name) throws FHIRException {
1253      switch (hash) {
1254      case -1410166417:
1255        return getValue();
1256      case 111972721:
1257        return getValue();
1258      case 3242771:
1259        return addItem();
1260      default:
1261        return super.makeProperty(hash, name);
1262      }
1263
1264    }
1265
1266    @Override
1267    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1268      switch (hash) {
1269      case 111972721:
1270        /* value */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri",
1271            "Attachment", "Coding", "Quantity", "Reference" };
1272      case 3242771:
1273        /* item */ return new String[] { "@QuestionnaireResponse.item" };
1274      default:
1275        return super.getTypesForProperty(hash, name);
1276      }
1277
1278    }
1279
1280    @Override
1281    public Base addChild(String name) throws FHIRException {
1282      if (name.equals("valueBoolean")) {
1283        this.value = new BooleanType();
1284        return this.value;
1285      } else if (name.equals("valueDecimal")) {
1286        this.value = new DecimalType();
1287        return this.value;
1288      } else if (name.equals("valueInteger")) {
1289        this.value = new IntegerType();
1290        return this.value;
1291      } else if (name.equals("valueDate")) {
1292        this.value = new DateType();
1293        return this.value;
1294      } else if (name.equals("valueDateTime")) {
1295        this.value = new DateTimeType();
1296        return this.value;
1297      } else if (name.equals("valueTime")) {
1298        this.value = new TimeType();
1299        return this.value;
1300      } else if (name.equals("valueString")) {
1301        this.value = new StringType();
1302        return this.value;
1303      } else if (name.equals("valueUri")) {
1304        this.value = new UriType();
1305        return this.value;
1306      } else if (name.equals("valueAttachment")) {
1307        this.value = new Attachment();
1308        return this.value;
1309      } else if (name.equals("valueCoding")) {
1310        this.value = new Coding();
1311        return this.value;
1312      } else if (name.equals("valueQuantity")) {
1313        this.value = new Quantity();
1314        return this.value;
1315      } else if (name.equals("valueReference")) {
1316        this.value = new Reference();
1317        return this.value;
1318      } else if (name.equals("item")) {
1319        return addItem();
1320      } else
1321        return super.addChild(name);
1322    }
1323
1324    public QuestionnaireResponseItemAnswerComponent copy() {
1325      QuestionnaireResponseItemAnswerComponent dst = new QuestionnaireResponseItemAnswerComponent();
1326      copyValues(dst);
1327      return dst;
1328    }
1329
1330    public void copyValues(QuestionnaireResponseItemAnswerComponent dst) {
1331      super.copyValues(dst);
1332      dst.value = value == null ? null : value.copy();
1333      if (item != null) {
1334        dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
1335        for (QuestionnaireResponseItemComponent i : item)
1336          dst.item.add(i.copy());
1337      }
1338      ;
1339    }
1340
1341    @Override
1342    public boolean equalsDeep(Base other_) {
1343      if (!super.equalsDeep(other_))
1344        return false;
1345      if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1346        return false;
1347      QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1348      return compareDeep(value, o.value, true) && compareDeep(item, o.item, true);
1349    }
1350
1351    @Override
1352    public boolean equalsShallow(Base other_) {
1353      if (!super.equalsShallow(other_))
1354        return false;
1355      if (!(other_ instanceof QuestionnaireResponseItemAnswerComponent))
1356        return false;
1357      QuestionnaireResponseItemAnswerComponent o = (QuestionnaireResponseItemAnswerComponent) other_;
1358      return true;
1359    }
1360
1361    public boolean isEmpty() {
1362      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, item);
1363    }
1364
1365    public String fhirType() {
1366      return "QuestionnaireResponse.item.answer";
1367
1368    }
1369
1370  }
1371
1372  /**
1373   * A business identifier assigned to a particular completed (or partially
1374   * completed) questionnaire.
1375   */
1376  @Child(name = "identifier", type = {
1377      Identifier.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
1378  @Description(shortDefinition = "Unique id for this set of answers", formalDefinition = "A business identifier assigned to a particular completed (or partially completed) questionnaire.")
1379  protected Identifier identifier;
1380
1381  /**
1382   * The order, proposal or plan that is fulfilled in whole or in part by this
1383   * QuestionnaireResponse. For example, a ServiceRequest seeking an intake
1384   * assessment or a decision support recommendation to assess for post-partum
1385   * depression.
1386   */
1387  @Child(name = "basedOn", type = { CarePlan.class,
1388      ServiceRequest.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1389  @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.")
1390  protected List<Reference> basedOn;
1391  /**
1392   * The actual objects that are the target of the reference (The order, proposal
1393   * or plan that is fulfilled in whole or in part by this QuestionnaireResponse.
1394   * For example, a ServiceRequest seeking an intake assessment or a decision
1395   * support recommendation to assess for post-partum depression.)
1396   */
1397  protected List<Resource> basedOnTarget;
1398
1399  /**
1400   * A procedure or observation that this questionnaire was performed as part of
1401   * the execution of. For example, the surgery a checklist was executed as part
1402   * of.
1403   */
1404  @Child(name = "partOf", type = { Observation.class,
1405      Procedure.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1406  @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.")
1407  protected List<Reference> partOf;
1408  /**
1409   * The actual objects that are the target of the reference (A procedure or
1410   * observation that this questionnaire was performed as part of the execution
1411   * of. For example, the surgery a checklist was executed as part of.)
1412   */
1413  protected List<Resource> partOfTarget;
1414
1415  /**
1416   * The Questionnaire that defines and organizes the questions for which answers
1417   * are being provided.
1418   */
1419  @Child(name = "questionnaire", type = {
1420      CanonicalType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1421  @Description(shortDefinition = "Form being answered", formalDefinition = "The Questionnaire that defines and organizes the questions for which answers are being provided.")
1422  protected CanonicalType questionnaire;
1423
1424  /**
1425   * The position of the questionnaire response within its overall lifecycle.
1426   */
1427  @Child(name = "status", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = true, summary = true)
1428  @Description(shortDefinition = "in-progress | completed | amended | entered-in-error | stopped", formalDefinition = "The position of the questionnaire response within its overall lifecycle.")
1429  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers-status")
1430  protected Enumeration<QuestionnaireResponseStatus> status;
1431
1432  /**
1433   * The subject of the questionnaire response. This could be a patient,
1434   * organization, practitioner, device, etc. This is who/what the answers apply
1435   * to, but is not necessarily the source of information.
1436   */
1437  @Child(name = "subject", type = { Reference.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1438  @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.")
1439  protected Reference subject;
1440
1441  /**
1442   * The actual object that is the target of the reference (The subject of the
1443   * questionnaire response. This could be a patient, organization, practitioner,
1444   * device, etc. This is who/what the answers apply to, but is not necessarily
1445   * the source of information.)
1446   */
1447  protected Resource subjectTarget;
1448
1449  /**
1450   * The Encounter during which this questionnaire response was created or to
1451   * which the creation of this record is tightly associated.
1452   */
1453  @Child(name = "encounter", type = { Encounter.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1454  @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.")
1455  protected Reference encounter;
1456
1457  /**
1458   * The actual object that is the target of the reference (The Encounter during
1459   * which this questionnaire response was created or to which the creation of
1460   * this record is tightly associated.)
1461   */
1462  protected Encounter encounterTarget;
1463
1464  /**
1465   * The date and/or time that this set of answers were last changed.
1466   */
1467  @Child(name = "authored", type = {
1468      DateTimeType.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1469  @Description(shortDefinition = "Date the answers were gathered", formalDefinition = "The date and/or time that this set of answers were last changed.")
1470  protected DateTimeType authored;
1471
1472  /**
1473   * Person who received the answers to the questions in the QuestionnaireResponse
1474   * and recorded them in the system.
1475   */
1476  @Child(name = "author", type = { Device.class, Practitioner.class, PractitionerRole.class, Patient.class,
1477      RelatedPerson.class, Organization.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1478  @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.")
1479  protected Reference author;
1480
1481  /**
1482   * The actual object that is the target of the reference (Person who received
1483   * the answers to the questions in the QuestionnaireResponse and recorded them
1484   * in the system.)
1485   */
1486  protected Resource authorTarget;
1487
1488  /**
1489   * The person who answered the questions about the subject.
1490   */
1491  @Child(name = "source", type = { Patient.class, Practitioner.class, PractitionerRole.class,
1492      RelatedPerson.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1493  @Description(shortDefinition = "The person who answered the questions", formalDefinition = "The person who answered the questions about the subject.")
1494  protected Reference source;
1495
1496  /**
1497   * The actual object that is the target of the reference (The person who
1498   * answered the questions about the subject.)
1499   */
1500  protected Resource sourceTarget;
1501
1502  /**
1503   * A group or question item from the original questionnaire for which answers
1504   * are provided.
1505   */
1506  @Child(name = "item", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1507  @Description(shortDefinition = "Groups and questions", formalDefinition = "A group or question item from the original questionnaire for which answers are provided.")
1508  protected List<QuestionnaireResponseItemComponent> item;
1509
1510  private static final long serialVersionUID = -259908687L;
1511
1512  /**
1513   * Constructor
1514   */
1515  public QuestionnaireResponse() {
1516    super();
1517  }
1518
1519  /**
1520   * Constructor
1521   */
1522  public QuestionnaireResponse(Enumeration<QuestionnaireResponseStatus> status) {
1523    super();
1524    this.status = status;
1525  }
1526
1527  /**
1528   * @return {@link #identifier} (A business identifier assigned to a particular
1529   *         completed (or partially completed) questionnaire.)
1530   */
1531  public Identifier getIdentifier() {
1532    if (this.identifier == null)
1533      if (Configuration.errorOnAutoCreate())
1534        throw new Error("Attempt to auto-create QuestionnaireResponse.identifier");
1535      else if (Configuration.doAutoCreate())
1536        this.identifier = new Identifier(); // cc
1537    return this.identifier;
1538  }
1539
1540  public boolean hasIdentifier() {
1541    return this.identifier != null && !this.identifier.isEmpty();
1542  }
1543
1544  /**
1545   * @param value {@link #identifier} (A business identifier assigned to a
1546   *              particular completed (or partially completed) questionnaire.)
1547   */
1548  public QuestionnaireResponse setIdentifier(Identifier value) {
1549    this.identifier = value;
1550    return this;
1551  }
1552
1553  /**
1554   * @return {@link #basedOn} (The order, proposal or plan that is fulfilled in
1555   *         whole or in part by this QuestionnaireResponse. For example, a
1556   *         ServiceRequest seeking an intake assessment or a decision support
1557   *         recommendation to assess for post-partum depression.)
1558   */
1559  public List<Reference> getBasedOn() {
1560    if (this.basedOn == null)
1561      this.basedOn = new ArrayList<Reference>();
1562    return this.basedOn;
1563  }
1564
1565  /**
1566   * @return Returns a reference to <code>this</code> for easy method chaining
1567   */
1568  public QuestionnaireResponse setBasedOn(List<Reference> theBasedOn) {
1569    this.basedOn = theBasedOn;
1570    return this;
1571  }
1572
1573  public boolean hasBasedOn() {
1574    if (this.basedOn == null)
1575      return false;
1576    for (Reference item : this.basedOn)
1577      if (!item.isEmpty())
1578        return true;
1579    return false;
1580  }
1581
1582  public Reference addBasedOn() { // 3
1583    Reference t = new Reference();
1584    if (this.basedOn == null)
1585      this.basedOn = new ArrayList<Reference>();
1586    this.basedOn.add(t);
1587    return t;
1588  }
1589
1590  public QuestionnaireResponse addBasedOn(Reference t) { // 3
1591    if (t == null)
1592      return this;
1593    if (this.basedOn == null)
1594      this.basedOn = new ArrayList<Reference>();
1595    this.basedOn.add(t);
1596    return this;
1597  }
1598
1599  /**
1600   * @return The first repetition of repeating field {@link #basedOn}, creating it
1601   *         if it does not already exist
1602   */
1603  public Reference getBasedOnFirstRep() {
1604    if (getBasedOn().isEmpty()) {
1605      addBasedOn();
1606    }
1607    return getBasedOn().get(0);
1608  }
1609
1610  /**
1611   * @deprecated Use Reference#setResource(IBaseResource) instead
1612   */
1613  @Deprecated
1614  public List<Resource> getBasedOnTarget() {
1615    if (this.basedOnTarget == null)
1616      this.basedOnTarget = new ArrayList<Resource>();
1617    return this.basedOnTarget;
1618  }
1619
1620  /**
1621   * @return {@link #partOf} (A procedure or observation that this questionnaire
1622   *         was performed as part of the execution of. For example, the surgery a
1623   *         checklist was executed as part of.)
1624   */
1625  public List<Reference> getPartOf() {
1626    if (this.partOf == null)
1627      this.partOf = new ArrayList<Reference>();
1628    return this.partOf;
1629  }
1630
1631  /**
1632   * @return Returns a reference to <code>this</code> for easy method chaining
1633   */
1634  public QuestionnaireResponse setPartOf(List<Reference> thePartOf) {
1635    this.partOf = thePartOf;
1636    return this;
1637  }
1638
1639  public boolean hasPartOf() {
1640    if (this.partOf == null)
1641      return false;
1642    for (Reference item : this.partOf)
1643      if (!item.isEmpty())
1644        return true;
1645    return false;
1646  }
1647
1648  public Reference addPartOf() { // 3
1649    Reference t = new Reference();
1650    if (this.partOf == null)
1651      this.partOf = new ArrayList<Reference>();
1652    this.partOf.add(t);
1653    return t;
1654  }
1655
1656  public QuestionnaireResponse addPartOf(Reference t) { // 3
1657    if (t == null)
1658      return this;
1659    if (this.partOf == null)
1660      this.partOf = new ArrayList<Reference>();
1661    this.partOf.add(t);
1662    return this;
1663  }
1664
1665  /**
1666   * @return The first repetition of repeating field {@link #partOf}, creating it
1667   *         if it does not already exist
1668   */
1669  public Reference getPartOfFirstRep() {
1670    if (getPartOf().isEmpty()) {
1671      addPartOf();
1672    }
1673    return getPartOf().get(0);
1674  }
1675
1676  /**
1677   * @deprecated Use Reference#setResource(IBaseResource) instead
1678   */
1679  @Deprecated
1680  public List<Resource> getPartOfTarget() {
1681    if (this.partOfTarget == null)
1682      this.partOfTarget = new ArrayList<Resource>();
1683    return this.partOfTarget;
1684  }
1685
1686  /**
1687   * @return {@link #questionnaire} (The Questionnaire that defines and organizes
1688   *         the questions for which answers are being provided.). This is the
1689   *         underlying object with id, value and extensions. The accessor
1690   *         "getQuestionnaire" gives direct access to the value
1691   */
1692  public CanonicalType getQuestionnaireElement() {
1693    if (this.questionnaire == null)
1694      if (Configuration.errorOnAutoCreate())
1695        throw new Error("Attempt to auto-create QuestionnaireResponse.questionnaire");
1696      else if (Configuration.doAutoCreate())
1697        this.questionnaire = new CanonicalType(); // bb
1698    return this.questionnaire;
1699  }
1700
1701  public boolean hasQuestionnaireElement() {
1702    return this.questionnaire != null && !this.questionnaire.isEmpty();
1703  }
1704
1705  public boolean hasQuestionnaire() {
1706    return this.questionnaire != null && !this.questionnaire.isEmpty();
1707  }
1708
1709  /**
1710   * @param value {@link #questionnaire} (The Questionnaire that defines and
1711   *              organizes the questions for which answers are being provided.).
1712   *              This is the underlying object with id, value and extensions. The
1713   *              accessor "getQuestionnaire" gives direct access to the value
1714   */
1715  public QuestionnaireResponse setQuestionnaireElement(CanonicalType value) {
1716    this.questionnaire = value;
1717    return this;
1718  }
1719
1720  /**
1721   * @return The Questionnaire that defines and organizes the questions for which
1722   *         answers are being provided.
1723   */
1724  public String getQuestionnaire() {
1725    return this.questionnaire == null ? null : this.questionnaire.getValue();
1726  }
1727
1728  /**
1729   * @param value The Questionnaire that defines and organizes the questions for
1730   *              which answers are being provided.
1731   */
1732  public QuestionnaireResponse setQuestionnaire(String value) {
1733    if (Utilities.noString(value))
1734      this.questionnaire = null;
1735    else {
1736      if (this.questionnaire == null)
1737        this.questionnaire = new CanonicalType();
1738      this.questionnaire.setValue(value);
1739    }
1740    return this;
1741  }
1742
1743  /**
1744   * @return {@link #status} (The position of the questionnaire response within
1745   *         its overall lifecycle.). This is the underlying object with id, value
1746   *         and extensions. The accessor "getStatus" gives direct access to the
1747   *         value
1748   */
1749  public Enumeration<QuestionnaireResponseStatus> getStatusElement() {
1750    if (this.status == null)
1751      if (Configuration.errorOnAutoCreate())
1752        throw new Error("Attempt to auto-create QuestionnaireResponse.status");
1753      else if (Configuration.doAutoCreate())
1754        this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory()); // bb
1755    return this.status;
1756  }
1757
1758  public boolean hasStatusElement() {
1759    return this.status != null && !this.status.isEmpty();
1760  }
1761
1762  public boolean hasStatus() {
1763    return this.status != null && !this.status.isEmpty();
1764  }
1765
1766  /**
1767   * @param value {@link #status} (The position of the questionnaire response
1768   *              within its overall lifecycle.). This is the underlying object
1769   *              with id, value and extensions. The accessor "getStatus" gives
1770   *              direct access to the value
1771   */
1772  public QuestionnaireResponse setStatusElement(Enumeration<QuestionnaireResponseStatus> value) {
1773    this.status = value;
1774    return this;
1775  }
1776
1777  /**
1778   * @return The position of the questionnaire response within its overall
1779   *         lifecycle.
1780   */
1781  public QuestionnaireResponseStatus getStatus() {
1782    return this.status == null ? null : this.status.getValue();
1783  }
1784
1785  /**
1786   * @param value The position of the questionnaire response within its overall
1787   *              lifecycle.
1788   */
1789  public QuestionnaireResponse setStatus(QuestionnaireResponseStatus value) {
1790    if (this.status == null)
1791      this.status = new Enumeration<QuestionnaireResponseStatus>(new QuestionnaireResponseStatusEnumFactory());
1792    this.status.setValue(value);
1793    return this;
1794  }
1795
1796  /**
1797   * @return {@link #subject} (The subject of the questionnaire response. This
1798   *         could be a patient, organization, practitioner, device, etc. This is
1799   *         who/what the answers apply to, but is not necessarily the source of
1800   *         information.)
1801   */
1802  public Reference getSubject() {
1803    if (this.subject == null)
1804      if (Configuration.errorOnAutoCreate())
1805        throw new Error("Attempt to auto-create QuestionnaireResponse.subject");
1806      else if (Configuration.doAutoCreate())
1807        this.subject = new Reference(); // cc
1808    return this.subject;
1809  }
1810
1811  public boolean hasSubject() {
1812    return this.subject != null && !this.subject.isEmpty();
1813  }
1814
1815  /**
1816   * @param value {@link #subject} (The subject of the questionnaire response.
1817   *              This could be a patient, organization, practitioner, device,
1818   *              etc. This is who/what the answers apply to, but is not
1819   *              necessarily the source of information.)
1820   */
1821  public QuestionnaireResponse setSubject(Reference value) {
1822    this.subject = value;
1823    return this;
1824  }
1825
1826  /**
1827   * @return {@link #subject} The actual object that is the target of the
1828   *         reference. The reference library doesn't populate this, but you can
1829   *         use it to hold the resource if you resolve it. (The subject of the
1830   *         questionnaire response. This could be a patient, organization,
1831   *         practitioner, device, etc. This is who/what the answers apply to, but
1832   *         is not necessarily the source of information.)
1833   */
1834  public Resource getSubjectTarget() {
1835    return this.subjectTarget;
1836  }
1837
1838  /**
1839   * @param value {@link #subject} The actual object that is the target of the
1840   *              reference. The reference library doesn't use these, but you can
1841   *              use it to hold the resource if you resolve it. (The subject of
1842   *              the questionnaire response. This could be a patient,
1843   *              organization, practitioner, device, etc. This is who/what the
1844   *              answers apply to, but is not necessarily the source of
1845   *              information.)
1846   */
1847  public QuestionnaireResponse setSubjectTarget(Resource value) {
1848    this.subjectTarget = value;
1849    return this;
1850  }
1851
1852  /**
1853   * @return {@link #encounter} (The Encounter during which this questionnaire
1854   *         response was created or to which the creation of this record is
1855   *         tightly associated.)
1856   */
1857  public Reference getEncounter() {
1858    if (this.encounter == null)
1859      if (Configuration.errorOnAutoCreate())
1860        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1861      else if (Configuration.doAutoCreate())
1862        this.encounter = new Reference(); // cc
1863    return this.encounter;
1864  }
1865
1866  public boolean hasEncounter() {
1867    return this.encounter != null && !this.encounter.isEmpty();
1868  }
1869
1870  /**
1871   * @param value {@link #encounter} (The Encounter during which this
1872   *              questionnaire response was created or to which the creation of
1873   *              this record is tightly associated.)
1874   */
1875  public QuestionnaireResponse setEncounter(Reference value) {
1876    this.encounter = value;
1877    return this;
1878  }
1879
1880  /**
1881   * @return {@link #encounter} The actual object that is the target of the
1882   *         reference. The reference library doesn't populate this, but you can
1883   *         use it to hold the resource if you resolve it. (The Encounter during
1884   *         which this questionnaire response was created or to which the
1885   *         creation of this record is tightly associated.)
1886   */
1887  public Encounter getEncounterTarget() {
1888    if (this.encounterTarget == null)
1889      if (Configuration.errorOnAutoCreate())
1890        throw new Error("Attempt to auto-create QuestionnaireResponse.encounter");
1891      else if (Configuration.doAutoCreate())
1892        this.encounterTarget = new Encounter(); // aa
1893    return this.encounterTarget;
1894  }
1895
1896  /**
1897   * @param value {@link #encounter} The actual object that is the target of the
1898   *              reference. The reference library doesn't use these, but you can
1899   *              use it to hold the resource if you resolve it. (The Encounter
1900   *              during which this questionnaire response was created or to which
1901   *              the creation of this record is tightly associated.)
1902   */
1903  public QuestionnaireResponse setEncounterTarget(Encounter value) {
1904    this.encounterTarget = value;
1905    return this;
1906  }
1907
1908  /**
1909   * @return {@link #authored} (The date and/or time that this set of answers were
1910   *         last changed.). This is the underlying object with id, value and
1911   *         extensions. The accessor "getAuthored" gives direct access to the
1912   *         value
1913   */
1914  public DateTimeType getAuthoredElement() {
1915    if (this.authored == null)
1916      if (Configuration.errorOnAutoCreate())
1917        throw new Error("Attempt to auto-create QuestionnaireResponse.authored");
1918      else if (Configuration.doAutoCreate())
1919        this.authored = new DateTimeType(); // bb
1920    return this.authored;
1921  }
1922
1923  public boolean hasAuthoredElement() {
1924    return this.authored != null && !this.authored.isEmpty();
1925  }
1926
1927  public boolean hasAuthored() {
1928    return this.authored != null && !this.authored.isEmpty();
1929  }
1930
1931  /**
1932   * @param value {@link #authored} (The date and/or time that this set of answers
1933   *              were last changed.). This is the underlying object with id,
1934   *              value and extensions. The accessor "getAuthored" gives direct
1935   *              access to the value
1936   */
1937  public QuestionnaireResponse setAuthoredElement(DateTimeType value) {
1938    this.authored = value;
1939    return this;
1940  }
1941
1942  /**
1943   * @return The date and/or time that this set of answers were last changed.
1944   */
1945  public Date getAuthored() {
1946    return this.authored == null ? null : this.authored.getValue();
1947  }
1948
1949  /**
1950   * @param value The date and/or time that this set of answers were last changed.
1951   */
1952  public QuestionnaireResponse setAuthored(Date value) {
1953    if (value == null)
1954      this.authored = null;
1955    else {
1956      if (this.authored == null)
1957        this.authored = new DateTimeType();
1958      this.authored.setValue(value);
1959    }
1960    return this;
1961  }
1962
1963  /**
1964   * @return {@link #author} (Person who received the answers to the questions in
1965   *         the QuestionnaireResponse and recorded them in the system.)
1966   */
1967  public Reference getAuthor() {
1968    if (this.author == null)
1969      if (Configuration.errorOnAutoCreate())
1970        throw new Error("Attempt to auto-create QuestionnaireResponse.author");
1971      else if (Configuration.doAutoCreate())
1972        this.author = new Reference(); // cc
1973    return this.author;
1974  }
1975
1976  public boolean hasAuthor() {
1977    return this.author != null && !this.author.isEmpty();
1978  }
1979
1980  /**
1981   * @param value {@link #author} (Person who received the answers to the
1982   *              questions in the QuestionnaireResponse and recorded them in the
1983   *              system.)
1984   */
1985  public QuestionnaireResponse setAuthor(Reference value) {
1986    this.author = value;
1987    return this;
1988  }
1989
1990  /**
1991   * @return {@link #author} The actual object that is the target of the
1992   *         reference. The reference library doesn't populate this, but you can
1993   *         use it to hold the resource if you resolve it. (Person who received
1994   *         the answers to the questions in the QuestionnaireResponse and
1995   *         recorded them in the system.)
1996   */
1997  public Resource getAuthorTarget() {
1998    return this.authorTarget;
1999  }
2000
2001  /**
2002   * @param value {@link #author} The actual object that is the target of the
2003   *              reference. The reference library doesn't use these, but you can
2004   *              use it to hold the resource if you resolve it. (Person who
2005   *              received the answers to the questions in the
2006   *              QuestionnaireResponse and recorded them in the system.)
2007   */
2008  public QuestionnaireResponse setAuthorTarget(Resource value) {
2009    this.authorTarget = value;
2010    return this;
2011  }
2012
2013  /**
2014   * @return {@link #source} (The person who answered the questions about the
2015   *         subject.)
2016   */
2017  public Reference getSource() {
2018    if (this.source == null)
2019      if (Configuration.errorOnAutoCreate())
2020        throw new Error("Attempt to auto-create QuestionnaireResponse.source");
2021      else if (Configuration.doAutoCreate())
2022        this.source = new Reference(); // cc
2023    return this.source;
2024  }
2025
2026  public boolean hasSource() {
2027    return this.source != null && !this.source.isEmpty();
2028  }
2029
2030  /**
2031   * @param value {@link #source} (The person who answered the questions about the
2032   *              subject.)
2033   */
2034  public QuestionnaireResponse setSource(Reference value) {
2035    this.source = value;
2036    return this;
2037  }
2038
2039  /**
2040   * @return {@link #source} The actual object that is the target of the
2041   *         reference. The reference library doesn't populate this, but you can
2042   *         use it to hold the resource if you resolve it. (The person who
2043   *         answered the questions about the subject.)
2044   */
2045  public Resource getSourceTarget() {
2046    return this.sourceTarget;
2047  }
2048
2049  /**
2050   * @param value {@link #source} The actual object that is the target of the
2051   *              reference. The reference library doesn't use these, but you can
2052   *              use it to hold the resource if you resolve it. (The person who
2053   *              answered the questions about the subject.)
2054   */
2055  public QuestionnaireResponse setSourceTarget(Resource value) {
2056    this.sourceTarget = value;
2057    return this;
2058  }
2059
2060  /**
2061   * @return {@link #item} (A group or question item from the original
2062   *         questionnaire for which answers are provided.)
2063   */
2064  public List<QuestionnaireResponseItemComponent> getItem() {
2065    if (this.item == null)
2066      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2067    return this.item;
2068  }
2069
2070  /**
2071   * @return Returns a reference to <code>this</code> for easy method chaining
2072   */
2073  public QuestionnaireResponse setItem(List<QuestionnaireResponseItemComponent> theItem) {
2074    this.item = theItem;
2075    return this;
2076  }
2077
2078  public boolean hasItem() {
2079    if (this.item == null)
2080      return false;
2081    for (QuestionnaireResponseItemComponent item : this.item)
2082      if (!item.isEmpty())
2083        return true;
2084    return false;
2085  }
2086
2087  public QuestionnaireResponseItemComponent addItem() { // 3
2088    QuestionnaireResponseItemComponent t = new QuestionnaireResponseItemComponent();
2089    if (this.item == null)
2090      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2091    this.item.add(t);
2092    return t;
2093  }
2094
2095  public QuestionnaireResponse addItem(QuestionnaireResponseItemComponent t) { // 3
2096    if (t == null)
2097      return this;
2098    if (this.item == null)
2099      this.item = new ArrayList<QuestionnaireResponseItemComponent>();
2100    this.item.add(t);
2101    return this;
2102  }
2103
2104  /**
2105   * @return The first repetition of repeating field {@link #item}, creating it if
2106   *         it does not already exist
2107   */
2108  public QuestionnaireResponseItemComponent getItemFirstRep() {
2109    if (getItem().isEmpty()) {
2110      addItem();
2111    }
2112    return getItem().get(0);
2113  }
2114
2115  protected void listChildren(List<Property> children) {
2116    super.listChildren(children);
2117    children.add(new Property("identifier", "Identifier",
2118        "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1,
2119        identifier));
2120    children.add(new Property("basedOn", "Reference(CarePlan|ServiceRequest)",
2121        "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.",
2122        0, java.lang.Integer.MAX_VALUE, basedOn));
2123    children.add(new Property("partOf", "Reference(Observation|Procedure)",
2124        "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.",
2125        0, java.lang.Integer.MAX_VALUE, partOf));
2126    children.add(new Property("questionnaire", "canonical(Questionnaire)",
2127        "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1,
2128        questionnaire));
2129    children.add(new Property("status", "code",
2130        "The position of the questionnaire response within its overall lifecycle.", 0, 1, status));
2131    children.add(new Property("subject", "Reference(Any)",
2132        "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.",
2133        0, 1, subject));
2134    children.add(new Property("encounter", "Reference(Encounter)",
2135        "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.",
2136        0, 1, encounter));
2137    children.add(new Property("authored", "dateTime",
2138        "The date and/or time that this set of answers were last changed.", 0, 1, authored));
2139    children.add(new Property("author",
2140        "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)",
2141        "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
2142        0, 1, author));
2143    children.add(new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
2144        "The person who answered the questions about the subject.", 0, 1, source));
2145    children.add(new Property("item", "",
2146        "A group or question item from the original questionnaire for which answers are provided.", 0,
2147        java.lang.Integer.MAX_VALUE, item));
2148  }
2149
2150  @Override
2151  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2152    switch (_hash) {
2153    case -1618432855:
2154      /* identifier */ return new Property("identifier", "Identifier",
2155          "A business identifier assigned to a particular completed (or partially completed) questionnaire.", 0, 1,
2156          identifier);
2157    case -332612366:
2158      /* basedOn */ return new Property("basedOn", "Reference(CarePlan|ServiceRequest)",
2159          "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.",
2160          0, java.lang.Integer.MAX_VALUE, basedOn);
2161    case -995410646:
2162      /* partOf */ return new Property("partOf", "Reference(Observation|Procedure)",
2163          "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.",
2164          0, java.lang.Integer.MAX_VALUE, partOf);
2165    case -1017049693:
2166      /* questionnaire */ return new Property("questionnaire", "canonical(Questionnaire)",
2167          "The Questionnaire that defines and organizes the questions for which answers are being provided.", 0, 1,
2168          questionnaire);
2169    case -892481550:
2170      /* status */ return new Property("status", "code",
2171          "The position of the questionnaire response within its overall lifecycle.", 0, 1, status);
2172    case -1867885268:
2173      /* subject */ return new Property("subject", "Reference(Any)",
2174          "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.",
2175          0, 1, subject);
2176    case 1524132147:
2177      /* encounter */ return new Property("encounter", "Reference(Encounter)",
2178          "The Encounter during which this questionnaire response was created or to which the creation of this record is tightly associated.",
2179          0, 1, encounter);
2180    case 1433073514:
2181      /* authored */ return new Property("authored", "dateTime",
2182          "The date and/or time that this set of answers were last changed.", 0, 1, authored);
2183    case -1406328437:
2184      /* author */ return new Property("author",
2185          "Reference(Device|Practitioner|PractitionerRole|Patient|RelatedPerson|Organization)",
2186          "Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.",
2187          0, 1, author);
2188    case -896505829:
2189      /* source */ return new Property("source", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)",
2190          "The person who answered the questions about the subject.", 0, 1, source);
2191    case 3242771:
2192      /* item */ return new Property("item", "",
2193          "A group or question item from the original questionnaire for which answers are provided.", 0,
2194          java.lang.Integer.MAX_VALUE, item);
2195    default:
2196      return super.getNamedProperty(_hash, _name, _checkValid);
2197    }
2198
2199  }
2200
2201  @Override
2202  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2203    switch (hash) {
2204    case -1618432855:
2205      /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
2206    case -332612366:
2207      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
2208    case -995410646:
2209      /* partOf */ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference
2210    case -1017049693:
2211      /* questionnaire */ return this.questionnaire == null ? new Base[0] : new Base[] { this.questionnaire }; // CanonicalType
2212    case -892481550:
2213      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<QuestionnaireResponseStatus>
2214    case -1867885268:
2215      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
2216    case 1524132147:
2217      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
2218    case 1433073514:
2219      /* authored */ return this.authored == null ? new Base[0] : new Base[] { this.authored }; // DateTimeType
2220    case -1406328437:
2221      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
2222    case -896505829:
2223      /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // Reference
2224    case 3242771:
2225      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireResponseItemComponent
2226    default:
2227      return super.getProperty(hash, name, checkValid);
2228    }
2229
2230  }
2231
2232  @Override
2233  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2234    switch (hash) {
2235    case -1618432855: // identifier
2236      this.identifier = castToIdentifier(value); // Identifier
2237      return value;
2238    case -332612366: // basedOn
2239      this.getBasedOn().add(castToReference(value)); // Reference
2240      return value;
2241    case -995410646: // partOf
2242      this.getPartOf().add(castToReference(value)); // Reference
2243      return value;
2244    case -1017049693: // questionnaire
2245      this.questionnaire = castToCanonical(value); // CanonicalType
2246      return value;
2247    case -892481550: // status
2248      value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
2249      this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
2250      return value;
2251    case -1867885268: // subject
2252      this.subject = castToReference(value); // Reference
2253      return value;
2254    case 1524132147: // encounter
2255      this.encounter = castToReference(value); // Reference
2256      return value;
2257    case 1433073514: // authored
2258      this.authored = castToDateTime(value); // DateTimeType
2259      return value;
2260    case -1406328437: // author
2261      this.author = castToReference(value); // Reference
2262      return value;
2263    case -896505829: // source
2264      this.source = castToReference(value); // Reference
2265      return value;
2266    case 3242771: // item
2267      this.getItem().add((QuestionnaireResponseItemComponent) value); // QuestionnaireResponseItemComponent
2268      return value;
2269    default:
2270      return super.setProperty(hash, name, value);
2271    }
2272
2273  }
2274
2275  @Override
2276  public Base setProperty(String name, Base value) throws FHIRException {
2277    if (name.equals("identifier")) {
2278      this.identifier = castToIdentifier(value); // Identifier
2279    } else if (name.equals("basedOn")) {
2280      this.getBasedOn().add(castToReference(value));
2281    } else if (name.equals("partOf")) {
2282      this.getPartOf().add(castToReference(value));
2283    } else if (name.equals("questionnaire")) {
2284      this.questionnaire = castToCanonical(value); // CanonicalType
2285    } else if (name.equals("status")) {
2286      value = new QuestionnaireResponseStatusEnumFactory().fromType(castToCode(value));
2287      this.status = (Enumeration) value; // Enumeration<QuestionnaireResponseStatus>
2288    } else if (name.equals("subject")) {
2289      this.subject = castToReference(value); // Reference
2290    } else if (name.equals("encounter")) {
2291      this.encounter = castToReference(value); // Reference
2292    } else if (name.equals("authored")) {
2293      this.authored = castToDateTime(value); // DateTimeType
2294    } else if (name.equals("author")) {
2295      this.author = castToReference(value); // Reference
2296    } else if (name.equals("source")) {
2297      this.source = castToReference(value); // Reference
2298    } else if (name.equals("item")) {
2299      this.getItem().add((QuestionnaireResponseItemComponent) value);
2300    } else
2301      return super.setProperty(name, value);
2302    return value;
2303  }
2304
2305  @Override
2306  public void removeChild(String name, Base value) throws FHIRException {
2307    if (name.equals("identifier")) {
2308      this.identifier = null;
2309    } else if (name.equals("basedOn")) {
2310      this.getBasedOn().remove(castToReference(value));
2311    } else if (name.equals("partOf")) {
2312      this.getPartOf().remove(castToReference(value));
2313    } else if (name.equals("questionnaire")) {
2314      this.questionnaire = null;
2315    } else if (name.equals("status")) {
2316      this.status = null;
2317    } else if (name.equals("subject")) {
2318      this.subject = null;
2319    } else if (name.equals("encounter")) {
2320      this.encounter = null;
2321    } else if (name.equals("authored")) {
2322      this.authored = null;
2323    } else if (name.equals("author")) {
2324      this.author = null;
2325    } else if (name.equals("source")) {
2326      this.source = null;
2327    } else if (name.equals("item")) {
2328      this.getItem().remove((QuestionnaireResponseItemComponent) value);
2329    } else
2330      super.removeChild(name, value);
2331    
2332  }
2333
2334  @Override
2335  public Base makeProperty(int hash, String name) throws FHIRException {
2336    switch (hash) {
2337    case -1618432855:
2338      return getIdentifier();
2339    case -332612366:
2340      return addBasedOn();
2341    case -995410646:
2342      return addPartOf();
2343    case -1017049693:
2344      return getQuestionnaireElement();
2345    case -892481550:
2346      return getStatusElement();
2347    case -1867885268:
2348      return getSubject();
2349    case 1524132147:
2350      return getEncounter();
2351    case 1433073514:
2352      return getAuthoredElement();
2353    case -1406328437:
2354      return getAuthor();
2355    case -896505829:
2356      return getSource();
2357    case 3242771:
2358      return addItem();
2359    default:
2360      return super.makeProperty(hash, name);
2361    }
2362
2363  }
2364
2365  @Override
2366  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2367    switch (hash) {
2368    case -1618432855:
2369      /* identifier */ return new String[] { "Identifier" };
2370    case -332612366:
2371      /* basedOn */ return new String[] { "Reference" };
2372    case -995410646:
2373      /* partOf */ return new String[] { "Reference" };
2374    case -1017049693:
2375      /* questionnaire */ return new String[] { "canonical" };
2376    case -892481550:
2377      /* status */ return new String[] { "code" };
2378    case -1867885268:
2379      /* subject */ return new String[] { "Reference" };
2380    case 1524132147:
2381      /* encounter */ return new String[] { "Reference" };
2382    case 1433073514:
2383      /* authored */ return new String[] { "dateTime" };
2384    case -1406328437:
2385      /* author */ return new String[] { "Reference" };
2386    case -896505829:
2387      /* source */ return new String[] { "Reference" };
2388    case 3242771:
2389      /* item */ return new String[] {};
2390    default:
2391      return super.getTypesForProperty(hash, name);
2392    }
2393
2394  }
2395
2396  @Override
2397  public Base addChild(String name) throws FHIRException {
2398    if (name.equals("identifier")) {
2399      this.identifier = new Identifier();
2400      return this.identifier;
2401    } else if (name.equals("basedOn")) {
2402      return addBasedOn();
2403    } else if (name.equals("partOf")) {
2404      return addPartOf();
2405    } else if (name.equals("questionnaire")) {
2406      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.questionnaire");
2407    } else if (name.equals("status")) {
2408      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.status");
2409    } else if (name.equals("subject")) {
2410      this.subject = new Reference();
2411      return this.subject;
2412    } else if (name.equals("encounter")) {
2413      this.encounter = new Reference();
2414      return this.encounter;
2415    } else if (name.equals("authored")) {
2416      throw new FHIRException("Cannot call addChild on a singleton property QuestionnaireResponse.authored");
2417    } else if (name.equals("author")) {
2418      this.author = new Reference();
2419      return this.author;
2420    } else if (name.equals("source")) {
2421      this.source = new Reference();
2422      return this.source;
2423    } else if (name.equals("item")) {
2424      return addItem();
2425    } else
2426      return super.addChild(name);
2427  }
2428
2429  public String fhirType() {
2430    return "QuestionnaireResponse";
2431
2432  }
2433
2434  public QuestionnaireResponse copy() {
2435    QuestionnaireResponse dst = new QuestionnaireResponse();
2436    copyValues(dst);
2437    return dst;
2438  }
2439
2440  public void copyValues(QuestionnaireResponse dst) {
2441    super.copyValues(dst);
2442    dst.identifier = identifier == null ? null : identifier.copy();
2443    if (basedOn != null) {
2444      dst.basedOn = new ArrayList<Reference>();
2445      for (Reference i : basedOn)
2446        dst.basedOn.add(i.copy());
2447    }
2448    ;
2449    if (partOf != null) {
2450      dst.partOf = new ArrayList<Reference>();
2451      for (Reference i : partOf)
2452        dst.partOf.add(i.copy());
2453    }
2454    ;
2455    dst.questionnaire = questionnaire == null ? null : questionnaire.copy();
2456    dst.status = status == null ? null : status.copy();
2457    dst.subject = subject == null ? null : subject.copy();
2458    dst.encounter = encounter == null ? null : encounter.copy();
2459    dst.authored = authored == null ? null : authored.copy();
2460    dst.author = author == null ? null : author.copy();
2461    dst.source = source == null ? null : source.copy();
2462    if (item != null) {
2463      dst.item = new ArrayList<QuestionnaireResponseItemComponent>();
2464      for (QuestionnaireResponseItemComponent i : item)
2465        dst.item.add(i.copy());
2466    }
2467    ;
2468  }
2469
2470  protected QuestionnaireResponse typedCopy() {
2471    return copy();
2472  }
2473
2474  @Override
2475  public boolean equalsDeep(Base other_) {
2476    if (!super.equalsDeep(other_))
2477      return false;
2478    if (!(other_ instanceof QuestionnaireResponse))
2479      return false;
2480    QuestionnaireResponse o = (QuestionnaireResponse) other_;
2481    return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true)
2482        && compareDeep(partOf, o.partOf, true) && compareDeep(questionnaire, o.questionnaire, true)
2483        && compareDeep(status, o.status, true) && compareDeep(subject, o.subject, true)
2484        && compareDeep(encounter, o.encounter, true) && compareDeep(authored, o.authored, true)
2485        && compareDeep(author, o.author, true) && compareDeep(source, o.source, true)
2486        && compareDeep(item, o.item, true);
2487  }
2488
2489  @Override
2490  public boolean equalsShallow(Base other_) {
2491    if (!super.equalsShallow(other_))
2492      return false;
2493    if (!(other_ instanceof QuestionnaireResponse))
2494      return false;
2495    QuestionnaireResponse o = (QuestionnaireResponse) other_;
2496    return compareValues(status, o.status, true) && compareValues(authored, o.authored, true);
2497  }
2498
2499  public boolean isEmpty() {
2500    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf, questionnaire, status,
2501        subject, encounter, authored, author, source, item);
2502  }
2503
2504  @Override
2505  public ResourceType getResourceType() {
2506    return ResourceType.QuestionnaireResponse;
2507  }
2508
2509  /**
2510   * Search parameter: <b>authored</b>
2511   * <p>
2512   * Description: <b>When the questionnaire response was last changed</b><br>
2513   * Type: <b>date</b><br>
2514   * Path: <b>QuestionnaireResponse.authored</b><br>
2515   * </p>
2516   */
2517  @SearchParamDefinition(name = "authored", path = "QuestionnaireResponse.authored", description = "When the questionnaire response was last changed", type = "date")
2518  public static final String SP_AUTHORED = "authored";
2519  /**
2520   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
2521   * <p>
2522   * Description: <b>When the questionnaire response was last changed</b><br>
2523   * Type: <b>date</b><br>
2524   * Path: <b>QuestionnaireResponse.authored</b><br>
2525   * </p>
2526   */
2527  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(
2528      SP_AUTHORED);
2529
2530  /**
2531   * Search parameter: <b>identifier</b>
2532   * <p>
2533   * Description: <b>The unique identifier for the questionnaire response</b><br>
2534   * Type: <b>token</b><br>
2535   * Path: <b>QuestionnaireResponse.identifier</b><br>
2536   * </p>
2537   */
2538  @SearchParamDefinition(name = "identifier", path = "QuestionnaireResponse.identifier", description = "The unique identifier for the questionnaire response", type = "token")
2539  public static final String SP_IDENTIFIER = "identifier";
2540  /**
2541   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2542   * <p>
2543   * Description: <b>The unique identifier for the questionnaire response</b><br>
2544   * Type: <b>token</b><br>
2545   * Path: <b>QuestionnaireResponse.identifier</b><br>
2546   * </p>
2547   */
2548  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2549      SP_IDENTIFIER);
2550
2551  /**
2552   * Search parameter: <b>questionnaire</b>
2553   * <p>
2554   * Description: <b>The questionnaire the answers are provided for</b><br>
2555   * Type: <b>reference</b><br>
2556   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2557   * </p>
2558   */
2559  @SearchParamDefinition(name = "questionnaire", path = "QuestionnaireResponse.questionnaire", description = "The questionnaire the answers are provided for", type = "reference", target = {
2560      Questionnaire.class })
2561  public static final String SP_QUESTIONNAIRE = "questionnaire";
2562  /**
2563   * <b>Fluent Client</b> search parameter constant for <b>questionnaire</b>
2564   * <p>
2565   * Description: <b>The questionnaire the answers are provided for</b><br>
2566   * Type: <b>reference</b><br>
2567   * Path: <b>QuestionnaireResponse.questionnaire</b><br>
2568   * </p>
2569   */
2570  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam QUESTIONNAIRE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2571      SP_QUESTIONNAIRE);
2572
2573  /**
2574   * Constant for fluent queries to be used to add include statements. Specifies
2575   * the path value of "<b>QuestionnaireResponse:questionnaire</b>".
2576   */
2577  public static final ca.uhn.fhir.model.api.Include INCLUDE_QUESTIONNAIRE = new ca.uhn.fhir.model.api.Include(
2578      "QuestionnaireResponse:questionnaire").toLocked();
2579
2580  /**
2581   * Search parameter: <b>based-on</b>
2582   * <p>
2583   * Description: <b>Plan/proposal/order fulfilled by this questionnaire
2584   * response</b><br>
2585   * Type: <b>reference</b><br>
2586   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2587   * </p>
2588   */
2589  @SearchParamDefinition(name = "based-on", path = "QuestionnaireResponse.basedOn", description = "Plan/proposal/order fulfilled by this questionnaire response", type = "reference", target = {
2590      CarePlan.class, ServiceRequest.class })
2591  public static final String SP_BASED_ON = "based-on";
2592  /**
2593   * <b>Fluent Client</b> search parameter constant for <b>based-on</b>
2594   * <p>
2595   * Description: <b>Plan/proposal/order fulfilled by this questionnaire
2596   * response</b><br>
2597   * Type: <b>reference</b><br>
2598   * Path: <b>QuestionnaireResponse.basedOn</b><br>
2599   * </p>
2600   */
2601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASED_ON = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2602      SP_BASED_ON);
2603
2604  /**
2605   * Constant for fluent queries to be used to add include statements. Specifies
2606   * the path value of "<b>QuestionnaireResponse:based-on</b>".
2607   */
2608  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASED_ON = new ca.uhn.fhir.model.api.Include(
2609      "QuestionnaireResponse:based-on").toLocked();
2610
2611  /**
2612   * Search parameter: <b>subject</b>
2613   * <p>
2614   * Description: <b>The subject of the questionnaire response</b><br>
2615   * Type: <b>reference</b><br>
2616   * Path: <b>QuestionnaireResponse.subject</b><br>
2617   * </p>
2618   */
2619  @SearchParamDefinition(name = "subject", path = "QuestionnaireResponse.subject", description = "The subject of the questionnaire response", type = "reference", providesMembershipIn = {
2620      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") })
2621  public static final String SP_SUBJECT = "subject";
2622  /**
2623   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2624   * <p>
2625   * Description: <b>The subject of the questionnaire response</b><br>
2626   * Type: <b>reference</b><br>
2627   * Path: <b>QuestionnaireResponse.subject</b><br>
2628   * </p>
2629   */
2630  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2631      SP_SUBJECT);
2632
2633  /**
2634   * Constant for fluent queries to be used to add include statements. Specifies
2635   * the path value of "<b>QuestionnaireResponse:subject</b>".
2636   */
2637  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
2638      "QuestionnaireResponse:subject").toLocked();
2639
2640  /**
2641   * Search parameter: <b>author</b>
2642   * <p>
2643   * Description: <b>The author of the questionnaire response</b><br>
2644   * Type: <b>reference</b><br>
2645   * Path: <b>QuestionnaireResponse.author</b><br>
2646   * </p>
2647   */
2648  @SearchParamDefinition(name = "author", path = "QuestionnaireResponse.author", description = "The author of the questionnaire response", type = "reference", providesMembershipIn = {
2649      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2650      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"),
2651      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
2652      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class,
2653          Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class })
2654  public static final String SP_AUTHOR = "author";
2655  /**
2656   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2657   * <p>
2658   * Description: <b>The author of the questionnaire response</b><br>
2659   * Type: <b>reference</b><br>
2660   * Path: <b>QuestionnaireResponse.author</b><br>
2661   * </p>
2662   */
2663  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2664      SP_AUTHOR);
2665
2666  /**
2667   * Constant for fluent queries to be used to add include statements. Specifies
2668   * the path value of "<b>QuestionnaireResponse:author</b>".
2669   */
2670  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
2671      "QuestionnaireResponse:author").toLocked();
2672
2673  /**
2674   * Search parameter: <b>patient</b>
2675   * <p>
2676   * Description: <b>The patient that is the subject of the questionnaire
2677   * response</b><br>
2678   * Type: <b>reference</b><br>
2679   * Path: <b>QuestionnaireResponse.subject</b><br>
2680   * </p>
2681   */
2682  @SearchParamDefinition(name = "patient", path = "QuestionnaireResponse.subject.where(resolve() is Patient)", description = "The patient that is the subject of the questionnaire response", type = "reference", target = {
2683      Patient.class })
2684  public static final String SP_PATIENT = "patient";
2685  /**
2686   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2687   * <p>
2688   * Description: <b>The patient that is the subject of the questionnaire
2689   * response</b><br>
2690   * Type: <b>reference</b><br>
2691   * Path: <b>QuestionnaireResponse.subject</b><br>
2692   * </p>
2693   */
2694  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2695      SP_PATIENT);
2696
2697  /**
2698   * Constant for fluent queries to be used to add include statements. Specifies
2699   * the path value of "<b>QuestionnaireResponse:patient</b>".
2700   */
2701  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2702      "QuestionnaireResponse:patient").toLocked();
2703
2704  /**
2705   * Search parameter: <b>part-of</b>
2706   * <p>
2707   * Description: <b>Procedure or observation this questionnaire response was
2708   * performed as a part of</b><br>
2709   * Type: <b>reference</b><br>
2710   * Path: <b>QuestionnaireResponse.partOf</b><br>
2711   * </p>
2712   */
2713  @SearchParamDefinition(name = "part-of", path = "QuestionnaireResponse.partOf", description = "Procedure or observation this questionnaire response was performed as a part of", type = "reference", target = {
2714      Observation.class, Procedure.class })
2715  public static final String SP_PART_OF = "part-of";
2716  /**
2717   * <b>Fluent Client</b> search parameter constant for <b>part-of</b>
2718   * <p>
2719   * Description: <b>Procedure or observation this questionnaire response was
2720   * performed as a part of</b><br>
2721   * Type: <b>reference</b><br>
2722   * Path: <b>QuestionnaireResponse.partOf</b><br>
2723   * </p>
2724   */
2725  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PART_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2726      SP_PART_OF);
2727
2728  /**
2729   * Constant for fluent queries to be used to add include statements. Specifies
2730   * the path value of "<b>QuestionnaireResponse:part-of</b>".
2731   */
2732  public static final ca.uhn.fhir.model.api.Include INCLUDE_PART_OF = new ca.uhn.fhir.model.api.Include(
2733      "QuestionnaireResponse:part-of").toLocked();
2734
2735  /**
2736   * Search parameter: <b>encounter</b>
2737   * <p>
2738   * Description: <b>Encounter associated with the questionnaire response</b><br>
2739   * Type: <b>reference</b><br>
2740   * Path: <b>QuestionnaireResponse.encounter</b><br>
2741   * </p>
2742   */
2743  @SearchParamDefinition(name = "encounter", path = "QuestionnaireResponse.encounter", description = "Encounter associated with the questionnaire response", type = "reference", providesMembershipIn = {
2744      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
2745  public static final String SP_ENCOUNTER = "encounter";
2746  /**
2747   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
2748   * <p>
2749   * Description: <b>Encounter associated with the questionnaire response</b><br>
2750   * Type: <b>reference</b><br>
2751   * Path: <b>QuestionnaireResponse.encounter</b><br>
2752   * </p>
2753   */
2754  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2755      SP_ENCOUNTER);
2756
2757  /**
2758   * Constant for fluent queries to be used to add include statements. Specifies
2759   * the path value of "<b>QuestionnaireResponse:encounter</b>".
2760   */
2761  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
2762      "QuestionnaireResponse:encounter").toLocked();
2763
2764  /**
2765   * Search parameter: <b>source</b>
2766   * <p>
2767   * Description: <b>The individual providing the information reflected in the
2768   * questionnaire respose</b><br>
2769   * Type: <b>reference</b><br>
2770   * Path: <b>QuestionnaireResponse.source</b><br>
2771   * </p>
2772   */
2773  @SearchParamDefinition(name = "source", path = "QuestionnaireResponse.source", description = "The individual providing the information reflected in the questionnaire respose", type = "reference", providesMembershipIn = {
2774      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"),
2775      @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Patient.class,
2776          Practitioner.class, PractitionerRole.class, RelatedPerson.class })
2777  public static final String SP_SOURCE = "source";
2778  /**
2779   * <b>Fluent Client</b> search parameter constant for <b>source</b>
2780   * <p>
2781   * Description: <b>The individual providing the information reflected in the
2782   * questionnaire respose</b><br>
2783   * Type: <b>reference</b><br>
2784   * Path: <b>QuestionnaireResponse.source</b><br>
2785   * </p>
2786   */
2787  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2788      SP_SOURCE);
2789
2790  /**
2791   * Constant for fluent queries to be used to add include statements. Specifies
2792   * the path value of "<b>QuestionnaireResponse:source</b>".
2793   */
2794  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include(
2795      "QuestionnaireResponse:source").toLocked();
2796
2797  /**
2798   * Search parameter: <b>status</b>
2799   * <p>
2800   * Description: <b>The status of the questionnaire response</b><br>
2801   * Type: <b>token</b><br>
2802   * Path: <b>QuestionnaireResponse.status</b><br>
2803   * </p>
2804   */
2805  @SearchParamDefinition(name = "status", path = "QuestionnaireResponse.status", description = "The status of the questionnaire response", type = "token")
2806  public static final String SP_STATUS = "status";
2807  /**
2808   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2809   * <p>
2810   * Description: <b>The status of the questionnaire response</b><br>
2811   * Type: <b>token</b><br>
2812   * Path: <b>QuestionnaireResponse.status</b><br>
2813   * </p>
2814   */
2815  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2816      SP_STATUS);
2817
2818}