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