001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * 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.
048 */
049@ResourceDef(name="Questionnaire", profile="http://hl7.org/fhir/Profile/Questionnaire")
050@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "description", "purpose", "approvalDate", "lastReviewDate", "effectivePeriod", "useContext", "jurisdiction", "contact", "copyright", "code", "subjectType", "item"})
051public class Questionnaire extends MetadataResource {
052
053    public enum QuestionnaireItemType {
054        /**
055         * An item with no direct answer but should have at least one child item.
056         */
057        GROUP, 
058        /**
059         * Text for display that will not capture an answer or have child items.
060         */
061        DISPLAY, 
062        /**
063         * An item that defines a specific answer to be captured, and may have child items.
064(the answer provided in the QuestionnaireResponse should be of the defined datatype)
065         */
066        QUESTION, 
067        /**
068         * Question with a yes/no answer (valueBoolean)
069         */
070        BOOLEAN, 
071        /**
072         * Question with is a real number answer (valueDecimal)
073         */
074        DECIMAL, 
075        /**
076         * Question with an integer answer (valueInteger)
077         */
078        INTEGER, 
079        /**
080         * Question with a date answer (valueDate)
081         */
082        DATE, 
083        /**
084         * Question with a date and time answer (valueDateTime)
085         */
086        DATETIME, 
087        /**
088         * Question with a time (hour:minute:second) answer independent of date. (valueTime)
089         */
090        TIME, 
091        /**
092         * Question with a short (few words to short sentence) free-text entry answer (valueString)
093         */
094        STRING, 
095        /**
096         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString)
097         */
098        TEXT, 
099        /**
100         * Question with a URL (website, FTP site, etc.) answer (valueUri)
101         */
102        URL, 
103        /**
104         * Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)
105         */
106        CHOICE, 
107        /**
108         * Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)
109         */
110        OPENCHOICE, 
111        /**
112         * Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)
113         */
114        ATTACHMENT, 
115        /**
116         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)
117         */
118        REFERENCE, 
119        /**
120         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)
121There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)
122         */
123        QUANTITY, 
124        /**
125         * added to help the parsers with the generic types
126         */
127        NULL;
128        public static QuestionnaireItemType fromCode(String codeString) throws FHIRException {
129            if (codeString == null || "".equals(codeString))
130                return null;
131        if ("group".equals(codeString))
132          return GROUP;
133        if ("display".equals(codeString))
134          return DISPLAY;
135        if ("question".equals(codeString))
136          return QUESTION;
137        if ("boolean".equals(codeString))
138          return BOOLEAN;
139        if ("decimal".equals(codeString))
140          return DECIMAL;
141        if ("integer".equals(codeString))
142          return INTEGER;
143        if ("date".equals(codeString))
144          return DATE;
145        if ("dateTime".equals(codeString))
146          return DATETIME;
147        if ("time".equals(codeString))
148          return TIME;
149        if ("string".equals(codeString))
150          return STRING;
151        if ("text".equals(codeString))
152          return TEXT;
153        if ("url".equals(codeString))
154          return URL;
155        if ("choice".equals(codeString))
156          return CHOICE;
157        if ("open-choice".equals(codeString))
158          return OPENCHOICE;
159        if ("attachment".equals(codeString))
160          return ATTACHMENT;
161        if ("reference".equals(codeString))
162          return REFERENCE;
163        if ("quantity".equals(codeString))
164          return QUANTITY;
165        if (Configuration.isAcceptInvalidEnums())
166          return null;
167        else
168          throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
169        }
170        public String toCode() {
171          switch (this) {
172            case GROUP: return "group";
173            case DISPLAY: return "display";
174            case QUESTION: return "question";
175            case BOOLEAN: return "boolean";
176            case DECIMAL: return "decimal";
177            case INTEGER: return "integer";
178            case DATE: return "date";
179            case DATETIME: return "dateTime";
180            case TIME: return "time";
181            case STRING: return "string";
182            case TEXT: return "text";
183            case URL: return "url";
184            case CHOICE: return "choice";
185            case OPENCHOICE: return "open-choice";
186            case ATTACHMENT: return "attachment";
187            case REFERENCE: return "reference";
188            case QUANTITY: return "quantity";
189            default: return "?";
190          }
191        }
192        public String getSystem() {
193          switch (this) {
194            case GROUP: return "http://hl7.org/fhir/item-type";
195            case DISPLAY: return "http://hl7.org/fhir/item-type";
196            case QUESTION: return "http://hl7.org/fhir/item-type";
197            case BOOLEAN: return "http://hl7.org/fhir/item-type";
198            case DECIMAL: return "http://hl7.org/fhir/item-type";
199            case INTEGER: return "http://hl7.org/fhir/item-type";
200            case DATE: return "http://hl7.org/fhir/item-type";
201            case DATETIME: return "http://hl7.org/fhir/item-type";
202            case TIME: return "http://hl7.org/fhir/item-type";
203            case STRING: return "http://hl7.org/fhir/item-type";
204            case TEXT: return "http://hl7.org/fhir/item-type";
205            case URL: return "http://hl7.org/fhir/item-type";
206            case CHOICE: return "http://hl7.org/fhir/item-type";
207            case OPENCHOICE: return "http://hl7.org/fhir/item-type";
208            case ATTACHMENT: return "http://hl7.org/fhir/item-type";
209            case REFERENCE: return "http://hl7.org/fhir/item-type";
210            case QUANTITY: return "http://hl7.org/fhir/item-type";
211            default: return "?";
212          }
213        }
214        public String getDefinition() {
215          switch (this) {
216            case GROUP: return "An item with no direct answer but should have at least one child item.";
217            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
218            case QUESTION: return "An item that defines a specific answer to be captured, and may have child items.\n(the answer provided in the QuestionnaireResponse should be of the defined datatype)";
219            case BOOLEAN: return "Question with a yes/no answer (valueBoolean)";
220            case DECIMAL: return "Question with is a real number answer (valueDecimal)";
221            case INTEGER: return "Question with an integer answer (valueInteger)";
222            case DATE: return "Question with a date answer (valueDate)";
223            case DATETIME: return "Question with a date and time answer (valueDateTime)";
224            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime)";
225            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString)";
226            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)";
227            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri)";
228            case CHOICE: return "Question with a Coding drawn from a list of options (specified in either the option property, or via the valueset referenced in the options property) as an answer (valueCoding)";
229            case OPENCHOICE: return "Answer is a Coding drawn from a list of options (as with the choice type) or a free-text entry in a string (valueCoding or valueString)";
230            case ATTACHMENT: return "Question with binary content such as a image, PDF, etc. as an answer (valueAttachment)";
231            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)";
232            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity)\nThere is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit whould be captured (or the a unit that has a ucum conversion from the provided unit)";
233            default: return "?";
234          }
235        }
236        public String getDisplay() {
237          switch (this) {
238            case GROUP: return "Group";
239            case DISPLAY: return "Display";
240            case QUESTION: return "Question";
241            case BOOLEAN: return "Boolean";
242            case DECIMAL: return "Decimal";
243            case INTEGER: return "Integer";
244            case DATE: return "Date";
245            case DATETIME: return "Date Time";
246            case TIME: return "Time";
247            case STRING: return "String";
248            case TEXT: return "Text";
249            case URL: return "Url";
250            case CHOICE: return "Choice";
251            case OPENCHOICE: return "Open Choice";
252            case ATTACHMENT: return "Attachment";
253            case REFERENCE: return "Reference";
254            case QUANTITY: return "Quantity";
255            default: return "?";
256          }
257        }
258    }
259
260  public static class QuestionnaireItemTypeEnumFactory implements EnumFactory<QuestionnaireItemType> {
261    public QuestionnaireItemType fromCode(String codeString) throws IllegalArgumentException {
262      if (codeString == null || "".equals(codeString))
263            if (codeString == null || "".equals(codeString))
264                return null;
265        if ("group".equals(codeString))
266          return QuestionnaireItemType.GROUP;
267        if ("display".equals(codeString))
268          return QuestionnaireItemType.DISPLAY;
269        if ("question".equals(codeString))
270          return QuestionnaireItemType.QUESTION;
271        if ("boolean".equals(codeString))
272          return QuestionnaireItemType.BOOLEAN;
273        if ("decimal".equals(codeString))
274          return QuestionnaireItemType.DECIMAL;
275        if ("integer".equals(codeString))
276          return QuestionnaireItemType.INTEGER;
277        if ("date".equals(codeString))
278          return QuestionnaireItemType.DATE;
279        if ("dateTime".equals(codeString))
280          return QuestionnaireItemType.DATETIME;
281        if ("time".equals(codeString))
282          return QuestionnaireItemType.TIME;
283        if ("string".equals(codeString))
284          return QuestionnaireItemType.STRING;
285        if ("text".equals(codeString))
286          return QuestionnaireItemType.TEXT;
287        if ("url".equals(codeString))
288          return QuestionnaireItemType.URL;
289        if ("choice".equals(codeString))
290          return QuestionnaireItemType.CHOICE;
291        if ("open-choice".equals(codeString))
292          return QuestionnaireItemType.OPENCHOICE;
293        if ("attachment".equals(codeString))
294          return QuestionnaireItemType.ATTACHMENT;
295        if ("reference".equals(codeString))
296          return QuestionnaireItemType.REFERENCE;
297        if ("quantity".equals(codeString))
298          return QuestionnaireItemType.QUANTITY;
299        throw new IllegalArgumentException("Unknown QuestionnaireItemType code '"+codeString+"'");
300        }
301        public Enumeration<QuestionnaireItemType> fromType(Base code) throws FHIRException {
302          if (code == null)
303            return null;
304          if (code.isEmpty())
305            return new Enumeration<QuestionnaireItemType>(this);
306          String codeString = ((PrimitiveType) code).asStringValue();
307          if (codeString == null || "".equals(codeString))
308            return null;
309        if ("group".equals(codeString))
310          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.GROUP);
311        if ("display".equals(codeString))
312          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DISPLAY);
313        if ("question".equals(codeString))
314          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUESTION);
315        if ("boolean".equals(codeString))
316          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.BOOLEAN);
317        if ("decimal".equals(codeString))
318          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DECIMAL);
319        if ("integer".equals(codeString))
320          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.INTEGER);
321        if ("date".equals(codeString))
322          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATE);
323        if ("dateTime".equals(codeString))
324          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATETIME);
325        if ("time".equals(codeString))
326          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TIME);
327        if ("string".equals(codeString))
328          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.STRING);
329        if ("text".equals(codeString))
330          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TEXT);
331        if ("url".equals(codeString))
332          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.URL);
333        if ("choice".equals(codeString))
334          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.CHOICE);
335        if ("open-choice".equals(codeString))
336          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.OPENCHOICE);
337        if ("attachment".equals(codeString))
338          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.ATTACHMENT);
339        if ("reference".equals(codeString))
340          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.REFERENCE);
341        if ("quantity".equals(codeString))
342          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUANTITY);
343        throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
344        }
345    public String toCode(QuestionnaireItemType code) {
346      if (code == QuestionnaireItemType.GROUP)
347        return "group";
348      if (code == QuestionnaireItemType.DISPLAY)
349        return "display";
350      if (code == QuestionnaireItemType.QUESTION)
351        return "question";
352      if (code == QuestionnaireItemType.BOOLEAN)
353        return "boolean";
354      if (code == QuestionnaireItemType.DECIMAL)
355        return "decimal";
356      if (code == QuestionnaireItemType.INTEGER)
357        return "integer";
358      if (code == QuestionnaireItemType.DATE)
359        return "date";
360      if (code == QuestionnaireItemType.DATETIME)
361        return "dateTime";
362      if (code == QuestionnaireItemType.TIME)
363        return "time";
364      if (code == QuestionnaireItemType.STRING)
365        return "string";
366      if (code == QuestionnaireItemType.TEXT)
367        return "text";
368      if (code == QuestionnaireItemType.URL)
369        return "url";
370      if (code == QuestionnaireItemType.CHOICE)
371        return "choice";
372      if (code == QuestionnaireItemType.OPENCHOICE)
373        return "open-choice";
374      if (code == QuestionnaireItemType.ATTACHMENT)
375        return "attachment";
376      if (code == QuestionnaireItemType.REFERENCE)
377        return "reference";
378      if (code == QuestionnaireItemType.QUANTITY)
379        return "quantity";
380      return "?";
381      }
382    public String toSystem(QuestionnaireItemType code) {
383      return code.getSystem();
384      }
385    }
386
387    @Block()
388    public static class QuestionnaireItemComponent extends BackboneElement implements IBaseBackboneElement {
389        /**
390         * An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
391         */
392        @Child(name = "linkId", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
393        @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." )
394        protected StringType linkId;
395
396        /**
397         * A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: 
398
399* code (ElementDefinition.code)
400* type (ElementDefinition.type)
401* required (ElementDefinition.min)
402* repeats (ElementDefinition.max)
403* maxLength (ElementDefinition.maxLength)
404* options (ElementDefinition.binding)
405
406Any information provided in these elements on a Questionnaire Item overrides the information from the definition.
407         */
408        @Child(name = "definition", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
409        @Description(shortDefinition="ElementDefinition - details for the item", formalDefinition="A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: \n\n* code (ElementDefinition.code)\n* type (ElementDefinition.type)\n* required (ElementDefinition.min)\n* repeats (ElementDefinition.max)\n* maxLength (ElementDefinition.maxLength)\n* options (ElementDefinition.binding)\n\nAny information provided in these elements on a Questionnaire Item overrides the information from the definition." )
410        protected UriType definition;
411
412        /**
413         * A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).
414         */
415        @Child(name = "code", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
416        @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)." )
417        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
418        protected List<Coding> code;
419
420        /**
421         * 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.
422         */
423        @Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
424        @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." )
425        protected StringType prefix;
426
427        /**
428         * The name of a section, the text of a question or text content for a display item.
429         */
430        @Child(name = "text", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
431        @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." )
432        protected StringType text;
433
434        /**
435         * 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.).
436         */
437        @Child(name = "type", type = {CodeType.class}, order=6, min=1, max=1, modifier=false, summary=false)
438        @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.)." )
439        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/item-type")
440        protected Enumeration<QuestionnaireItemType> type;
441
442        /**
443         * A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.
444         */
445        @Child(name = "enableWhen", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true)
446        @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." )
447        protected List<QuestionnaireItemEnableWhenComponent> enableWhen;
448
449        /**
450         * 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.
451         */
452        @Child(name = "required", type = {BooleanType.class}, order=8, min=0, max=1, modifier=false, summary=false)
453        @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." )
454        protected BooleanType required;
455
456        /**
457         * An indication, if true, that the item may occur multiple times in the response, collecting multiple answers answers for questions or multiple sets of answers for groups.
458         */
459        @Child(name = "repeats", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
460        @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 answers for questions or multiple sets of answers for groups." )
461        protected BooleanType repeats;
462
463        /**
464         * An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
465         */
466        @Child(name = "readOnly", type = {BooleanType.class}, order=10, min=0, max=1, modifier=false, summary=false)
467        @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." )
468        protected BooleanType readOnly;
469
470        /**
471         * The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
472         */
473        @Child(name = "maxLength", type = {IntegerType.class}, order=11, min=0, max=1, modifier=false, summary=false)
474        @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." )
475        protected IntegerType maxLength;
476
477        /**
478         * A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.
479         */
480        @Child(name = "options", type = {ValueSet.class}, order=12, min=0, max=1, modifier=false, summary=false)
481        @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." )
482        protected Reference options;
483
484        /**
485         * The actual object that is the target of the reference (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.)
486         */
487        protected ValueSet optionsTarget;
488
489        /**
490         * One of the permitted answers for a "choice" or "open-choice" question.
491         */
492        @Child(name = "option", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
493        @Description(shortDefinition="Permitted answer", formalDefinition="One of the permitted answers for a \"choice\" or \"open-choice\" question." )
494        protected List<QuestionnaireItemOptionComponent> option;
495
496        /**
497         * The value that should be defaulted when initially rendering the questionnaire for user input.
498         */
499        @Child(name = "initial", 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=14, min=0, max=1, modifier=false, summary=false)
500        @Description(shortDefinition="Default value when item is first rendered", formalDefinition="The value that should be defaulted when initially rendering the questionnaire for user input." )
501        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
502        protected Type initial;
503
504        /**
505         * Text, questions and other groups to be nested beneath a question or group.
506         */
507        @Child(name = "item", type = {QuestionnaireItemComponent.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
508        @Description(shortDefinition="Nested questionnaire items", formalDefinition="Text, questions and other groups to be nested beneath a question or group." )
509        protected List<QuestionnaireItemComponent> item;
510
511        private static final long serialVersionUID = -1997112302L;
512
513    /**
514     * Constructor
515     */
516      public QuestionnaireItemComponent() {
517        super();
518      }
519
520    /**
521     * Constructor
522     */
523      public QuestionnaireItemComponent(StringType linkId, Enumeration<QuestionnaireItemType> type) {
524        super();
525        this.linkId = linkId;
526        this.type = type;
527      }
528
529        /**
530         * @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
531         */
532        public StringType getLinkIdElement() { 
533          if (this.linkId == null)
534            if (Configuration.errorOnAutoCreate())
535              throw new Error("Attempt to auto-create QuestionnaireItemComponent.linkId");
536            else if (Configuration.doAutoCreate())
537              this.linkId = new StringType(); // bb
538          return this.linkId;
539        }
540
541        public boolean hasLinkIdElement() { 
542          return this.linkId != null && !this.linkId.isEmpty();
543        }
544
545        public boolean hasLinkId() { 
546          return this.linkId != null && !this.linkId.isEmpty();
547        }
548
549        /**
550         * @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
551         */
552        public QuestionnaireItemComponent setLinkIdElement(StringType value) { 
553          this.linkId = value;
554          return this;
555        }
556
557        /**
558         * @return An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
559         */
560        public String getLinkId() { 
561          return this.linkId == null ? null : this.linkId.getValue();
562        }
563
564        /**
565         * @param value An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
566         */
567        public QuestionnaireItemComponent setLinkId(String value) { 
568            if (this.linkId == null)
569              this.linkId = new StringType();
570            this.linkId.setValue(value);
571          return this;
572        }
573
574        /**
575         * @return {@link #definition} (A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: 
576
577* code (ElementDefinition.code)
578* type (ElementDefinition.type)
579* required (ElementDefinition.min)
580* repeats (ElementDefinition.max)
581* maxLength (ElementDefinition.maxLength)
582* options (ElementDefinition.binding)
583
584Any information provided in these elements on a Questionnaire Item overrides the information from the definition.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
585         */
586        public UriType getDefinitionElement() { 
587          if (this.definition == null)
588            if (Configuration.errorOnAutoCreate())
589              throw new Error("Attempt to auto-create QuestionnaireItemComponent.definition");
590            else if (Configuration.doAutoCreate())
591              this.definition = new UriType(); // bb
592          return this.definition;
593        }
594
595        public boolean hasDefinitionElement() { 
596          return this.definition != null && !this.definition.isEmpty();
597        }
598
599        public boolean hasDefinition() { 
600          return this.definition != null && !this.definition.isEmpty();
601        }
602
603        /**
604         * @param value {@link #definition} (A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: 
605
606* code (ElementDefinition.code)
607* type (ElementDefinition.type)
608* required (ElementDefinition.min)
609* repeats (ElementDefinition.max)
610* maxLength (ElementDefinition.maxLength)
611* options (ElementDefinition.binding)
612
613Any information provided in these elements on a Questionnaire Item overrides the information from the definition.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
614         */
615        public QuestionnaireItemComponent setDefinitionElement(UriType value) { 
616          this.definition = value;
617          return this;
618        }
619
620        /**
621         * @return A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: 
622
623* code (ElementDefinition.code)
624* type (ElementDefinition.type)
625* required (ElementDefinition.min)
626* repeats (ElementDefinition.max)
627* maxLength (ElementDefinition.maxLength)
628* options (ElementDefinition.binding)
629
630Any information provided in these elements on a Questionnaire Item overrides the information from the definition.
631         */
632        public String getDefinition() { 
633          return this.definition == null ? null : this.definition.getValue();
634        }
635
636        /**
637         * @param value A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: 
638
639* code (ElementDefinition.code)
640* type (ElementDefinition.type)
641* required (ElementDefinition.min)
642* repeats (ElementDefinition.max)
643* maxLength (ElementDefinition.maxLength)
644* options (ElementDefinition.binding)
645
646Any information provided in these elements on a Questionnaire Item overrides the information from the definition.
647         */
648        public QuestionnaireItemComponent setDefinition(String value) { 
649          if (Utilities.noString(value))
650            this.definition = null;
651          else {
652            if (this.definition == null)
653              this.definition = new UriType();
654            this.definition.setValue(value);
655          }
656          return this;
657        }
658
659        /**
660         * @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).)
661         */
662        public List<Coding> getCode() { 
663          if (this.code == null)
664            this.code = new ArrayList<Coding>();
665          return this.code;
666        }
667
668        /**
669         * @return Returns a reference to <code>this</code> for easy method chaining
670         */
671        public QuestionnaireItemComponent setCode(List<Coding> theCode) { 
672          this.code = theCode;
673          return this;
674        }
675
676        public boolean hasCode() { 
677          if (this.code == null)
678            return false;
679          for (Coding item : this.code)
680            if (!item.isEmpty())
681              return true;
682          return false;
683        }
684
685        public Coding addCode() { //3
686          Coding t = new Coding();
687          if (this.code == null)
688            this.code = new ArrayList<Coding>();
689          this.code.add(t);
690          return t;
691        }
692
693        public QuestionnaireItemComponent addCode(Coding t) { //3
694          if (t == null)
695            return this;
696          if (this.code == null)
697            this.code = new ArrayList<Coding>();
698          this.code.add(t);
699          return this;
700        }
701
702        /**
703         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
704         */
705        public Coding getCodeFirstRep() { 
706          if (getCode().isEmpty()) {
707            addCode();
708          }
709          return getCode().get(0);
710        }
711
712        /**
713         * @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
714         */
715        public StringType getPrefixElement() { 
716          if (this.prefix == null)
717            if (Configuration.errorOnAutoCreate())
718              throw new Error("Attempt to auto-create QuestionnaireItemComponent.prefix");
719            else if (Configuration.doAutoCreate())
720              this.prefix = new StringType(); // bb
721          return this.prefix;
722        }
723
724        public boolean hasPrefixElement() { 
725          return this.prefix != null && !this.prefix.isEmpty();
726        }
727
728        public boolean hasPrefix() { 
729          return this.prefix != null && !this.prefix.isEmpty();
730        }
731
732        /**
733         * @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
734         */
735        public QuestionnaireItemComponent setPrefixElement(StringType value) { 
736          this.prefix = value;
737          return this;
738        }
739
740        /**
741         * @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.
742         */
743        public String getPrefix() { 
744          return this.prefix == null ? null : this.prefix.getValue();
745        }
746
747        /**
748         * @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.
749         */
750        public QuestionnaireItemComponent setPrefix(String value) { 
751          if (Utilities.noString(value))
752            this.prefix = null;
753          else {
754            if (this.prefix == null)
755              this.prefix = new StringType();
756            this.prefix.setValue(value);
757          }
758          return this;
759        }
760
761        /**
762         * @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
763         */
764        public StringType getTextElement() { 
765          if (this.text == null)
766            if (Configuration.errorOnAutoCreate())
767              throw new Error("Attempt to auto-create QuestionnaireItemComponent.text");
768            else if (Configuration.doAutoCreate())
769              this.text = new StringType(); // bb
770          return this.text;
771        }
772
773        public boolean hasTextElement() { 
774          return this.text != null && !this.text.isEmpty();
775        }
776
777        public boolean hasText() { 
778          return this.text != null && !this.text.isEmpty();
779        }
780
781        /**
782         * @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
783         */
784        public QuestionnaireItemComponent setTextElement(StringType value) { 
785          this.text = value;
786          return this;
787        }
788
789        /**
790         * @return The name of a section, the text of a question or text content for a display item.
791         */
792        public String getText() { 
793          return this.text == null ? null : this.text.getValue();
794        }
795
796        /**
797         * @param value The name of a section, the text of a question or text content for a display item.
798         */
799        public QuestionnaireItemComponent setText(String value) { 
800          if (Utilities.noString(value))
801            this.text = null;
802          else {
803            if (this.text == null)
804              this.text = new StringType();
805            this.text.setValue(value);
806          }
807          return this;
808        }
809
810        /**
811         * @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
812         */
813        public Enumeration<QuestionnaireItemType> getTypeElement() { 
814          if (this.type == null)
815            if (Configuration.errorOnAutoCreate())
816              throw new Error("Attempt to auto-create QuestionnaireItemComponent.type");
817            else if (Configuration.doAutoCreate())
818              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory()); // bb
819          return this.type;
820        }
821
822        public boolean hasTypeElement() { 
823          return this.type != null && !this.type.isEmpty();
824        }
825
826        public boolean hasType() { 
827          return this.type != null && !this.type.isEmpty();
828        }
829
830        /**
831         * @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
832         */
833        public QuestionnaireItemComponent setTypeElement(Enumeration<QuestionnaireItemType> value) { 
834          this.type = value;
835          return this;
836        }
837
838        /**
839         * @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.).
840         */
841        public QuestionnaireItemType getType() { 
842          return this.type == null ? null : this.type.getValue();
843        }
844
845        /**
846         * @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.).
847         */
848        public QuestionnaireItemComponent setType(QuestionnaireItemType value) { 
849            if (this.type == null)
850              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory());
851            this.type.setValue(value);
852          return this;
853        }
854
855        /**
856         * @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.)
857         */
858        public List<QuestionnaireItemEnableWhenComponent> getEnableWhen() { 
859          if (this.enableWhen == null)
860            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
861          return this.enableWhen;
862        }
863
864        /**
865         * @return Returns a reference to <code>this</code> for easy method chaining
866         */
867        public QuestionnaireItemComponent setEnableWhen(List<QuestionnaireItemEnableWhenComponent> theEnableWhen) { 
868          this.enableWhen = theEnableWhen;
869          return this;
870        }
871
872        public boolean hasEnableWhen() { 
873          if (this.enableWhen == null)
874            return false;
875          for (QuestionnaireItemEnableWhenComponent item : this.enableWhen)
876            if (!item.isEmpty())
877              return true;
878          return false;
879        }
880
881        public QuestionnaireItemEnableWhenComponent addEnableWhen() { //3
882          QuestionnaireItemEnableWhenComponent t = new QuestionnaireItemEnableWhenComponent();
883          if (this.enableWhen == null)
884            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
885          this.enableWhen.add(t);
886          return t;
887        }
888
889        public QuestionnaireItemComponent addEnableWhen(QuestionnaireItemEnableWhenComponent t) { //3
890          if (t == null)
891            return this;
892          if (this.enableWhen == null)
893            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
894          this.enableWhen.add(t);
895          return this;
896        }
897
898        /**
899         * @return The first repetition of repeating field {@link #enableWhen}, creating it if it does not already exist
900         */
901        public QuestionnaireItemEnableWhenComponent getEnableWhenFirstRep() { 
902          if (getEnableWhen().isEmpty()) {
903            addEnableWhen();
904          }
905          return getEnableWhen().get(0);
906        }
907
908        /**
909         * @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
910         */
911        public BooleanType getRequiredElement() { 
912          if (this.required == null)
913            if (Configuration.errorOnAutoCreate())
914              throw new Error("Attempt to auto-create QuestionnaireItemComponent.required");
915            else if (Configuration.doAutoCreate())
916              this.required = new BooleanType(); // bb
917          return this.required;
918        }
919
920        public boolean hasRequiredElement() { 
921          return this.required != null && !this.required.isEmpty();
922        }
923
924        public boolean hasRequired() { 
925          return this.required != null && !this.required.isEmpty();
926        }
927
928        /**
929         * @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
930         */
931        public QuestionnaireItemComponent setRequiredElement(BooleanType value) { 
932          this.required = value;
933          return this;
934        }
935
936        /**
937         * @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.
938         */
939        public boolean getRequired() { 
940          return this.required == null || this.required.isEmpty() ? false : this.required.getValue();
941        }
942
943        /**
944         * @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.
945         */
946        public QuestionnaireItemComponent setRequired(boolean value) { 
947            if (this.required == null)
948              this.required = new BooleanType();
949            this.required.setValue(value);
950          return this;
951        }
952
953        /**
954         * @return {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers 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
955         */
956        public BooleanType getRepeatsElement() { 
957          if (this.repeats == null)
958            if (Configuration.errorOnAutoCreate())
959              throw new Error("Attempt to auto-create QuestionnaireItemComponent.repeats");
960            else if (Configuration.doAutoCreate())
961              this.repeats = new BooleanType(); // bb
962          return this.repeats;
963        }
964
965        public boolean hasRepeatsElement() { 
966          return this.repeats != null && !this.repeats.isEmpty();
967        }
968
969        public boolean hasRepeats() { 
970          return this.repeats != null && !this.repeats.isEmpty();
971        }
972
973        /**
974         * @param value {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers 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
975         */
976        public QuestionnaireItemComponent setRepeatsElement(BooleanType value) { 
977          this.repeats = value;
978          return this;
979        }
980
981        /**
982         * @return An indication, if true, that the item may occur multiple times in the response, collecting multiple answers answers for questions or multiple sets of answers for groups.
983         */
984        public boolean getRepeats() { 
985          return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue();
986        }
987
988        /**
989         * @param value An indication, if true, that the item may occur multiple times in the response, collecting multiple answers answers for questions or multiple sets of answers for groups.
990         */
991        public QuestionnaireItemComponent setRepeats(boolean value) { 
992            if (this.repeats == null)
993              this.repeats = new BooleanType();
994            this.repeats.setValue(value);
995          return this;
996        }
997
998        /**
999         * @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
1000         */
1001        public BooleanType getReadOnlyElement() { 
1002          if (this.readOnly == null)
1003            if (Configuration.errorOnAutoCreate())
1004              throw new Error("Attempt to auto-create QuestionnaireItemComponent.readOnly");
1005            else if (Configuration.doAutoCreate())
1006              this.readOnly = new BooleanType(); // bb
1007          return this.readOnly;
1008        }
1009
1010        public boolean hasReadOnlyElement() { 
1011          return this.readOnly != null && !this.readOnly.isEmpty();
1012        }
1013
1014        public boolean hasReadOnly() { 
1015          return this.readOnly != null && !this.readOnly.isEmpty();
1016        }
1017
1018        /**
1019         * @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
1020         */
1021        public QuestionnaireItemComponent setReadOnlyElement(BooleanType value) { 
1022          this.readOnly = value;
1023          return this;
1024        }
1025
1026        /**
1027         * @return An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1028         */
1029        public boolean getReadOnly() { 
1030          return this.readOnly == null || this.readOnly.isEmpty() ? false : this.readOnly.getValue();
1031        }
1032
1033        /**
1034         * @param value An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1035         */
1036        public QuestionnaireItemComponent setReadOnly(boolean value) { 
1037            if (this.readOnly == null)
1038              this.readOnly = new BooleanType();
1039            this.readOnly.setValue(value);
1040          return this;
1041        }
1042
1043        /**
1044         * @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
1045         */
1046        public IntegerType getMaxLengthElement() { 
1047          if (this.maxLength == null)
1048            if (Configuration.errorOnAutoCreate())
1049              throw new Error("Attempt to auto-create QuestionnaireItemComponent.maxLength");
1050            else if (Configuration.doAutoCreate())
1051              this.maxLength = new IntegerType(); // bb
1052          return this.maxLength;
1053        }
1054
1055        public boolean hasMaxLengthElement() { 
1056          return this.maxLength != null && !this.maxLength.isEmpty();
1057        }
1058
1059        public boolean hasMaxLength() { 
1060          return this.maxLength != null && !this.maxLength.isEmpty();
1061        }
1062
1063        /**
1064         * @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
1065         */
1066        public QuestionnaireItemComponent setMaxLengthElement(IntegerType value) { 
1067          this.maxLength = value;
1068          return this;
1069        }
1070
1071        /**
1072         * @return The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1073         */
1074        public int getMaxLength() { 
1075          return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
1076        }
1077
1078        /**
1079         * @param value The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1080         */
1081        public QuestionnaireItemComponent setMaxLength(int value) { 
1082            if (this.maxLength == null)
1083              this.maxLength = new IntegerType();
1084            this.maxLength.setValue(value);
1085          return this;
1086        }
1087
1088        /**
1089         * @return {@link #options} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.)
1090         */
1091        public Reference getOptions() { 
1092          if (this.options == null)
1093            if (Configuration.errorOnAutoCreate())
1094              throw new Error("Attempt to auto-create QuestionnaireItemComponent.options");
1095            else if (Configuration.doAutoCreate())
1096              this.options = new Reference(); // cc
1097          return this.options;
1098        }
1099
1100        public boolean hasOptions() { 
1101          return this.options != null && !this.options.isEmpty();
1102        }
1103
1104        /**
1105         * @param value {@link #options} (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.)
1106         */
1107        public QuestionnaireItemComponent setOptions(Reference value) { 
1108          this.options = value;
1109          return this;
1110        }
1111
1112        /**
1113         * @return {@link #options} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.)
1114         */
1115        public ValueSet getOptionsTarget() { 
1116          if (this.optionsTarget == null)
1117            if (Configuration.errorOnAutoCreate())
1118              throw new Error("Attempt to auto-create QuestionnaireItemComponent.options");
1119            else if (Configuration.doAutoCreate())
1120              this.optionsTarget = new ValueSet(); // aa
1121          return this.optionsTarget;
1122        }
1123
1124        /**
1125         * @param value {@link #options} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.)
1126         */
1127        public QuestionnaireItemComponent setOptionsTarget(ValueSet value) { 
1128          this.optionsTarget = value;
1129          return this;
1130        }
1131
1132        /**
1133         * @return {@link #option} (One of the permitted answers for a "choice" or "open-choice" question.)
1134         */
1135        public List<QuestionnaireItemOptionComponent> getOption() { 
1136          if (this.option == null)
1137            this.option = new ArrayList<QuestionnaireItemOptionComponent>();
1138          return this.option;
1139        }
1140
1141        /**
1142         * @return Returns a reference to <code>this</code> for easy method chaining
1143         */
1144        public QuestionnaireItemComponent setOption(List<QuestionnaireItemOptionComponent> theOption) { 
1145          this.option = theOption;
1146          return this;
1147        }
1148
1149        public boolean hasOption() { 
1150          if (this.option == null)
1151            return false;
1152          for (QuestionnaireItemOptionComponent item : this.option)
1153            if (!item.isEmpty())
1154              return true;
1155          return false;
1156        }
1157
1158        public QuestionnaireItemOptionComponent addOption() { //3
1159          QuestionnaireItemOptionComponent t = new QuestionnaireItemOptionComponent();
1160          if (this.option == null)
1161            this.option = new ArrayList<QuestionnaireItemOptionComponent>();
1162          this.option.add(t);
1163          return t;
1164        }
1165
1166        public QuestionnaireItemComponent addOption(QuestionnaireItemOptionComponent t) { //3
1167          if (t == null)
1168            return this;
1169          if (this.option == null)
1170            this.option = new ArrayList<QuestionnaireItemOptionComponent>();
1171          this.option.add(t);
1172          return this;
1173        }
1174
1175        /**
1176         * @return The first repetition of repeating field {@link #option}, creating it if it does not already exist
1177         */
1178        public QuestionnaireItemOptionComponent getOptionFirstRep() { 
1179          if (getOption().isEmpty()) {
1180            addOption();
1181          }
1182          return getOption().get(0);
1183        }
1184
1185        /**
1186         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1187         */
1188        public Type getInitial() { 
1189          return this.initial;
1190        }
1191
1192        /**
1193         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1194         */
1195        public BooleanType getInitialBooleanType() throws FHIRException { 
1196          if (!(this.initial instanceof BooleanType))
1197            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.initial.getClass().getName()+" was encountered");
1198          return (BooleanType) this.initial;
1199        }
1200
1201        public boolean hasInitialBooleanType() { 
1202          return this.initial instanceof BooleanType;
1203        }
1204
1205        /**
1206         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1207         */
1208        public DecimalType getInitialDecimalType() throws FHIRException { 
1209          if (!(this.initial instanceof DecimalType))
1210            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.initial.getClass().getName()+" was encountered");
1211          return (DecimalType) this.initial;
1212        }
1213
1214        public boolean hasInitialDecimalType() { 
1215          return this.initial instanceof DecimalType;
1216        }
1217
1218        /**
1219         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1220         */
1221        public IntegerType getInitialIntegerType() throws FHIRException { 
1222          if (!(this.initial instanceof IntegerType))
1223            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.initial.getClass().getName()+" was encountered");
1224          return (IntegerType) this.initial;
1225        }
1226
1227        public boolean hasInitialIntegerType() { 
1228          return this.initial instanceof IntegerType;
1229        }
1230
1231        /**
1232         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1233         */
1234        public DateType getInitialDateType() throws FHIRException { 
1235          if (!(this.initial instanceof DateType))
1236            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.initial.getClass().getName()+" was encountered");
1237          return (DateType) this.initial;
1238        }
1239
1240        public boolean hasInitialDateType() { 
1241          return this.initial instanceof DateType;
1242        }
1243
1244        /**
1245         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1246         */
1247        public DateTimeType getInitialDateTimeType() throws FHIRException { 
1248          if (!(this.initial instanceof DateTimeType))
1249            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.initial.getClass().getName()+" was encountered");
1250          return (DateTimeType) this.initial;
1251        }
1252
1253        public boolean hasInitialDateTimeType() { 
1254          return this.initial instanceof DateTimeType;
1255        }
1256
1257        /**
1258         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1259         */
1260        public TimeType getInitialTimeType() throws FHIRException { 
1261          if (!(this.initial instanceof TimeType))
1262            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.initial.getClass().getName()+" was encountered");
1263          return (TimeType) this.initial;
1264        }
1265
1266        public boolean hasInitialTimeType() { 
1267          return this.initial instanceof TimeType;
1268        }
1269
1270        /**
1271         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1272         */
1273        public StringType getInitialStringType() throws FHIRException { 
1274          if (!(this.initial instanceof StringType))
1275            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.initial.getClass().getName()+" was encountered");
1276          return (StringType) this.initial;
1277        }
1278
1279        public boolean hasInitialStringType() { 
1280          return this.initial instanceof StringType;
1281        }
1282
1283        /**
1284         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1285         */
1286        public UriType getInitialUriType() throws FHIRException { 
1287          if (!(this.initial instanceof UriType))
1288            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.initial.getClass().getName()+" was encountered");
1289          return (UriType) this.initial;
1290        }
1291
1292        public boolean hasInitialUriType() { 
1293          return this.initial instanceof UriType;
1294        }
1295
1296        /**
1297         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1298         */
1299        public Attachment getInitialAttachment() throws FHIRException { 
1300          if (!(this.initial instanceof Attachment))
1301            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.initial.getClass().getName()+" was encountered");
1302          return (Attachment) this.initial;
1303        }
1304
1305        public boolean hasInitialAttachment() { 
1306          return this.initial instanceof Attachment;
1307        }
1308
1309        /**
1310         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1311         */
1312        public Coding getInitialCoding() throws FHIRException { 
1313          if (!(this.initial instanceof Coding))
1314            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.initial.getClass().getName()+" was encountered");
1315          return (Coding) this.initial;
1316        }
1317
1318        public boolean hasInitialCoding() { 
1319          return this.initial instanceof Coding;
1320        }
1321
1322        /**
1323         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1324         */
1325        public Quantity getInitialQuantity() throws FHIRException { 
1326          if (!(this.initial instanceof Quantity))
1327            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.initial.getClass().getName()+" was encountered");
1328          return (Quantity) this.initial;
1329        }
1330
1331        public boolean hasInitialQuantity() { 
1332          return this.initial instanceof Quantity;
1333        }
1334
1335        /**
1336         * @return {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1337         */
1338        public Reference getInitialReference() throws FHIRException { 
1339          if (!(this.initial instanceof Reference))
1340            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.initial.getClass().getName()+" was encountered");
1341          return (Reference) this.initial;
1342        }
1343
1344        public boolean hasInitialReference() { 
1345          return this.initial instanceof Reference;
1346        }
1347
1348        public boolean hasInitial() { 
1349          return this.initial != null && !this.initial.isEmpty();
1350        }
1351
1352        /**
1353         * @param value {@link #initial} (The value that should be defaulted when initially rendering the questionnaire for user input.)
1354         */
1355        public QuestionnaireItemComponent setInitial(Type value) { 
1356          this.initial = value;
1357          return this;
1358        }
1359
1360        /**
1361         * @return {@link #item} (Text, questions and other groups to be nested beneath a question or group.)
1362         */
1363        public List<QuestionnaireItemComponent> getItem() { 
1364          if (this.item == null)
1365            this.item = new ArrayList<QuestionnaireItemComponent>();
1366          return this.item;
1367        }
1368
1369        /**
1370         * @return Returns a reference to <code>this</code> for easy method chaining
1371         */
1372        public QuestionnaireItemComponent setItem(List<QuestionnaireItemComponent> theItem) { 
1373          this.item = theItem;
1374          return this;
1375        }
1376
1377        public boolean hasItem() { 
1378          if (this.item == null)
1379            return false;
1380          for (QuestionnaireItemComponent item : this.item)
1381            if (!item.isEmpty())
1382              return true;
1383          return false;
1384        }
1385
1386        public QuestionnaireItemComponent addItem() { //3
1387          QuestionnaireItemComponent t = new QuestionnaireItemComponent();
1388          if (this.item == null)
1389            this.item = new ArrayList<QuestionnaireItemComponent>();
1390          this.item.add(t);
1391          return t;
1392        }
1393
1394        public QuestionnaireItemComponent addItem(QuestionnaireItemComponent t) { //3
1395          if (t == null)
1396            return this;
1397          if (this.item == null)
1398            this.item = new ArrayList<QuestionnaireItemComponent>();
1399          this.item.add(t);
1400          return this;
1401        }
1402
1403        /**
1404         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
1405         */
1406        public QuestionnaireItemComponent getItemFirstRep() { 
1407          if (getItem().isEmpty()) {
1408            addItem();
1409          }
1410          return getItem().get(0);
1411        }
1412
1413        protected void listChildren(List<Property> childrenList) {
1414          super.listChildren(childrenList);
1415          childrenList.add(new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, java.lang.Integer.MAX_VALUE, linkId));
1416          childrenList.add(new Property("definition", "uri", "A reference to an [[[ElementDefinition]]] that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition: \n\n* code (ElementDefinition.code)\n* type (ElementDefinition.type)\n* required (ElementDefinition.min)\n* repeats (ElementDefinition.max)\n* maxLength (ElementDefinition.maxLength)\n* options (ElementDefinition.binding)\n\nAny information provided in these elements on a Questionnaire Item overrides the information from the definition.", 0, java.lang.Integer.MAX_VALUE, definition));
1417          childrenList.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));
1418          childrenList.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, java.lang.Integer.MAX_VALUE, prefix));
1419          childrenList.add(new Property("text", "string", "The name of a section, the text of a question or text content for a display item.", 0, java.lang.Integer.MAX_VALUE, text));
1420          childrenList.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, java.lang.Integer.MAX_VALUE, type));
1421          childrenList.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));
1422          childrenList.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, java.lang.Integer.MAX_VALUE, required));
1423          childrenList.add(new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers answers for questions or multiple sets of answers for groups.", 0, java.lang.Integer.MAX_VALUE, repeats));
1424          childrenList.add(new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, java.lang.Integer.MAX_VALUE, readOnly));
1425          childrenList.add(new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, java.lang.Integer.MAX_VALUE, maxLength));
1426          childrenList.add(new Property("options", "Reference(ValueSet)", "A reference to a value set containing a list of codes representing permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, options));
1427          childrenList.add(new Property("option", "", "One of the permitted answers for a \"choice\" or \"open-choice\" question.", 0, java.lang.Integer.MAX_VALUE, option));
1428          childrenList.add(new Property("initial[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The value that should be defaulted when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial));
1429          childrenList.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));
1430        }
1431
1432      @Override
1433      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1434        switch (hash) {
1435        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
1436        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
1437        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
1438        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
1439        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
1440        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<QuestionnaireItemType>
1441        case 1893321565: /*enableWhen*/ return this.enableWhen == null ? new Base[0] : this.enableWhen.toArray(new Base[this.enableWhen.size()]); // QuestionnaireItemEnableWhenComponent
1442        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // BooleanType
1443        case 1094288952: /*repeats*/ return this.repeats == null ? new Base[0] : new Base[] {this.repeats}; // BooleanType
1444        case -867683742: /*readOnly*/ return this.readOnly == null ? new Base[0] : new Base[] {this.readOnly}; // BooleanType
1445        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
1446        case -1249474914: /*options*/ return this.options == null ? new Base[0] : new Base[] {this.options}; // Reference
1447        case -1010136971: /*option*/ return this.option == null ? new Base[0] : this.option.toArray(new Base[this.option.size()]); // QuestionnaireItemOptionComponent
1448        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : new Base[] {this.initial}; // Type
1449        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
1450        default: return super.getProperty(hash, name, checkValid);
1451        }
1452
1453      }
1454
1455      @Override
1456      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1457        switch (hash) {
1458        case -1102667083: // linkId
1459          this.linkId = castToString(value); // StringType
1460          return value;
1461        case -1014418093: // definition
1462          this.definition = castToUri(value); // UriType
1463          return value;
1464        case 3059181: // code
1465          this.getCode().add(castToCoding(value)); // Coding
1466          return value;
1467        case -980110702: // prefix
1468          this.prefix = castToString(value); // StringType
1469          return value;
1470        case 3556653: // text
1471          this.text = castToString(value); // StringType
1472          return value;
1473        case 3575610: // type
1474          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1475          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1476          return value;
1477        case 1893321565: // enableWhen
1478          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value); // QuestionnaireItemEnableWhenComponent
1479          return value;
1480        case -393139297: // required
1481          this.required = castToBoolean(value); // BooleanType
1482          return value;
1483        case 1094288952: // repeats
1484          this.repeats = castToBoolean(value); // BooleanType
1485          return value;
1486        case -867683742: // readOnly
1487          this.readOnly = castToBoolean(value); // BooleanType
1488          return value;
1489        case -791400086: // maxLength
1490          this.maxLength = castToInteger(value); // IntegerType
1491          return value;
1492        case -1249474914: // options
1493          this.options = castToReference(value); // Reference
1494          return value;
1495        case -1010136971: // option
1496          this.getOption().add((QuestionnaireItemOptionComponent) value); // QuestionnaireItemOptionComponent
1497          return value;
1498        case 1948342084: // initial
1499          this.initial = castToType(value); // Type
1500          return value;
1501        case 3242771: // item
1502          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
1503          return value;
1504        default: return super.setProperty(hash, name, value);
1505        }
1506
1507      }
1508
1509      @Override
1510      public Base setProperty(String name, Base value) throws FHIRException {
1511        if (name.equals("linkId")) {
1512          this.linkId = castToString(value); // StringType
1513        } else if (name.equals("definition")) {
1514          this.definition = castToUri(value); // UriType
1515        } else if (name.equals("code")) {
1516          this.getCode().add(castToCoding(value));
1517        } else if (name.equals("prefix")) {
1518          this.prefix = castToString(value); // StringType
1519        } else if (name.equals("text")) {
1520          this.text = castToString(value); // StringType
1521        } else if (name.equals("type")) {
1522          value = new QuestionnaireItemTypeEnumFactory().fromType(castToCode(value));
1523          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1524        } else if (name.equals("enableWhen")) {
1525          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value);
1526        } else if (name.equals("required")) {
1527          this.required = castToBoolean(value); // BooleanType
1528        } else if (name.equals("repeats")) {
1529          this.repeats = castToBoolean(value); // BooleanType
1530        } else if (name.equals("readOnly")) {
1531          this.readOnly = castToBoolean(value); // BooleanType
1532        } else if (name.equals("maxLength")) {
1533          this.maxLength = castToInteger(value); // IntegerType
1534        } else if (name.equals("options")) {
1535          this.options = castToReference(value); // Reference
1536        } else if (name.equals("option")) {
1537          this.getOption().add((QuestionnaireItemOptionComponent) value);
1538        } else if (name.equals("initial[x]")) {
1539          this.initial = castToType(value); // Type
1540        } else if (name.equals("item")) {
1541          this.getItem().add((QuestionnaireItemComponent) value);
1542        } else
1543          return super.setProperty(name, value);
1544        return value;
1545      }
1546
1547      @Override
1548      public Base makeProperty(int hash, String name) throws FHIRException {
1549        switch (hash) {
1550        case -1102667083:  return getLinkIdElement();
1551        case -1014418093:  return getDefinitionElement();
1552        case 3059181:  return addCode(); 
1553        case -980110702:  return getPrefixElement();
1554        case 3556653:  return getTextElement();
1555        case 3575610:  return getTypeElement();
1556        case 1893321565:  return addEnableWhen(); 
1557        case -393139297:  return getRequiredElement();
1558        case 1094288952:  return getRepeatsElement();
1559        case -867683742:  return getReadOnlyElement();
1560        case -791400086:  return getMaxLengthElement();
1561        case -1249474914:  return getOptions(); 
1562        case -1010136971:  return addOption(); 
1563        case 871077564:  return getInitial(); 
1564        case 1948342084:  return getInitial(); 
1565        case 3242771:  return addItem(); 
1566        default: return super.makeProperty(hash, name);
1567        }
1568
1569      }
1570
1571      @Override
1572      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1573        switch (hash) {
1574        case -1102667083: /*linkId*/ return new String[] {"string"};
1575        case -1014418093: /*definition*/ return new String[] {"uri"};
1576        case 3059181: /*code*/ return new String[] {"Coding"};
1577        case -980110702: /*prefix*/ return new String[] {"string"};
1578        case 3556653: /*text*/ return new String[] {"string"};
1579        case 3575610: /*type*/ return new String[] {"code"};
1580        case 1893321565: /*enableWhen*/ return new String[] {};
1581        case -393139297: /*required*/ return new String[] {"boolean"};
1582        case 1094288952: /*repeats*/ return new String[] {"boolean"};
1583        case -867683742: /*readOnly*/ return new String[] {"boolean"};
1584        case -791400086: /*maxLength*/ return new String[] {"integer"};
1585        case -1249474914: /*options*/ return new String[] {"Reference"};
1586        case -1010136971: /*option*/ return new String[] {};
1587        case 1948342084: /*initial*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
1588        case 3242771: /*item*/ return new String[] {"@Questionnaire.item"};
1589        default: return super.getTypesForProperty(hash, name);
1590        }
1591
1592      }
1593
1594      @Override
1595      public Base addChild(String name) throws FHIRException {
1596        if (name.equals("linkId")) {
1597          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.linkId");
1598        }
1599        else if (name.equals("definition")) {
1600          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.definition");
1601        }
1602        else if (name.equals("code")) {
1603          return addCode();
1604        }
1605        else if (name.equals("prefix")) {
1606          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.prefix");
1607        }
1608        else if (name.equals("text")) {
1609          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.text");
1610        }
1611        else if (name.equals("type")) {
1612          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.type");
1613        }
1614        else if (name.equals("enableWhen")) {
1615          return addEnableWhen();
1616        }
1617        else if (name.equals("required")) {
1618          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.required");
1619        }
1620        else if (name.equals("repeats")) {
1621          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.repeats");
1622        }
1623        else if (name.equals("readOnly")) {
1624          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.readOnly");
1625        }
1626        else if (name.equals("maxLength")) {
1627          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.maxLength");
1628        }
1629        else if (name.equals("options")) {
1630          this.options = new Reference();
1631          return this.options;
1632        }
1633        else if (name.equals("option")) {
1634          return addOption();
1635        }
1636        else if (name.equals("initialBoolean")) {
1637          this.initial = new BooleanType();
1638          return this.initial;
1639        }
1640        else if (name.equals("initialDecimal")) {
1641          this.initial = new DecimalType();
1642          return this.initial;
1643        }
1644        else if (name.equals("initialInteger")) {
1645          this.initial = new IntegerType();
1646          return this.initial;
1647        }
1648        else if (name.equals("initialDate")) {
1649          this.initial = new DateType();
1650          return this.initial;
1651        }
1652        else if (name.equals("initialDateTime")) {
1653          this.initial = new DateTimeType();
1654          return this.initial;
1655        }
1656        else if (name.equals("initialTime")) {
1657          this.initial = new TimeType();
1658          return this.initial;
1659        }
1660        else if (name.equals("initialString")) {
1661          this.initial = new StringType();
1662          return this.initial;
1663        }
1664        else if (name.equals("initialUri")) {
1665          this.initial = new UriType();
1666          return this.initial;
1667        }
1668        else if (name.equals("initialAttachment")) {
1669          this.initial = new Attachment();
1670          return this.initial;
1671        }
1672        else if (name.equals("initialCoding")) {
1673          this.initial = new Coding();
1674          return this.initial;
1675        }
1676        else if (name.equals("initialQuantity")) {
1677          this.initial = new Quantity();
1678          return this.initial;
1679        }
1680        else if (name.equals("initialReference")) {
1681          this.initial = new Reference();
1682          return this.initial;
1683        }
1684        else if (name.equals("item")) {
1685          return addItem();
1686        }
1687        else
1688          return super.addChild(name);
1689      }
1690
1691      public QuestionnaireItemComponent copy() {
1692        QuestionnaireItemComponent dst = new QuestionnaireItemComponent();
1693        copyValues(dst);
1694        dst.linkId = linkId == null ? null : linkId.copy();
1695        dst.definition = definition == null ? null : definition.copy();
1696        if (code != null) {
1697          dst.code = new ArrayList<Coding>();
1698          for (Coding i : code)
1699            dst.code.add(i.copy());
1700        };
1701        dst.prefix = prefix == null ? null : prefix.copy();
1702        dst.text = text == null ? null : text.copy();
1703        dst.type = type == null ? null : type.copy();
1704        if (enableWhen != null) {
1705          dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1706          for (QuestionnaireItemEnableWhenComponent i : enableWhen)
1707            dst.enableWhen.add(i.copy());
1708        };
1709        dst.required = required == null ? null : required.copy();
1710        dst.repeats = repeats == null ? null : repeats.copy();
1711        dst.readOnly = readOnly == null ? null : readOnly.copy();
1712        dst.maxLength = maxLength == null ? null : maxLength.copy();
1713        dst.options = options == null ? null : options.copy();
1714        if (option != null) {
1715          dst.option = new ArrayList<QuestionnaireItemOptionComponent>();
1716          for (QuestionnaireItemOptionComponent i : option)
1717            dst.option.add(i.copy());
1718        };
1719        dst.initial = initial == null ? null : initial.copy();
1720        if (item != null) {
1721          dst.item = new ArrayList<QuestionnaireItemComponent>();
1722          for (QuestionnaireItemComponent i : item)
1723            dst.item.add(i.copy());
1724        };
1725        return dst;
1726      }
1727
1728      @Override
1729      public boolean equalsDeep(Base other) {
1730        if (!super.equalsDeep(other))
1731          return false;
1732        if (!(other instanceof QuestionnaireItemComponent))
1733          return false;
1734        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other;
1735        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(code, o.code, true)
1736           && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true) && compareDeep(type, o.type, true)
1737           && compareDeep(enableWhen, o.enableWhen, true) && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true)
1738           && compareDeep(readOnly, o.readOnly, true) && compareDeep(maxLength, o.maxLength, true) && compareDeep(options, o.options, true)
1739           && compareDeep(option, o.option, true) && compareDeep(initial, o.initial, true) && compareDeep(item, o.item, true)
1740          ;
1741      }
1742
1743      @Override
1744      public boolean equalsShallow(Base other) {
1745        if (!super.equalsShallow(other))
1746          return false;
1747        if (!(other instanceof QuestionnaireItemComponent))
1748          return false;
1749        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other;
1750        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(prefix, o.prefix, true)
1751           && compareValues(text, o.text, true) && compareValues(type, o.type, true) && compareValues(required, o.required, true)
1752           && compareValues(repeats, o.repeats, true) && compareValues(readOnly, o.readOnly, true) && compareValues(maxLength, o.maxLength, true)
1753          ;
1754      }
1755
1756      public boolean isEmpty() {
1757        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code
1758          , prefix, text, type, enableWhen, required, repeats, readOnly, maxLength, options
1759          , option, initial, item);
1760      }
1761
1762  public String fhirType() {
1763    return "Questionnaire.item";
1764
1765  }
1766
1767  }
1768
1769    @Block()
1770    public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
1771        /**
1772         * The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
1773         */
1774        @Child(name = "question", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1775        @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." )
1776        protected StringType question;
1777
1778        /**
1779         * An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).
1780         */
1781        @Child(name = "hasAnswer", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1782        @Description(shortDefinition="Enable when answered or not", formalDefinition="An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false)." )
1783        protected BooleanType hasAnswer;
1784
1785        /**
1786         * An answer that the referenced question must match in order for the item to be enabled.
1787         */
1788        @Child(name = "answer", 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=3, min=0, max=1, modifier=false, summary=false)
1789        @Description(shortDefinition="Value question must have", formalDefinition="An answer that the referenced question must match in order for the item to be enabled." )
1790        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
1791        protected Type answer;
1792
1793        private static final long serialVersionUID = -300241115L;
1794
1795    /**
1796     * Constructor
1797     */
1798      public QuestionnaireItemEnableWhenComponent() {
1799        super();
1800      }
1801
1802    /**
1803     * Constructor
1804     */
1805      public QuestionnaireItemEnableWhenComponent(StringType question) {
1806        super();
1807        this.question = question;
1808      }
1809
1810        /**
1811         * @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
1812         */
1813        public StringType getQuestionElement() { 
1814          if (this.question == null)
1815            if (Configuration.errorOnAutoCreate())
1816              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
1817            else if (Configuration.doAutoCreate())
1818              this.question = new StringType(); // bb
1819          return this.question;
1820        }
1821
1822        public boolean hasQuestionElement() { 
1823          return this.question != null && !this.question.isEmpty();
1824        }
1825
1826        public boolean hasQuestion() { 
1827          return this.question != null && !this.question.isEmpty();
1828        }
1829
1830        /**
1831         * @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
1832         */
1833        public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) { 
1834          this.question = value;
1835          return this;
1836        }
1837
1838        /**
1839         * @return The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
1840         */
1841        public String getQuestion() { 
1842          return this.question == null ? null : this.question.getValue();
1843        }
1844
1845        /**
1846         * @param value The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
1847         */
1848        public QuestionnaireItemEnableWhenComponent setQuestion(String value) { 
1849            if (this.question == null)
1850              this.question = new StringType();
1851            this.question.setValue(value);
1852          return this;
1853        }
1854
1855        /**
1856         * @return {@link #hasAnswer} (An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).). This is the underlying object with id, value and extensions. The accessor "getHasAnswer" gives direct access to the value
1857         */
1858        public BooleanType getHasAnswerElement() { 
1859          if (this.hasAnswer == null)
1860            if (Configuration.errorOnAutoCreate())
1861              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.hasAnswer");
1862            else if (Configuration.doAutoCreate())
1863              this.hasAnswer = new BooleanType(); // bb
1864          return this.hasAnswer;
1865        }
1866
1867        public boolean hasHasAnswerElement() { 
1868          return this.hasAnswer != null && !this.hasAnswer.isEmpty();
1869        }
1870
1871        public boolean hasHasAnswer() { 
1872          return this.hasAnswer != null && !this.hasAnswer.isEmpty();
1873        }
1874
1875        /**
1876         * @param value {@link #hasAnswer} (An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).). This is the underlying object with id, value and extensions. The accessor "getHasAnswer" gives direct access to the value
1877         */
1878        public QuestionnaireItemEnableWhenComponent setHasAnswerElement(BooleanType value) { 
1879          this.hasAnswer = value;
1880          return this;
1881        }
1882
1883        /**
1884         * @return An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).
1885         */
1886        public boolean getHasAnswer() { 
1887          return this.hasAnswer == null || this.hasAnswer.isEmpty() ? false : this.hasAnswer.getValue();
1888        }
1889
1890        /**
1891         * @param value An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).
1892         */
1893        public QuestionnaireItemEnableWhenComponent setHasAnswer(boolean value) { 
1894            if (this.hasAnswer == null)
1895              this.hasAnswer = new BooleanType();
1896            this.hasAnswer.setValue(value);
1897          return this;
1898        }
1899
1900        /**
1901         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1902         */
1903        public Type getAnswer() { 
1904          return this.answer;
1905        }
1906
1907        /**
1908         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1909         */
1910        public BooleanType getAnswerBooleanType() throws FHIRException { 
1911          if (!(this.answer instanceof BooleanType))
1912            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.answer.getClass().getName()+" was encountered");
1913          return (BooleanType) this.answer;
1914        }
1915
1916        public boolean hasAnswerBooleanType() { 
1917          return this.answer instanceof BooleanType;
1918        }
1919
1920        /**
1921         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1922         */
1923        public DecimalType getAnswerDecimalType() throws FHIRException { 
1924          if (!(this.answer instanceof DecimalType))
1925            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.answer.getClass().getName()+" was encountered");
1926          return (DecimalType) this.answer;
1927        }
1928
1929        public boolean hasAnswerDecimalType() { 
1930          return this.answer instanceof DecimalType;
1931        }
1932
1933        /**
1934         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1935         */
1936        public IntegerType getAnswerIntegerType() throws FHIRException { 
1937          if (!(this.answer instanceof IntegerType))
1938            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.answer.getClass().getName()+" was encountered");
1939          return (IntegerType) this.answer;
1940        }
1941
1942        public boolean hasAnswerIntegerType() { 
1943          return this.answer instanceof IntegerType;
1944        }
1945
1946        /**
1947         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1948         */
1949        public DateType getAnswerDateType() throws FHIRException { 
1950          if (!(this.answer instanceof DateType))
1951            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.answer.getClass().getName()+" was encountered");
1952          return (DateType) this.answer;
1953        }
1954
1955        public boolean hasAnswerDateType() { 
1956          return this.answer instanceof DateType;
1957        }
1958
1959        /**
1960         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1961         */
1962        public DateTimeType getAnswerDateTimeType() throws FHIRException { 
1963          if (!(this.answer instanceof DateTimeType))
1964            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
1965          return (DateTimeType) this.answer;
1966        }
1967
1968        public boolean hasAnswerDateTimeType() { 
1969          return this.answer instanceof DateTimeType;
1970        }
1971
1972        /**
1973         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1974         */
1975        public TimeType getAnswerTimeType() throws FHIRException { 
1976          if (!(this.answer instanceof TimeType))
1977            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
1978          return (TimeType) this.answer;
1979        }
1980
1981        public boolean hasAnswerTimeType() { 
1982          return this.answer instanceof TimeType;
1983        }
1984
1985        /**
1986         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
1987         */
1988        public StringType getAnswerStringType() throws FHIRException { 
1989          if (!(this.answer instanceof StringType))
1990            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.answer.getClass().getName()+" was encountered");
1991          return (StringType) this.answer;
1992        }
1993
1994        public boolean hasAnswerStringType() { 
1995          return this.answer instanceof StringType;
1996        }
1997
1998        /**
1999         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2000         */
2001        public UriType getAnswerUriType() throws FHIRException { 
2002          if (!(this.answer instanceof UriType))
2003            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.answer.getClass().getName()+" was encountered");
2004          return (UriType) this.answer;
2005        }
2006
2007        public boolean hasAnswerUriType() { 
2008          return this.answer instanceof UriType;
2009        }
2010
2011        /**
2012         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2013         */
2014        public Attachment getAnswerAttachment() throws FHIRException { 
2015          if (!(this.answer instanceof Attachment))
2016            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.answer.getClass().getName()+" was encountered");
2017          return (Attachment) this.answer;
2018        }
2019
2020        public boolean hasAnswerAttachment() { 
2021          return this.answer instanceof Attachment;
2022        }
2023
2024        /**
2025         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2026         */
2027        public Coding getAnswerCoding() throws FHIRException { 
2028          if (!(this.answer instanceof Coding))
2029            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.answer.getClass().getName()+" was encountered");
2030          return (Coding) this.answer;
2031        }
2032
2033        public boolean hasAnswerCoding() { 
2034          return this.answer instanceof Coding;
2035        }
2036
2037        /**
2038         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2039         */
2040        public Quantity getAnswerQuantity() throws FHIRException { 
2041          if (!(this.answer instanceof Quantity))
2042            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.answer.getClass().getName()+" was encountered");
2043          return (Quantity) this.answer;
2044        }
2045
2046        public boolean hasAnswerQuantity() { 
2047          return this.answer instanceof Quantity;
2048        }
2049
2050        /**
2051         * @return {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2052         */
2053        public Reference getAnswerReference() throws FHIRException { 
2054          if (!(this.answer instanceof Reference))
2055            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.answer.getClass().getName()+" was encountered");
2056          return (Reference) this.answer;
2057        }
2058
2059        public boolean hasAnswerReference() { 
2060          return this.answer instanceof Reference;
2061        }
2062
2063        public boolean hasAnswer() { 
2064          return this.answer != null && !this.answer.isEmpty();
2065        }
2066
2067        /**
2068         * @param value {@link #answer} (An answer that the referenced question must match in order for the item to be enabled.)
2069         */
2070        public QuestionnaireItemEnableWhenComponent setAnswer(Type value) { 
2071          this.answer = value;
2072          return this;
2073        }
2074
2075        protected void listChildren(List<Property> childrenList) {
2076          super.listChildren(childrenList);
2077          childrenList.add(new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, java.lang.Integer.MAX_VALUE, question));
2078          childrenList.add(new Property("hasAnswer", "boolean", "An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).", 0, java.lang.Integer.MAX_VALUE, hasAnswer));
2079          childrenList.add(new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "An answer that the referenced question must match in order for the item to be enabled.", 0, java.lang.Integer.MAX_VALUE, answer));
2080        }
2081
2082      @Override
2083      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2084        switch (hash) {
2085        case -1165870106: /*question*/ return this.question == null ? new Base[0] : new Base[] {this.question}; // StringType
2086        case -793058568: /*hasAnswer*/ return this.hasAnswer == null ? new Base[0] : new Base[] {this.hasAnswer}; // BooleanType
2087        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : new Base[] {this.answer}; // Type
2088        default: return super.getProperty(hash, name, checkValid);
2089        }
2090
2091      }
2092
2093      @Override
2094      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2095        switch (hash) {
2096        case -1165870106: // question
2097          this.question = castToString(value); // StringType
2098          return value;
2099        case -793058568: // hasAnswer
2100          this.hasAnswer = castToBoolean(value); // BooleanType
2101          return value;
2102        case -1412808770: // answer
2103          this.answer = castToType(value); // Type
2104          return value;
2105        default: return super.setProperty(hash, name, value);
2106        }
2107
2108      }
2109
2110      @Override
2111      public Base setProperty(String name, Base value) throws FHIRException {
2112        if (name.equals("question")) {
2113          this.question = castToString(value); // StringType
2114        } else if (name.equals("hasAnswer")) {
2115          this.hasAnswer = castToBoolean(value); // BooleanType
2116        } else if (name.equals("answer[x]")) {
2117          this.answer = castToType(value); // Type
2118        } else
2119          return super.setProperty(name, value);
2120        return value;
2121      }
2122
2123      @Override
2124      public Base makeProperty(int hash, String name) throws FHIRException {
2125        switch (hash) {
2126        case -1165870106:  return getQuestionElement();
2127        case -793058568:  return getHasAnswerElement();
2128        case 1693524994:  return getAnswer(); 
2129        case -1412808770:  return getAnswer(); 
2130        default: return super.makeProperty(hash, name);
2131        }
2132
2133      }
2134
2135      @Override
2136      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2137        switch (hash) {
2138        case -1165870106: /*question*/ return new String[] {"string"};
2139        case -793058568: /*hasAnswer*/ return new String[] {"boolean"};
2140        case -1412808770: /*answer*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
2141        default: return super.getTypesForProperty(hash, name);
2142        }
2143
2144      }
2145
2146      @Override
2147      public Base addChild(String name) throws FHIRException {
2148        if (name.equals("question")) {
2149          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.question");
2150        }
2151        else if (name.equals("hasAnswer")) {
2152          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.hasAnswer");
2153        }
2154        else if (name.equals("answerBoolean")) {
2155          this.answer = new BooleanType();
2156          return this.answer;
2157        }
2158        else if (name.equals("answerDecimal")) {
2159          this.answer = new DecimalType();
2160          return this.answer;
2161        }
2162        else if (name.equals("answerInteger")) {
2163          this.answer = new IntegerType();
2164          return this.answer;
2165        }
2166        else if (name.equals("answerDate")) {
2167          this.answer = new DateType();
2168          return this.answer;
2169        }
2170        else if (name.equals("answerDateTime")) {
2171          this.answer = new DateTimeType();
2172          return this.answer;
2173        }
2174        else if (name.equals("answerTime")) {
2175          this.answer = new TimeType();
2176          return this.answer;
2177        }
2178        else if (name.equals("answerString")) {
2179          this.answer = new StringType();
2180          return this.answer;
2181        }
2182        else if (name.equals("answerUri")) {
2183          this.answer = new UriType();
2184          return this.answer;
2185        }
2186        else if (name.equals("answerAttachment")) {
2187          this.answer = new Attachment();
2188          return this.answer;
2189        }
2190        else if (name.equals("answerCoding")) {
2191          this.answer = new Coding();
2192          return this.answer;
2193        }
2194        else if (name.equals("answerQuantity")) {
2195          this.answer = new Quantity();
2196          return this.answer;
2197        }
2198        else if (name.equals("answerReference")) {
2199          this.answer = new Reference();
2200          return this.answer;
2201        }
2202        else
2203          return super.addChild(name);
2204      }
2205
2206      public QuestionnaireItemEnableWhenComponent copy() {
2207        QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
2208        copyValues(dst);
2209        dst.question = question == null ? null : question.copy();
2210        dst.hasAnswer = hasAnswer == null ? null : hasAnswer.copy();
2211        dst.answer = answer == null ? null : answer.copy();
2212        return dst;
2213      }
2214
2215      @Override
2216      public boolean equalsDeep(Base other) {
2217        if (!super.equalsDeep(other))
2218          return false;
2219        if (!(other instanceof QuestionnaireItemEnableWhenComponent))
2220          return false;
2221        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other;
2222        return compareDeep(question, o.question, true) && compareDeep(hasAnswer, o.hasAnswer, true) && compareDeep(answer, o.answer, true)
2223          ;
2224      }
2225
2226      @Override
2227      public boolean equalsShallow(Base other) {
2228        if (!super.equalsShallow(other))
2229          return false;
2230        if (!(other instanceof QuestionnaireItemEnableWhenComponent))
2231          return false;
2232        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other;
2233        return compareValues(question, o.question, true) && compareValues(hasAnswer, o.hasAnswer, true);
2234      }
2235
2236      public boolean isEmpty() {
2237        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, hasAnswer, answer
2238          );
2239      }
2240
2241  public String fhirType() {
2242    return "Questionnaire.item.enableWhen";
2243
2244  }
2245
2246  }
2247
2248    @Block()
2249    public static class QuestionnaireItemOptionComponent extends BackboneElement implements IBaseBackboneElement {
2250        /**
2251         * A potential answer that's allowed as the answer to this question.
2252         */
2253        @Child(name = "value", type = {IntegerType.class, DateType.class, TimeType.class, StringType.class, Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
2254        @Description(shortDefinition="Answer value", formalDefinition="A potential answer that's allowed as the answer to this question." )
2255        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2256        protected Type value;
2257
2258        private static final long serialVersionUID = -732981989L;
2259
2260    /**
2261     * Constructor
2262     */
2263      public QuestionnaireItemOptionComponent() {
2264        super();
2265      }
2266
2267    /**
2268     * Constructor
2269     */
2270      public QuestionnaireItemOptionComponent(Type value) {
2271        super();
2272        this.value = value;
2273      }
2274
2275        /**
2276         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2277         */
2278        public Type getValue() { 
2279          return this.value;
2280        }
2281
2282        /**
2283         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2284         */
2285        public IntegerType getValueIntegerType() throws FHIRException { 
2286          if (!(this.value instanceof IntegerType))
2287            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2288          return (IntegerType) this.value;
2289        }
2290
2291        public boolean hasValueIntegerType() { 
2292          return this.value instanceof IntegerType;
2293        }
2294
2295        /**
2296         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2297         */
2298        public DateType getValueDateType() throws FHIRException { 
2299          if (!(this.value instanceof DateType))
2300            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2301          return (DateType) this.value;
2302        }
2303
2304        public boolean hasValueDateType() { 
2305          return this.value instanceof DateType;
2306        }
2307
2308        /**
2309         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2310         */
2311        public TimeType getValueTimeType() throws FHIRException { 
2312          if (!(this.value instanceof TimeType))
2313            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2314          return (TimeType) this.value;
2315        }
2316
2317        public boolean hasValueTimeType() { 
2318          return this.value instanceof TimeType;
2319        }
2320
2321        /**
2322         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2323         */
2324        public StringType getValueStringType() throws FHIRException { 
2325          if (!(this.value instanceof StringType))
2326            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2327          return (StringType) this.value;
2328        }
2329
2330        public boolean hasValueStringType() { 
2331          return this.value instanceof StringType;
2332        }
2333
2334        /**
2335         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2336         */
2337        public Coding getValueCoding() throws FHIRException { 
2338          if (!(this.value instanceof Coding))
2339            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2340          return (Coding) this.value;
2341        }
2342
2343        public boolean hasValueCoding() { 
2344          return this.value instanceof Coding;
2345        }
2346
2347        public boolean hasValue() { 
2348          return this.value != null && !this.value.isEmpty();
2349        }
2350
2351        /**
2352         * @param value {@link #value} (A potential answer that's allowed as the answer to this question.)
2353         */
2354        public QuestionnaireItemOptionComponent setValue(Type value) { 
2355          this.value = value;
2356          return this;
2357        }
2358
2359        protected void listChildren(List<Property> childrenList) {
2360          super.listChildren(childrenList);
2361          childrenList.add(new Property("value[x]", "integer|date|time|string|Coding", "A potential answer that's allowed as the answer to this question.", 0, java.lang.Integer.MAX_VALUE, value));
2362        }
2363
2364      @Override
2365      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2366        switch (hash) {
2367        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2368        default: return super.getProperty(hash, name, checkValid);
2369        }
2370
2371      }
2372
2373      @Override
2374      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2375        switch (hash) {
2376        case 111972721: // value
2377          this.value = castToType(value); // Type
2378          return value;
2379        default: return super.setProperty(hash, name, value);
2380        }
2381
2382      }
2383
2384      @Override
2385      public Base setProperty(String name, Base value) throws FHIRException {
2386        if (name.equals("value[x]")) {
2387          this.value = 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 -1410166417:  return getValue(); 
2397        case 111972721:  return getValue(); 
2398        default: return super.makeProperty(hash, name);
2399        }
2400
2401      }
2402
2403      @Override
2404      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2405        switch (hash) {
2406        case 111972721: /*value*/ return new String[] {"integer", "date", "time", "string", "Coding"};
2407        default: return super.getTypesForProperty(hash, name);
2408        }
2409
2410      }
2411
2412      @Override
2413      public Base addChild(String name) throws FHIRException {
2414        if (name.equals("valueInteger")) {
2415          this.value = new IntegerType();
2416          return this.value;
2417        }
2418        else if (name.equals("valueDate")) {
2419          this.value = new DateType();
2420          return this.value;
2421        }
2422        else if (name.equals("valueTime")) {
2423          this.value = new TimeType();
2424          return this.value;
2425        }
2426        else if (name.equals("valueString")) {
2427          this.value = new StringType();
2428          return this.value;
2429        }
2430        else if (name.equals("valueCoding")) {
2431          this.value = new Coding();
2432          return this.value;
2433        }
2434        else
2435          return super.addChild(name);
2436      }
2437
2438      public QuestionnaireItemOptionComponent copy() {
2439        QuestionnaireItemOptionComponent dst = new QuestionnaireItemOptionComponent();
2440        copyValues(dst);
2441        dst.value = value == null ? null : value.copy();
2442        return dst;
2443      }
2444
2445      @Override
2446      public boolean equalsDeep(Base other) {
2447        if (!super.equalsDeep(other))
2448          return false;
2449        if (!(other instanceof QuestionnaireItemOptionComponent))
2450          return false;
2451        QuestionnaireItemOptionComponent o = (QuestionnaireItemOptionComponent) other;
2452        return compareDeep(value, o.value, true);
2453      }
2454
2455      @Override
2456      public boolean equalsShallow(Base other) {
2457        if (!super.equalsShallow(other))
2458          return false;
2459        if (!(other instanceof QuestionnaireItemOptionComponent))
2460          return false;
2461        QuestionnaireItemOptionComponent o = (QuestionnaireItemOptionComponent) other;
2462        return true;
2463      }
2464
2465      public boolean isEmpty() {
2466        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
2467      }
2468
2469  public String fhirType() {
2470    return "Questionnaire.item.option";
2471
2472  }
2473
2474  }
2475
2476    /**
2477     * 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.
2478     */
2479    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2480    @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." )
2481    protected List<Identifier> identifier;
2482
2483    /**
2484     * Explaination of why this questionnaire is needed and why it has been designed as it has.
2485     */
2486    @Child(name = "purpose", type = {MarkdownType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2487    @Description(shortDefinition="Why this questionnaire is defined", formalDefinition="Explaination of why this questionnaire is needed and why it has been designed as it has." )
2488    protected MarkdownType purpose;
2489
2490    /**
2491     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
2492     */
2493    @Child(name = "approvalDate", type = {DateType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2494    @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." )
2495    protected DateType approvalDate;
2496
2497    /**
2498     * The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.
2499     */
2500    @Child(name = "lastReviewDate", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2501    @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 doesn't change the original approval date." )
2502    protected DateType lastReviewDate;
2503
2504    /**
2505     * The period during which the questionnaire content was or is planned to be in active use.
2506     */
2507    @Child(name = "effectivePeriod", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
2508    @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." )
2509    protected Period effectivePeriod;
2510
2511    /**
2512     * 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.
2513     */
2514    @Child(name = "copyright", type = {MarkdownType.class}, order=5, min=0, max=1, modifier=false, summary=false)
2515    @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." )
2516    protected MarkdownType copyright;
2517
2518    /**
2519     * An identifier for this question or group of questions in a particular terminology such as LOINC.
2520     */
2521    @Child(name = "code", type = {Coding.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2522    @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." )
2523    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
2524    protected List<Coding> code;
2525
2526    /**
2527     * The types of subjects that can be the subject of responses created for the questionnaire.
2528     */
2529    @Child(name = "subjectType", type = {CodeType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2530    @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." )
2531    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
2532    protected List<CodeType> subjectType;
2533
2534    /**
2535     * A particular question, question grouping or display text that is part of the questionnaire.
2536     */
2537    @Child(name = "item", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2538    @Description(shortDefinition="Questions and sections within the Questionnaire", formalDefinition="A particular question, question grouping or display text that is part of the questionnaire." )
2539    protected List<QuestionnaireItemComponent> item;
2540
2541    private static final long serialVersionUID = -1846925043L;
2542
2543  /**
2544   * Constructor
2545   */
2546    public Questionnaire() {
2547      super();
2548    }
2549
2550  /**
2551   * Constructor
2552   */
2553    public Questionnaire(Enumeration<PublicationStatus> status) {
2554      super();
2555      this.status = status;
2556    }
2557
2558    /**
2559     * @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. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2560     */
2561    public UriType getUrlElement() { 
2562      if (this.url == null)
2563        if (Configuration.errorOnAutoCreate())
2564          throw new Error("Attempt to auto-create Questionnaire.url");
2565        else if (Configuration.doAutoCreate())
2566          this.url = new UriType(); // bb
2567      return this.url;
2568    }
2569
2570    public boolean hasUrlElement() { 
2571      return this.url != null && !this.url.isEmpty();
2572    }
2573
2574    public boolean hasUrl() { 
2575      return this.url != null && !this.url.isEmpty();
2576    }
2577
2578    /**
2579     * @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. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2580     */
2581    public Questionnaire setUrlElement(UriType value) { 
2582      this.url = value;
2583      return this;
2584    }
2585
2586    /**
2587     * @return An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).
2588     */
2589    public String getUrl() { 
2590      return this.url == null ? null : this.url.getValue();
2591    }
2592
2593    /**
2594     * @param value An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).
2595     */
2596    public Questionnaire setUrl(String value) { 
2597      if (Utilities.noString(value))
2598        this.url = null;
2599      else {
2600        if (this.url == null)
2601          this.url = new UriType();
2602        this.url.setValue(value);
2603      }
2604      return this;
2605    }
2606
2607    /**
2608     * @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.)
2609     */
2610    public List<Identifier> getIdentifier() { 
2611      if (this.identifier == null)
2612        this.identifier = new ArrayList<Identifier>();
2613      return this.identifier;
2614    }
2615
2616    /**
2617     * @return Returns a reference to <code>this</code> for easy method chaining
2618     */
2619    public Questionnaire setIdentifier(List<Identifier> theIdentifier) { 
2620      this.identifier = theIdentifier;
2621      return this;
2622    }
2623
2624    public boolean hasIdentifier() { 
2625      if (this.identifier == null)
2626        return false;
2627      for (Identifier item : this.identifier)
2628        if (!item.isEmpty())
2629          return true;
2630      return false;
2631    }
2632
2633    public Identifier addIdentifier() { //3
2634      Identifier t = new Identifier();
2635      if (this.identifier == null)
2636        this.identifier = new ArrayList<Identifier>();
2637      this.identifier.add(t);
2638      return t;
2639    }
2640
2641    public Questionnaire addIdentifier(Identifier t) { //3
2642      if (t == null)
2643        return this;
2644      if (this.identifier == null)
2645        this.identifier = new ArrayList<Identifier>();
2646      this.identifier.add(t);
2647      return this;
2648    }
2649
2650    /**
2651     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2652     */
2653    public Identifier getIdentifierFirstRep() { 
2654      if (getIdentifier().isEmpty()) {
2655        addIdentifier();
2656      }
2657      return getIdentifier().get(0);
2658    }
2659
2660    /**
2661     * @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
2662     */
2663    public StringType getVersionElement() { 
2664      if (this.version == null)
2665        if (Configuration.errorOnAutoCreate())
2666          throw new Error("Attempt to auto-create Questionnaire.version");
2667        else if (Configuration.doAutoCreate())
2668          this.version = new StringType(); // bb
2669      return this.version;
2670    }
2671
2672    public boolean hasVersionElement() { 
2673      return this.version != null && !this.version.isEmpty();
2674    }
2675
2676    public boolean hasVersion() { 
2677      return this.version != null && !this.version.isEmpty();
2678    }
2679
2680    /**
2681     * @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
2682     */
2683    public Questionnaire setVersionElement(StringType value) { 
2684      this.version = value;
2685      return this;
2686    }
2687
2688    /**
2689     * @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.
2690     */
2691    public String getVersion() { 
2692      return this.version == null ? null : this.version.getValue();
2693    }
2694
2695    /**
2696     * @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.
2697     */
2698    public Questionnaire setVersion(String value) { 
2699      if (Utilities.noString(value))
2700        this.version = null;
2701      else {
2702        if (this.version == null)
2703          this.version = new StringType();
2704        this.version.setValue(value);
2705      }
2706      return this;
2707    }
2708
2709    /**
2710     * @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
2711     */
2712    public StringType getNameElement() { 
2713      if (this.name == null)
2714        if (Configuration.errorOnAutoCreate())
2715          throw new Error("Attempt to auto-create Questionnaire.name");
2716        else if (Configuration.doAutoCreate())
2717          this.name = new StringType(); // bb
2718      return this.name;
2719    }
2720
2721    public boolean hasNameElement() { 
2722      return this.name != null && !this.name.isEmpty();
2723    }
2724
2725    public boolean hasName() { 
2726      return this.name != null && !this.name.isEmpty();
2727    }
2728
2729    /**
2730     * @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
2731     */
2732    public Questionnaire setNameElement(StringType value) { 
2733      this.name = value;
2734      return this;
2735    }
2736
2737    /**
2738     * @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.
2739     */
2740    public String getName() { 
2741      return this.name == null ? null : this.name.getValue();
2742    }
2743
2744    /**
2745     * @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.
2746     */
2747    public Questionnaire setName(String value) { 
2748      if (Utilities.noString(value))
2749        this.name = null;
2750      else {
2751        if (this.name == null)
2752          this.name = new StringType();
2753        this.name.setValue(value);
2754      }
2755      return this;
2756    }
2757
2758    /**
2759     * @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
2760     */
2761    public StringType getTitleElement() { 
2762      if (this.title == null)
2763        if (Configuration.errorOnAutoCreate())
2764          throw new Error("Attempt to auto-create Questionnaire.title");
2765        else if (Configuration.doAutoCreate())
2766          this.title = new StringType(); // bb
2767      return this.title;
2768    }
2769
2770    public boolean hasTitleElement() { 
2771      return this.title != null && !this.title.isEmpty();
2772    }
2773
2774    public boolean hasTitle() { 
2775      return this.title != null && !this.title.isEmpty();
2776    }
2777
2778    /**
2779     * @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
2780     */
2781    public Questionnaire setTitleElement(StringType value) { 
2782      this.title = value;
2783      return this;
2784    }
2785
2786    /**
2787     * @return A short, descriptive, user-friendly title for the questionnaire.
2788     */
2789    public String getTitle() { 
2790      return this.title == null ? null : this.title.getValue();
2791    }
2792
2793    /**
2794     * @param value A short, descriptive, user-friendly title for the questionnaire.
2795     */
2796    public Questionnaire setTitle(String value) { 
2797      if (Utilities.noString(value))
2798        this.title = null;
2799      else {
2800        if (this.title == null)
2801          this.title = new StringType();
2802        this.title.setValue(value);
2803      }
2804      return this;
2805    }
2806
2807    /**
2808     * @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
2809     */
2810    public Enumeration<PublicationStatus> getStatusElement() { 
2811      if (this.status == null)
2812        if (Configuration.errorOnAutoCreate())
2813          throw new Error("Attempt to auto-create Questionnaire.status");
2814        else if (Configuration.doAutoCreate())
2815          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2816      return this.status;
2817    }
2818
2819    public boolean hasStatusElement() { 
2820      return this.status != null && !this.status.isEmpty();
2821    }
2822
2823    public boolean hasStatus() { 
2824      return this.status != null && !this.status.isEmpty();
2825    }
2826
2827    /**
2828     * @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
2829     */
2830    public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) { 
2831      this.status = value;
2832      return this;
2833    }
2834
2835    /**
2836     * @return The status of this questionnaire. Enables tracking the life-cycle of the content.
2837     */
2838    public PublicationStatus getStatus() { 
2839      return this.status == null ? null : this.status.getValue();
2840    }
2841
2842    /**
2843     * @param value The status of this questionnaire. Enables tracking the life-cycle of the content.
2844     */
2845    public Questionnaire setStatus(PublicationStatus value) { 
2846        if (this.status == null)
2847          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2848        this.status.setValue(value);
2849      return this;
2850    }
2851
2852    /**
2853     * @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
2854     */
2855    public BooleanType getExperimentalElement() { 
2856      if (this.experimental == null)
2857        if (Configuration.errorOnAutoCreate())
2858          throw new Error("Attempt to auto-create Questionnaire.experimental");
2859        else if (Configuration.doAutoCreate())
2860          this.experimental = new BooleanType(); // bb
2861      return this.experimental;
2862    }
2863
2864    public boolean hasExperimentalElement() { 
2865      return this.experimental != null && !this.experimental.isEmpty();
2866    }
2867
2868    public boolean hasExperimental() { 
2869      return this.experimental != null && !this.experimental.isEmpty();
2870    }
2871
2872    /**
2873     * @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
2874     */
2875    public Questionnaire setExperimentalElement(BooleanType value) { 
2876      this.experimental = value;
2877      return this;
2878    }
2879
2880    /**
2881     * @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.
2882     */
2883    public boolean getExperimental() { 
2884      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2885    }
2886
2887    /**
2888     * @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.
2889     */
2890    public Questionnaire setExperimental(boolean value) { 
2891        if (this.experimental == null)
2892          this.experimental = new BooleanType();
2893        this.experimental.setValue(value);
2894      return this;
2895    }
2896
2897    /**
2898     * @return {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change if and 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
2899     */
2900    public DateTimeType getDateElement() { 
2901      if (this.date == null)
2902        if (Configuration.errorOnAutoCreate())
2903          throw new Error("Attempt to auto-create Questionnaire.date");
2904        else if (Configuration.doAutoCreate())
2905          this.date = new DateTimeType(); // bb
2906      return this.date;
2907    }
2908
2909    public boolean hasDateElement() { 
2910      return this.date != null && !this.date.isEmpty();
2911    }
2912
2913    public boolean hasDate() { 
2914      return this.date != null && !this.date.isEmpty();
2915    }
2916
2917    /**
2918     * @param value {@link #date} (The date  (and optionally time) when the questionnaire was published. The date must change if and 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
2919     */
2920    public Questionnaire setDateElement(DateTimeType value) { 
2921      this.date = value;
2922      return this;
2923    }
2924
2925    /**
2926     * @return The date  (and optionally time) when the questionnaire was published. The date must change if and 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.
2927     */
2928    public Date getDate() { 
2929      return this.date == null ? null : this.date.getValue();
2930    }
2931
2932    /**
2933     * @param value The date  (and optionally time) when the questionnaire was published. The date must change if and 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.
2934     */
2935    public Questionnaire setDate(Date value) { 
2936      if (value == null)
2937        this.date = null;
2938      else {
2939        if (this.date == null)
2940          this.date = new DateTimeType();
2941        this.date.setValue(value);
2942      }
2943      return this;
2944    }
2945
2946    /**
2947     * @return {@link #publisher} (The name of the individual or organization that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
2948     */
2949    public StringType getPublisherElement() { 
2950      if (this.publisher == null)
2951        if (Configuration.errorOnAutoCreate())
2952          throw new Error("Attempt to auto-create Questionnaire.publisher");
2953        else if (Configuration.doAutoCreate())
2954          this.publisher = new StringType(); // bb
2955      return this.publisher;
2956    }
2957
2958    public boolean hasPublisherElement() { 
2959      return this.publisher != null && !this.publisher.isEmpty();
2960    }
2961
2962    public boolean hasPublisher() { 
2963      return this.publisher != null && !this.publisher.isEmpty();
2964    }
2965
2966    /**
2967     * @param value {@link #publisher} (The name of the individual or organization that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
2968     */
2969    public Questionnaire setPublisherElement(StringType value) { 
2970      this.publisher = value;
2971      return this;
2972    }
2973
2974    /**
2975     * @return The name of the individual or organization that published the questionnaire.
2976     */
2977    public String getPublisher() { 
2978      return this.publisher == null ? null : this.publisher.getValue();
2979    }
2980
2981    /**
2982     * @param value The name of the individual or organization that published the questionnaire.
2983     */
2984    public Questionnaire setPublisher(String value) { 
2985      if (Utilities.noString(value))
2986        this.publisher = null;
2987      else {
2988        if (this.publisher == null)
2989          this.publisher = new StringType();
2990        this.publisher.setValue(value);
2991      }
2992      return this;
2993    }
2994
2995    /**
2996     * @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
2997     */
2998    public MarkdownType getDescriptionElement() { 
2999      if (this.description == null)
3000        if (Configuration.errorOnAutoCreate())
3001          throw new Error("Attempt to auto-create Questionnaire.description");
3002        else if (Configuration.doAutoCreate())
3003          this.description = new MarkdownType(); // bb
3004      return this.description;
3005    }
3006
3007    public boolean hasDescriptionElement() { 
3008      return this.description != null && !this.description.isEmpty();
3009    }
3010
3011    public boolean hasDescription() { 
3012      return this.description != null && !this.description.isEmpty();
3013    }
3014
3015    /**
3016     * @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
3017     */
3018    public Questionnaire setDescriptionElement(MarkdownType value) { 
3019      this.description = value;
3020      return this;
3021    }
3022
3023    /**
3024     * @return A free text natural language description of the questionnaire from a consumer's perspective.
3025     */
3026    public String getDescription() { 
3027      return this.description == null ? null : this.description.getValue();
3028    }
3029
3030    /**
3031     * @param value A free text natural language description of the questionnaire from a consumer's perspective.
3032     */
3033    public Questionnaire setDescription(String value) { 
3034      if (value == null)
3035        this.description = null;
3036      else {
3037        if (this.description == null)
3038          this.description = new MarkdownType();
3039        this.description.setValue(value);
3040      }
3041      return this;
3042    }
3043
3044    /**
3045     * @return {@link #purpose} (Explaination 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
3046     */
3047    public MarkdownType getPurposeElement() { 
3048      if (this.purpose == null)
3049        if (Configuration.errorOnAutoCreate())
3050          throw new Error("Attempt to auto-create Questionnaire.purpose");
3051        else if (Configuration.doAutoCreate())
3052          this.purpose = new MarkdownType(); // bb
3053      return this.purpose;
3054    }
3055
3056    public boolean hasPurposeElement() { 
3057      return this.purpose != null && !this.purpose.isEmpty();
3058    }
3059
3060    public boolean hasPurpose() { 
3061      return this.purpose != null && !this.purpose.isEmpty();
3062    }
3063
3064    /**
3065     * @param value {@link #purpose} (Explaination 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
3066     */
3067    public Questionnaire setPurposeElement(MarkdownType value) { 
3068      this.purpose = value;
3069      return this;
3070    }
3071
3072    /**
3073     * @return Explaination of why this questionnaire is needed and why it has been designed as it has.
3074     */
3075    public String getPurpose() { 
3076      return this.purpose == null ? null : this.purpose.getValue();
3077    }
3078
3079    /**
3080     * @param value Explaination of why this questionnaire is needed and why it has been designed as it has.
3081     */
3082    public Questionnaire setPurpose(String value) { 
3083      if (value == null)
3084        this.purpose = null;
3085      else {
3086        if (this.purpose == null)
3087          this.purpose = new MarkdownType();
3088        this.purpose.setValue(value);
3089      }
3090      return this;
3091    }
3092
3093    /**
3094     * @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
3095     */
3096    public DateType getApprovalDateElement() { 
3097      if (this.approvalDate == null)
3098        if (Configuration.errorOnAutoCreate())
3099          throw new Error("Attempt to auto-create Questionnaire.approvalDate");
3100        else if (Configuration.doAutoCreate())
3101          this.approvalDate = new DateType(); // bb
3102      return this.approvalDate;
3103    }
3104
3105    public boolean hasApprovalDateElement() { 
3106      return this.approvalDate != null && !this.approvalDate.isEmpty();
3107    }
3108
3109    public boolean hasApprovalDate() { 
3110      return this.approvalDate != null && !this.approvalDate.isEmpty();
3111    }
3112
3113    /**
3114     * @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
3115     */
3116    public Questionnaire setApprovalDateElement(DateType value) { 
3117      this.approvalDate = value;
3118      return this;
3119    }
3120
3121    /**
3122     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3123     */
3124    public Date getApprovalDate() { 
3125      return this.approvalDate == null ? null : this.approvalDate.getValue();
3126    }
3127
3128    /**
3129     * @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.
3130     */
3131    public Questionnaire setApprovalDate(Date value) { 
3132      if (value == null)
3133        this.approvalDate = null;
3134      else {
3135        if (this.approvalDate == null)
3136          this.approvalDate = new DateType();
3137        this.approvalDate.setValue(value);
3138      }
3139      return this;
3140    }
3141
3142    /**
3143     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3144     */
3145    public DateType getLastReviewDateElement() { 
3146      if (this.lastReviewDate == null)
3147        if (Configuration.errorOnAutoCreate())
3148          throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
3149        else if (Configuration.doAutoCreate())
3150          this.lastReviewDate = new DateType(); // bb
3151      return this.lastReviewDate;
3152    }
3153
3154    public boolean hasLastReviewDateElement() { 
3155      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3156    }
3157
3158    public boolean hasLastReviewDate() { 
3159      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3160    }
3161
3162    /**
3163     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3164     */
3165    public Questionnaire setLastReviewDateElement(DateType value) { 
3166      this.lastReviewDate = value;
3167      return this;
3168    }
3169
3170    /**
3171     * @return The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.
3172     */
3173    public Date getLastReviewDate() { 
3174      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
3175    }
3176
3177    /**
3178     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.
3179     */
3180    public Questionnaire setLastReviewDate(Date value) { 
3181      if (value == null)
3182        this.lastReviewDate = null;
3183      else {
3184        if (this.lastReviewDate == null)
3185          this.lastReviewDate = new DateType();
3186        this.lastReviewDate.setValue(value);
3187      }
3188      return this;
3189    }
3190
3191    /**
3192     * @return {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
3193     */
3194    public Period getEffectivePeriod() { 
3195      if (this.effectivePeriod == null)
3196        if (Configuration.errorOnAutoCreate())
3197          throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
3198        else if (Configuration.doAutoCreate())
3199          this.effectivePeriod = new Period(); // cc
3200      return this.effectivePeriod;
3201    }
3202
3203    public boolean hasEffectivePeriod() { 
3204      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
3205    }
3206
3207    /**
3208     * @param value {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
3209     */
3210    public Questionnaire setEffectivePeriod(Period value) { 
3211      this.effectivePeriod = value;
3212      return this;
3213    }
3214
3215    /**
3216     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate questionnaire instances.)
3217     */
3218    public List<UsageContext> getUseContext() { 
3219      if (this.useContext == null)
3220        this.useContext = new ArrayList<UsageContext>();
3221      return this.useContext;
3222    }
3223
3224    /**
3225     * @return Returns a reference to <code>this</code> for easy method chaining
3226     */
3227    public Questionnaire setUseContext(List<UsageContext> theUseContext) { 
3228      this.useContext = theUseContext;
3229      return this;
3230    }
3231
3232    public boolean hasUseContext() { 
3233      if (this.useContext == null)
3234        return false;
3235      for (UsageContext item : this.useContext)
3236        if (!item.isEmpty())
3237          return true;
3238      return false;
3239    }
3240
3241    public UsageContext addUseContext() { //3
3242      UsageContext t = new UsageContext();
3243      if (this.useContext == null)
3244        this.useContext = new ArrayList<UsageContext>();
3245      this.useContext.add(t);
3246      return t;
3247    }
3248
3249    public Questionnaire addUseContext(UsageContext t) { //3
3250      if (t == null)
3251        return this;
3252      if (this.useContext == null)
3253        this.useContext = new ArrayList<UsageContext>();
3254      this.useContext.add(t);
3255      return this;
3256    }
3257
3258    /**
3259     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
3260     */
3261    public UsageContext getUseContextFirstRep() { 
3262      if (getUseContext().isEmpty()) {
3263        addUseContext();
3264      }
3265      return getUseContext().get(0);
3266    }
3267
3268    /**
3269     * @return {@link #jurisdiction} (A legal or geographic region in which the questionnaire is intended to be used.)
3270     */
3271    public List<CodeableConcept> getJurisdiction() { 
3272      if (this.jurisdiction == null)
3273        this.jurisdiction = new ArrayList<CodeableConcept>();
3274      return this.jurisdiction;
3275    }
3276
3277    /**
3278     * @return Returns a reference to <code>this</code> for easy method chaining
3279     */
3280    public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) { 
3281      this.jurisdiction = theJurisdiction;
3282      return this;
3283    }
3284
3285    public boolean hasJurisdiction() { 
3286      if (this.jurisdiction == null)
3287        return false;
3288      for (CodeableConcept item : this.jurisdiction)
3289        if (!item.isEmpty())
3290          return true;
3291      return false;
3292    }
3293
3294    public CodeableConcept addJurisdiction() { //3
3295      CodeableConcept t = new CodeableConcept();
3296      if (this.jurisdiction == null)
3297        this.jurisdiction = new ArrayList<CodeableConcept>();
3298      this.jurisdiction.add(t);
3299      return t;
3300    }
3301
3302    public Questionnaire addJurisdiction(CodeableConcept t) { //3
3303      if (t == null)
3304        return this;
3305      if (this.jurisdiction == null)
3306        this.jurisdiction = new ArrayList<CodeableConcept>();
3307      this.jurisdiction.add(t);
3308      return this;
3309    }
3310
3311    /**
3312     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
3313     */
3314    public CodeableConcept getJurisdictionFirstRep() { 
3315      if (getJurisdiction().isEmpty()) {
3316        addJurisdiction();
3317      }
3318      return getJurisdiction().get(0);
3319    }
3320
3321    /**
3322     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
3323     */
3324    public List<ContactDetail> getContact() { 
3325      if (this.contact == null)
3326        this.contact = new ArrayList<ContactDetail>();
3327      return this.contact;
3328    }
3329
3330    /**
3331     * @return Returns a reference to <code>this</code> for easy method chaining
3332     */
3333    public Questionnaire setContact(List<ContactDetail> theContact) { 
3334      this.contact = theContact;
3335      return this;
3336    }
3337
3338    public boolean hasContact() { 
3339      if (this.contact == null)
3340        return false;
3341      for (ContactDetail item : this.contact)
3342        if (!item.isEmpty())
3343          return true;
3344      return false;
3345    }
3346
3347    public ContactDetail addContact() { //3
3348      ContactDetail t = new ContactDetail();
3349      if (this.contact == null)
3350        this.contact = new ArrayList<ContactDetail>();
3351      this.contact.add(t);
3352      return t;
3353    }
3354
3355    public Questionnaire addContact(ContactDetail t) { //3
3356      if (t == null)
3357        return this;
3358      if (this.contact == null)
3359        this.contact = new ArrayList<ContactDetail>();
3360      this.contact.add(t);
3361      return this;
3362    }
3363
3364    /**
3365     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3366     */
3367    public ContactDetail getContactFirstRep() { 
3368      if (getContact().isEmpty()) {
3369        addContact();
3370      }
3371      return getContact().get(0);
3372    }
3373
3374    /**
3375     * @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
3376     */
3377    public MarkdownType getCopyrightElement() { 
3378      if (this.copyright == null)
3379        if (Configuration.errorOnAutoCreate())
3380          throw new Error("Attempt to auto-create Questionnaire.copyright");
3381        else if (Configuration.doAutoCreate())
3382          this.copyright = new MarkdownType(); // bb
3383      return this.copyright;
3384    }
3385
3386    public boolean hasCopyrightElement() { 
3387      return this.copyright != null && !this.copyright.isEmpty();
3388    }
3389
3390    public boolean hasCopyright() { 
3391      return this.copyright != null && !this.copyright.isEmpty();
3392    }
3393
3394    /**
3395     * @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
3396     */
3397    public Questionnaire setCopyrightElement(MarkdownType value) { 
3398      this.copyright = value;
3399      return this;
3400    }
3401
3402    /**
3403     * @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.
3404     */
3405    public String getCopyright() { 
3406      return this.copyright == null ? null : this.copyright.getValue();
3407    }
3408
3409    /**
3410     * @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.
3411     */
3412    public Questionnaire setCopyright(String value) { 
3413      if (value == null)
3414        this.copyright = null;
3415      else {
3416        if (this.copyright == null)
3417          this.copyright = new MarkdownType();
3418        this.copyright.setValue(value);
3419      }
3420      return this;
3421    }
3422
3423    /**
3424     * @return {@link #code} (An identifier for this question or group of questions in a particular terminology such as LOINC.)
3425     */
3426    public List<Coding> getCode() { 
3427      if (this.code == null)
3428        this.code = new ArrayList<Coding>();
3429      return this.code;
3430    }
3431
3432    /**
3433     * @return Returns a reference to <code>this</code> for easy method chaining
3434     */
3435    public Questionnaire setCode(List<Coding> theCode) { 
3436      this.code = theCode;
3437      return this;
3438    }
3439
3440    public boolean hasCode() { 
3441      if (this.code == null)
3442        return false;
3443      for (Coding item : this.code)
3444        if (!item.isEmpty())
3445          return true;
3446      return false;
3447    }
3448
3449    public Coding addCode() { //3
3450      Coding t = new Coding();
3451      if (this.code == null)
3452        this.code = new ArrayList<Coding>();
3453      this.code.add(t);
3454      return t;
3455    }
3456
3457    public Questionnaire addCode(Coding t) { //3
3458      if (t == null)
3459        return this;
3460      if (this.code == null)
3461        this.code = new ArrayList<Coding>();
3462      this.code.add(t);
3463      return this;
3464    }
3465
3466    /**
3467     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
3468     */
3469    public Coding getCodeFirstRep() { 
3470      if (getCode().isEmpty()) {
3471        addCode();
3472      }
3473      return getCode().get(0);
3474    }
3475
3476    /**
3477     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3478     */
3479    public List<CodeType> getSubjectType() { 
3480      if (this.subjectType == null)
3481        this.subjectType = new ArrayList<CodeType>();
3482      return this.subjectType;
3483    }
3484
3485    /**
3486     * @return Returns a reference to <code>this</code> for easy method chaining
3487     */
3488    public Questionnaire setSubjectType(List<CodeType> theSubjectType) { 
3489      this.subjectType = theSubjectType;
3490      return this;
3491    }
3492
3493    public boolean hasSubjectType() { 
3494      if (this.subjectType == null)
3495        return false;
3496      for (CodeType item : this.subjectType)
3497        if (!item.isEmpty())
3498          return true;
3499      return false;
3500    }
3501
3502    /**
3503     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3504     */
3505    public CodeType addSubjectTypeElement() {//2 
3506      CodeType t = new CodeType();
3507      if (this.subjectType == null)
3508        this.subjectType = new ArrayList<CodeType>();
3509      this.subjectType.add(t);
3510      return t;
3511    }
3512
3513    /**
3514     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3515     */
3516    public Questionnaire addSubjectType(String value) { //1
3517      CodeType t = new CodeType();
3518      t.setValue(value);
3519      if (this.subjectType == null)
3520        this.subjectType = new ArrayList<CodeType>();
3521      this.subjectType.add(t);
3522      return this;
3523    }
3524
3525    /**
3526     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
3527     */
3528    public boolean hasSubjectType(String value) { 
3529      if (this.subjectType == null)
3530        return false;
3531      for (CodeType v : this.subjectType)
3532        if (v.equals(value)) // code
3533          return true;
3534      return false;
3535    }
3536
3537    /**
3538     * @return {@link #item} (A particular question, question grouping or display text that is part of the questionnaire.)
3539     */
3540    public List<QuestionnaireItemComponent> getItem() { 
3541      if (this.item == null)
3542        this.item = new ArrayList<QuestionnaireItemComponent>();
3543      return this.item;
3544    }
3545
3546    /**
3547     * @return Returns a reference to <code>this</code> for easy method chaining
3548     */
3549    public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) { 
3550      this.item = theItem;
3551      return this;
3552    }
3553
3554    public boolean hasItem() { 
3555      if (this.item == null)
3556        return false;
3557      for (QuestionnaireItemComponent item : this.item)
3558        if (!item.isEmpty())
3559          return true;
3560      return false;
3561    }
3562
3563    public QuestionnaireItemComponent addItem() { //3
3564      QuestionnaireItemComponent t = new QuestionnaireItemComponent();
3565      if (this.item == null)
3566        this.item = new ArrayList<QuestionnaireItemComponent>();
3567      this.item.add(t);
3568      return t;
3569    }
3570
3571    public Questionnaire addItem(QuestionnaireItemComponent t) { //3
3572      if (t == null)
3573        return this;
3574      if (this.item == null)
3575        this.item = new ArrayList<QuestionnaireItemComponent>();
3576      this.item.add(t);
3577      return this;
3578    }
3579
3580    /**
3581     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
3582     */
3583    public QuestionnaireItemComponent getItemFirstRep() { 
3584      if (getItem().isEmpty()) {
3585        addItem();
3586      }
3587      return getItem().get(0);
3588    }
3589
3590      protected void listChildren(List<Property> childrenList) {
3591        super.listChildren(childrenList);
3592        childrenList.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. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).", 0, java.lang.Integer.MAX_VALUE, url));
3593        childrenList.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));
3594        childrenList.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, java.lang.Integer.MAX_VALUE, version));
3595        childrenList.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, java.lang.Integer.MAX_VALUE, name));
3596        childrenList.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, title));
3597        childrenList.add(new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, java.lang.Integer.MAX_VALUE, status));
3598        childrenList.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, java.lang.Integer.MAX_VALUE, experimental));
3599        childrenList.add(new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire was published. The date must change if and 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, java.lang.Integer.MAX_VALUE, date));
3600        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the questionnaire.", 0, java.lang.Integer.MAX_VALUE, publisher));
3601        childrenList.add(new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, java.lang.Integer.MAX_VALUE, description));
3602        childrenList.add(new Property("purpose", "markdown", "Explaination of why this questionnaire is needed and why it has been designed as it has.", 0, java.lang.Integer.MAX_VALUE, purpose));
3603        childrenList.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, java.lang.Integer.MAX_VALUE, approvalDate));
3604        childrenList.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.", 0, java.lang.Integer.MAX_VALUE, lastReviewDate));
3605        childrenList.add(new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, java.lang.Integer.MAX_VALUE, effectivePeriod));
3606        childrenList.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
3607        childrenList.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));
3608        childrenList.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));
3609        childrenList.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, java.lang.Integer.MAX_VALUE, copyright));
3610        childrenList.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));
3611        childrenList.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));
3612        childrenList.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));
3613      }
3614
3615      @Override
3616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3617        switch (hash) {
3618        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3619        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3620        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3621        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
3622        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3623        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
3624        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
3625        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3626        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
3627        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
3628        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
3629        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
3630        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
3631        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
3632        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
3633        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3634        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
3635        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
3636        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
3637        case -603200890: /*subjectType*/ return this.subjectType == null ? new Base[0] : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
3638        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
3639        default: return super.getProperty(hash, name, checkValid);
3640        }
3641
3642      }
3643
3644      @Override
3645      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3646        switch (hash) {
3647        case 116079: // url
3648          this.url = castToUri(value); // UriType
3649          return value;
3650        case -1618432855: // identifier
3651          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3652          return value;
3653        case 351608024: // version
3654          this.version = castToString(value); // StringType
3655          return value;
3656        case 3373707: // name
3657          this.name = castToString(value); // StringType
3658          return value;
3659        case 110371416: // title
3660          this.title = castToString(value); // StringType
3661          return value;
3662        case -892481550: // status
3663          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3664          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3665          return value;
3666        case -404562712: // experimental
3667          this.experimental = castToBoolean(value); // BooleanType
3668          return value;
3669        case 3076014: // date
3670          this.date = castToDateTime(value); // DateTimeType
3671          return value;
3672        case 1447404028: // publisher
3673          this.publisher = castToString(value); // StringType
3674          return value;
3675        case -1724546052: // description
3676          this.description = castToMarkdown(value); // MarkdownType
3677          return value;
3678        case -220463842: // purpose
3679          this.purpose = castToMarkdown(value); // MarkdownType
3680          return value;
3681        case 223539345: // approvalDate
3682          this.approvalDate = castToDate(value); // DateType
3683          return value;
3684        case -1687512484: // lastReviewDate
3685          this.lastReviewDate = castToDate(value); // DateType
3686          return value;
3687        case -403934648: // effectivePeriod
3688          this.effectivePeriod = castToPeriod(value); // Period
3689          return value;
3690        case -669707736: // useContext
3691          this.getUseContext().add(castToUsageContext(value)); // UsageContext
3692          return value;
3693        case -507075711: // jurisdiction
3694          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
3695          return value;
3696        case 951526432: // contact
3697          this.getContact().add(castToContactDetail(value)); // ContactDetail
3698          return value;
3699        case 1522889671: // copyright
3700          this.copyright = castToMarkdown(value); // MarkdownType
3701          return value;
3702        case 3059181: // code
3703          this.getCode().add(castToCoding(value)); // Coding
3704          return value;
3705        case -603200890: // subjectType
3706          this.getSubjectType().add(castToCode(value)); // CodeType
3707          return value;
3708        case 3242771: // item
3709          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
3710          return value;
3711        default: return super.setProperty(hash, name, value);
3712        }
3713
3714      }
3715
3716      @Override
3717      public Base setProperty(String name, Base value) throws FHIRException {
3718        if (name.equals("url")) {
3719          this.url = castToUri(value); // UriType
3720        } else if (name.equals("identifier")) {
3721          this.getIdentifier().add(castToIdentifier(value));
3722        } else if (name.equals("version")) {
3723          this.version = castToString(value); // StringType
3724        } else if (name.equals("name")) {
3725          this.name = castToString(value); // StringType
3726        } else if (name.equals("title")) {
3727          this.title = castToString(value); // StringType
3728        } else if (name.equals("status")) {
3729          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3730          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3731        } else if (name.equals("experimental")) {
3732          this.experimental = castToBoolean(value); // BooleanType
3733        } else if (name.equals("date")) {
3734          this.date = castToDateTime(value); // DateTimeType
3735        } else if (name.equals("publisher")) {
3736          this.publisher = castToString(value); // StringType
3737        } else if (name.equals("description")) {
3738          this.description = castToMarkdown(value); // MarkdownType
3739        } else if (name.equals("purpose")) {
3740          this.purpose = castToMarkdown(value); // MarkdownType
3741        } else if (name.equals("approvalDate")) {
3742          this.approvalDate = castToDate(value); // DateType
3743        } else if (name.equals("lastReviewDate")) {
3744          this.lastReviewDate = castToDate(value); // DateType
3745        } else if (name.equals("effectivePeriod")) {
3746          this.effectivePeriod = castToPeriod(value); // Period
3747        } else if (name.equals("useContext")) {
3748          this.getUseContext().add(castToUsageContext(value));
3749        } else if (name.equals("jurisdiction")) {
3750          this.getJurisdiction().add(castToCodeableConcept(value));
3751        } else if (name.equals("contact")) {
3752          this.getContact().add(castToContactDetail(value));
3753        } else if (name.equals("copyright")) {
3754          this.copyright = castToMarkdown(value); // MarkdownType
3755        } else if (name.equals("code")) {
3756          this.getCode().add(castToCoding(value));
3757        } else if (name.equals("subjectType")) {
3758          this.getSubjectType().add(castToCode(value));
3759        } else if (name.equals("item")) {
3760          this.getItem().add((QuestionnaireItemComponent) value);
3761        } else
3762          return super.setProperty(name, value);
3763        return value;
3764      }
3765
3766      @Override
3767      public Base makeProperty(int hash, String name) throws FHIRException {
3768        switch (hash) {
3769        case 116079:  return getUrlElement();
3770        case -1618432855:  return addIdentifier(); 
3771        case 351608024:  return getVersionElement();
3772        case 3373707:  return getNameElement();
3773        case 110371416:  return getTitleElement();
3774        case -892481550:  return getStatusElement();
3775        case -404562712:  return getExperimentalElement();
3776        case 3076014:  return getDateElement();
3777        case 1447404028:  return getPublisherElement();
3778        case -1724546052:  return getDescriptionElement();
3779        case -220463842:  return getPurposeElement();
3780        case 223539345:  return getApprovalDateElement();
3781        case -1687512484:  return getLastReviewDateElement();
3782        case -403934648:  return getEffectivePeriod(); 
3783        case -669707736:  return addUseContext(); 
3784        case -507075711:  return addJurisdiction(); 
3785        case 951526432:  return addContact(); 
3786        case 1522889671:  return getCopyrightElement();
3787        case 3059181:  return addCode(); 
3788        case -603200890:  return addSubjectTypeElement();
3789        case 3242771:  return addItem(); 
3790        default: return super.makeProperty(hash, name);
3791        }
3792
3793      }
3794
3795      @Override
3796      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3797        switch (hash) {
3798        case 116079: /*url*/ return new String[] {"uri"};
3799        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3800        case 351608024: /*version*/ return new String[] {"string"};
3801        case 3373707: /*name*/ return new String[] {"string"};
3802        case 110371416: /*title*/ return new String[] {"string"};
3803        case -892481550: /*status*/ return new String[] {"code"};
3804        case -404562712: /*experimental*/ return new String[] {"boolean"};
3805        case 3076014: /*date*/ return new String[] {"dateTime"};
3806        case 1447404028: /*publisher*/ return new String[] {"string"};
3807        case -1724546052: /*description*/ return new String[] {"markdown"};
3808        case -220463842: /*purpose*/ return new String[] {"markdown"};
3809        case 223539345: /*approvalDate*/ return new String[] {"date"};
3810        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
3811        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
3812        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
3813        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
3814        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
3815        case 1522889671: /*copyright*/ return new String[] {"markdown"};
3816        case 3059181: /*code*/ return new String[] {"Coding"};
3817        case -603200890: /*subjectType*/ return new String[] {"code"};
3818        case 3242771: /*item*/ return new String[] {};
3819        default: return super.getTypesForProperty(hash, name);
3820        }
3821
3822      }
3823
3824      @Override
3825      public Base addChild(String name) throws FHIRException {
3826        if (name.equals("url")) {
3827          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.url");
3828        }
3829        else if (name.equals("identifier")) {
3830          return addIdentifier();
3831        }
3832        else if (name.equals("version")) {
3833          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version");
3834        }
3835        else if (name.equals("name")) {
3836          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.name");
3837        }
3838        else if (name.equals("title")) {
3839          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title");
3840        }
3841        else if (name.equals("status")) {
3842          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status");
3843        }
3844        else if (name.equals("experimental")) {
3845          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.experimental");
3846        }
3847        else if (name.equals("date")) {
3848          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date");
3849        }
3850        else if (name.equals("publisher")) {
3851          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher");
3852        }
3853        else if (name.equals("description")) {
3854          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.description");
3855        }
3856        else if (name.equals("purpose")) {
3857          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.purpose");
3858        }
3859        else if (name.equals("approvalDate")) {
3860          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.approvalDate");
3861        }
3862        else if (name.equals("lastReviewDate")) {
3863          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.lastReviewDate");
3864        }
3865        else if (name.equals("effectivePeriod")) {
3866          this.effectivePeriod = new Period();
3867          return this.effectivePeriod;
3868        }
3869        else if (name.equals("useContext")) {
3870          return addUseContext();
3871        }
3872        else if (name.equals("jurisdiction")) {
3873          return addJurisdiction();
3874        }
3875        else if (name.equals("contact")) {
3876          return addContact();
3877        }
3878        else if (name.equals("copyright")) {
3879          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.copyright");
3880        }
3881        else if (name.equals("code")) {
3882          return addCode();
3883        }
3884        else if (name.equals("subjectType")) {
3885          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType");
3886        }
3887        else if (name.equals("item")) {
3888          return addItem();
3889        }
3890        else
3891          return super.addChild(name);
3892      }
3893
3894  public String fhirType() {
3895    return "Questionnaire";
3896
3897  }
3898
3899      public Questionnaire copy() {
3900        Questionnaire dst = new Questionnaire();
3901        copyValues(dst);
3902        dst.url = url == null ? null : url.copy();
3903        if (identifier != null) {
3904          dst.identifier = new ArrayList<Identifier>();
3905          for (Identifier i : identifier)
3906            dst.identifier.add(i.copy());
3907        };
3908        dst.version = version == null ? null : version.copy();
3909        dst.name = name == null ? null : name.copy();
3910        dst.title = title == null ? null : title.copy();
3911        dst.status = status == null ? null : status.copy();
3912        dst.experimental = experimental == null ? null : experimental.copy();
3913        dst.date = date == null ? null : date.copy();
3914        dst.publisher = publisher == null ? null : publisher.copy();
3915        dst.description = description == null ? null : description.copy();
3916        dst.purpose = purpose == null ? null : purpose.copy();
3917        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
3918        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
3919        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
3920        if (useContext != null) {
3921          dst.useContext = new ArrayList<UsageContext>();
3922          for (UsageContext i : useContext)
3923            dst.useContext.add(i.copy());
3924        };
3925        if (jurisdiction != null) {
3926          dst.jurisdiction = new ArrayList<CodeableConcept>();
3927          for (CodeableConcept i : jurisdiction)
3928            dst.jurisdiction.add(i.copy());
3929        };
3930        if (contact != null) {
3931          dst.contact = new ArrayList<ContactDetail>();
3932          for (ContactDetail i : contact)
3933            dst.contact.add(i.copy());
3934        };
3935        dst.copyright = copyright == null ? null : copyright.copy();
3936        if (code != null) {
3937          dst.code = new ArrayList<Coding>();
3938          for (Coding i : code)
3939            dst.code.add(i.copy());
3940        };
3941        if (subjectType != null) {
3942          dst.subjectType = new ArrayList<CodeType>();
3943          for (CodeType i : subjectType)
3944            dst.subjectType.add(i.copy());
3945        };
3946        if (item != null) {
3947          dst.item = new ArrayList<QuestionnaireItemComponent>();
3948          for (QuestionnaireItemComponent i : item)
3949            dst.item.add(i.copy());
3950        };
3951        return dst;
3952      }
3953
3954      protected Questionnaire typedCopy() {
3955        return copy();
3956      }
3957
3958      @Override
3959      public boolean equalsDeep(Base other) {
3960        if (!super.equalsDeep(other))
3961          return false;
3962        if (!(other instanceof Questionnaire))
3963          return false;
3964        Questionnaire o = (Questionnaire) other;
3965        return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true) && compareDeep(approvalDate, o.approvalDate, true)
3966           && compareDeep(lastReviewDate, o.lastReviewDate, true) && compareDeep(effectivePeriod, o.effectivePeriod, true)
3967           && compareDeep(copyright, o.copyright, true) && compareDeep(code, o.code, true) && compareDeep(subjectType, o.subjectType, true)
3968           && compareDeep(item, o.item, true);
3969      }
3970
3971      @Override
3972      public boolean equalsShallow(Base other) {
3973        if (!super.equalsShallow(other))
3974          return false;
3975        if (!(other instanceof Questionnaire))
3976          return false;
3977        Questionnaire o = (Questionnaire) other;
3978        return compareValues(purpose, o.purpose, true) && compareValues(approvalDate, o.approvalDate, true)
3979           && compareValues(lastReviewDate, o.lastReviewDate, true) && compareValues(copyright, o.copyright, true)
3980           && compareValues(subjectType, o.subjectType, true);
3981      }
3982
3983      public boolean isEmpty() {
3984        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, approvalDate
3985          , lastReviewDate, effectivePeriod, copyright, code, subjectType, item);
3986      }
3987
3988  @Override
3989  public ResourceType getResourceType() {
3990    return ResourceType.Questionnaire;
3991   }
3992
3993 /**
3994   * Search parameter: <b>date</b>
3995   * <p>
3996   * Description: <b>The questionnaire publication date</b><br>
3997   * Type: <b>date</b><br>
3998   * Path: <b>Questionnaire.date</b><br>
3999   * </p>
4000   */
4001  @SearchParamDefinition(name="date", path="Questionnaire.date", description="The questionnaire publication date", type="date" )
4002  public static final String SP_DATE = "date";
4003 /**
4004   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4005   * <p>
4006   * Description: <b>The questionnaire publication date</b><br>
4007   * Type: <b>date</b><br>
4008   * Path: <b>Questionnaire.date</b><br>
4009   * </p>
4010   */
4011  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4012
4013 /**
4014   * Search parameter: <b>identifier</b>
4015   * <p>
4016   * Description: <b>External identifier for the questionnaire</b><br>
4017   * Type: <b>token</b><br>
4018   * Path: <b>Questionnaire.identifier</b><br>
4019   * </p>
4020   */
4021  @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="External identifier for the questionnaire", type="token" )
4022  public static final String SP_IDENTIFIER = "identifier";
4023 /**
4024   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4025   * <p>
4026   * Description: <b>External identifier for the questionnaire</b><br>
4027   * Type: <b>token</b><br>
4028   * Path: <b>Questionnaire.identifier</b><br>
4029   * </p>
4030   */
4031  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4032
4033 /**
4034   * Search parameter: <b>effective</b>
4035   * <p>
4036   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
4037   * Type: <b>date</b><br>
4038   * Path: <b>Questionnaire.effectivePeriod</b><br>
4039   * </p>
4040   */
4041  @SearchParamDefinition(name="effective", path="Questionnaire.effectivePeriod", description="The time during which the questionnaire is intended to be in use", type="date" )
4042  public static final String SP_EFFECTIVE = "effective";
4043 /**
4044   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
4045   * <p>
4046   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
4047   * Type: <b>date</b><br>
4048   * Path: <b>Questionnaire.effectivePeriod</b><br>
4049   * </p>
4050   */
4051  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
4052
4053 /**
4054   * Search parameter: <b>code</b>
4055   * <p>
4056   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4057   * Type: <b>token</b><br>
4058   * Path: <b>Questionnaire.item.code</b><br>
4059   * </p>
4060   */
4061  @SearchParamDefinition(name="code", path="Questionnaire.item.code", description="A code that corresponds to one of its items in the questionnaire", type="token" )
4062  public static final String SP_CODE = "code";
4063 /**
4064   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4065   * <p>
4066   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
4067   * Type: <b>token</b><br>
4068   * Path: <b>Questionnaire.item.code</b><br>
4069   * </p>
4070   */
4071  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4072
4073 /**
4074   * Search parameter: <b>jurisdiction</b>
4075   * <p>
4076   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4077   * Type: <b>token</b><br>
4078   * Path: <b>Questionnaire.jurisdiction</b><br>
4079   * </p>
4080   */
4081  @SearchParamDefinition(name="jurisdiction", path="Questionnaire.jurisdiction", description="Intended jurisdiction for the questionnaire", type="token" )
4082  public static final String SP_JURISDICTION = "jurisdiction";
4083 /**
4084   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4085   * <p>
4086   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
4087   * Type: <b>token</b><br>
4088   * Path: <b>Questionnaire.jurisdiction</b><br>
4089   * </p>
4090   */
4091  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
4092
4093 /**
4094   * Search parameter: <b>name</b>
4095   * <p>
4096   * Description: <b>Computationally friendly name of the questionnaire</b><br>
4097   * Type: <b>string</b><br>
4098   * Path: <b>Questionnaire.name</b><br>
4099   * </p>
4100   */
4101  @SearchParamDefinition(name="name", path="Questionnaire.name", description="Computationally friendly name of the questionnaire", type="string" )
4102  public static final String SP_NAME = "name";
4103 /**
4104   * <b>Fluent Client</b> search parameter constant for <b>name</b>
4105   * <p>
4106   * Description: <b>Computationally friendly name of the questionnaire</b><br>
4107   * Type: <b>string</b><br>
4108   * Path: <b>Questionnaire.name</b><br>
4109   * </p>
4110   */
4111  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
4112
4113 /**
4114   * Search parameter: <b>description</b>
4115   * <p>
4116   * Description: <b>The description of the questionnaire</b><br>
4117   * Type: <b>string</b><br>
4118   * Path: <b>Questionnaire.description</b><br>
4119   * </p>
4120   */
4121  @SearchParamDefinition(name="description", path="Questionnaire.description", description="The description of the questionnaire", type="string" )
4122  public static final String SP_DESCRIPTION = "description";
4123 /**
4124   * <b>Fluent Client</b> search parameter constant for <b>description</b>
4125   * <p>
4126   * Description: <b>The description of the questionnaire</b><br>
4127   * Type: <b>string</b><br>
4128   * Path: <b>Questionnaire.description</b><br>
4129   * </p>
4130   */
4131  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
4132
4133 /**
4134   * Search parameter: <b>publisher</b>
4135   * <p>
4136   * Description: <b>Name of the publisher of the questionnaire</b><br>
4137   * Type: <b>string</b><br>
4138   * Path: <b>Questionnaire.publisher</b><br>
4139   * </p>
4140   */
4141  @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="Name of the publisher of the questionnaire", type="string" )
4142  public static final String SP_PUBLISHER = "publisher";
4143 /**
4144   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
4145   * <p>
4146   * Description: <b>Name of the publisher of the questionnaire</b><br>
4147   * Type: <b>string</b><br>
4148   * Path: <b>Questionnaire.publisher</b><br>
4149   * </p>
4150   */
4151  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
4152
4153 /**
4154   * Search parameter: <b>title</b>
4155   * <p>
4156   * Description: <b>The human-friendly name of the questionnaire</b><br>
4157   * Type: <b>string</b><br>
4158   * Path: <b>Questionnaire.title</b><br>
4159   * </p>
4160   */
4161  @SearchParamDefinition(name="title", path="Questionnaire.title", description="The human-friendly name of the questionnaire", type="string" )
4162  public static final String SP_TITLE = "title";
4163 /**
4164   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4165   * <p>
4166   * Description: <b>The human-friendly name of the questionnaire</b><br>
4167   * Type: <b>string</b><br>
4168   * Path: <b>Questionnaire.title</b><br>
4169   * </p>
4170   */
4171  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
4172
4173 /**
4174   * Search parameter: <b>version</b>
4175   * <p>
4176   * Description: <b>The business version of the questionnaire</b><br>
4177   * Type: <b>token</b><br>
4178   * Path: <b>Questionnaire.version</b><br>
4179   * </p>
4180   */
4181  @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="token" )
4182  public static final String SP_VERSION = "version";
4183 /**
4184   * <b>Fluent Client</b> search parameter constant for <b>version</b>
4185   * <p>
4186   * Description: <b>The business version of the questionnaire</b><br>
4187   * Type: <b>token</b><br>
4188   * Path: <b>Questionnaire.version</b><br>
4189   * </p>
4190   */
4191  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
4192
4193 /**
4194   * Search parameter: <b>url</b>
4195   * <p>
4196   * Description: <b>The uri that identifies the questionnaire</b><br>
4197   * Type: <b>uri</b><br>
4198   * Path: <b>Questionnaire.url</b><br>
4199   * </p>
4200   */
4201  @SearchParamDefinition(name="url", path="Questionnaire.url", description="The uri that identifies the questionnaire", type="uri" )
4202  public static final String SP_URL = "url";
4203 /**
4204   * <b>Fluent Client</b> search parameter constant for <b>url</b>
4205   * <p>
4206   * Description: <b>The uri that identifies the questionnaire</b><br>
4207   * Type: <b>uri</b><br>
4208   * Path: <b>Questionnaire.url</b><br>
4209   * </p>
4210   */
4211  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
4212
4213 /**
4214   * Search parameter: <b>status</b>
4215   * <p>
4216   * Description: <b>The current status of the questionnaire</b><br>
4217   * Type: <b>token</b><br>
4218   * Path: <b>Questionnaire.status</b><br>
4219   * </p>
4220   */
4221  @SearchParamDefinition(name="status", path="Questionnaire.status", description="The current status of the questionnaire", type="token" )
4222  public static final String SP_STATUS = "status";
4223 /**
4224   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4225   * <p>
4226   * Description: <b>The current status of the questionnaire</b><br>
4227   * Type: <b>token</b><br>
4228   * Path: <b>Questionnaire.status</b><br>
4229   * </p>
4230   */
4231  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4232
4233
4234}
4235