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