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