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