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 Base makeProperty(int hash, String name) throws FHIRException {
2235      switch (hash) {
2236      case -1102667083:
2237        return getLinkIdElement();
2238      case -1014418093:
2239        return getDefinitionElement();
2240      case 3059181:
2241        return addCode();
2242      case -980110702:
2243        return getPrefixElement();
2244      case 3556653:
2245        return getTextElement();
2246      case 3575610:
2247        return getTypeElement();
2248      case 1893321565:
2249        return addEnableWhen();
2250      case 1854802165:
2251        return getEnableBehaviorElement();
2252      case -393139297:
2253        return getRequiredElement();
2254      case 1094288952:
2255        return getRepeatsElement();
2256      case -867683742:
2257        return getReadOnlyElement();
2258      case -791400086:
2259        return getMaxLengthElement();
2260      case -743278833:
2261        return getAnswerValueSetElement();
2262      case -1527878189:
2263        return addAnswerOption();
2264      case 1948342084:
2265        return addInitial();
2266      case 3242771:
2267        return addItem();
2268      default:
2269        return super.makeProperty(hash, name);
2270      }
2271
2272    }
2273
2274    @Override
2275    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2276      switch (hash) {
2277      case -1102667083:
2278        /* linkId */ return new String[] { "string" };
2279      case -1014418093:
2280        /* definition */ return new String[] { "uri" };
2281      case 3059181:
2282        /* code */ return new String[] { "Coding" };
2283      case -980110702:
2284        /* prefix */ return new String[] { "string" };
2285      case 3556653:
2286        /* text */ return new String[] { "string" };
2287      case 3575610:
2288        /* type */ return new String[] { "code" };
2289      case 1893321565:
2290        /* enableWhen */ return new String[] {};
2291      case 1854802165:
2292        /* enableBehavior */ return new String[] { "code" };
2293      case -393139297:
2294        /* required */ return new String[] { "boolean" };
2295      case 1094288952:
2296        /* repeats */ return new String[] { "boolean" };
2297      case -867683742:
2298        /* readOnly */ return new String[] { "boolean" };
2299      case -791400086:
2300        /* maxLength */ return new String[] { "integer" };
2301      case -743278833:
2302        /* answerValueSet */ return new String[] { "canonical" };
2303      case -1527878189:
2304        /* answerOption */ return new String[] {};
2305      case 1948342084:
2306        /* initial */ return new String[] {};
2307      case 3242771:
2308        /* item */ return new String[] { "@Questionnaire.item" };
2309      default:
2310        return super.getTypesForProperty(hash, name);
2311      }
2312
2313    }
2314
2315    @Override
2316    public Base addChild(String name) throws FHIRException {
2317      if (name.equals("linkId")) {
2318        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.linkId");
2319      } else if (name.equals("definition")) {
2320        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.definition");
2321      } else if (name.equals("code")) {
2322        return addCode();
2323      } else if (name.equals("prefix")) {
2324        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.prefix");
2325      } else if (name.equals("text")) {
2326        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.text");
2327      } else if (name.equals("type")) {
2328        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.type");
2329      } else if (name.equals("enableWhen")) {
2330        return addEnableWhen();
2331      } else if (name.equals("enableBehavior")) {
2332        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.enableBehavior");
2333      } else if (name.equals("required")) {
2334        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.required");
2335      } else if (name.equals("repeats")) {
2336        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.repeats");
2337      } else if (name.equals("readOnly")) {
2338        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.readOnly");
2339      } else if (name.equals("maxLength")) {
2340        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.maxLength");
2341      } else if (name.equals("answerValueSet")) {
2342        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.answerValueSet");
2343      } else if (name.equals("answerOption")) {
2344        return addAnswerOption();
2345      } else if (name.equals("initial")) {
2346        return addInitial();
2347      } else if (name.equals("item")) {
2348        return addItem();
2349      } else
2350        return super.addChild(name);
2351    }
2352
2353    public QuestionnaireItemComponent copy() {
2354      QuestionnaireItemComponent dst = new QuestionnaireItemComponent();
2355      copyValues(dst);
2356      return dst;
2357    }
2358
2359    public void copyValues(QuestionnaireItemComponent dst) {
2360      super.copyValues(dst);
2361      dst.linkId = linkId == null ? null : linkId.copy();
2362      dst.definition = definition == null ? null : definition.copy();
2363      if (code != null) {
2364        dst.code = new ArrayList<Coding>();
2365        for (Coding i : code)
2366          dst.code.add(i.copy());
2367      }
2368      ;
2369      dst.prefix = prefix == null ? null : prefix.copy();
2370      dst.text = text == null ? null : text.copy();
2371      dst.type = type == null ? null : type.copy();
2372      if (enableWhen != null) {
2373        dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
2374        for (QuestionnaireItemEnableWhenComponent i : enableWhen)
2375          dst.enableWhen.add(i.copy());
2376      }
2377      ;
2378      dst.enableBehavior = enableBehavior == null ? null : enableBehavior.copy();
2379      dst.required = required == null ? null : required.copy();
2380      dst.repeats = repeats == null ? null : repeats.copy();
2381      dst.readOnly = readOnly == null ? null : readOnly.copy();
2382      dst.maxLength = maxLength == null ? null : maxLength.copy();
2383      dst.answerValueSet = answerValueSet == null ? null : answerValueSet.copy();
2384      if (answerOption != null) {
2385        dst.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
2386        for (QuestionnaireItemAnswerOptionComponent i : answerOption)
2387          dst.answerOption.add(i.copy());
2388      }
2389      ;
2390      if (initial != null) {
2391        dst.initial = new ArrayList<QuestionnaireItemInitialComponent>();
2392        for (QuestionnaireItemInitialComponent i : initial)
2393          dst.initial.add(i.copy());
2394      }
2395      ;
2396      if (item != null) {
2397        dst.item = new ArrayList<QuestionnaireItemComponent>();
2398        for (QuestionnaireItemComponent i : item)
2399          dst.item.add(i.copy());
2400      }
2401      ;
2402    }
2403
2404    @Override
2405    public boolean equalsDeep(Base other_) {
2406      if (!super.equalsDeep(other_))
2407        return false;
2408      if (!(other_ instanceof QuestionnaireItemComponent))
2409        return false;
2410      QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
2411      return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true)
2412          && compareDeep(code, o.code, true) && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true)
2413          && compareDeep(type, o.type, true) && compareDeep(enableWhen, o.enableWhen, true)
2414          && compareDeep(enableBehavior, o.enableBehavior, true) && compareDeep(required, o.required, true)
2415          && compareDeep(repeats, o.repeats, true) && compareDeep(readOnly, o.readOnly, true)
2416          && compareDeep(maxLength, o.maxLength, true) && compareDeep(answerValueSet, o.answerValueSet, true)
2417          && compareDeep(answerOption, o.answerOption, true) && compareDeep(initial, o.initial, true)
2418          && compareDeep(item, o.item, true);
2419    }
2420
2421    @Override
2422    public boolean equalsShallow(Base other_) {
2423      if (!super.equalsShallow(other_))
2424        return false;
2425      if (!(other_ instanceof QuestionnaireItemComponent))
2426        return false;
2427      QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
2428      return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true)
2429          && compareValues(prefix, o.prefix, true) && compareValues(text, o.text, true)
2430          && compareValues(type, o.type, true) && compareValues(enableBehavior, o.enableBehavior, true)
2431          && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true)
2432          && compareValues(readOnly, o.readOnly, true) && compareValues(maxLength, o.maxLength, true);
2433    }
2434
2435    public boolean isEmpty() {
2436      return super.isEmpty()
2437          && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code, prefix, text, type, enableWhen,
2438              enableBehavior, required, repeats, readOnly, maxLength, answerValueSet, answerOption, initial, item);
2439    }
2440
2441    public String fhirType() {
2442      return "Questionnaire.item";
2443
2444    }
2445
2446  }
2447
2448  @Block()
2449  public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
2450    /**
2451     * The linkId for the question whose answer (or lack of answer) governs whether
2452     * this item is enabled.
2453     */
2454    @Child(name = "question", type = {
2455        StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2456    @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.")
2457    protected StringType question;
2458
2459    /**
2460     * Specifies the criteria by which the question is enabled.
2461     */
2462    @Child(name = "operator", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
2463    @Description(shortDefinition = "exists | = | != | > | < | >= | <=", formalDefinition = "Specifies the criteria by which the question is enabled.")
2464    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-enable-operator")
2465    protected Enumeration<QuestionnaireItemOperator> operator;
2466
2467    /**
2468     * A value that the referenced question is tested using the specified operator
2469     * in order for the item to be enabled.
2470     */
2471    @Child(name = "answer", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
2472        DateTimeType.class, TimeType.class, StringType.class, Coding.class, Quantity.class,
2473        Reference.class }, order = 3, min = 1, max = 1, modifier = false, summary = false)
2474    @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.")
2475    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers")
2476    protected Type answer;
2477
2478    private static final long serialVersionUID = -1815133868L;
2479
2480    /**
2481     * Constructor
2482     */
2483    public QuestionnaireItemEnableWhenComponent() {
2484      super();
2485    }
2486
2487    /**
2488     * Constructor
2489     */
2490    public QuestionnaireItemEnableWhenComponent(StringType question, Enumeration<QuestionnaireItemOperator> operator,
2491        Type answer) {
2492      super();
2493      this.question = question;
2494      this.operator = operator;
2495      this.answer = answer;
2496    }
2497
2498    /**
2499     * @return {@link #question} (The linkId for the question whose answer (or lack
2500     *         of answer) governs whether this item is enabled.). This is the
2501     *         underlying object with id, value and extensions. The accessor
2502     *         "getQuestion" gives direct access to the value
2503     */
2504    public StringType getQuestionElement() {
2505      if (this.question == null)
2506        if (Configuration.errorOnAutoCreate())
2507          throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
2508        else if (Configuration.doAutoCreate())
2509          this.question = new StringType(); // bb
2510      return this.question;
2511    }
2512
2513    public boolean hasQuestionElement() {
2514      return this.question != null && !this.question.isEmpty();
2515    }
2516
2517    public boolean hasQuestion() {
2518      return this.question != null && !this.question.isEmpty();
2519    }
2520
2521    /**
2522     * @param value {@link #question} (The linkId for the question whose answer (or
2523     *              lack of answer) governs whether this item is enabled.). This is
2524     *              the underlying object with id, value and extensions. The
2525     *              accessor "getQuestion" gives direct access to the value
2526     */
2527    public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) {
2528      this.question = value;
2529      return this;
2530    }
2531
2532    /**
2533     * @return The linkId for the question whose answer (or lack of answer) governs
2534     *         whether this item is enabled.
2535     */
2536    public String getQuestion() {
2537      return this.question == null ? null : this.question.getValue();
2538    }
2539
2540    /**
2541     * @param value The linkId for the question whose answer (or lack of answer)
2542     *              governs whether this item is enabled.
2543     */
2544    public QuestionnaireItemEnableWhenComponent setQuestion(String value) {
2545      if (this.question == null)
2546        this.question = new StringType();
2547      this.question.setValue(value);
2548      return this;
2549    }
2550
2551    /**
2552     * @return {@link #operator} (Specifies the criteria by which the question is
2553     *         enabled.). This is the underlying object with id, value and
2554     *         extensions. The accessor "getOperator" gives direct access to the
2555     *         value
2556     */
2557    public Enumeration<QuestionnaireItemOperator> getOperatorElement() {
2558      if (this.operator == null)
2559        if (Configuration.errorOnAutoCreate())
2560          throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.operator");
2561        else if (Configuration.doAutoCreate())
2562          this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory()); // bb
2563      return this.operator;
2564    }
2565
2566    public boolean hasOperatorElement() {
2567      return this.operator != null && !this.operator.isEmpty();
2568    }
2569
2570    public boolean hasOperator() {
2571      return this.operator != null && !this.operator.isEmpty();
2572    }
2573
2574    /**
2575     * @param value {@link #operator} (Specifies the criteria by which the question
2576     *              is enabled.). This is the underlying object with id, value and
2577     *              extensions. The accessor "getOperator" gives direct access to
2578     *              the value
2579     */
2580    public QuestionnaireItemEnableWhenComponent setOperatorElement(Enumeration<QuestionnaireItemOperator> value) {
2581      this.operator = value;
2582      return this;
2583    }
2584
2585    /**
2586     * @return Specifies the criteria by which the question is enabled.
2587     */
2588    public QuestionnaireItemOperator getOperator() {
2589      return this.operator == null ? null : this.operator.getValue();
2590    }
2591
2592    /**
2593     * @param value Specifies the criteria by which the question is enabled.
2594     */
2595    public QuestionnaireItemEnableWhenComponent setOperator(QuestionnaireItemOperator value) {
2596      if (this.operator == null)
2597        this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory());
2598      this.operator.setValue(value);
2599      return this;
2600    }
2601
2602    /**
2603     * @return {@link #answer} (A value that the referenced question is tested using
2604     *         the specified operator in order for the item to be enabled.)
2605     */
2606    public Type getAnswer() {
2607      return this.answer;
2608    }
2609
2610    /**
2611     * @return {@link #answer} (A value that the referenced question is tested using
2612     *         the specified operator in order for the item to be enabled.)
2613     */
2614    public BooleanType getAnswerBooleanType() throws FHIRException {
2615      if (this.answer == null)
2616        this.answer = new BooleanType();
2617      if (!(this.answer instanceof BooleanType))
2618        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
2619            + this.answer.getClass().getName() + " was encountered");
2620      return (BooleanType) this.answer;
2621    }
2622
2623    public boolean hasAnswerBooleanType() {
2624      return this != null && this.answer instanceof BooleanType;
2625    }
2626
2627    /**
2628     * @return {@link #answer} (A value that the referenced question is tested using
2629     *         the specified operator in order for the item to be enabled.)
2630     */
2631    public DecimalType getAnswerDecimalType() throws FHIRException {
2632      if (this.answer == null)
2633        this.answer = new DecimalType();
2634      if (!(this.answer instanceof DecimalType))
2635        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
2636            + this.answer.getClass().getName() + " was encountered");
2637      return (DecimalType) this.answer;
2638    }
2639
2640    public boolean hasAnswerDecimalType() {
2641      return this != null && this.answer instanceof DecimalType;
2642    }
2643
2644    /**
2645     * @return {@link #answer} (A value that the referenced question is tested using
2646     *         the specified operator in order for the item to be enabled.)
2647     */
2648    public IntegerType getAnswerIntegerType() throws FHIRException {
2649      if (this.answer == null)
2650        this.answer = new IntegerType();
2651      if (!(this.answer instanceof IntegerType))
2652        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
2653            + this.answer.getClass().getName() + " was encountered");
2654      return (IntegerType) this.answer;
2655    }
2656
2657    public boolean hasAnswerIntegerType() {
2658      return this != null && this.answer instanceof IntegerType;
2659    }
2660
2661    /**
2662     * @return {@link #answer} (A value that the referenced question is tested using
2663     *         the specified operator in order for the item to be enabled.)
2664     */
2665    public DateType getAnswerDateType() throws FHIRException {
2666      if (this.answer == null)
2667        this.answer = new DateType();
2668      if (!(this.answer instanceof DateType))
2669        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.answer.getClass().getName()
2670            + " was encountered");
2671      return (DateType) this.answer;
2672    }
2673
2674    public boolean hasAnswerDateType() {
2675      return this != null && this.answer instanceof DateType;
2676    }
2677
2678    /**
2679     * @return {@link #answer} (A value that the referenced question is tested using
2680     *         the specified operator in order for the item to be enabled.)
2681     */
2682    public DateTimeType getAnswerDateTimeType() throws FHIRException {
2683      if (this.answer == null)
2684        this.answer = new DateTimeType();
2685      if (!(this.answer instanceof DateTimeType))
2686        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
2687            + this.answer.getClass().getName() + " was encountered");
2688      return (DateTimeType) this.answer;
2689    }
2690
2691    public boolean hasAnswerDateTimeType() {
2692      return this != null && this.answer instanceof DateTimeType;
2693    }
2694
2695    /**
2696     * @return {@link #answer} (A value that the referenced question is tested using
2697     *         the specified operator in order for the item to be enabled.)
2698     */
2699    public TimeType getAnswerTimeType() throws FHIRException {
2700      if (this.answer == null)
2701        this.answer = new TimeType();
2702      if (!(this.answer instanceof TimeType))
2703        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.answer.getClass().getName()
2704            + " was encountered");
2705      return (TimeType) this.answer;
2706    }
2707
2708    public boolean hasAnswerTimeType() {
2709      return this != null && this.answer instanceof TimeType;
2710    }
2711
2712    /**
2713     * @return {@link #answer} (A value that the referenced question is tested using
2714     *         the specified operator in order for the item to be enabled.)
2715     */
2716    public StringType getAnswerStringType() throws FHIRException {
2717      if (this.answer == null)
2718        this.answer = new StringType();
2719      if (!(this.answer instanceof StringType))
2720        throw new FHIRException("Type mismatch: the type StringType was expected, but "
2721            + this.answer.getClass().getName() + " was encountered");
2722      return (StringType) this.answer;
2723    }
2724
2725    public boolean hasAnswerStringType() {
2726      return this != null && this.answer instanceof StringType;
2727    }
2728
2729    /**
2730     * @return {@link #answer} (A value that the referenced question is tested using
2731     *         the specified operator in order for the item to be enabled.)
2732     */
2733    public Coding getAnswerCoding() throws FHIRException {
2734      if (this.answer == null)
2735        this.answer = new Coding();
2736      if (!(this.answer instanceof Coding))
2737        throw new FHIRException("Type mismatch: the type Coding was expected, but " + this.answer.getClass().getName()
2738            + " was encountered");
2739      return (Coding) this.answer;
2740    }
2741
2742    public boolean hasAnswerCoding() {
2743      return this != null && this.answer instanceof Coding;
2744    }
2745
2746    /**
2747     * @return {@link #answer} (A value that the referenced question is tested using
2748     *         the specified operator in order for the item to be enabled.)
2749     */
2750    public Quantity getAnswerQuantity() throws FHIRException {
2751      if (this.answer == null)
2752        this.answer = new Quantity();
2753      if (!(this.answer instanceof Quantity))
2754        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.answer.getClass().getName()
2755            + " was encountered");
2756      return (Quantity) this.answer;
2757    }
2758
2759    public boolean hasAnswerQuantity() {
2760      return this != null && this.answer instanceof Quantity;
2761    }
2762
2763    /**
2764     * @return {@link #answer} (A value that the referenced question is tested using
2765     *         the specified operator in order for the item to be enabled.)
2766     */
2767    public Reference getAnswerReference() throws FHIRException {
2768      if (this.answer == null)
2769        this.answer = new Reference();
2770      if (!(this.answer instanceof Reference))
2771        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2772            + this.answer.getClass().getName() + " was encountered");
2773      return (Reference) this.answer;
2774    }
2775
2776    public boolean hasAnswerReference() {
2777      return this != null && this.answer instanceof Reference;
2778    }
2779
2780    public boolean hasAnswer() {
2781      return this.answer != null && !this.answer.isEmpty();
2782    }
2783
2784    /**
2785     * @param value {@link #answer} (A value that the referenced question is tested
2786     *              using the specified operator in order for the item to be
2787     *              enabled.)
2788     */
2789    public QuestionnaireItemEnableWhenComponent setAnswer(Type value) {
2790      if (value != null && !(value instanceof BooleanType || value instanceof DecimalType
2791          || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType
2792          || value instanceof TimeType || value instanceof StringType || value instanceof Coding
2793          || value instanceof Quantity || value instanceof Reference))
2794        throw new Error("Not the right type for Questionnaire.item.enableWhen.answer[x]: " + value.fhirType());
2795      this.answer = value;
2796      return this;
2797    }
2798
2799    protected void listChildren(List<Property> children) {
2800      super.listChildren(children);
2801      children.add(new Property("question", "string",
2802          "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1,
2803          question));
2804      children.add(
2805          new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator));
2806      children.add(new Property("answer[x]",
2807          "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2808          "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2809          0, 1, answer));
2810    }
2811
2812    @Override
2813    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2814      switch (_hash) {
2815      case -1165870106:
2816        /* question */ return new Property("question", "string",
2817            "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1,
2818            question);
2819      case -500553564:
2820        /* operator */ return new Property("operator", "code",
2821            "Specifies the criteria by which the question is enabled.", 0, 1, operator);
2822      case 1693524994:
2823        /* answer[x] */ return new Property("answer[x]",
2824            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2825            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2826            0, 1, answer);
2827      case -1412808770:
2828        /* answer */ return new Property("answer[x]",
2829            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2830            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2831            0, 1, answer);
2832      case 1194603146:
2833        /* answerBoolean */ return new Property("answer[x]",
2834            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2835            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2836            0, 1, answer);
2837      case -1622812237:
2838        /* answerDecimal */ return new Property("answer[x]",
2839            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2840            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2841            0, 1, answer);
2842      case -1207023712:
2843        /* answerInteger */ return new Property("answer[x]",
2844            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2845            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2846            0, 1, answer);
2847      case 958960780:
2848        /* answerDate */ return new Property("answer[x]",
2849            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2850            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2851            0, 1, answer);
2852      case -1835321991:
2853        /* answerDateTime */ return new Property("answer[x]",
2854            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2855            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2856            0, 1, answer);
2857      case 959444907:
2858        /* answerTime */ return new Property("answer[x]",
2859            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2860            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2861            0, 1, answer);
2862      case -1409727121:
2863        /* answerString */ return new Property("answer[x]",
2864            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2865            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2866            0, 1, answer);
2867      case -1872828216:
2868        /* answerCoding */ return new Property("answer[x]",
2869            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2870            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2871            0, 1, answer);
2872      case -618108311:
2873        /* answerQuantity */ return new Property("answer[x]",
2874            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2875            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2876            0, 1, answer);
2877      case -1726221011:
2878        /* answerReference */ return new Property("answer[x]",
2879            "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)",
2880            "A value that the referenced question is tested using the specified operator in order for the item to be enabled.",
2881            0, 1, answer);
2882      default:
2883        return super.getNamedProperty(_hash, _name, _checkValid);
2884      }
2885
2886    }
2887
2888    @Override
2889    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2890      switch (hash) {
2891      case -1165870106:
2892        /* question */ return this.question == null ? new Base[0] : new Base[] { this.question }; // StringType
2893      case -500553564:
2894        /* operator */ return this.operator == null ? new Base[0] : new Base[] { this.operator }; // Enumeration<QuestionnaireItemOperator>
2895      case -1412808770:
2896        /* answer */ return this.answer == null ? new Base[0] : new Base[] { this.answer }; // Type
2897      default:
2898        return super.getProperty(hash, name, checkValid);
2899      }
2900
2901    }
2902
2903    @Override
2904    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2905      switch (hash) {
2906      case -1165870106: // question
2907        this.question = castToString(value); // StringType
2908        return value;
2909      case -500553564: // operator
2910        value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2911        this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2912        return value;
2913      case -1412808770: // answer
2914        this.answer = castToType(value); // Type
2915        return value;
2916      default:
2917        return super.setProperty(hash, name, value);
2918      }
2919
2920    }
2921
2922    @Override
2923    public Base setProperty(String name, Base value) throws FHIRException {
2924      if (name.equals("question")) {
2925        this.question = castToString(value); // StringType
2926      } else if (name.equals("operator")) {
2927        value = new QuestionnaireItemOperatorEnumFactory().fromType(castToCode(value));
2928        this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2929      } else if (name.equals("answer[x]")) {
2930        this.answer = castToType(value); // Type
2931      } else
2932        return super.setProperty(name, value);
2933      return value;
2934    }
2935
2936    @Override
2937    public Base makeProperty(int hash, String name) throws FHIRException {
2938      switch (hash) {
2939      case -1165870106:
2940        return getQuestionElement();
2941      case -500553564:
2942        return getOperatorElement();
2943      case 1693524994:
2944        return getAnswer();
2945      case -1412808770:
2946        return getAnswer();
2947      default:
2948        return super.makeProperty(hash, name);
2949      }
2950
2951    }
2952
2953    @Override
2954    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2955      switch (hash) {
2956      case -1165870106:
2957        /* question */ return new String[] { "string" };
2958      case -500553564:
2959        /* operator */ return new String[] { "code" };
2960      case -1412808770:
2961        /* answer */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string",
2962            "Coding", "Quantity", "Reference" };
2963      default:
2964        return super.getTypesForProperty(hash, name);
2965      }
2966
2967    }
2968
2969    @Override
2970    public Base addChild(String name) throws FHIRException {
2971      if (name.equals("question")) {
2972        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.question");
2973      } else if (name.equals("operator")) {
2974        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.operator");
2975      } else if (name.equals("answerBoolean")) {
2976        this.answer = new BooleanType();
2977        return this.answer;
2978      } else if (name.equals("answerDecimal")) {
2979        this.answer = new DecimalType();
2980        return this.answer;
2981      } else if (name.equals("answerInteger")) {
2982        this.answer = new IntegerType();
2983        return this.answer;
2984      } else if (name.equals("answerDate")) {
2985        this.answer = new DateType();
2986        return this.answer;
2987      } else if (name.equals("answerDateTime")) {
2988        this.answer = new DateTimeType();
2989        return this.answer;
2990      } else if (name.equals("answerTime")) {
2991        this.answer = new TimeType();
2992        return this.answer;
2993      } else if (name.equals("answerString")) {
2994        this.answer = new StringType();
2995        return this.answer;
2996      } else if (name.equals("answerCoding")) {
2997        this.answer = new Coding();
2998        return this.answer;
2999      } else if (name.equals("answerQuantity")) {
3000        this.answer = new Quantity();
3001        return this.answer;
3002      } else if (name.equals("answerReference")) {
3003        this.answer = new Reference();
3004        return this.answer;
3005      } else
3006        return super.addChild(name);
3007    }
3008
3009    public QuestionnaireItemEnableWhenComponent copy() {
3010      QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
3011      copyValues(dst);
3012      return dst;
3013    }
3014
3015    public void copyValues(QuestionnaireItemEnableWhenComponent dst) {
3016      super.copyValues(dst);
3017      dst.question = question == null ? null : question.copy();
3018      dst.operator = operator == null ? null : operator.copy();
3019      dst.answer = answer == null ? null : answer.copy();
3020    }
3021
3022    @Override
3023    public boolean equalsDeep(Base other_) {
3024      if (!super.equalsDeep(other_))
3025        return false;
3026      if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
3027        return false;
3028      QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
3029      return compareDeep(question, o.question, true) && compareDeep(operator, o.operator, true)
3030          && compareDeep(answer, o.answer, true);
3031    }
3032
3033    @Override
3034    public boolean equalsShallow(Base other_) {
3035      if (!super.equalsShallow(other_))
3036        return false;
3037      if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
3038        return false;
3039      QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
3040      return compareValues(question, o.question, true) && compareValues(operator, o.operator, true);
3041    }
3042
3043    public boolean isEmpty() {
3044      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, operator, answer);
3045    }
3046
3047    public String fhirType() {
3048      return "Questionnaire.item.enableWhen";
3049
3050    }
3051
3052  }
3053
3054  @Block()
3055  public static class QuestionnaireItemAnswerOptionComponent extends BackboneElement implements IBaseBackboneElement {
3056    /**
3057     * A potential answer that's allowed as the answer to this question.
3058     */
3059    @Child(name = "value", type = { IntegerType.class, DateType.class, TimeType.class, StringType.class, Coding.class,
3060        Reference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3061    @Description(shortDefinition = "Answer value", formalDefinition = "A potential answer that's allowed as the answer to this question.")
3062    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers")
3063    protected Type value;
3064
3065    /**
3066     * Indicates whether the answer value is selected when the list of possible
3067     * answers is initially shown.
3068     */
3069    @Child(name = "initialSelected", type = {
3070        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3071    @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.")
3072    protected BooleanType initialSelected;
3073
3074    private static final long serialVersionUID = 1703686148L;
3075
3076    /**
3077     * Constructor
3078     */
3079    public QuestionnaireItemAnswerOptionComponent() {
3080      super();
3081    }
3082
3083    /**
3084     * Constructor
3085     */
3086    public QuestionnaireItemAnswerOptionComponent(Type value) {
3087      super();
3088      this.value = value;
3089    }
3090
3091    /**
3092     * @return {@link #value} (A potential answer that's allowed as the answer to
3093     *         this question.)
3094     */
3095    public Type getValue() {
3096      return this.value;
3097    }
3098
3099    /**
3100     * @return {@link #value} (A potential answer that's allowed as the answer to
3101     *         this question.)
3102     */
3103    public IntegerType getValueIntegerType() throws FHIRException {
3104      if (this.value == null)
3105        this.value = new IntegerType();
3106      if (!(this.value instanceof IntegerType))
3107        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
3108            + this.value.getClass().getName() + " was encountered");
3109      return (IntegerType) this.value;
3110    }
3111
3112    public boolean hasValueIntegerType() {
3113      return this != null && this.value instanceof IntegerType;
3114    }
3115
3116    /**
3117     * @return {@link #value} (A potential answer that's allowed as the answer to
3118     *         this question.)
3119     */
3120    public DateType getValueDateType() throws FHIRException {
3121      if (this.value == null)
3122        this.value = new DateType();
3123      if (!(this.value instanceof DateType))
3124        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
3125            + " was encountered");
3126      return (DateType) this.value;
3127    }
3128
3129    public boolean hasValueDateType() {
3130      return this != null && this.value instanceof DateType;
3131    }
3132
3133    /**
3134     * @return {@link #value} (A potential answer that's allowed as the answer to
3135     *         this question.)
3136     */
3137    public TimeType getValueTimeType() throws FHIRException {
3138      if (this.value == null)
3139        this.value = new TimeType();
3140      if (!(this.value instanceof TimeType))
3141        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
3142            + " was encountered");
3143      return (TimeType) this.value;
3144    }
3145
3146    public boolean hasValueTimeType() {
3147      return this != null && this.value instanceof TimeType;
3148    }
3149
3150    /**
3151     * @return {@link #value} (A potential answer that's allowed as the answer to
3152     *         this question.)
3153     */
3154    public StringType getValueStringType() throws FHIRException {
3155      if (this.value == null)
3156        this.value = new StringType();
3157      if (!(this.value instanceof StringType))
3158        throw new FHIRException("Type mismatch: the type StringType was expected, but "
3159            + this.value.getClass().getName() + " was encountered");
3160      return (StringType) this.value;
3161    }
3162
3163    public boolean hasValueStringType() {
3164      return this != null && this.value instanceof StringType;
3165    }
3166
3167    /**
3168     * @return {@link #value} (A potential answer that's allowed as the answer to
3169     *         this question.)
3170     */
3171    public Coding getValueCoding() throws FHIRException {
3172      if (this.value == null)
3173        this.value = new Coding();
3174      if (!(this.value instanceof Coding))
3175        throw new FHIRException(
3176            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
3177      return (Coding) this.value;
3178    }
3179
3180    public boolean hasValueCoding() {
3181      return this != null && this.value instanceof Coding;
3182    }
3183
3184    /**
3185     * @return {@link #value} (A potential answer that's allowed as the answer to
3186     *         this question.)
3187     */
3188    public Reference getValueReference() throws FHIRException {
3189      if (this.value == null)
3190        this.value = new Reference();
3191      if (!(this.value instanceof Reference))
3192        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
3193            + " was encountered");
3194      return (Reference) this.value;
3195    }
3196
3197    public boolean hasValueReference() {
3198      return this != null && this.value instanceof Reference;
3199    }
3200
3201    public boolean hasValue() {
3202      return this.value != null && !this.value.isEmpty();
3203    }
3204
3205    /**
3206     * @param value {@link #value} (A potential answer that's allowed as the answer
3207     *              to this question.)
3208     */
3209    public QuestionnaireItemAnswerOptionComponent setValue(Type value) {
3210      if (value != null && !(value instanceof IntegerType || value instanceof DateType || value instanceof TimeType
3211          || value instanceof StringType || value instanceof Coding || value instanceof Reference))
3212        throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: " + value.fhirType());
3213      this.value = value;
3214      return this;
3215    }
3216
3217    /**
3218     * @return {@link #initialSelected} (Indicates whether the answer value is
3219     *         selected when the list of possible answers is initially shown.). This
3220     *         is the underlying object with id, value and extensions. The accessor
3221     *         "getInitialSelected" gives direct access to the value
3222     */
3223    public BooleanType getInitialSelectedElement() {
3224      if (this.initialSelected == null)
3225        if (Configuration.errorOnAutoCreate())
3226          throw new Error("Attempt to auto-create QuestionnaireItemAnswerOptionComponent.initialSelected");
3227        else if (Configuration.doAutoCreate())
3228          this.initialSelected = new BooleanType(); // bb
3229      return this.initialSelected;
3230    }
3231
3232    public boolean hasInitialSelectedElement() {
3233      return this.initialSelected != null && !this.initialSelected.isEmpty();
3234    }
3235
3236    public boolean hasInitialSelected() {
3237      return this.initialSelected != null && !this.initialSelected.isEmpty();
3238    }
3239
3240    /**
3241     * @param value {@link #initialSelected} (Indicates whether the answer value is
3242     *              selected when the list of possible answers is initially shown.).
3243     *              This is the underlying object with id, value and extensions. The
3244     *              accessor "getInitialSelected" gives direct access to the value
3245     */
3246    public QuestionnaireItemAnswerOptionComponent setInitialSelectedElement(BooleanType value) {
3247      this.initialSelected = value;
3248      return this;
3249    }
3250
3251    /**
3252     * @return Indicates whether the answer value is selected when the list of
3253     *         possible answers is initially shown.
3254     */
3255    public boolean getInitialSelected() {
3256      return this.initialSelected == null || this.initialSelected.isEmpty() ? false : this.initialSelected.getValue();
3257    }
3258
3259    /**
3260     * @param value Indicates whether the answer value is selected when the list of
3261     *              possible answers is initially shown.
3262     */
3263    public QuestionnaireItemAnswerOptionComponent setInitialSelected(boolean value) {
3264      if (this.initialSelected == null)
3265        this.initialSelected = new BooleanType();
3266      this.initialSelected.setValue(value);
3267      return this;
3268    }
3269
3270    protected void listChildren(List<Property> children) {
3271      super.listChildren(children);
3272      children.add(new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3273          "A potential answer that's allowed as the answer to this question.", 0, 1, value));
3274      children.add(new Property("initialSelected", "boolean",
3275          "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1,
3276          initialSelected));
3277    }
3278
3279    @Override
3280    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3281      switch (_hash) {
3282      case -1410166417:
3283        /* value[x] */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3284            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3285      case 111972721:
3286        /* value */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3287            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3288      case -1668204915:
3289        /* valueInteger */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3290            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3291      case -766192449:
3292        /* valueDate */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3293            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3294      case -765708322:
3295        /* valueTime */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3296            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3297      case -1424603934:
3298        /* valueString */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3299            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3300      case -1887705029:
3301        /* valueCoding */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3302            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3303      case 1755241690:
3304        /* valueReference */ return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)",
3305            "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3306      case -1310184961:
3307        /* initialSelected */ return new Property("initialSelected", "boolean",
3308            "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0,
3309            1, initialSelected);
3310      default:
3311        return super.getNamedProperty(_hash, _name, _checkValid);
3312      }
3313
3314    }
3315
3316    @Override
3317    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3318      switch (hash) {
3319      case 111972721:
3320        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
3321      case -1310184961:
3322        /* initialSelected */ return this.initialSelected == null ? new Base[0] : new Base[] { this.initialSelected }; // BooleanType
3323      default:
3324        return super.getProperty(hash, name, checkValid);
3325      }
3326
3327    }
3328
3329    @Override
3330    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3331      switch (hash) {
3332      case 111972721: // value
3333        this.value = castToType(value); // Type
3334        return value;
3335      case -1310184961: // initialSelected
3336        this.initialSelected = castToBoolean(value); // BooleanType
3337        return value;
3338      default:
3339        return super.setProperty(hash, name, value);
3340      }
3341
3342    }
3343
3344    @Override
3345    public Base setProperty(String name, Base value) throws FHIRException {
3346      if (name.equals("value[x]")) {
3347        this.value = castToType(value); // Type
3348      } else if (name.equals("initialSelected")) {
3349        this.initialSelected = castToBoolean(value); // BooleanType
3350      } else
3351        return super.setProperty(name, value);
3352      return value;
3353    }
3354
3355    @Override
3356    public Base makeProperty(int hash, String name) throws FHIRException {
3357      switch (hash) {
3358      case -1410166417:
3359        return getValue();
3360      case 111972721:
3361        return getValue();
3362      case -1310184961:
3363        return getInitialSelectedElement();
3364      default:
3365        return super.makeProperty(hash, name);
3366      }
3367
3368    }
3369
3370    @Override
3371    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3372      switch (hash) {
3373      case 111972721:
3374        /* value */ return new String[] { "integer", "date", "time", "string", "Coding", "Reference" };
3375      case -1310184961:
3376        /* initialSelected */ return new String[] { "boolean" };
3377      default:
3378        return super.getTypesForProperty(hash, name);
3379      }
3380
3381    }
3382
3383    @Override
3384    public Base addChild(String name) throws FHIRException {
3385      if (name.equals("valueInteger")) {
3386        this.value = new IntegerType();
3387        return this.value;
3388      } else if (name.equals("valueDate")) {
3389        this.value = new DateType();
3390        return this.value;
3391      } else if (name.equals("valueTime")) {
3392        this.value = new TimeType();
3393        return this.value;
3394      } else if (name.equals("valueString")) {
3395        this.value = new StringType();
3396        return this.value;
3397      } else if (name.equals("valueCoding")) {
3398        this.value = new Coding();
3399        return this.value;
3400      } else if (name.equals("valueReference")) {
3401        this.value = new Reference();
3402        return this.value;
3403      } else if (name.equals("initialSelected")) {
3404        throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.initialSelected");
3405      } else
3406        return super.addChild(name);
3407    }
3408
3409    public QuestionnaireItemAnswerOptionComponent copy() {
3410      QuestionnaireItemAnswerOptionComponent dst = new QuestionnaireItemAnswerOptionComponent();
3411      copyValues(dst);
3412      return dst;
3413    }
3414
3415    public void copyValues(QuestionnaireItemAnswerOptionComponent dst) {
3416      super.copyValues(dst);
3417      dst.value = value == null ? null : value.copy();
3418      dst.initialSelected = initialSelected == null ? null : initialSelected.copy();
3419    }
3420
3421    @Override
3422    public boolean equalsDeep(Base other_) {
3423      if (!super.equalsDeep(other_))
3424        return false;
3425      if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
3426        return false;
3427      QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
3428      return compareDeep(value, o.value, true) && compareDeep(initialSelected, o.initialSelected, true);
3429    }
3430
3431    @Override
3432    public boolean equalsShallow(Base other_) {
3433      if (!super.equalsShallow(other_))
3434        return false;
3435      if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
3436        return false;
3437      QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
3438      return compareValues(initialSelected, o.initialSelected, true);
3439    }
3440
3441    public boolean isEmpty() {
3442      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, initialSelected);
3443    }
3444
3445    public String fhirType() {
3446      return "Questionnaire.item.answerOption";
3447
3448    }
3449
3450  }
3451
3452  @Block()
3453  public static class QuestionnaireItemInitialComponent extends BackboneElement implements IBaseBackboneElement {
3454    /**
3455     * The actual value to for an initial answer.
3456     */
3457    @Child(name = "value", type = { BooleanType.class, DecimalType.class, IntegerType.class, DateType.class,
3458        DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class,
3459        Quantity.class, Reference.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3460    @Description(shortDefinition = "Actual value for initializing the question", formalDefinition = "The actual value to for an initial answer.")
3461    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-answers")
3462    protected Type value;
3463
3464    private static final long serialVersionUID = -732981989L;
3465
3466    /**
3467     * Constructor
3468     */
3469    public QuestionnaireItemInitialComponent() {
3470      super();
3471    }
3472
3473    /**
3474     * Constructor
3475     */
3476    public QuestionnaireItemInitialComponent(Type value) {
3477      super();
3478      this.value = value;
3479    }
3480
3481    /**
3482     * @return {@link #value} (The actual value to for an initial answer.)
3483     */
3484    public Type getValue() {
3485      return this.value;
3486    }
3487
3488    /**
3489     * @return {@link #value} (The actual value to for an initial answer.)
3490     */
3491    public BooleanType getValueBooleanType() throws FHIRException {
3492      if (this.value == null)
3493        this.value = new BooleanType();
3494      if (!(this.value instanceof BooleanType))
3495        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "
3496            + this.value.getClass().getName() + " was encountered");
3497      return (BooleanType) this.value;
3498    }
3499
3500    public boolean hasValueBooleanType() {
3501      return this != null && this.value instanceof BooleanType;
3502    }
3503
3504    /**
3505     * @return {@link #value} (The actual value to for an initial answer.)
3506     */
3507    public DecimalType getValueDecimalType() throws FHIRException {
3508      if (this.value == null)
3509        this.value = new DecimalType();
3510      if (!(this.value instanceof DecimalType))
3511        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "
3512            + this.value.getClass().getName() + " was encountered");
3513      return (DecimalType) this.value;
3514    }
3515
3516    public boolean hasValueDecimalType() {
3517      return this != null && this.value instanceof DecimalType;
3518    }
3519
3520    /**
3521     * @return {@link #value} (The actual value to for an initial answer.)
3522     */
3523    public IntegerType getValueIntegerType() throws FHIRException {
3524      if (this.value == null)
3525        this.value = new IntegerType();
3526      if (!(this.value instanceof IntegerType))
3527        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "
3528            + this.value.getClass().getName() + " was encountered");
3529      return (IntegerType) this.value;
3530    }
3531
3532    public boolean hasValueIntegerType() {
3533      return this != null && this.value instanceof IntegerType;
3534    }
3535
3536    /**
3537     * @return {@link #value} (The actual value to for an initial answer.)
3538     */
3539    public DateType getValueDateType() throws FHIRException {
3540      if (this.value == null)
3541        this.value = new DateType();
3542      if (!(this.value instanceof DateType))
3543        throw new FHIRException("Type mismatch: the type DateType was expected, but " + this.value.getClass().getName()
3544            + " was encountered");
3545      return (DateType) this.value;
3546    }
3547
3548    public boolean hasValueDateType() {
3549      return this != null && this.value instanceof DateType;
3550    }
3551
3552    /**
3553     * @return {@link #value} (The actual value to for an initial answer.)
3554     */
3555    public DateTimeType getValueDateTimeType() throws FHIRException {
3556      if (this.value == null)
3557        this.value = new DateTimeType();
3558      if (!(this.value instanceof DateTimeType))
3559        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
3560            + this.value.getClass().getName() + " was encountered");
3561      return (DateTimeType) this.value;
3562    }
3563
3564    public boolean hasValueDateTimeType() {
3565      return this != null && this.value instanceof DateTimeType;
3566    }
3567
3568    /**
3569     * @return {@link #value} (The actual value to for an initial answer.)
3570     */
3571    public TimeType getValueTimeType() throws FHIRException {
3572      if (this.value == null)
3573        this.value = new TimeType();
3574      if (!(this.value instanceof TimeType))
3575        throw new FHIRException("Type mismatch: the type TimeType was expected, but " + this.value.getClass().getName()
3576            + " was encountered");
3577      return (TimeType) this.value;
3578    }
3579
3580    public boolean hasValueTimeType() {
3581      return this != null && this.value instanceof TimeType;
3582    }
3583
3584    /**
3585     * @return {@link #value} (The actual value to for an initial answer.)
3586     */
3587    public StringType getValueStringType() throws FHIRException {
3588      if (this.value == null)
3589        this.value = new StringType();
3590      if (!(this.value instanceof StringType))
3591        throw new FHIRException("Type mismatch: the type StringType was expected, but "
3592            + this.value.getClass().getName() + " was encountered");
3593      return (StringType) this.value;
3594    }
3595
3596    public boolean hasValueStringType() {
3597      return this != null && this.value instanceof StringType;
3598    }
3599
3600    /**
3601     * @return {@link #value} (The actual value to for an initial answer.)
3602     */
3603    public UriType getValueUriType() throws FHIRException {
3604      if (this.value == null)
3605        this.value = new UriType();
3606      if (!(this.value instanceof UriType))
3607        throw new FHIRException("Type mismatch: the type UriType was expected, but " + this.value.getClass().getName()
3608            + " was encountered");
3609      return (UriType) this.value;
3610    }
3611
3612    public boolean hasValueUriType() {
3613      return this != null && this.value instanceof UriType;
3614    }
3615
3616    /**
3617     * @return {@link #value} (The actual value to for an initial answer.)
3618     */
3619    public Attachment getValueAttachment() throws FHIRException {
3620      if (this.value == null)
3621        this.value = new Attachment();
3622      if (!(this.value instanceof Attachment))
3623        throw new FHIRException("Type mismatch: the type Attachment was expected, but "
3624            + this.value.getClass().getName() + " was encountered");
3625      return (Attachment) this.value;
3626    }
3627
3628    public boolean hasValueAttachment() {
3629      return this != null && this.value instanceof Attachment;
3630    }
3631
3632    /**
3633     * @return {@link #value} (The actual value to for an initial answer.)
3634     */
3635    public Coding getValueCoding() throws FHIRException {
3636      if (this.value == null)
3637        this.value = new Coding();
3638      if (!(this.value instanceof Coding))
3639        throw new FHIRException(
3640            "Type mismatch: the type Coding was expected, but " + this.value.getClass().getName() + " was encountered");
3641      return (Coding) this.value;
3642    }
3643
3644    public boolean hasValueCoding() {
3645      return this != null && this.value instanceof Coding;
3646    }
3647
3648    /**
3649     * @return {@link #value} (The actual value to for an initial answer.)
3650     */
3651    public Quantity getValueQuantity() throws FHIRException {
3652      if (this.value == null)
3653        this.value = new Quantity();
3654      if (!(this.value instanceof Quantity))
3655        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
3656            + " was encountered");
3657      return (Quantity) this.value;
3658    }
3659
3660    public boolean hasValueQuantity() {
3661      return this != null && this.value instanceof Quantity;
3662    }
3663
3664    /**
3665     * @return {@link #value} (The actual value to for an initial answer.)
3666     */
3667    public Reference getValueReference() throws FHIRException {
3668      if (this.value == null)
3669        this.value = new Reference();
3670      if (!(this.value instanceof Reference))
3671        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.value.getClass().getName()
3672            + " was encountered");
3673      return (Reference) this.value;
3674    }
3675
3676    public boolean hasValueReference() {
3677      return this != null && this.value instanceof Reference;
3678    }
3679
3680    public boolean hasValue() {
3681      return this.value != null && !this.value.isEmpty();
3682    }
3683
3684    /**
3685     * @param value {@link #value} (The actual value to for an initial answer.)
3686     */
3687    public QuestionnaireItemInitialComponent setValue(Type value) {
3688      if (value != null
3689          && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType
3690              || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType
3691              || value instanceof StringType || value instanceof UriType || value instanceof Attachment
3692              || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
3693        throw new Error("Not the right type for Questionnaire.item.initial.value[x]: " + value.fhirType());
3694      this.value = value;
3695      return this;
3696    }
3697
3698    protected void listChildren(List<Property> children) {
3699      super.listChildren(children);
3700      children.add(new Property("value[x]",
3701          "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3702          "The actual value to for an initial answer.", 0, 1, value));
3703    }
3704
3705    @Override
3706    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3707      switch (_hash) {
3708      case -1410166417:
3709        /* value[x] */ return new Property("value[x]",
3710            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3711            "The actual value to for an initial answer.", 0, 1, value);
3712      case 111972721:
3713        /* value */ return new Property("value[x]",
3714            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3715            "The actual value to for an initial answer.", 0, 1, value);
3716      case 733421943:
3717        /* valueBoolean */ return new Property("value[x]",
3718            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3719            "The actual value to for an initial answer.", 0, 1, value);
3720      case -2083993440:
3721        /* valueDecimal */ return new Property("value[x]",
3722            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3723            "The actual value to for an initial answer.", 0, 1, value);
3724      case -1668204915:
3725        /* valueInteger */ return new Property("value[x]",
3726            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3727            "The actual value to for an initial answer.", 0, 1, value);
3728      case -766192449:
3729        /* valueDate */ return new Property("value[x]",
3730            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3731            "The actual value to for an initial answer.", 0, 1, value);
3732      case 1047929900:
3733        /* valueDateTime */ return new Property("value[x]",
3734            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3735            "The actual value to for an initial answer.", 0, 1, value);
3736      case -765708322:
3737        /* valueTime */ return new Property("value[x]",
3738            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3739            "The actual value to for an initial answer.", 0, 1, value);
3740      case -1424603934:
3741        /* valueString */ return new Property("value[x]",
3742            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3743            "The actual value to for an initial answer.", 0, 1, value);
3744      case -1410172357:
3745        /* valueUri */ return new Property("value[x]",
3746            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3747            "The actual value to for an initial answer.", 0, 1, value);
3748      case -475566732:
3749        /* valueAttachment */ return new Property("value[x]",
3750            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3751            "The actual value to for an initial answer.", 0, 1, value);
3752      case -1887705029:
3753        /* valueCoding */ return new Property("value[x]",
3754            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3755            "The actual value to for an initial answer.", 0, 1, value);
3756      case -2029823716:
3757        /* valueQuantity */ return new Property("value[x]",
3758            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3759            "The actual value to for an initial answer.", 0, 1, value);
3760      case 1755241690:
3761        /* valueReference */ return new Property("value[x]",
3762            "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)",
3763            "The actual value to for an initial answer.", 0, 1, value);
3764      default:
3765        return super.getNamedProperty(_hash, _name, _checkValid);
3766      }
3767
3768    }
3769
3770    @Override
3771    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3772      switch (hash) {
3773      case 111972721:
3774        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
3775      default:
3776        return super.getProperty(hash, name, checkValid);
3777      }
3778
3779    }
3780
3781    @Override
3782    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3783      switch (hash) {
3784      case 111972721: // value
3785        this.value = castToType(value); // Type
3786        return value;
3787      default:
3788        return super.setProperty(hash, name, value);
3789      }
3790
3791    }
3792
3793    @Override
3794    public Base setProperty(String name, Base value) throws FHIRException {
3795      if (name.equals("value[x]")) {
3796        this.value = castToType(value); // Type
3797      } else
3798        return super.setProperty(name, value);
3799      return value;
3800    }
3801
3802    @Override
3803    public Base makeProperty(int hash, String name) throws FHIRException {
3804      switch (hash) {
3805      case -1410166417:
3806        return getValue();
3807      case 111972721:
3808        return getValue();
3809      default:
3810        return super.makeProperty(hash, name);
3811      }
3812
3813    }
3814
3815    @Override
3816    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3817      switch (hash) {
3818      case 111972721:
3819        /* value */ return new String[] { "boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri",
3820            "Attachment", "Coding", "Quantity", "Reference" };
3821      default:
3822        return super.getTypesForProperty(hash, name);
3823      }
3824
3825    }
3826
3827    @Override
3828    public Base addChild(String name) throws FHIRException {
3829      if (name.equals("valueBoolean")) {
3830        this.value = new BooleanType();
3831        return this.value;
3832      } else if (name.equals("valueDecimal")) {
3833        this.value = new DecimalType();
3834        return this.value;
3835      } else if (name.equals("valueInteger")) {
3836        this.value = new IntegerType();
3837        return this.value;
3838      } else if (name.equals("valueDate")) {
3839        this.value = new DateType();
3840        return this.value;
3841      } else if (name.equals("valueDateTime")) {
3842        this.value = new DateTimeType();
3843        return this.value;
3844      } else if (name.equals("valueTime")) {
3845        this.value = new TimeType();
3846        return this.value;
3847      } else if (name.equals("valueString")) {
3848        this.value = new StringType();
3849        return this.value;
3850      } else if (name.equals("valueUri")) {
3851        this.value = new UriType();
3852        return this.value;
3853      } else if (name.equals("valueAttachment")) {
3854        this.value = new Attachment();
3855        return this.value;
3856      } else if (name.equals("valueCoding")) {
3857        this.value = new Coding();
3858        return this.value;
3859      } else if (name.equals("valueQuantity")) {
3860        this.value = new Quantity();
3861        return this.value;
3862      } else if (name.equals("valueReference")) {
3863        this.value = new Reference();
3864        return this.value;
3865      } else
3866        return super.addChild(name);
3867    }
3868
3869    public QuestionnaireItemInitialComponent copy() {
3870      QuestionnaireItemInitialComponent dst = new QuestionnaireItemInitialComponent();
3871      copyValues(dst);
3872      return dst;
3873    }
3874
3875    public void copyValues(QuestionnaireItemInitialComponent dst) {
3876      super.copyValues(dst);
3877      dst.value = value == null ? null : value.copy();
3878    }
3879
3880    @Override
3881    public boolean equalsDeep(Base other_) {
3882      if (!super.equalsDeep(other_))
3883        return false;
3884      if (!(other_ instanceof QuestionnaireItemInitialComponent))
3885        return false;
3886      QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3887      return compareDeep(value, o.value, true);
3888    }
3889
3890    @Override
3891    public boolean equalsShallow(Base other_) {
3892      if (!super.equalsShallow(other_))
3893        return false;
3894      if (!(other_ instanceof QuestionnaireItemInitialComponent))
3895        return false;
3896      QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3897      return true;
3898    }
3899
3900    public boolean isEmpty() {
3901      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3902    }
3903
3904    public String fhirType() {
3905      return "Questionnaire.item.initial";
3906
3907    }
3908
3909  }
3910
3911  /**
3912   * A formal identifier that is used to identify this questionnaire when it is
3913   * represented in other formats, or referenced in a specification, model, design
3914   * or an instance.
3915   */
3916  @Child(name = "identifier", type = {
3917      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3918  @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.")
3919  protected List<Identifier> identifier;
3920
3921  /**
3922   * The URL of a Questionnaire that this Questionnaire is based on.
3923   */
3924  @Child(name = "derivedFrom", type = {
3925      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3926  @Description(shortDefinition = "Instantiates protocol or definition", formalDefinition = "The URL of a Questionnaire that this Questionnaire is based on.")
3927  protected List<CanonicalType> derivedFrom;
3928
3929  /**
3930   * The types of subjects that can be the subject of responses created for the
3931   * questionnaire.
3932   */
3933  @Child(name = "subjectType", type = {
3934      CodeType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3935  @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.")
3936  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/resource-types")
3937  protected List<CodeType> subjectType;
3938
3939  /**
3940   * Explanation of why this questionnaire is needed and why it has been designed
3941   * as it has.
3942   */
3943  @Child(name = "purpose", type = {
3944      MarkdownType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
3945  @Description(shortDefinition = "Why this questionnaire is defined", formalDefinition = "Explanation of why this questionnaire is needed and why it has been designed as it has.")
3946  protected MarkdownType purpose;
3947
3948  /**
3949   * A copyright statement relating to the questionnaire and/or its contents.
3950   * Copyright statements are generally legal restrictions on the use and
3951   * publishing of the questionnaire.
3952   */
3953  @Child(name = "copyright", type = {
3954      MarkdownType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
3955  @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.")
3956  protected MarkdownType copyright;
3957
3958  /**
3959   * The date on which the resource content was approved by the publisher.
3960   * Approval happens once when the content is officially approved for usage.
3961   */
3962  @Child(name = "approvalDate", type = {
3963      DateType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
3964  @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.")
3965  protected DateType approvalDate;
3966
3967  /**
3968   * The date on which the resource content was last reviewed. Review happens
3969   * periodically after approval but does not change the original approval date.
3970   */
3971  @Child(name = "lastReviewDate", type = {
3972      DateType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
3973  @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.")
3974  protected DateType lastReviewDate;
3975
3976  /**
3977   * The period during which the questionnaire content was or is planned to be in
3978   * active use.
3979   */
3980  @Child(name = "effectivePeriod", type = {
3981      Period.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
3982  @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.")
3983  protected Period effectivePeriod;
3984
3985  /**
3986   * An identifier for this question or group of questions in a particular
3987   * terminology such as LOINC.
3988   */
3989  @Child(name = "code", type = {
3990      Coding.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3991  @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.")
3992  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/questionnaire-questions")
3993  protected List<Coding> code;
3994
3995  /**
3996   * A particular question, question grouping or display text that is part of the
3997   * questionnaire.
3998   */
3999  @Child(name = "item", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4000  @Description(shortDefinition = "Questions and sections within the Questionnaire", formalDefinition = "A particular question, question grouping or display text that is part of the questionnaire.")
4001  protected List<QuestionnaireItemComponent> item;
4002
4003  private static final long serialVersionUID = 1036031192L;
4004
4005  /**
4006   * Constructor
4007   */
4008  public Questionnaire() {
4009    super();
4010  }
4011
4012  /**
4013   * Constructor
4014   */
4015  public Questionnaire(Enumeration<PublicationStatus> status) {
4016    super();
4017    this.status = status;
4018  }
4019
4020  /**
4021   * @return {@link #url} (An absolute URI that is used to identify this
4022   *         questionnaire when it is referenced in a specification, model, design
4023   *         or an instance; also called its canonical identifier. This SHOULD be
4024   *         globally unique and SHOULD be a literal address at which at which an
4025   *         authoritative instance of this questionnaire is (or will be)
4026   *         published. This URL can be the target of a canonical reference. It
4027   *         SHALL remain the same when the questionnaire is stored on different
4028   *         servers.). This is the underlying object with id, value and
4029   *         extensions. The accessor "getUrl" gives direct access to the value
4030   */
4031  public UriType getUrlElement() {
4032    if (this.url == null)
4033      if (Configuration.errorOnAutoCreate())
4034        throw new Error("Attempt to auto-create Questionnaire.url");
4035      else if (Configuration.doAutoCreate())
4036        this.url = new UriType(); // bb
4037    return this.url;
4038  }
4039
4040  public boolean hasUrlElement() {
4041    return this.url != null && !this.url.isEmpty();
4042  }
4043
4044  public boolean hasUrl() {
4045    return this.url != null && !this.url.isEmpty();
4046  }
4047
4048  /**
4049   * @param value {@link #url} (An absolute URI that is used to identify this
4050   *              questionnaire when it is referenced in a specification, model,
4051   *              design or an instance; also called its canonical identifier.
4052   *              This SHOULD be globally unique and SHOULD be a literal address
4053   *              at which at which an authoritative instance of this
4054   *              questionnaire is (or will be) published. This URL can be the
4055   *              target of a canonical reference. It SHALL remain the same when
4056   *              the questionnaire is stored on different servers.). This is the
4057   *              underlying object with id, value and extensions. The accessor
4058   *              "getUrl" gives direct access to the value
4059   */
4060  public Questionnaire setUrlElement(UriType value) {
4061    this.url = value;
4062    return this;
4063  }
4064
4065  /**
4066   * @return An absolute URI that is used to identify this questionnaire when it
4067   *         is referenced in a specification, model, design or an instance; also
4068   *         called its canonical identifier. This SHOULD be globally unique and
4069   *         SHOULD be a literal address at which at which an authoritative
4070   *         instance of this questionnaire is (or will be) published. This URL
4071   *         can be the target of a canonical reference. It SHALL remain the same
4072   *         when the questionnaire is stored on different servers.
4073   */
4074  public String getUrl() {
4075    return this.url == null ? null : this.url.getValue();
4076  }
4077
4078  /**
4079   * @param value An absolute URI that is used to identify this questionnaire when
4080   *              it is referenced in a specification, model, design or an
4081   *              instance; also called its canonical identifier. This SHOULD be
4082   *              globally unique and SHOULD be a literal address at which at
4083   *              which an authoritative instance of this questionnaire is (or
4084   *              will be) published. This URL can be the target of a canonical
4085   *              reference. It SHALL remain the same when the questionnaire is
4086   *              stored on different servers.
4087   */
4088  public Questionnaire setUrl(String value) {
4089    if (Utilities.noString(value))
4090      this.url = null;
4091    else {
4092      if (this.url == null)
4093        this.url = new UriType();
4094      this.url.setValue(value);
4095    }
4096    return this;
4097  }
4098
4099  /**
4100   * @return {@link #identifier} (A formal identifier that is used to identify
4101   *         this questionnaire when it is represented in other formats, or
4102   *         referenced in a specification, model, design or an instance.)
4103   */
4104  public List<Identifier> getIdentifier() {
4105    if (this.identifier == null)
4106      this.identifier = new ArrayList<Identifier>();
4107    return this.identifier;
4108  }
4109
4110  /**
4111   * @return Returns a reference to <code>this</code> for easy method chaining
4112   */
4113  public Questionnaire setIdentifier(List<Identifier> theIdentifier) {
4114    this.identifier = theIdentifier;
4115    return this;
4116  }
4117
4118  public boolean hasIdentifier() {
4119    if (this.identifier == null)
4120      return false;
4121    for (Identifier item : this.identifier)
4122      if (!item.isEmpty())
4123        return true;
4124    return false;
4125  }
4126
4127  public Identifier addIdentifier() { // 3
4128    Identifier t = new Identifier();
4129    if (this.identifier == null)
4130      this.identifier = new ArrayList<Identifier>();
4131    this.identifier.add(t);
4132    return t;
4133  }
4134
4135  public Questionnaire addIdentifier(Identifier t) { // 3
4136    if (t == null)
4137      return this;
4138    if (this.identifier == null)
4139      this.identifier = new ArrayList<Identifier>();
4140    this.identifier.add(t);
4141    return this;
4142  }
4143
4144  /**
4145   * @return The first repetition of repeating field {@link #identifier}, creating
4146   *         it if it does not already exist
4147   */
4148  public Identifier getIdentifierFirstRep() {
4149    if (getIdentifier().isEmpty()) {
4150      addIdentifier();
4151    }
4152    return getIdentifier().get(0);
4153  }
4154
4155  /**
4156   * @return {@link #version} (The identifier that is used to identify this
4157   *         version of the questionnaire when it is referenced in a
4158   *         specification, model, design or instance. This is an arbitrary value
4159   *         managed by the questionnaire author and is not expected to be
4160   *         globally unique. For example, it might be a timestamp (e.g. yyyymmdd)
4161   *         if a managed version is not available. There is also no expectation
4162   *         that versions can be placed in a lexicographical sequence.). This is
4163   *         the underlying object with id, value and extensions. The accessor
4164   *         "getVersion" gives direct access to the value
4165   */
4166  public StringType getVersionElement() {
4167    if (this.version == null)
4168      if (Configuration.errorOnAutoCreate())
4169        throw new Error("Attempt to auto-create Questionnaire.version");
4170      else if (Configuration.doAutoCreate())
4171        this.version = new StringType(); // bb
4172    return this.version;
4173  }
4174
4175  public boolean hasVersionElement() {
4176    return this.version != null && !this.version.isEmpty();
4177  }
4178
4179  public boolean hasVersion() {
4180    return this.version != null && !this.version.isEmpty();
4181  }
4182
4183  /**
4184   * @param value {@link #version} (The identifier that is used to identify this
4185   *              version of the questionnaire when it is referenced in a
4186   *              specification, model, design or instance. This is an arbitrary
4187   *              value managed by the questionnaire author and is not expected to
4188   *              be globally unique. For example, it might be a timestamp (e.g.
4189   *              yyyymmdd) if a managed version is not available. There is also
4190   *              no expectation that versions can be placed in a lexicographical
4191   *              sequence.). This is the underlying object with id, value and
4192   *              extensions. The accessor "getVersion" gives direct access to the
4193   *              value
4194   */
4195  public Questionnaire setVersionElement(StringType value) {
4196    this.version = value;
4197    return this;
4198  }
4199
4200  /**
4201   * @return The identifier that is used to identify this version of the
4202   *         questionnaire when it is referenced in a specification, model, design
4203   *         or instance. This is an arbitrary value managed by the questionnaire
4204   *         author and is not expected to be globally unique. For example, it
4205   *         might be a timestamp (e.g. yyyymmdd) if a managed version is not
4206   *         available. There is also no expectation that versions can be placed
4207   *         in a lexicographical sequence.
4208   */
4209  public String getVersion() {
4210    return this.version == null ? null : this.version.getValue();
4211  }
4212
4213  /**
4214   * @param value The identifier that is used to identify this version of the
4215   *              questionnaire when it is referenced in a specification, model,
4216   *              design or instance. This is an arbitrary value managed by the
4217   *              questionnaire author and is not expected to be globally unique.
4218   *              For example, it might be a timestamp (e.g. yyyymmdd) if a
4219   *              managed version is not available. There is also no expectation
4220   *              that versions can be placed in a lexicographical sequence.
4221   */
4222  public Questionnaire setVersion(String value) {
4223    if (Utilities.noString(value))
4224      this.version = null;
4225    else {
4226      if (this.version == null)
4227        this.version = new StringType();
4228      this.version.setValue(value);
4229    }
4230    return this;
4231  }
4232
4233  /**
4234   * @return {@link #name} (A natural language name identifying the questionnaire.
4235   *         This name should be usable as an identifier for the module by machine
4236   *         processing applications such as code generation.). This is the
4237   *         underlying object with id, value and extensions. The accessor
4238   *         "getName" gives direct access to the value
4239   */
4240  public StringType getNameElement() {
4241    if (this.name == null)
4242      if (Configuration.errorOnAutoCreate())
4243        throw new Error("Attempt to auto-create Questionnaire.name");
4244      else if (Configuration.doAutoCreate())
4245        this.name = new StringType(); // bb
4246    return this.name;
4247  }
4248
4249  public boolean hasNameElement() {
4250    return this.name != null && !this.name.isEmpty();
4251  }
4252
4253  public boolean hasName() {
4254    return this.name != null && !this.name.isEmpty();
4255  }
4256
4257  /**
4258   * @param value {@link #name} (A natural language name identifying the
4259   *              questionnaire. This name should be usable as an identifier for
4260   *              the module by machine processing applications such as code
4261   *              generation.). This is the underlying object with id, value and
4262   *              extensions. The accessor "getName" gives direct access to the
4263   *              value
4264   */
4265  public Questionnaire setNameElement(StringType value) {
4266    this.name = value;
4267    return this;
4268  }
4269
4270  /**
4271   * @return A natural language name identifying the questionnaire. This name
4272   *         should be usable as an identifier for the module by machine
4273   *         processing applications such as code generation.
4274   */
4275  public String getName() {
4276    return this.name == null ? null : this.name.getValue();
4277  }
4278
4279  /**
4280   * @param value A natural language name identifying the questionnaire. This name
4281   *              should be usable as an identifier for the module by machine
4282   *              processing applications such as code generation.
4283   */
4284  public Questionnaire setName(String value) {
4285    if (Utilities.noString(value))
4286      this.name = null;
4287    else {
4288      if (this.name == null)
4289        this.name = new StringType();
4290      this.name.setValue(value);
4291    }
4292    return this;
4293  }
4294
4295  /**
4296   * @return {@link #title} (A short, descriptive, user-friendly title for the
4297   *         questionnaire.). This is the underlying object with id, value and
4298   *         extensions. The accessor "getTitle" gives direct access to the value
4299   */
4300  public StringType getTitleElement() {
4301    if (this.title == null)
4302      if (Configuration.errorOnAutoCreate())
4303        throw new Error("Attempt to auto-create Questionnaire.title");
4304      else if (Configuration.doAutoCreate())
4305        this.title = new StringType(); // bb
4306    return this.title;
4307  }
4308
4309  public boolean hasTitleElement() {
4310    return this.title != null && !this.title.isEmpty();
4311  }
4312
4313  public boolean hasTitle() {
4314    return this.title != null && !this.title.isEmpty();
4315  }
4316
4317  /**
4318   * @param value {@link #title} (A short, descriptive, user-friendly title for
4319   *              the questionnaire.). This is the underlying object with id,
4320   *              value and extensions. The accessor "getTitle" gives direct
4321   *              access to the value
4322   */
4323  public Questionnaire setTitleElement(StringType value) {
4324    this.title = value;
4325    return this;
4326  }
4327
4328  /**
4329   * @return A short, descriptive, user-friendly title for the questionnaire.
4330   */
4331  public String getTitle() {
4332    return this.title == null ? null : this.title.getValue();
4333  }
4334
4335  /**
4336   * @param value A short, descriptive, user-friendly title for the questionnaire.
4337   */
4338  public Questionnaire setTitle(String value) {
4339    if (Utilities.noString(value))
4340      this.title = null;
4341    else {
4342      if (this.title == null)
4343        this.title = new StringType();
4344      this.title.setValue(value);
4345    }
4346    return this;
4347  }
4348
4349  /**
4350   * @return {@link #derivedFrom} (The URL of a Questionnaire that this
4351   *         Questionnaire is based on.)
4352   */
4353  public List<CanonicalType> getDerivedFrom() {
4354    if (this.derivedFrom == null)
4355      this.derivedFrom = new ArrayList<CanonicalType>();
4356    return this.derivedFrom;
4357  }
4358
4359  /**
4360   * @return Returns a reference to <code>this</code> for easy method chaining
4361   */
4362  public Questionnaire setDerivedFrom(List<CanonicalType> theDerivedFrom) {
4363    this.derivedFrom = theDerivedFrom;
4364    return this;
4365  }
4366
4367  public boolean hasDerivedFrom() {
4368    if (this.derivedFrom == null)
4369      return false;
4370    for (CanonicalType item : this.derivedFrom)
4371      if (!item.isEmpty())
4372        return true;
4373    return false;
4374  }
4375
4376  /**
4377   * @return {@link #derivedFrom} (The URL of a Questionnaire that this
4378   *         Questionnaire is based on.)
4379   */
4380  public CanonicalType addDerivedFromElement() {// 2
4381    CanonicalType t = new CanonicalType();
4382    if (this.derivedFrom == null)
4383      this.derivedFrom = new ArrayList<CanonicalType>();
4384    this.derivedFrom.add(t);
4385    return t;
4386  }
4387
4388  /**
4389   * @param value {@link #derivedFrom} (The URL of a Questionnaire that this
4390   *              Questionnaire is based on.)
4391   */
4392  public Questionnaire addDerivedFrom(String value) { // 1
4393    CanonicalType t = new CanonicalType();
4394    t.setValue(value);
4395    if (this.derivedFrom == null)
4396      this.derivedFrom = new ArrayList<CanonicalType>();
4397    this.derivedFrom.add(t);
4398    return this;
4399  }
4400
4401  /**
4402   * @param value {@link #derivedFrom} (The URL of a Questionnaire that this
4403   *              Questionnaire is based on.)
4404   */
4405  public boolean hasDerivedFrom(String value) {
4406    if (this.derivedFrom == null)
4407      return false;
4408    for (CanonicalType v : this.derivedFrom)
4409      if (v.getValue().equals(value)) // canonical(Questionnaire)
4410        return true;
4411    return false;
4412  }
4413
4414  /**
4415   * @return {@link #status} (The status of this questionnaire. Enables tracking
4416   *         the life-cycle of the content.). This is the underlying object with
4417   *         id, value and extensions. The accessor "getStatus" gives direct
4418   *         access to the value
4419   */
4420  public Enumeration<PublicationStatus> getStatusElement() {
4421    if (this.status == null)
4422      if (Configuration.errorOnAutoCreate())
4423        throw new Error("Attempt to auto-create Questionnaire.status");
4424      else if (Configuration.doAutoCreate())
4425        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
4426    return this.status;
4427  }
4428
4429  public boolean hasStatusElement() {
4430    return this.status != null && !this.status.isEmpty();
4431  }
4432
4433  public boolean hasStatus() {
4434    return this.status != null && !this.status.isEmpty();
4435  }
4436
4437  /**
4438   * @param value {@link #status} (The status of this questionnaire. Enables
4439   *              tracking the life-cycle of the content.). This is the underlying
4440   *              object with id, value and extensions. The accessor "getStatus"
4441   *              gives direct access to the value
4442   */
4443  public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) {
4444    this.status = value;
4445    return this;
4446  }
4447
4448  /**
4449   * @return The status of this questionnaire. Enables tracking the life-cycle of
4450   *         the content.
4451   */
4452  public PublicationStatus getStatus() {
4453    return this.status == null ? null : this.status.getValue();
4454  }
4455
4456  /**
4457   * @param value The status of this questionnaire. Enables tracking the
4458   *              life-cycle of the content.
4459   */
4460  public Questionnaire setStatus(PublicationStatus value) {
4461    if (this.status == null)
4462      this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
4463    this.status.setValue(value);
4464    return this;
4465  }
4466
4467  /**
4468   * @return {@link #experimental} (A Boolean value to indicate that this
4469   *         questionnaire is authored for testing purposes (or
4470   *         education/evaluation/marketing) and is not intended to be used for
4471   *         genuine usage.). This is the underlying object with id, value and
4472   *         extensions. The accessor "getExperimental" gives direct access to the
4473   *         value
4474   */
4475  public BooleanType getExperimentalElement() {
4476    if (this.experimental == null)
4477      if (Configuration.errorOnAutoCreate())
4478        throw new Error("Attempt to auto-create Questionnaire.experimental");
4479      else if (Configuration.doAutoCreate())
4480        this.experimental = new BooleanType(); // bb
4481    return this.experimental;
4482  }
4483
4484  public boolean hasExperimentalElement() {
4485    return this.experimental != null && !this.experimental.isEmpty();
4486  }
4487
4488  public boolean hasExperimental() {
4489    return this.experimental != null && !this.experimental.isEmpty();
4490  }
4491
4492  /**
4493   * @param value {@link #experimental} (A Boolean value to indicate that this
4494   *              questionnaire is authored for testing purposes (or
4495   *              education/evaluation/marketing) and is not intended to be used
4496   *              for genuine usage.). This is the underlying object with id,
4497   *              value and extensions. The accessor "getExperimental" gives
4498   *              direct access to the value
4499   */
4500  public Questionnaire setExperimentalElement(BooleanType value) {
4501    this.experimental = value;
4502    return this;
4503  }
4504
4505  /**
4506   * @return A Boolean value to indicate that this questionnaire is authored for
4507   *         testing purposes (or education/evaluation/marketing) and is not
4508   *         intended to be used for genuine usage.
4509   */
4510  public boolean getExperimental() {
4511    return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
4512  }
4513
4514  /**
4515   * @param value A Boolean value to indicate that this questionnaire is authored
4516   *              for testing purposes (or education/evaluation/marketing) and is
4517   *              not intended to be used for genuine usage.
4518   */
4519  public Questionnaire setExperimental(boolean value) {
4520    if (this.experimental == null)
4521      this.experimental = new BooleanType();
4522    this.experimental.setValue(value);
4523    return this;
4524  }
4525
4526  /**
4527   * @return {@link #subjectType} (The types of subjects that can be the subject
4528   *         of responses created for the questionnaire.)
4529   */
4530  public List<CodeType> getSubjectType() {
4531    if (this.subjectType == null)
4532      this.subjectType = new ArrayList<CodeType>();
4533    return this.subjectType;
4534  }
4535
4536  /**
4537   * @return Returns a reference to <code>this</code> for easy method chaining
4538   */
4539  public Questionnaire setSubjectType(List<CodeType> theSubjectType) {
4540    this.subjectType = theSubjectType;
4541    return this;
4542  }
4543
4544  public boolean hasSubjectType() {
4545    if (this.subjectType == null)
4546      return false;
4547    for (CodeType item : this.subjectType)
4548      if (!item.isEmpty())
4549        return true;
4550    return false;
4551  }
4552
4553  /**
4554   * @return {@link #subjectType} (The types of subjects that can be the subject
4555   *         of responses created for the questionnaire.)
4556   */
4557  public CodeType addSubjectTypeElement() {// 2
4558    CodeType t = new CodeType();
4559    if (this.subjectType == null)
4560      this.subjectType = new ArrayList<CodeType>();
4561    this.subjectType.add(t);
4562    return t;
4563  }
4564
4565  /**
4566   * @param value {@link #subjectType} (The types of subjects that can be the
4567   *              subject of responses created for the questionnaire.)
4568   */
4569  public Questionnaire addSubjectType(String value) { // 1
4570    CodeType t = new CodeType();
4571    t.setValue(value);
4572    if (this.subjectType == null)
4573      this.subjectType = new ArrayList<CodeType>();
4574    this.subjectType.add(t);
4575    return this;
4576  }
4577
4578  /**
4579   * @param value {@link #subjectType} (The types of subjects that can be the
4580   *              subject of responses created for the questionnaire.)
4581   */
4582  public boolean hasSubjectType(String value) {
4583    if (this.subjectType == null)
4584      return false;
4585    for (CodeType v : this.subjectType)
4586      if (v.getValue().equals(value)) // code
4587        return true;
4588    return false;
4589  }
4590
4591  /**
4592   * @return {@link #date} (The date (and optionally time) when the questionnaire
4593   *         was published. The date must change when the business version changes
4594   *         and it must change if the status code changes. In addition, it should
4595   *         change when the substantive content of the questionnaire changes.).
4596   *         This is the underlying object with id, value and extensions. The
4597   *         accessor "getDate" gives direct access to the value
4598   */
4599  public DateTimeType getDateElement() {
4600    if (this.date == null)
4601      if (Configuration.errorOnAutoCreate())
4602        throw new Error("Attempt to auto-create Questionnaire.date");
4603      else if (Configuration.doAutoCreate())
4604        this.date = new DateTimeType(); // bb
4605    return this.date;
4606  }
4607
4608  public boolean hasDateElement() {
4609    return this.date != null && !this.date.isEmpty();
4610  }
4611
4612  public boolean hasDate() {
4613    return this.date != null && !this.date.isEmpty();
4614  }
4615
4616  /**
4617   * @param value {@link #date} (The date (and optionally time) when the
4618   *              questionnaire was published. The date must change when the
4619   *              business version changes and it must change if the status code
4620   *              changes. In addition, it should change when the substantive
4621   *              content of the questionnaire changes.). This is the underlying
4622   *              object with id, value and extensions. The accessor "getDate"
4623   *              gives direct access to the value
4624   */
4625  public Questionnaire setDateElement(DateTimeType value) {
4626    this.date = value;
4627    return this;
4628  }
4629
4630  /**
4631   * @return The date (and optionally time) when the questionnaire was published.
4632   *         The date must change when the business version changes and it must
4633   *         change if the status code changes. In addition, it should change when
4634   *         the substantive content of the questionnaire changes.
4635   */
4636  public Date getDate() {
4637    return this.date == null ? null : this.date.getValue();
4638  }
4639
4640  /**
4641   * @param value The date (and optionally time) when the questionnaire was
4642   *              published. The date must change when the business version
4643   *              changes and it must change if the status code changes. In
4644   *              addition, it should change when the substantive content of the
4645   *              questionnaire changes.
4646   */
4647  public Questionnaire setDate(Date value) {
4648    if (value == null)
4649      this.date = null;
4650    else {
4651      if (this.date == null)
4652        this.date = new DateTimeType();
4653      this.date.setValue(value);
4654    }
4655    return this;
4656  }
4657
4658  /**
4659   * @return {@link #publisher} (The name of the organization or individual that
4660   *         published the questionnaire.). This is the underlying object with id,
4661   *         value and extensions. The accessor "getPublisher" gives direct access
4662   *         to the value
4663   */
4664  public StringType getPublisherElement() {
4665    if (this.publisher == null)
4666      if (Configuration.errorOnAutoCreate())
4667        throw new Error("Attempt to auto-create Questionnaire.publisher");
4668      else if (Configuration.doAutoCreate())
4669        this.publisher = new StringType(); // bb
4670    return this.publisher;
4671  }
4672
4673  public boolean hasPublisherElement() {
4674    return this.publisher != null && !this.publisher.isEmpty();
4675  }
4676
4677  public boolean hasPublisher() {
4678    return this.publisher != null && !this.publisher.isEmpty();
4679  }
4680
4681  /**
4682   * @param value {@link #publisher} (The name of the organization or individual
4683   *              that published the questionnaire.). This is the underlying
4684   *              object with id, value and extensions. The accessor
4685   *              "getPublisher" gives direct access to the value
4686   */
4687  public Questionnaire setPublisherElement(StringType value) {
4688    this.publisher = value;
4689    return this;
4690  }
4691
4692  /**
4693   * @return The name of the organization or individual that published the
4694   *         questionnaire.
4695   */
4696  public String getPublisher() {
4697    return this.publisher == null ? null : this.publisher.getValue();
4698  }
4699
4700  /**
4701   * @param value The name of the organization or individual that published the
4702   *              questionnaire.
4703   */
4704  public Questionnaire setPublisher(String value) {
4705    if (Utilities.noString(value))
4706      this.publisher = null;
4707    else {
4708      if (this.publisher == null)
4709        this.publisher = new StringType();
4710      this.publisher.setValue(value);
4711    }
4712    return this;
4713  }
4714
4715  /**
4716   * @return {@link #contact} (Contact details to assist a user in finding and
4717   *         communicating with the publisher.)
4718   */
4719  public List<ContactDetail> getContact() {
4720    if (this.contact == null)
4721      this.contact = new ArrayList<ContactDetail>();
4722    return this.contact;
4723  }
4724
4725  /**
4726   * @return Returns a reference to <code>this</code> for easy method chaining
4727   */
4728  public Questionnaire setContact(List<ContactDetail> theContact) {
4729    this.contact = theContact;
4730    return this;
4731  }
4732
4733  public boolean hasContact() {
4734    if (this.contact == null)
4735      return false;
4736    for (ContactDetail item : this.contact)
4737      if (!item.isEmpty())
4738        return true;
4739    return false;
4740  }
4741
4742  public ContactDetail addContact() { // 3
4743    ContactDetail t = new ContactDetail();
4744    if (this.contact == null)
4745      this.contact = new ArrayList<ContactDetail>();
4746    this.contact.add(t);
4747    return t;
4748  }
4749
4750  public Questionnaire addContact(ContactDetail t) { // 3
4751    if (t == null)
4752      return this;
4753    if (this.contact == null)
4754      this.contact = new ArrayList<ContactDetail>();
4755    this.contact.add(t);
4756    return this;
4757  }
4758
4759  /**
4760   * @return The first repetition of repeating field {@link #contact}, creating it
4761   *         if it does not already exist
4762   */
4763  public ContactDetail getContactFirstRep() {
4764    if (getContact().isEmpty()) {
4765      addContact();
4766    }
4767    return getContact().get(0);
4768  }
4769
4770  /**
4771   * @return {@link #description} (A free text natural language description of the
4772   *         questionnaire from a consumer's perspective.). This is the underlying
4773   *         object with id, value and extensions. The accessor "getDescription"
4774   *         gives direct access to the value
4775   */
4776  public MarkdownType getDescriptionElement() {
4777    if (this.description == null)
4778      if (Configuration.errorOnAutoCreate())
4779        throw new Error("Attempt to auto-create Questionnaire.description");
4780      else if (Configuration.doAutoCreate())
4781        this.description = new MarkdownType(); // bb
4782    return this.description;
4783  }
4784
4785  public boolean hasDescriptionElement() {
4786    return this.description != null && !this.description.isEmpty();
4787  }
4788
4789  public boolean hasDescription() {
4790    return this.description != null && !this.description.isEmpty();
4791  }
4792
4793  /**
4794   * @param value {@link #description} (A free text natural language description
4795   *              of the questionnaire from a consumer's perspective.). This is
4796   *              the underlying object with id, value and extensions. The
4797   *              accessor "getDescription" gives direct access to the value
4798   */
4799  public Questionnaire setDescriptionElement(MarkdownType value) {
4800    this.description = value;
4801    return this;
4802  }
4803
4804  /**
4805   * @return A free text natural language description of the questionnaire from a
4806   *         consumer's perspective.
4807   */
4808  public String getDescription() {
4809    return this.description == null ? null : this.description.getValue();
4810  }
4811
4812  /**
4813   * @param value A free text natural language description of the questionnaire
4814   *              from a consumer's perspective.
4815   */
4816  public Questionnaire setDescription(String value) {
4817    if (value == null)
4818      this.description = null;
4819    else {
4820      if (this.description == null)
4821        this.description = new MarkdownType();
4822      this.description.setValue(value);
4823    }
4824    return this;
4825  }
4826
4827  /**
4828   * @return {@link #useContext} (The content was developed with a focus and
4829   *         intent of supporting the contexts that are listed. These contexts may
4830   *         be general categories (gender, age, ...) or may be references to
4831   *         specific programs (insurance plans, studies, ...) and may be used to
4832   *         assist with indexing and searching for appropriate questionnaire
4833   *         instances.)
4834   */
4835  public List<UsageContext> getUseContext() {
4836    if (this.useContext == null)
4837      this.useContext = new ArrayList<UsageContext>();
4838    return this.useContext;
4839  }
4840
4841  /**
4842   * @return Returns a reference to <code>this</code> for easy method chaining
4843   */
4844  public Questionnaire setUseContext(List<UsageContext> theUseContext) {
4845    this.useContext = theUseContext;
4846    return this;
4847  }
4848
4849  public boolean hasUseContext() {
4850    if (this.useContext == null)
4851      return false;
4852    for (UsageContext item : this.useContext)
4853      if (!item.isEmpty())
4854        return true;
4855    return false;
4856  }
4857
4858  public UsageContext addUseContext() { // 3
4859    UsageContext t = new UsageContext();
4860    if (this.useContext == null)
4861      this.useContext = new ArrayList<UsageContext>();
4862    this.useContext.add(t);
4863    return t;
4864  }
4865
4866  public Questionnaire addUseContext(UsageContext t) { // 3
4867    if (t == null)
4868      return this;
4869    if (this.useContext == null)
4870      this.useContext = new ArrayList<UsageContext>();
4871    this.useContext.add(t);
4872    return this;
4873  }
4874
4875  /**
4876   * @return The first repetition of repeating field {@link #useContext}, creating
4877   *         it if it does not already exist
4878   */
4879  public UsageContext getUseContextFirstRep() {
4880    if (getUseContext().isEmpty()) {
4881      addUseContext();
4882    }
4883    return getUseContext().get(0);
4884  }
4885
4886  /**
4887   * @return {@link #jurisdiction} (A legal or geographic region in which the
4888   *         questionnaire is intended to be used.)
4889   */
4890  public List<CodeableConcept> getJurisdiction() {
4891    if (this.jurisdiction == null)
4892      this.jurisdiction = new ArrayList<CodeableConcept>();
4893    return this.jurisdiction;
4894  }
4895
4896  /**
4897   * @return Returns a reference to <code>this</code> for easy method chaining
4898   */
4899  public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) {
4900    this.jurisdiction = theJurisdiction;
4901    return this;
4902  }
4903
4904  public boolean hasJurisdiction() {
4905    if (this.jurisdiction == null)
4906      return false;
4907    for (CodeableConcept item : this.jurisdiction)
4908      if (!item.isEmpty())
4909        return true;
4910    return false;
4911  }
4912
4913  public CodeableConcept addJurisdiction() { // 3
4914    CodeableConcept t = new CodeableConcept();
4915    if (this.jurisdiction == null)
4916      this.jurisdiction = new ArrayList<CodeableConcept>();
4917    this.jurisdiction.add(t);
4918    return t;
4919  }
4920
4921  public Questionnaire addJurisdiction(CodeableConcept t) { // 3
4922    if (t == null)
4923      return this;
4924    if (this.jurisdiction == null)
4925      this.jurisdiction = new ArrayList<CodeableConcept>();
4926    this.jurisdiction.add(t);
4927    return this;
4928  }
4929
4930  /**
4931   * @return The first repetition of repeating field {@link #jurisdiction},
4932   *         creating it if it does not already exist
4933   */
4934  public CodeableConcept getJurisdictionFirstRep() {
4935    if (getJurisdiction().isEmpty()) {
4936      addJurisdiction();
4937    }
4938    return getJurisdiction().get(0);
4939  }
4940
4941  /**
4942   * @return {@link #purpose} (Explanation of why this questionnaire is needed and
4943   *         why it has been designed as it has.). This is the underlying object
4944   *         with id, value and extensions. The accessor "getPurpose" gives direct
4945   *         access to the value
4946   */
4947  public MarkdownType getPurposeElement() {
4948    if (this.purpose == null)
4949      if (Configuration.errorOnAutoCreate())
4950        throw new Error("Attempt to auto-create Questionnaire.purpose");
4951      else if (Configuration.doAutoCreate())
4952        this.purpose = new MarkdownType(); // bb
4953    return this.purpose;
4954  }
4955
4956  public boolean hasPurposeElement() {
4957    return this.purpose != null && !this.purpose.isEmpty();
4958  }
4959
4960  public boolean hasPurpose() {
4961    return this.purpose != null && !this.purpose.isEmpty();
4962  }
4963
4964  /**
4965   * @param value {@link #purpose} (Explanation of why this questionnaire is
4966   *              needed and why it has been designed as it has.). This is the
4967   *              underlying object with id, value and extensions. The accessor
4968   *              "getPurpose" gives direct access to the value
4969   */
4970  public Questionnaire setPurposeElement(MarkdownType value) {
4971    this.purpose = value;
4972    return this;
4973  }
4974
4975  /**
4976   * @return Explanation of why this questionnaire is needed and why it has been
4977   *         designed as it has.
4978   */
4979  public String getPurpose() {
4980    return this.purpose == null ? null : this.purpose.getValue();
4981  }
4982
4983  /**
4984   * @param value Explanation of why this questionnaire is needed and why it has
4985   *              been designed as it has.
4986   */
4987  public Questionnaire setPurpose(String value) {
4988    if (value == null)
4989      this.purpose = null;
4990    else {
4991      if (this.purpose == null)
4992        this.purpose = new MarkdownType();
4993      this.purpose.setValue(value);
4994    }
4995    return this;
4996  }
4997
4998  /**
4999   * @return {@link #copyright} (A copyright statement relating to the
5000   *         questionnaire and/or its contents. Copyright statements are generally
5001   *         legal restrictions on the use and publishing of the questionnaire.).
5002   *         This is the underlying object with id, value and extensions. The
5003   *         accessor "getCopyright" gives direct access to the value
5004   */
5005  public MarkdownType getCopyrightElement() {
5006    if (this.copyright == null)
5007      if (Configuration.errorOnAutoCreate())
5008        throw new Error("Attempt to auto-create Questionnaire.copyright");
5009      else if (Configuration.doAutoCreate())
5010        this.copyright = new MarkdownType(); // bb
5011    return this.copyright;
5012  }
5013
5014  public boolean hasCopyrightElement() {
5015    return this.copyright != null && !this.copyright.isEmpty();
5016  }
5017
5018  public boolean hasCopyright() {
5019    return this.copyright != null && !this.copyright.isEmpty();
5020  }
5021
5022  /**
5023   * @param value {@link #copyright} (A copyright statement relating to the
5024   *              questionnaire and/or its contents. Copyright statements are
5025   *              generally legal restrictions on the use and publishing of the
5026   *              questionnaire.). This is the underlying object with id, value
5027   *              and extensions. The accessor "getCopyright" gives direct access
5028   *              to the value
5029   */
5030  public Questionnaire setCopyrightElement(MarkdownType value) {
5031    this.copyright = value;
5032    return this;
5033  }
5034
5035  /**
5036   * @return A copyright statement relating to the questionnaire and/or its
5037   *         contents. Copyright statements are generally legal restrictions on
5038   *         the use and publishing of the questionnaire.
5039   */
5040  public String getCopyright() {
5041    return this.copyright == null ? null : this.copyright.getValue();
5042  }
5043
5044  /**
5045   * @param value A copyright statement relating to the questionnaire and/or its
5046   *              contents. Copyright statements are generally legal restrictions
5047   *              on the use and publishing of the questionnaire.
5048   */
5049  public Questionnaire setCopyright(String value) {
5050    if (value == null)
5051      this.copyright = null;
5052    else {
5053      if (this.copyright == null)
5054        this.copyright = new MarkdownType();
5055      this.copyright.setValue(value);
5056    }
5057    return this;
5058  }
5059
5060  /**
5061   * @return {@link #approvalDate} (The date on which the resource content was
5062   *         approved by the publisher. Approval happens once when the content is
5063   *         officially approved for usage.). This is the underlying object with
5064   *         id, value and extensions. The accessor "getApprovalDate" gives direct
5065   *         access to the value
5066   */
5067  public DateType getApprovalDateElement() {
5068    if (this.approvalDate == null)
5069      if (Configuration.errorOnAutoCreate())
5070        throw new Error("Attempt to auto-create Questionnaire.approvalDate");
5071      else if (Configuration.doAutoCreate())
5072        this.approvalDate = new DateType(); // bb
5073    return this.approvalDate;
5074  }
5075
5076  public boolean hasApprovalDateElement() {
5077    return this.approvalDate != null && !this.approvalDate.isEmpty();
5078  }
5079
5080  public boolean hasApprovalDate() {
5081    return this.approvalDate != null && !this.approvalDate.isEmpty();
5082  }
5083
5084  /**
5085   * @param value {@link #approvalDate} (The date on which the resource content
5086   *              was approved by the publisher. Approval happens once when the
5087   *              content is officially approved for usage.). This is the
5088   *              underlying object with id, value and extensions. The accessor
5089   *              "getApprovalDate" gives direct access to the value
5090   */
5091  public Questionnaire setApprovalDateElement(DateType value) {
5092    this.approvalDate = value;
5093    return this;
5094  }
5095
5096  /**
5097   * @return The date on which the resource content was approved by the publisher.
5098   *         Approval happens once when the content is officially approved for
5099   *         usage.
5100   */
5101  public Date getApprovalDate() {
5102    return this.approvalDate == null ? null : this.approvalDate.getValue();
5103  }
5104
5105  /**
5106   * @param value The date on which the resource content was approved by the
5107   *              publisher. Approval happens once when the content is officially
5108   *              approved for usage.
5109   */
5110  public Questionnaire setApprovalDate(Date value) {
5111    if (value == null)
5112      this.approvalDate = null;
5113    else {
5114      if (this.approvalDate == null)
5115        this.approvalDate = new DateType();
5116      this.approvalDate.setValue(value);
5117    }
5118    return this;
5119  }
5120
5121  /**
5122   * @return {@link #lastReviewDate} (The date on which the resource content was
5123   *         last reviewed. Review happens periodically after approval but does
5124   *         not change the original approval date.). This is the underlying
5125   *         object with id, value and extensions. The accessor
5126   *         "getLastReviewDate" gives direct access to the value
5127   */
5128  public DateType getLastReviewDateElement() {
5129    if (this.lastReviewDate == null)
5130      if (Configuration.errorOnAutoCreate())
5131        throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
5132      else if (Configuration.doAutoCreate())
5133        this.lastReviewDate = new DateType(); // bb
5134    return this.lastReviewDate;
5135  }
5136
5137  public boolean hasLastReviewDateElement() {
5138    return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
5139  }
5140
5141  public boolean hasLastReviewDate() {
5142    return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
5143  }
5144
5145  /**
5146   * @param value {@link #lastReviewDate} (The date on which the resource content
5147   *              was last reviewed. Review happens periodically after approval
5148   *              but does not change the original approval date.). This is the
5149   *              underlying object with id, value and extensions. The accessor
5150   *              "getLastReviewDate" gives direct access to the value
5151   */
5152  public Questionnaire setLastReviewDateElement(DateType value) {
5153    this.lastReviewDate = value;
5154    return this;
5155  }
5156
5157  /**
5158   * @return The date on which the resource content was last reviewed. Review
5159   *         happens periodically after approval but does not change the original
5160   *         approval date.
5161   */
5162  public Date getLastReviewDate() {
5163    return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
5164  }
5165
5166  /**
5167   * @param value The date on which the resource content was last reviewed. Review
5168   *              happens periodically after approval but does not change the
5169   *              original approval date.
5170   */
5171  public Questionnaire setLastReviewDate(Date value) {
5172    if (value == null)
5173      this.lastReviewDate = null;
5174    else {
5175      if (this.lastReviewDate == null)
5176        this.lastReviewDate = new DateType();
5177      this.lastReviewDate.setValue(value);
5178    }
5179    return this;
5180  }
5181
5182  /**
5183   * @return {@link #effectivePeriod} (The period during which the questionnaire
5184   *         content was or is planned to be in active use.)
5185   */
5186  public Period getEffectivePeriod() {
5187    if (this.effectivePeriod == null)
5188      if (Configuration.errorOnAutoCreate())
5189        throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
5190      else if (Configuration.doAutoCreate())
5191        this.effectivePeriod = new Period(); // cc
5192    return this.effectivePeriod;
5193  }
5194
5195  public boolean hasEffectivePeriod() {
5196    return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
5197  }
5198
5199  /**
5200   * @param value {@link #effectivePeriod} (The period during which the
5201   *              questionnaire content was or is planned to be in active use.)
5202   */
5203  public Questionnaire setEffectivePeriod(Period value) {
5204    this.effectivePeriod = value;
5205    return this;
5206  }
5207
5208  /**
5209   * @return {@link #code} (An identifier for this question or group of questions
5210   *         in a particular terminology such as LOINC.)
5211   */
5212  public List<Coding> getCode() {
5213    if (this.code == null)
5214      this.code = new ArrayList<Coding>();
5215    return this.code;
5216  }
5217
5218  /**
5219   * @return Returns a reference to <code>this</code> for easy method chaining
5220   */
5221  public Questionnaire setCode(List<Coding> theCode) {
5222    this.code = theCode;
5223    return this;
5224  }
5225
5226  public boolean hasCode() {
5227    if (this.code == null)
5228      return false;
5229    for (Coding item : this.code)
5230      if (!item.isEmpty())
5231        return true;
5232    return false;
5233  }
5234
5235  public Coding addCode() { // 3
5236    Coding t = new Coding();
5237    if (this.code == null)
5238      this.code = new ArrayList<Coding>();
5239    this.code.add(t);
5240    return t;
5241  }
5242
5243  public Questionnaire addCode(Coding t) { // 3
5244    if (t == null)
5245      return this;
5246    if (this.code == null)
5247      this.code = new ArrayList<Coding>();
5248    this.code.add(t);
5249    return this;
5250  }
5251
5252  /**
5253   * @return The first repetition of repeating field {@link #code}, creating it if
5254   *         it does not already exist
5255   */
5256  public Coding getCodeFirstRep() {
5257    if (getCode().isEmpty()) {
5258      addCode();
5259    }
5260    return getCode().get(0);
5261  }
5262
5263  /**
5264   * @return {@link #item} (A particular question, question grouping or display
5265   *         text that is part of the questionnaire.)
5266   */
5267  public List<QuestionnaireItemComponent> getItem() {
5268    if (this.item == null)
5269      this.item = new ArrayList<QuestionnaireItemComponent>();
5270    return this.item;
5271  }
5272
5273  /**
5274   * @return Returns a reference to <code>this</code> for easy method chaining
5275   */
5276  public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) {
5277    this.item = theItem;
5278    return this;
5279  }
5280
5281  public boolean hasItem() {
5282    if (this.item == null)
5283      return false;
5284    for (QuestionnaireItemComponent item : this.item)
5285      if (!item.isEmpty())
5286        return true;
5287    return false;
5288  }
5289
5290  public QuestionnaireItemComponent addItem() { // 3
5291    QuestionnaireItemComponent t = new QuestionnaireItemComponent();
5292    if (this.item == null)
5293      this.item = new ArrayList<QuestionnaireItemComponent>();
5294    this.item.add(t);
5295    return t;
5296  }
5297
5298  public Questionnaire addItem(QuestionnaireItemComponent t) { // 3
5299    if (t == null)
5300      return this;
5301    if (this.item == null)
5302      this.item = new ArrayList<QuestionnaireItemComponent>();
5303    this.item.add(t);
5304    return this;
5305  }
5306
5307  /**
5308   * @return The first repetition of repeating field {@link #item}, creating it if
5309   *         it does not already exist
5310   */
5311  public QuestionnaireItemComponent getItemFirstRep() {
5312    if (getItem().isEmpty()) {
5313      addItem();
5314    }
5315    return getItem().get(0);
5316  }
5317
5318  protected void listChildren(List<Property> children) {
5319    super.listChildren(children);
5320    children.add(new Property("url", "uri",
5321        "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.",
5322        0, 1, url));
5323    children.add(new Property("identifier", "Identifier",
5324        "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.",
5325        0, java.lang.Integer.MAX_VALUE, identifier));
5326    children.add(new Property("version", "string",
5327        "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.",
5328        0, 1, version));
5329    children.add(new Property("name", "string",
5330        "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.",
5331        0, 1, name));
5332    children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0,
5333        1, title));
5334    children.add(new Property("derivedFrom", "canonical(Questionnaire)",
5335        "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE,
5336        derivedFrom));
5337    children.add(new Property("status", "code",
5338        "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status));
5339    children.add(new Property("experimental", "boolean",
5340        "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.",
5341        0, 1, experimental));
5342    children.add(new Property("subjectType", "code",
5343        "The types of subjects that can be the subject of responses created for the questionnaire.", 0,
5344        java.lang.Integer.MAX_VALUE, subjectType));
5345    children.add(new Property("date", "dateTime",
5346        "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.",
5347        0, 1, date));
5348    children.add(new Property("publisher", "string",
5349        "The name of the organization or individual that published the questionnaire.", 0, 1, publisher));
5350    children.add(new Property("contact", "ContactDetail",
5351        "Contact details to assist a user in finding and communicating with the publisher.", 0,
5352        java.lang.Integer.MAX_VALUE, contact));
5353    children.add(new Property("description", "markdown",
5354        "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1,
5355        description));
5356    children.add(new Property("useContext", "UsageContext",
5357        "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.",
5358        0, java.lang.Integer.MAX_VALUE, useContext));
5359    children.add(new Property("jurisdiction", "CodeableConcept",
5360        "A legal or geographic region in which the questionnaire is intended to be used.", 0,
5361        java.lang.Integer.MAX_VALUE, jurisdiction));
5362    children.add(new Property("purpose", "markdown",
5363        "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose));
5364    children.add(new Property("copyright", "markdown",
5365        "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.",
5366        0, 1, copyright));
5367    children.add(new Property("approvalDate", "date",
5368        "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.",
5369        0, 1, approvalDate));
5370    children.add(new Property("lastReviewDate", "date",
5371        "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.",
5372        0, 1, lastReviewDate));
5373    children.add(new Property("effectivePeriod", "Period",
5374        "The period during which the questionnaire content was or is planned to be in active use.", 0, 1,
5375        effectivePeriod));
5376    children.add(new Property("code", "Coding",
5377        "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0,
5378        java.lang.Integer.MAX_VALUE, code));
5379    children.add(new Property("item", "",
5380        "A particular question, question grouping or display text that is part of the questionnaire.", 0,
5381        java.lang.Integer.MAX_VALUE, item));
5382  }
5383
5384  @Override
5385  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5386    switch (_hash) {
5387    case 116079:
5388      /* url */ return new Property("url", "uri",
5389          "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.",
5390          0, 1, url);
5391    case -1618432855:
5392      /* identifier */ return new Property("identifier", "Identifier",
5393          "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.",
5394          0, java.lang.Integer.MAX_VALUE, identifier);
5395    case 351608024:
5396      /* version */ return new Property("version", "string",
5397          "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.",
5398          0, 1, version);
5399    case 3373707:
5400      /* name */ return new Property("name", "string",
5401          "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.",
5402          0, 1, name);
5403    case 110371416:
5404      /* title */ return new Property("title", "string",
5405          "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title);
5406    case 1077922663:
5407      /* derivedFrom */ return new Property("derivedFrom", "canonical(Questionnaire)",
5408          "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE,
5409          derivedFrom);
5410    case -892481550:
5411      /* status */ return new Property("status", "code",
5412          "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status);
5413    case -404562712:
5414      /* experimental */ return new Property("experimental", "boolean",
5415          "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.",
5416          0, 1, experimental);
5417    case -603200890:
5418      /* subjectType */ return new Property("subjectType", "code",
5419          "The types of subjects that can be the subject of responses created for the questionnaire.", 0,
5420          java.lang.Integer.MAX_VALUE, subjectType);
5421    case 3076014:
5422      /* date */ return new Property("date", "dateTime",
5423          "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.",
5424          0, 1, date);
5425    case 1447404028:
5426      /* publisher */ return new Property("publisher", "string",
5427          "The name of the organization or individual that published the questionnaire.", 0, 1, publisher);
5428    case 951526432:
5429      /* contact */ return new Property("contact", "ContactDetail",
5430          "Contact details to assist a user in finding and communicating with the publisher.", 0,
5431          java.lang.Integer.MAX_VALUE, contact);
5432    case -1724546052:
5433      /* description */ return new Property("description", "markdown",
5434          "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1,
5435          description);
5436    case -669707736:
5437      /* useContext */ return new Property("useContext", "UsageContext",
5438          "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.",
5439          0, java.lang.Integer.MAX_VALUE, useContext);
5440    case -507075711:
5441      /* jurisdiction */ return new Property("jurisdiction", "CodeableConcept",
5442          "A legal or geographic region in which the questionnaire is intended to be used.", 0,
5443          java.lang.Integer.MAX_VALUE, jurisdiction);
5444    case -220463842:
5445      /* purpose */ return new Property("purpose", "markdown",
5446          "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose);
5447    case 1522889671:
5448      /* copyright */ return new Property("copyright", "markdown",
5449          "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.",
5450          0, 1, copyright);
5451    case 223539345:
5452      /* approvalDate */ return new Property("approvalDate", "date",
5453          "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.",
5454          0, 1, approvalDate);
5455    case -1687512484:
5456      /* lastReviewDate */ return new Property("lastReviewDate", "date",
5457          "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.",
5458          0, 1, lastReviewDate);
5459    case -403934648:
5460      /* effectivePeriod */ return new Property("effectivePeriod", "Period",
5461          "The period during which the questionnaire content was or is planned to be in active use.", 0, 1,
5462          effectivePeriod);
5463    case 3059181:
5464      /* code */ return new Property("code", "Coding",
5465          "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0,
5466          java.lang.Integer.MAX_VALUE, code);
5467    case 3242771:
5468      /* item */ return new Property("item", "",
5469          "A particular question, question grouping or display text that is part of the questionnaire.", 0,
5470          java.lang.Integer.MAX_VALUE, item);
5471    default:
5472      return super.getNamedProperty(_hash, _name, _checkValid);
5473    }
5474
5475  }
5476
5477  @Override
5478  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5479    switch (hash) {
5480    case 116079:
5481      /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
5482    case -1618432855:
5483      /* identifier */ return this.identifier == null ? new Base[0]
5484          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
5485    case 351608024:
5486      /* version */ return this.version == null ? new Base[0] : new Base[] { this.version }; // StringType
5487    case 3373707:
5488      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
5489    case 110371416:
5490      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
5491    case 1077922663:
5492      /* derivedFrom */ return this.derivedFrom == null ? new Base[0]
5493          : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // CanonicalType
5494    case -892481550:
5495      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<PublicationStatus>
5496    case -404562712:
5497      /* experimental */ return this.experimental == null ? new Base[0] : new Base[] { this.experimental }; // BooleanType
5498    case -603200890:
5499      /* subjectType */ return this.subjectType == null ? new Base[0]
5500          : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
5501    case 3076014:
5502      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
5503    case 1447404028:
5504      /* publisher */ return this.publisher == null ? new Base[0] : new Base[] { this.publisher }; // StringType
5505    case 951526432:
5506      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
5507    case -1724546052:
5508      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // MarkdownType
5509    case -669707736:
5510      /* useContext */ return this.useContext == null ? new Base[0]
5511          : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
5512    case -507075711:
5513      /* jurisdiction */ return this.jurisdiction == null ? new Base[0]
5514          : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
5515    case -220463842:
5516      /* purpose */ return this.purpose == null ? new Base[0] : new Base[] { this.purpose }; // MarkdownType
5517    case 1522889671:
5518      /* copyright */ return this.copyright == null ? new Base[0] : new Base[] { this.copyright }; // MarkdownType
5519    case 223539345:
5520      /* approvalDate */ return this.approvalDate == null ? new Base[0] : new Base[] { this.approvalDate }; // DateType
5521    case -1687512484:
5522      /* lastReviewDate */ return this.lastReviewDate == null ? new Base[0] : new Base[] { this.lastReviewDate }; // DateType
5523    case -403934648:
5524      /* effectivePeriod */ return this.effectivePeriod == null ? new Base[0] : new Base[] { this.effectivePeriod }; // Period
5525    case 3059181:
5526      /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
5527    case 3242771:
5528      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
5529    default:
5530      return super.getProperty(hash, name, checkValid);
5531    }
5532
5533  }
5534
5535  @Override
5536  public Base setProperty(int hash, String name, Base value) throws FHIRException {
5537    switch (hash) {
5538    case 116079: // url
5539      this.url = castToUri(value); // UriType
5540      return value;
5541    case -1618432855: // identifier
5542      this.getIdentifier().add(castToIdentifier(value)); // Identifier
5543      return value;
5544    case 351608024: // version
5545      this.version = castToString(value); // StringType
5546      return value;
5547    case 3373707: // name
5548      this.name = castToString(value); // StringType
5549      return value;
5550    case 110371416: // title
5551      this.title = castToString(value); // StringType
5552      return value;
5553    case 1077922663: // derivedFrom
5554      this.getDerivedFrom().add(castToCanonical(value)); // CanonicalType
5555      return value;
5556    case -892481550: // status
5557      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
5558      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5559      return value;
5560    case -404562712: // experimental
5561      this.experimental = castToBoolean(value); // BooleanType
5562      return value;
5563    case -603200890: // subjectType
5564      this.getSubjectType().add(castToCode(value)); // CodeType
5565      return value;
5566    case 3076014: // date
5567      this.date = castToDateTime(value); // DateTimeType
5568      return value;
5569    case 1447404028: // publisher
5570      this.publisher = castToString(value); // StringType
5571      return value;
5572    case 951526432: // contact
5573      this.getContact().add(castToContactDetail(value)); // ContactDetail
5574      return value;
5575    case -1724546052: // description
5576      this.description = castToMarkdown(value); // MarkdownType
5577      return value;
5578    case -669707736: // useContext
5579      this.getUseContext().add(castToUsageContext(value)); // UsageContext
5580      return value;
5581    case -507075711: // jurisdiction
5582      this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
5583      return value;
5584    case -220463842: // purpose
5585      this.purpose = castToMarkdown(value); // MarkdownType
5586      return value;
5587    case 1522889671: // copyright
5588      this.copyright = castToMarkdown(value); // MarkdownType
5589      return value;
5590    case 223539345: // approvalDate
5591      this.approvalDate = castToDate(value); // DateType
5592      return value;
5593    case -1687512484: // lastReviewDate
5594      this.lastReviewDate = castToDate(value); // DateType
5595      return value;
5596    case -403934648: // effectivePeriod
5597      this.effectivePeriod = castToPeriod(value); // Period
5598      return value;
5599    case 3059181: // code
5600      this.getCode().add(castToCoding(value)); // Coding
5601      return value;
5602    case 3242771: // item
5603      this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
5604      return value;
5605    default:
5606      return super.setProperty(hash, name, value);
5607    }
5608
5609  }
5610
5611  @Override
5612  public Base setProperty(String name, Base value) throws FHIRException {
5613    if (name.equals("url")) {
5614      this.url = castToUri(value); // UriType
5615    } else if (name.equals("identifier")) {
5616      this.getIdentifier().add(castToIdentifier(value));
5617    } else if (name.equals("version")) {
5618      this.version = castToString(value); // StringType
5619    } else if (name.equals("name")) {
5620      this.name = castToString(value); // StringType
5621    } else if (name.equals("title")) {
5622      this.title = castToString(value); // StringType
5623    } else if (name.equals("derivedFrom")) {
5624      this.getDerivedFrom().add(castToCanonical(value));
5625    } else if (name.equals("status")) {
5626      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
5627      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5628    } else if (name.equals("experimental")) {
5629      this.experimental = castToBoolean(value); // BooleanType
5630    } else if (name.equals("subjectType")) {
5631      this.getSubjectType().add(castToCode(value));
5632    } else if (name.equals("date")) {
5633      this.date = castToDateTime(value); // DateTimeType
5634    } else if (name.equals("publisher")) {
5635      this.publisher = castToString(value); // StringType
5636    } else if (name.equals("contact")) {
5637      this.getContact().add(castToContactDetail(value));
5638    } else if (name.equals("description")) {
5639      this.description = castToMarkdown(value); // MarkdownType
5640    } else if (name.equals("useContext")) {
5641      this.getUseContext().add(castToUsageContext(value));
5642    } else if (name.equals("jurisdiction")) {
5643      this.getJurisdiction().add(castToCodeableConcept(value));
5644    } else if (name.equals("purpose")) {
5645      this.purpose = castToMarkdown(value); // MarkdownType
5646    } else if (name.equals("copyright")) {
5647      this.copyright = castToMarkdown(value); // MarkdownType
5648    } else if (name.equals("approvalDate")) {
5649      this.approvalDate = castToDate(value); // DateType
5650    } else if (name.equals("lastReviewDate")) {
5651      this.lastReviewDate = castToDate(value); // DateType
5652    } else if (name.equals("effectivePeriod")) {
5653      this.effectivePeriod = castToPeriod(value); // Period
5654    } else if (name.equals("code")) {
5655      this.getCode().add(castToCoding(value));
5656    } else if (name.equals("item")) {
5657      this.getItem().add((QuestionnaireItemComponent) value);
5658    } else
5659      return super.setProperty(name, value);
5660    return value;
5661  }
5662
5663  @Override
5664  public Base makeProperty(int hash, String name) throws FHIRException {
5665    switch (hash) {
5666    case 116079:
5667      return getUrlElement();
5668    case -1618432855:
5669      return addIdentifier();
5670    case 351608024:
5671      return getVersionElement();
5672    case 3373707:
5673      return getNameElement();
5674    case 110371416:
5675      return getTitleElement();
5676    case 1077922663:
5677      return addDerivedFromElement();
5678    case -892481550:
5679      return getStatusElement();
5680    case -404562712:
5681      return getExperimentalElement();
5682    case -603200890:
5683      return addSubjectTypeElement();
5684    case 3076014:
5685      return getDateElement();
5686    case 1447404028:
5687      return getPublisherElement();
5688    case 951526432:
5689      return addContact();
5690    case -1724546052:
5691      return getDescriptionElement();
5692    case -669707736:
5693      return addUseContext();
5694    case -507075711:
5695      return addJurisdiction();
5696    case -220463842:
5697      return getPurposeElement();
5698    case 1522889671:
5699      return getCopyrightElement();
5700    case 223539345:
5701      return getApprovalDateElement();
5702    case -1687512484:
5703      return getLastReviewDateElement();
5704    case -403934648:
5705      return getEffectivePeriod();
5706    case 3059181:
5707      return addCode();
5708    case 3242771:
5709      return addItem();
5710    default:
5711      return super.makeProperty(hash, name);
5712    }
5713
5714  }
5715
5716  @Override
5717  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5718    switch (hash) {
5719    case 116079:
5720      /* url */ return new String[] { "uri" };
5721    case -1618432855:
5722      /* identifier */ return new String[] { "Identifier" };
5723    case 351608024:
5724      /* version */ return new String[] { "string" };
5725    case 3373707:
5726      /* name */ return new String[] { "string" };
5727    case 110371416:
5728      /* title */ return new String[] { "string" };
5729    case 1077922663:
5730      /* derivedFrom */ return new String[] { "canonical" };
5731    case -892481550:
5732      /* status */ return new String[] { "code" };
5733    case -404562712:
5734      /* experimental */ return new String[] { "boolean" };
5735    case -603200890:
5736      /* subjectType */ return new String[] { "code" };
5737    case 3076014:
5738      /* date */ return new String[] { "dateTime" };
5739    case 1447404028:
5740      /* publisher */ return new String[] { "string" };
5741    case 951526432:
5742      /* contact */ return new String[] { "ContactDetail" };
5743    case -1724546052:
5744      /* description */ return new String[] { "markdown" };
5745    case -669707736:
5746      /* useContext */ return new String[] { "UsageContext" };
5747    case -507075711:
5748      /* jurisdiction */ return new String[] { "CodeableConcept" };
5749    case -220463842:
5750      /* purpose */ return new String[] { "markdown" };
5751    case 1522889671:
5752      /* copyright */ return new String[] { "markdown" };
5753    case 223539345:
5754      /* approvalDate */ return new String[] { "date" };
5755    case -1687512484:
5756      /* lastReviewDate */ return new String[] { "date" };
5757    case -403934648:
5758      /* effectivePeriod */ return new String[] { "Period" };
5759    case 3059181:
5760      /* code */ return new String[] { "Coding" };
5761    case 3242771:
5762      /* item */ return new String[] {};
5763    default:
5764      return super.getTypesForProperty(hash, name);
5765    }
5766
5767  }
5768
5769  @Override
5770  public Base addChild(String name) throws FHIRException {
5771    if (name.equals("url")) {
5772      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.url");
5773    } else if (name.equals("identifier")) {
5774      return addIdentifier();
5775    } else if (name.equals("version")) {
5776      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.version");
5777    } else if (name.equals("name")) {
5778      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.name");
5779    } else if (name.equals("title")) {
5780      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.title");
5781    } else if (name.equals("derivedFrom")) {
5782      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.derivedFrom");
5783    } else if (name.equals("status")) {
5784      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.status");
5785    } else if (name.equals("experimental")) {
5786      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.experimental");
5787    } else if (name.equals("subjectType")) {
5788      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.subjectType");
5789    } else if (name.equals("date")) {
5790      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.date");
5791    } else if (name.equals("publisher")) {
5792      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.publisher");
5793    } else if (name.equals("contact")) {
5794      return addContact();
5795    } else if (name.equals("description")) {
5796      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.description");
5797    } else if (name.equals("useContext")) {
5798      return addUseContext();
5799    } else if (name.equals("jurisdiction")) {
5800      return addJurisdiction();
5801    } else if (name.equals("purpose")) {
5802      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.purpose");
5803    } else if (name.equals("copyright")) {
5804      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.copyright");
5805    } else if (name.equals("approvalDate")) {
5806      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.approvalDate");
5807    } else if (name.equals("lastReviewDate")) {
5808      throw new FHIRException("Cannot call addChild on a singleton property Questionnaire.lastReviewDate");
5809    } else if (name.equals("effectivePeriod")) {
5810      this.effectivePeriod = new Period();
5811      return this.effectivePeriod;
5812    } else if (name.equals("code")) {
5813      return addCode();
5814    } else if (name.equals("item")) {
5815      return addItem();
5816    } else
5817      return super.addChild(name);
5818  }
5819
5820  public String fhirType() {
5821    return "Questionnaire";
5822
5823  }
5824
5825  public Questionnaire copy() {
5826    Questionnaire dst = new Questionnaire();
5827    copyValues(dst);
5828    return dst;
5829  }
5830
5831  public void copyValues(Questionnaire dst) {
5832    super.copyValues(dst);
5833    dst.url = url == null ? null : url.copy();
5834    if (identifier != null) {
5835      dst.identifier = new ArrayList<Identifier>();
5836      for (Identifier i : identifier)
5837        dst.identifier.add(i.copy());
5838    }
5839    ;
5840    dst.version = version == null ? null : version.copy();
5841    dst.name = name == null ? null : name.copy();
5842    dst.title = title == null ? null : title.copy();
5843    if (derivedFrom != null) {
5844      dst.derivedFrom = new ArrayList<CanonicalType>();
5845      for (CanonicalType i : derivedFrom)
5846        dst.derivedFrom.add(i.copy());
5847    }
5848    ;
5849    dst.status = status == null ? null : status.copy();
5850    dst.experimental = experimental == null ? null : experimental.copy();
5851    if (subjectType != null) {
5852      dst.subjectType = new ArrayList<CodeType>();
5853      for (CodeType i : subjectType)
5854        dst.subjectType.add(i.copy());
5855    }
5856    ;
5857    dst.date = date == null ? null : date.copy();
5858    dst.publisher = publisher == null ? null : publisher.copy();
5859    if (contact != null) {
5860      dst.contact = new ArrayList<ContactDetail>();
5861      for (ContactDetail i : contact)
5862        dst.contact.add(i.copy());
5863    }
5864    ;
5865    dst.description = description == null ? null : description.copy();
5866    if (useContext != null) {
5867      dst.useContext = new ArrayList<UsageContext>();
5868      for (UsageContext i : useContext)
5869        dst.useContext.add(i.copy());
5870    }
5871    ;
5872    if (jurisdiction != null) {
5873      dst.jurisdiction = new ArrayList<CodeableConcept>();
5874      for (CodeableConcept i : jurisdiction)
5875        dst.jurisdiction.add(i.copy());
5876    }
5877    ;
5878    dst.purpose = purpose == null ? null : purpose.copy();
5879    dst.copyright = copyright == null ? null : copyright.copy();
5880    dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
5881    dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
5882    dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
5883    if (code != null) {
5884      dst.code = new ArrayList<Coding>();
5885      for (Coding i : code)
5886        dst.code.add(i.copy());
5887    }
5888    ;
5889    if (item != null) {
5890      dst.item = new ArrayList<QuestionnaireItemComponent>();
5891      for (QuestionnaireItemComponent i : item)
5892        dst.item.add(i.copy());
5893    }
5894    ;
5895  }
5896
5897  protected Questionnaire typedCopy() {
5898    return copy();
5899  }
5900
5901  @Override
5902  public boolean equalsDeep(Base other_) {
5903    if (!super.equalsDeep(other_))
5904      return false;
5905    if (!(other_ instanceof Questionnaire))
5906      return false;
5907    Questionnaire o = (Questionnaire) other_;
5908    return compareDeep(identifier, o.identifier, true) && compareDeep(derivedFrom, o.derivedFrom, true)
5909        && compareDeep(subjectType, o.subjectType, true) && compareDeep(purpose, o.purpose, true)
5910        && compareDeep(copyright, o.copyright, true) && compareDeep(approvalDate, o.approvalDate, true)
5911        && compareDeep(lastReviewDate, o.lastReviewDate, true) && compareDeep(effectivePeriod, o.effectivePeriod, true)
5912        && compareDeep(code, o.code, true) && compareDeep(item, o.item, true);
5913  }
5914
5915  @Override
5916  public boolean equalsShallow(Base other_) {
5917    if (!super.equalsShallow(other_))
5918      return false;
5919    if (!(other_ instanceof Questionnaire))
5920      return false;
5921    Questionnaire o = (Questionnaire) other_;
5922    return compareValues(subjectType, o.subjectType, true) && compareValues(purpose, o.purpose, true)
5923        && compareValues(copyright, o.copyright, true) && compareValues(approvalDate, o.approvalDate, true)
5924        && compareValues(lastReviewDate, o.lastReviewDate, true);
5925  }
5926
5927  public boolean isEmpty() {
5928    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, derivedFrom, subjectType, purpose,
5929        copyright, approvalDate, lastReviewDate, effectivePeriod, code, item);
5930  }
5931
5932  @Override
5933  public ResourceType getResourceType() {
5934    return ResourceType.Questionnaire;
5935  }
5936
5937  /**
5938   * Search parameter: <b>date</b>
5939   * <p>
5940   * Description: <b>The questionnaire publication date</b><br>
5941   * Type: <b>date</b><br>
5942   * Path: <b>Questionnaire.date</b><br>
5943   * </p>
5944   */
5945  @SearchParamDefinition(name = "date", path = "Questionnaire.date", description = "The questionnaire publication date", type = "date")
5946  public static final String SP_DATE = "date";
5947  /**
5948   * <b>Fluent Client</b> search parameter constant for <b>date</b>
5949   * <p>
5950   * Description: <b>The questionnaire publication date</b><br>
5951   * Type: <b>date</b><br>
5952   * Path: <b>Questionnaire.date</b><br>
5953   * </p>
5954   */
5955  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
5956      SP_DATE);
5957
5958  /**
5959   * Search parameter: <b>identifier</b>
5960   * <p>
5961   * Description: <b>External identifier for the questionnaire</b><br>
5962   * Type: <b>token</b><br>
5963   * Path: <b>Questionnaire.identifier</b><br>
5964   * </p>
5965   */
5966  @SearchParamDefinition(name = "identifier", path = "Questionnaire.identifier", description = "External identifier for the questionnaire", type = "token")
5967  public static final String SP_IDENTIFIER = "identifier";
5968  /**
5969   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5970   * <p>
5971   * Description: <b>External identifier for the questionnaire</b><br>
5972   * Type: <b>token</b><br>
5973   * Path: <b>Questionnaire.identifier</b><br>
5974   * </p>
5975   */
5976  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5977      SP_IDENTIFIER);
5978
5979  /**
5980   * Search parameter: <b>code</b>
5981   * <p>
5982   * Description: <b>A code that corresponds to one of its items in the
5983   * questionnaire</b><br>
5984   * Type: <b>token</b><br>
5985   * Path: <b>Questionnaire.item.code</b><br>
5986   * </p>
5987   */
5988  @SearchParamDefinition(name = "code", path = "Questionnaire.item.code", description = "A code that corresponds to one of its items in the questionnaire", type = "token")
5989  public static final String SP_CODE = "code";
5990  /**
5991   * <b>Fluent Client</b> search parameter constant for <b>code</b>
5992   * <p>
5993   * Description: <b>A code that corresponds to one of its items in the
5994   * questionnaire</b><br>
5995   * Type: <b>token</b><br>
5996   * Path: <b>Questionnaire.item.code</b><br>
5997   * </p>
5998   */
5999  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6000      SP_CODE);
6001
6002  /**
6003   * Search parameter: <b>context-type-value</b>
6004   * <p>
6005   * Description: <b>A use context type and value assigned to the
6006   * questionnaire</b><br>
6007   * Type: <b>composite</b><br>
6008   * Path: <b></b><br>
6009   * </p>
6010   */
6011  @SearchParamDefinition(name = "context-type-value", path = "Questionnaire.useContext", description = "A use context type and value assigned to the questionnaire", type = "composite", compositeOf = {
6012      "context-type", "context" })
6013  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
6014  /**
6015   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
6016   * <p>
6017   * Description: <b>A use context type and value assigned to the
6018   * questionnaire</b><br>
6019   * Type: <b>composite</b><br>
6020   * Path: <b></b><br>
6021   * </p>
6022   */
6023  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>(
6024      SP_CONTEXT_TYPE_VALUE);
6025
6026  /**
6027   * Search parameter: <b>jurisdiction</b>
6028   * <p>
6029   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
6030   * Type: <b>token</b><br>
6031   * Path: <b>Questionnaire.jurisdiction</b><br>
6032   * </p>
6033   */
6034  @SearchParamDefinition(name = "jurisdiction", path = "Questionnaire.jurisdiction", description = "Intended jurisdiction for the questionnaire", type = "token")
6035  public static final String SP_JURISDICTION = "jurisdiction";
6036  /**
6037   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
6038   * <p>
6039   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
6040   * Type: <b>token</b><br>
6041   * Path: <b>Questionnaire.jurisdiction</b><br>
6042   * </p>
6043   */
6044  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6045      SP_JURISDICTION);
6046
6047  /**
6048   * Search parameter: <b>description</b>
6049   * <p>
6050   * Description: <b>The description of the questionnaire</b><br>
6051   * Type: <b>string</b><br>
6052   * Path: <b>Questionnaire.description</b><br>
6053   * </p>
6054   */
6055  @SearchParamDefinition(name = "description", path = "Questionnaire.description", description = "The description of the questionnaire", type = "string")
6056  public static final String SP_DESCRIPTION = "description";
6057  /**
6058   * <b>Fluent Client</b> search parameter constant for <b>description</b>
6059   * <p>
6060   * Description: <b>The description of the questionnaire</b><br>
6061   * Type: <b>string</b><br>
6062   * Path: <b>Questionnaire.description</b><br>
6063   * </p>
6064   */
6065  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(
6066      SP_DESCRIPTION);
6067
6068  /**
6069   * Search parameter: <b>context-type</b>
6070   * <p>
6071   * Description: <b>A type of use context assigned to the questionnaire</b><br>
6072   * Type: <b>token</b><br>
6073   * Path: <b>Questionnaire.useContext.code</b><br>
6074   * </p>
6075   */
6076  @SearchParamDefinition(name = "context-type", path = "Questionnaire.useContext.code", description = "A type of use context assigned to the questionnaire", type = "token")
6077  public static final String SP_CONTEXT_TYPE = "context-type";
6078  /**
6079   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
6080   * <p>
6081   * Description: <b>A type of use context assigned to the questionnaire</b><br>
6082   * Type: <b>token</b><br>
6083   * Path: <b>Questionnaire.useContext.code</b><br>
6084   * </p>
6085   */
6086  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6087      SP_CONTEXT_TYPE);
6088
6089  /**
6090   * Search parameter: <b>title</b>
6091   * <p>
6092   * Description: <b>The human-friendly name of the questionnaire</b><br>
6093   * Type: <b>string</b><br>
6094   * Path: <b>Questionnaire.title</b><br>
6095   * </p>
6096   */
6097  @SearchParamDefinition(name = "title", path = "Questionnaire.title", description = "The human-friendly name of the questionnaire", type = "string")
6098  public static final String SP_TITLE = "title";
6099  /**
6100   * <b>Fluent Client</b> search parameter constant for <b>title</b>
6101   * <p>
6102   * Description: <b>The human-friendly name of the questionnaire</b><br>
6103   * Type: <b>string</b><br>
6104   * Path: <b>Questionnaire.title</b><br>
6105   * </p>
6106   */
6107  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(
6108      SP_TITLE);
6109
6110  /**
6111   * Search parameter: <b>version</b>
6112   * <p>
6113   * Description: <b>The business version of the questionnaire</b><br>
6114   * Type: <b>token</b><br>
6115   * Path: <b>Questionnaire.version</b><br>
6116   * </p>
6117   */
6118  @SearchParamDefinition(name = "version", path = "Questionnaire.version", description = "The business version of the questionnaire", type = "token")
6119  public static final String SP_VERSION = "version";
6120  /**
6121   * <b>Fluent Client</b> search parameter constant for <b>version</b>
6122   * <p>
6123   * Description: <b>The business version of the questionnaire</b><br>
6124   * Type: <b>token</b><br>
6125   * Path: <b>Questionnaire.version</b><br>
6126   * </p>
6127   */
6128  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6129      SP_VERSION);
6130
6131  /**
6132   * Search parameter: <b>url</b>
6133   * <p>
6134   * Description: <b>The uri that identifies the questionnaire</b><br>
6135   * Type: <b>uri</b><br>
6136   * Path: <b>Questionnaire.url</b><br>
6137   * </p>
6138   */
6139  @SearchParamDefinition(name = "url", path = "Questionnaire.url", description = "The uri that identifies the questionnaire", type = "uri")
6140  public static final String SP_URL = "url";
6141  /**
6142   * <b>Fluent Client</b> search parameter constant for <b>url</b>
6143   * <p>
6144   * Description: <b>The uri that identifies the questionnaire</b><br>
6145   * Type: <b>uri</b><br>
6146   * Path: <b>Questionnaire.url</b><br>
6147   * </p>
6148   */
6149  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
6150
6151  /**
6152   * Search parameter: <b>context-quantity</b>
6153   * <p>
6154   * Description: <b>A quantity- or range-valued use context assigned to the
6155   * questionnaire</b><br>
6156   * Type: <b>quantity</b><br>
6157   * Path: <b>Questionnaire.useContext.valueQuantity,
6158   * Questionnaire.useContext.valueRange</b><br>
6159   * </p>
6160   */
6161  @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")
6162  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
6163  /**
6164   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
6165   * <p>
6166   * Description: <b>A quantity- or range-valued use context assigned to the
6167   * questionnaire</b><br>
6168   * Type: <b>quantity</b><br>
6169   * Path: <b>Questionnaire.useContext.valueQuantity,
6170   * Questionnaire.useContext.valueRange</b><br>
6171   * </p>
6172   */
6173  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
6174      SP_CONTEXT_QUANTITY);
6175
6176  /**
6177   * Search parameter: <b>effective</b>
6178   * <p>
6179   * Description: <b>The time during which the questionnaire is intended to be in
6180   * use</b><br>
6181   * Type: <b>date</b><br>
6182   * Path: <b>Questionnaire.effectivePeriod</b><br>
6183   * </p>
6184   */
6185  @SearchParamDefinition(name = "effective", path = "Questionnaire.effectivePeriod", description = "The time during which the questionnaire is intended to be in use", type = "date")
6186  public static final String SP_EFFECTIVE = "effective";
6187  /**
6188   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
6189   * <p>
6190   * Description: <b>The time during which the questionnaire is intended to be in
6191   * use</b><br>
6192   * Type: <b>date</b><br>
6193   * Path: <b>Questionnaire.effectivePeriod</b><br>
6194   * </p>
6195   */
6196  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(
6197      SP_EFFECTIVE);
6198
6199  /**
6200   * Search parameter: <b>subject-type</b>
6201   * <p>
6202   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
6203   * Type: <b>token</b><br>
6204   * Path: <b>Questionnaire.subjectType</b><br>
6205   * </p>
6206   */
6207  @SearchParamDefinition(name = "subject-type", path = "Questionnaire.subjectType", description = "Resource that can be subject of QuestionnaireResponse", type = "token")
6208  public static final String SP_SUBJECT_TYPE = "subject-type";
6209  /**
6210   * <b>Fluent Client</b> search parameter constant for <b>subject-type</b>
6211   * <p>
6212   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
6213   * Type: <b>token</b><br>
6214   * Path: <b>Questionnaire.subjectType</b><br>
6215   * </p>
6216   */
6217  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBJECT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6218      SP_SUBJECT_TYPE);
6219
6220  /**
6221   * Search parameter: <b>name</b>
6222   * <p>
6223   * Description: <b>Computationally friendly name of the questionnaire</b><br>
6224   * Type: <b>string</b><br>
6225   * Path: <b>Questionnaire.name</b><br>
6226   * </p>
6227   */
6228  @SearchParamDefinition(name = "name", path = "Questionnaire.name", description = "Computationally friendly name of the questionnaire", type = "string")
6229  public static final String SP_NAME = "name";
6230  /**
6231   * <b>Fluent Client</b> search parameter constant for <b>name</b>
6232   * <p>
6233   * Description: <b>Computationally friendly name of the questionnaire</b><br>
6234   * Type: <b>string</b><br>
6235   * Path: <b>Questionnaire.name</b><br>
6236   * </p>
6237   */
6238  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
6239      SP_NAME);
6240
6241  /**
6242   * Search parameter: <b>context</b>
6243   * <p>
6244   * Description: <b>A use context assigned to the questionnaire</b><br>
6245   * Type: <b>token</b><br>
6246   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
6247   * </p>
6248   */
6249  @SearchParamDefinition(name = "context", path = "(Questionnaire.useContext.value as CodeableConcept)", description = "A use context assigned to the questionnaire", type = "token")
6250  public static final String SP_CONTEXT = "context";
6251  /**
6252   * <b>Fluent Client</b> search parameter constant for <b>context</b>
6253   * <p>
6254   * Description: <b>A use context assigned to the questionnaire</b><br>
6255   * Type: <b>token</b><br>
6256   * Path: <b>Questionnaire.useContext.valueCodeableConcept</b><br>
6257   * </p>
6258   */
6259  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6260      SP_CONTEXT);
6261
6262  /**
6263   * Search parameter: <b>publisher</b>
6264   * <p>
6265   * Description: <b>Name of the publisher of the questionnaire</b><br>
6266   * Type: <b>string</b><br>
6267   * Path: <b>Questionnaire.publisher</b><br>
6268   * </p>
6269   */
6270  @SearchParamDefinition(name = "publisher", path = "Questionnaire.publisher", description = "Name of the publisher of the questionnaire", type = "string")
6271  public static final String SP_PUBLISHER = "publisher";
6272  /**
6273   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
6274   * <p>
6275   * Description: <b>Name of the publisher of the questionnaire</b><br>
6276   * Type: <b>string</b><br>
6277   * Path: <b>Questionnaire.publisher</b><br>
6278   * </p>
6279   */
6280  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(
6281      SP_PUBLISHER);
6282
6283  /**
6284   * Search parameter: <b>definition</b>
6285   * <p>
6286   * Description: <b>ElementDefinition - details for the item</b><br>
6287   * Type: <b>uri</b><br>
6288   * Path: <b>Questionnaire.item.definition</b><br>
6289   * </p>
6290   */
6291  @SearchParamDefinition(name = "definition", path = "Questionnaire.item.definition", description = "ElementDefinition - details for the item", type = "uri")
6292  public static final String SP_DEFINITION = "definition";
6293  /**
6294   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
6295   * <p>
6296   * Description: <b>ElementDefinition - details for the item</b><br>
6297   * Type: <b>uri</b><br>
6298   * Path: <b>Questionnaire.item.definition</b><br>
6299   * </p>
6300   */
6301  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(
6302      SP_DEFINITION);
6303
6304  /**
6305   * Search parameter: <b>context-type-quantity</b>
6306   * <p>
6307   * Description: <b>A use context type and quantity- or range-based value
6308   * assigned to the questionnaire</b><br>
6309   * Type: <b>composite</b><br>
6310   * Path: <b></b><br>
6311   * </p>
6312   */
6313  @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 = {
6314      "context-type", "context-quantity" })
6315  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
6316  /**
6317   * <b>Fluent Client</b> search parameter constant for
6318   * <b>context-type-quantity</b>
6319   * <p>
6320   * Description: <b>A use context type and quantity- or range-based value
6321   * assigned to the questionnaire</b><br>
6322   * Type: <b>composite</b><br>
6323   * Path: <b></b><br>
6324   * </p>
6325   */
6326  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>(
6327      SP_CONTEXT_TYPE_QUANTITY);
6328
6329  /**
6330   * Search parameter: <b>status</b>
6331   * <p>
6332   * Description: <b>The current status of the questionnaire</b><br>
6333   * Type: <b>token</b><br>
6334   * Path: <b>Questionnaire.status</b><br>
6335   * </p>
6336   */
6337  @SearchParamDefinition(name = "status", path = "Questionnaire.status", description = "The current status of the questionnaire", type = "token")
6338  public static final String SP_STATUS = "status";
6339  /**
6340   * <b>Fluent Client</b> search parameter constant for <b>status</b>
6341   * <p>
6342   * Description: <b>The current status of the questionnaire</b><br>
6343   * Type: <b>token</b><br>
6344   * Path: <b>Questionnaire.status</b><br>
6345   * </p>
6346   */
6347  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
6348      SP_STATUS);
6349
6350}