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