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