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