001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056
057import org.hl7.fhir.exceptions.FHIRException;
058import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
059import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
060import org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory;
061import org.hl7.fhir.utilities.Utilities;
062
063import ca.uhn.fhir.model.api.annotation.Block;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.ResourceDef;
068import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
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        dst.linkId = linkId == null ? null : linkId.copy();
1900        dst.definition = definition == null ? null : definition.copy();
1901        if (code != null) {
1902          dst.code = new ArrayList<Coding>();
1903          for (Coding i : code)
1904            dst.code.add(i.copy());
1905        };
1906        dst.prefix = prefix == null ? null : prefix.copy();
1907        dst.text = text == null ? null : text.copy();
1908        dst.type = type == null ? null : type.copy();
1909        if (enableWhen != null) {
1910          dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1911          for (QuestionnaireItemEnableWhenComponent i : enableWhen)
1912            dst.enableWhen.add(i.copy());
1913        };
1914        dst.enableBehavior = enableBehavior == null ? null : enableBehavior.copy();
1915        dst.required = required == null ? null : required.copy();
1916        dst.repeats = repeats == null ? null : repeats.copy();
1917        dst.readOnly = readOnly == null ? null : readOnly.copy();
1918        dst.maxLength = maxLength == null ? null : maxLength.copy();
1919        dst.answerValueSet = answerValueSet == null ? null : answerValueSet.copy();
1920        if (answerOption != null) {
1921          dst.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1922          for (QuestionnaireItemAnswerOptionComponent i : answerOption)
1923            dst.answerOption.add(i.copy());
1924        };
1925        if (initial != null) {
1926          dst.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1927          for (QuestionnaireItemInitialComponent i : initial)
1928            dst.initial.add(i.copy());
1929        };
1930        if (item != null) {
1931          dst.item = new ArrayList<QuestionnaireItemComponent>();
1932          for (QuestionnaireItemComponent i : item)
1933            dst.item.add(i.copy());
1934        };
1935        return dst;
1936      }
1937
1938      @Override
1939      public boolean equalsDeep(Base other_) {
1940        if (!super.equalsDeep(other_))
1941          return false;
1942        if (!(other_ instanceof QuestionnaireItemComponent))
1943          return false;
1944        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1945        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(code, o.code, true)
1946           && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true) && compareDeep(type, o.type, true)
1947           && compareDeep(enableWhen, o.enableWhen, true) && compareDeep(enableBehavior, o.enableBehavior, true)
1948           && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true) && compareDeep(readOnly, o.readOnly, true)
1949           && compareDeep(maxLength, o.maxLength, true) && compareDeep(answerValueSet, o.answerValueSet, true)
1950           && compareDeep(answerOption, o.answerOption, true) && compareDeep(initial, o.initial, true) && compareDeep(item, o.item, true)
1951          ;
1952      }
1953
1954      @Override
1955      public boolean equalsShallow(Base other_) {
1956        if (!super.equalsShallow(other_))
1957          return false;
1958        if (!(other_ instanceof QuestionnaireItemComponent))
1959          return false;
1960        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
1961        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(prefix, o.prefix, true)
1962           && compareValues(text, o.text, true) && compareValues(type, o.type, true) && compareValues(enableBehavior, o.enableBehavior, true)
1963           && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true) && compareValues(readOnly, o.readOnly, true)
1964           && compareValues(maxLength, o.maxLength, true);
1965      }
1966
1967      public boolean isEmpty() {
1968        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code
1969          , prefix, text, type, enableWhen, enableBehavior, required, repeats, readOnly
1970          , maxLength, answerValueSet, answerOption, initial, item);
1971      }
1972
1973  public String fhirType() {
1974    return "Questionnaire.item";
1975
1976  }
1977
1978      public QuestionnaireItemComponent getQuestion(String linkId) {
1979        if (linkId == null)
1980          return null;
1981        for (QuestionnaireItemComponent i : getItem()) {
1982          if (i.getLinkId().equals(linkId))
1983            return i;
1984          QuestionnaireItemComponent t = i.getQuestion(linkId);
1985          if (t != null)
1986            return t;
1987        }
1988        return null;
1989      }
1990
1991      public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
1992        if (q1 == null || q2 == null)
1993          return null;
1994        for (QuestionnaireItemComponent i : getItem()) {
1995          QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
1996          if (t != null)
1997            return t;
1998        }
1999        if (containsQuestion(q1) && containsQuestion(q2))
2000          return this;
2001        return null;
2002      }
2003
2004      public boolean containsQuestion(QuestionnaireItemComponent q) {
2005        if (q == this)
2006          return true;
2007        for (QuestionnaireItemComponent i : getItem()) {
2008          if (i.containsQuestion(q))
2009            return true;
2010        }
2011        return false;
2012      }
2013
2014  }
2015
2016    @Block()
2017    public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
2018        /**
2019         * The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2020         */
2021        @Child(name = "question", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2022        @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." )
2023        protected StringType question;
2024
2025        /**
2026         * Specifies the criteria by which the question is enabled.
2027         */
2028        @Child(name = "operator", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2029        @Description(shortDefinition="exists | = | != | > | < | >= | <=", formalDefinition="Specifies the criteria by which the question is enabled." )
2030        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-operator")
2031        protected Enumeration<QuestionnaireItemOperator> operator;
2032
2033        /**
2034         * A value that the referenced question is tested using the specified operator in order for the item to be enabled.
2035         */
2036        @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)
2037        @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." )
2038        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2039        protected Type answer;
2040
2041        private static final long serialVersionUID = -1815133868L;
2042
2043    /**
2044     * Constructor
2045     */
2046      public QuestionnaireItemEnableWhenComponent() {
2047        super();
2048      }
2049
2050    /**
2051     * Constructor
2052     */
2053      public QuestionnaireItemEnableWhenComponent(StringType question, Enumeration<QuestionnaireItemOperator> operator, Type answer) {
2054        super();
2055        this.question = question;
2056        this.operator = operator;
2057        this.answer = answer;
2058      }
2059
2060        /**
2061         * @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
2062         */
2063        public StringType getQuestionElement() { 
2064          if (this.question == null)
2065            if (Configuration.errorOnAutoCreate())
2066              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
2067            else if (Configuration.doAutoCreate())
2068              this.question = new StringType(); // bb
2069          return this.question;
2070        }
2071
2072        public boolean hasQuestionElement() { 
2073          return this.question != null && !this.question.isEmpty();
2074        }
2075
2076        public boolean hasQuestion() { 
2077          return this.question != null && !this.question.isEmpty();
2078        }
2079
2080        /**
2081         * @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
2082         */
2083        public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) { 
2084          this.question = value;
2085          return this;
2086        }
2087
2088        /**
2089         * @return The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2090         */
2091        public String getQuestion() { 
2092          return this.question == null ? null : this.question.getValue();
2093        }
2094
2095        /**
2096         * @param value The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2097         */
2098        public QuestionnaireItemEnableWhenComponent setQuestion(String value) { 
2099            if (this.question == null)
2100              this.question = new StringType();
2101            this.question.setValue(value);
2102          return this;
2103        }
2104
2105        /**
2106         * @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
2107         */
2108        public Enumeration<QuestionnaireItemOperator> getOperatorElement() { 
2109          if (this.operator == null)
2110            if (Configuration.errorOnAutoCreate())
2111              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.operator");
2112            else if (Configuration.doAutoCreate())
2113              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory()); // bb
2114          return this.operator;
2115        }
2116
2117        public boolean hasOperatorElement() { 
2118          return this.operator != null && !this.operator.isEmpty();
2119        }
2120
2121        public boolean hasOperator() { 
2122          return this.operator != null && !this.operator.isEmpty();
2123        }
2124
2125        /**
2126         * @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
2127         */
2128        public QuestionnaireItemEnableWhenComponent setOperatorElement(Enumeration<QuestionnaireItemOperator> value) { 
2129          this.operator = value;
2130          return this;
2131        }
2132
2133        /**
2134         * @return Specifies the criteria by which the question is enabled.
2135         */
2136        public QuestionnaireItemOperator getOperator() { 
2137          return this.operator == null ? null : this.operator.getValue();
2138        }
2139
2140        /**
2141         * @param value Specifies the criteria by which the question is enabled.
2142         */
2143        public QuestionnaireItemEnableWhenComponent setOperator(QuestionnaireItemOperator value) { 
2144            if (this.operator == null)
2145              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory());
2146            this.operator.setValue(value);
2147          return this;
2148        }
2149
2150        /**
2151         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2152         */
2153        public Type getAnswer() { 
2154          return this.answer;
2155        }
2156
2157        /**
2158         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2159         */
2160        public BooleanType getAnswerBooleanType() throws FHIRException { 
2161          if (this.answer == null)
2162            this.answer = new BooleanType();
2163          if (!(this.answer instanceof BooleanType))
2164            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.answer.getClass().getName()+" was encountered");
2165          return (BooleanType) this.answer;
2166        }
2167
2168        public boolean hasAnswerBooleanType() { 
2169          return this != null && this.answer instanceof BooleanType;
2170        }
2171
2172        /**
2173         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2174         */
2175        public DecimalType getAnswerDecimalType() throws FHIRException { 
2176          if (this.answer == null)
2177            this.answer = new DecimalType();
2178          if (!(this.answer instanceof DecimalType))
2179            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.answer.getClass().getName()+" was encountered");
2180          return (DecimalType) this.answer;
2181        }
2182
2183        public boolean hasAnswerDecimalType() { 
2184          return this != null && this.answer instanceof DecimalType;
2185        }
2186
2187        /**
2188         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2189         */
2190        public IntegerType getAnswerIntegerType() throws FHIRException { 
2191          if (this.answer == null)
2192            this.answer = new IntegerType();
2193          if (!(this.answer instanceof IntegerType))
2194            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.answer.getClass().getName()+" was encountered");
2195          return (IntegerType) this.answer;
2196        }
2197
2198        public boolean hasAnswerIntegerType() { 
2199          return this != null && this.answer instanceof IntegerType;
2200        }
2201
2202        /**
2203         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2204         */
2205        public DateType getAnswerDateType() throws FHIRException { 
2206          if (this.answer == null)
2207            this.answer = new DateType();
2208          if (!(this.answer instanceof DateType))
2209            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.answer.getClass().getName()+" was encountered");
2210          return (DateType) this.answer;
2211        }
2212
2213        public boolean hasAnswerDateType() { 
2214          return this != null && this.answer instanceof DateType;
2215        }
2216
2217        /**
2218         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2219         */
2220        public DateTimeType getAnswerDateTimeType() throws FHIRException { 
2221          if (this.answer == null)
2222            this.answer = new DateTimeType();
2223          if (!(this.answer instanceof DateTimeType))
2224            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2225          return (DateTimeType) this.answer;
2226        }
2227
2228        public boolean hasAnswerDateTimeType() { 
2229          return this != null && this.answer instanceof DateTimeType;
2230        }
2231
2232        /**
2233         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2234         */
2235        public TimeType getAnswerTimeType() throws FHIRException { 
2236          if (this.answer == null)
2237            this.answer = new TimeType();
2238          if (!(this.answer instanceof TimeType))
2239            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2240          return (TimeType) this.answer;
2241        }
2242
2243        public boolean hasAnswerTimeType() { 
2244          return this != null && this.answer instanceof TimeType;
2245        }
2246
2247        /**
2248         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2249         */
2250        public StringType getAnswerStringType() throws FHIRException { 
2251          if (this.answer == null)
2252            this.answer = new StringType();
2253          if (!(this.answer instanceof StringType))
2254            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.answer.getClass().getName()+" was encountered");
2255          return (StringType) this.answer;
2256        }
2257
2258        public boolean hasAnswerStringType() { 
2259          return this != null && this.answer instanceof StringType;
2260        }
2261
2262        /**
2263         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2264         */
2265        public Coding getAnswerCoding() throws FHIRException { 
2266          if (this.answer == null)
2267            this.answer = new Coding();
2268          if (!(this.answer instanceof Coding))
2269            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.answer.getClass().getName()+" was encountered");
2270          return (Coding) this.answer;
2271        }
2272
2273        public boolean hasAnswerCoding() { 
2274          return this != null && this.answer instanceof Coding;
2275        }
2276
2277        /**
2278         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2279         */
2280        public Quantity getAnswerQuantity() throws FHIRException { 
2281          if (this.answer == null)
2282            this.answer = new Quantity();
2283          if (!(this.answer instanceof Quantity))
2284            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.answer.getClass().getName()+" was encountered");
2285          return (Quantity) this.answer;
2286        }
2287
2288        public boolean hasAnswerQuantity() { 
2289          return this != null && this.answer instanceof Quantity;
2290        }
2291
2292        /**
2293         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2294         */
2295        public Reference getAnswerReference() throws FHIRException { 
2296          if (this.answer == null)
2297            this.answer = new Reference();
2298          if (!(this.answer instanceof Reference))
2299            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.answer.getClass().getName()+" was encountered");
2300          return (Reference) this.answer;
2301        }
2302
2303        public boolean hasAnswerReference() { 
2304          return this != null && this.answer instanceof Reference;
2305        }
2306
2307        public boolean hasAnswer() { 
2308          return this.answer != null && !this.answer.isEmpty();
2309        }
2310
2311        /**
2312         * @param value {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.)
2313         */
2314        public QuestionnaireItemEnableWhenComponent setAnswer(Type value) { 
2315          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))
2316            throw new Error("Not the right type for Questionnaire.item.enableWhen.answer[x]: "+value.fhirType());
2317          this.answer = value;
2318          return this;
2319        }
2320
2321        protected void listChildren(List<Property> children) {
2322          super.listChildren(children);
2323          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));
2324          children.add(new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator));
2325          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));
2326        }
2327
2328        @Override
2329        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2330          switch (_hash) {
2331          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);
2332          case -500553564: /*operator*/  return new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator);
2333          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);
2334          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);
2335          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);
2336          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);
2337          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);
2338          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);
2339          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);
2340          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);
2341          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);
2342          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);
2343          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);
2344          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);
2345          default: return super.getNamedProperty(_hash, _name, _checkValid);
2346          }
2347
2348        }
2349
2350      @Override
2351      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2352        switch (hash) {
2353        case -1165870106: /*question*/ return this.question == null ? new Base[0] : new Base[] {this.question}; // StringType
2354        case -500553564: /*operator*/ return this.operator == null ? new Base[0] : new Base[] {this.operator}; // Enumeration<QuestionnaireItemOperator>
2355        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : new Base[] {this.answer}; // Type
2356        default: return super.getProperty(hash, name, checkValid);
2357        }
2358
2359      }
2360
2361      @Override
2362      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2363        switch (hash) {
2364        case -1165870106: // question
2365          this.question = castToString(value); // StringType
2366          return value;
2367        case -500553564: // operator
2368          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2369          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2370          return value;
2371        case -1412808770: // answer
2372          this.answer = castToType(value); // Type
2373          return value;
2374        default: return super.setProperty(hash, name, value);
2375        }
2376
2377      }
2378
2379      @Override
2380      public Base setProperty(String name, Base value) throws FHIRException {
2381        if (name.equals("question")) {
2382          this.question = castToString(value); // StringType
2383        } else if (name.equals("operator")) {
2384          value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2385          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2386        } else if (name.equals("answer[x]")) {
2387          this.answer = castToType(value); // Type
2388        } else
2389          return super.setProperty(name, value);
2390        return value;
2391      }
2392
2393      @Override
2394      public Base makeProperty(int hash, String name) throws FHIRException {
2395        switch (hash) {
2396        case -1165870106:  return getQuestionElement();
2397        case -500553564:  return getOperatorElement();
2398        case 1693524994:  return getAnswer(); 
2399        case -1412808770:  return getAnswer(); 
2400        default: return super.makeProperty(hash, name);
2401        }
2402
2403      }
2404
2405      @Override
2406      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2407        switch (hash) {
2408        case -1165870106: /*question*/ return new String[] {"string"};
2409        case -500553564: /*operator*/ return new String[] {"code"};
2410        case -1412808770: /*answer*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "Coding", "Quantity", "Reference"};
2411        default: return super.getTypesForProperty(hash, name);
2412        }
2413
2414      }
2415
2416      @Override
2417      public Base addChild(String name) throws FHIRException {
2418        if (name.equals("question")) {
2419          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.question");
2420        }
2421        else if (name.equals("operator")) {
2422          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.operator");
2423        }
2424        else if (name.equals("answerBoolean")) {
2425          this.answer = new BooleanType();
2426          return this.answer;
2427        }
2428        else if (name.equals("answerDecimal")) {
2429          this.answer = new DecimalType();
2430          return this.answer;
2431        }
2432        else if (name.equals("answerInteger")) {
2433          this.answer = new IntegerType();
2434          return this.answer;
2435        }
2436        else if (name.equals("answerDate")) {
2437          this.answer = new DateType();
2438          return this.answer;
2439        }
2440        else if (name.equals("answerDateTime")) {
2441          this.answer = new DateTimeType();
2442          return this.answer;
2443        }
2444        else if (name.equals("answerTime")) {
2445          this.answer = new TimeType();
2446          return this.answer;
2447        }
2448        else if (name.equals("answerString")) {
2449          this.answer = new StringType();
2450          return this.answer;
2451        }
2452        else if (name.equals("answerCoding")) {
2453          this.answer = new Coding();
2454          return this.answer;
2455        }
2456        else if (name.equals("answerQuantity")) {
2457          this.answer = new Quantity();
2458          return this.answer;
2459        }
2460        else if (name.equals("answerReference")) {
2461          this.answer = new Reference();
2462          return this.answer;
2463        }
2464        else
2465          return super.addChild(name);
2466      }
2467
2468      public QuestionnaireItemEnableWhenComponent copy() {
2469        QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
2470        copyValues(dst);
2471        dst.question = question == null ? null : question.copy();
2472        dst.operator = operator == null ? null : operator.copy();
2473        dst.answer = answer == null ? null : answer.copy();
2474        return dst;
2475      }
2476
2477      @Override
2478      public boolean equalsDeep(Base other_) {
2479        if (!super.equalsDeep(other_))
2480          return false;
2481        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2482          return false;
2483        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2484        return compareDeep(question, o.question, true) && compareDeep(operator, o.operator, true) && compareDeep(answer, o.answer, true)
2485          ;
2486      }
2487
2488      @Override
2489      public boolean equalsShallow(Base other_) {
2490        if (!super.equalsShallow(other_))
2491          return false;
2492        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2493          return false;
2494        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2495        return compareValues(question, o.question, true) && compareValues(operator, o.operator, true);
2496      }
2497
2498      public boolean isEmpty() {
2499        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, operator, answer
2500          );
2501      }
2502
2503  public String fhirType() {
2504    return "Questionnaire.item.enableWhen";
2505
2506  }
2507
2508  }
2509
2510    @Block()
2511    public static class QuestionnaireItemAnswerOptionComponent extends BackboneElement implements IBaseBackboneElement {
2512        /**
2513         * A potential answer that's allowed as the answer to this question.
2514         */
2515        @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)
2516        @Description(shortDefinition="Answer value", formalDefinition="A potential answer that's allowed as the answer to this question." )
2517        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2518        protected Type value;
2519
2520        /**
2521         * Indicates whether the answer value is selected when the list of possible answers is initially shown.
2522         */
2523        @Child(name = "initialSelected", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2524        @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." )
2525        protected BooleanType initialSelected;
2526
2527        private static final long serialVersionUID = 1703686148L;
2528
2529    /**
2530     * Constructor
2531     */
2532      public QuestionnaireItemAnswerOptionComponent() {
2533        super();
2534      }
2535
2536    /**
2537     * Constructor
2538     */
2539      public QuestionnaireItemAnswerOptionComponent(Type value) {
2540        super();
2541        this.value = value;
2542      }
2543
2544        /**
2545         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2546         */
2547        public Type getValue() { 
2548          return this.value;
2549        }
2550
2551        /**
2552         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2553         */
2554        public IntegerType getValueIntegerType() throws FHIRException { 
2555          if (this.value == null)
2556            this.value = new IntegerType();
2557          if (!(this.value instanceof IntegerType))
2558            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2559          return (IntegerType) this.value;
2560        }
2561
2562        public boolean hasValueIntegerType() { 
2563          return this != null && this.value instanceof IntegerType;
2564        }
2565
2566        /**
2567         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2568         */
2569        public DateType getValueDateType() throws FHIRException { 
2570          if (this.value == null)
2571            this.value = new DateType();
2572          if (!(this.value instanceof DateType))
2573            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2574          return (DateType) this.value;
2575        }
2576
2577        public boolean hasValueDateType() { 
2578          return this != null && this.value instanceof DateType;
2579        }
2580
2581        /**
2582         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2583         */
2584        public TimeType getValueTimeType() throws FHIRException { 
2585          if (this.value == null)
2586            this.value = new TimeType();
2587          if (!(this.value instanceof TimeType))
2588            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2589          return (TimeType) this.value;
2590        }
2591
2592        public boolean hasValueTimeType() { 
2593          return this != null && this.value instanceof TimeType;
2594        }
2595
2596        /**
2597         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2598         */
2599        public StringType getValueStringType() throws FHIRException { 
2600          if (this.value == null)
2601            this.value = new StringType();
2602          if (!(this.value instanceof StringType))
2603            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2604          return (StringType) this.value;
2605        }
2606
2607        public boolean hasValueStringType() { 
2608          return this != null && this.value instanceof StringType;
2609        }
2610
2611        /**
2612         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2613         */
2614        public Coding getValueCoding() throws FHIRException { 
2615          if (this.value == null)
2616            this.value = new Coding();
2617          if (!(this.value instanceof Coding))
2618            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2619          return (Coding) this.value;
2620        }
2621
2622        public boolean hasValueCoding() { 
2623          return this != null && this.value instanceof Coding;
2624        }
2625
2626        /**
2627         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2628         */
2629        public Reference getValueReference() throws FHIRException { 
2630          if (this.value == null)
2631            this.value = new Reference();
2632          if (!(this.value instanceof Reference))
2633            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
2634          return (Reference) this.value;
2635        }
2636
2637        public boolean hasValueReference() { 
2638          return this != null && this.value instanceof Reference;
2639        }
2640
2641        public boolean hasValue() { 
2642          return this.value != null && !this.value.isEmpty();
2643        }
2644
2645        /**
2646         * @param value {@link #value} (A potential answer that's allowed as the answer to this question.)
2647         */
2648        public QuestionnaireItemAnswerOptionComponent setValue(Type value) { 
2649          if (value != null && !(value instanceof IntegerType || value instanceof DateType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Reference))
2650            throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: "+value.fhirType());
2651          this.value = value;
2652          return this;
2653        }
2654
2655        /**
2656         * @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
2657         */
2658        public BooleanType getInitialSelectedElement() { 
2659          if (this.initialSelected == null)
2660            if (Configuration.errorOnAutoCreate())
2661              throw new Error("Attempt to auto-create QuestionnaireItemAnswerOptionComponent.initialSelected");
2662            else if (Configuration.doAutoCreate())
2663              this.initialSelected = new BooleanType(); // bb
2664          return this.initialSelected;
2665        }
2666
2667        public boolean hasInitialSelectedElement() { 
2668          return this.initialSelected != null && !this.initialSelected.isEmpty();
2669        }
2670
2671        public boolean hasInitialSelected() { 
2672          return this.initialSelected != null && !this.initialSelected.isEmpty();
2673        }
2674
2675        /**
2676         * @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
2677         */
2678        public QuestionnaireItemAnswerOptionComponent setInitialSelectedElement(BooleanType value) { 
2679          this.initialSelected = value;
2680          return this;
2681        }
2682
2683        /**
2684         * @return Indicates whether the answer value is selected when the list of possible answers is initially shown.
2685         */
2686        public boolean getInitialSelected() { 
2687          return this.initialSelected == null || this.initialSelected.isEmpty() ? false : this.initialSelected.getValue();
2688        }
2689
2690        /**
2691         * @param value Indicates whether the answer value is selected when the list of possible answers is initially shown.
2692         */
2693        public QuestionnaireItemAnswerOptionComponent setInitialSelected(boolean value) { 
2694            if (this.initialSelected == null)
2695              this.initialSelected = new BooleanType();
2696            this.initialSelected.setValue(value);
2697          return this;
2698        }
2699
2700        protected void listChildren(List<Property> children) {
2701          super.listChildren(children);
2702          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));
2703          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));
2704        }
2705
2706        @Override
2707        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2708          switch (_hash) {
2709          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);
2710          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);
2711          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);
2712          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);
2713          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);
2714          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);
2715          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);
2716          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);
2717          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);
2718          default: return super.getNamedProperty(_hash, _name, _checkValid);
2719          }
2720
2721        }
2722
2723      @Override
2724      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2725        switch (hash) {
2726        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2727        case -1310184961: /*initialSelected*/ return this.initialSelected == null ? new Base[0] : new Base[] {this.initialSelected}; // BooleanType
2728        default: return super.getProperty(hash, name, checkValid);
2729        }
2730
2731      }
2732
2733      @Override
2734      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2735        switch (hash) {
2736        case 111972721: // value
2737          this.value = castToType(value); // Type
2738          return value;
2739        case -1310184961: // initialSelected
2740          this.initialSelected = castToBoolean(value); // BooleanType
2741          return value;
2742        default: return super.setProperty(hash, name, value);
2743        }
2744
2745      }
2746
2747      @Override
2748      public Base setProperty(String name, Base value) throws FHIRException {
2749        if (name.equals("value[x]")) {
2750          this.value = castToType(value); // Type
2751        } else if (name.equals("initialSelected")) {
2752          this.initialSelected = castToBoolean(value); // BooleanType
2753        } else
2754          return super.setProperty(name, value);
2755        return value;
2756      }
2757
2758      @Override
2759      public Base makeProperty(int hash, String name) throws FHIRException {
2760        switch (hash) {
2761        case -1410166417:  return getValue(); 
2762        case 111972721:  return getValue(); 
2763        case -1310184961:  return getInitialSelectedElement();
2764        default: return super.makeProperty(hash, name);
2765        }
2766
2767      }
2768
2769      @Override
2770      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2771        switch (hash) {
2772        case 111972721: /*value*/ return new String[] {"integer", "date", "time", "string", "Coding", "Reference"};
2773        case -1310184961: /*initialSelected*/ return new String[] {"boolean"};
2774        default: return super.getTypesForProperty(hash, name);
2775        }
2776
2777      }
2778
2779      @Override
2780      public Base addChild(String name) throws FHIRException {
2781        if (name.equals("valueInteger")) {
2782          this.value = new IntegerType();
2783          return this.value;
2784        }
2785        else if (name.equals("valueDate")) {
2786          this.value = new DateType();
2787          return this.value;
2788        }
2789        else if (name.equals("valueTime")) {
2790          this.value = new TimeType();
2791          return this.value;
2792        }
2793        else if (name.equals("valueString")) {
2794          this.value = new StringType();
2795          return this.value;
2796        }
2797        else if (name.equals("valueCoding")) {
2798          this.value = new Coding();
2799          return this.value;
2800        }
2801        else if (name.equals("valueReference")) {
2802          this.value = new Reference();
2803          return this.value;
2804        }
2805        else if (name.equals("initialSelected")) {
2806          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.initialSelected");
2807        }
2808        else
2809          return super.addChild(name);
2810      }
2811
2812      public QuestionnaireItemAnswerOptionComponent copy() {
2813        QuestionnaireItemAnswerOptionComponent dst = new QuestionnaireItemAnswerOptionComponent();
2814        copyValues(dst);
2815        dst.value = value == null ? null : value.copy();
2816        dst.initialSelected = initialSelected == null ? null : initialSelected.copy();
2817        return dst;
2818      }
2819
2820      @Override
2821      public boolean equalsDeep(Base other_) {
2822        if (!super.equalsDeep(other_))
2823          return false;
2824        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2825          return false;
2826        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2827        return compareDeep(value, o.value, true) && compareDeep(initialSelected, o.initialSelected, true)
2828          ;
2829      }
2830
2831      @Override
2832      public boolean equalsShallow(Base other_) {
2833        if (!super.equalsShallow(other_))
2834          return false;
2835        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
2836          return false;
2837        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
2838        return compareValues(initialSelected, o.initialSelected, true);
2839      }
2840
2841      public boolean isEmpty() {
2842        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, initialSelected);
2843      }
2844
2845  public String fhirType() {
2846    return "Questionnaire.item.answerOption";
2847
2848  }
2849
2850  }
2851
2852    @Block()
2853    public static class QuestionnaireItemInitialComponent extends BackboneElement implements IBaseBackboneElement {
2854        /**
2855         * The actual value to for an initial answer.
2856         */
2857        @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)
2858        @Description(shortDefinition="Actual value for initializing the question", formalDefinition="The actual value to for an initial answer." )
2859        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2860        protected Type value;
2861
2862        private static final long serialVersionUID = -732981989L;
2863
2864    /**
2865     * Constructor
2866     */
2867      public QuestionnaireItemInitialComponent() {
2868        super();
2869      }
2870
2871    /**
2872     * Constructor
2873     */
2874      public QuestionnaireItemInitialComponent(Type value) {
2875        super();
2876        this.value = value;
2877      }
2878
2879        /**
2880         * @return {@link #value} (The actual value to for an initial answer.)
2881         */
2882        public Type getValue() { 
2883          return this.value;
2884        }
2885
2886        /**
2887         * @return {@link #value} (The actual value to for an initial answer.)
2888         */
2889        public BooleanType getValueBooleanType() throws FHIRException { 
2890          if (this.value == null)
2891            this.value = new BooleanType();
2892          if (!(this.value instanceof BooleanType))
2893            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2894          return (BooleanType) this.value;
2895        }
2896
2897        public boolean hasValueBooleanType() { 
2898          return this != null && this.value instanceof BooleanType;
2899        }
2900
2901        /**
2902         * @return {@link #value} (The actual value to for an initial answer.)
2903         */
2904        public DecimalType getValueDecimalType() throws FHIRException { 
2905          if (this.value == null)
2906            this.value = new DecimalType();
2907          if (!(this.value instanceof DecimalType))
2908            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2909          return (DecimalType) this.value;
2910        }
2911
2912        public boolean hasValueDecimalType() { 
2913          return this != null && this.value instanceof DecimalType;
2914        }
2915
2916        /**
2917         * @return {@link #value} (The actual value to for an initial answer.)
2918         */
2919        public IntegerType getValueIntegerType() throws FHIRException { 
2920          if (this.value == null)
2921            this.value = new IntegerType();
2922          if (!(this.value instanceof IntegerType))
2923            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2924          return (IntegerType) this.value;
2925        }
2926
2927        public boolean hasValueIntegerType() { 
2928          return this != null && this.value instanceof IntegerType;
2929        }
2930
2931        /**
2932         * @return {@link #value} (The actual value to for an initial answer.)
2933         */
2934        public DateType getValueDateType() throws FHIRException { 
2935          if (this.value == null)
2936            this.value = new DateType();
2937          if (!(this.value instanceof DateType))
2938            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2939          return (DateType) this.value;
2940        }
2941
2942        public boolean hasValueDateType() { 
2943          return this != null && this.value instanceof DateType;
2944        }
2945
2946        /**
2947         * @return {@link #value} (The actual value to for an initial answer.)
2948         */
2949        public DateTimeType getValueDateTimeType() throws FHIRException { 
2950          if (this.value == null)
2951            this.value = new DateTimeType();
2952          if (!(this.value instanceof DateTimeType))
2953            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2954          return (DateTimeType) this.value;
2955        }
2956
2957        public boolean hasValueDateTimeType() { 
2958          return this != null && this.value instanceof DateTimeType;
2959        }
2960
2961        /**
2962         * @return {@link #value} (The actual value to for an initial answer.)
2963         */
2964        public TimeType getValueTimeType() throws FHIRException { 
2965          if (this.value == null)
2966            this.value = new TimeType();
2967          if (!(this.value instanceof TimeType))
2968            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2969          return (TimeType) this.value;
2970        }
2971
2972        public boolean hasValueTimeType() { 
2973          return this != null && this.value instanceof TimeType;
2974        }
2975
2976        /**
2977         * @return {@link #value} (The actual value to for an initial answer.)
2978         */
2979        public StringType getValueStringType() throws FHIRException { 
2980          if (this.value == null)
2981            this.value = new StringType();
2982          if (!(this.value instanceof StringType))
2983            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2984          return (StringType) this.value;
2985        }
2986
2987        public boolean hasValueStringType() { 
2988          return this != null && this.value instanceof StringType;
2989        }
2990
2991        /**
2992         * @return {@link #value} (The actual value to for an initial answer.)
2993         */
2994        public UriType getValueUriType() throws FHIRException { 
2995          if (this.value == null)
2996            this.value = new UriType();
2997          if (!(this.value instanceof UriType))
2998            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
2999          return (UriType) this.value;
3000        }
3001
3002        public boolean hasValueUriType() { 
3003          return this != null && this.value instanceof UriType;
3004        }
3005
3006        /**
3007         * @return {@link #value} (The actual value to for an initial answer.)
3008         */
3009        public Attachment getValueAttachment() throws FHIRException { 
3010          if (this.value == null)
3011            this.value = new Attachment();
3012          if (!(this.value instanceof Attachment))
3013            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3014          return (Attachment) this.value;
3015        }
3016
3017        public boolean hasValueAttachment() { 
3018          return this != null && this.value instanceof Attachment;
3019        }
3020
3021        /**
3022         * @return {@link #value} (The actual value to for an initial answer.)
3023         */
3024        public Coding getValueCoding() throws FHIRException { 
3025          if (this.value == null)
3026            this.value = new Coding();
3027          if (!(this.value instanceof Coding))
3028            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3029          return (Coding) this.value;
3030        }
3031
3032        public boolean hasValueCoding() { 
3033          return this != null && this.value instanceof Coding;
3034        }
3035
3036        /**
3037         * @return {@link #value} (The actual value to for an initial answer.)
3038         */
3039        public Quantity getValueQuantity() throws FHIRException { 
3040          if (this.value == null)
3041            this.value = new Quantity();
3042          if (!(this.value instanceof Quantity))
3043            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3044          return (Quantity) this.value;
3045        }
3046
3047        public boolean hasValueQuantity() { 
3048          return this != null && this.value instanceof Quantity;
3049        }
3050
3051        /**
3052         * @return {@link #value} (The actual value to for an initial answer.)
3053         */
3054        public Reference getValueReference() throws FHIRException { 
3055          if (this.value == null)
3056            this.value = new Reference();
3057          if (!(this.value instanceof Reference))
3058            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3059          return (Reference) this.value;
3060        }
3061
3062        public boolean hasValueReference() { 
3063          return this != null && this.value instanceof Reference;
3064        }
3065
3066        public boolean hasValue() { 
3067          return this.value != null && !this.value.isEmpty();
3068        }
3069
3070        /**
3071         * @param value {@link #value} (The actual value to for an initial answer.)
3072         */
3073        public QuestionnaireItemInitialComponent setValue(Type value) { 
3074          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))
3075            throw new Error("Not the right type for Questionnaire.item.initial.value[x]: "+value.fhirType());
3076          this.value = value;
3077          return this;
3078        }
3079
3080        protected void listChildren(List<Property> children) {
3081          super.listChildren(children);
3082          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));
3083        }
3084
3085        @Override
3086        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3087          switch (_hash) {
3088          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);
3089          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);
3090          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);
3091          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);
3092          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);
3093          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);
3094          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);
3095          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);
3096          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);
3097          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);
3098          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);
3099          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);
3100          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);
3101          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);
3102          default: return super.getNamedProperty(_hash, _name, _checkValid);
3103          }
3104
3105        }
3106
3107      @Override
3108      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3109        switch (hash) {
3110        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
3111        default: return super.getProperty(hash, name, checkValid);
3112        }
3113
3114      }
3115
3116      @Override
3117      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3118        switch (hash) {
3119        case 111972721: // value
3120          this.value = castToType(value); // Type
3121          return value;
3122        default: return super.setProperty(hash, name, value);
3123        }
3124
3125      }
3126
3127      @Override
3128      public Base setProperty(String name, Base value) throws FHIRException {
3129        if (name.equals("value[x]")) {
3130          this.value = castToType(value); // Type
3131        } else
3132          return super.setProperty(name, value);
3133        return value;
3134      }
3135
3136      @Override
3137      public Base makeProperty(int hash, String name) throws FHIRException {
3138        switch (hash) {
3139        case -1410166417:  return getValue(); 
3140        case 111972721:  return getValue(); 
3141        default: return super.makeProperty(hash, name);
3142        }
3143
3144      }
3145
3146      @Override
3147      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3148        switch (hash) {
3149        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3150        default: return super.getTypesForProperty(hash, name);
3151        }
3152
3153      }
3154
3155      @Override
3156      public Base addChild(String name) throws FHIRException {
3157        if (name.equals("valueBoolean")) {
3158          this.value = new BooleanType();
3159          return this.value;
3160        }
3161        else if (name.equals("valueDecimal")) {
3162          this.value = new DecimalType();
3163          return this.value;
3164        }
3165        else if (name.equals("valueInteger")) {
3166          this.value = new IntegerType();
3167          return this.value;
3168        }
3169        else if (name.equals("valueDate")) {
3170          this.value = new DateType();
3171          return this.value;
3172        }
3173        else if (name.equals("valueDateTime")) {
3174          this.value = new DateTimeType();
3175          return this.value;
3176        }
3177        else if (name.equals("valueTime")) {
3178          this.value = new TimeType();
3179          return this.value;
3180        }
3181        else if (name.equals("valueString")) {
3182          this.value = new StringType();
3183          return this.value;
3184        }
3185        else if (name.equals("valueUri")) {
3186          this.value = new UriType();
3187          return this.value;
3188        }
3189        else if (name.equals("valueAttachment")) {
3190          this.value = new Attachment();
3191          return this.value;
3192        }
3193        else if (name.equals("valueCoding")) {
3194          this.value = new Coding();
3195          return this.value;
3196        }
3197        else if (name.equals("valueQuantity")) {
3198          this.value = new Quantity();
3199          return this.value;
3200        }
3201        else if (name.equals("valueReference")) {
3202          this.value = new Reference();
3203          return this.value;
3204        }
3205        else
3206          return super.addChild(name);
3207      }
3208
3209      public QuestionnaireItemInitialComponent copy() {
3210        QuestionnaireItemInitialComponent dst = new QuestionnaireItemInitialComponent();
3211        copyValues(dst);
3212        dst.value = value == null ? null : value.copy();
3213        return dst;
3214      }
3215
3216      @Override
3217      public boolean equalsDeep(Base other_) {
3218        if (!super.equalsDeep(other_))
3219          return false;
3220        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3221          return false;
3222        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3223        return compareDeep(value, o.value, true);
3224      }
3225
3226      @Override
3227      public boolean equalsShallow(Base other_) {
3228        if (!super.equalsShallow(other_))
3229          return false;
3230        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3231          return false;
3232        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3233        return true;
3234      }
3235
3236      public boolean isEmpty() {
3237        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3238      }
3239
3240  public String fhirType() {
3241    return "Questionnaire.item.initial";
3242
3243  }
3244
3245  }
3246
3247    /**
3248     * 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.
3249     */
3250    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3251    @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." )
3252    protected List<Identifier> identifier;
3253
3254    /**
3255     * The URL of a Questionnaire that this Questionnaire is based on.
3256     */
3257    @Child(name = "derivedFrom", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3258    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL of a Questionnaire that this Questionnaire is based on." )
3259    protected List<CanonicalType> derivedFrom;
3260
3261    /**
3262     * The types of subjects that can be the subject of responses created for the questionnaire.
3263     */
3264    @Child(name = "subjectType", type = {CodeType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3265    @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." )
3266    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
3267    protected List<CodeType> subjectType;
3268
3269    /**
3270     * Explanation of why this questionnaire is needed and why it has been designed as it has.
3271     */
3272    @Child(name = "purpose", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3273    @Description(shortDefinition="Why this questionnaire is defined", formalDefinition="Explanation of why this questionnaire is needed and why it has been designed as it has." )
3274    protected MarkdownType purpose;
3275
3276    /**
3277     * 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.
3278     */
3279    @Child(name = "copyright", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
3280    @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." )
3281    protected MarkdownType copyright;
3282
3283    /**
3284     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3285     */
3286    @Child(name = "approvalDate", type = {DateType.class}, order=5, min=0, max=1, modifier=false, summary=false)
3287    @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." )
3288    protected DateType approvalDate;
3289
3290    /**
3291     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
3292     */
3293    @Child(name = "lastReviewDate", type = {DateType.class}, order=6, min=0, max=1, modifier=false, summary=false)
3294    @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." )
3295    protected DateType lastReviewDate;
3296
3297    /**
3298     * The period during which the questionnaire content was or is planned to be in active use.
3299     */
3300    @Child(name = "effectivePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
3301    @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." )
3302    protected Period effectivePeriod;
3303
3304    /**
3305     * An identifier for this question or group of questions in a particular terminology such as LOINC.
3306     */
3307    @Child(name = "code", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3308    @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." )
3309    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
3310    protected List<Coding> code;
3311
3312    /**
3313     * A particular question, question grouping or display text that is part of the questionnaire.
3314     */
3315    @Child(name = "item", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3316    @Description(shortDefinition="Questions and sections within the Questionnaire", formalDefinition="A particular question, question grouping or display text that is part of the questionnaire." )
3317    protected List<QuestionnaireItemComponent> item;
3318
3319    private static final long serialVersionUID = 1036031192L;
3320
3321  /**
3322   * Constructor
3323   */
3324    public Questionnaire() {
3325      super();
3326    }
3327
3328  /**
3329   * Constructor
3330   */
3331    public Questionnaire(Enumeration<PublicationStatus> status) {
3332      super();
3333      this.status = status;
3334    }
3335
3336    /**
3337     * @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
3338     */
3339    public UriType getUrlElement() { 
3340      if (this.url == null)
3341        if (Configuration.errorOnAutoCreate())
3342          throw new Error("Attempt to auto-create Questionnaire.url");
3343        else if (Configuration.doAutoCreate())
3344          this.url = new UriType(); // bb
3345      return this.url;
3346    }
3347
3348    public boolean hasUrlElement() { 
3349      return this.url != null && !this.url.isEmpty();
3350    }
3351
3352    public boolean hasUrl() { 
3353      return this.url != null && !this.url.isEmpty();
3354    }
3355
3356    /**
3357     * @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
3358     */
3359    public Questionnaire setUrlElement(UriType value) { 
3360      this.url = value;
3361      return this;
3362    }
3363
3364    /**
3365     * @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.
3366     */
3367    public String getUrl() { 
3368      return this.url == null ? null : this.url.getValue();
3369    }
3370
3371    /**
3372     * @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.
3373     */
3374    public Questionnaire setUrl(String value) { 
3375      if (Utilities.noString(value))
3376        this.url = null;
3377      else {
3378        if (this.url == null)
3379          this.url = new UriType();
3380        this.url.setValue(value);
3381      }
3382      return this;
3383    }
3384
3385    /**
3386     * @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.)
3387     */
3388    public List<Identifier> getIdentifier() { 
3389      if (this.identifier == null)
3390        this.identifier = new ArrayList<Identifier>();
3391      return this.identifier;
3392    }
3393
3394    /**
3395     * @return Returns a reference to <code>this</code> for easy method chaining
3396     */
3397    public Questionnaire setIdentifier(List<Identifier> theIdentifier) { 
3398      this.identifier = theIdentifier;
3399      return this;
3400    }
3401
3402    public boolean hasIdentifier() { 
3403      if (this.identifier == null)
3404        return false;
3405      for (Identifier item : this.identifier)
3406        if (!item.isEmpty())
3407          return true;
3408      return false;
3409    }
3410
3411    public Identifier addIdentifier() { //3
3412      Identifier t = new Identifier();
3413      if (this.identifier == null)
3414        this.identifier = new ArrayList<Identifier>();
3415      this.identifier.add(t);
3416      return t;
3417    }
3418
3419    public Questionnaire addIdentifier(Identifier t) { //3
3420      if (t == null)
3421        return this;
3422      if (this.identifier == null)
3423        this.identifier = new ArrayList<Identifier>();
3424      this.identifier.add(t);
3425      return this;
3426    }
3427
3428    /**
3429     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
3430     */
3431    public Identifier getIdentifierFirstRep() { 
3432      if (getIdentifier().isEmpty()) {
3433        addIdentifier();
3434      }
3435      return getIdentifier().get(0);
3436    }
3437
3438    /**
3439     * @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
3440     */
3441    public StringType getVersionElement() { 
3442      if (this.version == null)
3443        if (Configuration.errorOnAutoCreate())
3444          throw new Error("Attempt to auto-create Questionnaire.version");
3445        else if (Configuration.doAutoCreate())
3446          this.version = new StringType(); // bb
3447      return this.version;
3448    }
3449
3450    public boolean hasVersionElement() { 
3451      return this.version != null && !this.version.isEmpty();
3452    }
3453
3454    public boolean hasVersion() { 
3455      return this.version != null && !this.version.isEmpty();
3456    }
3457
3458    /**
3459     * @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
3460     */
3461    public Questionnaire setVersionElement(StringType value) { 
3462      this.version = value;
3463      return this;
3464    }
3465
3466    /**
3467     * @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.
3468     */
3469    public String getVersion() { 
3470      return this.version == null ? null : this.version.getValue();
3471    }
3472
3473    /**
3474     * @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.
3475     */
3476    public Questionnaire setVersion(String value) { 
3477      if (Utilities.noString(value))
3478        this.version = null;
3479      else {
3480        if (this.version == null)
3481          this.version = new StringType();
3482        this.version.setValue(value);
3483      }
3484      return this;
3485    }
3486
3487    /**
3488     * @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
3489     */
3490    public StringType getNameElement() { 
3491      if (this.name == null)
3492        if (Configuration.errorOnAutoCreate())
3493          throw new Error("Attempt to auto-create Questionnaire.name");
3494        else if (Configuration.doAutoCreate())
3495          this.name = new StringType(); // bb
3496      return this.name;
3497    }
3498
3499    public boolean hasNameElement() { 
3500      return this.name != null && !this.name.isEmpty();
3501    }
3502
3503    public boolean hasName() { 
3504      return this.name != null && !this.name.isEmpty();
3505    }
3506
3507    /**
3508     * @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
3509     */
3510    public Questionnaire setNameElement(StringType value) { 
3511      this.name = value;
3512      return this;
3513    }
3514
3515    /**
3516     * @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.
3517     */
3518    public String getName() { 
3519      return this.name == null ? null : this.name.getValue();
3520    }
3521
3522    /**
3523     * @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.
3524     */
3525    public Questionnaire setName(String value) { 
3526      if (Utilities.noString(value))
3527        this.name = null;
3528      else {
3529        if (this.name == null)
3530          this.name = new StringType();
3531        this.name.setValue(value);
3532      }
3533      return this;
3534    }
3535
3536    /**
3537     * @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
3538     */
3539    public StringType getTitleElement() { 
3540      if (this.title == null)
3541        if (Configuration.errorOnAutoCreate())
3542          throw new Error("Attempt to auto-create Questionnaire.title");
3543        else if (Configuration.doAutoCreate())
3544          this.title = new StringType(); // bb
3545      return this.title;
3546    }
3547
3548    public boolean hasTitleElement() { 
3549      return this.title != null && !this.title.isEmpty();
3550    }
3551
3552    public boolean hasTitle() { 
3553      return this.title != null && !this.title.isEmpty();
3554    }
3555
3556    /**
3557     * @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
3558     */
3559    public Questionnaire setTitleElement(StringType value) { 
3560      this.title = value;
3561      return this;
3562    }
3563
3564    /**
3565     * @return A short, descriptive, user-friendly title for the questionnaire.
3566     */
3567    public String getTitle() { 
3568      return this.title == null ? null : this.title.getValue();
3569    }
3570
3571    /**
3572     * @param value A short, descriptive, user-friendly title for the questionnaire.
3573     */
3574    public Questionnaire setTitle(String value) { 
3575      if (Utilities.noString(value))
3576        this.title = null;
3577      else {
3578        if (this.title == null)
3579          this.title = new StringType();
3580        this.title.setValue(value);
3581      }
3582      return this;
3583    }
3584
3585    /**
3586     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3587     */
3588    public List<CanonicalType> getDerivedFrom() { 
3589      if (this.derivedFrom == null)
3590        this.derivedFrom = new ArrayList<CanonicalType>();
3591      return this.derivedFrom;
3592    }
3593
3594    /**
3595     * @return Returns a reference to <code>this</code> for easy method chaining
3596     */
3597    public Questionnaire setDerivedFrom(List<CanonicalType> theDerivedFrom) { 
3598      this.derivedFrom = theDerivedFrom;
3599      return this;
3600    }
3601
3602    public boolean hasDerivedFrom() { 
3603      if (this.derivedFrom == null)
3604        return false;
3605      for (CanonicalType item : this.derivedFrom)
3606        if (!item.isEmpty())
3607          return true;
3608      return false;
3609    }
3610
3611    /**
3612     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3613     */
3614    public CanonicalType addDerivedFromElement() {//2 
3615      CanonicalType t = new CanonicalType();
3616      if (this.derivedFrom == null)
3617        this.derivedFrom = new ArrayList<CanonicalType>();
3618      this.derivedFrom.add(t);
3619      return t;
3620    }
3621
3622    /**
3623     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3624     */
3625    public Questionnaire addDerivedFrom(String value) { //1
3626      CanonicalType t = new CanonicalType();
3627      t.setValue(value);
3628      if (this.derivedFrom == null)
3629        this.derivedFrom = new ArrayList<CanonicalType>();
3630      this.derivedFrom.add(t);
3631      return this;
3632    }
3633
3634    /**
3635     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3636     */
3637    public boolean hasDerivedFrom(String value) { 
3638      if (this.derivedFrom == null)
3639        return false;
3640      for (CanonicalType v : this.derivedFrom)
3641        if (v.getValue().equals(value)) // canonical(Questionnaire)
3642          return true;
3643      return false;
3644    }
3645
3646    /**
3647     * @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
3648     */
3649    public Enumeration<PublicationStatus> getStatusElement() { 
3650      if (this.status == null)
3651        if (Configuration.errorOnAutoCreate())
3652          throw new Error("Attempt to auto-create Questionnaire.status");
3653        else if (Configuration.doAutoCreate())
3654          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
3655      return this.status;
3656    }
3657
3658    public boolean hasStatusElement() { 
3659      return this.status != null && !this.status.isEmpty();
3660    }
3661
3662    public boolean hasStatus() { 
3663      return this.status != null && !this.status.isEmpty();
3664    }
3665
3666    /**
3667     * @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
3668     */
3669    public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) { 
3670      this.status = value;
3671      return this;
3672    }
3673
3674    /**
3675     * @return The status of this questionnaire. Enables tracking the life-cycle of the content.
3676     */
3677    public PublicationStatus getStatus() { 
3678      return this.status == null ? null : this.status.getValue();
3679    }
3680
3681    /**
3682     * @param value The status of this questionnaire. Enables tracking the life-cycle of the content.
3683     */
3684    public Questionnaire setStatus(PublicationStatus value) { 
3685        if (this.status == null)
3686          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
3687        this.status.setValue(value);
3688      return this;
3689    }
3690
3691    /**
3692     * @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
3693     */
3694    public BooleanType getExperimentalElement() { 
3695      if (this.experimental == null)
3696        if (Configuration.errorOnAutoCreate())
3697          throw new Error("Attempt to auto-create Questionnaire.experimental");
3698        else if (Configuration.doAutoCreate())
3699          this.experimental = new BooleanType(); // bb
3700      return this.experimental;
3701    }
3702
3703    public boolean hasExperimentalElement() { 
3704      return this.experimental != null && !this.experimental.isEmpty();
3705    }
3706
3707    public boolean hasExperimental() { 
3708      return this.experimental != null && !this.experimental.isEmpty();
3709    }
3710
3711    /**
3712     * @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
3713     */
3714    public Questionnaire setExperimentalElement(BooleanType value) { 
3715      this.experimental = value;
3716      return this;
3717    }
3718
3719    /**
3720     * @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.
3721     */
3722    public boolean getExperimental() { 
3723      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
3724    }
3725
3726    /**
3727     * @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.
3728     */
3729    public Questionnaire setExperimental(boolean value) { 
3730        if (this.experimental == null)
3731          this.experimental = new BooleanType();
3732        this.experimental.setValue(value);
3733      return this;
3734    }
3735
3736    /**
3737     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3738     */
3739    public List<CodeType> getSubjectType() { 
3740      if (this.subjectType == null)
3741        this.subjectType = new ArrayList<CodeType>();
3742      return this.subjectType;
3743    }
3744
3745    /**
3746     * @return Returns a reference to <code>this</code> for easy method chaining
3747     */
3748    public Questionnaire setSubjectType(List<CodeType> theSubjectType) { 
3749      this.subjectType = theSubjectType;
3750      return this;
3751    }
3752
3753    public boolean hasSubjectType() { 
3754      if (this.subjectType == null)
3755        return false;
3756      for (CodeType item : this.subjectType)
3757        if (!item.isEmpty())
3758          return true;
3759      return false;
3760    }
3761
3762    /**
3763     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3764     */
3765    public CodeType addSubjectTypeElement() {//2 
3766      CodeType t = new CodeType();
3767      if (this.subjectType == null)
3768        this.subjectType = new ArrayList<CodeType>();
3769      this.subjectType.add(t);
3770      return t;
3771    }
3772
3773    /**
3774     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3775     */
3776    public Questionnaire addSubjectType(String value) { //1
3777      CodeType t = new CodeType();
3778      t.setValue(value);
3779      if (this.subjectType == null)
3780        this.subjectType = new ArrayList<CodeType>();
3781      this.subjectType.add(t);
3782      return this;
3783    }
3784
3785    /**
3786     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3787     */
3788    public boolean hasSubjectType(String value) { 
3789      if (this.subjectType == null)
3790        return false;
3791      for (CodeType v : this.subjectType)
3792        if (v.getValue().equals(value)) // code
3793          return true;
3794      return false;
3795    }
3796
3797    /**
3798     * @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
3799     */
3800    public DateTimeType getDateElement() { 
3801      if (this.date == null)
3802        if (Configuration.errorOnAutoCreate())
3803          throw new Error("Attempt to auto-create Questionnaire.date");
3804        else if (Configuration.doAutoCreate())
3805          this.date = new DateTimeType(); // bb
3806      return this.date;
3807    }
3808
3809    public boolean hasDateElement() { 
3810      return this.date != null && !this.date.isEmpty();
3811    }
3812
3813    public boolean hasDate() { 
3814      return this.date != null && !this.date.isEmpty();
3815    }
3816
3817    /**
3818     * @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
3819     */
3820    public Questionnaire setDateElement(DateTimeType value) { 
3821      this.date = value;
3822      return this;
3823    }
3824
3825    /**
3826     * @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.
3827     */
3828    public Date getDate() { 
3829      return this.date == null ? null : this.date.getValue();
3830    }
3831
3832    /**
3833     * @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.
3834     */
3835    public Questionnaire setDate(Date value) { 
3836      if (value == null)
3837        this.date = null;
3838      else {
3839        if (this.date == null)
3840          this.date = new DateTimeType();
3841        this.date.setValue(value);
3842      }
3843      return this;
3844    }
3845
3846    /**
3847     * @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
3848     */
3849    public StringType getPublisherElement() { 
3850      if (this.publisher == null)
3851        if (Configuration.errorOnAutoCreate())
3852          throw new Error("Attempt to auto-create Questionnaire.publisher");
3853        else if (Configuration.doAutoCreate())
3854          this.publisher = new StringType(); // bb
3855      return this.publisher;
3856    }
3857
3858    public boolean hasPublisherElement() { 
3859      return this.publisher != null && !this.publisher.isEmpty();
3860    }
3861
3862    public boolean hasPublisher() { 
3863      return this.publisher != null && !this.publisher.isEmpty();
3864    }
3865
3866    /**
3867     * @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
3868     */
3869    public Questionnaire setPublisherElement(StringType value) { 
3870      this.publisher = value;
3871      return this;
3872    }
3873
3874    /**
3875     * @return The name of the organization or individual that published the questionnaire.
3876     */
3877    public String getPublisher() { 
3878      return this.publisher == null ? null : this.publisher.getValue();
3879    }
3880
3881    /**
3882     * @param value The name of the organization or individual that published the questionnaire.
3883     */
3884    public Questionnaire setPublisher(String value) { 
3885      if (Utilities.noString(value))
3886        this.publisher = null;
3887      else {
3888        if (this.publisher == null)
3889          this.publisher = new StringType();
3890        this.publisher.setValue(value);
3891      }
3892      return this;
3893    }
3894
3895    /**
3896     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
3897     */
3898    public List<ContactDetail> getContact() { 
3899      if (this.contact == null)
3900        this.contact = new ArrayList<ContactDetail>();
3901      return this.contact;
3902    }
3903
3904    /**
3905     * @return Returns a reference to <code>this</code> for easy method chaining
3906     */
3907    public Questionnaire setContact(List<ContactDetail> theContact) { 
3908      this.contact = theContact;
3909      return this;
3910    }
3911
3912    public boolean hasContact() { 
3913      if (this.contact == null)
3914        return false;
3915      for (ContactDetail item : this.contact)
3916        if (!item.isEmpty())
3917          return true;
3918      return false;
3919    }
3920
3921    public ContactDetail addContact() { //3
3922      ContactDetail t = new ContactDetail();
3923      if (this.contact == null)
3924        this.contact = new ArrayList<ContactDetail>();
3925      this.contact.add(t);
3926      return t;
3927    }
3928
3929    public Questionnaire addContact(ContactDetail t) { //3
3930      if (t == null)
3931        return this;
3932      if (this.contact == null)
3933        this.contact = new ArrayList<ContactDetail>();
3934      this.contact.add(t);
3935      return this;
3936    }
3937
3938    /**
3939     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3940     */
3941    public ContactDetail getContactFirstRep() { 
3942      if (getContact().isEmpty()) {
3943        addContact();
3944      }
3945      return getContact().get(0);
3946    }
3947
3948    /**
3949     * @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
3950     */
3951    public MarkdownType getDescriptionElement() { 
3952      if (this.description == null)
3953        if (Configuration.errorOnAutoCreate())
3954          throw new Error("Attempt to auto-create Questionnaire.description");
3955        else if (Configuration.doAutoCreate())
3956          this.description = new MarkdownType(); // bb
3957      return this.description;
3958    }
3959
3960    public boolean hasDescriptionElement() { 
3961      return this.description != null && !this.description.isEmpty();
3962    }
3963
3964    public boolean hasDescription() { 
3965      return this.description != null && !this.description.isEmpty();
3966    }
3967
3968    /**
3969     * @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
3970     */
3971    public Questionnaire setDescriptionElement(MarkdownType value) { 
3972      this.description = value;
3973      return this;
3974    }
3975
3976    /**
3977     * @return A free text natural language description of the questionnaire from a consumer's perspective.
3978     */
3979    public String getDescription() { 
3980      return this.description == null ? null : this.description.getValue();
3981    }
3982
3983    /**
3984     * @param value A free text natural language description of the questionnaire from a consumer's perspective.
3985     */
3986    public Questionnaire setDescription(String value) { 
3987      if (value == null)
3988        this.description = null;
3989      else {
3990        if (this.description == null)
3991          this.description = new MarkdownType();
3992        this.description.setValue(value);
3993      }
3994      return this;
3995    }
3996
3997    /**
3998     * @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.)
3999     */
4000    public List<UsageContext> getUseContext() { 
4001      if (this.useContext == null)
4002        this.useContext = new ArrayList<UsageContext>();
4003      return this.useContext;
4004    }
4005
4006    /**
4007     * @return Returns a reference to <code>this</code> for easy method chaining
4008     */
4009    public Questionnaire setUseContext(List<UsageContext> theUseContext) { 
4010      this.useContext = theUseContext;
4011      return this;
4012    }
4013
4014    public boolean hasUseContext() { 
4015      if (this.useContext == null)
4016        return false;
4017      for (UsageContext item : this.useContext)
4018        if (!item.isEmpty())
4019          return true;
4020      return false;
4021    }
4022
4023    public UsageContext addUseContext() { //3
4024      UsageContext t = new UsageContext();
4025      if (this.useContext == null)
4026        this.useContext = new ArrayList<UsageContext>();
4027      this.useContext.add(t);
4028      return t;
4029    }
4030
4031    public Questionnaire addUseContext(UsageContext t) { //3
4032      if (t == null)
4033        return this;
4034      if (this.useContext == null)
4035        this.useContext = new ArrayList<UsageContext>();
4036      this.useContext.add(t);
4037      return this;
4038    }
4039
4040    /**
4041     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
4042     */
4043    public UsageContext getUseContextFirstRep() { 
4044      if (getUseContext().isEmpty()) {
4045        addUseContext();
4046      }
4047      return getUseContext().get(0);
4048    }
4049
4050    /**
4051     * @return {@link #jurisdiction} (A legal or geographic region in which the questionnaire is intended to be used.)
4052     */
4053    public List<CodeableConcept> getJurisdiction() { 
4054      if (this.jurisdiction == null)
4055        this.jurisdiction = new ArrayList<CodeableConcept>();
4056      return this.jurisdiction;
4057    }
4058
4059    /**
4060     * @return Returns a reference to <code>this</code> for easy method chaining
4061     */
4062    public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) { 
4063      this.jurisdiction = theJurisdiction;
4064      return this;
4065    }
4066
4067    public boolean hasJurisdiction() { 
4068      if (this.jurisdiction == null)
4069        return false;
4070      for (CodeableConcept item : this.jurisdiction)
4071        if (!item.isEmpty())
4072          return true;
4073      return false;
4074    }
4075
4076    public CodeableConcept addJurisdiction() { //3
4077      CodeableConcept t = new CodeableConcept();
4078      if (this.jurisdiction == null)
4079        this.jurisdiction = new ArrayList<CodeableConcept>();
4080      this.jurisdiction.add(t);
4081      return t;
4082    }
4083
4084    public Questionnaire addJurisdiction(CodeableConcept t) { //3
4085      if (t == null)
4086        return this;
4087      if (this.jurisdiction == null)
4088        this.jurisdiction = new ArrayList<CodeableConcept>();
4089      this.jurisdiction.add(t);
4090      return this;
4091    }
4092
4093    /**
4094     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
4095     */
4096    public CodeableConcept getJurisdictionFirstRep() { 
4097      if (getJurisdiction().isEmpty()) {
4098        addJurisdiction();
4099      }
4100      return getJurisdiction().get(0);
4101    }
4102
4103    /**
4104     * @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
4105     */
4106    public MarkdownType getPurposeElement() { 
4107      if (this.purpose == null)
4108        if (Configuration.errorOnAutoCreate())
4109          throw new Error("Attempt to auto-create Questionnaire.purpose");
4110        else if (Configuration.doAutoCreate())
4111          this.purpose = new MarkdownType(); // bb
4112      return this.purpose;
4113    }
4114
4115    public boolean hasPurposeElement() { 
4116      return this.purpose != null && !this.purpose.isEmpty();
4117    }
4118
4119    public boolean hasPurpose() { 
4120      return this.purpose != null && !this.purpose.isEmpty();
4121    }
4122
4123    /**
4124     * @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
4125     */
4126    public Questionnaire setPurposeElement(MarkdownType value) { 
4127      this.purpose = value;
4128      return this;
4129    }
4130
4131    /**
4132     * @return Explanation of why this questionnaire is needed and why it has been designed as it has.
4133     */
4134    public String getPurpose() { 
4135      return this.purpose == null ? null : this.purpose.getValue();
4136    }
4137
4138    /**
4139     * @param value Explanation of why this questionnaire is needed and why it has been designed as it has.
4140     */
4141    public Questionnaire setPurpose(String value) { 
4142      if (value == null)
4143        this.purpose = null;
4144      else {
4145        if (this.purpose == null)
4146          this.purpose = new MarkdownType();
4147        this.purpose.setValue(value);
4148      }
4149      return this;
4150    }
4151
4152    /**
4153     * @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
4154     */
4155    public MarkdownType getCopyrightElement() { 
4156      if (this.copyright == null)
4157        if (Configuration.errorOnAutoCreate())
4158          throw new Error("Attempt to auto-create Questionnaire.copyright");
4159        else if (Configuration.doAutoCreate())
4160          this.copyright = new MarkdownType(); // bb
4161      return this.copyright;
4162    }
4163
4164    public boolean hasCopyrightElement() { 
4165      return this.copyright != null && !this.copyright.isEmpty();
4166    }
4167
4168    public boolean hasCopyright() { 
4169      return this.copyright != null && !this.copyright.isEmpty();
4170    }
4171
4172    /**
4173     * @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
4174     */
4175    public Questionnaire setCopyrightElement(MarkdownType value) { 
4176      this.copyright = value;
4177      return this;
4178    }
4179
4180    /**
4181     * @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.
4182     */
4183    public String getCopyright() { 
4184      return this.copyright == null ? null : this.copyright.getValue();
4185    }
4186
4187    /**
4188     * @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.
4189     */
4190    public Questionnaire setCopyright(String value) { 
4191      if (value == null)
4192        this.copyright = null;
4193      else {
4194        if (this.copyright == null)
4195          this.copyright = new MarkdownType();
4196        this.copyright.setValue(value);
4197      }
4198      return this;
4199    }
4200
4201    /**
4202     * @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
4203     */
4204    public DateType getApprovalDateElement() { 
4205      if (this.approvalDate == null)
4206        if (Configuration.errorOnAutoCreate())
4207          throw new Error("Attempt to auto-create Questionnaire.approvalDate");
4208        else if (Configuration.doAutoCreate())
4209          this.approvalDate = new DateType(); // bb
4210      return this.approvalDate;
4211    }
4212
4213    public boolean hasApprovalDateElement() { 
4214      return this.approvalDate != null && !this.approvalDate.isEmpty();
4215    }
4216
4217    public boolean hasApprovalDate() { 
4218      return this.approvalDate != null && !this.approvalDate.isEmpty();
4219    }
4220
4221    /**
4222     * @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
4223     */
4224    public Questionnaire setApprovalDateElement(DateType value) { 
4225      this.approvalDate = value;
4226      return this;
4227    }
4228
4229    /**
4230     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4231     */
4232    public Date getApprovalDate() { 
4233      return this.approvalDate == null ? null : this.approvalDate.getValue();
4234    }
4235
4236    /**
4237     * @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.
4238     */
4239    public Questionnaire setApprovalDate(Date value) { 
4240      if (value == null)
4241        this.approvalDate = null;
4242      else {
4243        if (this.approvalDate == null)
4244          this.approvalDate = new DateType();
4245        this.approvalDate.setValue(value);
4246      }
4247      return this;
4248    }
4249
4250    /**
4251     * @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
4252     */
4253    public DateType getLastReviewDateElement() { 
4254      if (this.lastReviewDate == null)
4255        if (Configuration.errorOnAutoCreate())
4256          throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
4257        else if (Configuration.doAutoCreate())
4258          this.lastReviewDate = new DateType(); // bb
4259      return this.lastReviewDate;
4260    }
4261
4262    public boolean hasLastReviewDateElement() { 
4263      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4264    }
4265
4266    public boolean hasLastReviewDate() { 
4267      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4268    }
4269
4270    /**
4271     * @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
4272     */
4273    public Questionnaire setLastReviewDateElement(DateType value) { 
4274      this.lastReviewDate = value;
4275      return this;
4276    }
4277
4278    /**
4279     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4280     */
4281    public Date getLastReviewDate() { 
4282      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
4283    }
4284
4285    /**
4286     * @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.
4287     */
4288    public Questionnaire setLastReviewDate(Date value) { 
4289      if (value == null)
4290        this.lastReviewDate = null;
4291      else {
4292        if (this.lastReviewDate == null)
4293          this.lastReviewDate = new DateType();
4294        this.lastReviewDate.setValue(value);
4295      }
4296      return this;
4297    }
4298
4299    /**
4300     * @return {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4301     */
4302    public Period getEffectivePeriod() { 
4303      if (this.effectivePeriod == null)
4304        if (Configuration.errorOnAutoCreate())
4305          throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
4306        else if (Configuration.doAutoCreate())
4307          this.effectivePeriod = new Period(); // cc
4308      return this.effectivePeriod;
4309    }
4310
4311    public boolean hasEffectivePeriod() { 
4312      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
4313    }
4314
4315    /**
4316     * @param value {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4317     */
4318    public Questionnaire setEffectivePeriod(Period value) { 
4319      this.effectivePeriod = value;
4320      return this;
4321    }
4322
4323    /**
4324     * @return {@link #code} (An identifier for this question or group of questions in a particular terminology such as LOINC.)
4325     */
4326    public List<Coding> getCode() { 
4327      if (this.code == null)
4328        this.code = new ArrayList<Coding>();
4329      return this.code;
4330    }
4331
4332    /**
4333     * @return Returns a reference to <code>this</code> for easy method chaining
4334     */
4335    public Questionnaire setCode(List<Coding> theCode) { 
4336      this.code = theCode;
4337      return this;
4338    }
4339
4340    public boolean hasCode() { 
4341      if (this.code == null)
4342        return false;
4343      for (Coding item : this.code)
4344        if (!item.isEmpty())
4345          return true;
4346      return false;
4347    }
4348
4349    public Coding addCode() { //3
4350      Coding t = new Coding();
4351      if (this.code == null)
4352        this.code = new ArrayList<Coding>();
4353      this.code.add(t);
4354      return t;
4355    }
4356
4357    public Questionnaire addCode(Coding t) { //3
4358      if (t == null)
4359        return this;
4360      if (this.code == null)
4361        this.code = new ArrayList<Coding>();
4362      this.code.add(t);
4363      return this;
4364    }
4365
4366    /**
4367     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
4368     */
4369    public Coding getCodeFirstRep() { 
4370      if (getCode().isEmpty()) {
4371        addCode();
4372      }
4373      return getCode().get(0);
4374    }
4375
4376    /**
4377     * @return {@link #item} (A particular question, question grouping or display text that is part of the questionnaire.)
4378     */
4379    public List<QuestionnaireItemComponent> getItem() { 
4380      if (this.item == null)
4381        this.item = new ArrayList<QuestionnaireItemComponent>();
4382      return this.item;
4383    }
4384
4385    /**
4386     * @return Returns a reference to <code>this</code> for easy method chaining
4387     */
4388    public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) { 
4389      this.item = theItem;
4390      return this;
4391    }
4392
4393    public boolean hasItem() { 
4394      if (this.item == null)
4395        return false;
4396      for (QuestionnaireItemComponent item : this.item)
4397        if (!item.isEmpty())
4398          return true;
4399      return false;
4400    }
4401
4402    public QuestionnaireItemComponent addItem() { //3
4403      QuestionnaireItemComponent t = new QuestionnaireItemComponent();
4404      if (this.item == null)
4405        this.item = new ArrayList<QuestionnaireItemComponent>();
4406      this.item.add(t);
4407      return t;
4408    }
4409
4410    public Questionnaire addItem(QuestionnaireItemComponent t) { //3
4411      if (t == null)
4412        return this;
4413      if (this.item == null)
4414        this.item = new ArrayList<QuestionnaireItemComponent>();
4415      this.item.add(t);
4416      return this;
4417    }
4418
4419    /**
4420     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
4421     */
4422    public QuestionnaireItemComponent getItemFirstRep() { 
4423      if (getItem().isEmpty()) {
4424        addItem();
4425      }
4426      return getItem().get(0);
4427    }
4428
4429      protected void listChildren(List<Property> children) {
4430        super.listChildren(children);
4431        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));
4432        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));
4433        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));
4434        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));
4435        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title));
4436        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));
4437        children.add(new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status));
4438        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));
4439        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));
4440        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));
4441        children.add(new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher));
4442        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));
4443        children.add(new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description));
4444        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));
4445        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));
4446        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));
4447        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));
4448        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));
4449        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));
4450        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));
4451        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));
4452        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));
4453      }
4454
4455      @Override
4456      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4457        switch (_hash) {
4458        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);
4459        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);
4460        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);
4461        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);
4462        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title);
4463        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);
4464        case -892481550: /*status*/  return new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status);
4465        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);
4466        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);
4467        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);
4468        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher);
4469        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);
4470        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);
4471        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);
4472        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);
4473        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);
4474        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);
4475        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);
4476        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);
4477        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);
4478        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);
4479        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);
4480        default: return super.getNamedProperty(_hash, _name, _checkValid);
4481        }
4482
4483      }
4484
4485      @Override
4486      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4487        switch (hash) {
4488        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
4489        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4490        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
4491        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
4492        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4493        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // CanonicalType
4494        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
4495        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
4496        case -603200890: /*subjectType*/ return this.subjectType == null ? new Base[0] : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
4497        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
4498        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
4499        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
4500        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4501        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
4502        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
4503        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
4504        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
4505        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
4506        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
4507        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
4508        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
4509        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
4510        default: return super.getProperty(hash, name, checkValid);
4511        }
4512
4513      }
4514
4515      @Override
4516      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4517        switch (hash) {
4518        case 116079: // url
4519          this.url = castToUri(value); // UriType
4520          return value;
4521        case -1618432855: // identifier
4522          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4523          return value;
4524        case 351608024: // version
4525          this.version = castToString(value); // StringType
4526          return value;
4527        case 3373707: // name
4528          this.name = castToString(value); // StringType
4529          return value;
4530        case 110371416: // title
4531          this.title = castToString(value); // StringType
4532          return value;
4533        case 1077922663: // derivedFrom
4534          this.getDerivedFrom().add(castToCanonical(value)); // CanonicalType
4535          return value;
4536        case -892481550: // status
4537          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4538          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4539          return value;
4540        case -404562712: // experimental
4541          this.experimental = castToBoolean(value); // BooleanType
4542          return value;
4543        case -603200890: // subjectType
4544          this.getSubjectType().add(castToCode(value)); // CodeType
4545          return value;
4546        case 3076014: // date
4547          this.date = castToDateTime(value); // DateTimeType
4548          return value;
4549        case 1447404028: // publisher
4550          this.publisher = castToString(value); // StringType
4551          return value;
4552        case 951526432: // contact
4553          this.getContact().add(castToContactDetail(value)); // ContactDetail
4554          return value;
4555        case -1724546052: // description
4556          this.description = castToMarkdown(value); // MarkdownType
4557          return value;
4558        case -669707736: // useContext
4559          this.getUseContext().add(castToUsageContext(value)); // UsageContext
4560          return value;
4561        case -507075711: // jurisdiction
4562          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
4563          return value;
4564        case -220463842: // purpose
4565          this.purpose = castToMarkdown(value); // MarkdownType
4566          return value;
4567        case 1522889671: // copyright
4568          this.copyright = castToMarkdown(value); // MarkdownType
4569          return value;
4570        case 223539345: // approvalDate
4571          this.approvalDate = castToDate(value); // DateType
4572          return value;
4573        case -1687512484: // lastReviewDate
4574          this.lastReviewDate = castToDate(value); // DateType
4575          return value;
4576        case -403934648: // effectivePeriod
4577          this.effectivePeriod = castToPeriod(value); // Period
4578          return value;
4579        case 3059181: // code
4580          this.getCode().add(castToCoding(value)); // Coding
4581          return value;
4582        case 3242771: // item
4583          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
4584          return value;
4585        default: return super.setProperty(hash, name, value);
4586        }
4587
4588      }
4589
4590      @Override
4591      public Base setProperty(String name, Base value) throws FHIRException {
4592        if (name.equals("url")) {
4593          this.url = castToUri(value); // UriType
4594        } else if (name.equals("identifier")) {
4595          this.getIdentifier().add(castToIdentifier(value));
4596        } else if (name.equals("version")) {
4597          this.version = castToString(value); // StringType
4598        } else if (name.equals("name")) {
4599          this.name = castToString(value); // StringType
4600        } else if (name.equals("title")) {
4601          this.title = castToString(value); // StringType
4602        } else if (name.equals("derivedFrom")) {
4603          this.getDerivedFrom().add(castToCanonical(value));
4604        } else if (name.equals("status")) {
4605          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4606          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4607        } else if (name.equals("experimental")) {
4608          this.experimental = castToBoolean(value); // BooleanType
4609        } else if (name.equals("subjectType")) {
4610          this.getSubjectType().add(castToCode(value));
4611        } else if (name.equals("date")) {
4612          this.date = castToDateTime(value); // DateTimeType
4613        } else if (name.equals("publisher")) {
4614          this.publisher = castToString(value); // StringType
4615        } else if (name.equals("contact")) {
4616          this.getContact().add(castToContactDetail(value));
4617        } else if (name.equals("description")) {
4618          this.description = castToMarkdown(value); // MarkdownType
4619        } else if (name.equals("useContext")) {
4620          this.getUseContext().add(castToUsageContext(value));
4621        } else if (name.equals("jurisdiction")) {
4622          this.getJurisdiction().add(castToCodeableConcept(value));
4623        } else if (name.equals("purpose")) {
4624          this.purpose = castToMarkdown(value); // MarkdownType
4625        } else if (name.equals("copyright")) {
4626          this.copyright = castToMarkdown(value); // MarkdownType
4627        } else if (name.equals("approvalDate")) {
4628          this.approvalDate = castToDate(value); // DateType
4629        } else if (name.equals("lastReviewDate")) {
4630          this.lastReviewDate = castToDate(value); // DateType
4631        } else if (name.equals("effectivePeriod")) {
4632          this.effectivePeriod = castToPeriod(value); // Period
4633        } else if (name.equals("code")) {
4634          this.getCode().add(castToCoding(value));
4635        } else if (name.equals("item")) {
4636          this.getItem().add((QuestionnaireItemComponent) value);
4637        } else
4638          return super.setProperty(name, value);
4639        return value;
4640      }
4641
4642      @Override
4643      public Base makeProperty(int hash, String name) throws FHIRException {
4644        switch (hash) {
4645        case 116079:  return getUrlElement();
4646        case -1618432855:  return addIdentifier(); 
4647        case 351608024:  return getVersionElement();
4648        case 3373707:  return getNameElement();
4649        case 110371416:  return getTitleElement();
4650        case 1077922663:  return addDerivedFromElement();
4651        case -892481550:  return getStatusElement();
4652        case -404562712:  return getExperimentalElement();
4653        case -603200890:  return addSubjectTypeElement();
4654        case 3076014:  return getDateElement();
4655        case 1447404028:  return getPublisherElement();
4656        case 951526432:  return addContact(); 
4657        case -1724546052:  return getDescriptionElement();
4658        case -669707736:  return addUseContext(); 
4659        case -507075711:  return addJurisdiction(); 
4660        case -220463842:  return getPurposeElement();
4661        case 1522889671:  return getCopyrightElement();
4662        case 223539345:  return getApprovalDateElement();
4663        case -1687512484:  return getLastReviewDateElement();
4664        case -403934648:  return getEffectivePeriod(); 
4665        case 3059181:  return addCode(); 
4666        case 3242771:  return addItem(); 
4667        default: return super.makeProperty(hash, name);
4668        }
4669
4670      }
4671
4672      @Override
4673      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4674        switch (hash) {
4675        case 116079: /*url*/ return new String[] {"uri"};
4676        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4677        case 351608024: /*version*/ return new String[] {"string"};
4678        case 3373707: /*name*/ return new String[] {"string"};
4679        case 110371416: /*title*/ return new String[] {"string"};
4680        case 1077922663: /*derivedFrom*/ return new String[] {"canonical"};
4681        case -892481550: /*status*/ return new String[] {"code"};
4682        case -404562712: /*experimental*/ return new String[] {"boolean"};
4683        case -603200890: /*subjectType*/ return new String[] {"code"};
4684        case 3076014: /*date*/ return new String[] {"dateTime"};
4685        case 1447404028: /*publisher*/ return new String[] {"string"};
4686        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4687        case -1724546052: /*description*/ return new String[] {"markdown"};
4688        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4689        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4690        case -220463842: /*purpose*/ return new String[] {"markdown"};
4691        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4692        case 223539345: /*approvalDate*/ return new String[] {"date"};
4693        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
4694        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
4695        case 3059181: /*code*/ return new String[] {"Coding"};
4696        case 3242771: /*item*/ return new String[] {};
4697        default: return super.getTypesForProperty(hash, name);
4698        }
4699
4700      }
4701
4702      @Override
4703      public Base addChild(String name) throws FHIRException {
4704        if (name.equals("url")) {
4705          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.url");
4706        }
4707        else if (name.equals("identifier")) {
4708          return addIdentifier();
4709        }
4710        else if (name.equals("version")) {
4711          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version");
4712        }
4713        else if (name.equals("name")) {
4714          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.name");
4715        }
4716        else if (name.equals("title")) {
4717          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title");
4718        }
4719        else if (name.equals("derivedFrom")) {
4720          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.derivedFrom");
4721        }
4722        else if (name.equals("status")) {
4723          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status");
4724        }
4725        else if (name.equals("experimental")) {
4726          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.experimental");
4727        }
4728        else if (name.equals("subjectType")) {
4729          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType");
4730        }
4731        else if (name.equals("date")) {
4732          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date");
4733        }
4734        else if (name.equals("publisher")) {
4735          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher");
4736        }
4737        else if (name.equals("contact")) {
4738          return addContact();
4739        }
4740        else if (name.equals("description")) {
4741          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.description");
4742        }
4743        else if (name.equals("useContext")) {
4744          return addUseContext();
4745        }
4746        else if (name.equals("jurisdiction")) {
4747          return addJurisdiction();
4748        }
4749        else if (name.equals("purpose")) {
4750          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.purpose");
4751        }
4752        else if (name.equals("copyright")) {
4753          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.copyright");
4754        }
4755        else if (name.equals("approvalDate")) {
4756          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.approvalDate");
4757        }
4758        else if (name.equals("lastReviewDate")) {
4759          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.lastReviewDate");
4760        }
4761        else if (name.equals("effectivePeriod")) {
4762          this.effectivePeriod = new Period();
4763          return this.effectivePeriod;
4764        }
4765        else if (name.equals("code")) {
4766          return addCode();
4767        }
4768        else if (name.equals("item")) {
4769          return addItem();
4770        }
4771        else
4772          return super.addChild(name);
4773      }
4774
4775  public String fhirType() {
4776    return "Questionnaire";
4777
4778  }
4779
4780      public Questionnaire copy() {
4781        Questionnaire dst = new Questionnaire();
4782        copyValues(dst);
4783        dst.url = url == null ? null : url.copy();
4784        if (identifier != null) {
4785          dst.identifier = new ArrayList<Identifier>();
4786          for (Identifier i : identifier)
4787            dst.identifier.add(i.copy());
4788        };
4789        dst.version = version == null ? null : version.copy();
4790        dst.name = name == null ? null : name.copy();
4791        dst.title = title == null ? null : title.copy();
4792        if (derivedFrom != null) {
4793          dst.derivedFrom = new ArrayList<CanonicalType>();
4794          for (CanonicalType i : derivedFrom)
4795            dst.derivedFrom.add(i.copy());
4796        };
4797        dst.status = status == null ? null : status.copy();
4798        dst.experimental = experimental == null ? null : experimental.copy();
4799        if (subjectType != null) {
4800          dst.subjectType = new ArrayList<CodeType>();
4801          for (CodeType i : subjectType)
4802            dst.subjectType.add(i.copy());
4803        };
4804        dst.date = date == null ? null : date.copy();
4805        dst.publisher = publisher == null ? null : publisher.copy();
4806        if (contact != null) {
4807          dst.contact = new ArrayList<ContactDetail>();
4808          for (ContactDetail i : contact)
4809            dst.contact.add(i.copy());
4810        };
4811        dst.description = description == null ? null : description.copy();
4812        if (useContext != null) {
4813          dst.useContext = new ArrayList<UsageContext>();
4814          for (UsageContext i : useContext)
4815            dst.useContext.add(i.copy());
4816        };
4817        if (jurisdiction != null) {
4818          dst.jurisdiction = new ArrayList<CodeableConcept>();
4819          for (CodeableConcept i : jurisdiction)
4820            dst.jurisdiction.add(i.copy());
4821        };
4822        dst.purpose = purpose == null ? null : purpose.copy();
4823        dst.copyright = copyright == null ? null : copyright.copy();
4824        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
4825        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
4826        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
4827        if (code != null) {
4828          dst.code = new ArrayList<Coding>();
4829          for (Coding i : code)
4830            dst.code.add(i.copy());
4831        };
4832        if (item != null) {
4833          dst.item = new ArrayList<QuestionnaireItemComponent>();
4834          for (QuestionnaireItemComponent i : item)
4835            dst.item.add(i.copy());
4836        };
4837        return dst;
4838      }
4839
4840      protected Questionnaire typedCopy() {
4841        return copy();
4842      }
4843
4844      @Override
4845      public boolean equalsDeep(Base other_) {
4846        if (!super.equalsDeep(other_))
4847          return false;
4848        if (!(other_ instanceof Questionnaire))
4849          return false;
4850        Questionnaire o = (Questionnaire) other_;
4851        return compareDeep(identifier, o.identifier, true) && compareDeep(derivedFrom, o.derivedFrom, true)
4852           && compareDeep(subjectType, o.subjectType, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4853           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4854           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(code, o.code, true) && compareDeep(item, o.item, true)
4855          ;
4856      }
4857
4858      @Override
4859      public boolean equalsShallow(Base other_) {
4860        if (!super.equalsShallow(other_))
4861          return false;
4862        if (!(other_ instanceof Questionnaire))
4863          return false;
4864        Questionnaire o = (Questionnaire) other_;
4865        return compareValues(subjectType, o.subjectType, true) && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4866           && compareValues(approvalDate, o.approvalDate, true) && compareValues(lastReviewDate, o.lastReviewDate, true)
4867          ;
4868      }
4869
4870      public boolean isEmpty() {
4871        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, derivedFrom, subjectType
4872          , purpose, copyright, approvalDate, lastReviewDate, effectivePeriod, code, item
4873          );
4874      }
4875
4876  @Override
4877  public ResourceType getResourceType() {
4878    return ResourceType.Questionnaire;
4879   }
4880
4881 /**
4882   * Search parameter: <b>date</b>
4883   * <p>
4884   * Description: <b>The questionnaire publication date</b><br>
4885   * Type: <b>date</b><br>
4886   * Path: <b>Questionnaire.date</b><br>
4887   * </p>
4888   */
4889  @SearchParamDefinition(name="date", path="Questionnaire.date", description="The questionnaire publication date", type="date" )
4890  public static final String SP_DATE = "date";
4891 /**
4892   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4893   * <p>
4894   * Description: <b>The questionnaire publication date</b><br>
4895   * Type: <b>date</b><br>
4896   * Path: <b>Questionnaire.date</b><br>
4897   * </p>
4898   */
4899  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4900
4901 /**
4902   * Search parameter: <b>identifier</b>
4903   * <p>
4904   * Description: <b>External identifier for the questionnaire</b><br>
4905   * Type: <b>token</b><br>
4906   * Path: <b>Questionnaire.identifier</b><br>
4907   * </p>
4908   */
4909  @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="External identifier for the questionnaire", type="token" )
4910  public static final String SP_IDENTIFIER = "identifier";
4911 /**
4912   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4913   * <p>
4914   * Description: <b>External identifier for the questionnaire</b><br>
4915   * Type: <b>token</b><br>
4916   * Path: <b>Questionnaire.identifier</b><br>
4917   * </p>
4918   */
4919  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4920
4921 /**
4922   * Search parameter: <b>code</b>
4923   * <p>
4924   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4925   * Type: <b>token</b><br>
4926   * Path: <b>Questionnaire.item.code</b><br>
4927   * </p>
4928   */
4929  @SearchParamDefinition(name="code", path="Questionnaire.item.code", description="A code that corresponds to one of its items in the questionnaire", type="token" )
4930  public static final String SP_CODE = "code";
4931 /**
4932   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4933   * <p>
4934   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4935   * Type: <b>token</b><br>
4936   * Path: <b>Questionnaire.item.code</b><br>
4937   * </p>
4938   */
4939  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4940
4941 /**
4942   * Search parameter: <b>context-type-value</b>
4943   * <p>
4944   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4945   * Type: <b>composite</b><br>
4946   * Path: <b></b><br>
4947   * </p>
4948   */
4949  @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"} )
4950  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
4951 /**
4952   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
4953   * <p>
4954   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
4955   * Type: <b>composite</b><br>
4956   * Path: <b></b><br>
4957   * </p>
4958   */
4959  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);
4960
4961 /**
4962   * Search parameter: <b>jurisdiction</b>
4963   * <p>
4964   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4965   * Type: <b>token</b><br>
4966   * Path: <b>Questionnaire.jurisdiction</b><br>
4967   * </p>
4968   */
4969  @SearchParamDefinition(name="jurisdiction", path="Questionnaire.jurisdiction", description="Intended jurisdiction for the questionnaire", type="token" )
4970  public static final String SP_JURISDICTION = "jurisdiction";
4971 /**
4972   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4973   * <p>
4974   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4975   * Type: <b>token</b><br>
4976   * Path: <b>Questionnaire.jurisdiction</b><br>
4977   * </p>
4978   */
4979  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
4980
4981 /**
4982   * Search parameter: <b>description</b>
4983   * <p>
4984   * Description: <b>The description of the questionnaire</b><br>
4985   * Type: <b>string</b><br>
4986   * Path: <b>Questionnaire.description</b><br>
4987   * </p>
4988   */
4989  @SearchParamDefinition(name="description", path="Questionnaire.description", description="The description of the questionnaire", type="string" )
4990  public static final String SP_DESCRIPTION = "description";
4991 /**
4992   * <b>Fluent Client</b> search parameter constant for <b>description</b>
4993   * <p>
4994   * Description: <b>The description of the questionnaire</b><br>
4995   * Type: <b>string</b><br>
4996   * Path: <b>Questionnaire.description</b><br>
4997   * </p>
4998   */
4999  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
5000
5001 /**
5002   * Search parameter: <b>context-type</b>
5003   * <p>
5004   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5005   * Type: <b>token</b><br>
5006   * Path: <b>Questionnaire.useContext.code</b><br>
5007   * </p>
5008   */
5009  @SearchParamDefinition(name="context-type", path="Questionnaire.useContext.code", description="A type of use context assigned to the questionnaire", type="token" )
5010  public static final String SP_CONTEXT_TYPE = "context-type";
5011 /**
5012   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
5013   * <p>
5014   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5015   * Type: <b>token</b><br>
5016   * Path: <b>Questionnaire.useContext.code</b><br>
5017   * </p>
5018   */
5019  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
5020
5021 /**
5022   * Search parameter: <b>title</b>
5023   * <p>
5024   * Description: <b>The human-friendly name of the questionnaire</b><br>
5025   * Type: <b>string</b><br>
5026   * Path: <b>Questionnaire.title</b><br>
5027   * </p>
5028   */
5029  @SearchParamDefinition(name="title", path="Questionnaire.title", description="The human-friendly name of the questionnaire", type="string" )
5030  public static final String SP_TITLE = "title";
5031 /**
5032   * <b>Fluent Client</b> search parameter constant for <b>title</b>
5033   * <p>
5034   * Description: <b>The human-friendly name of the questionnaire</b><br>
5035   * Type: <b>string</b><br>
5036   * Path: <b>Questionnaire.title</b><br>
5037   * </p>
5038   */
5039  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
5040
5041 /**
5042   * Search parameter: <b>version</b>
5043   * <p>
5044   * Description: <b>The business version of the questionnaire</b><br>
5045   * Type: <b>token</b><br>
5046   * Path: <b>Questionnaire.version</b><br>
5047   * </p>
5048   */
5049  @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="token" )
5050  public static final String SP_VERSION = "version";
5051 /**
5052   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5053   * <p>
5054   * Description: <b>The business version of the questionnaire</b><br>
5055   * Type: <b>token</b><br>
5056   * Path: <b>Questionnaire.version</b><br>
5057   * </p>
5058   */
5059  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
5060
5061 /**
5062   * Search parameter: <b>url</b>
5063   * <p>
5064   * Description: <b>The uri that identifies the questionnaire</b><br>
5065   * Type: <b>uri</b><br>
5066   * Path: <b>Questionnaire.url</b><br>
5067   * </p>
5068   */
5069  @SearchParamDefinition(name="url", path="Questionnaire.url", description="The uri that identifies the questionnaire", type="uri" )
5070  public static final String SP_URL = "url";
5071 /**
5072   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5073   * <p>
5074   * Description: <b>The uri that identifies the questionnaire</b><br>
5075   * Type: <b>uri</b><br>
5076   * Path: <b>Questionnaire.url</b><br>
5077   * </p>
5078   */
5079  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5080
5081 /**
5082   * Search parameter: <b>context-quantity</b>
5083   * <p>
5084   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5085   * Type: <b>quantity</b><br>
5086   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5087   * </p>
5088   */
5089  @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" )
5090  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
5091 /**
5092   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
5093   * <p>
5094   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5095   * Type: <b>quantity</b><br>
5096   * Path: <b>Questionnaire.useContext.valueQuantity, Questionnaire.useContext.valueRange</b><br>
5097   * </p>
5098   */
5099  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
5100
5101 /**
5102   * Search parameter: <b>effective</b>
5103   * <p>
5104   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5105   * Type: <b>date</b><br>
5106   * Path: <b>Questionnaire.effectivePeriod</b><br>
5107   * </p>
5108   */
5109  @SearchParamDefinition(name="effective", path="Questionnaire.effectivePeriod", description="The time during which the questionnaire is intended to be in use", type="date" )
5110  public static final String SP_EFFECTIVE = "effective";
5111 /**
5112   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
5113   * <p>
5114   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5115   * Type: <b>date</b><br>
5116   * Path: <b>Questionnaire.effectivePeriod</b><br>
5117   * </p>
5118   */
5119  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
5120
5121 /**
5122   * Search parameter: <b>subject-type</b>
5123   * <p>
5124   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5125   * Type: <b>token</b><br>
5126   * Path: <b>Questionnaire.subjectType</b><br>
5127   * </p>
5128   */
5129  @SearchParamDefinition(name="subject-type", path="Questionnaire.subjectType", description="Resource that can be subject of QuestionnaireResponse", type="token" )
5130  public static final String SP_SUBJECT_TYPE = "subject-type";
5131 /**
5132   * <b>Fluent Client</b> search parameter constant for <b>subject-type</b>
5133   * <p>
5134   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5135   * Type: <b>token</b><br>
5136   * Path: <b>Questionnaire.subjectType</b><br>
5137   * </p>
5138   */
5139  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBJECT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBJECT_TYPE);
5140
5141 /**
5142   * Search parameter: <b>name</b>
5143   * <p>
5144   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5145   * Type: <b>string</b><br>
5146   * Path: <b>Questionnaire.name</b><br>
5147   * </p>
5148   */
5149  @SearchParamDefinition(name="name", path="Questionnaire.name", description="Computationally friendly name of the questionnaire", type="string" )
5150  public static final String SP_NAME = "name";
5151 /**
5152   * <b>Fluent Client</b> search parameter constant for <b>name</b>
5153   * <p>
5154   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5155   * Type: <b>string</b><br>
5156   * Path: <b>Questionnaire.name</b><br>
5157   * </p>
5158   */
5159  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
5160
5161 /**
5162   * Search parameter: <b>context</b>
5163   * <p>
5164   * Description: <b>A use context assigned to the questionnaire</b><br>
5165   * Type: <b>token</b><br>
5166   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5167   * </p>
5168   */
5169  @SearchParamDefinition(name="context", path="(Questionnaire.useContext.value as CodeableConcept)", description="A use context assigned to the questionnaire", type="token" )
5170  public static final String SP_CONTEXT = "context";
5171 /**
5172   * <b>Fluent Client</b> search parameter constant for <b>context</b>
5173   * <p>
5174   * Description: <b>A use context assigned to the questionnaire</b><br>
5175   * Type: <b>token</b><br>
5176   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
5177   * </p>
5178   */
5179  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
5180
5181 /**
5182   * Search parameter: <b>publisher</b>
5183   * <p>
5184   * Description: <b>Name of the publisher of the questionnaire</b><br>
5185   * Type: <b>string</b><br>
5186   * Path: <b>Questionnaire.publisher</b><br>
5187   * </p>
5188   */
5189  @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="Name of the publisher of the questionnaire", type="string" )
5190  public static final String SP_PUBLISHER = "publisher";
5191 /**
5192   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
5193   * <p>
5194   * Description: <b>Name of the publisher of the questionnaire</b><br>
5195   * Type: <b>string</b><br>
5196   * Path: <b>Questionnaire.publisher</b><br>
5197   * </p>
5198   */
5199  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
5200
5201 /**
5202   * Search parameter: <b>definition</b>
5203   * <p>
5204   * Description: <b>ElementDefinition - details for the item</b><br>
5205   * Type: <b>uri</b><br>
5206   * Path: <b>Questionnaire.item.definition</b><br>
5207   * </p>
5208   */
5209  @SearchParamDefinition(name="definition", path="Questionnaire.item.definition", description="ElementDefinition - details for the item", type="uri" )
5210  public static final String SP_DEFINITION = "definition";
5211 /**
5212   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
5213   * <p>
5214   * Description: <b>ElementDefinition - details for the item</b><br>
5215   * Type: <b>uri</b><br>
5216   * Path: <b>Questionnaire.item.definition</b><br>
5217   * </p>
5218   */
5219  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DEFINITION);
5220
5221 /**
5222   * Search parameter: <b>context-type-quantity</b>
5223   * <p>
5224   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5225   * Type: <b>composite</b><br>
5226   * Path: <b></b><br>
5227   * </p>
5228   */
5229  @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"} )
5230  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
5231 /**
5232   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
5233   * <p>
5234   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5235   * Type: <b>composite</b><br>
5236   * Path: <b></b><br>
5237   * </p>
5238   */
5239  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);
5240
5241 /**
5242   * Search parameter: <b>status</b>
5243   * <p>
5244   * Description: <b>The current status of the questionnaire</b><br>
5245   * Type: <b>token</b><br>
5246   * Path: <b>Questionnaire.status</b><br>
5247   * </p>
5248   */
5249  @SearchParamDefinition(name="status", path="Questionnaire.status", description="The current status of the questionnaire", type="token" )
5250  public static final String SP_STATUS = "status";
5251 /**
5252   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5253   * <p>
5254   * Description: <b>The current status of the questionnaire</b><br>
5255   * Type: <b>token</b><br>
5256   * Path: <b>Questionnaire.status</b><br>
5257   * </p>
5258   */
5259  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5260
5261  
5262  public QuestionnaireItemComponent getQuestion(String linkId) {
5263    if (linkId == null)
5264      return null;
5265    for (QuestionnaireItemComponent i : getItem()) {
5266      if (i.getLinkId().equals(linkId))
5267        return i;
5268      QuestionnaireItemComponent t = i.getQuestion(linkId);
5269      if (t != null)
5270        return t;
5271    }
5272    return null;
5273  }
5274
5275  public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
5276    for (QuestionnaireItemComponent i : getItem()) {
5277      QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
5278      if (t != null)
5279        return t;
5280    }
5281    return null;
5282  }
5283  
5284
5285}
5286