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