001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 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 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057 058import ca.uhn.fhir.model.api.annotation.Block; 059import ca.uhn.fhir.model.api.annotation.Child; 060import ca.uhn.fhir.model.api.annotation.Description; 061import ca.uhn.fhir.model.api.annotation.ResourceDef; 062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 063import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 064import org.hl7.fhir.exceptions.FHIRException; 065import org.hl7.fhir.utilities.Utilities; 066/** 067 * A structured set of questions intended to guide the collection of answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the underlying questions. 068 */ 069@ResourceDef(name="Questionnaire", profile="http://hl7.org/fhir/Profile/Questionnaire") 070public class Questionnaire extends DomainResource { 071 072 public enum QuestionnaireStatus { 073 /** 074 * This Questionnaire is not ready for official use. 075 */ 076 DRAFT, 077 /** 078 * This Questionnaire is ready for use. 079 */ 080 PUBLISHED, 081 /** 082 * This Questionnaire should no longer be used to gather data. 083 */ 084 RETIRED, 085 /** 086 * added to help the parsers 087 */ 088 NULL; 089 public static QuestionnaireStatus fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("draft".equals(codeString)) 093 return DRAFT; 094 if ("published".equals(codeString)) 095 return PUBLISHED; 096 if ("retired".equals(codeString)) 097 return RETIRED; 098 throw new FHIRException("Unknown QuestionnaireStatus code '"+codeString+"'"); 099 } 100 public String toCode() { 101 switch (this) { 102 case DRAFT: return "draft"; 103 case PUBLISHED: return "published"; 104 case RETIRED: return "retired"; 105 default: return "?"; 106 } 107 } 108 public String getSystem() { 109 switch (this) { 110 case DRAFT: return "http://hl7.org/fhir/questionnaire-status"; 111 case PUBLISHED: return "http://hl7.org/fhir/questionnaire-status"; 112 case RETIRED: return "http://hl7.org/fhir/questionnaire-status"; 113 default: return "?"; 114 } 115 } 116 public String getDefinition() { 117 switch (this) { 118 case DRAFT: return "This Questionnaire is not ready for official use."; 119 case PUBLISHED: return "This Questionnaire is ready for use."; 120 case RETIRED: return "This Questionnaire should no longer be used to gather data."; 121 default: return "?"; 122 } 123 } 124 public String getDisplay() { 125 switch (this) { 126 case DRAFT: return "Draft"; 127 case PUBLISHED: return "Published"; 128 case RETIRED: return "Retired"; 129 default: return "?"; 130 } 131 } 132 } 133 134 public static class QuestionnaireStatusEnumFactory implements EnumFactory<QuestionnaireStatus> { 135 public QuestionnaireStatus fromCode(String codeString) throws IllegalArgumentException { 136 if (codeString == null || "".equals(codeString)) 137 if (codeString == null || "".equals(codeString)) 138 return null; 139 if ("draft".equals(codeString)) 140 return QuestionnaireStatus.DRAFT; 141 if ("published".equals(codeString)) 142 return QuestionnaireStatus.PUBLISHED; 143 if ("retired".equals(codeString)) 144 return QuestionnaireStatus.RETIRED; 145 throw new IllegalArgumentException("Unknown QuestionnaireStatus code '"+codeString+"'"); 146 } 147 public Enumeration<QuestionnaireStatus> fromType(Base code) throws FHIRException { 148 if (code == null || code.isEmpty()) 149 return null; 150 String codeString = ((PrimitiveType) code).asStringValue(); 151 if (codeString == null || "".equals(codeString)) 152 return null; 153 if ("draft".equals(codeString)) 154 return new Enumeration<QuestionnaireStatus>(this, QuestionnaireStatus.DRAFT); 155 if ("published".equals(codeString)) 156 return new Enumeration<QuestionnaireStatus>(this, QuestionnaireStatus.PUBLISHED); 157 if ("retired".equals(codeString)) 158 return new Enumeration<QuestionnaireStatus>(this, QuestionnaireStatus.RETIRED); 159 throw new FHIRException("Unknown QuestionnaireStatus code '"+codeString+"'"); 160 } 161 public String toCode(QuestionnaireStatus code) { 162 if (code == QuestionnaireStatus.DRAFT) 163 return "draft"; 164 if (code == QuestionnaireStatus.PUBLISHED) 165 return "published"; 166 if (code == QuestionnaireStatus.RETIRED) 167 return "retired"; 168 return "?"; 169 } 170 } 171 172 public enum AnswerFormat { 173 /** 174 * Answer is a yes/no answer. 175 */ 176 BOOLEAN, 177 /** 178 * Answer is a floating point number. 179 */ 180 DECIMAL, 181 /** 182 * Answer is an integer. 183 */ 184 INTEGER, 185 /** 186 * Answer is a date. 187 */ 188 DATE, 189 /** 190 * Answer is a date and time. 191 */ 192 DATETIME, 193 /** 194 * Answer is a system timestamp. 195 */ 196 INSTANT, 197 /** 198 * Answer is a time (hour/minute/second) independent of date. 199 */ 200 TIME, 201 /** 202 * Answer is a short (few words to short sentence) free-text entry. 203 */ 204 STRING, 205 /** 206 * Answer is a long (potentially multi-paragraph) free-text entry (still captured as a string). 207 */ 208 TEXT, 209 /** 210 * Answer is a url (website, FTP site, etc.). 211 */ 212 URL, 213 /** 214 * Answer is a Coding drawn from a list of options. 215 */ 216 CHOICE, 217 /** 218 * Answer is a Coding drawn from a list of options or a free-text entry. 219 */ 220 OPENCHOICE, 221 /** 222 * Answer is binary content such as a image, PDF, etc. 223 */ 224 ATTACHMENT, 225 /** 226 * Answer is a reference to another resource (practitioner, organization, etc.). 227 */ 228 REFERENCE, 229 /** 230 * Answer is a combination of a numeric value and unit, potentially with a comparator (<, >, etc.). 231 */ 232 QUANTITY, 233 /** 234 * added to help the parsers 235 */ 236 NULL; 237 public static AnswerFormat fromCode(String codeString) throws FHIRException { 238 if (codeString == null || "".equals(codeString)) 239 return null; 240 if ("boolean".equals(codeString)) 241 return BOOLEAN; 242 if ("decimal".equals(codeString)) 243 return DECIMAL; 244 if ("integer".equals(codeString)) 245 return INTEGER; 246 if ("date".equals(codeString)) 247 return DATE; 248 if ("dateTime".equals(codeString)) 249 return DATETIME; 250 if ("instant".equals(codeString)) 251 return INSTANT; 252 if ("time".equals(codeString)) 253 return TIME; 254 if ("string".equals(codeString)) 255 return STRING; 256 if ("text".equals(codeString)) 257 return TEXT; 258 if ("url".equals(codeString)) 259 return URL; 260 if ("choice".equals(codeString)) 261 return CHOICE; 262 if ("open-choice".equals(codeString)) 263 return OPENCHOICE; 264 if ("attachment".equals(codeString)) 265 return ATTACHMENT; 266 if ("reference".equals(codeString)) 267 return REFERENCE; 268 if ("quantity".equals(codeString)) 269 return QUANTITY; 270 throw new FHIRException("Unknown AnswerFormat code '"+codeString+"'"); 271 } 272 public String toCode() { 273 switch (this) { 274 case BOOLEAN: return "boolean"; 275 case DECIMAL: return "decimal"; 276 case INTEGER: return "integer"; 277 case DATE: return "date"; 278 case DATETIME: return "dateTime"; 279 case INSTANT: return "instant"; 280 case TIME: return "time"; 281 case STRING: return "string"; 282 case TEXT: return "text"; 283 case URL: return "url"; 284 case CHOICE: return "choice"; 285 case OPENCHOICE: return "open-choice"; 286 case ATTACHMENT: return "attachment"; 287 case REFERENCE: return "reference"; 288 case QUANTITY: return "quantity"; 289 default: return "?"; 290 } 291 } 292 public String getSystem() { 293 switch (this) { 294 case BOOLEAN: return "http://hl7.org/fhir/answer-format"; 295 case DECIMAL: return "http://hl7.org/fhir/answer-format"; 296 case INTEGER: return "http://hl7.org/fhir/answer-format"; 297 case DATE: return "http://hl7.org/fhir/answer-format"; 298 case DATETIME: return "http://hl7.org/fhir/answer-format"; 299 case INSTANT: return "http://hl7.org/fhir/answer-format"; 300 case TIME: return "http://hl7.org/fhir/answer-format"; 301 case STRING: return "http://hl7.org/fhir/answer-format"; 302 case TEXT: return "http://hl7.org/fhir/answer-format"; 303 case URL: return "http://hl7.org/fhir/answer-format"; 304 case CHOICE: return "http://hl7.org/fhir/answer-format"; 305 case OPENCHOICE: return "http://hl7.org/fhir/answer-format"; 306 case ATTACHMENT: return "http://hl7.org/fhir/answer-format"; 307 case REFERENCE: return "http://hl7.org/fhir/answer-format"; 308 case QUANTITY: return "http://hl7.org/fhir/answer-format"; 309 default: return "?"; 310 } 311 } 312 public String getDefinition() { 313 switch (this) { 314 case BOOLEAN: return "Answer is a yes/no answer."; 315 case DECIMAL: return "Answer is a floating point number."; 316 case INTEGER: return "Answer is an integer."; 317 case DATE: return "Answer is a date."; 318 case DATETIME: return "Answer is a date and time."; 319 case INSTANT: return "Answer is a system timestamp."; 320 case TIME: return "Answer is a time (hour/minute/second) independent of date."; 321 case STRING: return "Answer is a short (few words to short sentence) free-text entry."; 322 case TEXT: return "Answer is a long (potentially multi-paragraph) free-text entry (still captured as a string)."; 323 case URL: return "Answer is a url (website, FTP site, etc.)."; 324 case CHOICE: return "Answer is a Coding drawn from a list of options."; 325 case OPENCHOICE: return "Answer is a Coding drawn from a list of options or a free-text entry."; 326 case ATTACHMENT: return "Answer is binary content such as a image, PDF, etc."; 327 case REFERENCE: return "Answer is a reference to another resource (practitioner, organization, etc.)."; 328 case QUANTITY: return "Answer is a combination of a numeric value and unit, potentially with a comparator (<, >, etc.)."; 329 default: return "?"; 330 } 331 } 332 public String getDisplay() { 333 switch (this) { 334 case BOOLEAN: return "Boolean"; 335 case DECIMAL: return "Decimal"; 336 case INTEGER: return "Integer"; 337 case DATE: return "Date"; 338 case DATETIME: return "Date Time"; 339 case INSTANT: return "Instant"; 340 case TIME: return "Time"; 341 case STRING: return "String"; 342 case TEXT: return "Text"; 343 case URL: return "Url"; 344 case CHOICE: return "Choice"; 345 case OPENCHOICE: return "Open Choice"; 346 case ATTACHMENT: return "Attachment"; 347 case REFERENCE: return "Reference"; 348 case QUANTITY: return "Quantity"; 349 default: return "?"; 350 } 351 } 352 } 353 354 public static class AnswerFormatEnumFactory implements EnumFactory<AnswerFormat> { 355 public AnswerFormat fromCode(String codeString) throws IllegalArgumentException { 356 if (codeString == null || "".equals(codeString)) 357 if (codeString == null || "".equals(codeString)) 358 return null; 359 if ("boolean".equals(codeString)) 360 return AnswerFormat.BOOLEAN; 361 if ("decimal".equals(codeString)) 362 return AnswerFormat.DECIMAL; 363 if ("integer".equals(codeString)) 364 return AnswerFormat.INTEGER; 365 if ("date".equals(codeString)) 366 return AnswerFormat.DATE; 367 if ("dateTime".equals(codeString)) 368 return AnswerFormat.DATETIME; 369 if ("instant".equals(codeString)) 370 return AnswerFormat.INSTANT; 371 if ("time".equals(codeString)) 372 return AnswerFormat.TIME; 373 if ("string".equals(codeString)) 374 return AnswerFormat.STRING; 375 if ("text".equals(codeString)) 376 return AnswerFormat.TEXT; 377 if ("url".equals(codeString)) 378 return AnswerFormat.URL; 379 if ("choice".equals(codeString)) 380 return AnswerFormat.CHOICE; 381 if ("open-choice".equals(codeString)) 382 return AnswerFormat.OPENCHOICE; 383 if ("attachment".equals(codeString)) 384 return AnswerFormat.ATTACHMENT; 385 if ("reference".equals(codeString)) 386 return AnswerFormat.REFERENCE; 387 if ("quantity".equals(codeString)) 388 return AnswerFormat.QUANTITY; 389 throw new IllegalArgumentException("Unknown AnswerFormat code '"+codeString+"'"); 390 } 391 public Enumeration<AnswerFormat> fromType(Base code) throws FHIRException { 392 if (code == null || code.isEmpty()) 393 return null; 394 String codeString = ((PrimitiveType) code).asStringValue(); 395 if (codeString == null || "".equals(codeString)) 396 return null; 397 if ("boolean".equals(codeString)) 398 return new Enumeration<AnswerFormat>(this, AnswerFormat.BOOLEAN); 399 if ("decimal".equals(codeString)) 400 return new Enumeration<AnswerFormat>(this, AnswerFormat.DECIMAL); 401 if ("integer".equals(codeString)) 402 return new Enumeration<AnswerFormat>(this, AnswerFormat.INTEGER); 403 if ("date".equals(codeString)) 404 return new Enumeration<AnswerFormat>(this, AnswerFormat.DATE); 405 if ("dateTime".equals(codeString)) 406 return new Enumeration<AnswerFormat>(this, AnswerFormat.DATETIME); 407 if ("instant".equals(codeString)) 408 return new Enumeration<AnswerFormat>(this, AnswerFormat.INSTANT); 409 if ("time".equals(codeString)) 410 return new Enumeration<AnswerFormat>(this, AnswerFormat.TIME); 411 if ("string".equals(codeString)) 412 return new Enumeration<AnswerFormat>(this, AnswerFormat.STRING); 413 if ("text".equals(codeString)) 414 return new Enumeration<AnswerFormat>(this, AnswerFormat.TEXT); 415 if ("url".equals(codeString)) 416 return new Enumeration<AnswerFormat>(this, AnswerFormat.URL); 417 if ("choice".equals(codeString)) 418 return new Enumeration<AnswerFormat>(this, AnswerFormat.CHOICE); 419 if ("open-choice".equals(codeString)) 420 return new Enumeration<AnswerFormat>(this, AnswerFormat.OPENCHOICE); 421 if ("attachment".equals(codeString)) 422 return new Enumeration<AnswerFormat>(this, AnswerFormat.ATTACHMENT); 423 if ("reference".equals(codeString)) 424 return new Enumeration<AnswerFormat>(this, AnswerFormat.REFERENCE); 425 if ("quantity".equals(codeString)) 426 return new Enumeration<AnswerFormat>(this, AnswerFormat.QUANTITY); 427 throw new FHIRException("Unknown AnswerFormat code '"+codeString+"'"); 428 } 429 public String toCode(AnswerFormat code) { 430 if (code == AnswerFormat.BOOLEAN) 431 return "boolean"; 432 if (code == AnswerFormat.DECIMAL) 433 return "decimal"; 434 if (code == AnswerFormat.INTEGER) 435 return "integer"; 436 if (code == AnswerFormat.DATE) 437 return "date"; 438 if (code == AnswerFormat.DATETIME) 439 return "dateTime"; 440 if (code == AnswerFormat.INSTANT) 441 return "instant"; 442 if (code == AnswerFormat.TIME) 443 return "time"; 444 if (code == AnswerFormat.STRING) 445 return "string"; 446 if (code == AnswerFormat.TEXT) 447 return "text"; 448 if (code == AnswerFormat.URL) 449 return "url"; 450 if (code == AnswerFormat.CHOICE) 451 return "choice"; 452 if (code == AnswerFormat.OPENCHOICE) 453 return "open-choice"; 454 if (code == AnswerFormat.ATTACHMENT) 455 return "attachment"; 456 if (code == AnswerFormat.REFERENCE) 457 return "reference"; 458 if (code == AnswerFormat.QUANTITY) 459 return "quantity"; 460 return "?"; 461 } 462 } 463 464 @Block() 465 public static class GroupComponent extends BackboneElement implements IBaseBackboneElement { 466 /** 467 * An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource. 468 */ 469 @Child(name = "linkId", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false) 470 @Description(shortDefinition="To link questionnaire with questionnaire response", formalDefinition="An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource." ) 471 protected StringType linkId; 472 473 /** 474 * The human-readable name for this section of the questionnaire. 475 */ 476 @Child(name = "title", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 477 @Description(shortDefinition="Name to be displayed for group", formalDefinition="The human-readable name for this section of the questionnaire." ) 478 protected StringType title; 479 480 /** 481 * Identifies a how this group of questions is known in a particular terminology such as LOINC. 482 */ 483 @Child(name = "concept", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 484 @Description(shortDefinition="Concept that represents this section in a questionnaire", formalDefinition="Identifies a how this group of questions is known in a particular terminology such as LOINC." ) 485 protected List<Coding> concept; 486 487 /** 488 * Additional text for the group, used for display purposes. 489 */ 490 @Child(name = "text", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false) 491 @Description(shortDefinition="Additional text for the group", formalDefinition="Additional text for the group, used for display purposes." ) 492 protected StringType text; 493 494 /** 495 * If true, indicates that the group must be present and have required questions within it answered. If false, the group may be skipped when answering the questionnaire. 496 */ 497 @Child(name = "required", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=false) 498 @Description(shortDefinition="Whether the group must be included in data results", formalDefinition="If true, indicates that the group must be present and have required questions within it answered. If false, the group may be skipped when answering the questionnaire." ) 499 protected BooleanType required; 500 501 /** 502 * Whether the group may occur multiple times in the instance, containing multiple sets of answers. 503 */ 504 @Child(name = "repeats", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=false) 505 @Description(shortDefinition="Whether the group may repeat", formalDefinition="Whether the group may occur multiple times in the instance, containing multiple sets of answers." ) 506 protected BooleanType repeats; 507 508 /** 509 * A sub-group within a group. The ordering of groups within this group is relevant. 510 */ 511 @Child(name = "group", type = {GroupComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 512 @Description(shortDefinition="Nested questionnaire group", formalDefinition="A sub-group within a group. The ordering of groups within this group is relevant." ) 513 protected List<GroupComponent> group; 514 515 /** 516 * Set of questions within this group. The order of questions within the group is relevant. 517 */ 518 @Child(name = "question", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 519 @Description(shortDefinition="Questions in this group", formalDefinition="Set of questions within this group. The order of questions within the group is relevant." ) 520 protected List<QuestionComponent> question; 521 522 private static final long serialVersionUID = 494129548L; 523 524 /* 525 * Constructor 526 */ 527 public GroupComponent() { 528 super(); 529 } 530 531 /** 532 * @return {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value 533 */ 534 public StringType getLinkIdElement() { 535 if (this.linkId == null) 536 if (Configuration.errorOnAutoCreate()) 537 throw new Error("Attempt to auto-create GroupComponent.linkId"); 538 else if (Configuration.doAutoCreate()) 539 this.linkId = new StringType(); // bb 540 return this.linkId; 541 } 542 543 public boolean hasLinkIdElement() { 544 return this.linkId != null && !this.linkId.isEmpty(); 545 } 546 547 public boolean hasLinkId() { 548 return this.linkId != null && !this.linkId.isEmpty(); 549 } 550 551 /** 552 * @param value {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value 553 */ 554 public GroupComponent setLinkIdElement(StringType value) { 555 this.linkId = value; 556 return this; 557 } 558 559 /** 560 * @return An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource. 561 */ 562 public String getLinkId() { 563 return this.linkId == null ? null : this.linkId.getValue(); 564 } 565 566 /** 567 * @param value An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource. 568 */ 569 public GroupComponent setLinkId(String value) { 570 if (Utilities.noString(value)) 571 this.linkId = null; 572 else { 573 if (this.linkId == null) 574 this.linkId = new StringType(); 575 this.linkId.setValue(value); 576 } 577 return this; 578 } 579 580 /** 581 * @return {@link #title} (The human-readable name for this section of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 582 */ 583 public StringType getTitleElement() { 584 if (this.title == null) 585 if (Configuration.errorOnAutoCreate()) 586 throw new Error("Attempt to auto-create GroupComponent.title"); 587 else if (Configuration.doAutoCreate()) 588 this.title = new StringType(); // bb 589 return this.title; 590 } 591 592 public boolean hasTitleElement() { 593 return this.title != null && !this.title.isEmpty(); 594 } 595 596 public boolean hasTitle() { 597 return this.title != null && !this.title.isEmpty(); 598 } 599 600 /** 601 * @param value {@link #title} (The human-readable name for this section of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 602 */ 603 public GroupComponent setTitleElement(StringType value) { 604 this.title = value; 605 return this; 606 } 607 608 /** 609 * @return The human-readable name for this section of the questionnaire. 610 */ 611 public String getTitle() { 612 return this.title == null ? null : this.title.getValue(); 613 } 614 615 /** 616 * @param value The human-readable name for this section of the questionnaire. 617 */ 618 public GroupComponent setTitle(String value) { 619 if (Utilities.noString(value)) 620 this.title = null; 621 else { 622 if (this.title == null) 623 this.title = new StringType(); 624 this.title.setValue(value); 625 } 626 return this; 627 } 628 629 /** 630 * @return {@link #concept} (Identifies a how this group of questions is known in a particular terminology such as LOINC.) 631 */ 632 public List<Coding> getConcept() { 633 if (this.concept == null) 634 this.concept = new ArrayList<Coding>(); 635 return this.concept; 636 } 637 638 public boolean hasConcept() { 639 if (this.concept == null) 640 return false; 641 for (Coding item : this.concept) 642 if (!item.isEmpty()) 643 return true; 644 return false; 645 } 646 647 /** 648 * @return {@link #concept} (Identifies a how this group of questions is known in a particular terminology such as LOINC.) 649 */ 650 // syntactic sugar 651 public Coding addConcept() { //3 652 Coding t = new Coding(); 653 if (this.concept == null) 654 this.concept = new ArrayList<Coding>(); 655 this.concept.add(t); 656 return t; 657 } 658 659 // syntactic sugar 660 public GroupComponent addConcept(Coding t) { //3 661 if (t == null) 662 return this; 663 if (this.concept == null) 664 this.concept = new ArrayList<Coding>(); 665 this.concept.add(t); 666 return this; 667 } 668 669 /** 670 * @return {@link #text} (Additional text for the group, used for display purposes.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 671 */ 672 public StringType getTextElement() { 673 if (this.text == null) 674 if (Configuration.errorOnAutoCreate()) 675 throw new Error("Attempt to auto-create GroupComponent.text"); 676 else if (Configuration.doAutoCreate()) 677 this.text = new StringType(); // bb 678 return this.text; 679 } 680 681 public boolean hasTextElement() { 682 return this.text != null && !this.text.isEmpty(); 683 } 684 685 public boolean hasText() { 686 return this.text != null && !this.text.isEmpty(); 687 } 688 689 /** 690 * @param value {@link #text} (Additional text for the group, used for display purposes.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 691 */ 692 public GroupComponent setTextElement(StringType value) { 693 this.text = value; 694 return this; 695 } 696 697 /** 698 * @return Additional text for the group, used for display purposes. 699 */ 700 public String getText() { 701 return this.text == null ? null : this.text.getValue(); 702 } 703 704 /** 705 * @param value Additional text for the group, used for display purposes. 706 */ 707 public GroupComponent setText(String value) { 708 if (Utilities.noString(value)) 709 this.text = null; 710 else { 711 if (this.text == null) 712 this.text = new StringType(); 713 this.text.setValue(value); 714 } 715 return this; 716 } 717 718 /** 719 * @return {@link #required} (If true, indicates that the group must be present and have required questions within it answered. If false, the group 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 720 */ 721 public BooleanType getRequiredElement() { 722 if (this.required == null) 723 if (Configuration.errorOnAutoCreate()) 724 throw new Error("Attempt to auto-create GroupComponent.required"); 725 else if (Configuration.doAutoCreate()) 726 this.required = new BooleanType(); // bb 727 return this.required; 728 } 729 730 public boolean hasRequiredElement() { 731 return this.required != null && !this.required.isEmpty(); 732 } 733 734 public boolean hasRequired() { 735 return this.required != null && !this.required.isEmpty(); 736 } 737 738 /** 739 * @param value {@link #required} (If true, indicates that the group must be present and have required questions within it answered. If false, the group 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 740 */ 741 public GroupComponent setRequiredElement(BooleanType value) { 742 this.required = value; 743 return this; 744 } 745 746 /** 747 * @return If true, indicates that the group must be present and have required questions within it answered. If false, the group may be skipped when answering the questionnaire. 748 */ 749 public boolean getRequired() { 750 return this.required == null || this.required.isEmpty() ? false : this.required.getValue(); 751 } 752 753 /** 754 * @param value If true, indicates that the group must be present and have required questions within it answered. If false, the group may be skipped when answering the questionnaire. 755 */ 756 public GroupComponent setRequired(boolean value) { 757 if (this.required == null) 758 this.required = new BooleanType(); 759 this.required.setValue(value); 760 return this; 761 } 762 763 /** 764 * @return {@link #repeats} (Whether the group may occur multiple times in the instance, containing multiple sets of answers.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value 765 */ 766 public BooleanType getRepeatsElement() { 767 if (this.repeats == null) 768 if (Configuration.errorOnAutoCreate()) 769 throw new Error("Attempt to auto-create GroupComponent.repeats"); 770 else if (Configuration.doAutoCreate()) 771 this.repeats = new BooleanType(); // bb 772 return this.repeats; 773 } 774 775 public boolean hasRepeatsElement() { 776 return this.repeats != null && !this.repeats.isEmpty(); 777 } 778 779 public boolean hasRepeats() { 780 return this.repeats != null && !this.repeats.isEmpty(); 781 } 782 783 /** 784 * @param value {@link #repeats} (Whether the group may occur multiple times in the instance, containing multiple sets of answers.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value 785 */ 786 public GroupComponent setRepeatsElement(BooleanType value) { 787 this.repeats = value; 788 return this; 789 } 790 791 /** 792 * @return Whether the group may occur multiple times in the instance, containing multiple sets of answers. 793 */ 794 public boolean getRepeats() { 795 return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue(); 796 } 797 798 /** 799 * @param value Whether the group may occur multiple times in the instance, containing multiple sets of answers. 800 */ 801 public GroupComponent setRepeats(boolean value) { 802 if (this.repeats == null) 803 this.repeats = new BooleanType(); 804 this.repeats.setValue(value); 805 return this; 806 } 807 808 /** 809 * @return {@link #group} (A sub-group within a group. The ordering of groups within this group is relevant.) 810 */ 811 public List<GroupComponent> getGroup() { 812 if (this.group == null) 813 this.group = new ArrayList<GroupComponent>(); 814 return this.group; 815 } 816 817 public boolean hasGroup() { 818 if (this.group == null) 819 return false; 820 for (GroupComponent item : this.group) 821 if (!item.isEmpty()) 822 return true; 823 return false; 824 } 825 826 /** 827 * @return {@link #group} (A sub-group within a group. The ordering of groups within this group is relevant.) 828 */ 829 // syntactic sugar 830 public GroupComponent addGroup() { //3 831 GroupComponent t = new GroupComponent(); 832 if (this.group == null) 833 this.group = new ArrayList<GroupComponent>(); 834 this.group.add(t); 835 return t; 836 } 837 838 // syntactic sugar 839 public GroupComponent addGroup(GroupComponent t) { //3 840 if (t == null) 841 return this; 842 if (this.group == null) 843 this.group = new ArrayList<GroupComponent>(); 844 this.group.add(t); 845 return this; 846 } 847 848 /** 849 * @return {@link #question} (Set of questions within this group. The order of questions within the group is relevant.) 850 */ 851 public List<QuestionComponent> getQuestion() { 852 if (this.question == null) 853 this.question = new ArrayList<QuestionComponent>(); 854 return this.question; 855 } 856 857 public boolean hasQuestion() { 858 if (this.question == null) 859 return false; 860 for (QuestionComponent item : this.question) 861 if (!item.isEmpty()) 862 return true; 863 return false; 864 } 865 866 /** 867 * @return {@link #question} (Set of questions within this group. The order of questions within the group is relevant.) 868 */ 869 // syntactic sugar 870 public QuestionComponent addQuestion() { //3 871 QuestionComponent t = new QuestionComponent(); 872 if (this.question == null) 873 this.question = new ArrayList<QuestionComponent>(); 874 this.question.add(t); 875 return t; 876 } 877 878 // syntactic sugar 879 public GroupComponent addQuestion(QuestionComponent t) { //3 880 if (t == null) 881 return this; 882 if (this.question == null) 883 this.question = new ArrayList<QuestionComponent>(); 884 this.question.add(t); 885 return this; 886 } 887 888 protected void listChildren(List<Property> childrenList) { 889 super.listChildren(childrenList); 890 childrenList.add(new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent group in a QuestionnaireResponse resource.", 0, java.lang.Integer.MAX_VALUE, linkId)); 891 childrenList.add(new Property("title", "string", "The human-readable name for this section of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, title)); 892 childrenList.add(new Property("concept", "Coding", "Identifies a how this group of questions is known in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, concept)); 893 childrenList.add(new Property("text", "string", "Additional text for the group, used for display purposes.", 0, java.lang.Integer.MAX_VALUE, text)); 894 childrenList.add(new Property("required", "boolean", "If true, indicates that the group must be present and have required questions within it answered. If false, the group may be skipped when answering the questionnaire.", 0, java.lang.Integer.MAX_VALUE, required)); 895 childrenList.add(new Property("repeats", "boolean", "Whether the group may occur multiple times in the instance, containing multiple sets of answers.", 0, java.lang.Integer.MAX_VALUE, repeats)); 896 childrenList.add(new Property("group", "@Questionnaire.group", "A sub-group within a group. The ordering of groups within this group is relevant.", 0, java.lang.Integer.MAX_VALUE, group)); 897 childrenList.add(new Property("question", "", "Set of questions within this group. The order of questions within the group is relevant.", 0, java.lang.Integer.MAX_VALUE, question)); 898 } 899 900 @Override 901 public void setProperty(String name, Base value) throws FHIRException { 902 if (name.equals("linkId")) 903 this.linkId = castToString(value); // StringType 904 else if (name.equals("title")) 905 this.title = castToString(value); // StringType 906 else if (name.equals("concept")) 907 this.getConcept().add(castToCoding(value)); 908 else if (name.equals("text")) 909 this.text = castToString(value); // StringType 910 else if (name.equals("required")) 911 this.required = castToBoolean(value); // BooleanType 912 else if (name.equals("repeats")) 913 this.repeats = castToBoolean(value); // BooleanType 914 else if (name.equals("group")) 915 this.getGroup().add((GroupComponent) value); 916 else if (name.equals("question")) 917 this.getQuestion().add((QuestionComponent) value); 918 else 919 super.setProperty(name, value); 920 } 921 922 @Override 923 public Base addChild(String name) throws FHIRException { 924 if (name.equals("linkId")) { 925 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.linkId"); 926 } 927 else if (name.equals("title")) { 928 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title"); 929 } 930 else if (name.equals("concept")) { 931 return addConcept(); 932 } 933 else if (name.equals("text")) { 934 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.text"); 935 } 936 else if (name.equals("required")) { 937 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.required"); 938 } 939 else if (name.equals("repeats")) { 940 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.repeats"); 941 } 942 else if (name.equals("group")) { 943 return addGroup(); 944 } 945 else if (name.equals("question")) { 946 return addQuestion(); 947 } 948 else 949 return super.addChild(name); 950 } 951 952 public GroupComponent copy() { 953 GroupComponent dst = new GroupComponent(); 954 copyValues(dst); 955 dst.linkId = linkId == null ? null : linkId.copy(); 956 dst.title = title == null ? null : title.copy(); 957 if (concept != null) { 958 dst.concept = new ArrayList<Coding>(); 959 for (Coding i : concept) 960 dst.concept.add(i.copy()); 961 }; 962 dst.text = text == null ? null : text.copy(); 963 dst.required = required == null ? null : required.copy(); 964 dst.repeats = repeats == null ? null : repeats.copy(); 965 if (group != null) { 966 dst.group = new ArrayList<GroupComponent>(); 967 for (GroupComponent i : group) 968 dst.group.add(i.copy()); 969 }; 970 if (question != null) { 971 dst.question = new ArrayList<QuestionComponent>(); 972 for (QuestionComponent i : question) 973 dst.question.add(i.copy()); 974 }; 975 return dst; 976 } 977 978 @Override 979 public boolean equalsDeep(Base other) { 980 if (!super.equalsDeep(other)) 981 return false; 982 if (!(other instanceof GroupComponent)) 983 return false; 984 GroupComponent o = (GroupComponent) other; 985 return compareDeep(linkId, o.linkId, true) && compareDeep(title, o.title, true) && compareDeep(concept, o.concept, true) 986 && compareDeep(text, o.text, true) && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true) 987 && compareDeep(group, o.group, true) && compareDeep(question, o.question, true); 988 } 989 990 @Override 991 public boolean equalsShallow(Base other) { 992 if (!super.equalsShallow(other)) 993 return false; 994 if (!(other instanceof GroupComponent)) 995 return false; 996 GroupComponent o = (GroupComponent) other; 997 return compareValues(linkId, o.linkId, true) && compareValues(title, o.title, true) && compareValues(text, o.text, true) 998 && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true); 999 } 1000 1001 public boolean isEmpty() { 1002 return super.isEmpty() && (linkId == null || linkId.isEmpty()) && (title == null || title.isEmpty()) 1003 && (concept == null || concept.isEmpty()) && (text == null || text.isEmpty()) && (required == null || required.isEmpty()) 1004 && (repeats == null || repeats.isEmpty()) && (group == null || group.isEmpty()) && (question == null || question.isEmpty()) 1005 ; 1006 } 1007 1008 public String fhirType() { 1009 return "Questionnaire.group"; 1010 1011 } 1012 1013 } 1014 1015 @Block() 1016 public static class QuestionComponent extends BackboneElement implements IBaseBackboneElement { 1017 /** 1018 * An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource. 1019 */ 1020 @Child(name = "linkId", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false) 1021 @Description(shortDefinition="To link questionnaire with questionnaire response", formalDefinition="An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource." ) 1022 protected StringType linkId; 1023 1024 /** 1025 * Identifies a how this question is known in a particular terminology such as LOINC. 1026 */ 1027 @Child(name = "concept", type = {Coding.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1028 @Description(shortDefinition="Concept that represents this question on a questionnaire", formalDefinition="Identifies a how this question is known in a particular terminology such as LOINC." ) 1029 protected List<Coding> concept; 1030 1031 /** 1032 * The actual question as shown to the user to prompt them for an answer. 1033 */ 1034 @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false) 1035 @Description(shortDefinition="Text of the question as it is shown to the user", formalDefinition="The actual question as shown to the user to prompt them for an answer." ) 1036 protected StringType text; 1037 1038 /** 1039 * The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected. 1040 */ 1041 @Child(name = "type", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false) 1042 @Description(shortDefinition="boolean | decimal | integer | date | dateTime +", formalDefinition="The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected." ) 1043 protected Enumeration<AnswerFormat> type; 1044 1045 /** 1046 * If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups may be skipped when answering the questionnaire. 1047 */ 1048 @Child(name = "required", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=false) 1049 @Description(shortDefinition="Whether the question must be answered in data results", formalDefinition="If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups may be skipped when answering the questionnaire." ) 1050 protected BooleanType required; 1051 1052 /** 1053 * If true, the question may have more than one answer. 1054 */ 1055 @Child(name = "repeats", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=false) 1056 @Description(shortDefinition="Whether the question can have multiple answers", formalDefinition="If true, the question may have more than one answer." ) 1057 protected BooleanType repeats; 1058 1059 /** 1060 * Reference to a value set containing a list of codes representing permitted answers for the question. 1061 */ 1062 @Child(name = "options", type = {ValueSet.class}, order=7, min=0, max=1, modifier=false, summary=false) 1063 @Description(shortDefinition="Valueset containing permitted answers", formalDefinition="Reference to a value set containing a list of codes representing permitted answers for the question." ) 1064 protected Reference options; 1065 1066 /** 1067 * The actual object that is the target of the reference (Reference to a value set containing a list of codes representing permitted answers for the question.) 1068 */ 1069 protected ValueSet optionsTarget; 1070 1071 /** 1072 * For a "choice" question, identifies one of the permitted answers for the question. 1073 */ 1074 @Child(name = "option", type = {Coding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1075 @Description(shortDefinition="Permitted answer", formalDefinition="For a \"choice\" question, identifies one of the permitted answers for the question." ) 1076 protected List<Coding> option; 1077 1078 /** 1079 * Nested group, containing nested question for this question. The order of groups within the question is relevant. 1080 */ 1081 @Child(name = "group", type = {GroupComponent.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1082 @Description(shortDefinition="Nested questionnaire group", formalDefinition="Nested group, containing nested question for this question. The order of groups within the question is relevant." ) 1083 protected List<GroupComponent> group; 1084 1085 private static final long serialVersionUID = -1078951042L; 1086 1087 /* 1088 * Constructor 1089 */ 1090 public QuestionComponent() { 1091 super(); 1092 } 1093 1094 /** 1095 * @return {@link #linkId} (An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value 1096 */ 1097 public StringType getLinkIdElement() { 1098 if (this.linkId == null) 1099 if (Configuration.errorOnAutoCreate()) 1100 throw new Error("Attempt to auto-create QuestionComponent.linkId"); 1101 else if (Configuration.doAutoCreate()) 1102 this.linkId = new StringType(); // bb 1103 return this.linkId; 1104 } 1105 1106 public boolean hasLinkIdElement() { 1107 return this.linkId != null && !this.linkId.isEmpty(); 1108 } 1109 1110 public boolean hasLinkId() { 1111 return this.linkId != null && !this.linkId.isEmpty(); 1112 } 1113 1114 /** 1115 * @param value {@link #linkId} (An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value 1116 */ 1117 public QuestionComponent setLinkIdElement(StringType value) { 1118 this.linkId = value; 1119 return this; 1120 } 1121 1122 /** 1123 * @return An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource. 1124 */ 1125 public String getLinkId() { 1126 return this.linkId == null ? null : this.linkId.getValue(); 1127 } 1128 1129 /** 1130 * @param value An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource. 1131 */ 1132 public QuestionComponent setLinkId(String value) { 1133 if (Utilities.noString(value)) 1134 this.linkId = null; 1135 else { 1136 if (this.linkId == null) 1137 this.linkId = new StringType(); 1138 this.linkId.setValue(value); 1139 } 1140 return this; 1141 } 1142 1143 /** 1144 * @return {@link #concept} (Identifies a how this question is known in a particular terminology such as LOINC.) 1145 */ 1146 public List<Coding> getConcept() { 1147 if (this.concept == null) 1148 this.concept = new ArrayList<Coding>(); 1149 return this.concept; 1150 } 1151 1152 public boolean hasConcept() { 1153 if (this.concept == null) 1154 return false; 1155 for (Coding item : this.concept) 1156 if (!item.isEmpty()) 1157 return true; 1158 return false; 1159 } 1160 1161 /** 1162 * @return {@link #concept} (Identifies a how this question is known in a particular terminology such as LOINC.) 1163 */ 1164 // syntactic sugar 1165 public Coding addConcept() { //3 1166 Coding t = new Coding(); 1167 if (this.concept == null) 1168 this.concept = new ArrayList<Coding>(); 1169 this.concept.add(t); 1170 return t; 1171 } 1172 1173 // syntactic sugar 1174 public QuestionComponent addConcept(Coding t) { //3 1175 if (t == null) 1176 return this; 1177 if (this.concept == null) 1178 this.concept = new ArrayList<Coding>(); 1179 this.concept.add(t); 1180 return this; 1181 } 1182 1183 /** 1184 * @return {@link #text} (The actual question as shown to the user to prompt them for an answer.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 1185 */ 1186 public StringType getTextElement() { 1187 if (this.text == null) 1188 if (Configuration.errorOnAutoCreate()) 1189 throw new Error("Attempt to auto-create QuestionComponent.text"); 1190 else if (Configuration.doAutoCreate()) 1191 this.text = new StringType(); // bb 1192 return this.text; 1193 } 1194 1195 public boolean hasTextElement() { 1196 return this.text != null && !this.text.isEmpty(); 1197 } 1198 1199 public boolean hasText() { 1200 return this.text != null && !this.text.isEmpty(); 1201 } 1202 1203 /** 1204 * @param value {@link #text} (The actual question as shown to the user to prompt them for an answer.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 1205 */ 1206 public QuestionComponent setTextElement(StringType value) { 1207 this.text = value; 1208 return this; 1209 } 1210 1211 /** 1212 * @return The actual question as shown to the user to prompt them for an answer. 1213 */ 1214 public String getText() { 1215 return this.text == null ? null : this.text.getValue(); 1216 } 1217 1218 /** 1219 * @param value The actual question as shown to the user to prompt them for an answer. 1220 */ 1221 public QuestionComponent setText(String value) { 1222 if (Utilities.noString(value)) 1223 this.text = null; 1224 else { 1225 if (this.text == null) 1226 this.text = new StringType(); 1227 this.text.setValue(value); 1228 } 1229 return this; 1230 } 1231 1232 /** 1233 * @return {@link #type} (The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1234 */ 1235 public Enumeration<AnswerFormat> getTypeElement() { 1236 if (this.type == null) 1237 if (Configuration.errorOnAutoCreate()) 1238 throw new Error("Attempt to auto-create QuestionComponent.type"); 1239 else if (Configuration.doAutoCreate()) 1240 this.type = new Enumeration<AnswerFormat>(new AnswerFormatEnumFactory()); // bb 1241 return this.type; 1242 } 1243 1244 public boolean hasTypeElement() { 1245 return this.type != null && !this.type.isEmpty(); 1246 } 1247 1248 public boolean hasType() { 1249 return this.type != null && !this.type.isEmpty(); 1250 } 1251 1252 /** 1253 * @param value {@link #type} (The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 1254 */ 1255 public QuestionComponent setTypeElement(Enumeration<AnswerFormat> value) { 1256 this.type = value; 1257 return this; 1258 } 1259 1260 /** 1261 * @return The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected. 1262 */ 1263 public AnswerFormat getType() { 1264 return this.type == null ? null : this.type.getValue(); 1265 } 1266 1267 /** 1268 * @param value The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected. 1269 */ 1270 public QuestionComponent setType(AnswerFormat value) { 1271 if (value == null) 1272 this.type = null; 1273 else { 1274 if (this.type == null) 1275 this.type = new Enumeration<AnswerFormat>(new AnswerFormatEnumFactory()); 1276 this.type.setValue(value); 1277 } 1278 return this; 1279 } 1280 1281 /** 1282 * @return {@link #required} (If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups 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 1283 */ 1284 public BooleanType getRequiredElement() { 1285 if (this.required == null) 1286 if (Configuration.errorOnAutoCreate()) 1287 throw new Error("Attempt to auto-create QuestionComponent.required"); 1288 else if (Configuration.doAutoCreate()) 1289 this.required = new BooleanType(); // bb 1290 return this.required; 1291 } 1292 1293 public boolean hasRequiredElement() { 1294 return this.required != null && !this.required.isEmpty(); 1295 } 1296 1297 public boolean hasRequired() { 1298 return this.required != null && !this.required.isEmpty(); 1299 } 1300 1301 /** 1302 * @param value {@link #required} (If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups 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 1303 */ 1304 public QuestionComponent setRequiredElement(BooleanType value) { 1305 this.required = value; 1306 return this; 1307 } 1308 1309 /** 1310 * @return If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups may be skipped when answering the questionnaire. 1311 */ 1312 public boolean getRequired() { 1313 return this.required == null || this.required.isEmpty() ? false : this.required.getValue(); 1314 } 1315 1316 /** 1317 * @param value If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups may be skipped when answering the questionnaire. 1318 */ 1319 public QuestionComponent setRequired(boolean value) { 1320 if (this.required == null) 1321 this.required = new BooleanType(); 1322 this.required.setValue(value); 1323 return this; 1324 } 1325 1326 /** 1327 * @return {@link #repeats} (If true, the question may have more than one answer.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value 1328 */ 1329 public BooleanType getRepeatsElement() { 1330 if (this.repeats == null) 1331 if (Configuration.errorOnAutoCreate()) 1332 throw new Error("Attempt to auto-create QuestionComponent.repeats"); 1333 else if (Configuration.doAutoCreate()) 1334 this.repeats = new BooleanType(); // bb 1335 return this.repeats; 1336 } 1337 1338 public boolean hasRepeatsElement() { 1339 return this.repeats != null && !this.repeats.isEmpty(); 1340 } 1341 1342 public boolean hasRepeats() { 1343 return this.repeats != null && !this.repeats.isEmpty(); 1344 } 1345 1346 /** 1347 * @param value {@link #repeats} (If true, the question may have more than one answer.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value 1348 */ 1349 public QuestionComponent setRepeatsElement(BooleanType value) { 1350 this.repeats = value; 1351 return this; 1352 } 1353 1354 /** 1355 * @return If true, the question may have more than one answer. 1356 */ 1357 public boolean getRepeats() { 1358 return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue(); 1359 } 1360 1361 /** 1362 * @param value If true, the question may have more than one answer. 1363 */ 1364 public QuestionComponent setRepeats(boolean value) { 1365 if (this.repeats == null) 1366 this.repeats = new BooleanType(); 1367 this.repeats.setValue(value); 1368 return this; 1369 } 1370 1371 /** 1372 * @return {@link #options} (Reference to a value set containing a list of codes representing permitted answers for the question.) 1373 */ 1374 public Reference getOptions() { 1375 if (this.options == null) 1376 if (Configuration.errorOnAutoCreate()) 1377 throw new Error("Attempt to auto-create QuestionComponent.options"); 1378 else if (Configuration.doAutoCreate()) 1379 this.options = new Reference(); // cc 1380 return this.options; 1381 } 1382 1383 public boolean hasOptions() { 1384 return this.options != null && !this.options.isEmpty(); 1385 } 1386 1387 /** 1388 * @param value {@link #options} (Reference to a value set containing a list of codes representing permitted answers for the question.) 1389 */ 1390 public QuestionComponent setOptions(Reference value) { 1391 this.options = value; 1392 return this; 1393 } 1394 1395 /** 1396 * @return {@link #options} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to a value set containing a list of codes representing permitted answers for the question.) 1397 */ 1398 public ValueSet getOptionsTarget() { 1399 if (this.optionsTarget == null) 1400 if (Configuration.errorOnAutoCreate()) 1401 throw new Error("Attempt to auto-create QuestionComponent.options"); 1402 else if (Configuration.doAutoCreate()) 1403 this.optionsTarget = new ValueSet(); // aa 1404 return this.optionsTarget; 1405 } 1406 1407 /** 1408 * @param value {@link #options} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to a value set containing a list of codes representing permitted answers for the question.) 1409 */ 1410 public QuestionComponent setOptionsTarget(ValueSet value) { 1411 this.optionsTarget = value; 1412 return this; 1413 } 1414 1415 /** 1416 * @return {@link #option} (For a "choice" question, identifies one of the permitted answers for the question.) 1417 */ 1418 public List<Coding> getOption() { 1419 if (this.option == null) 1420 this.option = new ArrayList<Coding>(); 1421 return this.option; 1422 } 1423 1424 public boolean hasOption() { 1425 if (this.option == null) 1426 return false; 1427 for (Coding item : this.option) 1428 if (!item.isEmpty()) 1429 return true; 1430 return false; 1431 } 1432 1433 /** 1434 * @return {@link #option} (For a "choice" question, identifies one of the permitted answers for the question.) 1435 */ 1436 // syntactic sugar 1437 public Coding addOption() { //3 1438 Coding t = new Coding(); 1439 if (this.option == null) 1440 this.option = new ArrayList<Coding>(); 1441 this.option.add(t); 1442 return t; 1443 } 1444 1445 // syntactic sugar 1446 public QuestionComponent addOption(Coding t) { //3 1447 if (t == null) 1448 return this; 1449 if (this.option == null) 1450 this.option = new ArrayList<Coding>(); 1451 this.option.add(t); 1452 return this; 1453 } 1454 1455 /** 1456 * @return {@link #group} (Nested group, containing nested question for this question. The order of groups within the question is relevant.) 1457 */ 1458 public List<GroupComponent> getGroup() { 1459 if (this.group == null) 1460 this.group = new ArrayList<GroupComponent>(); 1461 return this.group; 1462 } 1463 1464 public boolean hasGroup() { 1465 if (this.group == null) 1466 return false; 1467 for (GroupComponent item : this.group) 1468 if (!item.isEmpty()) 1469 return true; 1470 return false; 1471 } 1472 1473 /** 1474 * @return {@link #group} (Nested group, containing nested question for this question. The order of groups within the question is relevant.) 1475 */ 1476 // syntactic sugar 1477 public GroupComponent addGroup() { //3 1478 GroupComponent t = new GroupComponent(); 1479 if (this.group == null) 1480 this.group = new ArrayList<GroupComponent>(); 1481 this.group.add(t); 1482 return t; 1483 } 1484 1485 // syntactic sugar 1486 public QuestionComponent addGroup(GroupComponent t) { //3 1487 if (t == null) 1488 return this; 1489 if (this.group == null) 1490 this.group = new ArrayList<GroupComponent>(); 1491 this.group.add(t); 1492 return this; 1493 } 1494 1495 protected void listChildren(List<Property> childrenList) { 1496 super.listChildren(childrenList); 1497 childrenList.add(new Property("linkId", "string", "An identifier that is unique within the questionnaire allowing linkage to the equivalent group in a [[[QuestionnaireResponse]]] resource.", 0, java.lang.Integer.MAX_VALUE, linkId)); 1498 childrenList.add(new Property("concept", "Coding", "Identifies a how this question is known in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, concept)); 1499 childrenList.add(new Property("text", "string", "The actual question as shown to the user to prompt them for an answer.", 0, java.lang.Integer.MAX_VALUE, text)); 1500 childrenList.add(new Property("type", "code", "The expected format of the answer, e.g. the type of input (string, integer) or whether a (multiple) choice is expected.", 0, java.lang.Integer.MAX_VALUE, type)); 1501 childrenList.add(new Property("required", "boolean", "If true, indicates that the question must be answered and have required groups within it also present. If false, the question and any contained groups may be skipped when answering the questionnaire.", 0, java.lang.Integer.MAX_VALUE, required)); 1502 childrenList.add(new Property("repeats", "boolean", "If true, the question may have more than one answer.", 0, java.lang.Integer.MAX_VALUE, repeats)); 1503 childrenList.add(new Property("options", "Reference(ValueSet)", "Reference to a value set containing a list of codes representing permitted answers for the question.", 0, java.lang.Integer.MAX_VALUE, options)); 1504 childrenList.add(new Property("option", "Coding", "For a \"choice\" question, identifies one of the permitted answers for the question.", 0, java.lang.Integer.MAX_VALUE, option)); 1505 childrenList.add(new Property("group", "@Questionnaire.group", "Nested group, containing nested question for this question. The order of groups within the question is relevant.", 0, java.lang.Integer.MAX_VALUE, group)); 1506 } 1507 1508 @Override 1509 public void setProperty(String name, Base value) throws FHIRException { 1510 if (name.equals("linkId")) 1511 this.linkId = castToString(value); // StringType 1512 else if (name.equals("concept")) 1513 this.getConcept().add(castToCoding(value)); 1514 else if (name.equals("text")) 1515 this.text = castToString(value); // StringType 1516 else if (name.equals("type")) 1517 this.type = new AnswerFormatEnumFactory().fromType(value); // Enumeration<AnswerFormat> 1518 else if (name.equals("required")) 1519 this.required = castToBoolean(value); // BooleanType 1520 else if (name.equals("repeats")) 1521 this.repeats = castToBoolean(value); // BooleanType 1522 else if (name.equals("options")) 1523 this.options = castToReference(value); // Reference 1524 else if (name.equals("option")) 1525 this.getOption().add(castToCoding(value)); 1526 else if (name.equals("group")) 1527 this.getGroup().add((GroupComponent) value); 1528 else 1529 super.setProperty(name, value); 1530 } 1531 1532 @Override 1533 public Base addChild(String name) throws FHIRException { 1534 if (name.equals("linkId")) { 1535 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.linkId"); 1536 } 1537 else if (name.equals("concept")) { 1538 return addConcept(); 1539 } 1540 else if (name.equals("text")) { 1541 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.text"); 1542 } 1543 else if (name.equals("type")) { 1544 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.type"); 1545 } 1546 else if (name.equals("required")) { 1547 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.required"); 1548 } 1549 else if (name.equals("repeats")) { 1550 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.repeats"); 1551 } 1552 else if (name.equals("options")) { 1553 this.options = new Reference(); 1554 return this.options; 1555 } 1556 else if (name.equals("option")) { 1557 return addOption(); 1558 } 1559 else if (name.equals("group")) { 1560 return addGroup(); 1561 } 1562 else 1563 return super.addChild(name); 1564 } 1565 1566 public QuestionComponent copy() { 1567 QuestionComponent dst = new QuestionComponent(); 1568 copyValues(dst); 1569 dst.linkId = linkId == null ? null : linkId.copy(); 1570 if (concept != null) { 1571 dst.concept = new ArrayList<Coding>(); 1572 for (Coding i : concept) 1573 dst.concept.add(i.copy()); 1574 }; 1575 dst.text = text == null ? null : text.copy(); 1576 dst.type = type == null ? null : type.copy(); 1577 dst.required = required == null ? null : required.copy(); 1578 dst.repeats = repeats == null ? null : repeats.copy(); 1579 dst.options = options == null ? null : options.copy(); 1580 if (option != null) { 1581 dst.option = new ArrayList<Coding>(); 1582 for (Coding i : option) 1583 dst.option.add(i.copy()); 1584 }; 1585 if (group != null) { 1586 dst.group = new ArrayList<GroupComponent>(); 1587 for (GroupComponent i : group) 1588 dst.group.add(i.copy()); 1589 }; 1590 return dst; 1591 } 1592 1593 @Override 1594 public boolean equalsDeep(Base other) { 1595 if (!super.equalsDeep(other)) 1596 return false; 1597 if (!(other instanceof QuestionComponent)) 1598 return false; 1599 QuestionComponent o = (QuestionComponent) other; 1600 return compareDeep(linkId, o.linkId, true) && compareDeep(concept, o.concept, true) && compareDeep(text, o.text, true) 1601 && compareDeep(type, o.type, true) && compareDeep(required, o.required, true) && compareDeep(repeats, o.repeats, true) 1602 && compareDeep(options, o.options, true) && compareDeep(option, o.option, true) && compareDeep(group, o.group, true) 1603 ; 1604 } 1605 1606 @Override 1607 public boolean equalsShallow(Base other) { 1608 if (!super.equalsShallow(other)) 1609 return false; 1610 if (!(other instanceof QuestionComponent)) 1611 return false; 1612 QuestionComponent o = (QuestionComponent) other; 1613 return compareValues(linkId, o.linkId, true) && compareValues(text, o.text, true) && compareValues(type, o.type, true) 1614 && compareValues(required, o.required, true) && compareValues(repeats, o.repeats, true); 1615 } 1616 1617 public boolean isEmpty() { 1618 return super.isEmpty() && (linkId == null || linkId.isEmpty()) && (concept == null || concept.isEmpty()) 1619 && (text == null || text.isEmpty()) && (type == null || type.isEmpty()) && (required == null || required.isEmpty()) 1620 && (repeats == null || repeats.isEmpty()) && (options == null || options.isEmpty()) && (option == null || option.isEmpty()) 1621 && (group == null || group.isEmpty()); 1622 } 1623 1624 public String fhirType() { 1625 return "Questionnaire.group.question"; 1626 1627 } 1628 1629 } 1630 1631 /** 1632 * This records identifiers associated with this question set that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation). 1633 */ 1634 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1635 @Description(shortDefinition="External identifiers for this questionnaire", formalDefinition="This records identifiers associated with this question set that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." ) 1636 protected List<Identifier> identifier; 1637 1638 /** 1639 * The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated. 1640 */ 1641 @Child(name = "version", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 1642 @Description(shortDefinition="Logical identifier for this version of Questionnaire", formalDefinition="The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated." ) 1643 protected StringType version; 1644 1645 /** 1646 * The lifecycle status of the questionnaire as a whole. 1647 */ 1648 @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true) 1649 @Description(shortDefinition="draft | published | retired", formalDefinition="The lifecycle status of the questionnaire as a whole." ) 1650 protected Enumeration<QuestionnaireStatus> status; 1651 1652 /** 1653 * The date that this questionnaire was last changed. 1654 */ 1655 @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true) 1656 @Description(shortDefinition="Date this version was authored", formalDefinition="The date that this questionnaire was last changed." ) 1657 protected DateTimeType date; 1658 1659 /** 1660 * Organization or person responsible for developing and maintaining the questionnaire. 1661 */ 1662 @Child(name = "publisher", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1663 @Description(shortDefinition="Organization/individual who designed the questionnaire", formalDefinition="Organization or person responsible for developing and maintaining the questionnaire." ) 1664 protected StringType publisher; 1665 1666 /** 1667 * Contact details to assist a user in finding and communicating with the publisher. 1668 */ 1669 @Child(name = "telecom", type = {ContactPoint.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1670 @Description(shortDefinition="Contact information of the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." ) 1671 protected List<ContactPoint> telecom; 1672 1673 /** 1674 * Identifies the types of subjects that can be the subject of the questionnaire. 1675 */ 1676 @Child(name = "subjectType", type = {CodeType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1677 @Description(shortDefinition="Resource that can be subject of QuestionnaireResponse", formalDefinition="Identifies the types of subjects that can be the subject of the questionnaire." ) 1678 protected List<CodeType> subjectType; 1679 1680 /** 1681 * A collection of related questions (or further groupings of questions). 1682 */ 1683 @Child(name = "group", type = {}, order=7, min=1, max=1, modifier=false, summary=true) 1684 @Description(shortDefinition="Grouped questions", formalDefinition="A collection of related questions (or further groupings of questions)." ) 1685 protected GroupComponent group; 1686 1687 private static final long serialVersionUID = -1348292652L; 1688 1689 /* 1690 * Constructor 1691 */ 1692 public Questionnaire() { 1693 super(); 1694 } 1695 1696 /* 1697 * Constructor 1698 */ 1699 public Questionnaire(Enumeration<QuestionnaireStatus> status, GroupComponent group) { 1700 super(); 1701 this.status = status; 1702 this.group = group; 1703 } 1704 1705 /** 1706 * @return {@link #identifier} (This records identifiers associated with this question set that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 1707 */ 1708 public List<Identifier> getIdentifier() { 1709 if (this.identifier == null) 1710 this.identifier = new ArrayList<Identifier>(); 1711 return this.identifier; 1712 } 1713 1714 public boolean hasIdentifier() { 1715 if (this.identifier == null) 1716 return false; 1717 for (Identifier item : this.identifier) 1718 if (!item.isEmpty()) 1719 return true; 1720 return false; 1721 } 1722 1723 /** 1724 * @return {@link #identifier} (This records identifiers associated with this question set that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).) 1725 */ 1726 // syntactic sugar 1727 public Identifier addIdentifier() { //3 1728 Identifier t = new Identifier(); 1729 if (this.identifier == null) 1730 this.identifier = new ArrayList<Identifier>(); 1731 this.identifier.add(t); 1732 return t; 1733 } 1734 1735 // syntactic sugar 1736 public Questionnaire addIdentifier(Identifier t) { //3 1737 if (t == null) 1738 return this; 1739 if (this.identifier == null) 1740 this.identifier = new ArrayList<Identifier>(); 1741 this.identifier.add(t); 1742 return this; 1743 } 1744 1745 /** 1746 * @return {@link #version} (The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 1747 */ 1748 public StringType getVersionElement() { 1749 if (this.version == null) 1750 if (Configuration.errorOnAutoCreate()) 1751 throw new Error("Attempt to auto-create Questionnaire.version"); 1752 else if (Configuration.doAutoCreate()) 1753 this.version = new StringType(); // bb 1754 return this.version; 1755 } 1756 1757 public boolean hasVersionElement() { 1758 return this.version != null && !this.version.isEmpty(); 1759 } 1760 1761 public boolean hasVersion() { 1762 return this.version != null && !this.version.isEmpty(); 1763 } 1764 1765 /** 1766 * @param value {@link #version} (The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value 1767 */ 1768 public Questionnaire setVersionElement(StringType value) { 1769 this.version = value; 1770 return this; 1771 } 1772 1773 /** 1774 * @return The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated. 1775 */ 1776 public String getVersion() { 1777 return this.version == null ? null : this.version.getValue(); 1778 } 1779 1780 /** 1781 * @param value The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated. 1782 */ 1783 public Questionnaire setVersion(String value) { 1784 if (Utilities.noString(value)) 1785 this.version = null; 1786 else { 1787 if (this.version == null) 1788 this.version = new StringType(); 1789 this.version.setValue(value); 1790 } 1791 return this; 1792 } 1793 1794 /** 1795 * @return {@link #status} (The lifecycle status of the questionnaire as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1796 */ 1797 public Enumeration<QuestionnaireStatus> getStatusElement() { 1798 if (this.status == null) 1799 if (Configuration.errorOnAutoCreate()) 1800 throw new Error("Attempt to auto-create Questionnaire.status"); 1801 else if (Configuration.doAutoCreate()) 1802 this.status = new Enumeration<QuestionnaireStatus>(new QuestionnaireStatusEnumFactory()); // bb 1803 return this.status; 1804 } 1805 1806 public boolean hasStatusElement() { 1807 return this.status != null && !this.status.isEmpty(); 1808 } 1809 1810 public boolean hasStatus() { 1811 return this.status != null && !this.status.isEmpty(); 1812 } 1813 1814 /** 1815 * @param value {@link #status} (The lifecycle status of the questionnaire as a whole.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1816 */ 1817 public Questionnaire setStatusElement(Enumeration<QuestionnaireStatus> value) { 1818 this.status = value; 1819 return this; 1820 } 1821 1822 /** 1823 * @return The lifecycle status of the questionnaire as a whole. 1824 */ 1825 public QuestionnaireStatus getStatus() { 1826 return this.status == null ? null : this.status.getValue(); 1827 } 1828 1829 /** 1830 * @param value The lifecycle status of the questionnaire as a whole. 1831 */ 1832 public Questionnaire setStatus(QuestionnaireStatus value) { 1833 if (this.status == null) 1834 this.status = new Enumeration<QuestionnaireStatus>(new QuestionnaireStatusEnumFactory()); 1835 this.status.setValue(value); 1836 return this; 1837 } 1838 1839 /** 1840 * @return {@link #date} (The date that this questionnaire was last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 1841 */ 1842 public DateTimeType getDateElement() { 1843 if (this.date == null) 1844 if (Configuration.errorOnAutoCreate()) 1845 throw new Error("Attempt to auto-create Questionnaire.date"); 1846 else if (Configuration.doAutoCreate()) 1847 this.date = new DateTimeType(); // bb 1848 return this.date; 1849 } 1850 1851 public boolean hasDateElement() { 1852 return this.date != null && !this.date.isEmpty(); 1853 } 1854 1855 public boolean hasDate() { 1856 return this.date != null && !this.date.isEmpty(); 1857 } 1858 1859 /** 1860 * @param value {@link #date} (The date that this questionnaire was last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 1861 */ 1862 public Questionnaire setDateElement(DateTimeType value) { 1863 this.date = value; 1864 return this; 1865 } 1866 1867 /** 1868 * @return The date that this questionnaire was last changed. 1869 */ 1870 public Date getDate() { 1871 return this.date == null ? null : this.date.getValue(); 1872 } 1873 1874 /** 1875 * @param value The date that this questionnaire was last changed. 1876 */ 1877 public Questionnaire setDate(Date value) { 1878 if (value == null) 1879 this.date = null; 1880 else { 1881 if (this.date == null) 1882 this.date = new DateTimeType(); 1883 this.date.setValue(value); 1884 } 1885 return this; 1886 } 1887 1888 /** 1889 * @return {@link #publisher} (Organization or person responsible for developing and maintaining the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value 1890 */ 1891 public StringType getPublisherElement() { 1892 if (this.publisher == null) 1893 if (Configuration.errorOnAutoCreate()) 1894 throw new Error("Attempt to auto-create Questionnaire.publisher"); 1895 else if (Configuration.doAutoCreate()) 1896 this.publisher = new StringType(); // bb 1897 return this.publisher; 1898 } 1899 1900 public boolean hasPublisherElement() { 1901 return this.publisher != null && !this.publisher.isEmpty(); 1902 } 1903 1904 public boolean hasPublisher() { 1905 return this.publisher != null && !this.publisher.isEmpty(); 1906 } 1907 1908 /** 1909 * @param value {@link #publisher} (Organization or person responsible for developing and maintaining the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value 1910 */ 1911 public Questionnaire setPublisherElement(StringType value) { 1912 this.publisher = value; 1913 return this; 1914 } 1915 1916 /** 1917 * @return Organization or person responsible for developing and maintaining the questionnaire. 1918 */ 1919 public String getPublisher() { 1920 return this.publisher == null ? null : this.publisher.getValue(); 1921 } 1922 1923 /** 1924 * @param value Organization or person responsible for developing and maintaining the questionnaire. 1925 */ 1926 public Questionnaire setPublisher(String value) { 1927 if (Utilities.noString(value)) 1928 this.publisher = null; 1929 else { 1930 if (this.publisher == null) 1931 this.publisher = new StringType(); 1932 this.publisher.setValue(value); 1933 } 1934 return this; 1935 } 1936 1937 /** 1938 * @return {@link #telecom} (Contact details to assist a user in finding and communicating with the publisher.) 1939 */ 1940 public List<ContactPoint> getTelecom() { 1941 if (this.telecom == null) 1942 this.telecom = new ArrayList<ContactPoint>(); 1943 return this.telecom; 1944 } 1945 1946 public boolean hasTelecom() { 1947 if (this.telecom == null) 1948 return false; 1949 for (ContactPoint item : this.telecom) 1950 if (!item.isEmpty()) 1951 return true; 1952 return false; 1953 } 1954 1955 /** 1956 * @return {@link #telecom} (Contact details to assist a user in finding and communicating with the publisher.) 1957 */ 1958 // syntactic sugar 1959 public ContactPoint addTelecom() { //3 1960 ContactPoint t = new ContactPoint(); 1961 if (this.telecom == null) 1962 this.telecom = new ArrayList<ContactPoint>(); 1963 this.telecom.add(t); 1964 return t; 1965 } 1966 1967 // syntactic sugar 1968 public Questionnaire addTelecom(ContactPoint t) { //3 1969 if (t == null) 1970 return this; 1971 if (this.telecom == null) 1972 this.telecom = new ArrayList<ContactPoint>(); 1973 this.telecom.add(t); 1974 return this; 1975 } 1976 1977 /** 1978 * @return {@link #subjectType} (Identifies the types of subjects that can be the subject of the questionnaire.) 1979 */ 1980 public List<CodeType> getSubjectType() { 1981 if (this.subjectType == null) 1982 this.subjectType = new ArrayList<CodeType>(); 1983 return this.subjectType; 1984 } 1985 1986 public boolean hasSubjectType() { 1987 if (this.subjectType == null) 1988 return false; 1989 for (CodeType item : this.subjectType) 1990 if (!item.isEmpty()) 1991 return true; 1992 return false; 1993 } 1994 1995 /** 1996 * @return {@link #subjectType} (Identifies the types of subjects that can be the subject of the questionnaire.) 1997 */ 1998 // syntactic sugar 1999 public CodeType addSubjectTypeElement() {//2 2000 CodeType t = new CodeType(); 2001 if (this.subjectType == null) 2002 this.subjectType = new ArrayList<CodeType>(); 2003 this.subjectType.add(t); 2004 return t; 2005 } 2006 2007 /** 2008 * @param value {@link #subjectType} (Identifies the types of subjects that can be the subject of the questionnaire.) 2009 */ 2010 public Questionnaire addSubjectType(String value) { //1 2011 CodeType t = new CodeType(); 2012 t.setValue(value); 2013 if (this.subjectType == null) 2014 this.subjectType = new ArrayList<CodeType>(); 2015 this.subjectType.add(t); 2016 return this; 2017 } 2018 2019 /** 2020 * @param value {@link #subjectType} (Identifies the types of subjects that can be the subject of the questionnaire.) 2021 */ 2022 public boolean hasSubjectType(String value) { 2023 if (this.subjectType == null) 2024 return false; 2025 for (CodeType v : this.subjectType) 2026 if (v.equals(value)) // code 2027 return true; 2028 return false; 2029 } 2030 2031 /** 2032 * @return {@link #group} (A collection of related questions (or further groupings of questions).) 2033 */ 2034 public GroupComponent getGroup() { 2035 if (this.group == null) 2036 if (Configuration.errorOnAutoCreate()) 2037 throw new Error("Attempt to auto-create Questionnaire.group"); 2038 else if (Configuration.doAutoCreate()) 2039 this.group = new GroupComponent(); // cc 2040 return this.group; 2041 } 2042 2043 public boolean hasGroup() { 2044 return this.group != null && !this.group.isEmpty(); 2045 } 2046 2047 /** 2048 * @param value {@link #group} (A collection of related questions (or further groupings of questions).) 2049 */ 2050 public Questionnaire setGroup(GroupComponent value) { 2051 this.group = value; 2052 return this; 2053 } 2054 2055 protected void listChildren(List<Property> childrenList) { 2056 super.listChildren(childrenList); 2057 childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this question set that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier)); 2058 childrenList.add(new Property("version", "string", "The version number assigned by the publisher for business reasons. It may remain the same when the resource is updated.", 0, java.lang.Integer.MAX_VALUE, version)); 2059 childrenList.add(new Property("status", "code", "The lifecycle status of the questionnaire as a whole.", 0, java.lang.Integer.MAX_VALUE, status)); 2060 childrenList.add(new Property("date", "dateTime", "The date that this questionnaire was last changed.", 0, java.lang.Integer.MAX_VALUE, date)); 2061 childrenList.add(new Property("publisher", "string", "Organization or person responsible for developing and maintaining the questionnaire.", 0, java.lang.Integer.MAX_VALUE, publisher)); 2062 childrenList.add(new Property("telecom", "ContactPoint", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, telecom)); 2063 childrenList.add(new Property("subjectType", "code", "Identifies the types of subjects that can be the subject of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType)); 2064 childrenList.add(new Property("group", "", "A collection of related questions (or further groupings of questions).", 0, java.lang.Integer.MAX_VALUE, group)); 2065 } 2066 2067 @Override 2068 public void setProperty(String name, Base value) throws FHIRException { 2069 if (name.equals("identifier")) 2070 this.getIdentifier().add(castToIdentifier(value)); 2071 else if (name.equals("version")) 2072 this.version = castToString(value); // StringType 2073 else if (name.equals("status")) 2074 this.status = new QuestionnaireStatusEnumFactory().fromType(value); // Enumeration<QuestionnaireStatus> 2075 else if (name.equals("date")) 2076 this.date = castToDateTime(value); // DateTimeType 2077 else if (name.equals("publisher")) 2078 this.publisher = castToString(value); // StringType 2079 else if (name.equals("telecom")) 2080 this.getTelecom().add(castToContactPoint(value)); 2081 else if (name.equals("subjectType")) 2082 this.getSubjectType().add(castToCode(value)); 2083 else if (name.equals("group")) 2084 this.group = (GroupComponent) value; // GroupComponent 2085 else 2086 super.setProperty(name, value); 2087 } 2088 2089 @Override 2090 public Base addChild(String name) throws FHIRException { 2091 if (name.equals("identifier")) { 2092 return addIdentifier(); 2093 } 2094 else if (name.equals("version")) { 2095 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version"); 2096 } 2097 else if (name.equals("status")) { 2098 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status"); 2099 } 2100 else if (name.equals("date")) { 2101 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date"); 2102 } 2103 else if (name.equals("publisher")) { 2104 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher"); 2105 } 2106 else if (name.equals("telecom")) { 2107 return addTelecom(); 2108 } 2109 else if (name.equals("subjectType")) { 2110 throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType"); 2111 } 2112 else if (name.equals("group")) { 2113 this.group = new GroupComponent(); 2114 return this.group; 2115 } 2116 else 2117 return super.addChild(name); 2118 } 2119 2120 public String fhirType() { 2121 return "Questionnaire"; 2122 2123 } 2124 2125 public Questionnaire copy() { 2126 Questionnaire dst = new Questionnaire(); 2127 copyValues(dst); 2128 if (identifier != null) { 2129 dst.identifier = new ArrayList<Identifier>(); 2130 for (Identifier i : identifier) 2131 dst.identifier.add(i.copy()); 2132 }; 2133 dst.version = version == null ? null : version.copy(); 2134 dst.status = status == null ? null : status.copy(); 2135 dst.date = date == null ? null : date.copy(); 2136 dst.publisher = publisher == null ? null : publisher.copy(); 2137 if (telecom != null) { 2138 dst.telecom = new ArrayList<ContactPoint>(); 2139 for (ContactPoint i : telecom) 2140 dst.telecom.add(i.copy()); 2141 }; 2142 if (subjectType != null) { 2143 dst.subjectType = new ArrayList<CodeType>(); 2144 for (CodeType i : subjectType) 2145 dst.subjectType.add(i.copy()); 2146 }; 2147 dst.group = group == null ? null : group.copy(); 2148 return dst; 2149 } 2150 2151 protected Questionnaire typedCopy() { 2152 return copy(); 2153 } 2154 2155 @Override 2156 public boolean equalsDeep(Base other) { 2157 if (!super.equalsDeep(other)) 2158 return false; 2159 if (!(other instanceof Questionnaire)) 2160 return false; 2161 Questionnaire o = (Questionnaire) other; 2162 return compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true) && compareDeep(status, o.status, true) 2163 && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true) && compareDeep(telecom, o.telecom, true) 2164 && compareDeep(subjectType, o.subjectType, true) && compareDeep(group, o.group, true); 2165 } 2166 2167 @Override 2168 public boolean equalsShallow(Base other) { 2169 if (!super.equalsShallow(other)) 2170 return false; 2171 if (!(other instanceof Questionnaire)) 2172 return false; 2173 Questionnaire o = (Questionnaire) other; 2174 return compareValues(version, o.version, true) && compareValues(status, o.status, true) && compareValues(date, o.date, true) 2175 && compareValues(publisher, o.publisher, true) && compareValues(subjectType, o.subjectType, true); 2176 } 2177 2178 public boolean isEmpty() { 2179 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (version == null || version.isEmpty()) 2180 && (status == null || status.isEmpty()) && (date == null || date.isEmpty()) && (publisher == null || publisher.isEmpty()) 2181 && (telecom == null || telecom.isEmpty()) && (subjectType == null || subjectType.isEmpty()) 2182 && (group == null || group.isEmpty()); 2183 } 2184 2185 @Override 2186 public ResourceType getResourceType() { 2187 return ResourceType.Questionnaire; 2188 } 2189 2190 @SearchParamDefinition(name="date", path="Questionnaire.date", description="When the questionnaire was last changed", type="date" ) 2191 public static final String SP_DATE = "date"; 2192 @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="An identifier for the questionnaire", type="token" ) 2193 public static final String SP_IDENTIFIER = "identifier"; 2194 @SearchParamDefinition(name="code", path="Questionnaire.group.concept", description="A code that corresponds to the questionnaire or one of its groups", type="token" ) 2195 public static final String SP_CODE = "code"; 2196 @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="The author of the questionnaire", type="string" ) 2197 public static final String SP_PUBLISHER = "publisher"; 2198 @SearchParamDefinition(name="title", path="Questionnaire.group.title", description="All or part of the name of the questionnaire (title for the root group of the questionnaire)", type="string" ) 2199 public static final String SP_TITLE = "title"; 2200 @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="string" ) 2201 public static final String SP_VERSION = "version"; 2202 @SearchParamDefinition(name="status", path="Questionnaire.status", description="The status of the questionnaire", type="token" ) 2203 public static final String SP_STATUS = "status"; 2204 2205} 2206