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