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