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