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