001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import org.hl7.fhir.r5.model.Enumerations.*;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.
071 */
072@ResourceDef(name="Questionnaire", profile="http://hl7.org/fhir/StructureDefinition/Questionnaire")
073@ChildOrder(names={"url", "identifier", "version", "name", "title", "derivedFrom", "status", "experimental", "subjectType", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "approvalDate", "lastReviewDate", "effectivePeriod", "code", "item"})
074public class Questionnaire extends MetadataResource {
075
076    public enum QuestionnaireItemType {
077        /**
078         * An item with no direct answer but should have at least one child item.
079         */
080        GROUP, 
081        /**
082         * Text for display that will not capture an answer or have child items.
083         */
084        DISPLAY, 
085        /**
086         * An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).
087         */
088        QUESTION, 
089        /**
090         * Question with a yes/no answer (valueBoolean).
091         */
092        BOOLEAN, 
093        /**
094         * Question with is a real number answer (valueDecimal).
095         */
096        DECIMAL, 
097        /**
098         * Question with an integer answer (valueInteger).
099         */
100        INTEGER, 
101        /**
102         * Question with a date answer (valueDate).
103         */
104        DATE, 
105        /**
106         * Question with a date and time answer (valueDateTime).
107         */
108        DATETIME, 
109        /**
110         * Question with a time (hour:minute:second) answer independent of date. (valueTime).
111         */
112        TIME, 
113        /**
114         * Question with a short (few words to short sentence) free-text entry answer (valueString).
115         */
116        STRING, 
117        /**
118         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString).
119         */
120        TEXT, 
121        /**
122         * Question with a URL (website, FTP site, etc.) answer (valueUri).
123         */
124        URL, 
125        /**
126         * Question with a Coding drawn from a list of possible answers (specified in either the answerOption property, or via the valueset referenced in the answerValueSet property) as an answer (valueCoding).
127         */
128        CHOICE, 
129        /**
130         * Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString).
131         */
132        OPENCHOICE, 
133        /**
134         * Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).
135         */
136        ATTACHMENT, 
137        /**
138         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).
139         */
140        REFERENCE, 
141        /**
142         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).
143         */
144        QUANTITY, 
145        /**
146         * added to help the parsers with the generic types
147         */
148        NULL;
149        public static QuestionnaireItemType fromCode(String codeString) throws FHIRException {
150            if (codeString == null || "".equals(codeString))
151                return null;
152        if ("group".equals(codeString))
153          return GROUP;
154        if ("display".equals(codeString))
155          return DISPLAY;
156        if ("question".equals(codeString))
157          return QUESTION;
158        if ("boolean".equals(codeString))
159          return BOOLEAN;
160        if ("decimal".equals(codeString))
161          return DECIMAL;
162        if ("integer".equals(codeString))
163          return INTEGER;
164        if ("date".equals(codeString))
165          return DATE;
166        if ("dateTime".equals(codeString))
167          return DATETIME;
168        if ("time".equals(codeString))
169          return TIME;
170        if ("string".equals(codeString))
171          return STRING;
172        if ("text".equals(codeString))
173          return TEXT;
174        if ("url".equals(codeString))
175          return URL;
176        if ("choice".equals(codeString))
177          return CHOICE;
178        if ("open-choice".equals(codeString))
179          return OPENCHOICE;
180        if ("attachment".equals(codeString))
181          return ATTACHMENT;
182        if ("reference".equals(codeString))
183          return REFERENCE;
184        if ("quantity".equals(codeString))
185          return QUANTITY;
186        if (Configuration.isAcceptInvalidEnums())
187          return null;
188        else
189          throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
190        }
191        public String toCode() {
192          switch (this) {
193            case GROUP: return "group";
194            case DISPLAY: return "display";
195            case QUESTION: return "question";
196            case BOOLEAN: return "boolean";
197            case DECIMAL: return "decimal";
198            case INTEGER: return "integer";
199            case DATE: return "date";
200            case DATETIME: return "dateTime";
201            case TIME: return "time";
202            case STRING: return "string";
203            case TEXT: return "text";
204            case URL: return "url";
205            case CHOICE: return "choice";
206            case OPENCHOICE: return "open-choice";
207            case ATTACHMENT: return "attachment";
208            case REFERENCE: return "reference";
209            case QUANTITY: return "quantity";
210            default: return "?";
211          }
212        }
213        public String getSystem() {
214          switch (this) {
215            case GROUP: return "http://hl7.org/fhir/item-type";
216            case DISPLAY: return "http://hl7.org/fhir/item-type";
217            case QUESTION: return "http://hl7.org/fhir/item-type";
218            case BOOLEAN: return "http://hl7.org/fhir/item-type";
219            case DECIMAL: return "http://hl7.org/fhir/item-type";
220            case INTEGER: return "http://hl7.org/fhir/item-type";
221            case DATE: return "http://hl7.org/fhir/item-type";
222            case DATETIME: return "http://hl7.org/fhir/item-type";
223            case TIME: return "http://hl7.org/fhir/item-type";
224            case STRING: return "http://hl7.org/fhir/item-type";
225            case TEXT: return "http://hl7.org/fhir/item-type";
226            case URL: return "http://hl7.org/fhir/item-type";
227            case CHOICE: return "http://hl7.org/fhir/item-type";
228            case OPENCHOICE: return "http://hl7.org/fhir/item-type";
229            case ATTACHMENT: return "http://hl7.org/fhir/item-type";
230            case REFERENCE: return "http://hl7.org/fhir/item-type";
231            case QUANTITY: return "http://hl7.org/fhir/item-type";
232            default: return "?";
233          }
234        }
235        public String getDefinition() {
236          switch (this) {
237            case GROUP: return "An item with no direct answer but should have at least one child item.";
238            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
239            case QUESTION: return "An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).";
240            case BOOLEAN: return "Question with a yes/no answer (valueBoolean).";
241            case DECIMAL: return "Question with is a real number answer (valueDecimal).";
242            case INTEGER: return "Question with an integer answer (valueInteger).";
243            case DATE: return "Question with a date answer (valueDate).";
244            case DATETIME: return "Question with a date and time answer (valueDateTime).";
245            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime).";
246            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString).";
247            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString).";
248            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri).";
249            case CHOICE: return "Question with a Coding drawn from a list of possible answers (specified in either the answerOption property, or via the valueset referenced in the answerValueSet property) as an answer (valueCoding).";
250            case OPENCHOICE: return "Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString).";
251            case ATTACHMENT: return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).";
252            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).";
253            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).";
254            default: return "?";
255          }
256        }
257        public String getDisplay() {
258          switch (this) {
259            case GROUP: return "Group";
260            case DISPLAY: return "Display";
261            case QUESTION: return "Question";
262            case BOOLEAN: return "Boolean";
263            case DECIMAL: return "Decimal";
264            case INTEGER: return "Integer";
265            case DATE: return "Date";
266            case DATETIME: return "Date Time";
267            case TIME: return "Time";
268            case STRING: return "String";
269            case TEXT: return "Text";
270            case URL: return "Url";
271            case CHOICE: return "Choice";
272            case OPENCHOICE: return "Open Choice";
273            case ATTACHMENT: return "Attachment";
274            case REFERENCE: return "Reference";
275            case QUANTITY: return "Quantity";
276            default: return "?";
277          }
278        }
279    }
280
281  public static class QuestionnaireItemTypeEnumFactory implements EnumFactory<QuestionnaireItemType> {
282    public QuestionnaireItemType fromCode(String codeString) throws IllegalArgumentException {
283      if (codeString == null || "".equals(codeString))
284            if (codeString == null || "".equals(codeString))
285                return null;
286        if ("group".equals(codeString))
287          return QuestionnaireItemType.GROUP;
288        if ("display".equals(codeString))
289          return QuestionnaireItemType.DISPLAY;
290        if ("question".equals(codeString))
291          return QuestionnaireItemType.QUESTION;
292        if ("boolean".equals(codeString))
293          return QuestionnaireItemType.BOOLEAN;
294        if ("decimal".equals(codeString))
295          return QuestionnaireItemType.DECIMAL;
296        if ("integer".equals(codeString))
297          return QuestionnaireItemType.INTEGER;
298        if ("date".equals(codeString))
299          return QuestionnaireItemType.DATE;
300        if ("dateTime".equals(codeString))
301          return QuestionnaireItemType.DATETIME;
302        if ("time".equals(codeString))
303          return QuestionnaireItemType.TIME;
304        if ("string".equals(codeString))
305          return QuestionnaireItemType.STRING;
306        if ("text".equals(codeString))
307          return QuestionnaireItemType.TEXT;
308        if ("url".equals(codeString))
309          return QuestionnaireItemType.URL;
310        if ("choice".equals(codeString))
311          return QuestionnaireItemType.CHOICE;
312        if ("open-choice".equals(codeString))
313          return QuestionnaireItemType.OPENCHOICE;
314        if ("attachment".equals(codeString))
315          return QuestionnaireItemType.ATTACHMENT;
316        if ("reference".equals(codeString))
317          return QuestionnaireItemType.REFERENCE;
318        if ("quantity".equals(codeString))
319          return QuestionnaireItemType.QUANTITY;
320        throw new IllegalArgumentException("Unknown QuestionnaireItemType code '"+codeString+"'");
321        }
322        public Enumeration<QuestionnaireItemType> fromType(Base code) throws FHIRException {
323          if (code == null)
324            return null;
325          if (code.isEmpty())
326            return new Enumeration<QuestionnaireItemType>(this);
327          String codeString = ((PrimitiveType) code).asStringValue();
328          if (codeString == null || "".equals(codeString))
329            return null;
330        if ("group".equals(codeString))
331          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.GROUP);
332        if ("display".equals(codeString))
333          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DISPLAY);
334        if ("question".equals(codeString))
335          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUESTION);
336        if ("boolean".equals(codeString))
337          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.BOOLEAN);
338        if ("decimal".equals(codeString))
339          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DECIMAL);
340        if ("integer".equals(codeString))
341          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.INTEGER);
342        if ("date".equals(codeString))
343          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATE);
344        if ("dateTime".equals(codeString))
345          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATETIME);
346        if ("time".equals(codeString))
347          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TIME);
348        if ("string".equals(codeString))
349          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.STRING);
350        if ("text".equals(codeString))
351          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TEXT);
352        if ("url".equals(codeString))
353          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.URL);
354        if ("choice".equals(codeString))
355          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.CHOICE);
356        if ("open-choice".equals(codeString))
357          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.OPENCHOICE);
358        if ("attachment".equals(codeString))
359          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.ATTACHMENT);
360        if ("reference".equals(codeString))
361          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.REFERENCE);
362        if ("quantity".equals(codeString))
363          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUANTITY);
364        throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
365        }
366    public String toCode(QuestionnaireItemType code) {
367      if (code == QuestionnaireItemType.GROUP)
368        return "group";
369      if (code == QuestionnaireItemType.DISPLAY)
370        return "display";
371      if (code == QuestionnaireItemType.QUESTION)
372        return "question";
373      if (code == QuestionnaireItemType.BOOLEAN)
374        return "boolean";
375      if (code == QuestionnaireItemType.DECIMAL)
376        return "decimal";
377      if (code == QuestionnaireItemType.INTEGER)
378        return "integer";
379      if (code == QuestionnaireItemType.DATE)
380        return "date";
381      if (code == QuestionnaireItemType.DATETIME)
382        return "dateTime";
383      if (code == QuestionnaireItemType.TIME)
384        return "time";
385      if (code == QuestionnaireItemType.STRING)
386        return "string";
387      if (code == QuestionnaireItemType.TEXT)
388        return "text";
389      if (code == QuestionnaireItemType.URL)
390        return "url";
391      if (code == QuestionnaireItemType.CHOICE)
392        return "choice";
393      if (code == QuestionnaireItemType.OPENCHOICE)
394        return "open-choice";
395      if (code == QuestionnaireItemType.ATTACHMENT)
396        return "attachment";
397      if (code == QuestionnaireItemType.REFERENCE)
398        return "reference";
399      if (code == QuestionnaireItemType.QUANTITY)
400        return "quantity";
401      return "?";
402      }
403    public String toSystem(QuestionnaireItemType code) {
404      return code.getSystem();
405      }
406    }
407
408    public enum QuestionnaireItemOperator {
409        /**
410         * True if whether an answer exists is equal to the enableWhen answer (which must be a boolean).
411         */
412        EXISTS, 
413        /**
414         * True if whether at least one answer has a value that is equal to the enableWhen answer.
415         */
416        EQUAL, 
417        /**
418         * True if whether at least no answer has a value that is equal to the enableWhen answer.
419         */
420        NOT_EQUAL, 
421        /**
422         * True if whether at least no answer has a value that is greater than the enableWhen answer.
423         */
424        GREATER_THAN, 
425        /**
426         * True if whether at least no answer has a value that is less than the enableWhen answer.
427         */
428        LESS_THAN, 
429        /**
430         * True if whether at least no answer has a value that is greater or equal to the enableWhen answer.
431         */
432        GREATER_OR_EQUAL, 
433        /**
434         * True if whether at least no answer has a value that is less or equal to the enableWhen answer.
435         */
436        LESS_OR_EQUAL, 
437        /**
438         * added to help the parsers with the generic types
439         */
440        NULL;
441        public static QuestionnaireItemOperator fromCode(String codeString) throws FHIRException {
442            if (codeString == null || "".equals(codeString))
443                return null;
444        if ("exists".equals(codeString))
445          return EXISTS;
446        if ("=".equals(codeString))
447          return EQUAL;
448        if ("!=".equals(codeString))
449          return NOT_EQUAL;
450        if (">".equals(codeString))
451          return GREATER_THAN;
452        if ("<".equals(codeString))
453          return LESS_THAN;
454        if (">=".equals(codeString))
455          return GREATER_OR_EQUAL;
456        if ("<=".equals(codeString))
457          return LESS_OR_EQUAL;
458        if (Configuration.isAcceptInvalidEnums())
459          return null;
460        else
461          throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
462        }
463        public String toCode() {
464          switch (this) {
465            case EXISTS: return "exists";
466            case EQUAL: return "=";
467            case NOT_EQUAL: return "!=";
468            case GREATER_THAN: return ">";
469            case LESS_THAN: return "<";
470            case GREATER_OR_EQUAL: return ">=";
471            case LESS_OR_EQUAL: return "<=";
472            default: return "?";
473          }
474        }
475        public String getSystem() {
476          switch (this) {
477            case EXISTS: return "http://hl7.org/fhir/questionnaire-enable-operator";
478            case EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
479            case NOT_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
480            case GREATER_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
481            case LESS_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
482            case GREATER_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
483            case LESS_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
484            default: return "?";
485          }
486        }
487        public String getDefinition() {
488          switch (this) {
489            case EXISTS: return "True if whether an answer exists is equal to the enableWhen answer (which must be a boolean).";
490            case EQUAL: return "True if whether at least one answer has a value that is equal to the enableWhen answer.";
491            case NOT_EQUAL: return "True if whether at least no answer has a value that is equal to the enableWhen answer.";
492            case GREATER_THAN: return "True if whether at least no answer has a value that is greater than the enableWhen answer.";
493            case LESS_THAN: return "True if whether at least no answer has a value that is less than the enableWhen answer.";
494            case GREATER_OR_EQUAL: return "True if whether at least no answer has a value that is greater or equal to the enableWhen answer.";
495            case LESS_OR_EQUAL: return "True if whether at least no answer has a value that is less or equal to the enableWhen answer.";
496            default: return "?";
497          }
498        }
499        public String getDisplay() {
500          switch (this) {
501            case EXISTS: return "Exists";
502            case EQUAL: return "Equals";
503            case NOT_EQUAL: return "Not Equals";
504            case GREATER_THAN: return "Greater Than";
505            case LESS_THAN: return "Less Than";
506            case GREATER_OR_EQUAL: return "Greater or Equals";
507            case LESS_OR_EQUAL: return "Less or Equals";
508            default: return "?";
509          }
510        }
511    }
512
513  public static class QuestionnaireItemOperatorEnumFactory implements EnumFactory<QuestionnaireItemOperator> {
514    public QuestionnaireItemOperator fromCode(String codeString) throws IllegalArgumentException {
515      if (codeString == null || "".equals(codeString))
516            if (codeString == null || "".equals(codeString))
517                return null;
518        if ("exists".equals(codeString))
519          return QuestionnaireItemOperator.EXISTS;
520        if ("=".equals(codeString))
521          return QuestionnaireItemOperator.EQUAL;
522        if ("!=".equals(codeString))
523          return QuestionnaireItemOperator.NOT_EQUAL;
524        if (">".equals(codeString))
525          return QuestionnaireItemOperator.GREATER_THAN;
526        if ("<".equals(codeString))
527          return QuestionnaireItemOperator.LESS_THAN;
528        if (">=".equals(codeString))
529          return QuestionnaireItemOperator.GREATER_OR_EQUAL;
530        if ("<=".equals(codeString))
531          return QuestionnaireItemOperator.LESS_OR_EQUAL;
532        throw new IllegalArgumentException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
533        }
534        public Enumeration<QuestionnaireItemOperator> fromType(Base code) throws FHIRException {
535          if (code == null)
536            return null;
537          if (code.isEmpty())
538            return new Enumeration<QuestionnaireItemOperator>(this);
539          String codeString = ((PrimitiveType) code).asStringValue();
540          if (codeString == null || "".equals(codeString))
541            return null;
542        if ("exists".equals(codeString))
543          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EXISTS);
544        if ("=".equals(codeString))
545          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EQUAL);
546        if ("!=".equals(codeString))
547          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.NOT_EQUAL);
548        if (">".equals(codeString))
549          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_THAN);
550        if ("<".equals(codeString))
551          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_THAN);
552        if (">=".equals(codeString))
553          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_OR_EQUAL);
554        if ("<=".equals(codeString))
555          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_OR_EQUAL);
556        throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
557        }
558    public String toCode(QuestionnaireItemOperator code) {
559      if (code == QuestionnaireItemOperator.EXISTS)
560        return "exists";
561      if (code == QuestionnaireItemOperator.EQUAL)
562        return "=";
563      if (code == QuestionnaireItemOperator.NOT_EQUAL)
564        return "!=";
565      if (code == QuestionnaireItemOperator.GREATER_THAN)
566        return ">";
567      if (code == QuestionnaireItemOperator.LESS_THAN)
568        return "<";
569      if (code == QuestionnaireItemOperator.GREATER_OR_EQUAL)
570        return ">=";
571      if (code == QuestionnaireItemOperator.LESS_OR_EQUAL)
572        return "<=";
573      return "?";
574      }
575    public String toSystem(QuestionnaireItemOperator code) {
576      return code.getSystem();
577      }
578    }
579
580    public enum EnableWhenBehavior {
581        /**
582         * Enable the question when all the enableWhen criteria are satisfied.
583         */
584        ALL, 
585        /**
586         * Enable the question when any of the enableWhen criteria are satisfied.
587         */
588        ANY, 
589        /**
590         * added to help the parsers with the generic types
591         */
592        NULL;
593        public static EnableWhenBehavior fromCode(String codeString) throws FHIRException {
594            if (codeString == null || "".equals(codeString))
595                return null;
596        if ("all".equals(codeString))
597          return ALL;
598        if ("any".equals(codeString))
599          return ANY;
600        if (Configuration.isAcceptInvalidEnums())
601          return null;
602        else
603          throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
604        }
605        public String toCode() {
606          switch (this) {
607            case ALL: return "all";
608            case ANY: return "any";
609            default: return "?";
610          }
611        }
612        public String getSystem() {
613          switch (this) {
614            case ALL: return "http://hl7.org/fhir/questionnaire-enable-behavior";
615            case ANY: return "http://hl7.org/fhir/questionnaire-enable-behavior";
616            default: return "?";
617          }
618        }
619        public String getDefinition() {
620          switch (this) {
621            case ALL: return "Enable the question when all the enableWhen criteria are satisfied.";
622            case ANY: return "Enable the question when any of the enableWhen criteria are satisfied.";
623            default: return "?";
624          }
625        }
626        public String getDisplay() {
627          switch (this) {
628            case ALL: return "All";
629            case ANY: return "Any";
630            default: return "?";
631          }
632        }
633    }
634
635  public static class EnableWhenBehaviorEnumFactory implements EnumFactory<EnableWhenBehavior> {
636    public EnableWhenBehavior fromCode(String codeString) throws IllegalArgumentException {
637      if (codeString == null || "".equals(codeString))
638            if (codeString == null || "".equals(codeString))
639                return null;
640        if ("all".equals(codeString))
641          return EnableWhenBehavior.ALL;
642        if ("any".equals(codeString))
643          return EnableWhenBehavior.ANY;
644        throw new IllegalArgumentException("Unknown EnableWhenBehavior code '"+codeString+"'");
645        }
646        public Enumeration<EnableWhenBehavior> fromType(Base code) throws FHIRException {
647          if (code == null)
648            return null;
649          if (code.isEmpty())
650            return new Enumeration<EnableWhenBehavior>(this);
651          String codeString = ((PrimitiveType) code).asStringValue();
652          if (codeString == null || "".equals(codeString))
653            return null;
654        if ("all".equals(codeString))
655          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ALL);
656        if ("any".equals(codeString))
657          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ANY);
658        throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
659        }
660    public String toCode(EnableWhenBehavior code) {
661      if (code == EnableWhenBehavior.ALL)
662        return "all";
663      if (code == EnableWhenBehavior.ANY)
664        return "any";
665      return "?";
666      }
667    public String toSystem(EnableWhenBehavior code) {
668      return code.getSystem();
669      }
670    }
671
672    @Block()
673    public static class QuestionnaireItemComponent extends BackboneElement implements IBaseBackboneElement {
674        /**
675         * An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
676         */
677        @Child(name = "linkId", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
678        @Description(shortDefinition="Unique id for item in questionnaire", formalDefinition="An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource." )
679        protected StringType linkId;
680
681        /**
682         * This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
683
684* code (ElementDefinition.code) 
685* type (ElementDefinition.type) 
686* required (ElementDefinition.min) 
687* repeats (ElementDefinition.max) 
688* maxLength (ElementDefinition.maxLength) 
689* answerValueSet (ElementDefinition.binding)
690* options (ElementDefinition.binding).
691         */
692        @Child(name = "definition", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
693        @Description(shortDefinition="ElementDefinition - details for the item", formalDefinition="This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding)." )
694        protected UriType definition;
695
696        /**
697         * A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).
698         */
699        @Child(name = "code", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
700        @Description(shortDefinition="Corresponding concept for this item in a terminology", formalDefinition="A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers)." )
701        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
702        protected List<Coding> code;
703
704        /**
705         * A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
706         */
707        @Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
708        @Description(shortDefinition="E.g. \"1(a)\", \"2.5.3\"", formalDefinition="A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire." )
709        protected StringType prefix;
710
711        /**
712         * The name of a section, the text of a question or text content for a display item.
713         */
714        @Child(name = "text", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
715        @Description(shortDefinition="Primary text for the item", formalDefinition="The name of a section, the text of a question or text content for a display item." )
716        protected StringType text;
717
718        /**
719         * The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
720         */
721        @Child(name = "type", type = {CodeType.class}, order=6, min=1, max=1, modifier=false, summary=false)
722        @Description(shortDefinition="group | display | boolean | decimal | integer | date | dateTime +", formalDefinition="The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.)." )
723        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/item-type")
724        protected Enumeration<QuestionnaireItemType> type;
725
726        /**
727         * A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.
728         */
729        @Child(name = "enableWhen", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false)
730        @Description(shortDefinition="Only allow data when", formalDefinition="A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true." )
731        protected List<QuestionnaireItemEnableWhenComponent> enableWhen;
732
733        /**
734         * Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
735         */
736        @Child(name = "enableBehavior", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
737        @Description(shortDefinition="all | any", formalDefinition="Controls how multiple enableWhen values are interpreted -  whether all or any must be true." )
738        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-behavior")
739        protected Enumeration<EnableWhenBehavior> enableBehavior;
740
741        /**
742         * An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
743         */
744        @Child(name = "required", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
745        @Description(shortDefinition="Whether the item must be included in data results", formalDefinition="An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire." )
746        protected BooleanType required;
747
748        /**
749         * An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
750         */
751        @Child(name = "repeats", type = {BooleanType.class}, order=10, min=0, max=1, modifier=false, summary=false)
752        @Description(shortDefinition="Whether the item may repeat", formalDefinition="An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups." )
753        protected BooleanType repeats;
754
755        /**
756         * An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
757         */
758        @Child(name = "readOnly", type = {BooleanType.class}, order=11, min=0, max=1, modifier=false, summary=false)
759        @Description(shortDefinition="Don't allow human editing", formalDefinition="An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire." )
760        protected BooleanType readOnly;
761
762        /**
763         * The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
764         */
765        @Child(name = "maxLength", type = {IntegerType.class}, order=12, min=0, max=1, modifier=false, summary=false)
766        @Description(shortDefinition="No more than this many characters", formalDefinition="The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse." )
767        protected IntegerType maxLength;
768
769        /**
770         * A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
771         */
772        @Child(name = "answerValueSet", type = {CanonicalType.class}, order=13, min=0, max=1, modifier=false, summary=false)
773        @Description(shortDefinition="Valueset containing permitted answers", formalDefinition="A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question." )
774        protected CanonicalType answerValueSet;
775
776        /**
777         * One of the permitted answers for a "choice" or "open-choice" question.
778         */
779        @Child(name = "answerOption", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
780        @Description(shortDefinition="Permitted answer", formalDefinition="One of the permitted answers for a \"choice\" or \"open-choice\" question." )
781        protected List<QuestionnaireItemAnswerOptionComponent> answerOption;
782
783        /**
784         * One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.
785         */
786        @Child(name = "initial", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
787        @Description(shortDefinition="Initial value(s) when item is first rendered", formalDefinition="One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input." )
788        protected List<QuestionnaireItemInitialComponent> initial;
789
790        /**
791         * Text, questions and other groups to be nested beneath a question or group.
792         */
793        @Child(name = "item", type = {QuestionnaireItemComponent.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
794        @Description(shortDefinition="Nested questionnaire items", formalDefinition="Text, questions and other groups to be nested beneath a question or group." )
795        protected List<QuestionnaireItemComponent> item;
796
797        private static final long serialVersionUID = -1503380450L;
798
799    /**
800     * Constructor
801     */
802      public QuestionnaireItemComponent() {
803        super();
804      }
805
806    /**
807     * Constructor
808     */
809      public QuestionnaireItemComponent(StringType linkId, Enumeration<QuestionnaireItemType> type) {
810        super();
811        this.linkId = linkId;
812        this.type = type;
813      }
814
815        /**
816         * @return {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
817         */
818        public StringType getLinkIdElement() { 
819          if (this.linkId == null)
820            if (Configuration.errorOnAutoCreate())
821              throw new Error("Attempt to auto-create QuestionnaireItemComponent.linkId");
822            else if (Configuration.doAutoCreate())
823              this.linkId = new StringType(); // bb
824          return this.linkId;
825        }
826
827        public boolean hasLinkIdElement() { 
828          return this.linkId != null && !this.linkId.isEmpty();
829        }
830
831        public boolean hasLinkId() { 
832          return this.linkId != null && !this.linkId.isEmpty();
833        }
834
835        /**
836         * @param value {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
837         */
838        public QuestionnaireItemComponent setLinkIdElement(StringType value) { 
839          this.linkId = value;
840          return this;
841        }
842
843        /**
844         * @return An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
845         */
846        public String getLinkId() { 
847          return this.linkId == null ? null : this.linkId.getValue();
848        }
849
850        /**
851         * @param value An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
852         */
853        public QuestionnaireItemComponent setLinkId(String value) { 
854            if (this.linkId == null)
855              this.linkId = new StringType();
856            this.linkId.setValue(value);
857          return this;
858        }
859
860        /**
861         * @return {@link #definition} (This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
862
863* code (ElementDefinition.code) 
864* type (ElementDefinition.type) 
865* required (ElementDefinition.min) 
866* repeats (ElementDefinition.max) 
867* maxLength (ElementDefinition.maxLength) 
868* answerValueSet (ElementDefinition.binding)
869* options (ElementDefinition.binding).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
870         */
871        public UriType getDefinitionElement() { 
872          if (this.definition == null)
873            if (Configuration.errorOnAutoCreate())
874              throw new Error("Attempt to auto-create QuestionnaireItemComponent.definition");
875            else if (Configuration.doAutoCreate())
876              this.definition = new UriType(); // bb
877          return this.definition;
878        }
879
880        public boolean hasDefinitionElement() { 
881          return this.definition != null && !this.definition.isEmpty();
882        }
883
884        public boolean hasDefinition() { 
885          return this.definition != null && !this.definition.isEmpty();
886        }
887
888        /**
889         * @param value {@link #definition} (This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
890
891* code (ElementDefinition.code) 
892* type (ElementDefinition.type) 
893* required (ElementDefinition.min) 
894* repeats (ElementDefinition.max) 
895* maxLength (ElementDefinition.maxLength) 
896* answerValueSet (ElementDefinition.binding)
897* options (ElementDefinition.binding).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
898         */
899        public QuestionnaireItemComponent setDefinitionElement(UriType value) { 
900          this.definition = value;
901          return this;
902        }
903
904        /**
905         * @return This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
906
907* code (ElementDefinition.code) 
908* type (ElementDefinition.type) 
909* required (ElementDefinition.min) 
910* repeats (ElementDefinition.max) 
911* maxLength (ElementDefinition.maxLength) 
912* answerValueSet (ElementDefinition.binding)
913* options (ElementDefinition.binding).
914         */
915        public String getDefinition() { 
916          return this.definition == null ? null : this.definition.getValue();
917        }
918
919        /**
920         * @param value This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:
921
922* code (ElementDefinition.code) 
923* type (ElementDefinition.type) 
924* required (ElementDefinition.min) 
925* repeats (ElementDefinition.max) 
926* maxLength (ElementDefinition.maxLength) 
927* answerValueSet (ElementDefinition.binding)
928* options (ElementDefinition.binding).
929         */
930        public QuestionnaireItemComponent setDefinition(String value) { 
931          if (Utilities.noString(value))
932            this.definition = null;
933          else {
934            if (this.definition == null)
935              this.definition = new UriType();
936            this.definition.setValue(value);
937          }
938          return this;
939        }
940
941        /**
942         * @return {@link #code} (A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).)
943         */
944        public List<Coding> getCode() { 
945          if (this.code == null)
946            this.code = new ArrayList<Coding>();
947          return this.code;
948        }
949
950        /**
951         * @return Returns a reference to <code>this</code> for easy method chaining
952         */
953        public QuestionnaireItemComponent setCode(List<Coding> theCode) { 
954          this.code = theCode;
955          return this;
956        }
957
958        public boolean hasCode() { 
959          if (this.code == null)
960            return false;
961          for (Coding item : this.code)
962            if (!item.isEmpty())
963              return true;
964          return false;
965        }
966
967        public Coding addCode() { //3
968          Coding t = new Coding();
969          if (this.code == null)
970            this.code = new ArrayList<Coding>();
971          this.code.add(t);
972          return t;
973        }
974
975        public QuestionnaireItemComponent addCode(Coding t) { //3
976          if (t == null)
977            return this;
978          if (this.code == null)
979            this.code = new ArrayList<Coding>();
980          this.code.add(t);
981          return this;
982        }
983
984        /**
985         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
986         */
987        public Coding getCodeFirstRep() { 
988          if (getCode().isEmpty()) {
989            addCode();
990          }
991          return getCode().get(0);
992        }
993
994        /**
995         * @return {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
996         */
997        public StringType getPrefixElement() { 
998          if (this.prefix == null)
999            if (Configuration.errorOnAutoCreate())
1000              throw new Error("Attempt to auto-create QuestionnaireItemComponent.prefix");
1001            else if (Configuration.doAutoCreate())
1002              this.prefix = new StringType(); // bb
1003          return this.prefix;
1004        }
1005
1006        public boolean hasPrefixElement() { 
1007          return this.prefix != null && !this.prefix.isEmpty();
1008        }
1009
1010        public boolean hasPrefix() { 
1011          return this.prefix != null && !this.prefix.isEmpty();
1012        }
1013
1014        /**
1015         * @param value {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1016         */
1017        public QuestionnaireItemComponent setPrefixElement(StringType value) { 
1018          this.prefix = value;
1019          return this;
1020        }
1021
1022        /**
1023         * @return A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1024         */
1025        public String getPrefix() { 
1026          return this.prefix == null ? null : this.prefix.getValue();
1027        }
1028
1029        /**
1030         * @param value A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1031         */
1032        public QuestionnaireItemComponent setPrefix(String value) { 
1033          if (Utilities.noString(value))
1034            this.prefix = null;
1035          else {
1036            if (this.prefix == null)
1037              this.prefix = new StringType();
1038            this.prefix.setValue(value);
1039          }
1040          return this;
1041        }
1042
1043        /**
1044         * @return {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1045         */
1046        public StringType getTextElement() { 
1047          if (this.text == null)
1048            if (Configuration.errorOnAutoCreate())
1049              throw new Error("Attempt to auto-create QuestionnaireItemComponent.text");
1050            else if (Configuration.doAutoCreate())
1051              this.text = new StringType(); // bb
1052          return this.text;
1053        }
1054
1055        public boolean hasTextElement() { 
1056          return this.text != null && !this.text.isEmpty();
1057        }
1058
1059        public boolean hasText() { 
1060          return this.text != null && !this.text.isEmpty();
1061        }
1062
1063        /**
1064         * @param value {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1065         */
1066        public QuestionnaireItemComponent setTextElement(StringType value) { 
1067          this.text = value;
1068          return this;
1069        }
1070
1071        /**
1072         * @return The name of a section, the text of a question or text content for a display item.
1073         */
1074        public String getText() { 
1075          return this.text == null ? null : this.text.getValue();
1076        }
1077
1078        /**
1079         * @param value The name of a section, the text of a question or text content for a display item.
1080         */
1081        public QuestionnaireItemComponent setText(String value) { 
1082          if (Utilities.noString(value))
1083            this.text = null;
1084          else {
1085            if (this.text == null)
1086              this.text = new StringType();
1087            this.text.setValue(value);
1088          }
1089          return this;
1090        }
1091
1092        /**
1093         * @return {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1094         */
1095        public Enumeration<QuestionnaireItemType> getTypeElement() { 
1096          if (this.type == null)
1097            if (Configuration.errorOnAutoCreate())
1098              throw new Error("Attempt to auto-create QuestionnaireItemComponent.type");
1099            else if (Configuration.doAutoCreate())
1100              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory()); // bb
1101          return this.type;
1102        }
1103
1104        public boolean hasTypeElement() { 
1105          return this.type != null && !this.type.isEmpty();
1106        }
1107
1108        public boolean hasType() { 
1109          return this.type != null && !this.type.isEmpty();
1110        }
1111
1112        /**
1113         * @param value {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1114         */
1115        public QuestionnaireItemComponent setTypeElement(Enumeration<QuestionnaireItemType> value) { 
1116          this.type = value;
1117          return this;
1118        }
1119
1120        /**
1121         * @return The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
1122         */
1123        public QuestionnaireItemType getType() { 
1124          return this.type == null ? null : this.type.getValue();
1125        }
1126
1127        /**
1128         * @param value The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).
1129         */
1130        public QuestionnaireItemComponent setType(QuestionnaireItemType value) { 
1131            if (this.type == null)
1132              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory());
1133            this.type.setValue(value);
1134          return this;
1135        }
1136
1137        /**
1138         * @return {@link #enableWhen} (A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.)
1139         */
1140        public List<QuestionnaireItemEnableWhenComponent> getEnableWhen() { 
1141          if (this.enableWhen == null)
1142            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1143          return this.enableWhen;
1144        }
1145
1146        /**
1147         * @return Returns a reference to <code>this</code> for easy method chaining
1148         */
1149        public QuestionnaireItemComponent setEnableWhen(List<QuestionnaireItemEnableWhenComponent> theEnableWhen) { 
1150          this.enableWhen = theEnableWhen;
1151          return this;
1152        }
1153
1154        public boolean hasEnableWhen() { 
1155          if (this.enableWhen == null)
1156            return false;
1157          for (QuestionnaireItemEnableWhenComponent item : this.enableWhen)
1158            if (!item.isEmpty())
1159              return true;
1160          return false;
1161        }
1162
1163        public QuestionnaireItemEnableWhenComponent addEnableWhen() { //3
1164          QuestionnaireItemEnableWhenComponent t = new QuestionnaireItemEnableWhenComponent();
1165          if (this.enableWhen == null)
1166            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1167          this.enableWhen.add(t);
1168          return t;
1169        }
1170
1171        public QuestionnaireItemComponent addEnableWhen(QuestionnaireItemEnableWhenComponent t) { //3
1172          if (t == null)
1173            return this;
1174          if (this.enableWhen == null)
1175            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1176          this.enableWhen.add(t);
1177          return this;
1178        }
1179
1180        /**
1181         * @return The first repetition of repeating field {@link #enableWhen}, creating it if it does not already exist
1182         */
1183        public QuestionnaireItemEnableWhenComponent getEnableWhenFirstRep() { 
1184          if (getEnableWhen().isEmpty()) {
1185            addEnableWhen();
1186          }
1187          return getEnableWhen().get(0);
1188        }
1189
1190        /**
1191         * @return {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1192         */
1193        public Enumeration<EnableWhenBehavior> getEnableBehaviorElement() { 
1194          if (this.enableBehavior == null)
1195            if (Configuration.errorOnAutoCreate())
1196              throw new Error("Attempt to auto-create QuestionnaireItemComponent.enableBehavior");
1197            else if (Configuration.doAutoCreate())
1198              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory()); // bb
1199          return this.enableBehavior;
1200        }
1201
1202        public boolean hasEnableBehaviorElement() { 
1203          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1204        }
1205
1206        public boolean hasEnableBehavior() { 
1207          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1208        }
1209
1210        /**
1211         * @param value {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1212         */
1213        public QuestionnaireItemComponent setEnableBehaviorElement(Enumeration<EnableWhenBehavior> value) { 
1214          this.enableBehavior = value;
1215          return this;
1216        }
1217
1218        /**
1219         * @return Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1220         */
1221        public EnableWhenBehavior getEnableBehavior() { 
1222          return this.enableBehavior == null ? null : this.enableBehavior.getValue();
1223        }
1224
1225        /**
1226         * @param value Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1227         */
1228        public QuestionnaireItemComponent setEnableBehavior(EnableWhenBehavior value) { 
1229          if (value == null)
1230            this.enableBehavior = null;
1231          else {
1232            if (this.enableBehavior == null)
1233              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory());
1234            this.enableBehavior.setValue(value);
1235          }
1236          return this;
1237        }
1238
1239        /**
1240         * @return {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1241         */
1242        public BooleanType getRequiredElement() { 
1243          if (this.required == null)
1244            if (Configuration.errorOnAutoCreate())
1245              throw new Error("Attempt to auto-create QuestionnaireItemComponent.required");
1246            else if (Configuration.doAutoCreate())
1247              this.required = new BooleanType(); // bb
1248          return this.required;
1249        }
1250
1251        public boolean hasRequiredElement() { 
1252          return this.required != null && !this.required.isEmpty();
1253        }
1254
1255        public boolean hasRequired() { 
1256          return this.required != null && !this.required.isEmpty();
1257        }
1258
1259        /**
1260         * @param value {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1261         */
1262        public QuestionnaireItemComponent setRequiredElement(BooleanType value) { 
1263          this.required = value;
1264          return this;
1265        }
1266
1267        /**
1268         * @return An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1269         */
1270        public boolean getRequired() { 
1271          return this.required == null || this.required.isEmpty() ? false : this.required.getValue();
1272        }
1273
1274        /**
1275         * @param value An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1276         */
1277        public QuestionnaireItemComponent setRequired(boolean value) { 
1278            if (this.required == null)
1279              this.required = new BooleanType();
1280            this.required.setValue(value);
1281          return this;
1282        }
1283
1284        /**
1285         * @return {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1286         */
1287        public BooleanType getRepeatsElement() { 
1288          if (this.repeats == null)
1289            if (Configuration.errorOnAutoCreate())
1290              throw new Error("Attempt to auto-create QuestionnaireItemComponent.repeats");
1291            else if (Configuration.doAutoCreate())
1292              this.repeats = new BooleanType(); // bb
1293          return this.repeats;
1294        }
1295
1296        public boolean hasRepeatsElement() { 
1297          return this.repeats != null && !this.repeats.isEmpty();
1298        }
1299
1300        public boolean hasRepeats() { 
1301          return this.repeats != null && !this.repeats.isEmpty();
1302        }
1303
1304        /**
1305         * @param value {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1306         */
1307        public QuestionnaireItemComponent setRepeatsElement(BooleanType value) { 
1308          this.repeats = value;
1309          return this;
1310        }
1311
1312        /**
1313         * @return An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1314         */
1315        public boolean getRepeats() { 
1316          return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue();
1317        }
1318
1319        /**
1320         * @param value An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1321         */
1322        public QuestionnaireItemComponent setRepeats(boolean value) { 
1323            if (this.repeats == null)
1324              this.repeats = new BooleanType();
1325            this.repeats.setValue(value);
1326          return this;
1327        }
1328
1329        /**
1330         * @return {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1331         */
1332        public BooleanType getReadOnlyElement() { 
1333          if (this.readOnly == null)
1334            if (Configuration.errorOnAutoCreate())
1335              throw new Error("Attempt to auto-create QuestionnaireItemComponent.readOnly");
1336            else if (Configuration.doAutoCreate())
1337              this.readOnly = new BooleanType(); // bb
1338          return this.readOnly;
1339        }
1340
1341        public boolean hasReadOnlyElement() { 
1342          return this.readOnly != null && !this.readOnly.isEmpty();
1343        }
1344
1345        public boolean hasReadOnly() { 
1346          return this.readOnly != null && !this.readOnly.isEmpty();
1347        }
1348
1349        /**
1350         * @param value {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1351         */
1352        public QuestionnaireItemComponent setReadOnlyElement(BooleanType value) { 
1353          this.readOnly = value;
1354          return this;
1355        }
1356
1357        /**
1358         * @return An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1359         */
1360        public boolean getReadOnly() { 
1361          return this.readOnly == null || this.readOnly.isEmpty() ? false : this.readOnly.getValue();
1362        }
1363
1364        /**
1365         * @param value An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1366         */
1367        public QuestionnaireItemComponent setReadOnly(boolean value) { 
1368            if (this.readOnly == null)
1369              this.readOnly = new BooleanType();
1370            this.readOnly.setValue(value);
1371          return this;
1372        }
1373
1374        /**
1375         * @return {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1376         */
1377        public IntegerType getMaxLengthElement() { 
1378          if (this.maxLength == null)
1379            if (Configuration.errorOnAutoCreate())
1380              throw new Error("Attempt to auto-create QuestionnaireItemComponent.maxLength");
1381            else if (Configuration.doAutoCreate())
1382              this.maxLength = new IntegerType(); // bb
1383          return this.maxLength;
1384        }
1385
1386        public boolean hasMaxLengthElement() { 
1387          return this.maxLength != null && !this.maxLength.isEmpty();
1388        }
1389
1390        public boolean hasMaxLength() { 
1391          return this.maxLength != null && !this.maxLength.isEmpty();
1392        }
1393
1394        /**
1395         * @param value {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1396         */
1397        public QuestionnaireItemComponent setMaxLengthElement(IntegerType value) { 
1398          this.maxLength = value;
1399          return this;
1400        }
1401
1402        /**
1403         * @return The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1404         */
1405        public int getMaxLength() { 
1406          return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
1407        }
1408
1409        /**
1410         * @param value The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1411         */
1412        public QuestionnaireItemComponent setMaxLength(int value) { 
1413            if (this.maxLength == null)
1414              this.maxLength = new IntegerType();
1415            this.maxLength.setValue(value);
1416          return this;
1417        }
1418
1419        /**
1420         * @return {@link #answerValueSet} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1421         */
1422        public CanonicalType getAnswerValueSetElement() { 
1423          if (this.answerValueSet == null)
1424            if (Configuration.errorOnAutoCreate())
1425              throw new Error("Attempt to auto-create QuestionnaireItemComponent.answerValueSet");
1426            else if (Configuration.doAutoCreate())
1427              this.answerValueSet = new CanonicalType(); // bb
1428          return this.answerValueSet;
1429        }
1430
1431        public boolean hasAnswerValueSetElement() { 
1432          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1433        }
1434
1435        public boolean hasAnswerValueSet() { 
1436          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1437        }
1438
1439        /**
1440         * @param value {@link #answerValueSet} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1441         */
1442        public QuestionnaireItemComponent setAnswerValueSetElement(CanonicalType value) { 
1443          this.answerValueSet = value;
1444          return this;
1445        }
1446
1447        /**
1448         * @return A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
1449         */
1450        public String getAnswerValueSet() { 
1451          return this.answerValueSet == null ? null : this.answerValueSet.getValue();
1452        }
1453
1454        /**
1455         * @param value A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
1456         */
1457        public QuestionnaireItemComponent setAnswerValueSet(String value) { 
1458          if (Utilities.noString(value))
1459            this.answerValueSet = null;
1460          else {
1461            if (this.answerValueSet == null)
1462              this.answerValueSet = new CanonicalType();
1463            this.answerValueSet.setValue(value);
1464          }
1465          return this;
1466        }
1467
1468        /**
1469         * @return {@link #answerOption} (One of the permitted answers for a "choice" or "open-choice" question.)
1470         */
1471        public List<QuestionnaireItemAnswerOptionComponent> getAnswerOption() { 
1472          if (this.answerOption == null)
1473            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1474          return this.answerOption;
1475        }
1476
1477        /**
1478         * @return Returns a reference to <code>this</code> for easy method chaining
1479         */
1480        public QuestionnaireItemComponent setAnswerOption(List<QuestionnaireItemAnswerOptionComponent> theAnswerOption) { 
1481          this.answerOption = theAnswerOption;
1482          return this;
1483        }
1484
1485        public boolean hasAnswerOption() { 
1486          if (this.answerOption == null)
1487            return false;
1488          for (QuestionnaireItemAnswerOptionComponent item : this.answerOption)
1489            if (!item.isEmpty())
1490              return true;
1491          return false;
1492        }
1493
1494        public QuestionnaireItemAnswerOptionComponent addAnswerOption() { //3
1495          QuestionnaireItemAnswerOptionComponent t = new QuestionnaireItemAnswerOptionComponent();
1496          if (this.answerOption == null)
1497            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1498          this.answerOption.add(t);
1499          return t;
1500        }
1501
1502        public QuestionnaireItemComponent addAnswerOption(QuestionnaireItemAnswerOptionComponent t) { //3
1503          if (t == null)
1504            return this;
1505          if (this.answerOption == null)
1506            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1507          this.answerOption.add(t);
1508          return this;
1509        }
1510
1511        /**
1512         * @return The first repetition of repeating field {@link #answerOption}, creating it if it does not already exist
1513         */
1514        public QuestionnaireItemAnswerOptionComponent getAnswerOptionFirstRep() { 
1515          if (getAnswerOption().isEmpty()) {
1516            addAnswerOption();
1517          }
1518          return getAnswerOption().get(0);
1519        }
1520
1521        /**
1522         * @return {@link #initial} (One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.)
1523         */
1524        public List<QuestionnaireItemInitialComponent> getInitial() { 
1525          if (this.initial == null)
1526            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1527          return this.initial;
1528        }
1529
1530        /**
1531         * @return Returns a reference to <code>this</code> for easy method chaining
1532         */
1533        public QuestionnaireItemComponent setInitial(List<QuestionnaireItemInitialComponent> theInitial) { 
1534          this.initial = theInitial;
1535          return this;
1536        }
1537
1538        public boolean hasInitial() { 
1539          if (this.initial == null)
1540            return false;
1541          for (QuestionnaireItemInitialComponent item : this.initial)
1542            if (!item.isEmpty())
1543              return true;
1544          return false;
1545        }
1546
1547        public QuestionnaireItemInitialComponent addInitial() { //3
1548          QuestionnaireItemInitialComponent t = new QuestionnaireItemInitialComponent();
1549          if (this.initial == null)
1550            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1551          this.initial.add(t);
1552          return t;
1553        }
1554
1555        public QuestionnaireItemComponent addInitial(QuestionnaireItemInitialComponent t) { //3
1556          if (t == null)
1557            return this;
1558          if (this.initial == null)
1559            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1560          this.initial.add(t);
1561          return this;
1562        }
1563
1564        /**
1565         * @return The first repetition of repeating field {@link #initial}, creating it if it does not already exist
1566         */
1567        public QuestionnaireItemInitialComponent getInitialFirstRep() { 
1568          if (getInitial().isEmpty()) {
1569            addInitial();
1570          }
1571          return getInitial().get(0);
1572        }
1573
1574        /**
1575         * @return {@link #item} (Text, questions and other groups to be nested beneath a question or group.)
1576         */
1577        public List<QuestionnaireItemComponent> getItem() { 
1578          if (this.item == null)
1579            this.item = new ArrayList<QuestionnaireItemComponent>();
1580          return this.item;
1581        }
1582
1583        /**
1584         * @return Returns a reference to <code>this</code> for easy method chaining
1585         */
1586        public QuestionnaireItemComponent setItem(List<QuestionnaireItemComponent> theItem) { 
1587          this.item = theItem;
1588          return this;
1589        }
1590
1591        public boolean hasItem() { 
1592          if (this.item == null)
1593            return false;
1594          for (QuestionnaireItemComponent item : this.item)
1595            if (!item.isEmpty())
1596              return true;
1597          return false;
1598        }
1599
1600        public QuestionnaireItemComponent addItem() { //3
1601          QuestionnaireItemComponent t = new QuestionnaireItemComponent();
1602          if (this.item == null)
1603            this.item = new ArrayList<QuestionnaireItemComponent>();
1604          this.item.add(t);
1605          return t;
1606        }
1607
1608        public QuestionnaireItemComponent addItem(QuestionnaireItemComponent t) { //3
1609          if (t == null)
1610            return this;
1611          if (this.item == null)
1612            this.item = new ArrayList<QuestionnaireItemComponent>();
1613          this.item.add(t);
1614          return this;
1615        }
1616
1617        /**
1618         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
1619         */
1620        public QuestionnaireItemComponent getItemFirstRep() { 
1621          if (getItem().isEmpty()) {
1622            addItem();
1623          }
1624          return getItem().get(0);
1625        }
1626
1627        protected void listChildren(List<Property> children) {
1628          super.listChildren(children);
1629          children.add(new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId));
1630          children.add(new Property("definition", "uri", "This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding).", 0, 1, definition));
1631          children.add(new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code));
1632          children.add(new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix));
1633          children.add(new Property("text", "string", "The name of a section, the text of a question or text content for a display item.", 0, 1, text));
1634          children.add(new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).", 0, 1, type));
1635          children.add(new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen));
1636          children.add(new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior));
1637          children.add(new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required));
1638          children.add(new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats));
1639          children.add(new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly));
1640          children.add(new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength));
1641          children.add(new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question.", 0, 1, answerValueSet));
1642          children.add(new Property("answerOption", "", "One of the permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, answerOption));
1643          children.add(new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial));
1644          children.add(new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item));
1645        }
1646
1647        @Override
1648        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1649          switch (_hash) {
1650          case -1102667083: /*linkId*/  return new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId);
1651          case -1014418093: /*definition*/  return new Property("definition", "uri", "This element is a URI that refers to an [[[ElementDefinition]]] that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:\n\n* code (ElementDefinition.code) \n* type (ElementDefinition.type) \n* required (ElementDefinition.min) \n* repeats (ElementDefinition.max) \n* maxLength (ElementDefinition.maxLength) \n* answerValueSet (ElementDefinition.binding)\n* options (ElementDefinition.binding).", 0, 1, definition);
1652          case 3059181: /*code*/  return new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code);
1653          case -980110702: /*prefix*/  return new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix);
1654          case 3556653: /*text*/  return new Property("text", "string", "The name of a section, the text of a question or text content for a display item.", 0, 1, text);
1655          case 3575610: /*type*/  return new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).", 0, 1, type);
1656          case 1893321565: /*enableWhen*/  return new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen);
1657          case 1854802165: /*enableBehavior*/  return new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior);
1658          case -393139297: /*required*/  return new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required);
1659          case 1094288952: /*repeats*/  return new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats);
1660          case -867683742: /*readOnly*/  return new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly);
1661          case -791400086: /*maxLength*/  return new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength);
1662          case -743278833: /*answerValueSet*/  return new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question.", 0, 1, answerValueSet);
1663          case -1527878189: /*answerOption*/  return new Property("answerOption", "", "One of the permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, answerOption);
1664          case 1948342084: /*initial*/  return new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial);
1665          case 3242771: /*item*/  return new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item);
1666          default: return super.getNamedProperty(_hash, _name, _checkValid);
1667          }
1668
1669        }
1670
1671      @Override
1672      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1673        switch (hash) {
1674        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
1675        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
1676        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
1677        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
1678        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1679        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<QuestionnaireItemType>
1680        case 1893321565: /*enableWhen*/ return this.enableWhen == null ? new Base[0] : this.enableWhen.toArray(new Base[this.enableWhen.size()]); // QuestionnaireItemEnableWhenComponent
1681        case 1854802165: /*enableBehavior*/ return this.enableBehavior == null ? new Base[0] : new Base[] {this.enableBehavior}; // Enumeration<EnableWhenBehavior>
1682        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // BooleanType
1683        case 1094288952: /*repeats*/ return this.repeats == null ? new Base[0] : new Base[] {this.repeats}; // BooleanType
1684        case -867683742: /*readOnly*/ return this.readOnly == null ? new Base[0] : new Base[] {this.readOnly}; // BooleanType
1685        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
1686        case -743278833: /*answerValueSet*/ return this.answerValueSet == null ? new Base[0] : new Base[] {this.answerValueSet}; // CanonicalType
1687        case -1527878189: /*answerOption*/ return this.answerOption == null ? new Base[0] : this.answerOption.toArray(new Base[this.answerOption.size()]); // QuestionnaireItemAnswerOptionComponent
1688        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : this.initial.toArray(new Base[this.initial.size()]); // QuestionnaireItemInitialComponent
1689        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
1690        default: return super.getProperty(hash, name, checkValid);
1691        }
1692
1693      }
1694
1695      @Override
1696      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1697        switch (hash) {
1698        case -1102667083: // linkId
1699          this.linkId = castToString(value); // StringType
1700          return value;
1701        case -1014418093: // definition
1702          this.definition = castToUri(value); // UriType
1703          return value;
1704        case 3059181: // code
1705          this.getCode().add(castToCoding(value)); // Coding
1706          return value;
1707        case -980110702: // prefix
1708          this.prefix = castToString(value); // StringType
1709          return value;
1710        case 3556653: // text
1711          this.text = castToString(value); // StringType
1712          return value;
1713        case 3575610: // type
1714          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1715          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1716          return value;
1717        case 1893321565: // enableWhen
1718          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value); // QuestionnaireItemEnableWhenComponent
1719          return value;
1720        case 1854802165: // enableBehavior
1721          value = new EnableWhenBehaviorEnumFactory().fromType(castToCode(value));
1722          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
1723          return value;
1724        case -393139297: // required
1725          this.required = castToBoolean(value); // BooleanType
1726          return value;
1727        case 1094288952: // repeats
1728          this.repeats = castToBoolean(value); // BooleanType
1729          return value;
1730        case -867683742: // readOnly
1731          this.readOnly = castToBoolean(value); // BooleanType
1732          return value;
1733        case -791400086: // maxLength
1734          this.maxLength = castToInteger(value); // IntegerType
1735          return value;
1736        case -743278833: // answerValueSet
1737          this.answerValueSet = castToCanonical(value); // CanonicalType
1738          return value;
1739        case -1527878189: // answerOption
1740          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value); // QuestionnaireItemAnswerOptionComponent
1741          return value;
1742        case 1948342084: // initial
1743          this.getInitial().add((QuestionnaireItemInitialComponent) value); // QuestionnaireItemInitialComponent
1744          return value;
1745        case 3242771: // item
1746          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
1747          return value;
1748        default: return super.setProperty(hash, name, value);
1749        }
1750
1751      }
1752
1753      @Override
1754      public Base setProperty(String name, Base value) throws FHIRException {
1755        if (name.equals("linkId")) {
1756          this.linkId = castToString(value); // StringType
1757        } else if (name.equals("definition")) {
1758          this.definition = castToUri(value); // UriType
1759        } else if (name.equals("code")) {
1760          this.getCode().add(castToCoding(value));
1761        } else if (name.equals("prefix")) {
1762          this.prefix = castToString(value); // StringType
1763        } else if (name.equals("text")) {
1764          this.text = castToString(value); // StringType
1765        } else if (name.equals("type")) {
1766          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1767          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1768        } else if (name.equals("enableWhen")) {
1769          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value);
1770        } else if (name.equals("enableBehavior")) {
1771          value = new EnableWhenBehaviorEnumFactory().fromType(castToCode(value));
1772          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
1773        } else if (name.equals("required")) {
1774          this.required = castToBoolean(value); // BooleanType
1775        } else if (name.equals("repeats")) {
1776          this.repeats = castToBoolean(value); // BooleanType
1777        } else if (name.equals("readOnly")) {
1778          this.readOnly = castToBoolean(value); // BooleanType
1779        } else if (name.equals("maxLength")) {
1780          this.maxLength = castToInteger(value); // IntegerType
1781        } else if (name.equals("answerValueSet")) {
1782          this.answerValueSet = castToCanonical(value); // CanonicalType
1783        } else if (name.equals("answerOption")) {
1784          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value);
1785        } else if (name.equals("initial")) {
1786          this.getInitial().add((QuestionnaireItemInitialComponent) value);
1787        } else if (name.equals("item")) {
1788          this.getItem().add((QuestionnaireItemComponent) value);
1789        } else
1790          return super.setProperty(name, value);
1791        return value;
1792      }
1793
1794      @Override
1795      public Base makeProperty(int hash, String name) throws FHIRException {
1796        switch (hash) {
1797        case -1102667083:  return getLinkIdElement();
1798        case -1014418093:  return getDefinitionElement();
1799        case 3059181:  return addCode(); 
1800        case -980110702:  return getPrefixElement();
1801        case 3556653:  return getTextElement();
1802        case 3575610:  return getTypeElement();
1803        case 1893321565:  return addEnableWhen(); 
1804        case 1854802165:  return getEnableBehaviorElement();
1805        case -393139297:  return getRequiredElement();
1806        case 1094288952:  return getRepeatsElement();
1807        case -867683742:  return getReadOnlyElement();
1808        case -791400086:  return getMaxLengthElement();
1809        case -743278833:  return getAnswerValueSetElement();
1810        case -1527878189:  return addAnswerOption(); 
1811        case 1948342084:  return addInitial(); 
1812        case 3242771:  return addItem(); 
1813        default: return super.makeProperty(hash, name);
1814        }
1815
1816      }
1817
1818      @Override
1819      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1820        switch (hash) {
1821        case -1102667083: /*linkId*/ return new String[] {"string"};
1822        case -1014418093: /*definition*/ return new String[] {"uri"};
1823        case 3059181: /*code*/ return new String[] {"Coding"};
1824        case -980110702: /*prefix*/ return new String[] {"string"};
1825        case 3556653: /*text*/ return new String[] {"string"};
1826        case 3575610: /*type*/ return new String[] {"code"};
1827        case 1893321565: /*enableWhen*/ return new String[] {};
1828        case 1854802165: /*enableBehavior*/ return new String[] {"code"};
1829        case -393139297: /*required*/ return new String[] {"boolean"};
1830        case 1094288952: /*repeats*/ return new String[] {"boolean"};
1831        case -867683742: /*readOnly*/ return new String[] {"boolean"};
1832        case -791400086: /*maxLength*/ return new String[] {"integer"};
1833        case -743278833: /*answerValueSet*/ return new String[] {"canonical"};
1834        case -1527878189: /*answerOption*/ return new String[] {};
1835        case 1948342084: /*initial*/ return new String[] {};
1836        case 3242771: /*item*/ return new String[] {"@Questionnaire.item"};
1837        default: return super.getTypesForProperty(hash, name);
1838        }
1839
1840      }
1841
1842      @Override
1843      public Base addChild(String name) throws FHIRException {
1844        if (name.equals("linkId")) {
1845          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.linkId");
1846        }
1847        else if (name.equals("definition")) {
1848          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.definition");
1849        }
1850        else if (name.equals("code")) {
1851          return addCode();
1852        }
1853        else if (name.equals("prefix")) {
1854          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.prefix");
1855        }
1856        else if (name.equals("text")) {
1857          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.text");
1858        }
1859        else if (name.equals("type")) {
1860          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.type");
1861        }
1862        else if (name.equals("enableWhen")) {
1863          return addEnableWhen();
1864        }
1865        else if (name.equals("enableBehavior")) {
1866          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.enableBehavior");
1867        }
1868        else if (name.equals("required")) {
1869          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.required");
1870        }
1871        else if (name.equals("repeats")) {
1872          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.repeats");
1873        }
1874        else if (name.equals("readOnly")) {
1875          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.readOnly");
1876        }
1877        else if (name.equals("maxLength")) {
1878          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.maxLength");
1879        }
1880        else if (name.equals("answerValueSet")) {
1881          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.answerValueSet");
1882        }
1883        else if (name.equals("answerOption")) {
1884          return addAnswerOption();
1885        }
1886        else if (name.equals("initial")) {
1887          return addInitial();
1888        }
1889        else if (name.equals("item")) {
1890          return addItem();
1891        }
1892        else
1893          return super.addChild(name);
1894      }
1895
1896      public QuestionnaireItemComponent copy() {
1897        QuestionnaireItemComponent dst = new QuestionnaireItemComponent();
1898        copyValues(dst);
1899        return dst;
1900      }
1901
1902      public void copyValues(QuestionnaireItemComponent dst) {
1903        super.copyValues(dst);
1904        dst.linkId = linkId == null ? null : linkId.copy();
1905        dst.definition = definition == null ? null : definition.copy();
1906        if (code != null) {
1907          dst.code = new ArrayList<Coding>();
1908          for (Coding i : code)
1909            dst.code.add(i.copy());
1910        };
1911        dst.prefix = prefix == null ? null : prefix.copy();
1912        dst.text = text == null ? null : text.copy();
1913        dst.type = type == null ? null : type.copy();
1914        if (enableWhen != null) {
1915          dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1916          for (QuestionnaireItemEnableWhenComponent i : enableWhen)
1917            dst.enableWhen.add(i.copy());
1918        };
1919        dst.enableBehavior = enableBehavior == null ? null : enableBehavior.copy();
1920        dst.required = required == null ? null : required.copy();
1921        dst.repeats = repeats == null ? null : repeats.copy();
1922        dst.readOnly = readOnly == null ? null : readOnly.copy();
1923        dst.maxLength = maxLength == null ? null : maxLength.copy();
1924        dst.answerValueSet = answerValueSet == null ? null : answerValueSet.copy();
1925        if (answerOption != null) {
1926          dst.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1927          for (QuestionnaireItemAnswerOptionComponent i : answerOption)
1928            dst.answerOption.add(i.copy());
1929        };
1930        if (initial != null) {
1931          dst.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1932          for (QuestionnaireItemInitialComponent i : initial)
1933            dst.initial.add(i.copy());
1934        };
1935        if (item != null) {
1936          dst.item = new ArrayList<QuestionnaireItemComponent>();
1937          for (QuestionnaireItemComponent i : item)
1938            dst.item.add(i.copy());
1939        };
1940      }
1941
1942      @Override
1943      public boolean equalsDeep(Base other_) {
1944        if (!super.equalsDeep(other_))
1945          return false;
1946        if (!(other_ instanceof QuestionnaireItemComponent))
1947          return false;
1948        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1949        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(code, o.code, true)
1950           && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true) && compareDeep(type, o.type, true)
1951           && compareDeep(enableWhen, o.enableWhen, true) && compareDeep(enableBehavior, o.enableBehavior, true)
1952           && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true) && compareDeep(readOnly, o.readOnly, true)
1953           && compareDeep(maxLength, o.maxLength, true) && compareDeep(answerValueSet, o.answerValueSet, true)
1954           && compareDeep(answerOption, o.answerOption, true) && compareDeep(initial, o.initial, true) && compareDeep(item, o.item, true)
1955          ;
1956      }
1957
1958      @Override
1959      public boolean equalsShallow(Base other_) {
1960        if (!super.equalsShallow(other_))
1961          return false;
1962        if (!(other_ instanceof QuestionnaireItemComponent))
1963          return false;
1964        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1965        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(prefix, o.prefix, true)
1966           && compareValues(text, o.text, true) && compareValues(type, o.type, true) && compareValues(enableBehavior, o.enableBehavior, true)
1967           && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true) && compareValues(readOnly, o.readOnly, true)
1968           && compareValues(maxLength, o.maxLength, true);
1969      }
1970
1971      public boolean isEmpty() {
1972        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code
1973          , prefix, text, type, enableWhen, enableBehavior, required, repeats, readOnly
1974          , maxLength, answerValueSet, answerOption, initial, item);
1975      }
1976
1977  public String fhirType() {
1978    return "Questionnaire.item";
1979
1980  }
1981
1982// added from java-adornments.txt:
1983
1984      public QuestionnaireItemComponent getQuestion(String linkId) {
1985        if (linkId == null)
1986          return null;
1987        for (QuestionnaireItemComponent i : getItem()) {
1988          if (i.getLinkId().equals(linkId))
1989            return i;
1990          QuestionnaireItemComponent t = i.getQuestion(linkId);
1991          if (t != null)
1992            return t;
1993        }
1994        return null;
1995      }
1996
1997      public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
1998        if (q1 == null || q2 == null)
1999          return null;
2000        for (QuestionnaireItemComponent i : getItem()) {
2001          QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
2002          if (t != null)
2003            return t;
2004        }
2005        if (containsQuestion(q1) && containsQuestion(q2))
2006          return this;
2007        return null;
2008      }
2009
2010      public boolean containsQuestion(QuestionnaireItemComponent q) {
2011        if (q == this)
2012          return true;
2013        for (QuestionnaireItemComponent i : getItem()) {
2014          if (i.containsQuestion(q))
2015            return true;
2016        }
2017        return false;
2018      }
2019      
2020
2021// end addition
2022  }
2023
2024    @Block()
2025    public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
2026        /**
2027         * The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2028         */
2029        @Child(name = "question", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2030        @Description(shortDefinition="Question that determines whether item is enabled", formalDefinition="The linkId for the question whose answer (or lack of answer) governs whether this item is enabled." )
2031        protected StringType question;
2032
2033        /**
2034         * Specifies the criteria by which the question is enabled.
2035         */
2036        @Child(name = "operator", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2037        @Description(shortDefinition="exists | = | != | > | < | >= | <=", formalDefinition="Specifies the criteria by which the question is enabled." )
2038        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-operator")
2039        protected Enumeration<QuestionnaireItemOperator> operator;
2040
2041        /**
2042         * A value that the referenced question is tested using the specified operator in order for the item to be enabled.
2043         */
2044        @Child(name = "answer", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, Coding.class, Quantity.class, Reference.class}, order=3, min=1, max=1, modifier=false, summary=false)
2045        @Description(shortDefinition="Value for question comparison based on operator", formalDefinition="A value that the referenced question is tested using the specified operator in order for the item to be enabled." )
2046        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2047        protected Type answer;
2048
2049        private static final long serialVersionUID = -1815133868L;
2050
2051    /**
2052     * Constructor
2053     */
2054      public QuestionnaireItemEnableWhenComponent() {
2055        super();
2056      }
2057
2058    /**
2059     * Constructor
2060     */
2061      public QuestionnaireItemEnableWhenComponent(StringType question, Enumeration<QuestionnaireItemOperator> operator, Type answer) {
2062        super();
2063        this.question = question;
2064        this.operator = operator;
2065        this.answer = answer;
2066      }
2067
2068        /**
2069         * @return {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2070         */
2071        public StringType getQuestionElement() { 
2072          if (this.question == null)
2073            if (Configuration.errorOnAutoCreate())
2074              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
2075            else if (Configuration.doAutoCreate())
2076              this.question = new StringType(); // bb
2077          return this.question;
2078        }
2079
2080        public boolean hasQuestionElement() { 
2081          return this.question != null && !this.question.isEmpty();
2082        }
2083
2084        public boolean hasQuestion() { 
2085          return this.question != null && !this.question.isEmpty();
2086        }
2087
2088        /**
2089         * @param value {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2090         */
2091        public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) { 
2092          this.question = value;
2093          return this;
2094        }
2095
2096        /**
2097         * @return The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2098         */
2099        public String getQuestion() { 
2100          return this.question == null ? null : this.question.getValue();
2101        }
2102
2103        /**
2104         * @param value The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2105         */
2106        public QuestionnaireItemEnableWhenComponent setQuestion(String value) { 
2107            if (this.question == null)
2108              this.question = new StringType();
2109            this.question.setValue(value);
2110          return this;
2111        }
2112
2113        /**
2114         * @return {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2115         */
2116        public Enumeration<QuestionnaireItemOperator> getOperatorElement() { 
2117          if (this.operator == null)
2118            if (Configuration.errorOnAutoCreate())
2119              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.operator");
2120            else if (Configuration.doAutoCreate())
2121              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory()); // bb
2122          return this.operator;
2123        }
2124
2125        public boolean hasOperatorElement() { 
2126          return this.operator != null && !this.operator.isEmpty();
2127        }
2128
2129        public boolean hasOperator() { 
2130          return this.operator != null && !this.operator.isEmpty();
2131        }
2132
2133        /**
2134         * @param value {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2135         */
2136        public QuestionnaireItemEnableWhenComponent setOperatorElement(Enumeration<QuestionnaireItemOperator> value) { 
2137          this.operator = value;
2138          return this;
2139        }
2140
2141        /**
2142         * @return Specifies the criteria by which the question is enabled.
2143         */
2144        public QuestionnaireItemOperator getOperator() { 
2145          return this.operator == null ? null : this.operator.getValue();
2146        }
2147
2148        /**
2149         * @param value Specifies the criteria by which the question is enabled.
2150         */
2151        public QuestionnaireItemEnableWhenComponent setOperator(QuestionnaireItemOperator value) { 
2152            if (this.operator == null)
2153              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory());
2154            this.operator.setValue(value);
2155          return this;
2156        }
2157
2158        /**
2159         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2160         */
2161        public Type getAnswer() { 
2162          return this.answer;
2163        }
2164
2165        /**
2166         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2167         */
2168        public BooleanType getAnswerBooleanType() throws FHIRException { 
2169          if (this.answer == null)
2170            this.answer = new BooleanType();
2171          if (!(this.answer instanceof BooleanType))
2172            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.answer.getClass().getName()+" was encountered");
2173          return (BooleanType) this.answer;
2174        }
2175
2176        public boolean hasAnswerBooleanType() { 
2177          return this != null && this.answer instanceof BooleanType;
2178        }
2179
2180        /**
2181         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2182         */
2183        public DecimalType getAnswerDecimalType() throws FHIRException { 
2184          if (this.answer == null)
2185            this.answer = new DecimalType();
2186          if (!(this.answer instanceof DecimalType))
2187            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.answer.getClass().getName()+" was encountered");
2188          return (DecimalType) this.answer;
2189        }
2190
2191        public boolean hasAnswerDecimalType() { 
2192          return this != null && this.answer instanceof DecimalType;
2193        }
2194
2195        /**
2196         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2197         */
2198        public IntegerType getAnswerIntegerType() throws FHIRException { 
2199          if (this.answer == null)
2200            this.answer = new IntegerType();
2201          if (!(this.answer instanceof IntegerType))
2202            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.answer.getClass().getName()+" was encountered");
2203          return (IntegerType) this.answer;
2204        }
2205
2206        public boolean hasAnswerIntegerType() { 
2207          return this != null && this.answer instanceof IntegerType;
2208        }
2209
2210        /**
2211         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2212         */
2213        public DateType getAnswerDateType() throws FHIRException { 
2214          if (this.answer == null)
2215            this.answer = new DateType();
2216          if (!(this.answer instanceof DateType))
2217            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.answer.getClass().getName()+" was encountered");
2218          return (DateType) this.answer;
2219        }
2220
2221        public boolean hasAnswerDateType() { 
2222          return this != null && this.answer instanceof DateType;
2223        }
2224
2225        /**
2226         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2227         */
2228        public DateTimeType getAnswerDateTimeType() throws FHIRException { 
2229          if (this.answer == null)
2230            this.answer = new DateTimeType();
2231          if (!(this.answer instanceof DateTimeType))
2232            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2233          return (DateTimeType) this.answer;
2234        }
2235
2236        public boolean hasAnswerDateTimeType() { 
2237          return this != null && this.answer instanceof DateTimeType;
2238        }
2239
2240        /**
2241         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2242         */
2243        public TimeType getAnswerTimeType() throws FHIRException { 
2244          if (this.answer == null)
2245            this.answer = new TimeType();
2246          if (!(this.answer instanceof TimeType))
2247            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2248          return (TimeType) this.answer;
2249        }
2250
2251        public boolean hasAnswerTimeType() { 
2252          return this != null && this.answer instanceof TimeType;
2253        }
2254
2255        /**
2256         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2257         */
2258        public StringType getAnswerStringType() throws FHIRException { 
2259          if (this.answer == null)
2260            this.answer = new StringType();
2261          if (!(this.answer instanceof StringType))
2262            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.answer.getClass().getName()+" was encountered");
2263          return (StringType) this.answer;
2264        }
2265
2266        public boolean hasAnswerStringType() { 
2267          return this != null && this.answer instanceof StringType;
2268        }
2269
2270        /**
2271         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2272         */
2273        public Coding getAnswerCoding() throws FHIRException { 
2274          if (this.answer == null)
2275            this.answer = new Coding();
2276          if (!(this.answer instanceof Coding))
2277            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.answer.getClass().getName()+" was encountered");
2278          return (Coding) this.answer;
2279        }
2280
2281        public boolean hasAnswerCoding() { 
2282          return this != null && this.answer instanceof Coding;
2283        }
2284
2285        /**
2286         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2287         */
2288        public Quantity getAnswerQuantity() throws FHIRException { 
2289          if (this.answer == null)
2290            this.answer = new Quantity();
2291          if (!(this.answer instanceof Quantity))
2292            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.answer.getClass().getName()+" was encountered");
2293          return (Quantity) this.answer;
2294        }
2295
2296        public boolean hasAnswerQuantity() { 
2297          return this != null && this.answer instanceof Quantity;
2298        }
2299
2300        /**
2301         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2302         */
2303        public Reference getAnswerReference() throws FHIRException { 
2304          if (this.answer == null)
2305            this.answer = new Reference();
2306          if (!(this.answer instanceof Reference))
2307            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.answer.getClass().getName()+" was encountered");
2308          return (Reference) this.answer;
2309        }
2310
2311        public boolean hasAnswerReference() { 
2312          return this != null && this.answer instanceof Reference;
2313        }
2314
2315        public boolean hasAnswer() { 
2316          return this.answer != null && !this.answer.isEmpty();
2317        }
2318
2319        /**
2320         * @param value {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2321         */
2322        public QuestionnaireItemEnableWhenComponent setAnswer(Type value) { 
2323          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 Coding || value instanceof Quantity || value instanceof Reference))
2324            throw new Error("Not the right type for Questionnaire.item.enableWhen.answer[x]: "+value.fhirType());
2325          this.answer = value;
2326          return this;
2327        }
2328
2329        protected void listChildren(List<Property> children) {
2330          super.listChildren(children);
2331          children.add(new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question));
2332          children.add(new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator));
2333          children.add(new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer));
2334        }
2335
2336        @Override
2337        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2338          switch (_hash) {
2339          case -1165870106: /*question*/  return new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question);
2340          case -500553564: /*operator*/  return new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator);
2341          case 1693524994: /*answer[x]*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2342          case -1412808770: /*answer*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2343          case 1194603146: /*answerBoolean*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2344          case -1622812237: /*answerDecimal*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2345          case -1207023712: /*answerInteger*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2346          case 958960780: /*answerDate*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2347          case -1835321991: /*answerDateTime*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2348          case 959444907: /*answerTime*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2349          case -1409727121: /*answerString*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2350          case -1872828216: /*answerCoding*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2351          case -618108311: /*answerQuantity*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2352          case -1726221011: /*answerReference*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.", 0, 1, answer);
2353          default: return super.getNamedProperty(_hash, _name, _checkValid);
2354          }
2355
2356        }
2357
2358      @Override
2359      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2360        switch (hash) {
2361        case -1165870106: /*question*/ return this.question == null ? new Base[0] : new Base[] {this.question}; // StringType
2362        case -500553564: /*operator*/ return this.operator == null ? new Base[0] : new Base[] {this.operator}; // Enumeration<QuestionnaireItemOperator>
2363        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : new Base[] {this.answer}; // Type
2364        default: return super.getProperty(hash, name, checkValid);
2365        }
2366
2367      }
2368
2369      @Override
2370      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2371        switch (hash) {
2372        case -1165870106: // question
2373          this.question = castToString(value); // StringType
2374          return value;
2375        case -500553564: // operator
2376          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2377          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2378          return value;
2379        case -1412808770: // answer
2380          this.answer = castToType(value); // Type
2381          return value;
2382        default: return super.setProperty(hash, name, value);
2383        }
2384
2385      }
2386
2387      @Override
2388      public Base setProperty(String name, Base value) throws FHIRException {
2389        if (name.equals("question")) {
2390          this.question = castToString(value); // StringType
2391        } else if (name.equals("operator")) {
2392          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2393          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2394        } else if (name.equals("answer[x]")) {
2395          this.answer = castToType(value); // Type
2396        } else
2397          return super.setProperty(name, value);
2398        return value;
2399      }
2400
2401      @Override
2402      public Base makeProperty(int hash, String name) throws FHIRException {
2403        switch (hash) {
2404        case -1165870106:  return getQuestionElement();
2405        case -500553564:  return getOperatorElement();
2406        case 1693524994:  return getAnswer();
2407        case -1412808770:  return getAnswer();
2408        default: return super.makeProperty(hash, name);
2409        }
2410
2411      }
2412
2413      @Override
2414      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2415        switch (hash) {
2416        case -1165870106: /*question*/ return new String[] {"string"};
2417        case -500553564: /*operator*/ return new String[] {"code"};
2418        case -1412808770: /*answer*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "Coding", "Quantity", "Reference"};
2419        default: return super.getTypesForProperty(hash, name);
2420        }
2421
2422      }
2423
2424      @Override
2425      public Base addChild(String name) throws FHIRException {
2426        if (name.equals("question")) {
2427          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.question");
2428        }
2429        else if (name.equals("operator")) {
2430          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.operator");
2431        }
2432        else if (name.equals("answerBoolean")) {
2433          this.answer = new BooleanType();
2434          return this.answer;
2435        }
2436        else if (name.equals("answerDecimal")) {
2437          this.answer = new DecimalType();
2438          return this.answer;
2439        }
2440        else if (name.equals("answerInteger")) {
2441          this.answer = new IntegerType();
2442          return this.answer;
2443        }
2444        else if (name.equals("answerDate")) {
2445          this.answer = new DateType();
2446          return this.answer;
2447        }
2448        else if (name.equals("answerDateTime")) {
2449          this.answer = new DateTimeType();
2450          return this.answer;
2451        }
2452        else if (name.equals("answerTime")) {
2453          this.answer = new TimeType();
2454          return this.answer;
2455        }
2456        else if (name.equals("answerString")) {
2457          this.answer = new StringType();
2458          return this.answer;
2459        }
2460        else if (name.equals("answerCoding")) {
2461          this.answer = new Coding();
2462          return this.answer;
2463        }
2464        else if (name.equals("answerQuantity")) {
2465          this.answer = new Quantity();
2466          return this.answer;
2467        }
2468        else if (name.equals("answerReference")) {
2469          this.answer = new Reference();
2470          return this.answer;
2471        }
2472        else
2473          return super.addChild(name);
2474      }
2475
2476      public QuestionnaireItemEnableWhenComponent copy() {
2477        QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
2478        copyValues(dst);
2479        return dst;
2480      }
2481
2482      public void copyValues(QuestionnaireItemEnableWhenComponent dst) {
2483        super.copyValues(dst);
2484        dst.question = question == null ? null : question.copy();
2485        dst.operator = operator == null ? null : operator.copy();
2486        dst.answer = answer == null ? null : answer.copy();
2487      }
2488
2489      @Override
2490      public boolean equalsDeep(Base other_) {
2491        if (!super.equalsDeep(other_))
2492          return false;
2493        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2494          return false;
2495        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2496        return compareDeep(question, o.question, true) && compareDeep(operator, o.operator, true) && compareDeep(answer, o.answer, true)
2497          ;
2498      }
2499
2500      @Override
2501      public boolean equalsShallow(Base other_) {
2502        if (!super.equalsShallow(other_))
2503          return false;
2504        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2505          return false;
2506        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2507        return compareValues(question, o.question, true) && compareValues(operator, o.operator, true);
2508      }
2509
2510      public boolean isEmpty() {
2511        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, operator, answer
2512          );
2513      }
2514
2515  public String fhirType() {
2516    return "Questionnaire.item.enableWhen";
2517
2518  }
2519
2520  }
2521
2522    @Block()
2523    public static class QuestionnaireItemAnswerOptionComponent extends BackboneElement implements IBaseBackboneElement {
2524        /**
2525         * A potential answer that's allowed as the answer to this question.
2526         */
2527        @Child(name = "value", type = {IntegerType.class, DateType.class, TimeType.class, StringType.class, Coding.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
2528        @Description(shortDefinition="Answer value", formalDefinition="A potential answer that's allowed as the answer to this question." )
2529        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2530        protected Type value;
2531
2532        /**
2533         * Indicates whether the answer value is selected when the list of possible answers is initially shown.
2534         */
2535        @Child(name = "initialSelected", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2536        @Description(shortDefinition="Whether option is selected by default", formalDefinition="Indicates whether the answer value is selected when the list of possible answers is initially shown." )
2537        protected BooleanType initialSelected;
2538
2539        private static final long serialVersionUID = 1703686148L;
2540
2541    /**
2542     * Constructor
2543     */
2544      public QuestionnaireItemAnswerOptionComponent() {
2545        super();
2546      }
2547
2548    /**
2549     * Constructor
2550     */
2551      public QuestionnaireItemAnswerOptionComponent(Type value) {
2552        super();
2553        this.value = value;
2554      }
2555
2556        /**
2557         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2558         */
2559        public Type getValue() { 
2560          return this.value;
2561        }
2562
2563        /**
2564         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2565         */
2566        public IntegerType getValueIntegerType() throws FHIRException { 
2567          if (this.value == null)
2568            this.value = new IntegerType();
2569          if (!(this.value instanceof IntegerType))
2570            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2571          return (IntegerType) this.value;
2572        }
2573
2574        public boolean hasValueIntegerType() { 
2575          return this != null && this.value instanceof IntegerType;
2576        }
2577
2578        /**
2579         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2580         */
2581        public DateType getValueDateType() throws FHIRException { 
2582          if (this.value == null)
2583            this.value = new DateType();
2584          if (!(this.value instanceof DateType))
2585            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2586          return (DateType) this.value;
2587        }
2588
2589        public boolean hasValueDateType() { 
2590          return this != null && this.value instanceof DateType;
2591        }
2592
2593        /**
2594         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2595         */
2596        public TimeType getValueTimeType() throws FHIRException { 
2597          if (this.value == null)
2598            this.value = new TimeType();
2599          if (!(this.value instanceof TimeType))
2600            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2601          return (TimeType) this.value;
2602        }
2603
2604        public boolean hasValueTimeType() { 
2605          return this != null && this.value instanceof TimeType;
2606        }
2607
2608        /**
2609         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2610         */
2611        public StringType getValueStringType() throws FHIRException { 
2612          if (this.value == null)
2613            this.value = new StringType();
2614          if (!(this.value instanceof StringType))
2615            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2616          return (StringType) this.value;
2617        }
2618
2619        public boolean hasValueStringType() { 
2620          return this != null && this.value instanceof StringType;
2621        }
2622
2623        /**
2624         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2625         */
2626        public Coding getValueCoding() throws FHIRException { 
2627          if (this.value == null)
2628            this.value = new Coding();
2629          if (!(this.value instanceof Coding))
2630            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2631          return (Coding) this.value;
2632        }
2633
2634        public boolean hasValueCoding() { 
2635          return this != null && this.value instanceof Coding;
2636        }
2637
2638        /**
2639         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2640         */
2641        public Reference getValueReference() throws FHIRException { 
2642          if (this.value == null)
2643            this.value = new Reference();
2644          if (!(this.value instanceof Reference))
2645            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
2646          return (Reference) this.value;
2647        }
2648
2649        public boolean hasValueReference() { 
2650          return this != null && this.value instanceof Reference;
2651        }
2652
2653        public boolean hasValue() { 
2654          return this.value != null && !this.value.isEmpty();
2655        }
2656
2657        /**
2658         * @param value {@link #value} (A potential answer that's allowed as the answer to this question.)
2659         */
2660        public QuestionnaireItemAnswerOptionComponent setValue(Type value) { 
2661          if (value != null && !(value instanceof IntegerType || value instanceof DateType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Reference))
2662            throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: "+value.fhirType());
2663          this.value = value;
2664          return this;
2665        }
2666
2667        /**
2668         * @return {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2669         */
2670        public BooleanType getInitialSelectedElement() { 
2671          if (this.initialSelected == null)
2672            if (Configuration.errorOnAutoCreate())
2673              throw new Error("Attempt to auto-create QuestionnaireItemAnswerOptionComponent.initialSelected");
2674            else if (Configuration.doAutoCreate())
2675              this.initialSelected = new BooleanType(); // bb
2676          return this.initialSelected;
2677        }
2678
2679        public boolean hasInitialSelectedElement() { 
2680          return this.initialSelected != null && !this.initialSelected.isEmpty();
2681        }
2682
2683        public boolean hasInitialSelected() { 
2684          return this.initialSelected != null && !this.initialSelected.isEmpty();
2685        }
2686
2687        /**
2688         * @param value {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2689         */
2690        public QuestionnaireItemAnswerOptionComponent setInitialSelectedElement(BooleanType value) { 
2691          this.initialSelected = value;
2692          return this;
2693        }
2694
2695        /**
2696         * @return Indicates whether the answer value is selected when the list of possible answers is initially shown.
2697         */
2698        public boolean getInitialSelected() { 
2699          return this.initialSelected == null || this.initialSelected.isEmpty() ? false : this.initialSelected.getValue();
2700        }
2701
2702        /**
2703         * @param value Indicates whether the answer value is selected when the list of possible answers is initially shown.
2704         */
2705        public QuestionnaireItemAnswerOptionComponent setInitialSelected(boolean value) { 
2706            if (this.initialSelected == null)
2707              this.initialSelected = new BooleanType();
2708            this.initialSelected.setValue(value);
2709          return this;
2710        }
2711
2712        protected void listChildren(List<Property> children) {
2713          super.listChildren(children);
2714          children.add(new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value));
2715          children.add(new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected));
2716        }
2717
2718        @Override
2719        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2720          switch (_hash) {
2721          case -1410166417: /*value[x]*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2722          case 111972721: /*value*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2723          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2724          case -766192449: /*valueDate*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2725          case -765708322: /*valueTime*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2726          case -1424603934: /*valueString*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2727          case -1887705029: /*valueCoding*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2728          case 1755241690: /*valueReference*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
2729          case -1310184961: /*initialSelected*/  return new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected);
2730          default: return super.getNamedProperty(_hash, _name, _checkValid);
2731          }
2732
2733        }
2734
2735      @Override
2736      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2737        switch (hash) {
2738        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2739        case -1310184961: /*initialSelected*/ return this.initialSelected == null ? new Base[0] : new Base[] {this.initialSelected}; // BooleanType
2740        default: return super.getProperty(hash, name, checkValid);
2741        }
2742
2743      }
2744
2745      @Override
2746      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2747        switch (hash) {
2748        case 111972721: // value
2749          this.value = castToType(value); // Type
2750          return value;
2751        case -1310184961: // initialSelected
2752          this.initialSelected = castToBoolean(value); // BooleanType
2753          return value;
2754        default: return super.setProperty(hash, name, value);
2755        }
2756
2757      }
2758
2759      @Override
2760      public Base setProperty(String name, Base value) throws FHIRException {
2761        if (name.equals("value[x]")) {
2762          this.value = castToType(value); // Type
2763        } else if (name.equals("initialSelected")) {
2764          this.initialSelected = castToBoolean(value); // BooleanType
2765        } else
2766          return super.setProperty(name, value);
2767        return value;
2768      }
2769
2770      @Override
2771      public Base makeProperty(int hash, String name) throws FHIRException {
2772        switch (hash) {
2773        case -1410166417:  return getValue();
2774        case 111972721:  return getValue();
2775        case -1310184961:  return getInitialSelectedElement();
2776        default: return super.makeProperty(hash, name);
2777        }
2778
2779      }
2780
2781      @Override
2782      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2783        switch (hash) {
2784        case 111972721: /*value*/ return new String[] {"integer", "date", "time", "string", "Coding", "Reference"};
2785        case -1310184961: /*initialSelected*/ return new String[] {"boolean"};
2786        default: return super.getTypesForProperty(hash, name);
2787        }
2788
2789      }
2790
2791      @Override
2792      public Base addChild(String name) throws FHIRException {
2793        if (name.equals("valueInteger")) {
2794          this.value = new IntegerType();
2795          return this.value;
2796        }
2797        else if (name.equals("valueDate")) {
2798          this.value = new DateType();
2799          return this.value;
2800        }
2801        else if (name.equals("valueTime")) {
2802          this.value = new TimeType();
2803          return this.value;
2804        }
2805        else if (name.equals("valueString")) {
2806          this.value = new StringType();
2807          return this.value;
2808        }
2809        else if (name.equals("valueCoding")) {
2810          this.value = new Coding();
2811          return this.value;
2812        }
2813        else if (name.equals("valueReference")) {
2814          this.value = new Reference();
2815          return this.value;
2816        }
2817        else if (name.equals("initialSelected")) {
2818          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.initialSelected");
2819        }
2820        else
2821          return super.addChild(name);
2822      }
2823
2824      public QuestionnaireItemAnswerOptionComponent copy() {
2825        QuestionnaireItemAnswerOptionComponent dst = new QuestionnaireItemAnswerOptionComponent();
2826        copyValues(dst);
2827        return dst;
2828      }
2829
2830      public void copyValues(QuestionnaireItemAnswerOptionComponent dst) {
2831        super.copyValues(dst);
2832        dst.value = value == null ? null : value.copy();
2833        dst.initialSelected = initialSelected == null ? null : initialSelected.copy();
2834      }
2835
2836      @Override
2837      public boolean equalsDeep(Base other_) {
2838        if (!super.equalsDeep(other_))
2839          return false;
2840        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2841          return false;
2842        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2843        return compareDeep(value, o.value, true) && compareDeep(initialSelected, o.initialSelected, true)
2844          ;
2845      }
2846
2847      @Override
2848      public boolean equalsShallow(Base other_) {
2849        if (!super.equalsShallow(other_))
2850          return false;
2851        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2852          return false;
2853        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2854        return compareValues(initialSelected, o.initialSelected, true);
2855      }
2856
2857      public boolean isEmpty() {
2858        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, initialSelected);
2859      }
2860
2861  public String fhirType() {
2862    return "Questionnaire.item.answerOption";
2863
2864  }
2865
2866  }
2867
2868    @Block()
2869    public static class QuestionnaireItemInitialComponent extends BackboneElement implements IBaseBackboneElement {
2870        /**
2871         * The actual value to for an initial answer.
2872         */
2873        @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=1, max=1, modifier=false, summary=false)
2874        @Description(shortDefinition="Actual value for initializing the question", formalDefinition="The actual value to for an initial answer." )
2875        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2876        protected Type value;
2877
2878        private static final long serialVersionUID = -732981989L;
2879
2880    /**
2881     * Constructor
2882     */
2883      public QuestionnaireItemInitialComponent() {
2884        super();
2885      }
2886
2887    /**
2888     * Constructor
2889     */
2890      public QuestionnaireItemInitialComponent(Type value) {
2891        super();
2892        this.value = value;
2893      }
2894
2895        /**
2896         * @return {@link #value} (The actual value to for an initial answer.)
2897         */
2898        public Type getValue() { 
2899          return this.value;
2900        }
2901
2902        /**
2903         * @return {@link #value} (The actual value to for an initial answer.)
2904         */
2905        public BooleanType getValueBooleanType() throws FHIRException { 
2906          if (this.value == null)
2907            this.value = new BooleanType();
2908          if (!(this.value instanceof BooleanType))
2909            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2910          return (BooleanType) this.value;
2911        }
2912
2913        public boolean hasValueBooleanType() { 
2914          return this != null && this.value instanceof BooleanType;
2915        }
2916
2917        /**
2918         * @return {@link #value} (The actual value to for an initial answer.)
2919         */
2920        public DecimalType getValueDecimalType() throws FHIRException { 
2921          if (this.value == null)
2922            this.value = new DecimalType();
2923          if (!(this.value instanceof DecimalType))
2924            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2925          return (DecimalType) this.value;
2926        }
2927
2928        public boolean hasValueDecimalType() { 
2929          return this != null && this.value instanceof DecimalType;
2930        }
2931
2932        /**
2933         * @return {@link #value} (The actual value to for an initial answer.)
2934         */
2935        public IntegerType getValueIntegerType() throws FHIRException { 
2936          if (this.value == null)
2937            this.value = new IntegerType();
2938          if (!(this.value instanceof IntegerType))
2939            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2940          return (IntegerType) this.value;
2941        }
2942
2943        public boolean hasValueIntegerType() { 
2944          return this != null && this.value instanceof IntegerType;
2945        }
2946
2947        /**
2948         * @return {@link #value} (The actual value to for an initial answer.)
2949         */
2950        public DateType getValueDateType() throws FHIRException { 
2951          if (this.value == null)
2952            this.value = new DateType();
2953          if (!(this.value instanceof DateType))
2954            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2955          return (DateType) this.value;
2956        }
2957
2958        public boolean hasValueDateType() { 
2959          return this != null && this.value instanceof DateType;
2960        }
2961
2962        /**
2963         * @return {@link #value} (The actual value to for an initial answer.)
2964         */
2965        public DateTimeType getValueDateTimeType() throws FHIRException { 
2966          if (this.value == null)
2967            this.value = new DateTimeType();
2968          if (!(this.value instanceof DateTimeType))
2969            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2970          return (DateTimeType) this.value;
2971        }
2972
2973        public boolean hasValueDateTimeType() { 
2974          return this != null && this.value instanceof DateTimeType;
2975        }
2976
2977        /**
2978         * @return {@link #value} (The actual value to for an initial answer.)
2979         */
2980        public TimeType getValueTimeType() throws FHIRException { 
2981          if (this.value == null)
2982            this.value = new TimeType();
2983          if (!(this.value instanceof TimeType))
2984            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2985          return (TimeType) this.value;
2986        }
2987
2988        public boolean hasValueTimeType() { 
2989          return this != null && this.value instanceof TimeType;
2990        }
2991
2992        /**
2993         * @return {@link #value} (The actual value to for an initial answer.)
2994         */
2995        public StringType getValueStringType() throws FHIRException { 
2996          if (this.value == null)
2997            this.value = new StringType();
2998          if (!(this.value instanceof StringType))
2999            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3000          return (StringType) this.value;
3001        }
3002
3003        public boolean hasValueStringType() { 
3004          return this != null && this.value instanceof StringType;
3005        }
3006
3007        /**
3008         * @return {@link #value} (The actual value to for an initial answer.)
3009         */
3010        public UriType getValueUriType() throws FHIRException { 
3011          if (this.value == null)
3012            this.value = new UriType();
3013          if (!(this.value instanceof UriType))
3014            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3015          return (UriType) this.value;
3016        }
3017
3018        public boolean hasValueUriType() { 
3019          return this != null && this.value instanceof UriType;
3020        }
3021
3022        /**
3023         * @return {@link #value} (The actual value to for an initial answer.)
3024         */
3025        public Attachment getValueAttachment() throws FHIRException { 
3026          if (this.value == null)
3027            this.value = new Attachment();
3028          if (!(this.value instanceof Attachment))
3029            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3030          return (Attachment) this.value;
3031        }
3032
3033        public boolean hasValueAttachment() { 
3034          return this != null && this.value instanceof Attachment;
3035        }
3036
3037        /**
3038         * @return {@link #value} (The actual value to for an initial answer.)
3039         */
3040        public Coding getValueCoding() throws FHIRException { 
3041          if (this.value == null)
3042            this.value = new Coding();
3043          if (!(this.value instanceof Coding))
3044            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3045          return (Coding) this.value;
3046        }
3047
3048        public boolean hasValueCoding() { 
3049          return this != null && this.value instanceof Coding;
3050        }
3051
3052        /**
3053         * @return {@link #value} (The actual value to for an initial answer.)
3054         */
3055        public Quantity getValueQuantity() throws FHIRException { 
3056          if (this.value == null)
3057            this.value = new Quantity();
3058          if (!(this.value instanceof Quantity))
3059            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3060          return (Quantity) this.value;
3061        }
3062
3063        public boolean hasValueQuantity() { 
3064          return this != null && this.value instanceof Quantity;
3065        }
3066
3067        /**
3068         * @return {@link #value} (The actual value to for an initial answer.)
3069         */
3070        public Reference getValueReference() throws FHIRException { 
3071          if (this.value == null)
3072            this.value = new Reference();
3073          if (!(this.value instanceof Reference))
3074            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3075          return (Reference) this.value;
3076        }
3077
3078        public boolean hasValueReference() { 
3079          return this != null && this.value instanceof Reference;
3080        }
3081
3082        public boolean hasValue() { 
3083          return this.value != null && !this.value.isEmpty();
3084        }
3085
3086        /**
3087         * @param value {@link #value} (The actual value to for an initial answer.)
3088         */
3089        public QuestionnaireItemInitialComponent setValue(Type value) { 
3090          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))
3091            throw new Error("Not the right type for Questionnaire.item.initial.value[x]: "+value.fhirType());
3092          this.value = value;
3093          return this;
3094        }
3095
3096        protected void listChildren(List<Property> children) {
3097          super.listChildren(children);
3098          children.add(new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value));
3099        }
3100
3101        @Override
3102        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3103          switch (_hash) {
3104          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3105          case 111972721: /*value*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3106          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3107          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3108          case -1668204915: /*valueInteger*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3109          case -766192449: /*valueDate*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3110          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3111          case -765708322: /*valueTime*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3112          case -1424603934: /*valueString*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3113          case -1410172357: /*valueUri*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3114          case -475566732: /*valueAttachment*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3115          case -1887705029: /*valueCoding*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3116          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3117          case 1755241690: /*valueReference*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3118          default: return super.getNamedProperty(_hash, _name, _checkValid);
3119          }
3120
3121        }
3122
3123      @Override
3124      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3125        switch (hash) {
3126        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
3127        default: return super.getProperty(hash, name, checkValid);
3128        }
3129
3130      }
3131
3132      @Override
3133      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3134        switch (hash) {
3135        case 111972721: // value
3136          this.value = castToType(value); // Type
3137          return value;
3138        default: return super.setProperty(hash, name, value);
3139        }
3140
3141      }
3142
3143      @Override
3144      public Base setProperty(String name, Base value) throws FHIRException {
3145        if (name.equals("value[x]")) {
3146          this.value = castToType(value); // Type
3147        } else
3148          return super.setProperty(name, value);
3149        return value;
3150      }
3151
3152      @Override
3153      public Base makeProperty(int hash, String name) throws FHIRException {
3154        switch (hash) {
3155        case -1410166417:  return getValue();
3156        case 111972721:  return getValue();
3157        default: return super.makeProperty(hash, name);
3158        }
3159
3160      }
3161
3162      @Override
3163      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3164        switch (hash) {
3165        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3166        default: return super.getTypesForProperty(hash, name);
3167        }
3168
3169      }
3170
3171      @Override
3172      public Base addChild(String name) throws FHIRException {
3173        if (name.equals("valueBoolean")) {
3174          this.value = new BooleanType();
3175          return this.value;
3176        }
3177        else if (name.equals("valueDecimal")) {
3178          this.value = new DecimalType();
3179          return this.value;
3180        }
3181        else if (name.equals("valueInteger")) {
3182          this.value = new IntegerType();
3183          return this.value;
3184        }
3185        else if (name.equals("valueDate")) {
3186          this.value = new DateType();
3187          return this.value;
3188        }
3189        else if (name.equals("valueDateTime")) {
3190          this.value = new DateTimeType();
3191          return this.value;
3192        }
3193        else if (name.equals("valueTime")) {
3194          this.value = new TimeType();
3195          return this.value;
3196        }
3197        else if (name.equals("valueString")) {
3198          this.value = new StringType();
3199          return this.value;
3200        }
3201        else if (name.equals("valueUri")) {
3202          this.value = new UriType();
3203          return this.value;
3204        }
3205        else if (name.equals("valueAttachment")) {
3206          this.value = new Attachment();
3207          return this.value;
3208        }
3209        else if (name.equals("valueCoding")) {
3210          this.value = new Coding();
3211          return this.value;
3212        }
3213        else if (name.equals("valueQuantity")) {
3214          this.value = new Quantity();
3215          return this.value;
3216        }
3217        else if (name.equals("valueReference")) {
3218          this.value = new Reference();
3219          return this.value;
3220        }
3221        else
3222          return super.addChild(name);
3223      }
3224
3225      public QuestionnaireItemInitialComponent copy() {
3226        QuestionnaireItemInitialComponent dst = new QuestionnaireItemInitialComponent();
3227        copyValues(dst);
3228        return dst;
3229      }
3230
3231      public void copyValues(QuestionnaireItemInitialComponent dst) {
3232        super.copyValues(dst);
3233        dst.value = value == null ? null : value.copy();
3234      }
3235
3236      @Override
3237      public boolean equalsDeep(Base other_) {
3238        if (!super.equalsDeep(other_))
3239          return false;
3240        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3241          return false;
3242        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3243        return compareDeep(value, o.value, true);
3244      }
3245
3246      @Override
3247      public boolean equalsShallow(Base other_) {
3248        if (!super.equalsShallow(other_))
3249          return false;
3250        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3251          return false;
3252        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3253        return true;
3254      }
3255
3256      public boolean isEmpty() {
3257        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3258      }
3259
3260  public String fhirType() {
3261    return "Questionnaire.item.initial";
3262
3263  }
3264
3265  }
3266
3267    /**
3268     * A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.
3269     */
3270    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3271    @Description(shortDefinition="Additional identifier for the questionnaire", formalDefinition="A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance." )
3272    protected List<Identifier> identifier;
3273
3274    /**
3275     * The URL of a Questionnaire that this Questionnaire is based on.
3276     */
3277    @Child(name = "derivedFrom", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3278    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL of a Questionnaire that this Questionnaire is based on." )
3279    protected List<CanonicalType> derivedFrom;
3280
3281    /**
3282     * The types of subjects that can be the subject of responses created for the questionnaire.
3283     */
3284    @Child(name = "subjectType", type = {CodeType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3285    @Description(shortDefinition="Resource that can be subject of QuestionnaireResponse", formalDefinition="The types of subjects that can be the subject of responses created for the questionnaire." )
3286    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
3287    protected List<CodeType> subjectType;
3288
3289    /**
3290     * Explanation of why this questionnaire is needed and why it has been designed as it has.
3291     */
3292    @Child(name = "purpose", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3293    @Description(shortDefinition="Why this questionnaire is defined", formalDefinition="Explanation of why this questionnaire is needed and why it has been designed as it has." )
3294    protected MarkdownType purpose;
3295
3296    /**
3297     * A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
3298     */
3299    @Child(name = "copyright", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
3300    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire." )
3301    protected MarkdownType copyright;
3302
3303    /**
3304     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3305     */
3306    @Child(name = "approvalDate", type = {DateType.class}, order=5, min=0, max=1, modifier=false, summary=false)
3307    @Description(shortDefinition="When the questionnaire was approved by publisher", formalDefinition="The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
3308    protected DateType approvalDate;
3309
3310    /**
3311     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
3312     */
3313    @Child(name = "lastReviewDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=false)
3314    @Description(shortDefinition="When the questionnaire was last reviewed", formalDefinition="The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date." )
3315    protected DateType lastReviewDate;
3316
3317    /**
3318     * The period during which the questionnaire content was or is planned to be in active use.
3319     */
3320    @Child(name = "effectivePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
3321    @Description(shortDefinition="When the questionnaire is expected to be used", formalDefinition="The period during which the questionnaire content was or is planned to be in active use." )
3322    protected Period effectivePeriod;
3323
3324    /**
3325     * An identifier for this question or group of questions in a particular terminology such as LOINC.
3326     */
3327    @Child(name = "code", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3328    @Description(shortDefinition="Concept that represents the overall questionnaire", formalDefinition="An identifier for this question or group of questions in a particular terminology such as LOINC." )
3329    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
3330    protected List<Coding> code;
3331
3332    /**
3333     * A particular question, question grouping or display text that is part of the questionnaire.
3334     */
3335    @Child(name = "item", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3336    @Description(shortDefinition="Questions and sections within the Questionnaire", formalDefinition="A particular question, question grouping or display text that is part of the questionnaire." )
3337    protected List<QuestionnaireItemComponent> item;
3338
3339    private static final long serialVersionUID = 1036031192L;
3340
3341  /**
3342   * Constructor
3343   */
3344    public Questionnaire() {
3345      super();
3346    }
3347
3348  /**
3349   * Constructor
3350   */
3351    public Questionnaire(Enumeration<PublicationStatus> status) {
3352      super();
3353      this.status = status;
3354    }
3355
3356    /**
3357     * @return {@link #url} (An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3358     */
3359    public UriType getUrlElement() { 
3360      if (this.url == null)
3361        if (Configuration.errorOnAutoCreate())
3362          throw new Error("Attempt to auto-create Questionnaire.url");
3363        else if (Configuration.doAutoCreate())
3364          this.url = new UriType(); // bb
3365      return this.url;
3366    }
3367
3368    public boolean hasUrlElement() { 
3369      return this.url != null && !this.url.isEmpty();
3370    }
3371
3372    public boolean hasUrl() { 
3373      return this.url != null && !this.url.isEmpty();
3374    }
3375
3376    /**
3377     * @param value {@link #url} (An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3378     */
3379    public Questionnaire setUrlElement(UriType value) { 
3380      this.url = value;
3381      return this;
3382    }
3383
3384    /**
3385     * @return An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3386     */
3387    public String getUrl() { 
3388      return this.url == null ? null : this.url.getValue();
3389    }
3390
3391    /**
3392     * @param value An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3393     */
3394    public Questionnaire setUrl(String value) { 
3395      if (Utilities.noString(value))
3396        this.url = null;
3397      else {
3398        if (this.url == null)
3399          this.url = new UriType();
3400        this.url.setValue(value);
3401      }
3402      return this;
3403    }
3404
3405    /**
3406     * @return {@link #identifier} (A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.)
3407     */
3408    public List<Identifier> getIdentifier() { 
3409      if (this.identifier == null)
3410        this.identifier = new ArrayList<Identifier>();
3411      return this.identifier;
3412    }
3413
3414    /**
3415     * @return Returns a reference to <code>this</code> for easy method chaining
3416     */
3417    public Questionnaire setIdentifier(List<Identifier> theIdentifier) { 
3418      this.identifier = theIdentifier;
3419      return this;
3420    }
3421
3422    public boolean hasIdentifier() { 
3423      if (this.identifier == null)
3424        return false;
3425      for (Identifier item : this.identifier)
3426        if (!item.isEmpty())
3427          return true;
3428      return false;
3429    }
3430
3431    public Identifier addIdentifier() { //3
3432      Identifier t = new Identifier();
3433      if (this.identifier == null)
3434        this.identifier = new ArrayList<Identifier>();
3435      this.identifier.add(t);
3436      return t;
3437    }
3438
3439    public Questionnaire addIdentifier(Identifier t) { //3
3440      if (t == null)
3441        return this;
3442      if (this.identifier == null)
3443        this.identifier = new ArrayList<Identifier>();
3444      this.identifier.add(t);
3445      return this;
3446    }
3447
3448    /**
3449     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
3450     */
3451    public Identifier getIdentifierFirstRep() { 
3452      if (getIdentifier().isEmpty()) {
3453        addIdentifier();
3454      }
3455      return getIdentifier().get(0);
3456    }
3457
3458    /**
3459     * @return {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3460     */
3461    public StringType getVersionElement() { 
3462      if (this.version == null)
3463        if (Configuration.errorOnAutoCreate())
3464          throw new Error("Attempt to auto-create Questionnaire.version");
3465        else if (Configuration.doAutoCreate())
3466          this.version = new StringType(); // bb
3467      return this.version;
3468    }
3469
3470    public boolean hasVersionElement() { 
3471      return this.version != null && !this.version.isEmpty();
3472    }
3473
3474    public boolean hasVersion() { 
3475      return this.version != null && !this.version.isEmpty();
3476    }
3477
3478    /**
3479     * @param value {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3480     */
3481    public Questionnaire setVersionElement(StringType value) { 
3482      this.version = value;
3483      return this;
3484    }
3485
3486    /**
3487     * @return The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
3488     */
3489    public String getVersion() { 
3490      return this.version == null ? null : this.version.getValue();
3491    }
3492
3493    /**
3494     * @param value The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
3495     */
3496    public Questionnaire setVersion(String value) { 
3497      if (Utilities.noString(value))
3498        this.version = null;
3499      else {
3500        if (this.version == null)
3501          this.version = new StringType();
3502        this.version.setValue(value);
3503      }
3504      return this;
3505    }
3506
3507    /**
3508     * @return {@link #name} (A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3509     */
3510    public StringType getNameElement() { 
3511      if (this.name == null)
3512        if (Configuration.errorOnAutoCreate())
3513          throw new Error("Attempt to auto-create Questionnaire.name");
3514        else if (Configuration.doAutoCreate())
3515          this.name = new StringType(); // bb
3516      return this.name;
3517    }
3518
3519    public boolean hasNameElement() { 
3520      return this.name != null && !this.name.isEmpty();
3521    }
3522
3523    public boolean hasName() { 
3524      return this.name != null && !this.name.isEmpty();
3525    }
3526
3527    /**
3528     * @param value {@link #name} (A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3529     */
3530    public Questionnaire setNameElement(StringType value) { 
3531      this.name = value;
3532      return this;
3533    }
3534
3535    /**
3536     * @return A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3537     */
3538    public String getName() { 
3539      return this.name == null ? null : this.name.getValue();
3540    }
3541
3542    /**
3543     * @param value A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3544     */
3545    public Questionnaire setName(String value) { 
3546      if (Utilities.noString(value))
3547        this.name = null;
3548      else {
3549        if (this.name == null)
3550          this.name = new StringType();
3551        this.name.setValue(value);
3552      }
3553      return this;
3554    }
3555
3556    /**
3557     * @return {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3558     */
3559    public StringType getTitleElement() { 
3560      if (this.title == null)
3561        if (Configuration.errorOnAutoCreate())
3562          throw new Error("Attempt to auto-create Questionnaire.title");
3563        else if (Configuration.doAutoCreate())
3564          this.title = new StringType(); // bb
3565      return this.title;
3566    }
3567
3568    public boolean hasTitleElement() { 
3569      return this.title != null && !this.title.isEmpty();
3570    }
3571
3572    public boolean hasTitle() { 
3573      return this.title != null && !this.title.isEmpty();
3574    }
3575
3576    /**
3577     * @param value {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3578     */
3579    public Questionnaire setTitleElement(StringType value) { 
3580      this.title = value;
3581      return this;
3582    }
3583
3584    /**
3585     * @return A short, descriptive, user-friendly title for the questionnaire.
3586     */
3587    public String getTitle() { 
3588      return this.title == null ? null : this.title.getValue();
3589    }
3590
3591    /**
3592     * @param value A short, descriptive, user-friendly title for the questionnaire.
3593     */
3594    public Questionnaire setTitle(String value) { 
3595      if (Utilities.noString(value))
3596        this.title = null;
3597      else {
3598        if (this.title == null)
3599          this.title = new StringType();
3600        this.title.setValue(value);
3601      }
3602      return this;
3603    }
3604
3605    /**
3606     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3607     */
3608    public List<CanonicalType> getDerivedFrom() { 
3609      if (this.derivedFrom == null)
3610        this.derivedFrom = new ArrayList<CanonicalType>();
3611      return this.derivedFrom;
3612    }
3613
3614    /**
3615     * @return Returns a reference to <code>this</code> for easy method chaining
3616     */
3617    public Questionnaire setDerivedFrom(List<CanonicalType> theDerivedFrom) { 
3618      this.derivedFrom = theDerivedFrom;
3619      return this;
3620    }
3621
3622    public boolean hasDerivedFrom() { 
3623      if (this.derivedFrom == null)
3624        return false;
3625      for (CanonicalType item : this.derivedFrom)
3626        if (!item.isEmpty())
3627          return true;
3628      return false;
3629    }
3630
3631    /**
3632     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3633     */
3634    public CanonicalType addDerivedFromElement() {//2 
3635      CanonicalType t = new CanonicalType();
3636      if (this.derivedFrom == null)
3637        this.derivedFrom = new ArrayList<CanonicalType>();
3638      this.derivedFrom.add(t);
3639      return t;
3640    }
3641
3642    /**
3643     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3644     */
3645    public Questionnaire addDerivedFrom(String value) { //1
3646      CanonicalType t = new CanonicalType();
3647      t.setValue(value);
3648      if (this.derivedFrom == null)
3649        this.derivedFrom = new ArrayList<CanonicalType>();
3650      this.derivedFrom.add(t);
3651      return this;
3652    }
3653
3654    /**
3655     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3656     */
3657    public boolean hasDerivedFrom(String value) { 
3658      if (this.derivedFrom == null)
3659        return false;
3660      for (CanonicalType v : this.derivedFrom)
3661        if (v.getValue().equals(value)) // canonical(Questionnaire)
3662          return true;
3663      return false;
3664    }
3665
3666    /**
3667     * @return {@link #status} (The status of this questionnaire. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3668     */
3669    public Enumeration<PublicationStatus> getStatusElement() { 
3670      if (this.status == null)
3671        if (Configuration.errorOnAutoCreate())
3672          throw new Error("Attempt to auto-create Questionnaire.status");
3673        else if (Configuration.doAutoCreate())
3674          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
3675      return this.status;
3676    }
3677
3678    public boolean hasStatusElement() { 
3679      return this.status != null && !this.status.isEmpty();
3680    }
3681
3682    public boolean hasStatus() { 
3683      return this.status != null && !this.status.isEmpty();
3684    }
3685
3686    /**
3687     * @param value {@link #status} (The status of this questionnaire. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3688     */
3689    public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) { 
3690      this.status = value;
3691      return this;
3692    }
3693
3694    /**
3695     * @return The status of this questionnaire. Enables tracking the life-cycle of the content.
3696     */
3697    public PublicationStatus getStatus() { 
3698      return this.status == null ? null : this.status.getValue();
3699    }
3700
3701    /**
3702     * @param value The status of this questionnaire. Enables tracking the life-cycle of the content.
3703     */
3704    public Questionnaire setStatus(PublicationStatus value) { 
3705        if (this.status == null)
3706          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
3707        this.status.setValue(value);
3708      return this;
3709    }
3710
3711    /**
3712     * @return {@link #experimental} (A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
3713     */
3714    public BooleanType getExperimentalElement() { 
3715      if (this.experimental == null)
3716        if (Configuration.errorOnAutoCreate())
3717          throw new Error("Attempt to auto-create Questionnaire.experimental");
3718        else if (Configuration.doAutoCreate())
3719          this.experimental = new BooleanType(); // bb
3720      return this.experimental;
3721    }
3722
3723    public boolean hasExperimentalElement() { 
3724      return this.experimental != null && !this.experimental.isEmpty();
3725    }
3726
3727    public boolean hasExperimental() { 
3728      return this.experimental != null && !this.experimental.isEmpty();
3729    }
3730
3731    /**
3732     * @param value {@link #experimental} (A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
3733     */
3734    public Questionnaire setExperimentalElement(BooleanType value) { 
3735      this.experimental = value;
3736      return this;
3737    }
3738
3739    /**
3740     * @return A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
3741     */
3742    public boolean getExperimental() { 
3743      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
3744    }
3745
3746    /**
3747     * @param value A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
3748     */
3749    public Questionnaire setExperimental(boolean value) { 
3750        if (this.experimental == null)
3751          this.experimental = new BooleanType();
3752        this.experimental.setValue(value);
3753      return this;
3754    }
3755
3756    /**
3757     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3758     */
3759    public List<CodeType> getSubjectType() { 
3760      if (this.subjectType == null)
3761        this.subjectType = new ArrayList<CodeType>();
3762      return this.subjectType;
3763    }
3764
3765    /**
3766     * @return Returns a reference to <code>this</code> for easy method chaining
3767     */
3768    public Questionnaire setSubjectType(List<CodeType> theSubjectType) { 
3769      this.subjectType = theSubjectType;
3770      return this;
3771    }
3772
3773    public boolean hasSubjectType() { 
3774      if (this.subjectType == null)
3775        return false;
3776      for (CodeType item : this.subjectType)
3777        if (!item.isEmpty())
3778          return true;
3779      return false;
3780    }
3781
3782    /**
3783     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3784     */
3785    public CodeType addSubjectTypeElement() {//2 
3786      CodeType t = new CodeType();
3787      if (this.subjectType == null)
3788        this.subjectType = new ArrayList<CodeType>();
3789      this.subjectType.add(t);
3790      return t;
3791    }
3792
3793    /**
3794     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3795     */
3796    public Questionnaire addSubjectType(String value) { //1
3797      CodeType t = new CodeType();
3798      t.setValue(value);
3799      if (this.subjectType == null)
3800        this.subjectType = new ArrayList<CodeType>();
3801      this.subjectType.add(t);
3802      return this;
3803    }
3804
3805    /**
3806     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3807     */
3808    public boolean hasSubjectType(String value) { 
3809      if (this.subjectType == null)
3810        return false;
3811      for (CodeType v : this.subjectType)
3812        if (v.getValue().equals(value)) // code
3813          return true;
3814      return false;
3815    }
3816
3817    /**
3818     * @return {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3819     */
3820    public DateTimeType getDateElement() { 
3821      if (this.date == null)
3822        if (Configuration.errorOnAutoCreate())
3823          throw new Error("Attempt to auto-create Questionnaire.date");
3824        else if (Configuration.doAutoCreate())
3825          this.date = new DateTimeType(); // bb
3826      return this.date;
3827    }
3828
3829    public boolean hasDateElement() { 
3830      return this.date != null && !this.date.isEmpty();
3831    }
3832
3833    public boolean hasDate() { 
3834      return this.date != null && !this.date.isEmpty();
3835    }
3836
3837    /**
3838     * @param value {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3839     */
3840    public Questionnaire setDateElement(DateTimeType value) { 
3841      this.date = value;
3842      return this;
3843    }
3844
3845    /**
3846     * @return The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.
3847     */
3848    public Date getDate() { 
3849      return this.date == null ? null : this.date.getValue();
3850    }
3851
3852    /**
3853     * @param value The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.
3854     */
3855    public Questionnaire setDate(Date value) { 
3856      if (value == null)
3857        this.date = null;
3858      else {
3859        if (this.date == null)
3860          this.date = new DateTimeType();
3861        this.date.setValue(value);
3862      }
3863      return this;
3864    }
3865
3866    /**
3867     * @return {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
3868     */
3869    public StringType getPublisherElement() { 
3870      if (this.publisher == null)
3871        if (Configuration.errorOnAutoCreate())
3872          throw new Error("Attempt to auto-create Questionnaire.publisher");
3873        else if (Configuration.doAutoCreate())
3874          this.publisher = new StringType(); // bb
3875      return this.publisher;
3876    }
3877
3878    public boolean hasPublisherElement() { 
3879      return this.publisher != null && !this.publisher.isEmpty();
3880    }
3881
3882    public boolean hasPublisher() { 
3883      return this.publisher != null && !this.publisher.isEmpty();
3884    }
3885
3886    /**
3887     * @param value {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
3888     */
3889    public Questionnaire setPublisherElement(StringType value) { 
3890      this.publisher = value;
3891      return this;
3892    }
3893
3894    /**
3895     * @return The name of the organization or individual that published the questionnaire.
3896     */
3897    public String getPublisher() { 
3898      return this.publisher == null ? null : this.publisher.getValue();
3899    }
3900
3901    /**
3902     * @param value The name of the organization or individual that published the questionnaire.
3903     */
3904    public Questionnaire setPublisher(String value) { 
3905      if (Utilities.noString(value))
3906        this.publisher = null;
3907      else {
3908        if (this.publisher == null)
3909          this.publisher = new StringType();
3910        this.publisher.setValue(value);
3911      }
3912      return this;
3913    }
3914
3915    /**
3916     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
3917     */
3918    public List<ContactDetail> getContact() { 
3919      if (this.contact == null)
3920        this.contact = new ArrayList<ContactDetail>();
3921      return this.contact;
3922    }
3923
3924    /**
3925     * @return Returns a reference to <code>this</code> for easy method chaining
3926     */
3927    public Questionnaire setContact(List<ContactDetail> theContact) { 
3928      this.contact = theContact;
3929      return this;
3930    }
3931
3932    public boolean hasContact() { 
3933      if (this.contact == null)
3934        return false;
3935      for (ContactDetail item : this.contact)
3936        if (!item.isEmpty())
3937          return true;
3938      return false;
3939    }
3940
3941    public ContactDetail addContact() { //3
3942      ContactDetail t = new ContactDetail();
3943      if (this.contact == null)
3944        this.contact = new ArrayList<ContactDetail>();
3945      this.contact.add(t);
3946      return t;
3947    }
3948
3949    public Questionnaire addContact(ContactDetail t) { //3
3950      if (t == null)
3951        return this;
3952      if (this.contact == null)
3953        this.contact = new ArrayList<ContactDetail>();
3954      this.contact.add(t);
3955      return this;
3956    }
3957
3958    /**
3959     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3960     */
3961    public ContactDetail getContactFirstRep() { 
3962      if (getContact().isEmpty()) {
3963        addContact();
3964      }
3965      return getContact().get(0);
3966    }
3967
3968    /**
3969     * @return {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3970     */
3971    public MarkdownType getDescriptionElement() { 
3972      if (this.description == null)
3973        if (Configuration.errorOnAutoCreate())
3974          throw new Error("Attempt to auto-create Questionnaire.description");
3975        else if (Configuration.doAutoCreate())
3976          this.description = new MarkdownType(); // bb
3977      return this.description;
3978    }
3979
3980    public boolean hasDescriptionElement() { 
3981      return this.description != null && !this.description.isEmpty();
3982    }
3983
3984    public boolean hasDescription() { 
3985      return this.description != null && !this.description.isEmpty();
3986    }
3987
3988    /**
3989     * @param value {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
3990     */
3991    public Questionnaire setDescriptionElement(MarkdownType value) { 
3992      this.description = value;
3993      return this;
3994    }
3995
3996    /**
3997     * @return A free text natural language description of the questionnaire from a consumer's perspective.
3998     */
3999    public String getDescription() { 
4000      return this.description == null ? null : this.description.getValue();
4001    }
4002
4003    /**
4004     * @param value A free text natural language description of the questionnaire from a consumer's perspective.
4005     */
4006    public Questionnaire setDescription(String value) { 
4007      if (value == null)
4008        this.description = null;
4009      else {
4010        if (this.description == null)
4011          this.description = new MarkdownType();
4012        this.description.setValue(value);
4013      }
4014      return this;
4015    }
4016
4017    /**
4018     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.)
4019     */
4020    public List<UsageContext> getUseContext() { 
4021      if (this.useContext == null)
4022        this.useContext = new ArrayList<UsageContext>();
4023      return this.useContext;
4024    }
4025
4026    /**
4027     * @return Returns a reference to <code>this</code> for easy method chaining
4028     */
4029    public Questionnaire setUseContext(List<UsageContext> theUseContext) { 
4030      this.useContext = theUseContext;
4031      return this;
4032    }
4033
4034    public boolean hasUseContext() { 
4035      if (this.useContext == null)
4036        return false;
4037      for (UsageContext item : this.useContext)
4038        if (!item.isEmpty())
4039          return true;
4040      return false;
4041    }
4042
4043    public UsageContext addUseContext() { //3
4044      UsageContext t = new UsageContext();
4045      if (this.useContext == null)
4046        this.useContext = new ArrayList<UsageContext>();
4047      this.useContext.add(t);
4048      return t;
4049    }
4050
4051    public Questionnaire addUseContext(UsageContext t) { //3
4052      if (t == null)
4053        return this;
4054      if (this.useContext == null)
4055        this.useContext = new ArrayList<UsageContext>();
4056      this.useContext.add(t);
4057      return this;
4058    }
4059
4060    /**
4061     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
4062     */
4063    public UsageContext getUseContextFirstRep() { 
4064      if (getUseContext().isEmpty()) {
4065        addUseContext();
4066      }
4067      return getUseContext().get(0);
4068    }
4069
4070    /**
4071     * @return {@link #jurisdiction} (A legal or geographic region in which the questionnaire is intended to be used.)
4072     */
4073    public List<CodeableConcept> getJurisdiction() { 
4074      if (this.jurisdiction == null)
4075        this.jurisdiction = new ArrayList<CodeableConcept>();
4076      return this.jurisdiction;
4077    }
4078
4079    /**
4080     * @return Returns a reference to <code>this</code> for easy method chaining
4081     */
4082    public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) { 
4083      this.jurisdiction = theJurisdiction;
4084      return this;
4085    }
4086
4087    public boolean hasJurisdiction() { 
4088      if (this.jurisdiction == null)
4089        return false;
4090      for (CodeableConcept item : this.jurisdiction)
4091        if (!item.isEmpty())
4092          return true;
4093      return false;
4094    }
4095
4096    public CodeableConcept addJurisdiction() { //3
4097      CodeableConcept t = new CodeableConcept();
4098      if (this.jurisdiction == null)
4099        this.jurisdiction = new ArrayList<CodeableConcept>();
4100      this.jurisdiction.add(t);
4101      return t;
4102    }
4103
4104    public Questionnaire addJurisdiction(CodeableConcept t) { //3
4105      if (t == null)
4106        return this;
4107      if (this.jurisdiction == null)
4108        this.jurisdiction = new ArrayList<CodeableConcept>();
4109      this.jurisdiction.add(t);
4110      return this;
4111    }
4112
4113    /**
4114     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
4115     */
4116    public CodeableConcept getJurisdictionFirstRep() { 
4117      if (getJurisdiction().isEmpty()) {
4118        addJurisdiction();
4119      }
4120      return getJurisdiction().get(0);
4121    }
4122
4123    /**
4124     * @return {@link #purpose} (Explanation of why this questionnaire is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4125     */
4126    public MarkdownType getPurposeElement() { 
4127      if (this.purpose == null)
4128        if (Configuration.errorOnAutoCreate())
4129          throw new Error("Attempt to auto-create Questionnaire.purpose");
4130        else if (Configuration.doAutoCreate())
4131          this.purpose = new MarkdownType(); // bb
4132      return this.purpose;
4133    }
4134
4135    public boolean hasPurposeElement() { 
4136      return this.purpose != null && !this.purpose.isEmpty();
4137    }
4138
4139    public boolean hasPurpose() { 
4140      return this.purpose != null && !this.purpose.isEmpty();
4141    }
4142
4143    /**
4144     * @param value {@link #purpose} (Explanation of why this questionnaire is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4145     */
4146    public Questionnaire setPurposeElement(MarkdownType value) { 
4147      this.purpose = value;
4148      return this;
4149    }
4150
4151    /**
4152     * @return Explanation of why this questionnaire is needed and why it has been designed as it has.
4153     */
4154    public String getPurpose() { 
4155      return this.purpose == null ? null : this.purpose.getValue();
4156    }
4157
4158    /**
4159     * @param value Explanation of why this questionnaire is needed and why it has been designed as it has.
4160     */
4161    public Questionnaire setPurpose(String value) { 
4162      if (value == null)
4163        this.purpose = null;
4164      else {
4165        if (this.purpose == null)
4166          this.purpose = new MarkdownType();
4167        this.purpose.setValue(value);
4168      }
4169      return this;
4170    }
4171
4172    /**
4173     * @return {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4174     */
4175    public MarkdownType getCopyrightElement() { 
4176      if (this.copyright == null)
4177        if (Configuration.errorOnAutoCreate())
4178          throw new Error("Attempt to auto-create Questionnaire.copyright");
4179        else if (Configuration.doAutoCreate())
4180          this.copyright = new MarkdownType(); // bb
4181      return this.copyright;
4182    }
4183
4184    public boolean hasCopyrightElement() { 
4185      return this.copyright != null && !this.copyright.isEmpty();
4186    }
4187
4188    public boolean hasCopyright() { 
4189      return this.copyright != null && !this.copyright.isEmpty();
4190    }
4191
4192    /**
4193     * @param value {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4194     */
4195    public Questionnaire setCopyrightElement(MarkdownType value) { 
4196      this.copyright = value;
4197      return this;
4198    }
4199
4200    /**
4201     * @return A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4202     */
4203    public String getCopyright() { 
4204      return this.copyright == null ? null : this.copyright.getValue();
4205    }
4206
4207    /**
4208     * @param value A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4209     */
4210    public Questionnaire setCopyright(String value) { 
4211      if (value == null)
4212        this.copyright = null;
4213      else {
4214        if (this.copyright == null)
4215          this.copyright = new MarkdownType();
4216        this.copyright.setValue(value);
4217      }
4218      return this;
4219    }
4220
4221    /**
4222     * @return {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4223     */
4224    public DateType getApprovalDateElement() { 
4225      if (this.approvalDate == null)
4226        if (Configuration.errorOnAutoCreate())
4227          throw new Error("Attempt to auto-create Questionnaire.approvalDate");
4228        else if (Configuration.doAutoCreate())
4229          this.approvalDate = new DateType(); // bb
4230      return this.approvalDate;
4231    }
4232
4233    public boolean hasApprovalDateElement() { 
4234      return this.approvalDate != null && !this.approvalDate.isEmpty();
4235    }
4236
4237    public boolean hasApprovalDate() { 
4238      return this.approvalDate != null && !this.approvalDate.isEmpty();
4239    }
4240
4241    /**
4242     * @param value {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4243     */
4244    public Questionnaire setApprovalDateElement(DateType value) { 
4245      this.approvalDate = value;
4246      return this;
4247    }
4248
4249    /**
4250     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4251     */
4252    public Date getApprovalDate() { 
4253      return this.approvalDate == null ? null : this.approvalDate.getValue();
4254    }
4255
4256    /**
4257     * @param value The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4258     */
4259    public Questionnaire setApprovalDate(Date value) { 
4260      if (value == null)
4261        this.approvalDate = null;
4262      else {
4263        if (this.approvalDate == null)
4264          this.approvalDate = new DateType();
4265        this.approvalDate.setValue(value);
4266      }
4267      return this;
4268    }
4269
4270    /**
4271     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4272     */
4273    public DateType getLastReviewDateElement() { 
4274      if (this.lastReviewDate == null)
4275        if (Configuration.errorOnAutoCreate())
4276          throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
4277        else if (Configuration.doAutoCreate())
4278          this.lastReviewDate = new DateType(); // bb
4279      return this.lastReviewDate;
4280    }
4281
4282    public boolean hasLastReviewDateElement() { 
4283      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4284    }
4285
4286    public boolean hasLastReviewDate() { 
4287      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4288    }
4289
4290    /**
4291     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4292     */
4293    public Questionnaire setLastReviewDateElement(DateType value) { 
4294      this.lastReviewDate = value;
4295      return this;
4296    }
4297
4298    /**
4299     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4300     */
4301    public Date getLastReviewDate() { 
4302      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
4303    }
4304
4305    /**
4306     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4307     */
4308    public Questionnaire setLastReviewDate(Date value) { 
4309      if (value == null)
4310        this.lastReviewDate = null;
4311      else {
4312        if (this.lastReviewDate == null)
4313          this.lastReviewDate = new DateType();
4314        this.lastReviewDate.setValue(value);
4315      }
4316      return this;
4317    }
4318
4319    /**
4320     * @return {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4321     */
4322    public Period getEffectivePeriod() { 
4323      if (this.effectivePeriod == null)
4324        if (Configuration.errorOnAutoCreate())
4325          throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
4326        else if (Configuration.doAutoCreate())
4327          this.effectivePeriod = new Period(); // cc
4328      return this.effectivePeriod;
4329    }
4330
4331    public boolean hasEffectivePeriod() { 
4332      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
4333    }
4334
4335    /**
4336     * @param value {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4337     */
4338    public Questionnaire setEffectivePeriod(Period value) { 
4339      this.effectivePeriod = value;
4340      return this;
4341    }
4342
4343    /**
4344     * @return {@link #code} (An identifier for this question or group of questions in a particular terminology such as LOINC.)
4345     */
4346    public List<Coding> getCode() { 
4347      if (this.code == null)
4348        this.code = new ArrayList<Coding>();
4349      return this.code;
4350    }
4351
4352    /**
4353     * @return Returns a reference to <code>this</code> for easy method chaining
4354     */
4355    public Questionnaire setCode(List<Coding> theCode) { 
4356      this.code = theCode;
4357      return this;
4358    }
4359
4360    public boolean hasCode() { 
4361      if (this.code == null)
4362        return false;
4363      for (Coding item : this.code)
4364        if (!item.isEmpty())
4365          return true;
4366      return false;
4367    }
4368
4369    public Coding addCode() { //3
4370      Coding t = new Coding();
4371      if (this.code == null)
4372        this.code = new ArrayList<Coding>();
4373      this.code.add(t);
4374      return t;
4375    }
4376
4377    public Questionnaire addCode(Coding t) { //3
4378      if (t == null)
4379        return this;
4380      if (this.code == null)
4381        this.code = new ArrayList<Coding>();
4382      this.code.add(t);
4383      return this;
4384    }
4385
4386    /**
4387     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
4388     */
4389    public Coding getCodeFirstRep() { 
4390      if (getCode().isEmpty()) {
4391        addCode();
4392      }
4393      return getCode().get(0);
4394    }
4395
4396    /**
4397     * @return {@link #item} (A particular question, question grouping or display text that is part of the questionnaire.)
4398     */
4399    public List<QuestionnaireItemComponent> getItem() { 
4400      if (this.item == null)
4401        this.item = new ArrayList<QuestionnaireItemComponent>();
4402      return this.item;
4403    }
4404
4405    /**
4406     * @return Returns a reference to <code>this</code> for easy method chaining
4407     */
4408    public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) { 
4409      this.item = theItem;
4410      return this;
4411    }
4412
4413    public boolean hasItem() { 
4414      if (this.item == null)
4415        return false;
4416      for (QuestionnaireItemComponent item : this.item)
4417        if (!item.isEmpty())
4418          return true;
4419      return false;
4420    }
4421
4422    public QuestionnaireItemComponent addItem() { //3
4423      QuestionnaireItemComponent t = new QuestionnaireItemComponent();
4424      if (this.item == null)
4425        this.item = new ArrayList<QuestionnaireItemComponent>();
4426      this.item.add(t);
4427      return t;
4428    }
4429
4430    public Questionnaire addItem(QuestionnaireItemComponent t) { //3
4431      if (t == null)
4432        return this;
4433      if (this.item == null)
4434        this.item = new ArrayList<QuestionnaireItemComponent>();
4435      this.item.add(t);
4436      return this;
4437    }
4438
4439    /**
4440     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
4441     */
4442    public QuestionnaireItemComponent getItemFirstRep() { 
4443      if (getItem().isEmpty()) {
4444        addItem();
4445      }
4446      return getItem().get(0);
4447    }
4448
4449      protected void listChildren(List<Property> children) {
4450        super.listChildren(children);
4451        children.add(new Property("url", "uri", "An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url));
4452        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
4453        children.add(new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version));
4454        children.add(new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
4455        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title));
4456        children.add(new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom));
4457        children.add(new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status));
4458        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
4459        children.add(new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType));
4460        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.", 0, 1, date));
4461        children.add(new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher));
4462        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
4463        children.add(new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description));
4464        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
4465        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
4466        children.add(new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose));
4467        children.add(new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright));
4468        children.add(new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
4469        children.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate));
4470        children.add(new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod));
4471        children.add(new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code));
4472        children.add(new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item));
4473      }
4474
4475      @Override
4476      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4477        switch (_hash) {
4478        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url);
4479        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
4480        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, 1, version);
4481        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
4482        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title);
4483        case 1077922663: /*derivedFrom*/  return new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom);
4484        case -892481550: /*status*/  return new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status);
4485        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
4486        case -603200890: /*subjectType*/  return new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType);
4487        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.", 0, 1, date);
4488        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher);
4489        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
4490        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description);
4491        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
4492        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
4493        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose);
4494        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright);
4495        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
4496        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate);
4497        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod);
4498        case 3059181: /*code*/  return new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code);
4499        case 3242771: /*item*/  return new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item);
4500        default: return super.getNamedProperty(_hash, _name, _checkValid);
4501        }
4502
4503      }
4504
4505      @Override
4506      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4507        switch (hash) {
4508        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
4509        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4510        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
4511        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
4512        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4513        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // CanonicalType
4514        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
4515        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
4516        case -603200890: /*subjectType*/ return this.subjectType == null ? new Base[0] : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
4517        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
4518        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
4519        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
4520        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4521        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
4522        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
4523        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
4524        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
4525        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
4526        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
4527        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
4528        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
4529        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
4530        default: return super.getProperty(hash, name, checkValid);
4531        }
4532
4533      }
4534
4535      @Override
4536      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4537        switch (hash) {
4538        case 116079: // url
4539          this.url = castToUri(value); // UriType
4540          return value;
4541        case -1618432855: // identifier
4542          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4543          return value;
4544        case 351608024: // version
4545          this.version = castToString(value); // StringType
4546          return value;
4547        case 3373707: // name
4548          this.name = castToString(value); // StringType
4549          return value;
4550        case 110371416: // title
4551          this.title = castToString(value); // StringType
4552          return value;
4553        case 1077922663: // derivedFrom
4554          this.getDerivedFrom().add(castToCanonical(value)); // CanonicalType
4555          return value;
4556        case -892481550: // status
4557          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4558          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4559          return value;
4560        case -404562712: // experimental
4561          this.experimental = castToBoolean(value); // BooleanType
4562          return value;
4563        case -603200890: // subjectType
4564          this.getSubjectType().add(castToCode(value)); // CodeType
4565          return value;
4566        case 3076014: // date
4567          this.date = castToDateTime(value); // DateTimeType
4568          return value;
4569        case 1447404028: // publisher
4570          this.publisher = castToString(value); // StringType
4571          return value;
4572        case 951526432: // contact
4573          this.getContact().add(castToContactDetail(value)); // ContactDetail
4574          return value;
4575        case -1724546052: // description
4576          this.description = castToMarkdown(value); // MarkdownType
4577          return value;
4578        case -669707736: // useContext
4579          this.getUseContext().add(castToUsageContext(value)); // UsageContext
4580          return value;
4581        case -507075711: // jurisdiction
4582          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
4583          return value;
4584        case -220463842: // purpose
4585          this.purpose = castToMarkdown(value); // MarkdownType
4586          return value;
4587        case 1522889671: // copyright
4588          this.copyright = castToMarkdown(value); // MarkdownType
4589          return value;
4590        case 223539345: // approvalDate
4591          this.approvalDate = castToDate(value); // DateType
4592          return value;
4593        case -1687512484: // lastReviewDate
4594          this.lastReviewDate = castToDate(value); // DateType
4595          return value;
4596        case -403934648: // effectivePeriod
4597          this.effectivePeriod = castToPeriod(value); // Period
4598          return value;
4599        case 3059181: // code
4600          this.getCode().add(castToCoding(value)); // Coding
4601          return value;
4602        case 3242771: // item
4603          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
4604          return value;
4605        default: return super.setProperty(hash, name, value);
4606        }
4607
4608      }
4609
4610      @Override
4611      public Base setProperty(String name, Base value) throws FHIRException {
4612        if (name.equals("url")) {
4613          this.url = castToUri(value); // UriType
4614        } else if (name.equals("identifier")) {
4615          this.getIdentifier().add(castToIdentifier(value));
4616        } else if (name.equals("version")) {
4617          this.version = castToString(value); // StringType
4618        } else if (name.equals("name")) {
4619          this.name = castToString(value); // StringType
4620        } else if (name.equals("title")) {
4621          this.title = castToString(value); // StringType
4622        } else if (name.equals("derivedFrom")) {
4623          this.getDerivedFrom().add(castToCanonical(value));
4624        } else if (name.equals("status")) {
4625          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4626          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4627        } else if (name.equals("experimental")) {
4628          this.experimental = castToBoolean(value); // BooleanType
4629        } else if (name.equals("subjectType")) {
4630          this.getSubjectType().add(castToCode(value));
4631        } else if (name.equals("date")) {
4632          this.date = castToDateTime(value); // DateTimeType
4633        } else if (name.equals("publisher")) {
4634          this.publisher = castToString(value); // StringType
4635        } else if (name.equals("contact")) {
4636          this.getContact().add(castToContactDetail(value));
4637        } else if (name.equals("description")) {
4638          this.description = castToMarkdown(value); // MarkdownType
4639        } else if (name.equals("useContext")) {
4640          this.getUseContext().add(castToUsageContext(value));
4641        } else if (name.equals("jurisdiction")) {
4642          this.getJurisdiction().add(castToCodeableConcept(value));
4643        } else if (name.equals("purpose")) {
4644          this.purpose = castToMarkdown(value); // MarkdownType
4645        } else if (name.equals("copyright")) {
4646          this.copyright = castToMarkdown(value); // MarkdownType
4647        } else if (name.equals("approvalDate")) {
4648          this.approvalDate = castToDate(value); // DateType
4649        } else if (name.equals("lastReviewDate")) {
4650          this.lastReviewDate = castToDate(value); // DateType
4651        } else if (name.equals("effectivePeriod")) {
4652          this.effectivePeriod = castToPeriod(value); // Period
4653        } else if (name.equals("code")) {
4654          this.getCode().add(castToCoding(value));
4655        } else if (name.equals("item")) {
4656          this.getItem().add((QuestionnaireItemComponent) value);
4657        } else
4658          return super.setProperty(name, value);
4659        return value;
4660      }
4661
4662      @Override
4663      public Base makeProperty(int hash, String name) throws FHIRException {
4664        switch (hash) {
4665        case 116079:  return getUrlElement();
4666        case -1618432855:  return addIdentifier(); 
4667        case 351608024:  return getVersionElement();
4668        case 3373707:  return getNameElement();
4669        case 110371416:  return getTitleElement();
4670        case 1077922663:  return addDerivedFromElement();
4671        case -892481550:  return getStatusElement();
4672        case -404562712:  return getExperimentalElement();
4673        case -603200890:  return addSubjectTypeElement();
4674        case 3076014:  return getDateElement();
4675        case 1447404028:  return getPublisherElement();
4676        case 951526432:  return addContact(); 
4677        case -1724546052:  return getDescriptionElement();
4678        case -669707736:  return addUseContext(); 
4679        case -507075711:  return addJurisdiction(); 
4680        case -220463842:  return getPurposeElement();
4681        case 1522889671:  return getCopyrightElement();
4682        case 223539345:  return getApprovalDateElement();
4683        case -1687512484:  return getLastReviewDateElement();
4684        case -403934648:  return getEffectivePeriod();
4685        case 3059181:  return addCode(); 
4686        case 3242771:  return addItem(); 
4687        default: return super.makeProperty(hash, name);
4688        }
4689
4690      }
4691
4692      @Override
4693      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4694        switch (hash) {
4695        case 116079: /*url*/ return new String[] {"uri"};
4696        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4697        case 351608024: /*version*/ return new String[] {"string"};
4698        case 3373707: /*name*/ return new String[] {"string"};
4699        case 110371416: /*title*/ return new String[] {"string"};
4700        case 1077922663: /*derivedFrom*/ return new String[] {"canonical"};
4701        case -892481550: /*status*/ return new String[] {"code"};
4702        case -404562712: /*experimental*/ return new String[] {"boolean"};
4703        case -603200890: /*subjectType*/ return new String[] {"code"};
4704        case 3076014: /*date*/ return new String[] {"dateTime"};
4705        case 1447404028: /*publisher*/ return new String[] {"string"};
4706        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4707        case -1724546052: /*description*/ return new String[] {"markdown"};
4708        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4709        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4710        case -220463842: /*purpose*/ return new String[] {"markdown"};
4711        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4712        case 223539345: /*approvalDate*/ return new String[] {"date"};
4713        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
4714        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
4715        case 3059181: /*code*/ return new String[] {"Coding"};
4716        case 3242771: /*item*/ return new String[] {};
4717        default: return super.getTypesForProperty(hash, name);
4718        }
4719
4720      }
4721
4722      @Override
4723      public Base addChild(String name) throws FHIRException {
4724        if (name.equals("url")) {
4725          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.url");
4726        }
4727        else if (name.equals("identifier")) {
4728          return addIdentifier();
4729        }
4730        else if (name.equals("version")) {
4731          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version");
4732        }
4733        else if (name.equals("name")) {
4734          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.name");
4735        }
4736        else if (name.equals("title")) {
4737          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title");
4738        }
4739        else if (name.equals("derivedFrom")) {
4740          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.derivedFrom");
4741        }
4742        else if (name.equals("status")) {
4743          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status");
4744        }
4745        else if (name.equals("experimental")) {
4746          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.experimental");
4747        }
4748        else if (name.equals("subjectType")) {
4749          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType");
4750        }
4751        else if (name.equals("date")) {
4752          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date");
4753        }
4754        else if (name.equals("publisher")) {
4755          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher");
4756        }
4757        else if (name.equals("contact")) {
4758          return addContact();
4759        }
4760        else if (name.equals("description")) {
4761          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.description");
4762        }
4763        else if (name.equals("useContext")) {
4764          return addUseContext();
4765        }
4766        else if (name.equals("jurisdiction")) {
4767          return addJurisdiction();
4768        }
4769        else if (name.equals("purpose")) {
4770          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.purpose");
4771        }
4772        else if (name.equals("copyright")) {
4773          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.copyright");
4774        }
4775        else if (name.equals("approvalDate")) {
4776          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.approvalDate");
4777        }
4778        else if (name.equals("lastReviewDate")) {
4779          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.lastReviewDate");
4780        }
4781        else if (name.equals("effectivePeriod")) {
4782          this.effectivePeriod = new Period();
4783          return this.effectivePeriod;
4784        }
4785        else if (name.equals("code")) {
4786          return addCode();
4787        }
4788        else if (name.equals("item")) {
4789          return addItem();
4790        }
4791        else
4792          return super.addChild(name);
4793      }
4794
4795  public String fhirType() {
4796    return "Questionnaire";
4797
4798  }
4799
4800      public Questionnaire copy() {
4801        Questionnaire dst = new Questionnaire();
4802        copyValues(dst);
4803        return dst;
4804      }
4805
4806      public void copyValues(Questionnaire dst) {
4807        super.copyValues(dst);
4808        dst.url = url == null ? null : url.copy();
4809        if (identifier != null) {
4810          dst.identifier = new ArrayList<Identifier>();
4811          for (Identifier i : identifier)
4812            dst.identifier.add(i.copy());
4813        };
4814        dst.version = version == null ? null : version.copy();
4815        dst.name = name == null ? null : name.copy();
4816        dst.title = title == null ? null : title.copy();
4817        if (derivedFrom != null) {
4818          dst.derivedFrom = new ArrayList<CanonicalType>();
4819          for (CanonicalType i : derivedFrom)
4820            dst.derivedFrom.add(i.copy());
4821        };
4822        dst.status = status == null ? null : status.copy();
4823        dst.experimental = experimental == null ? null : experimental.copy();
4824        if (subjectType != null) {
4825          dst.subjectType = new ArrayList<CodeType>();
4826          for (CodeType i : subjectType)
4827            dst.subjectType.add(i.copy());
4828        };
4829        dst.date = date == null ? null : date.copy();
4830        dst.publisher = publisher == null ? null : publisher.copy();
4831        if (contact != null) {
4832          dst.contact = new ArrayList<ContactDetail>();
4833          for (ContactDetail i : contact)
4834            dst.contact.add(i.copy());
4835        };
4836        dst.description = description == null ? null : description.copy();
4837        if (useContext != null) {
4838          dst.useContext = new ArrayList<UsageContext>();
4839          for (UsageContext i : useContext)
4840            dst.useContext.add(i.copy());
4841        };
4842        if (jurisdiction != null) {
4843          dst.jurisdiction = new ArrayList<CodeableConcept>();
4844          for (CodeableConcept i : jurisdiction)
4845            dst.jurisdiction.add(i.copy());
4846        };
4847        dst.purpose = purpose == null ? null : purpose.copy();
4848        dst.copyright = copyright == null ? null : copyright.copy();
4849        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
4850        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
4851        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
4852        if (code != null) {
4853          dst.code = new ArrayList<Coding>();
4854          for (Coding i : code)
4855            dst.code.add(i.copy());
4856        };
4857        if (item != null) {
4858          dst.item = new ArrayList<QuestionnaireItemComponent>();
4859          for (QuestionnaireItemComponent i : item)
4860            dst.item.add(i.copy());
4861        };
4862      }
4863
4864      protected Questionnaire typedCopy() {
4865        return copy();
4866      }
4867
4868      @Override
4869      public boolean equalsDeep(Base other_) {
4870        if (!super.equalsDeep(other_))
4871          return false;
4872        if (!(other_ instanceof Questionnaire))
4873          return false;
4874        Questionnaire o = (Questionnaire) other_;
4875        return compareDeep(identifier, o.identifier, true) && compareDeep(derivedFrom, o.derivedFrom, true)
4876           && compareDeep(subjectType, o.subjectType, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4877           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4878           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(code, o.code, true) && compareDeep(item, o.item, true)
4879          ;
4880      }
4881
4882      @Override
4883      public boolean equalsShallow(Base other_) {
4884        if (!super.equalsShallow(other_))
4885          return false;
4886        if (!(other_ instanceof Questionnaire))
4887          return false;
4888        Questionnaire o = (Questionnaire) other_;
4889        return compareValues(subjectType, o.subjectType, true) && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4890           && compareValues(approvalDate, o.approvalDate, true) && compareValues(lastReviewDate, o.lastReviewDate, true)
4891          ;
4892      }
4893
4894      public boolean isEmpty() {
4895        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, derivedFrom, subjectType
4896          , purpose, copyright, approvalDate, lastReviewDate, effectivePeriod, code, item
4897          );
4898      }
4899
4900  @Override
4901  public ResourceType getResourceType() {
4902    return ResourceType.Questionnaire;
4903   }
4904
4905 /**
4906   * Search parameter: <b>date</b>
4907   * <p>
4908   * Description: <b>The questionnaire publication date</b><br>
4909   * Type: <b>date</b><br>
4910   * Path: <b>Questionnaire.date</b><br>
4911   * </p>
4912   */
4913  @SearchParamDefinition(name="date", path="Questionnaire.date", description="The questionnaire publication date", type="date" )
4914  public static final String SP_DATE = "date";
4915 /**
4916   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4917   * <p>
4918   * Description: <b>The questionnaire publication date</b><br>
4919   * Type: <b>date</b><br>
4920   * Path: <b>Questionnaire.date</b><br>
4921   * </p>
4922   */
4923  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4924
4925 /**
4926   * Search parameter: <b>identifier</b>
4927   * <p>
4928   * Description: <b>External identifier for the questionnaire</b><br>
4929   * Type: <b>token</b><br>
4930   * Path: <b>Questionnaire.identifier</b><br>
4931   * </p>
4932   */
4933  @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="External identifier for the questionnaire", type="token" )
4934  public static final String SP_IDENTIFIER = "identifier";
4935 /**
4936   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4937   * <p>
4938   * Description: <b>External identifier for the questionnaire</b><br>
4939   * Type: <b>token</b><br>
4940   * Path: <b>Questionnaire.identifier</b><br>
4941   * </p>
4942   */
4943  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4944
4945 /**
4946   * Search parameter: <b>code</b>
4947   * <p>
4948   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4949   * Type: <b>token</b><br>
4950   * Path: <b>Questionnaire.item.code</b><br>
4951   * </p>
4952   */
4953  @SearchParamDefinition(name="code", path="Questionnaire.item.code", description="A code that corresponds to one of its items in the questionnaire", type="token" )
4954  public static final String SP_CODE = "code";
4955 /**
4956   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4957   * <p>
4958   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4959   * Type: <b>token</b><br>
4960   * Path: <b>Questionnaire.item.code</b><br>
4961   * </p>
4962   */
4963  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4964
4965 /**
4966   * Search parameter: <b>context-type-value</b>
4967   * <p>
4968   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4969   * Type: <b>composite</b><br>
4970   * Path: <b></b><br>
4971   * </p>
4972   */
4973  @SearchParamDefinition(name="context-type-value", path="Questionnaire.useContext", description="A use context type and value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context"} )
4974  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
4975 /**
4976   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
4977   * <p>
4978   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4979   * Type: <b>composite</b><br>
4980   * Path: <b></b><br>
4981   * </p>
4982   */
4983  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(SP_CONTEXT_TYPE_VALUE);
4984
4985 /**
4986   * Search parameter: <b>jurisdiction</b>
4987   * <p>
4988   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4989   * Type: <b>token</b><br>
4990   * Path: <b>Questionnaire.jurisdiction</b><br>
4991   * </p>
4992   */
4993  @SearchParamDefinition(name="jurisdiction", path="Questionnaire.jurisdiction", description="Intended jurisdiction for the questionnaire", type="token" )
4994  public static final String SP_JURISDICTION = "jurisdiction";
4995 /**
4996   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4997   * <p>
4998   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4999   * Type: <b>token</b><br>
5000   * Path: <b>Questionnaire.jurisdiction</b><br>
5001   * </p>
5002   */
5003  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
5004
5005 /**
5006   * Search parameter: <b>description</b>
5007   * <p>
5008   * Description: <b>The description of the questionnaire</b><br>
5009   * Type: <b>string</b><br>
5010   * Path: <b>Questionnaire.description</b><br>
5011   * </p>
5012   */
5013  @SearchParamDefinition(name="description", path="Questionnaire.description", description="The description of the questionnaire", type="string" )
5014  public static final String SP_DESCRIPTION = "description";
5015 /**
5016   * <b>Fluent Client</b> search parameter constant for <b>description</b>
5017   * <p>
5018   * Description: <b>The description of the questionnaire</b><br>
5019   * Type: <b>string</b><br>
5020   * Path: <b>Questionnaire.description</b><br>
5021   * </p>
5022   */
5023  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
5024
5025 /**
5026   * Search parameter: <b>context-type</b>
5027   * <p>
5028   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5029   * Type: <b>token</b><br>
5030   * Path: <b>Questionnaire.useContext.code</b><br>
5031   * </p>
5032   */
5033  @SearchParamDefinition(name="context-type", path="Questionnaire.useContext.code", description="A type of use context assigned to the questionnaire", type="token" )
5034  public static final String SP_CONTEXT_TYPE = "context-type";
5035 /**
5036   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
5037   * <p>
5038   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5039   * Type: <b>token</b><br>
5040   * Path: <b>Questionnaire.useContext.code</b><br>
5041   * </p>
5042   */
5043  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
5044
5045 /**
5046   * Search parameter: <b>title</b>
5047   * <p>
5048   * Description: <b>The human-friendly name of the questionnaire</b><br>
5049   * Type: <b>string</b><br>
5050   * Path: <b>Questionnaire.title</b><br>
5051   * </p>
5052   */
5053  @SearchParamDefinition(name="title", path="Questionnaire.title", description="The human-friendly name of the questionnaire", type="string" )
5054  public static final String SP_TITLE = "title";
5055 /**
5056   * <b>Fluent Client</b> search parameter constant for <b>title</b>
5057   * <p>
5058   * Description: <b>The human-friendly name of the questionnaire</b><br>
5059   * Type: <b>string</b><br>
5060   * Path: <b>Questionnaire.title</b><br>
5061   * </p>
5062   */
5063  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
5064
5065 /**
5066   * Search parameter: <b>version</b>
5067   * <p>
5068   * Description: <b>The business version of the questionnaire</b><br>
5069   * Type: <b>token</b><br>
5070   * Path: <b>Questionnaire.version</b><br>
5071   * </p>
5072   */
5073  @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="token" )
5074  public static final String SP_VERSION = "version";
5075 /**
5076   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5077   * <p>
5078   * Description: <b>The business version of the questionnaire</b><br>
5079   * Type: <b>token</b><br>
5080   * Path: <b>Questionnaire.version</b><br>
5081   * </p>
5082   */
5083  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
5084
5085 /**
5086   * Search parameter: <b>url</b>
5087   * <p>
5088   * Description: <b>The uri that identifies the questionnaire</b><br>
5089   * Type: <b>uri</b><br>
5090   * Path: <b>Questionnaire.url</b><br>
5091   * </p>
5092   */
5093  @SearchParamDefinition(name="url", path="Questionnaire.url", description="The uri that identifies the questionnaire", type="uri" )
5094  public static final String SP_URL = "url";
5095 /**
5096   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5097   * <p>
5098   * Description: <b>The uri that identifies the questionnaire</b><br>
5099   * Type: <b>uri</b><br>
5100   * Path: <b>Questionnaire.url</b><br>
5101   * </p>
5102   */
5103  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5104
5105 /**
5106   * Search parameter: <b>context-quantity</b>
5107   * <p>
5108   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5109   * Type: <b>quantity</b><br>
5110   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5111   * </p>
5112   */
5113  @SearchParamDefinition(name="context-quantity", path="(Questionnaire.useContext.value as Quantity) | (Questionnaire.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the questionnaire", type="quantity" )
5114  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
5115 /**
5116   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
5117   * <p>
5118   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5119   * Type: <b>quantity</b><br>
5120   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5121   * </p>
5122   */
5123  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
5124
5125 /**
5126   * Search parameter: <b>effective</b>
5127   * <p>
5128   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5129   * Type: <b>date</b><br>
5130   * Path: <b>Questionnaire.effectivePeriod</b><br>
5131   * </p>
5132   */
5133  @SearchParamDefinition(name="effective", path="Questionnaire.effectivePeriod", description="The time during which the questionnaire is intended to be in use", type="date" )
5134  public static final String SP_EFFECTIVE = "effective";
5135 /**
5136   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
5137   * <p>
5138   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5139   * Type: <b>date</b><br>
5140   * Path: <b>Questionnaire.effectivePeriod</b><br>
5141   * </p>
5142   */
5143  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
5144
5145 /**
5146   * Search parameter: <b>subject-type</b>
5147   * <p>
5148   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5149   * Type: <b>token</b><br>
5150   * Path: <b>Questionnaire.subjectType</b><br>
5151   * </p>
5152   */
5153  @SearchParamDefinition(name="subject-type", path="Questionnaire.subjectType", description="Resource that can be subject of QuestionnaireResponse", type="token" )
5154  public static final String SP_SUBJECT_TYPE = "subject-type";
5155 /**
5156   * <b>Fluent Client</b> search parameter constant for <b>subject-type</b>
5157   * <p>
5158   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5159   * Type: <b>token</b><br>
5160   * Path: <b>Questionnaire.subjectType</b><br>
5161   * </p>
5162   */
5163  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBJECT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBJECT_TYPE);
5164
5165 /**
5166   * Search parameter: <b>name</b>
5167   * <p>
5168   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5169   * Type: <b>string</b><br>
5170   * Path: <b>Questionnaire.name</b><br>
5171   * </p>
5172   */
5173  @SearchParamDefinition(name="name", path="Questionnaire.name", description="Computationally friendly name of the questionnaire", type="string" )
5174  public static final String SP_NAME = "name";
5175 /**
5176   * <b>Fluent Client</b> search parameter constant for <b>name</b>
5177   * <p>
5178   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5179   * Type: <b>string</b><br>
5180   * Path: <b>Questionnaire.name</b><br>
5181   * </p>
5182   */
5183  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
5184
5185 /**
5186   * Search parameter: <b>context</b>
5187   * <p>
5188   * Description: <b>A use context assigned to the questionnaire</b><br>
5189   * Type: <b>token</b><br>
5190   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5191   * </p>
5192   */
5193  @SearchParamDefinition(name="context", path="(Questionnaire.useContext.value as CodeableConcept)", description="A use context assigned to the questionnaire", type="token" )
5194  public static final String SP_CONTEXT = "context";
5195 /**
5196   * <b>Fluent Client</b> search parameter constant for <b>context</b>
5197   * <p>
5198   * Description: <b>A use context assigned to the questionnaire</b><br>
5199   * Type: <b>token</b><br>
5200   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5201   * </p>
5202   */
5203  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
5204
5205 /**
5206   * Search parameter: <b>publisher</b>
5207   * <p>
5208   * Description: <b>Name of the publisher of the questionnaire</b><br>
5209   * Type: <b>string</b><br>
5210   * Path: <b>Questionnaire.publisher</b><br>
5211   * </p>
5212   */
5213  @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="Name of the publisher of the questionnaire", type="string" )
5214  public static final String SP_PUBLISHER = "publisher";
5215 /**
5216   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
5217   * <p>
5218   * Description: <b>Name of the publisher of the questionnaire</b><br>
5219   * Type: <b>string</b><br>
5220   * Path: <b>Questionnaire.publisher</b><br>
5221   * </p>
5222   */
5223  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
5224
5225 /**
5226   * Search parameter: <b>definition</b>
5227   * <p>
5228   * Description: <b>ElementDefinition - details for the item</b><br>
5229   * Type: <b>uri</b><br>
5230   * Path: <b>Questionnaire.item.definition</b><br>
5231   * </p>
5232   */
5233  @SearchParamDefinition(name="definition", path="Questionnaire.item.definition", description="ElementDefinition - details for the item", type="uri" )
5234  public static final String SP_DEFINITION = "definition";
5235 /**
5236   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
5237   * <p>
5238   * Description: <b>ElementDefinition - details for the item</b><br>
5239   * Type: <b>uri</b><br>
5240   * Path: <b>Questionnaire.item.definition</b><br>
5241   * </p>
5242   */
5243  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DEFINITION);
5244
5245 /**
5246   * Search parameter: <b>context-type-quantity</b>
5247   * <p>
5248   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5249   * Type: <b>composite</b><br>
5250   * Path: <b></b><br>
5251   * </p>
5252   */
5253  @SearchParamDefinition(name="context-type-quantity", path="Questionnaire.useContext", description="A use context type and quantity- or range-based value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context-quantity"} )
5254  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
5255 /**
5256   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
5257   * <p>
5258   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5259   * Type: <b>composite</b><br>
5260   * Path: <b></b><br>
5261   * </p>
5262   */
5263  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(SP_CONTEXT_TYPE_QUANTITY);
5264
5265 /**
5266   * Search parameter: <b>status</b>
5267   * <p>
5268   * Description: <b>The current status of the questionnaire</b><br>
5269   * Type: <b>token</b><br>
5270   * Path: <b>Questionnaire.status</b><br>
5271   * </p>
5272   */
5273  @SearchParamDefinition(name="status", path="Questionnaire.status", description="The current status of the questionnaire", type="token" )
5274  public static final String SP_STATUS = "status";
5275 /**
5276   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5277   * <p>
5278   * Description: <b>The current status of the questionnaire</b><br>
5279   * Type: <b>token</b><br>
5280   * Path: <b>Questionnaire.status</b><br>
5281   * </p>
5282   */
5283  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5284
5285// added from java-adornments.txt:
5286
5287  public QuestionnaireItemComponent getQuestion(String linkId) {
5288    if (linkId == null)
5289      return null;
5290    for (QuestionnaireItemComponent i : getItem()) {
5291      if (i.getLinkId().equals(linkId))
5292        return i;
5293      QuestionnaireItemComponent t = i.getQuestion(linkId);
5294      if (t != null)
5295        return t;
5296    }
5297    return null;
5298  }
5299
5300  public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
5301    for (QuestionnaireItemComponent i : getItem()) {
5302      QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
5303      if (t != null)
5304        return t;
5305    }
5306    return null;
5307  }
5308
5309
5310// end addition
5311
5312}
5313