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