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