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