001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036import java.util.ArrayList; 037import java.util.List; 038 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 041import org.hl7.fhir.utilities.Utilities; 042 043import ca.uhn.fhir.model.api.annotation.Block; 044import ca.uhn.fhir.model.api.annotation.Child; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.ResourceDef; 047import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 048/** 049 * A definition of behaviors to be taken in particular circumstances, often including conditions, options and other decision points. 050 */ 051@ResourceDef(name="Protocol", profile="http://hl7.org/fhir/Profile/Protocol") 052public class Protocol extends DomainResource { 053 054 public enum ProtocolStatus { 055 /** 056 * This protocol is still under development 057 */ 058 DRAFT, 059 /** 060 * This protocol was authored for testing purposes (or education/evaluation/marketing) 061 */ 062 TESTING, 063 /** 064 * This protocol is undergoing review to check that it is ready for production use 065 */ 066 REVIEW, 067 /** 068 * This protocol is ready for use in production systems 069 */ 070 ACTIVE, 071 /** 072 * This protocol has been withdrawn and should no longer be used 073 */ 074 WITHDRAWN, 075 /** 076 * This protocol has been replaced and a different protocol should be used in its place 077 */ 078 SUPERSEDED, 079 /** 080 * added to help the parsers 081 */ 082 NULL; 083 public static ProtocolStatus fromCode(String codeString) throws FHIRException { 084 if (codeString == null || "".equals(codeString)) 085 return null; 086 if ("draft".equals(codeString)) 087 return DRAFT; 088 if ("testing".equals(codeString)) 089 return TESTING; 090 if ("review".equals(codeString)) 091 return REVIEW; 092 if ("active".equals(codeString)) 093 return ACTIVE; 094 if ("withdrawn".equals(codeString)) 095 return WITHDRAWN; 096 if ("superseded".equals(codeString)) 097 return SUPERSEDED; 098 throw new FHIRException("Unknown ProtocolStatus code '"+codeString+"'"); 099 } 100 public String toCode() { 101 switch (this) { 102 case DRAFT: return "draft"; 103 case TESTING: return "testing"; 104 case REVIEW: return "review"; 105 case ACTIVE: return "active"; 106 case WITHDRAWN: return "withdrawn"; 107 case SUPERSEDED: return "superseded"; 108 case NULL: return null; 109 default: return "?"; 110 } 111 } 112 public String getSystem() { 113 switch (this) { 114 case DRAFT: return "http://hl7.org/fhir/protocol-status"; 115 case TESTING: return "http://hl7.org/fhir/protocol-status"; 116 case REVIEW: return "http://hl7.org/fhir/protocol-status"; 117 case ACTIVE: return "http://hl7.org/fhir/protocol-status"; 118 case WITHDRAWN: return "http://hl7.org/fhir/protocol-status"; 119 case SUPERSEDED: return "http://hl7.org/fhir/protocol-status"; 120 case NULL: return null; 121 default: return "?"; 122 } 123 } 124 public String getDefinition() { 125 switch (this) { 126 case DRAFT: return "This protocol is still under development"; 127 case TESTING: return "This protocol was authored for testing purposes (or education/evaluation/marketing)"; 128 case REVIEW: return "This protocol is undergoing review to check that it is ready for production use"; 129 case ACTIVE: return "This protocol is ready for use in production systems"; 130 case WITHDRAWN: return "This protocol has been withdrawn and should no longer be used"; 131 case SUPERSEDED: return "This protocol has been replaced and a different protocol should be used in its place"; 132 case NULL: return null; 133 default: return "?"; 134 } 135 } 136 public String getDisplay() { 137 switch (this) { 138 case DRAFT: return "Draft"; 139 case TESTING: return "Testing"; 140 case REVIEW: return "Review"; 141 case ACTIVE: return "Active"; 142 case WITHDRAWN: return "Withdrawn"; 143 case SUPERSEDED: return "Superseded"; 144 case NULL: return null; 145 default: return "?"; 146 } 147 } 148 } 149 150 public static class ProtocolStatusEnumFactory implements EnumFactory<ProtocolStatus> { 151 public ProtocolStatus fromCode(String codeString) throws IllegalArgumentException { 152 if (codeString == null || "".equals(codeString)) 153 if (codeString == null || "".equals(codeString)) 154 return null; 155 if ("draft".equals(codeString)) 156 return ProtocolStatus.DRAFT; 157 if ("testing".equals(codeString)) 158 return ProtocolStatus.TESTING; 159 if ("review".equals(codeString)) 160 return ProtocolStatus.REVIEW; 161 if ("active".equals(codeString)) 162 return ProtocolStatus.ACTIVE; 163 if ("withdrawn".equals(codeString)) 164 return ProtocolStatus.WITHDRAWN; 165 if ("superseded".equals(codeString)) 166 return ProtocolStatus.SUPERSEDED; 167 throw new IllegalArgumentException("Unknown ProtocolStatus code '"+codeString+"'"); 168 } 169 public Enumeration<ProtocolStatus> fromType(Base code) throws FHIRException { 170 if (code == null || code.isEmpty()) 171 return null; 172 String codeString = ((PrimitiveType) code).asStringValue(); 173 if (codeString == null || "".equals(codeString)) 174 return null; 175 if ("draft".equals(codeString)) 176 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.DRAFT); 177 if ("testing".equals(codeString)) 178 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.TESTING); 179 if ("review".equals(codeString)) 180 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.REVIEW); 181 if ("active".equals(codeString)) 182 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.ACTIVE); 183 if ("withdrawn".equals(codeString)) 184 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.WITHDRAWN); 185 if ("superseded".equals(codeString)) 186 return new Enumeration<ProtocolStatus>(this, ProtocolStatus.SUPERSEDED); 187 throw new FHIRException("Unknown ProtocolStatus code '"+codeString+"'"); 188 } 189 public String toCode(ProtocolStatus code) { 190 if (code == ProtocolStatus.DRAFT) 191 return "draft"; 192 if (code == ProtocolStatus.TESTING) 193 return "testing"; 194 if (code == ProtocolStatus.REVIEW) 195 return "review"; 196 if (code == ProtocolStatus.ACTIVE) 197 return "active"; 198 if (code == ProtocolStatus.WITHDRAWN) 199 return "withdrawn"; 200 if (code == ProtocolStatus.SUPERSEDED) 201 return "superseded"; 202 return "?"; 203 } 204 public String toSystem(ProtocolStatus code) { 205 return code.getSystem(); 206 } 207 } 208 209 public enum ProtocolType { 210 /** 211 * The protocol describes the steps to manage a particular health condition including monitoring, treatment, mitigation and/or follow-up 212 */ 213 CONDITION, 214 /** 215 * The protocol describes the appropriate use of a particular device (medical device, software, etc.) 216 */ 217 DEVICE, 218 /** 219 * The protocol describes the appropriate use of a particular medication including indications for use, dosages, treatment cycles, etc. 220 */ 221 DRUG, 222 /** 223 * The protocol describes the set of steps to occur for study subjects enrolled in an interventional study 224 */ 225 STUDY, 226 /** 227 * added to help the parsers 228 */ 229 NULL; 230 public static ProtocolType fromCode(String codeString) throws FHIRException { 231 if (codeString == null || "".equals(codeString)) 232 return null; 233 if ("condition".equals(codeString)) 234 return CONDITION; 235 if ("device".equals(codeString)) 236 return DEVICE; 237 if ("drug".equals(codeString)) 238 return DRUG; 239 if ("study".equals(codeString)) 240 return STUDY; 241 throw new FHIRException("Unknown ProtocolType code '"+codeString+"'"); 242 } 243 public String toCode() { 244 switch (this) { 245 case CONDITION: return "condition"; 246 case DEVICE: return "device"; 247 case DRUG: return "drug"; 248 case STUDY: return "study"; 249 case NULL: return null; 250 default: return "?"; 251 } 252 } 253 public String getSystem() { 254 switch (this) { 255 case CONDITION: return "http://hl7.org/fhir/protocol-type"; 256 case DEVICE: return "http://hl7.org/fhir/protocol-type"; 257 case DRUG: return "http://hl7.org/fhir/protocol-type"; 258 case STUDY: return "http://hl7.org/fhir/protocol-type"; 259 case NULL: return null; 260 default: return "?"; 261 } 262 } 263 public String getDefinition() { 264 switch (this) { 265 case CONDITION: return "The protocol describes the steps to manage a particular health condition including monitoring, treatment, mitigation and/or follow-up"; 266 case DEVICE: return "The protocol describes the appropriate use of a particular device (medical device, software, etc.)"; 267 case DRUG: return "The protocol describes the appropriate use of a particular medication including indications for use, dosages, treatment cycles, etc."; 268 case STUDY: return "The protocol describes the set of steps to occur for study subjects enrolled in an interventional study"; 269 case NULL: return null; 270 default: return "?"; 271 } 272 } 273 public String getDisplay() { 274 switch (this) { 275 case CONDITION: return "Condition"; 276 case DEVICE: return "Device"; 277 case DRUG: return "Drug"; 278 case STUDY: return "Study"; 279 case NULL: return null; 280 default: return "?"; 281 } 282 } 283 } 284 285 public static class ProtocolTypeEnumFactory implements EnumFactory<ProtocolType> { 286 public ProtocolType fromCode(String codeString) throws IllegalArgumentException { 287 if (codeString == null || "".equals(codeString)) 288 if (codeString == null || "".equals(codeString)) 289 return null; 290 if ("condition".equals(codeString)) 291 return ProtocolType.CONDITION; 292 if ("device".equals(codeString)) 293 return ProtocolType.DEVICE; 294 if ("drug".equals(codeString)) 295 return ProtocolType.DRUG; 296 if ("study".equals(codeString)) 297 return ProtocolType.STUDY; 298 throw new IllegalArgumentException("Unknown ProtocolType code '"+codeString+"'"); 299 } 300 public Enumeration<ProtocolType> fromType(Base code) throws FHIRException { 301 if (code == null || code.isEmpty()) 302 return null; 303 String codeString = ((PrimitiveType) code).asStringValue(); 304 if (codeString == null || "".equals(codeString)) 305 return null; 306 if ("condition".equals(codeString)) 307 return new Enumeration<ProtocolType>(this, ProtocolType.CONDITION); 308 if ("device".equals(codeString)) 309 return new Enumeration<ProtocolType>(this, ProtocolType.DEVICE); 310 if ("drug".equals(codeString)) 311 return new Enumeration<ProtocolType>(this, ProtocolType.DRUG); 312 if ("study".equals(codeString)) 313 return new Enumeration<ProtocolType>(this, ProtocolType.STUDY); 314 throw new FHIRException("Unknown ProtocolType code '"+codeString+"'"); 315 } 316 public String toCode(ProtocolType code) { 317 if (code == ProtocolType.CONDITION) 318 return "condition"; 319 if (code == ProtocolType.DEVICE) 320 return "device"; 321 if (code == ProtocolType.DRUG) 322 return "drug"; 323 if (code == ProtocolType.STUDY) 324 return "study"; 325 return "?"; 326 } 327 public String toSystem(ProtocolType code) { 328 return code.getSystem(); 329 } 330 } 331 332 public enum ActivityDefinitionCategory { 333 /** 334 * To consume food of a specified nature 335 */ 336 DIET, 337 /** 338 * To consume/receive a drug, vaccine or other product 339 */ 340 DRUG, 341 /** 342 * To meet or communicate with the patient (in-patient, out-patient, phone call, etc.) 343 */ 344 ENCOUNTER, 345 /** 346 * To capture information about a patient (vitals, labs, diagnostic images, etc.) 347 */ 348 OBSERVATION, 349 /** 350 * To modify the patient in some way (surgery, physiotherapy, education, counseling, etc.) 351 */ 352 PROCEDURE, 353 /** 354 * To provide something to the patient (medication, medical supply, etc.) 355 */ 356 SUPPLY, 357 /** 358 * Some other form of action 359 */ 360 OTHER, 361 /** 362 * added to help the parsers 363 */ 364 NULL; 365 public static ActivityDefinitionCategory fromCode(String codeString) throws FHIRException { 366 if (codeString == null || "".equals(codeString)) 367 return null; 368 if ("diet".equals(codeString)) 369 return DIET; 370 if ("drug".equals(codeString)) 371 return DRUG; 372 if ("encounter".equals(codeString)) 373 return ENCOUNTER; 374 if ("observation".equals(codeString)) 375 return OBSERVATION; 376 if ("procedure".equals(codeString)) 377 return PROCEDURE; 378 if ("supply".equals(codeString)) 379 return SUPPLY; 380 if ("other".equals(codeString)) 381 return OTHER; 382 throw new FHIRException("Unknown ActivityDefinitionCategory code '"+codeString+"'"); 383 } 384 public String toCode() { 385 switch (this) { 386 case DIET: return "diet"; 387 case DRUG: return "drug"; 388 case ENCOUNTER: return "encounter"; 389 case OBSERVATION: return "observation"; 390 case PROCEDURE: return "procedure"; 391 case SUPPLY: return "supply"; 392 case OTHER: return "other"; 393 case NULL: return null; 394 default: return "?"; 395 } 396 } 397 public String getSystem() { 398 switch (this) { 399 case DIET: return "http://hl7.org/fhir/activity-definition-category"; 400 case DRUG: return "http://hl7.org/fhir/activity-definition-category"; 401 case ENCOUNTER: return "http://hl7.org/fhir/activity-definition-category"; 402 case OBSERVATION: return "http://hl7.org/fhir/activity-definition-category"; 403 case PROCEDURE: return "http://hl7.org/fhir/activity-definition-category"; 404 case SUPPLY: return "http://hl7.org/fhir/activity-definition-category"; 405 case OTHER: return "http://hl7.org/fhir/activity-definition-category"; 406 case NULL: return null; 407 default: return "?"; 408 } 409 } 410 public String getDefinition() { 411 switch (this) { 412 case DIET: return "To consume food of a specified nature"; 413 case DRUG: return "To consume/receive a drug, vaccine or other product"; 414 case ENCOUNTER: return "To meet or communicate with the patient (in-patient, out-patient, phone call, etc.)"; 415 case OBSERVATION: return "To capture information about a patient (vitals, labs, diagnostic images, etc.)"; 416 case PROCEDURE: return "To modify the patient in some way (surgery, physiotherapy, education, counseling, etc.)"; 417 case SUPPLY: return "To provide something to the patient (medication, medical supply, etc.)"; 418 case OTHER: return "Some other form of action"; 419 case NULL: return null; 420 default: return "?"; 421 } 422 } 423 public String getDisplay() { 424 switch (this) { 425 case DIET: return "Diet"; 426 case DRUG: return "Drug"; 427 case ENCOUNTER: return "Encounter"; 428 case OBSERVATION: return "Observation"; 429 case PROCEDURE: return "Procedure"; 430 case SUPPLY: return "Supply"; 431 case OTHER: return "Other"; 432 case NULL: return null; 433 default: return "?"; 434 } 435 } 436 } 437 438 public static class ActivityDefinitionCategoryEnumFactory implements EnumFactory<ActivityDefinitionCategory> { 439 public ActivityDefinitionCategory fromCode(String codeString) throws IllegalArgumentException { 440 if (codeString == null || "".equals(codeString)) 441 if (codeString == null || "".equals(codeString)) 442 return null; 443 if ("diet".equals(codeString)) 444 return ActivityDefinitionCategory.DIET; 445 if ("drug".equals(codeString)) 446 return ActivityDefinitionCategory.DRUG; 447 if ("encounter".equals(codeString)) 448 return ActivityDefinitionCategory.ENCOUNTER; 449 if ("observation".equals(codeString)) 450 return ActivityDefinitionCategory.OBSERVATION; 451 if ("procedure".equals(codeString)) 452 return ActivityDefinitionCategory.PROCEDURE; 453 if ("supply".equals(codeString)) 454 return ActivityDefinitionCategory.SUPPLY; 455 if ("other".equals(codeString)) 456 return ActivityDefinitionCategory.OTHER; 457 throw new IllegalArgumentException("Unknown ActivityDefinitionCategory code '"+codeString+"'"); 458 } 459 public Enumeration<ActivityDefinitionCategory> fromType(Base code) throws FHIRException { 460 if (code == null || code.isEmpty()) 461 return null; 462 String codeString = ((PrimitiveType) code).asStringValue(); 463 if (codeString == null || "".equals(codeString)) 464 return null; 465 if ("diet".equals(codeString)) 466 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.DIET); 467 if ("drug".equals(codeString)) 468 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.DRUG); 469 if ("encounter".equals(codeString)) 470 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.ENCOUNTER); 471 if ("observation".equals(codeString)) 472 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.OBSERVATION); 473 if ("procedure".equals(codeString)) 474 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.PROCEDURE); 475 if ("supply".equals(codeString)) 476 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.SUPPLY); 477 if ("other".equals(codeString)) 478 return new Enumeration<ActivityDefinitionCategory>(this, ActivityDefinitionCategory.OTHER); 479 throw new FHIRException("Unknown ActivityDefinitionCategory code '"+codeString+"'"); 480 } 481 public String toCode(ActivityDefinitionCategory code) { 482 if (code == ActivityDefinitionCategory.DIET) 483 return "diet"; 484 if (code == ActivityDefinitionCategory.DRUG) 485 return "drug"; 486 if (code == ActivityDefinitionCategory.ENCOUNTER) 487 return "encounter"; 488 if (code == ActivityDefinitionCategory.OBSERVATION) 489 return "observation"; 490 if (code == ActivityDefinitionCategory.PROCEDURE) 491 return "procedure"; 492 if (code == ActivityDefinitionCategory.SUPPLY) 493 return "supply"; 494 if (code == ActivityDefinitionCategory.OTHER) 495 return "other"; 496 return "?"; 497 } 498 public String toSystem(ActivityDefinitionCategory code) { 499 return code.getSystem(); 500 } 501 } 502 503 @Block() 504 public static class ProtocolStepComponent extends BackboneElement implements IBaseBackboneElement { 505 /** 506 * Label for step. 507 */ 508 @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 509 @Description(shortDefinition="Label for step", formalDefinition="Label for step." ) 510 protected StringType name; 511 512 /** 513 * Human description of activity. 514 */ 515 @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 516 @Description(shortDefinition="Human description of activity", formalDefinition="Human description of activity." ) 517 protected StringType description; 518 519 /** 520 * How long does step last? 521 */ 522 @Child(name = "duration", type = {Duration.class}, order=3, min=0, max=1, modifier=false, summary=true) 523 @Description(shortDefinition="How long does step last?", formalDefinition="How long does step last?" ) 524 protected Duration duration; 525 526 /** 527 * Rules prior to execution. 528 */ 529 @Child(name = "precondition", type = {}, order=4, min=0, max=1, modifier=true, summary=true) 530 @Description(shortDefinition="Rules prior to execution", formalDefinition="Rules prior to execution." ) 531 protected ProtocolStepPreconditionComponent precondition; 532 533 /** 534 * Indicates the conditions that must be met for activities that are part of this time point to terminate. 535 */ 536 @Child(name = "exit", type = {ProtocolStepPreconditionComponent.class}, order=5, min=0, max=1, modifier=true, summary=true) 537 @Description(shortDefinition="Rules prior to completion", formalDefinition="Indicates the conditions that must be met for activities that are part of this time point to terminate." ) 538 protected ProtocolStepPreconditionComponent exit; 539 540 /** 541 * First activity within timepoint. 542 */ 543 @Child(name = "firstActivity", type = {UriType.class}, order=6, min=0, max=1, modifier=true, summary=true) 544 @Description(shortDefinition="First activity within timepoint", formalDefinition="First activity within timepoint." ) 545 protected UriType firstActivity; 546 547 /** 548 * Activities that occur within timepoint. 549 */ 550 @Child(name = "activity", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true) 551 @Description(shortDefinition="Activities that occur within timepoint", formalDefinition="Activities that occur within timepoint." ) 552 protected List<ProtocolStepActivityComponent> activity; 553 554 /** 555 * What happens next? 556 */ 557 @Child(name = "next", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 558 @Description(shortDefinition="What happens next?", formalDefinition="What happens next?" ) 559 protected List<ProtocolStepNextComponent> next; 560 561 private static final long serialVersionUID = 626452062L; 562 563 /** 564 * Constructor 565 */ 566 public ProtocolStepComponent() { 567 super(); 568 } 569 570 /** 571 * @return {@link #name} (Label for step.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 572 */ 573 public StringType getNameElement() { 574 if (this.name == null) 575 if (Configuration.errorOnAutoCreate()) 576 throw new Error("Attempt to auto-create ProtocolStepComponent.name"); 577 else if (Configuration.doAutoCreate()) 578 this.name = new StringType(); // bb 579 return this.name; 580 } 581 582 public boolean hasNameElement() { 583 return this.name != null && !this.name.isEmpty(); 584 } 585 586 public boolean hasName() { 587 return this.name != null && !this.name.isEmpty(); 588 } 589 590 /** 591 * @param value {@link #name} (Label for step.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 592 */ 593 public ProtocolStepComponent setNameElement(StringType value) { 594 this.name = value; 595 return this; 596 } 597 598 /** 599 * @return Label for step. 600 */ 601 public String getName() { 602 return this.name == null ? null : this.name.getValue(); 603 } 604 605 /** 606 * @param value Label for step. 607 */ 608 public ProtocolStepComponent setName(String value) { 609 if (Utilities.noString(value)) 610 this.name = null; 611 else { 612 if (this.name == null) 613 this.name = new StringType(); 614 this.name.setValue(value); 615 } 616 return this; 617 } 618 619 /** 620 * @return {@link #description} (Human description of activity.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 621 */ 622 public StringType getDescriptionElement() { 623 if (this.description == null) 624 if (Configuration.errorOnAutoCreate()) 625 throw new Error("Attempt to auto-create ProtocolStepComponent.description"); 626 else if (Configuration.doAutoCreate()) 627 this.description = new StringType(); // bb 628 return this.description; 629 } 630 631 public boolean hasDescriptionElement() { 632 return this.description != null && !this.description.isEmpty(); 633 } 634 635 public boolean hasDescription() { 636 return this.description != null && !this.description.isEmpty(); 637 } 638 639 /** 640 * @param value {@link #description} (Human description of activity.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 641 */ 642 public ProtocolStepComponent setDescriptionElement(StringType value) { 643 this.description = value; 644 return this; 645 } 646 647 /** 648 * @return Human description of activity. 649 */ 650 public String getDescription() { 651 return this.description == null ? null : this.description.getValue(); 652 } 653 654 /** 655 * @param value Human description of activity. 656 */ 657 public ProtocolStepComponent setDescription(String value) { 658 if (Utilities.noString(value)) 659 this.description = null; 660 else { 661 if (this.description == null) 662 this.description = new StringType(); 663 this.description.setValue(value); 664 } 665 return this; 666 } 667 668 /** 669 * @return {@link #duration} (How long does step last?) 670 */ 671 public Duration getDuration() { 672 if (this.duration == null) 673 if (Configuration.errorOnAutoCreate()) 674 throw new Error("Attempt to auto-create ProtocolStepComponent.duration"); 675 else if (Configuration.doAutoCreate()) 676 this.duration = new Duration(); // cc 677 return this.duration; 678 } 679 680 public boolean hasDuration() { 681 return this.duration != null && !this.duration.isEmpty(); 682 } 683 684 /** 685 * @param value {@link #duration} (How long does step last?) 686 */ 687 public ProtocolStepComponent setDuration(Duration value) { 688 this.duration = value; 689 return this; 690 } 691 692 /** 693 * @return {@link #precondition} (Rules prior to execution.) 694 */ 695 public ProtocolStepPreconditionComponent getPrecondition() { 696 if (this.precondition == null) 697 if (Configuration.errorOnAutoCreate()) 698 throw new Error("Attempt to auto-create ProtocolStepComponent.precondition"); 699 else if (Configuration.doAutoCreate()) 700 this.precondition = new ProtocolStepPreconditionComponent(); // cc 701 return this.precondition; 702 } 703 704 public boolean hasPrecondition() { 705 return this.precondition != null && !this.precondition.isEmpty(); 706 } 707 708 /** 709 * @param value {@link #precondition} (Rules prior to execution.) 710 */ 711 public ProtocolStepComponent setPrecondition(ProtocolStepPreconditionComponent value) { 712 this.precondition = value; 713 return this; 714 } 715 716 /** 717 * @return {@link #exit} (Indicates the conditions that must be met for activities that are part of this time point to terminate.) 718 */ 719 public ProtocolStepPreconditionComponent getExit() { 720 if (this.exit == null) 721 if (Configuration.errorOnAutoCreate()) 722 throw new Error("Attempt to auto-create ProtocolStepComponent.exit"); 723 else if (Configuration.doAutoCreate()) 724 this.exit = new ProtocolStepPreconditionComponent(); // cc 725 return this.exit; 726 } 727 728 public boolean hasExit() { 729 return this.exit != null && !this.exit.isEmpty(); 730 } 731 732 /** 733 * @param value {@link #exit} (Indicates the conditions that must be met for activities that are part of this time point to terminate.) 734 */ 735 public ProtocolStepComponent setExit(ProtocolStepPreconditionComponent value) { 736 this.exit = value; 737 return this; 738 } 739 740 /** 741 * @return {@link #firstActivity} (First activity within timepoint.). This is the underlying object with id, value and extensions. The accessor "getFirstActivity" gives direct access to the value 742 */ 743 public UriType getFirstActivityElement() { 744 if (this.firstActivity == null) 745 if (Configuration.errorOnAutoCreate()) 746 throw new Error("Attempt to auto-create ProtocolStepComponent.firstActivity"); 747 else if (Configuration.doAutoCreate()) 748 this.firstActivity = new UriType(); // bb 749 return this.firstActivity; 750 } 751 752 public boolean hasFirstActivityElement() { 753 return this.firstActivity != null && !this.firstActivity.isEmpty(); 754 } 755 756 public boolean hasFirstActivity() { 757 return this.firstActivity != null && !this.firstActivity.isEmpty(); 758 } 759 760 /** 761 * @param value {@link #firstActivity} (First activity within timepoint.). This is the underlying object with id, value and extensions. The accessor "getFirstActivity" gives direct access to the value 762 */ 763 public ProtocolStepComponent setFirstActivityElement(UriType value) { 764 this.firstActivity = value; 765 return this; 766 } 767 768 /** 769 * @return First activity within timepoint. 770 */ 771 public String getFirstActivity() { 772 return this.firstActivity == null ? null : this.firstActivity.getValue(); 773 } 774 775 /** 776 * @param value First activity within timepoint. 777 */ 778 public ProtocolStepComponent setFirstActivity(String value) { 779 if (Utilities.noString(value)) 780 this.firstActivity = null; 781 else { 782 if (this.firstActivity == null) 783 this.firstActivity = new UriType(); 784 this.firstActivity.setValue(value); 785 } 786 return this; 787 } 788 789 /** 790 * @return {@link #activity} (Activities that occur within timepoint.) 791 */ 792 public List<ProtocolStepActivityComponent> getActivity() { 793 if (this.activity == null) 794 this.activity = new ArrayList<ProtocolStepActivityComponent>(); 795 return this.activity; 796 } 797 798 public boolean hasActivity() { 799 if (this.activity == null) 800 return false; 801 for (ProtocolStepActivityComponent item : this.activity) 802 if (!item.isEmpty()) 803 return true; 804 return false; 805 } 806 807 /** 808 * @return {@link #activity} (Activities that occur within timepoint.) 809 */ 810 // syntactic sugar 811 public ProtocolStepActivityComponent addActivity() { //3 812 ProtocolStepActivityComponent t = new ProtocolStepActivityComponent(); 813 if (this.activity == null) 814 this.activity = new ArrayList<ProtocolStepActivityComponent>(); 815 this.activity.add(t); 816 return t; 817 } 818 819 // syntactic sugar 820 public ProtocolStepComponent addActivity(ProtocolStepActivityComponent t) { //3 821 if (t == null) 822 return this; 823 if (this.activity == null) 824 this.activity = new ArrayList<ProtocolStepActivityComponent>(); 825 this.activity.add(t); 826 return this; 827 } 828 829 /** 830 * @return {@link #next} (What happens next?) 831 */ 832 public List<ProtocolStepNextComponent> getNext() { 833 if (this.next == null) 834 this.next = new ArrayList<ProtocolStepNextComponent>(); 835 return this.next; 836 } 837 838 public boolean hasNext() { 839 if (this.next == null) 840 return false; 841 for (ProtocolStepNextComponent item : this.next) 842 if (!item.isEmpty()) 843 return true; 844 return false; 845 } 846 847 /** 848 * @return {@link #next} (What happens next?) 849 */ 850 // syntactic sugar 851 public ProtocolStepNextComponent addNext() { //3 852 ProtocolStepNextComponent t = new ProtocolStepNextComponent(); 853 if (this.next == null) 854 this.next = new ArrayList<ProtocolStepNextComponent>(); 855 this.next.add(t); 856 return t; 857 } 858 859 // syntactic sugar 860 public ProtocolStepComponent addNext(ProtocolStepNextComponent t) { //3 861 if (t == null) 862 return this; 863 if (this.next == null) 864 this.next = new ArrayList<ProtocolStepNextComponent>(); 865 this.next.add(t); 866 return this; 867 } 868 869 protected void listChildren(List<Property> childrenList) { 870 super.listChildren(childrenList); 871 childrenList.add(new Property("name", "string", "Label for step.", 0, java.lang.Integer.MAX_VALUE, name)); 872 childrenList.add(new Property("description", "string", "Human description of activity.", 0, java.lang.Integer.MAX_VALUE, description)); 873 childrenList.add(new Property("duration", "Duration", "How long does step last?", 0, java.lang.Integer.MAX_VALUE, duration)); 874 childrenList.add(new Property("precondition", "", "Rules prior to execution.", 0, java.lang.Integer.MAX_VALUE, precondition)); 875 childrenList.add(new Property("exit", "@Protocol.step.precondition", "Indicates the conditions that must be met for activities that are part of this time point to terminate.", 0, java.lang.Integer.MAX_VALUE, exit)); 876 childrenList.add(new Property("firstActivity", "uri", "First activity within timepoint.", 0, java.lang.Integer.MAX_VALUE, firstActivity)); 877 childrenList.add(new Property("activity", "", "Activities that occur within timepoint.", 0, java.lang.Integer.MAX_VALUE, activity)); 878 childrenList.add(new Property("next", "", "What happens next?", 0, java.lang.Integer.MAX_VALUE, next)); 879 } 880 881 @Override 882 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 883 switch (hash) { 884 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 885 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 886 case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Duration 887 case -650968616: /*precondition*/ return this.precondition == null ? new Base[0] : new Base[] {this.precondition}; // ProtocolStepPreconditionComponent 888 case 3127582: /*exit*/ return this.exit == null ? new Base[0] : new Base[] {this.exit}; // ProtocolStepPreconditionComponent 889 case 185563615: /*firstActivity*/ return this.firstActivity == null ? new Base[0] : new Base[] {this.firstActivity}; // UriType 890 case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : this.activity.toArray(new Base[this.activity.size()]); // ProtocolStepActivityComponent 891 case 3377907: /*next*/ return this.next == null ? new Base[0] : this.next.toArray(new Base[this.next.size()]); // ProtocolStepNextComponent 892 default: return super.getProperty(hash, name, checkValid); 893 } 894 895 } 896 897 @Override 898 public void setProperty(int hash, String name, Base value) throws FHIRException { 899 switch (hash) { 900 case 3373707: // name 901 this.name = castToString(value); // StringType 902 break; 903 case -1724546052: // description 904 this.description = castToString(value); // StringType 905 break; 906 case -1992012396: // duration 907 this.duration = castToDuration(value); // Duration 908 break; 909 case -650968616: // precondition 910 this.precondition = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 911 break; 912 case 3127582: // exit 913 this.exit = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 914 break; 915 case 185563615: // firstActivity 916 this.firstActivity = castToUri(value); // UriType 917 break; 918 case -1655966961: // activity 919 this.getActivity().add((ProtocolStepActivityComponent) value); // ProtocolStepActivityComponent 920 break; 921 case 3377907: // next 922 this.getNext().add((ProtocolStepNextComponent) value); // ProtocolStepNextComponent 923 break; 924 default: super.setProperty(hash, name, value); 925 } 926 927 } 928 929 @Override 930 public void setProperty(String name, Base value) throws FHIRException { 931 if (name.equals("name")) 932 this.name = castToString(value); // StringType 933 else if (name.equals("description")) 934 this.description = castToString(value); // StringType 935 else if (name.equals("duration")) 936 this.duration = castToDuration(value); // Duration 937 else if (name.equals("precondition")) 938 this.precondition = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 939 else if (name.equals("exit")) 940 this.exit = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 941 else if (name.equals("firstActivity")) 942 this.firstActivity = castToUri(value); // UriType 943 else if (name.equals("activity")) 944 this.getActivity().add((ProtocolStepActivityComponent) value); 945 else if (name.equals("next")) 946 this.getNext().add((ProtocolStepNextComponent) value); 947 else 948 super.setProperty(name, value); 949 } 950 951 @Override 952 public Base makeProperty(int hash, String name) throws FHIRException { 953 switch (hash) { 954 case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType 955 case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType 956 case -1992012396: return getDuration(); // Duration 957 case -650968616: return getPrecondition(); // ProtocolStepPreconditionComponent 958 case 3127582: return getExit(); // ProtocolStepPreconditionComponent 959 case 185563615: throw new FHIRException("Cannot make property firstActivity as it is not a complex type"); // UriType 960 case -1655966961: return addActivity(); // ProtocolStepActivityComponent 961 case 3377907: return addNext(); // ProtocolStepNextComponent 962 default: return super.makeProperty(hash, name); 963 } 964 965 } 966 967 @Override 968 public Base addChild(String name) throws FHIRException { 969 if (name.equals("name")) { 970 throw new FHIRException("Cannot call addChild on a primitive type Protocol.name"); 971 } 972 else if (name.equals("description")) { 973 throw new FHIRException("Cannot call addChild on a primitive type Protocol.description"); 974 } 975 else if (name.equals("duration")) { 976 this.duration = new Duration(); 977 return this.duration; 978 } 979 else if (name.equals("precondition")) { 980 this.precondition = new ProtocolStepPreconditionComponent(); 981 return this.precondition; 982 } 983 else if (name.equals("exit")) { 984 this.exit = new ProtocolStepPreconditionComponent(); 985 return this.exit; 986 } 987 else if (name.equals("firstActivity")) { 988 throw new FHIRException("Cannot call addChild on a primitive type Protocol.firstActivity"); 989 } 990 else if (name.equals("activity")) { 991 return addActivity(); 992 } 993 else if (name.equals("next")) { 994 return addNext(); 995 } 996 else 997 return super.addChild(name); 998 } 999 1000 public ProtocolStepComponent copy() { 1001 ProtocolStepComponent dst = new ProtocolStepComponent(); 1002 copyValues(dst); 1003 dst.name = name == null ? null : name.copy(); 1004 dst.description = description == null ? null : description.copy(); 1005 dst.duration = duration == null ? null : duration.copy(); 1006 dst.precondition = precondition == null ? null : precondition.copy(); 1007 dst.exit = exit == null ? null : exit.copy(); 1008 dst.firstActivity = firstActivity == null ? null : firstActivity.copy(); 1009 if (activity != null) { 1010 dst.activity = new ArrayList<ProtocolStepActivityComponent>(); 1011 for (ProtocolStepActivityComponent i : activity) 1012 dst.activity.add(i.copy()); 1013 }; 1014 if (next != null) { 1015 dst.next = new ArrayList<ProtocolStepNextComponent>(); 1016 for (ProtocolStepNextComponent i : next) 1017 dst.next.add(i.copy()); 1018 }; 1019 return dst; 1020 } 1021 1022 @Override 1023 public boolean equalsDeep(Base other) { 1024 if (!super.equalsDeep(other)) 1025 return false; 1026 if (!(other instanceof ProtocolStepComponent)) 1027 return false; 1028 ProtocolStepComponent o = (ProtocolStepComponent) other; 1029 return compareDeep(name, o.name, true) && compareDeep(description, o.description, true) && compareDeep(duration, o.duration, true) 1030 && compareDeep(precondition, o.precondition, true) && compareDeep(exit, o.exit, true) && compareDeep(firstActivity, o.firstActivity, true) 1031 && compareDeep(activity, o.activity, true) && compareDeep(next, o.next, true); 1032 } 1033 1034 @Override 1035 public boolean equalsShallow(Base other) { 1036 if (!super.equalsShallow(other)) 1037 return false; 1038 if (!(other instanceof ProtocolStepComponent)) 1039 return false; 1040 ProtocolStepComponent o = (ProtocolStepComponent) other; 1041 return compareValues(name, o.name, true) && compareValues(description, o.description, true) && compareValues(firstActivity, o.firstActivity, true) 1042 ; 1043 } 1044 1045 public boolean isEmpty() { 1046 return super.isEmpty() && (name == null || name.isEmpty()) && (description == null || description.isEmpty()) 1047 && (duration == null || duration.isEmpty()) && (precondition == null || precondition.isEmpty()) 1048 && (exit == null || exit.isEmpty()) && (firstActivity == null || firstActivity.isEmpty()) 1049 && (activity == null || activity.isEmpty()) && (next == null || next.isEmpty()); 1050 } 1051 1052 public String fhirType() { 1053 return "Protocol.step"; 1054 1055 } 1056 1057 } 1058 1059 @Block() 1060 public static class ProtocolStepPreconditionComponent extends BackboneElement implements IBaseBackboneElement { 1061 /** 1062 * Human-readable description of the condition. 1063 */ 1064 @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 1065 @Description(shortDefinition="Description of condition", formalDefinition="Human-readable description of the condition." ) 1066 protected StringType description; 1067 1068 /** 1069 * Defines the name/value pair that must hold for the condition to be met. 1070 */ 1071 @Child(name = "condition", type = {}, order=2, min=0, max=1, modifier=false, summary=true) 1072 @Description(shortDefinition="Condition evaluated", formalDefinition="Defines the name/value pair that must hold for the condition to be met." ) 1073 protected ProtocolStepPreconditionConditionComponent condition; 1074 1075 /** 1076 * Lists a set of conditions that must all be met. 1077 */ 1078 @Child(name = "intersection", type = {ProtocolStepPreconditionComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1079 @Description(shortDefinition="And conditions", formalDefinition="Lists a set of conditions that must all be met." ) 1080 protected List<ProtocolStepPreconditionComponent> intersection; 1081 1082 /** 1083 * Lists alternative conditions, at least one of must be met. 1084 */ 1085 @Child(name = "union", type = {ProtocolStepPreconditionComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1086 @Description(shortDefinition="Or conditions", formalDefinition="Lists alternative conditions, at least one of must be met." ) 1087 protected List<ProtocolStepPreconditionComponent> union; 1088 1089 /** 1090 * Lists conditions of which none must be met. 1091 */ 1092 @Child(name = "exclude", type = {ProtocolStepPreconditionComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1093 @Description(shortDefinition="Not conditions", formalDefinition="Lists conditions of which none must be met." ) 1094 protected List<ProtocolStepPreconditionComponent> exclude; 1095 1096 private static final long serialVersionUID = -1469954145L; 1097 1098 /** 1099 * Constructor 1100 */ 1101 public ProtocolStepPreconditionComponent() { 1102 super(); 1103 } 1104 1105 /** 1106 * @return {@link #description} (Human-readable description of the condition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 1107 */ 1108 public StringType getDescriptionElement() { 1109 if (this.description == null) 1110 if (Configuration.errorOnAutoCreate()) 1111 throw new Error("Attempt to auto-create ProtocolStepPreconditionComponent.description"); 1112 else if (Configuration.doAutoCreate()) 1113 this.description = new StringType(); // bb 1114 return this.description; 1115 } 1116 1117 public boolean hasDescriptionElement() { 1118 return this.description != null && !this.description.isEmpty(); 1119 } 1120 1121 public boolean hasDescription() { 1122 return this.description != null && !this.description.isEmpty(); 1123 } 1124 1125 /** 1126 * @param value {@link #description} (Human-readable description of the condition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 1127 */ 1128 public ProtocolStepPreconditionComponent setDescriptionElement(StringType value) { 1129 this.description = value; 1130 return this; 1131 } 1132 1133 /** 1134 * @return Human-readable description of the condition. 1135 */ 1136 public String getDescription() { 1137 return this.description == null ? null : this.description.getValue(); 1138 } 1139 1140 /** 1141 * @param value Human-readable description of the condition. 1142 */ 1143 public ProtocolStepPreconditionComponent setDescription(String value) { 1144 if (Utilities.noString(value)) 1145 this.description = null; 1146 else { 1147 if (this.description == null) 1148 this.description = new StringType(); 1149 this.description.setValue(value); 1150 } 1151 return this; 1152 } 1153 1154 /** 1155 * @return {@link #condition} (Defines the name/value pair that must hold for the condition to be met.) 1156 */ 1157 public ProtocolStepPreconditionConditionComponent getCondition() { 1158 if (this.condition == null) 1159 if (Configuration.errorOnAutoCreate()) 1160 throw new Error("Attempt to auto-create ProtocolStepPreconditionComponent.condition"); 1161 else if (Configuration.doAutoCreate()) 1162 this.condition = new ProtocolStepPreconditionConditionComponent(); // cc 1163 return this.condition; 1164 } 1165 1166 public boolean hasCondition() { 1167 return this.condition != null && !this.condition.isEmpty(); 1168 } 1169 1170 /** 1171 * @param value {@link #condition} (Defines the name/value pair that must hold for the condition to be met.) 1172 */ 1173 public ProtocolStepPreconditionComponent setCondition(ProtocolStepPreconditionConditionComponent value) { 1174 this.condition = value; 1175 return this; 1176 } 1177 1178 /** 1179 * @return {@link #intersection} (Lists a set of conditions that must all be met.) 1180 */ 1181 public List<ProtocolStepPreconditionComponent> getIntersection() { 1182 if (this.intersection == null) 1183 this.intersection = new ArrayList<ProtocolStepPreconditionComponent>(); 1184 return this.intersection; 1185 } 1186 1187 public boolean hasIntersection() { 1188 if (this.intersection == null) 1189 return false; 1190 for (ProtocolStepPreconditionComponent item : this.intersection) 1191 if (!item.isEmpty()) 1192 return true; 1193 return false; 1194 } 1195 1196 /** 1197 * @return {@link #intersection} (Lists a set of conditions that must all be met.) 1198 */ 1199 // syntactic sugar 1200 public ProtocolStepPreconditionComponent addIntersection() { //3 1201 ProtocolStepPreconditionComponent t = new ProtocolStepPreconditionComponent(); 1202 if (this.intersection == null) 1203 this.intersection = new ArrayList<ProtocolStepPreconditionComponent>(); 1204 this.intersection.add(t); 1205 return t; 1206 } 1207 1208 // syntactic sugar 1209 public ProtocolStepPreconditionComponent addIntersection(ProtocolStepPreconditionComponent t) { //3 1210 if (t == null) 1211 return this; 1212 if (this.intersection == null) 1213 this.intersection = new ArrayList<ProtocolStepPreconditionComponent>(); 1214 this.intersection.add(t); 1215 return this; 1216 } 1217 1218 /** 1219 * @return {@link #union} (Lists alternative conditions, at least one of must be met.) 1220 */ 1221 public List<ProtocolStepPreconditionComponent> getUnion() { 1222 if (this.union == null) 1223 this.union = new ArrayList<ProtocolStepPreconditionComponent>(); 1224 return this.union; 1225 } 1226 1227 public boolean hasUnion() { 1228 if (this.union == null) 1229 return false; 1230 for (ProtocolStepPreconditionComponent item : this.union) 1231 if (!item.isEmpty()) 1232 return true; 1233 return false; 1234 } 1235 1236 /** 1237 * @return {@link #union} (Lists alternative conditions, at least one of must be met.) 1238 */ 1239 // syntactic sugar 1240 public ProtocolStepPreconditionComponent addUnion() { //3 1241 ProtocolStepPreconditionComponent t = new ProtocolStepPreconditionComponent(); 1242 if (this.union == null) 1243 this.union = new ArrayList<ProtocolStepPreconditionComponent>(); 1244 this.union.add(t); 1245 return t; 1246 } 1247 1248 // syntactic sugar 1249 public ProtocolStepPreconditionComponent addUnion(ProtocolStepPreconditionComponent t) { //3 1250 if (t == null) 1251 return this; 1252 if (this.union == null) 1253 this.union = new ArrayList<ProtocolStepPreconditionComponent>(); 1254 this.union.add(t); 1255 return this; 1256 } 1257 1258 /** 1259 * @return {@link #exclude} (Lists conditions of which none must be met.) 1260 */ 1261 public List<ProtocolStepPreconditionComponent> getExclude() { 1262 if (this.exclude == null) 1263 this.exclude = new ArrayList<ProtocolStepPreconditionComponent>(); 1264 return this.exclude; 1265 } 1266 1267 public boolean hasExclude() { 1268 if (this.exclude == null) 1269 return false; 1270 for (ProtocolStepPreconditionComponent item : this.exclude) 1271 if (!item.isEmpty()) 1272 return true; 1273 return false; 1274 } 1275 1276 /** 1277 * @return {@link #exclude} (Lists conditions of which none must be met.) 1278 */ 1279 // syntactic sugar 1280 public ProtocolStepPreconditionComponent addExclude() { //3 1281 ProtocolStepPreconditionComponent t = new ProtocolStepPreconditionComponent(); 1282 if (this.exclude == null) 1283 this.exclude = new ArrayList<ProtocolStepPreconditionComponent>(); 1284 this.exclude.add(t); 1285 return t; 1286 } 1287 1288 // syntactic sugar 1289 public ProtocolStepPreconditionComponent addExclude(ProtocolStepPreconditionComponent t) { //3 1290 if (t == null) 1291 return this; 1292 if (this.exclude == null) 1293 this.exclude = new ArrayList<ProtocolStepPreconditionComponent>(); 1294 this.exclude.add(t); 1295 return this; 1296 } 1297 1298 protected void listChildren(List<Property> childrenList) { 1299 super.listChildren(childrenList); 1300 childrenList.add(new Property("description", "string", "Human-readable description of the condition.", 0, java.lang.Integer.MAX_VALUE, description)); 1301 childrenList.add(new Property("condition", "", "Defines the name/value pair that must hold for the condition to be met.", 0, java.lang.Integer.MAX_VALUE, condition)); 1302 childrenList.add(new Property("intersection", "@Protocol.step.precondition", "Lists a set of conditions that must all be met.", 0, java.lang.Integer.MAX_VALUE, intersection)); 1303 childrenList.add(new Property("union", "@Protocol.step.precondition", "Lists alternative conditions, at least one of must be met.", 0, java.lang.Integer.MAX_VALUE, union)); 1304 childrenList.add(new Property("exclude", "@Protocol.step.precondition", "Lists conditions of which none must be met.", 0, java.lang.Integer.MAX_VALUE, exclude)); 1305 } 1306 1307 @Override 1308 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1309 switch (hash) { 1310 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 1311 case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // ProtocolStepPreconditionConditionComponent 1312 case 169749129: /*intersection*/ return this.intersection == null ? new Base[0] : this.intersection.toArray(new Base[this.intersection.size()]); // ProtocolStepPreconditionComponent 1313 case 111433423: /*union*/ return this.union == null ? new Base[0] : this.union.toArray(new Base[this.union.size()]); // ProtocolStepPreconditionComponent 1314 case -1321148966: /*exclude*/ return this.exclude == null ? new Base[0] : this.exclude.toArray(new Base[this.exclude.size()]); // ProtocolStepPreconditionComponent 1315 default: return super.getProperty(hash, name, checkValid); 1316 } 1317 1318 } 1319 1320 @Override 1321 public void setProperty(int hash, String name, Base value) throws FHIRException { 1322 switch (hash) { 1323 case -1724546052: // description 1324 this.description = castToString(value); // StringType 1325 break; 1326 case -861311717: // condition 1327 this.condition = (ProtocolStepPreconditionConditionComponent) value; // ProtocolStepPreconditionConditionComponent 1328 break; 1329 case 169749129: // intersection 1330 this.getIntersection().add((ProtocolStepPreconditionComponent) value); // ProtocolStepPreconditionComponent 1331 break; 1332 case 111433423: // union 1333 this.getUnion().add((ProtocolStepPreconditionComponent) value); // ProtocolStepPreconditionComponent 1334 break; 1335 case -1321148966: // exclude 1336 this.getExclude().add((ProtocolStepPreconditionComponent) value); // ProtocolStepPreconditionComponent 1337 break; 1338 default: super.setProperty(hash, name, value); 1339 } 1340 1341 } 1342 1343 @Override 1344 public void setProperty(String name, Base value) throws FHIRException { 1345 if (name.equals("description")) 1346 this.description = castToString(value); // StringType 1347 else if (name.equals("condition")) 1348 this.condition = (ProtocolStepPreconditionConditionComponent) value; // ProtocolStepPreconditionConditionComponent 1349 else if (name.equals("intersection")) 1350 this.getIntersection().add((ProtocolStepPreconditionComponent) value); 1351 else if (name.equals("union")) 1352 this.getUnion().add((ProtocolStepPreconditionComponent) value); 1353 else if (name.equals("exclude")) 1354 this.getExclude().add((ProtocolStepPreconditionComponent) value); 1355 else 1356 super.setProperty(name, value); 1357 } 1358 1359 @Override 1360 public Base makeProperty(int hash, String name) throws FHIRException { 1361 switch (hash) { 1362 case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType 1363 case -861311717: return getCondition(); // ProtocolStepPreconditionConditionComponent 1364 case 169749129: return addIntersection(); // ProtocolStepPreconditionComponent 1365 case 111433423: return addUnion(); // ProtocolStepPreconditionComponent 1366 case -1321148966: return addExclude(); // ProtocolStepPreconditionComponent 1367 default: return super.makeProperty(hash, name); 1368 } 1369 1370 } 1371 1372 @Override 1373 public Base addChild(String name) throws FHIRException { 1374 if (name.equals("description")) { 1375 throw new FHIRException("Cannot call addChild on a primitive type Protocol.description"); 1376 } 1377 else if (name.equals("condition")) { 1378 this.condition = new ProtocolStepPreconditionConditionComponent(); 1379 return this.condition; 1380 } 1381 else if (name.equals("intersection")) { 1382 return addIntersection(); 1383 } 1384 else if (name.equals("union")) { 1385 return addUnion(); 1386 } 1387 else if (name.equals("exclude")) { 1388 return addExclude(); 1389 } 1390 else 1391 return super.addChild(name); 1392 } 1393 1394 public ProtocolStepPreconditionComponent copy() { 1395 ProtocolStepPreconditionComponent dst = new ProtocolStepPreconditionComponent(); 1396 copyValues(dst); 1397 dst.description = description == null ? null : description.copy(); 1398 dst.condition = condition == null ? null : condition.copy(); 1399 if (intersection != null) { 1400 dst.intersection = new ArrayList<ProtocolStepPreconditionComponent>(); 1401 for (ProtocolStepPreconditionComponent i : intersection) 1402 dst.intersection.add(i.copy()); 1403 }; 1404 if (union != null) { 1405 dst.union = new ArrayList<ProtocolStepPreconditionComponent>(); 1406 for (ProtocolStepPreconditionComponent i : union) 1407 dst.union.add(i.copy()); 1408 }; 1409 if (exclude != null) { 1410 dst.exclude = new ArrayList<ProtocolStepPreconditionComponent>(); 1411 for (ProtocolStepPreconditionComponent i : exclude) 1412 dst.exclude.add(i.copy()); 1413 }; 1414 return dst; 1415 } 1416 1417 @Override 1418 public boolean equalsDeep(Base other) { 1419 if (!super.equalsDeep(other)) 1420 return false; 1421 if (!(other instanceof ProtocolStepPreconditionComponent)) 1422 return false; 1423 ProtocolStepPreconditionComponent o = (ProtocolStepPreconditionComponent) other; 1424 return compareDeep(description, o.description, true) && compareDeep(condition, o.condition, true) 1425 && compareDeep(intersection, o.intersection, true) && compareDeep(union, o.union, true) && compareDeep(exclude, o.exclude, true) 1426 ; 1427 } 1428 1429 @Override 1430 public boolean equalsShallow(Base other) { 1431 if (!super.equalsShallow(other)) 1432 return false; 1433 if (!(other instanceof ProtocolStepPreconditionComponent)) 1434 return false; 1435 ProtocolStepPreconditionComponent o = (ProtocolStepPreconditionComponent) other; 1436 return compareValues(description, o.description, true); 1437 } 1438 1439 public boolean isEmpty() { 1440 return super.isEmpty() && (description == null || description.isEmpty()) && (condition == null || condition.isEmpty()) 1441 && (intersection == null || intersection.isEmpty()) && (union == null || union.isEmpty()) 1442 && (exclude == null || exclude.isEmpty()); 1443 } 1444 1445 public String fhirType() { 1446 return "Protocol.step.precondition"; 1447 1448 } 1449 1450 } 1451 1452 @Block() 1453 public static class ProtocolStepPreconditionConditionComponent extends BackboneElement implements IBaseBackboneElement { 1454 /** 1455 * The type of observation, test or other assertion being evaluated by the condition. 1456 */ 1457 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 1458 @Description(shortDefinition="Observation / test / assertion", formalDefinition="The type of observation, test or other assertion being evaluated by the condition." ) 1459 protected CodeableConcept type; 1460 1461 /** 1462 * Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied. 1463 */ 1464 @Child(name = "value", type = {CodeableConcept.class, BooleanType.class, SimpleQuantity.class, Range.class}, order=2, min=1, max=1, modifier=false, summary=true) 1465 @Description(shortDefinition="Value needed to satisfy condition", formalDefinition="Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied." ) 1466 protected Type value; 1467 1468 private static final long serialVersionUID = -491121170L; 1469 1470 /** 1471 * Constructor 1472 */ 1473 public ProtocolStepPreconditionConditionComponent() { 1474 super(); 1475 } 1476 1477 /** 1478 * Constructor 1479 */ 1480 public ProtocolStepPreconditionConditionComponent(CodeableConcept type, Type value) { 1481 super(); 1482 this.type = type; 1483 this.value = value; 1484 } 1485 1486 /** 1487 * @return {@link #type} (The type of observation, test or other assertion being evaluated by the condition.) 1488 */ 1489 public CodeableConcept getType() { 1490 if (this.type == null) 1491 if (Configuration.errorOnAutoCreate()) 1492 throw new Error("Attempt to auto-create ProtocolStepPreconditionConditionComponent.type"); 1493 else if (Configuration.doAutoCreate()) 1494 this.type = new CodeableConcept(); // cc 1495 return this.type; 1496 } 1497 1498 public boolean hasType() { 1499 return this.type != null && !this.type.isEmpty(); 1500 } 1501 1502 /** 1503 * @param value {@link #type} (The type of observation, test or other assertion being evaluated by the condition.) 1504 */ 1505 public ProtocolStepPreconditionConditionComponent setType(CodeableConcept value) { 1506 this.type = value; 1507 return this; 1508 } 1509 1510 /** 1511 * @return {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1512 */ 1513 public Type getValue() { 1514 return this.value; 1515 } 1516 1517 /** 1518 * @return {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1519 */ 1520 public CodeableConcept getValueCodeableConcept() throws FHIRException { 1521 if (!(this.value instanceof CodeableConcept)) 1522 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 1523 return (CodeableConcept) this.value; 1524 } 1525 1526 public boolean hasValueCodeableConcept() { 1527 return this.value instanceof CodeableConcept; 1528 } 1529 1530 /** 1531 * @return {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1532 */ 1533 public BooleanType getValueBooleanType() throws FHIRException { 1534 if (!(this.value instanceof BooleanType)) 1535 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered"); 1536 return (BooleanType) this.value; 1537 } 1538 1539 public boolean hasValueBooleanType() { 1540 return this.value instanceof BooleanType; 1541 } 1542 1543 /** 1544 * @return {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1545 */ 1546 public SimpleQuantity getValueQuantity() throws FHIRException { 1547 if (!(this.value instanceof Quantity)) 1548 throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.value.getClass().getName()+" was encountered"); 1549 return (SimpleQuantity) this.value; 1550 } 1551 1552 public boolean hasValueQuantity() { 1553 return this.value instanceof Quantity; 1554 } 1555 1556 /** 1557 * @return {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1558 */ 1559 public Range getValueRange() throws FHIRException { 1560 if (!(this.value instanceof Range)) 1561 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered"); 1562 return (Range) this.value; 1563 } 1564 1565 public boolean hasValueRange() { 1566 return this.value instanceof Range; 1567 } 1568 1569 public boolean hasValue() { 1570 return this.value != null && !this.value.isEmpty(); 1571 } 1572 1573 /** 1574 * @param value {@link #value} (Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.) 1575 */ 1576 public ProtocolStepPreconditionConditionComponent setValue(Type value) { 1577 this.value = value; 1578 return this; 1579 } 1580 1581 protected void listChildren(List<Property> childrenList) { 1582 super.listChildren(childrenList); 1583 childrenList.add(new Property("type", "CodeableConcept", "The type of observation, test or other assertion being evaluated by the condition.", 0, java.lang.Integer.MAX_VALUE, type)); 1584 childrenList.add(new Property("value[x]", "CodeableConcept|boolean|SimpleQuantity|Range", "Indicates what value the observation/test/assertion must have in order for the condition to be considered to be satisfied.", 0, java.lang.Integer.MAX_VALUE, value)); 1585 } 1586 1587 @Override 1588 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1589 switch (hash) { 1590 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1591 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type 1592 default: return super.getProperty(hash, name, checkValid); 1593 } 1594 1595 } 1596 1597 @Override 1598 public void setProperty(int hash, String name, Base value) throws FHIRException { 1599 switch (hash) { 1600 case 3575610: // type 1601 this.type = castToCodeableConcept(value); // CodeableConcept 1602 break; 1603 case 111972721: // value 1604 this.value = (Type) value; // Type 1605 break; 1606 default: super.setProperty(hash, name, value); 1607 } 1608 1609 } 1610 1611 @Override 1612 public void setProperty(String name, Base value) throws FHIRException { 1613 if (name.equals("type")) 1614 this.type = castToCodeableConcept(value); // CodeableConcept 1615 else if (name.equals("value[x]")) 1616 this.value = (Type) value; // Type 1617 else 1618 super.setProperty(name, value); 1619 } 1620 1621 @Override 1622 public Base makeProperty(int hash, String name) throws FHIRException { 1623 switch (hash) { 1624 case 3575610: return getType(); // CodeableConcept 1625 case -1410166417: return getValue(); // Type 1626 default: return super.makeProperty(hash, name); 1627 } 1628 1629 } 1630 1631 @Override 1632 public Base addChild(String name) throws FHIRException { 1633 if (name.equals("type")) { 1634 this.type = new CodeableConcept(); 1635 return this.type; 1636 } 1637 else if (name.equals("valueCodeableConcept")) { 1638 this.value = new CodeableConcept(); 1639 return this.value; 1640 } 1641 else if (name.equals("valueBoolean")) { 1642 this.value = new BooleanType(); 1643 return this.value; 1644 } 1645 else if (name.equals("valueSimpleQuantity")) { 1646 this.value = new SimpleQuantity(); 1647 return this.value; 1648 } 1649 else if (name.equals("valueRange")) { 1650 this.value = new Range(); 1651 return this.value; 1652 } 1653 else 1654 return super.addChild(name); 1655 } 1656 1657 public ProtocolStepPreconditionConditionComponent copy() { 1658 ProtocolStepPreconditionConditionComponent dst = new ProtocolStepPreconditionConditionComponent(); 1659 copyValues(dst); 1660 dst.type = type == null ? null : type.copy(); 1661 dst.value = value == null ? null : value.copy(); 1662 return dst; 1663 } 1664 1665 @Override 1666 public boolean equalsDeep(Base other) { 1667 if (!super.equalsDeep(other)) 1668 return false; 1669 if (!(other instanceof ProtocolStepPreconditionConditionComponent)) 1670 return false; 1671 ProtocolStepPreconditionConditionComponent o = (ProtocolStepPreconditionConditionComponent) other; 1672 return compareDeep(type, o.type, true) && compareDeep(value, o.value, true); 1673 } 1674 1675 @Override 1676 public boolean equalsShallow(Base other) { 1677 if (!super.equalsShallow(other)) 1678 return false; 1679 if (!(other instanceof ProtocolStepPreconditionConditionComponent)) 1680 return false; 1681 ProtocolStepPreconditionConditionComponent o = (ProtocolStepPreconditionConditionComponent) other; 1682 return true; 1683 } 1684 1685 public boolean isEmpty() { 1686 return super.isEmpty() && (type == null || type.isEmpty()) && (value == null || value.isEmpty()) 1687 ; 1688 } 1689 1690 public String fhirType() { 1691 return "Protocol.step.precondition.condition"; 1692 1693 } 1694 1695 } 1696 1697 @Block() 1698 public static class ProtocolStepActivityComponent extends BackboneElement implements IBaseBackboneElement { 1699 /** 1700 * What can be done instead? 1701 */ 1702 @Child(name = "alternative", type = {UriType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true) 1703 @Description(shortDefinition="What can be done instead?", formalDefinition="What can be done instead?" ) 1704 protected List<UriType> alternative; 1705 1706 /** 1707 * Activities that are part of this activity. 1708 */ 1709 @Child(name = "component", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1710 @Description(shortDefinition="Activities that are part of this activity", formalDefinition="Activities that are part of this activity." ) 1711 protected List<ProtocolStepActivityComponentComponent> component; 1712 1713 /** 1714 * What happens next. 1715 */ 1716 @Child(name = "following", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true) 1717 @Description(shortDefinition="What happens next", formalDefinition="What happens next." ) 1718 protected List<UriType> following; 1719 1720 /** 1721 * Indicates the length of time to wait between the conditions being satisfied for the activity to start and the actual start of the activity. 1722 */ 1723 @Child(name = "wait", type = {Duration.class}, order=4, min=0, max=1, modifier=true, summary=true) 1724 @Description(shortDefinition="Pause before start", formalDefinition="Indicates the length of time to wait between the conditions being satisfied for the activity to start and the actual start of the activity." ) 1725 protected Duration wait; 1726 1727 /** 1728 * Information about the nature of the activity, including type, timing and other qualifiers. 1729 */ 1730 @Child(name = "detail", type = {}, order=5, min=1, max=1, modifier=true, summary=true) 1731 @Description(shortDefinition="Details of activity", formalDefinition="Information about the nature of the activity, including type, timing and other qualifiers." ) 1732 protected ProtocolStepActivityDetailComponent detail; 1733 1734 private static final long serialVersionUID = 1430131373L; 1735 1736 /** 1737 * Constructor 1738 */ 1739 public ProtocolStepActivityComponent() { 1740 super(); 1741 } 1742 1743 /** 1744 * Constructor 1745 */ 1746 public ProtocolStepActivityComponent(ProtocolStepActivityDetailComponent detail) { 1747 super(); 1748 this.detail = detail; 1749 } 1750 1751 /** 1752 * @return {@link #alternative} (What can be done instead?) 1753 */ 1754 public List<UriType> getAlternative() { 1755 if (this.alternative == null) 1756 this.alternative = new ArrayList<UriType>(); 1757 return this.alternative; 1758 } 1759 1760 public boolean hasAlternative() { 1761 if (this.alternative == null) 1762 return false; 1763 for (UriType item : this.alternative) 1764 if (!item.isEmpty()) 1765 return true; 1766 return false; 1767 } 1768 1769 /** 1770 * @return {@link #alternative} (What can be done instead?) 1771 */ 1772 // syntactic sugar 1773 public UriType addAlternativeElement() {//2 1774 UriType t = new UriType(); 1775 if (this.alternative == null) 1776 this.alternative = new ArrayList<UriType>(); 1777 this.alternative.add(t); 1778 return t; 1779 } 1780 1781 /** 1782 * @param value {@link #alternative} (What can be done instead?) 1783 */ 1784 public ProtocolStepActivityComponent addAlternative(String value) { //1 1785 UriType t = new UriType(); 1786 t.setValue(value); 1787 if (this.alternative == null) 1788 this.alternative = new ArrayList<UriType>(); 1789 this.alternative.add(t); 1790 return this; 1791 } 1792 1793 /** 1794 * @param value {@link #alternative} (What can be done instead?) 1795 */ 1796 public boolean hasAlternative(String value) { 1797 if (this.alternative == null) 1798 return false; 1799 for (UriType v : this.alternative) 1800 if (v.equals(value)) // uri 1801 return true; 1802 return false; 1803 } 1804 1805 /** 1806 * @return {@link #component} (Activities that are part of this activity.) 1807 */ 1808 public List<ProtocolStepActivityComponentComponent> getComponent() { 1809 if (this.component == null) 1810 this.component = new ArrayList<ProtocolStepActivityComponentComponent>(); 1811 return this.component; 1812 } 1813 1814 public boolean hasComponent() { 1815 if (this.component == null) 1816 return false; 1817 for (ProtocolStepActivityComponentComponent item : this.component) 1818 if (!item.isEmpty()) 1819 return true; 1820 return false; 1821 } 1822 1823 /** 1824 * @return {@link #component} (Activities that are part of this activity.) 1825 */ 1826 // syntactic sugar 1827 public ProtocolStepActivityComponentComponent addComponent() { //3 1828 ProtocolStepActivityComponentComponent t = new ProtocolStepActivityComponentComponent(); 1829 if (this.component == null) 1830 this.component = new ArrayList<ProtocolStepActivityComponentComponent>(); 1831 this.component.add(t); 1832 return t; 1833 } 1834 1835 // syntactic sugar 1836 public ProtocolStepActivityComponent addComponent(ProtocolStepActivityComponentComponent t) { //3 1837 if (t == null) 1838 return this; 1839 if (this.component == null) 1840 this.component = new ArrayList<ProtocolStepActivityComponentComponent>(); 1841 this.component.add(t); 1842 return this; 1843 } 1844 1845 /** 1846 * @return {@link #following} (What happens next.) 1847 */ 1848 public List<UriType> getFollowing() { 1849 if (this.following == null) 1850 this.following = new ArrayList<UriType>(); 1851 return this.following; 1852 } 1853 1854 public boolean hasFollowing() { 1855 if (this.following == null) 1856 return false; 1857 for (UriType item : this.following) 1858 if (!item.isEmpty()) 1859 return true; 1860 return false; 1861 } 1862 1863 /** 1864 * @return {@link #following} (What happens next.) 1865 */ 1866 // syntactic sugar 1867 public UriType addFollowingElement() {//2 1868 UriType t = new UriType(); 1869 if (this.following == null) 1870 this.following = new ArrayList<UriType>(); 1871 this.following.add(t); 1872 return t; 1873 } 1874 1875 /** 1876 * @param value {@link #following} (What happens next.) 1877 */ 1878 public ProtocolStepActivityComponent addFollowing(String value) { //1 1879 UriType t = new UriType(); 1880 t.setValue(value); 1881 if (this.following == null) 1882 this.following = new ArrayList<UriType>(); 1883 this.following.add(t); 1884 return this; 1885 } 1886 1887 /** 1888 * @param value {@link #following} (What happens next.) 1889 */ 1890 public boolean hasFollowing(String value) { 1891 if (this.following == null) 1892 return false; 1893 for (UriType v : this.following) 1894 if (v.equals(value)) // uri 1895 return true; 1896 return false; 1897 } 1898 1899 /** 1900 * @return {@link #wait} (Indicates the length of time to wait between the conditions being satisfied for the activity to start and the actual start of the activity.) 1901 */ 1902 public Duration getWait() { 1903 if (this.wait == null) 1904 if (Configuration.errorOnAutoCreate()) 1905 throw new Error("Attempt to auto-create ProtocolStepActivityComponent.wait"); 1906 else if (Configuration.doAutoCreate()) 1907 this.wait = new Duration(); // cc 1908 return this.wait; 1909 } 1910 1911 public boolean hasWait() { 1912 return this.wait != null && !this.wait.isEmpty(); 1913 } 1914 1915 /** 1916 * @param value {@link #wait} (Indicates the length of time to wait between the conditions being satisfied for the activity to start and the actual start of the activity.) 1917 */ 1918 public ProtocolStepActivityComponent setWait(Duration value) { 1919 this.wait = value; 1920 return this; 1921 } 1922 1923 /** 1924 * @return {@link #detail} (Information about the nature of the activity, including type, timing and other qualifiers.) 1925 */ 1926 public ProtocolStepActivityDetailComponent getDetail() { 1927 if (this.detail == null) 1928 if (Configuration.errorOnAutoCreate()) 1929 throw new Error("Attempt to auto-create ProtocolStepActivityComponent.detail"); 1930 else if (Configuration.doAutoCreate()) 1931 this.detail = new ProtocolStepActivityDetailComponent(); // cc 1932 return this.detail; 1933 } 1934 1935 public boolean hasDetail() { 1936 return this.detail != null && !this.detail.isEmpty(); 1937 } 1938 1939 /** 1940 * @param value {@link #detail} (Information about the nature of the activity, including type, timing and other qualifiers.) 1941 */ 1942 public ProtocolStepActivityComponent setDetail(ProtocolStepActivityDetailComponent value) { 1943 this.detail = value; 1944 return this; 1945 } 1946 1947 protected void listChildren(List<Property> childrenList) { 1948 super.listChildren(childrenList); 1949 childrenList.add(new Property("alternative", "uri", "What can be done instead?", 0, java.lang.Integer.MAX_VALUE, alternative)); 1950 childrenList.add(new Property("component", "", "Activities that are part of this activity.", 0, java.lang.Integer.MAX_VALUE, component)); 1951 childrenList.add(new Property("following", "uri", "What happens next.", 0, java.lang.Integer.MAX_VALUE, following)); 1952 childrenList.add(new Property("wait", "Duration", "Indicates the length of time to wait between the conditions being satisfied for the activity to start and the actual start of the activity.", 0, java.lang.Integer.MAX_VALUE, wait)); 1953 childrenList.add(new Property("detail", "", "Information about the nature of the activity, including type, timing and other qualifiers.", 0, java.lang.Integer.MAX_VALUE, detail)); 1954 } 1955 1956 @Override 1957 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1958 switch (hash) { 1959 case -196794451: /*alternative*/ return this.alternative == null ? new Base[0] : this.alternative.toArray(new Base[this.alternative.size()]); // UriType 1960 case -1399907075: /*component*/ return this.component == null ? new Base[0] : this.component.toArray(new Base[this.component.size()]); // ProtocolStepActivityComponentComponent 1961 case 765915793: /*following*/ return this.following == null ? new Base[0] : this.following.toArray(new Base[this.following.size()]); // UriType 1962 case 3641717: /*wait*/ return this.wait == null ? new Base[0] : new Base[] {this.wait}; // Duration 1963 case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // ProtocolStepActivityDetailComponent 1964 default: return super.getProperty(hash, name, checkValid); 1965 } 1966 1967 } 1968 1969 @Override 1970 public void setProperty(int hash, String name, Base value) throws FHIRException { 1971 switch (hash) { 1972 case -196794451: // alternative 1973 this.getAlternative().add(castToUri(value)); // UriType 1974 break; 1975 case -1399907075: // component 1976 this.getComponent().add((ProtocolStepActivityComponentComponent) value); // ProtocolStepActivityComponentComponent 1977 break; 1978 case 765915793: // following 1979 this.getFollowing().add(castToUri(value)); // UriType 1980 break; 1981 case 3641717: // wait 1982 this.wait = castToDuration(value); // Duration 1983 break; 1984 case -1335224239: // detail 1985 this.detail = (ProtocolStepActivityDetailComponent) value; // ProtocolStepActivityDetailComponent 1986 break; 1987 default: super.setProperty(hash, name, value); 1988 } 1989 1990 } 1991 1992 @Override 1993 public void setProperty(String name, Base value) throws FHIRException { 1994 if (name.equals("alternative")) 1995 this.getAlternative().add(castToUri(value)); 1996 else if (name.equals("component")) 1997 this.getComponent().add((ProtocolStepActivityComponentComponent) value); 1998 else if (name.equals("following")) 1999 this.getFollowing().add(castToUri(value)); 2000 else if (name.equals("wait")) 2001 this.wait = castToDuration(value); // Duration 2002 else if (name.equals("detail")) 2003 this.detail = (ProtocolStepActivityDetailComponent) value; // ProtocolStepActivityDetailComponent 2004 else 2005 super.setProperty(name, value); 2006 } 2007 2008 @Override 2009 public Base makeProperty(int hash, String name) throws FHIRException { 2010 switch (hash) { 2011 case -196794451: throw new FHIRException("Cannot make property alternative as it is not a complex type"); // UriType 2012 case -1399907075: return addComponent(); // ProtocolStepActivityComponentComponent 2013 case 765915793: throw new FHIRException("Cannot make property following as it is not a complex type"); // UriType 2014 case 3641717: return getWait(); // Duration 2015 case -1335224239: return getDetail(); // ProtocolStepActivityDetailComponent 2016 default: return super.makeProperty(hash, name); 2017 } 2018 2019 } 2020 2021 @Override 2022 public Base addChild(String name) throws FHIRException { 2023 if (name.equals("alternative")) { 2024 throw new FHIRException("Cannot call addChild on a primitive type Protocol.alternative"); 2025 } 2026 else if (name.equals("component")) { 2027 return addComponent(); 2028 } 2029 else if (name.equals("following")) { 2030 throw new FHIRException("Cannot call addChild on a primitive type Protocol.following"); 2031 } 2032 else if (name.equals("wait")) { 2033 this.wait = new Duration(); 2034 return this.wait; 2035 } 2036 else if (name.equals("detail")) { 2037 this.detail = new ProtocolStepActivityDetailComponent(); 2038 return this.detail; 2039 } 2040 else 2041 return super.addChild(name); 2042 } 2043 2044 public ProtocolStepActivityComponent copy() { 2045 ProtocolStepActivityComponent dst = new ProtocolStepActivityComponent(); 2046 copyValues(dst); 2047 if (alternative != null) { 2048 dst.alternative = new ArrayList<UriType>(); 2049 for (UriType i : alternative) 2050 dst.alternative.add(i.copy()); 2051 }; 2052 if (component != null) { 2053 dst.component = new ArrayList<ProtocolStepActivityComponentComponent>(); 2054 for (ProtocolStepActivityComponentComponent i : component) 2055 dst.component.add(i.copy()); 2056 }; 2057 if (following != null) { 2058 dst.following = new ArrayList<UriType>(); 2059 for (UriType i : following) 2060 dst.following.add(i.copy()); 2061 }; 2062 dst.wait = wait == null ? null : wait.copy(); 2063 dst.detail = detail == null ? null : detail.copy(); 2064 return dst; 2065 } 2066 2067 @Override 2068 public boolean equalsDeep(Base other) { 2069 if (!super.equalsDeep(other)) 2070 return false; 2071 if (!(other instanceof ProtocolStepActivityComponent)) 2072 return false; 2073 ProtocolStepActivityComponent o = (ProtocolStepActivityComponent) other; 2074 return compareDeep(alternative, o.alternative, true) && compareDeep(component, o.component, true) 2075 && compareDeep(following, o.following, true) && compareDeep(wait, o.wait, true) && compareDeep(detail, o.detail, true) 2076 ; 2077 } 2078 2079 @Override 2080 public boolean equalsShallow(Base other) { 2081 if (!super.equalsShallow(other)) 2082 return false; 2083 if (!(other instanceof ProtocolStepActivityComponent)) 2084 return false; 2085 ProtocolStepActivityComponent o = (ProtocolStepActivityComponent) other; 2086 return compareValues(alternative, o.alternative, true) && compareValues(following, o.following, true) 2087 ; 2088 } 2089 2090 public boolean isEmpty() { 2091 return super.isEmpty() && (alternative == null || alternative.isEmpty()) && (component == null || component.isEmpty()) 2092 && (following == null || following.isEmpty()) && (wait == null || wait.isEmpty()) && (detail == null || detail.isEmpty()) 2093 ; 2094 } 2095 2096 public String fhirType() { 2097 return "Protocol.step.activity"; 2098 2099 } 2100 2101 } 2102 2103 @Block() 2104 public static class ProtocolStepActivityComponentComponent extends BackboneElement implements IBaseBackboneElement { 2105 /** 2106 * Order of occurrence. 2107 */ 2108 @Child(name = "sequence", type = {IntegerType.class}, order=1, min=0, max=1, modifier=true, summary=true) 2109 @Description(shortDefinition="Order of occurrence", formalDefinition="Order of occurrence." ) 2110 protected IntegerType sequence; 2111 2112 /** 2113 * Component activity. 2114 */ 2115 @Child(name = "activity", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=true) 2116 @Description(shortDefinition="Component activity", formalDefinition="Component activity." ) 2117 protected UriType activity; 2118 2119 private static final long serialVersionUID = -856295616L; 2120 2121 /** 2122 * Constructor 2123 */ 2124 public ProtocolStepActivityComponentComponent() { 2125 super(); 2126 } 2127 2128 /** 2129 * Constructor 2130 */ 2131 public ProtocolStepActivityComponentComponent(UriType activity) { 2132 super(); 2133 this.activity = activity; 2134 } 2135 2136 /** 2137 * @return {@link #sequence} (Order of occurrence.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 2138 */ 2139 public IntegerType getSequenceElement() { 2140 if (this.sequence == null) 2141 if (Configuration.errorOnAutoCreate()) 2142 throw new Error("Attempt to auto-create ProtocolStepActivityComponentComponent.sequence"); 2143 else if (Configuration.doAutoCreate()) 2144 this.sequence = new IntegerType(); // bb 2145 return this.sequence; 2146 } 2147 2148 public boolean hasSequenceElement() { 2149 return this.sequence != null && !this.sequence.isEmpty(); 2150 } 2151 2152 public boolean hasSequence() { 2153 return this.sequence != null && !this.sequence.isEmpty(); 2154 } 2155 2156 /** 2157 * @param value {@link #sequence} (Order of occurrence.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value 2158 */ 2159 public ProtocolStepActivityComponentComponent setSequenceElement(IntegerType value) { 2160 this.sequence = value; 2161 return this; 2162 } 2163 2164 /** 2165 * @return Order of occurrence. 2166 */ 2167 public int getSequence() { 2168 return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue(); 2169 } 2170 2171 /** 2172 * @param value Order of occurrence. 2173 */ 2174 public ProtocolStepActivityComponentComponent setSequence(int value) { 2175 if (this.sequence == null) 2176 this.sequence = new IntegerType(); 2177 this.sequence.setValue(value); 2178 return this; 2179 } 2180 2181 /** 2182 * @return {@link #activity} (Component activity.). This is the underlying object with id, value and extensions. The accessor "getActivity" gives direct access to the value 2183 */ 2184 public UriType getActivityElement() { 2185 if (this.activity == null) 2186 if (Configuration.errorOnAutoCreate()) 2187 throw new Error("Attempt to auto-create ProtocolStepActivityComponentComponent.activity"); 2188 else if (Configuration.doAutoCreate()) 2189 this.activity = new UriType(); // bb 2190 return this.activity; 2191 } 2192 2193 public boolean hasActivityElement() { 2194 return this.activity != null && !this.activity.isEmpty(); 2195 } 2196 2197 public boolean hasActivity() { 2198 return this.activity != null && !this.activity.isEmpty(); 2199 } 2200 2201 /** 2202 * @param value {@link #activity} (Component activity.). This is the underlying object with id, value and extensions. The accessor "getActivity" gives direct access to the value 2203 */ 2204 public ProtocolStepActivityComponentComponent setActivityElement(UriType value) { 2205 this.activity = value; 2206 return this; 2207 } 2208 2209 /** 2210 * @return Component activity. 2211 */ 2212 public String getActivity() { 2213 return this.activity == null ? null : this.activity.getValue(); 2214 } 2215 2216 /** 2217 * @param value Component activity. 2218 */ 2219 public ProtocolStepActivityComponentComponent setActivity(String value) { 2220 if (this.activity == null) 2221 this.activity = new UriType(); 2222 this.activity.setValue(value); 2223 return this; 2224 } 2225 2226 protected void listChildren(List<Property> childrenList) { 2227 super.listChildren(childrenList); 2228 childrenList.add(new Property("sequence", "integer", "Order of occurrence.", 0, java.lang.Integer.MAX_VALUE, sequence)); 2229 childrenList.add(new Property("activity", "uri", "Component activity.", 0, java.lang.Integer.MAX_VALUE, activity)); 2230 } 2231 2232 @Override 2233 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2234 switch (hash) { 2235 case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // IntegerType 2236 case -1655966961: /*activity*/ return this.activity == null ? new Base[0] : new Base[] {this.activity}; // UriType 2237 default: return super.getProperty(hash, name, checkValid); 2238 } 2239 2240 } 2241 2242 @Override 2243 public void setProperty(int hash, String name, Base value) throws FHIRException { 2244 switch (hash) { 2245 case 1349547969: // sequence 2246 this.sequence = castToInteger(value); // IntegerType 2247 break; 2248 case -1655966961: // activity 2249 this.activity = castToUri(value); // UriType 2250 break; 2251 default: super.setProperty(hash, name, value); 2252 } 2253 2254 } 2255 2256 @Override 2257 public void setProperty(String name, Base value) throws FHIRException { 2258 if (name.equals("sequence")) 2259 this.sequence = castToInteger(value); // IntegerType 2260 else if (name.equals("activity")) 2261 this.activity = castToUri(value); // UriType 2262 else 2263 super.setProperty(name, value); 2264 } 2265 2266 @Override 2267 public Base makeProperty(int hash, String name) throws FHIRException { 2268 switch (hash) { 2269 case 1349547969: throw new FHIRException("Cannot make property sequence as it is not a complex type"); // IntegerType 2270 case -1655966961: throw new FHIRException("Cannot make property activity as it is not a complex type"); // UriType 2271 default: return super.makeProperty(hash, name); 2272 } 2273 2274 } 2275 2276 @Override 2277 public Base addChild(String name) throws FHIRException { 2278 if (name.equals("sequence")) { 2279 throw new FHIRException("Cannot call addChild on a primitive type Protocol.sequence"); 2280 } 2281 else if (name.equals("activity")) { 2282 throw new FHIRException("Cannot call addChild on a primitive type Protocol.activity"); 2283 } 2284 else 2285 return super.addChild(name); 2286 } 2287 2288 public ProtocolStepActivityComponentComponent copy() { 2289 ProtocolStepActivityComponentComponent dst = new ProtocolStepActivityComponentComponent(); 2290 copyValues(dst); 2291 dst.sequence = sequence == null ? null : sequence.copy(); 2292 dst.activity = activity == null ? null : activity.copy(); 2293 return dst; 2294 } 2295 2296 @Override 2297 public boolean equalsDeep(Base other) { 2298 if (!super.equalsDeep(other)) 2299 return false; 2300 if (!(other instanceof ProtocolStepActivityComponentComponent)) 2301 return false; 2302 ProtocolStepActivityComponentComponent o = (ProtocolStepActivityComponentComponent) other; 2303 return compareDeep(sequence, o.sequence, true) && compareDeep(activity, o.activity, true); 2304 } 2305 2306 @Override 2307 public boolean equalsShallow(Base other) { 2308 if (!super.equalsShallow(other)) 2309 return false; 2310 if (!(other instanceof ProtocolStepActivityComponentComponent)) 2311 return false; 2312 ProtocolStepActivityComponentComponent o = (ProtocolStepActivityComponentComponent) other; 2313 return compareValues(sequence, o.sequence, true) && compareValues(activity, o.activity, true); 2314 } 2315 2316 public boolean isEmpty() { 2317 return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (activity == null || activity.isEmpty()) 2318 ; 2319 } 2320 2321 public String fhirType() { 2322 return "Protocol.step.activity.component"; 2323 2324 } 2325 2326 } 2327 2328 @Block() 2329 public static class ProtocolStepActivityDetailComponent extends BackboneElement implements IBaseBackboneElement { 2330 /** 2331 * High-level categorization of the type of activity. 2332 */ 2333 @Child(name = "category", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 2334 @Description(shortDefinition="diet | drug | encounter | observation +", formalDefinition="High-level categorization of the type of activity." ) 2335 protected Enumeration<ActivityDefinitionCategory> category; 2336 2337 /** 2338 * Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter. 2339 */ 2340 @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 2341 @Description(shortDefinition="Detail type of activity", formalDefinition="Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter." ) 2342 protected CodeableConcept code; 2343 2344 /** 2345 * The period, timing or frequency upon which the described activity is to occur. 2346 */ 2347 @Child(name = "timing", type = {CodeableConcept.class, Timing.class}, order=3, min=0, max=1, modifier=false, summary=true) 2348 @Description(shortDefinition="When activity is to occur", formalDefinition="The period, timing or frequency upon which the described activity is to occur." ) 2349 protected Type timing; 2350 2351 /** 2352 * Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc. 2353 */ 2354 @Child(name = "location", type = {Location.class}, order=4, min=0, max=1, modifier=false, summary=true) 2355 @Description(shortDefinition="Where it should happen", formalDefinition="Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc." ) 2356 protected Reference location; 2357 2358 /** 2359 * The actual object that is the target of the reference (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.) 2360 */ 2361 protected Location locationTarget; 2362 2363 /** 2364 * Identifies who's expected to be involved in the activity. 2365 */ 2366 @Child(name = "performer", type = {Practitioner.class, Organization.class, RelatedPerson.class, Patient.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2367 @Description(shortDefinition="Who's responsible?", formalDefinition="Identifies who's expected to be involved in the activity." ) 2368 protected List<Reference> performer; 2369 /** 2370 * The actual objects that are the target of the reference (Identifies who's expected to be involved in the activity.) 2371 */ 2372 protected List<Resource> performerTarget; 2373 2374 2375 /** 2376 * Identifies the food, drug or other product being consumed or supplied in the activity. 2377 */ 2378 @Child(name = "product", type = {Medication.class, Substance.class}, order=6, min=0, max=1, modifier=false, summary=true) 2379 @Description(shortDefinition="What's administered/supplied", formalDefinition="Identifies the food, drug or other product being consumed or supplied in the activity." ) 2380 protected Reference product; 2381 2382 /** 2383 * The actual object that is the target of the reference (Identifies the food, drug or other product being consumed or supplied in the activity.) 2384 */ 2385 protected Resource productTarget; 2386 2387 /** 2388 * Identifies the quantity expected to be consumed at once (per dose, per meal, etc.). 2389 */ 2390 @Child(name = "quantity", type = {SimpleQuantity.class}, order=7, min=0, max=1, modifier=false, summary=true) 2391 @Description(shortDefinition="How much is administered/consumed/supplied", formalDefinition="Identifies the quantity expected to be consumed at once (per dose, per meal, etc.)." ) 2392 protected SimpleQuantity quantity; 2393 2394 /** 2395 * This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc. 2396 */ 2397 @Child(name = "description", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true) 2398 @Description(shortDefinition="Extra info on activity occurrence", formalDefinition="This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc." ) 2399 protected StringType description; 2400 2401 private static final long serialVersionUID = 8207475L; 2402 2403 /** 2404 * Constructor 2405 */ 2406 public ProtocolStepActivityDetailComponent() { 2407 super(); 2408 } 2409 2410 /** 2411 * @return {@link #category} (High-level categorization of the type of activity.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value 2412 */ 2413 public Enumeration<ActivityDefinitionCategory> getCategoryElement() { 2414 if (this.category == null) 2415 if (Configuration.errorOnAutoCreate()) 2416 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.category"); 2417 else if (Configuration.doAutoCreate()) 2418 this.category = new Enumeration<ActivityDefinitionCategory>(new ActivityDefinitionCategoryEnumFactory()); // bb 2419 return this.category; 2420 } 2421 2422 public boolean hasCategoryElement() { 2423 return this.category != null && !this.category.isEmpty(); 2424 } 2425 2426 public boolean hasCategory() { 2427 return this.category != null && !this.category.isEmpty(); 2428 } 2429 2430 /** 2431 * @param value {@link #category} (High-level categorization of the type of activity.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value 2432 */ 2433 public ProtocolStepActivityDetailComponent setCategoryElement(Enumeration<ActivityDefinitionCategory> value) { 2434 this.category = value; 2435 return this; 2436 } 2437 2438 /** 2439 * @return High-level categorization of the type of activity. 2440 */ 2441 public ActivityDefinitionCategory getCategory() { 2442 return this.category == null ? null : this.category.getValue(); 2443 } 2444 2445 /** 2446 * @param value High-level categorization of the type of activity. 2447 */ 2448 public ProtocolStepActivityDetailComponent setCategory(ActivityDefinitionCategory value) { 2449 if (value == null) 2450 this.category = null; 2451 else { 2452 if (this.category == null) 2453 this.category = new Enumeration<ActivityDefinitionCategory>(new ActivityDefinitionCategoryEnumFactory()); 2454 this.category.setValue(value); 2455 } 2456 return this; 2457 } 2458 2459 /** 2460 * @return {@link #code} (Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter.) 2461 */ 2462 public CodeableConcept getCode() { 2463 if (this.code == null) 2464 if (Configuration.errorOnAutoCreate()) 2465 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.code"); 2466 else if (Configuration.doAutoCreate()) 2467 this.code = new CodeableConcept(); // cc 2468 return this.code; 2469 } 2470 2471 public boolean hasCode() { 2472 return this.code != null && !this.code.isEmpty(); 2473 } 2474 2475 /** 2476 * @param value {@link #code} (Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter.) 2477 */ 2478 public ProtocolStepActivityDetailComponent setCode(CodeableConcept value) { 2479 this.code = value; 2480 return this; 2481 } 2482 2483 /** 2484 * @return {@link #timing} (The period, timing or frequency upon which the described activity is to occur.) 2485 */ 2486 public Type getTiming() { 2487 return this.timing; 2488 } 2489 2490 /** 2491 * @return {@link #timing} (The period, timing or frequency upon which the described activity is to occur.) 2492 */ 2493 public CodeableConcept getTimingCodeableConcept() throws FHIRException { 2494 if (!(this.timing instanceof CodeableConcept)) 2495 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.timing.getClass().getName()+" was encountered"); 2496 return (CodeableConcept) this.timing; 2497 } 2498 2499 public boolean hasTimingCodeableConcept() { 2500 return this.timing instanceof CodeableConcept; 2501 } 2502 2503 /** 2504 * @return {@link #timing} (The period, timing or frequency upon which the described activity is to occur.) 2505 */ 2506 public Timing getTimingTiming() throws FHIRException { 2507 if (!(this.timing instanceof Timing)) 2508 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered"); 2509 return (Timing) this.timing; 2510 } 2511 2512 public boolean hasTimingTiming() { 2513 return this.timing instanceof Timing; 2514 } 2515 2516 public boolean hasTiming() { 2517 return this.timing != null && !this.timing.isEmpty(); 2518 } 2519 2520 /** 2521 * @param value {@link #timing} (The period, timing or frequency upon which the described activity is to occur.) 2522 */ 2523 public ProtocolStepActivityDetailComponent setTiming(Type value) { 2524 this.timing = value; 2525 return this; 2526 } 2527 2528 /** 2529 * @return {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.) 2530 */ 2531 public Reference getLocation() { 2532 if (this.location == null) 2533 if (Configuration.errorOnAutoCreate()) 2534 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.location"); 2535 else if (Configuration.doAutoCreate()) 2536 this.location = new Reference(); // cc 2537 return this.location; 2538 } 2539 2540 public boolean hasLocation() { 2541 return this.location != null && !this.location.isEmpty(); 2542 } 2543 2544 /** 2545 * @param value {@link #location} (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.) 2546 */ 2547 public ProtocolStepActivityDetailComponent setLocation(Reference value) { 2548 this.location = value; 2549 return this; 2550 } 2551 2552 /** 2553 * @return {@link #location} 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. (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.) 2554 */ 2555 public Location getLocationTarget() { 2556 if (this.locationTarget == null) 2557 if (Configuration.errorOnAutoCreate()) 2558 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.location"); 2559 else if (Configuration.doAutoCreate()) 2560 this.locationTarget = new Location(); // aa 2561 return this.locationTarget; 2562 } 2563 2564 /** 2565 * @param value {@link #location} 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. (Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.) 2566 */ 2567 public ProtocolStepActivityDetailComponent setLocationTarget(Location value) { 2568 this.locationTarget = value; 2569 return this; 2570 } 2571 2572 /** 2573 * @return {@link #performer} (Identifies who's expected to be involved in the activity.) 2574 */ 2575 public List<Reference> getPerformer() { 2576 if (this.performer == null) 2577 this.performer = new ArrayList<Reference>(); 2578 return this.performer; 2579 } 2580 2581 public boolean hasPerformer() { 2582 if (this.performer == null) 2583 return false; 2584 for (Reference item : this.performer) 2585 if (!item.isEmpty()) 2586 return true; 2587 return false; 2588 } 2589 2590 /** 2591 * @return {@link #performer} (Identifies who's expected to be involved in the activity.) 2592 */ 2593 // syntactic sugar 2594 public Reference addPerformer() { //3 2595 Reference t = new Reference(); 2596 if (this.performer == null) 2597 this.performer = new ArrayList<Reference>(); 2598 this.performer.add(t); 2599 return t; 2600 } 2601 2602 // syntactic sugar 2603 public ProtocolStepActivityDetailComponent addPerformer(Reference t) { //3 2604 if (t == null) 2605 return this; 2606 if (this.performer == null) 2607 this.performer = new ArrayList<Reference>(); 2608 this.performer.add(t); 2609 return this; 2610 } 2611 2612 /** 2613 * @return {@link #performer} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Identifies who's expected to be involved in the activity.) 2614 */ 2615 public List<Resource> getPerformerTarget() { 2616 if (this.performerTarget == null) 2617 this.performerTarget = new ArrayList<Resource>(); 2618 return this.performerTarget; 2619 } 2620 2621 /** 2622 * @return {@link #product} (Identifies the food, drug or other product being consumed or supplied in the activity.) 2623 */ 2624 public Reference getProduct() { 2625 if (this.product == null) 2626 if (Configuration.errorOnAutoCreate()) 2627 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.product"); 2628 else if (Configuration.doAutoCreate()) 2629 this.product = new Reference(); // cc 2630 return this.product; 2631 } 2632 2633 public boolean hasProduct() { 2634 return this.product != null && !this.product.isEmpty(); 2635 } 2636 2637 /** 2638 * @param value {@link #product} (Identifies the food, drug or other product being consumed or supplied in the activity.) 2639 */ 2640 public ProtocolStepActivityDetailComponent setProduct(Reference value) { 2641 this.product = value; 2642 return this; 2643 } 2644 2645 /** 2646 * @return {@link #product} 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. (Identifies the food, drug or other product being consumed or supplied in the activity.) 2647 */ 2648 public Resource getProductTarget() { 2649 return this.productTarget; 2650 } 2651 2652 /** 2653 * @param value {@link #product} 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. (Identifies the food, drug or other product being consumed or supplied in the activity.) 2654 */ 2655 public ProtocolStepActivityDetailComponent setProductTarget(Resource value) { 2656 this.productTarget = value; 2657 return this; 2658 } 2659 2660 /** 2661 * @return {@link #quantity} (Identifies the quantity expected to be consumed at once (per dose, per meal, etc.).) 2662 */ 2663 public SimpleQuantity getQuantity() { 2664 if (this.quantity == null) 2665 if (Configuration.errorOnAutoCreate()) 2666 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.quantity"); 2667 else if (Configuration.doAutoCreate()) 2668 this.quantity = new SimpleQuantity(); // cc 2669 return this.quantity; 2670 } 2671 2672 public boolean hasQuantity() { 2673 return this.quantity != null && !this.quantity.isEmpty(); 2674 } 2675 2676 /** 2677 * @param value {@link #quantity} (Identifies the quantity expected to be consumed at once (per dose, per meal, etc.).) 2678 */ 2679 public ProtocolStepActivityDetailComponent setQuantity(SimpleQuantity value) { 2680 this.quantity = value; 2681 return this; 2682 } 2683 2684 /** 2685 * @return {@link #description} (This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 2686 */ 2687 public StringType getDescriptionElement() { 2688 if (this.description == null) 2689 if (Configuration.errorOnAutoCreate()) 2690 throw new Error("Attempt to auto-create ProtocolStepActivityDetailComponent.description"); 2691 else if (Configuration.doAutoCreate()) 2692 this.description = new StringType(); // bb 2693 return this.description; 2694 } 2695 2696 public boolean hasDescriptionElement() { 2697 return this.description != null && !this.description.isEmpty(); 2698 } 2699 2700 public boolean hasDescription() { 2701 return this.description != null && !this.description.isEmpty(); 2702 } 2703 2704 /** 2705 * @param value {@link #description} (This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 2706 */ 2707 public ProtocolStepActivityDetailComponent setDescriptionElement(StringType value) { 2708 this.description = value; 2709 return this; 2710 } 2711 2712 /** 2713 * @return This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc. 2714 */ 2715 public String getDescription() { 2716 return this.description == null ? null : this.description.getValue(); 2717 } 2718 2719 /** 2720 * @param value This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc. 2721 */ 2722 public ProtocolStepActivityDetailComponent setDescription(String value) { 2723 if (Utilities.noString(value)) 2724 this.description = null; 2725 else { 2726 if (this.description == null) 2727 this.description = new StringType(); 2728 this.description.setValue(value); 2729 } 2730 return this; 2731 } 2732 2733 protected void listChildren(List<Property> childrenList) { 2734 super.listChildren(childrenList); 2735 childrenList.add(new Property("category", "code", "High-level categorization of the type of activity.", 0, java.lang.Integer.MAX_VALUE, category)); 2736 childrenList.add(new Property("code", "CodeableConcept", "Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter.", 0, java.lang.Integer.MAX_VALUE, code)); 2737 childrenList.add(new Property("timing[x]", "CodeableConcept|Timing", "The period, timing or frequency upon which the described activity is to occur.", 0, java.lang.Integer.MAX_VALUE, timing)); 2738 childrenList.add(new Property("location", "Reference(Location)", "Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.", 0, java.lang.Integer.MAX_VALUE, location)); 2739 childrenList.add(new Property("performer", "Reference(Practitioner|Organization|RelatedPerson|Patient)", "Identifies who's expected to be involved in the activity.", 0, java.lang.Integer.MAX_VALUE, performer)); 2740 childrenList.add(new Property("product", "Reference(Medication|Substance)", "Identifies the food, drug or other product being consumed or supplied in the activity.", 0, java.lang.Integer.MAX_VALUE, product)); 2741 childrenList.add(new Property("quantity", "SimpleQuantity", "Identifies the quantity expected to be consumed at once (per dose, per meal, etc.).", 0, java.lang.Integer.MAX_VALUE, quantity)); 2742 childrenList.add(new Property("description", "string", "This provides a textual description of constraints on the activity occurrence, including relation to other activities. It may also include objectives, pre-conditions and end-conditions. Finally, it may convey specifics about the activity such as body site, method, route, etc.", 0, java.lang.Integer.MAX_VALUE, description)); 2743 } 2744 2745 @Override 2746 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2747 switch (hash) { 2748 case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<ActivityDefinitionCategory> 2749 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 2750 case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type 2751 case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference 2752 case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // Reference 2753 case -309474065: /*product*/ return this.product == null ? new Base[0] : new Base[] {this.product}; // Reference 2754 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity 2755 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 2756 default: return super.getProperty(hash, name, checkValid); 2757 } 2758 2759 } 2760 2761 @Override 2762 public void setProperty(int hash, String name, Base value) throws FHIRException { 2763 switch (hash) { 2764 case 50511102: // category 2765 this.category = new ActivityDefinitionCategoryEnumFactory().fromType(value); // Enumeration<ActivityDefinitionCategory> 2766 break; 2767 case 3059181: // code 2768 this.code = castToCodeableConcept(value); // CodeableConcept 2769 break; 2770 case -873664438: // timing 2771 this.timing = (Type) value; // Type 2772 break; 2773 case 1901043637: // location 2774 this.location = castToReference(value); // Reference 2775 break; 2776 case 481140686: // performer 2777 this.getPerformer().add(castToReference(value)); // Reference 2778 break; 2779 case -309474065: // product 2780 this.product = castToReference(value); // Reference 2781 break; 2782 case -1285004149: // quantity 2783 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2784 break; 2785 case -1724546052: // description 2786 this.description = castToString(value); // StringType 2787 break; 2788 default: super.setProperty(hash, name, value); 2789 } 2790 2791 } 2792 2793 @Override 2794 public void setProperty(String name, Base value) throws FHIRException { 2795 if (name.equals("category")) 2796 this.category = new ActivityDefinitionCategoryEnumFactory().fromType(value); // Enumeration<ActivityDefinitionCategory> 2797 else if (name.equals("code")) 2798 this.code = castToCodeableConcept(value); // CodeableConcept 2799 else if (name.equals("timing[x]")) 2800 this.timing = (Type) value; // Type 2801 else if (name.equals("location")) 2802 this.location = castToReference(value); // Reference 2803 else if (name.equals("performer")) 2804 this.getPerformer().add(castToReference(value)); 2805 else if (name.equals("product")) 2806 this.product = castToReference(value); // Reference 2807 else if (name.equals("quantity")) 2808 this.quantity = castToSimpleQuantity(value); // SimpleQuantity 2809 else if (name.equals("description")) 2810 this.description = castToString(value); // StringType 2811 else 2812 super.setProperty(name, value); 2813 } 2814 2815 @Override 2816 public Base makeProperty(int hash, String name) throws FHIRException { 2817 switch (hash) { 2818 case 50511102: throw new FHIRException("Cannot make property category as it is not a complex type"); // Enumeration<ActivityDefinitionCategory> 2819 case 3059181: return getCode(); // CodeableConcept 2820 case 164632566: return getTiming(); // Type 2821 case 1901043637: return getLocation(); // Reference 2822 case 481140686: return addPerformer(); // Reference 2823 case -309474065: return getProduct(); // Reference 2824 case -1285004149: return getQuantity(); // SimpleQuantity 2825 case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType 2826 default: return super.makeProperty(hash, name); 2827 } 2828 2829 } 2830 2831 @Override 2832 public Base addChild(String name) throws FHIRException { 2833 if (name.equals("category")) { 2834 throw new FHIRException("Cannot call addChild on a primitive type Protocol.category"); 2835 } 2836 else if (name.equals("code")) { 2837 this.code = new CodeableConcept(); 2838 return this.code; 2839 } 2840 else if (name.equals("timingCodeableConcept")) { 2841 this.timing = new CodeableConcept(); 2842 return this.timing; 2843 } 2844 else if (name.equals("timingTiming")) { 2845 this.timing = new Timing(); 2846 return this.timing; 2847 } 2848 else if (name.equals("location")) { 2849 this.location = new Reference(); 2850 return this.location; 2851 } 2852 else if (name.equals("performer")) { 2853 return addPerformer(); 2854 } 2855 else if (name.equals("product")) { 2856 this.product = new Reference(); 2857 return this.product; 2858 } 2859 else if (name.equals("quantity")) { 2860 this.quantity = new SimpleQuantity(); 2861 return this.quantity; 2862 } 2863 else if (name.equals("description")) { 2864 throw new FHIRException("Cannot call addChild on a primitive type Protocol.description"); 2865 } 2866 else 2867 return super.addChild(name); 2868 } 2869 2870 public ProtocolStepActivityDetailComponent copy() { 2871 ProtocolStepActivityDetailComponent dst = new ProtocolStepActivityDetailComponent(); 2872 copyValues(dst); 2873 dst.category = category == null ? null : category.copy(); 2874 dst.code = code == null ? null : code.copy(); 2875 dst.timing = timing == null ? null : timing.copy(); 2876 dst.location = location == null ? null : location.copy(); 2877 if (performer != null) { 2878 dst.performer = new ArrayList<Reference>(); 2879 for (Reference i : performer) 2880 dst.performer.add(i.copy()); 2881 }; 2882 dst.product = product == null ? null : product.copy(); 2883 dst.quantity = quantity == null ? null : quantity.copy(); 2884 dst.description = description == null ? null : description.copy(); 2885 return dst; 2886 } 2887 2888 @Override 2889 public boolean equalsDeep(Base other) { 2890 if (!super.equalsDeep(other)) 2891 return false; 2892 if (!(other instanceof ProtocolStepActivityDetailComponent)) 2893 return false; 2894 ProtocolStepActivityDetailComponent o = (ProtocolStepActivityDetailComponent) other; 2895 return compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(timing, o.timing, true) 2896 && compareDeep(location, o.location, true) && compareDeep(performer, o.performer, true) && compareDeep(product, o.product, true) 2897 && compareDeep(quantity, o.quantity, true) && compareDeep(description, o.description, true); 2898 } 2899 2900 @Override 2901 public boolean equalsShallow(Base other) { 2902 if (!super.equalsShallow(other)) 2903 return false; 2904 if (!(other instanceof ProtocolStepActivityDetailComponent)) 2905 return false; 2906 ProtocolStepActivityDetailComponent o = (ProtocolStepActivityDetailComponent) other; 2907 return compareValues(category, o.category, true) && compareValues(description, o.description, true) 2908 ; 2909 } 2910 2911 public boolean isEmpty() { 2912 return super.isEmpty() && (category == null || category.isEmpty()) && (code == null || code.isEmpty()) 2913 && (timing == null || timing.isEmpty()) && (location == null || location.isEmpty()) && (performer == null || performer.isEmpty()) 2914 && (product == null || product.isEmpty()) && (quantity == null || quantity.isEmpty()) && (description == null || description.isEmpty()) 2915 ; 2916 } 2917 2918 public String fhirType() { 2919 return "Protocol.step.activity.detail"; 2920 2921 } 2922 2923 } 2924 2925 @Block() 2926 public static class ProtocolStepNextComponent extends BackboneElement implements IBaseBackboneElement { 2927 /** 2928 * Description of what happens next. 2929 */ 2930 @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 2931 @Description(shortDefinition="Description of what happens next", formalDefinition="Description of what happens next." ) 2932 protected StringType description; 2933 2934 /** 2935 * Id of following step. 2936 */ 2937 @Child(name = "reference", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 2938 @Description(shortDefinition="Id of following step", formalDefinition="Id of following step." ) 2939 protected UriType reference; 2940 2941 /** 2942 * Condition in which next step is executed. 2943 */ 2944 @Child(name = "condition", type = {ProtocolStepPreconditionComponent.class}, order=3, min=0, max=1, modifier=false, summary=true) 2945 @Description(shortDefinition="Condition in which next step is executed", formalDefinition="Condition in which next step is executed." ) 2946 protected ProtocolStepPreconditionComponent condition; 2947 2948 private static final long serialVersionUID = -1343883194L; 2949 2950 /** 2951 * Constructor 2952 */ 2953 public ProtocolStepNextComponent() { 2954 super(); 2955 } 2956 2957 /** 2958 * @return {@link #description} (Description of what happens next.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 2959 */ 2960 public StringType getDescriptionElement() { 2961 if (this.description == null) 2962 if (Configuration.errorOnAutoCreate()) 2963 throw new Error("Attempt to auto-create ProtocolStepNextComponent.description"); 2964 else if (Configuration.doAutoCreate()) 2965 this.description = new StringType(); // bb 2966 return this.description; 2967 } 2968 2969 public boolean hasDescriptionElement() { 2970 return this.description != null && !this.description.isEmpty(); 2971 } 2972 2973 public boolean hasDescription() { 2974 return this.description != null && !this.description.isEmpty(); 2975 } 2976 2977 /** 2978 * @param value {@link #description} (Description of what happens next.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 2979 */ 2980 public ProtocolStepNextComponent setDescriptionElement(StringType value) { 2981 this.description = value; 2982 return this; 2983 } 2984 2985 /** 2986 * @return Description of what happens next. 2987 */ 2988 public String getDescription() { 2989 return this.description == null ? null : this.description.getValue(); 2990 } 2991 2992 /** 2993 * @param value Description of what happens next. 2994 */ 2995 public ProtocolStepNextComponent setDescription(String value) { 2996 if (Utilities.noString(value)) 2997 this.description = null; 2998 else { 2999 if (this.description == null) 3000 this.description = new StringType(); 3001 this.description.setValue(value); 3002 } 3003 return this; 3004 } 3005 3006 /** 3007 * @return {@link #reference} (Id of following step.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 3008 */ 3009 public UriType getReferenceElement() { 3010 if (this.reference == null) 3011 if (Configuration.errorOnAutoCreate()) 3012 throw new Error("Attempt to auto-create ProtocolStepNextComponent.reference"); 3013 else if (Configuration.doAutoCreate()) 3014 this.reference = new UriType(); // bb 3015 return this.reference; 3016 } 3017 3018 public boolean hasReferenceElement() { 3019 return this.reference != null && !this.reference.isEmpty(); 3020 } 3021 3022 public boolean hasReference() { 3023 return this.reference != null && !this.reference.isEmpty(); 3024 } 3025 3026 /** 3027 * @param value {@link #reference} (Id of following step.). This is the underlying object with id, value and extensions. The accessor "getReference" gives direct access to the value 3028 */ 3029 public ProtocolStepNextComponent setReferenceElement(UriType value) { 3030 this.reference = value; 3031 return this; 3032 } 3033 3034 /** 3035 * @return Id of following step. 3036 */ 3037 public String getReference() { 3038 return this.reference == null ? null : this.reference.getValue(); 3039 } 3040 3041 /** 3042 * @param value Id of following step. 3043 */ 3044 public ProtocolStepNextComponent setReference(String value) { 3045 if (Utilities.noString(value)) 3046 this.reference = null; 3047 else { 3048 if (this.reference == null) 3049 this.reference = new UriType(); 3050 this.reference.setValue(value); 3051 } 3052 return this; 3053 } 3054 3055 /** 3056 * @return {@link #condition} (Condition in which next step is executed.) 3057 */ 3058 public ProtocolStepPreconditionComponent getCondition() { 3059 if (this.condition == null) 3060 if (Configuration.errorOnAutoCreate()) 3061 throw new Error("Attempt to auto-create ProtocolStepNextComponent.condition"); 3062 else if (Configuration.doAutoCreate()) 3063 this.condition = new ProtocolStepPreconditionComponent(); // cc 3064 return this.condition; 3065 } 3066 3067 public boolean hasCondition() { 3068 return this.condition != null && !this.condition.isEmpty(); 3069 } 3070 3071 /** 3072 * @param value {@link #condition} (Condition in which next step is executed.) 3073 */ 3074 public ProtocolStepNextComponent setCondition(ProtocolStepPreconditionComponent value) { 3075 this.condition = value; 3076 return this; 3077 } 3078 3079 protected void listChildren(List<Property> childrenList) { 3080 super.listChildren(childrenList); 3081 childrenList.add(new Property("description", "string", "Description of what happens next.", 0, java.lang.Integer.MAX_VALUE, description)); 3082 childrenList.add(new Property("reference", "uri", "Id of following step.", 0, java.lang.Integer.MAX_VALUE, reference)); 3083 childrenList.add(new Property("condition", "@Protocol.step.precondition", "Condition in which next step is executed.", 0, java.lang.Integer.MAX_VALUE, condition)); 3084 } 3085 3086 @Override 3087 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 3088 switch (hash) { 3089 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 3090 case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // UriType 3091 case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // ProtocolStepPreconditionComponent 3092 default: return super.getProperty(hash, name, checkValid); 3093 } 3094 3095 } 3096 3097 @Override 3098 public void setProperty(int hash, String name, Base value) throws FHIRException { 3099 switch (hash) { 3100 case -1724546052: // description 3101 this.description = castToString(value); // StringType 3102 break; 3103 case -925155509: // reference 3104 this.reference = castToUri(value); // UriType 3105 break; 3106 case -861311717: // condition 3107 this.condition = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 3108 break; 3109 default: super.setProperty(hash, name, value); 3110 } 3111 3112 } 3113 3114 @Override 3115 public void setProperty(String name, Base value) throws FHIRException { 3116 if (name.equals("description")) 3117 this.description = castToString(value); // StringType 3118 else if (name.equals("reference")) 3119 this.reference = castToUri(value); // UriType 3120 else if (name.equals("condition")) 3121 this.condition = (ProtocolStepPreconditionComponent) value; // ProtocolStepPreconditionComponent 3122 else 3123 super.setProperty(name, value); 3124 } 3125 3126 @Override 3127 public Base makeProperty(int hash, String name) throws FHIRException { 3128 switch (hash) { 3129 case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType 3130 case -925155509: throw new FHIRException("Cannot make property reference as it is not a complex type"); // UriType 3131 case -861311717: return getCondition(); // ProtocolStepPreconditionComponent 3132 default: return super.makeProperty(hash, name); 3133 } 3134 3135 } 3136 3137 @Override 3138 public Base addChild(String name) throws FHIRException { 3139 if (name.equals("description")) { 3140 throw new FHIRException("Cannot call addChild on a primitive type Protocol.description"); 3141 } 3142 else if (name.equals("reference")) { 3143 throw new FHIRException("Cannot call addChild on a primitive type Protocol.reference"); 3144 } 3145 else if (name.equals("condition")) { 3146 this.condition = new ProtocolStepPreconditionComponent(); 3147 return this.condition; 3148 } 3149 else 3150 return super.addChild(name); 3151 } 3152 3153 public ProtocolStepNextComponent copy() { 3154 ProtocolStepNextComponent dst = new ProtocolStepNextComponent(); 3155 copyValues(dst); 3156 dst.description = description == null ? null : description.copy(); 3157 dst.reference = reference == null ? null : reference.copy(); 3158 dst.condition = condition == null ? null : condition.copy(); 3159 return dst; 3160 } 3161 3162 @Override 3163 public boolean equalsDeep(Base other) { 3164 if (!super.equalsDeep(other)) 3165 return false; 3166 if (!(other instanceof ProtocolStepNextComponent)) 3167 return false; 3168 ProtocolStepNextComponent o = (ProtocolStepNextComponent) other; 3169 return compareDeep(description, o.description, true) && compareDeep(reference, o.reference, true) 3170 && compareDeep(condition, o.condition, true); 3171 } 3172 3173 @Override 3174 public boolean equalsShallow(Base other) { 3175 if (!super.equalsShallow(other)) 3176 return false; 3177 if (!(other instanceof ProtocolStepNextComponent)) 3178 return false; 3179 ProtocolStepNextComponent o = (ProtocolStepNextComponent) other; 3180 return compareValues(description, o.description, true) && compareValues(reference, o.reference, true) 3181 ; 3182 } 3183 3184 public boolean isEmpty() { 3185 return super.isEmpty() && (description == null || description.isEmpty()) && (reference == null || reference.isEmpty()) 3186 && (condition == null || condition.isEmpty()); 3187 } 3188 3189 public String fhirType() { 3190 return "Protocol.step.next"; 3191 3192 } 3193 3194 } 3195 3196 /** 3197 * A unique identifier for the protocol instance. 3198 */ 3199 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 3200 @Description(shortDefinition="Unique Id for this particular protocol", formalDefinition="A unique identifier for the protocol instance." ) 3201 protected List<Identifier> identifier; 3202 3203 /** 3204 * Name of protocol. 3205 */ 3206 @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 3207 @Description(shortDefinition="Name of protocol", formalDefinition="Name of protocol." ) 3208 protected StringType title; 3209 3210 /** 3211 * The status of the protocol. 3212 */ 3213 @Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true) 3214 @Description(shortDefinition="draft | testing | review | active | withdrawn | superseded", formalDefinition="The status of the protocol." ) 3215 protected Enumeration<ProtocolStatus> status; 3216 3217 /** 3218 * A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes. 3219 */ 3220 @Child(name = "type", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true) 3221 @Description(shortDefinition="condition | device | drug | study", formalDefinition="A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes." ) 3222 protected Enumeration<ProtocolType> type; 3223 3224 /** 3225 * What does protocol deal with? 3226 */ 3227 @Child(name = "subject", type = {Condition.class, Device.class, Medication.class}, order=4, min=0, max=1, modifier=true, summary=true) 3228 @Description(shortDefinition="What does protocol deal with?", formalDefinition="What does protocol deal with?" ) 3229 protected Reference subject; 3230 3231 /** 3232 * The actual object that is the target of the reference (What does protocol deal with?) 3233 */ 3234 protected Resource subjectTarget; 3235 3236 /** 3237 * To whom does Protocol apply? 3238 */ 3239 @Child(name = "group", type = {Group.class}, order=5, min=0, max=1, modifier=true, summary=true) 3240 @Description(shortDefinition="To whom does Protocol apply?", formalDefinition="To whom does Protocol apply?" ) 3241 protected Reference group; 3242 3243 /** 3244 * The actual object that is the target of the reference (To whom does Protocol apply?) 3245 */ 3246 protected Group groupTarget; 3247 3248 /** 3249 * When is protocol to be used? 3250 */ 3251 @Child(name = "purpose", type = {StringType.class}, order=6, min=1, max=1, modifier=false, summary=true) 3252 @Description(shortDefinition="When is protocol to be used?", formalDefinition="When is protocol to be used?" ) 3253 protected StringType purpose; 3254 3255 /** 3256 * Who wrote protocol? 3257 */ 3258 @Child(name = "author", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true) 3259 @Description(shortDefinition="Who wrote protocol?", formalDefinition="Who wrote protocol?" ) 3260 protected Reference author; 3261 3262 /** 3263 * The actual object that is the target of the reference (Who wrote protocol?) 3264 */ 3265 protected Organization authorTarget; 3266 3267 /** 3268 * What's done as part of protocol. 3269 */ 3270 @Child(name = "step", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 3271 @Description(shortDefinition="What's done as part of protocol", formalDefinition="What's done as part of protocol." ) 3272 protected List<ProtocolStepComponent> step; 3273 3274 private static final long serialVersionUID = -1458830869L; 3275 3276 /** 3277 * Constructor 3278 */ 3279 public Protocol() { 3280 super(); 3281 } 3282 3283 /** 3284 * Constructor 3285 */ 3286 public Protocol(Enumeration<ProtocolStatus> status, Enumeration<ProtocolType> type, StringType purpose) { 3287 super(); 3288 this.status = status; 3289 this.type = type; 3290 this.purpose = purpose; 3291 } 3292 3293 /** 3294 * @return {@link #identifier} (A unique identifier for the protocol instance.) 3295 */ 3296 public List<Identifier> getIdentifier() { 3297 if (this.identifier == null) 3298 this.identifier = new ArrayList<Identifier>(); 3299 return this.identifier; 3300 } 3301 3302 public boolean hasIdentifier() { 3303 if (this.identifier == null) 3304 return false; 3305 for (Identifier item : this.identifier) 3306 if (!item.isEmpty()) 3307 return true; 3308 return false; 3309 } 3310 3311 /** 3312 * @return {@link #identifier} (A unique identifier for the protocol instance.) 3313 */ 3314 // syntactic sugar 3315 public Identifier addIdentifier() { //3 3316 Identifier t = new Identifier(); 3317 if (this.identifier == null) 3318 this.identifier = new ArrayList<Identifier>(); 3319 this.identifier.add(t); 3320 return t; 3321 } 3322 3323 // syntactic sugar 3324 public Protocol addIdentifier(Identifier t) { //3 3325 if (t == null) 3326 return this; 3327 if (this.identifier == null) 3328 this.identifier = new ArrayList<Identifier>(); 3329 this.identifier.add(t); 3330 return this; 3331 } 3332 3333 /** 3334 * @return {@link #title} (Name of protocol.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 3335 */ 3336 public StringType getTitleElement() { 3337 if (this.title == null) 3338 if (Configuration.errorOnAutoCreate()) 3339 throw new Error("Attempt to auto-create Protocol.title"); 3340 else if (Configuration.doAutoCreate()) 3341 this.title = new StringType(); // bb 3342 return this.title; 3343 } 3344 3345 public boolean hasTitleElement() { 3346 return this.title != null && !this.title.isEmpty(); 3347 } 3348 3349 public boolean hasTitle() { 3350 return this.title != null && !this.title.isEmpty(); 3351 } 3352 3353 /** 3354 * @param value {@link #title} (Name of protocol.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 3355 */ 3356 public Protocol setTitleElement(StringType value) { 3357 this.title = value; 3358 return this; 3359 } 3360 3361 /** 3362 * @return Name of protocol. 3363 */ 3364 public String getTitle() { 3365 return this.title == null ? null : this.title.getValue(); 3366 } 3367 3368 /** 3369 * @param value Name of protocol. 3370 */ 3371 public Protocol setTitle(String value) { 3372 if (Utilities.noString(value)) 3373 this.title = null; 3374 else { 3375 if (this.title == null) 3376 this.title = new StringType(); 3377 this.title.setValue(value); 3378 } 3379 return this; 3380 } 3381 3382 /** 3383 * @return {@link #status} (The status of the protocol.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 3384 */ 3385 public Enumeration<ProtocolStatus> getStatusElement() { 3386 if (this.status == null) 3387 if (Configuration.errorOnAutoCreate()) 3388 throw new Error("Attempt to auto-create Protocol.status"); 3389 else if (Configuration.doAutoCreate()) 3390 this.status = new Enumeration<ProtocolStatus>(new ProtocolStatusEnumFactory()); // bb 3391 return this.status; 3392 } 3393 3394 public boolean hasStatusElement() { 3395 return this.status != null && !this.status.isEmpty(); 3396 } 3397 3398 public boolean hasStatus() { 3399 return this.status != null && !this.status.isEmpty(); 3400 } 3401 3402 /** 3403 * @param value {@link #status} (The status of the protocol.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 3404 */ 3405 public Protocol setStatusElement(Enumeration<ProtocolStatus> value) { 3406 this.status = value; 3407 return this; 3408 } 3409 3410 /** 3411 * @return The status of the protocol. 3412 */ 3413 public ProtocolStatus getStatus() { 3414 return this.status == null ? null : this.status.getValue(); 3415 } 3416 3417 /** 3418 * @param value The status of the protocol. 3419 */ 3420 public Protocol setStatus(ProtocolStatus value) { 3421 if (this.status == null) 3422 this.status = new Enumeration<ProtocolStatus>(new ProtocolStatusEnumFactory()); 3423 this.status.setValue(value); 3424 return this; 3425 } 3426 3427 /** 3428 * @return {@link #type} (A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 3429 */ 3430 public Enumeration<ProtocolType> getTypeElement() { 3431 if (this.type == null) 3432 if (Configuration.errorOnAutoCreate()) 3433 throw new Error("Attempt to auto-create Protocol.type"); 3434 else if (Configuration.doAutoCreate()) 3435 this.type = new Enumeration<ProtocolType>(new ProtocolTypeEnumFactory()); // bb 3436 return this.type; 3437 } 3438 3439 public boolean hasTypeElement() { 3440 return this.type != null && !this.type.isEmpty(); 3441 } 3442 3443 public boolean hasType() { 3444 return this.type != null && !this.type.isEmpty(); 3445 } 3446 3447 /** 3448 * @param value {@link #type} (A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 3449 */ 3450 public Protocol setTypeElement(Enumeration<ProtocolType> value) { 3451 this.type = value; 3452 return this; 3453 } 3454 3455 /** 3456 * @return A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes. 3457 */ 3458 public ProtocolType getType() { 3459 return this.type == null ? null : this.type.getValue(); 3460 } 3461 3462 /** 3463 * @param value A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes. 3464 */ 3465 public Protocol setType(ProtocolType value) { 3466 if (this.type == null) 3467 this.type = new Enumeration<ProtocolType>(new ProtocolTypeEnumFactory()); 3468 this.type.setValue(value); 3469 return this; 3470 } 3471 3472 /** 3473 * @return {@link #subject} (What does protocol deal with?) 3474 */ 3475 public Reference getSubject() { 3476 if (this.subject == null) 3477 if (Configuration.errorOnAutoCreate()) 3478 throw new Error("Attempt to auto-create Protocol.subject"); 3479 else if (Configuration.doAutoCreate()) 3480 this.subject = new Reference(); // cc 3481 return this.subject; 3482 } 3483 3484 public boolean hasSubject() { 3485 return this.subject != null && !this.subject.isEmpty(); 3486 } 3487 3488 /** 3489 * @param value {@link #subject} (What does protocol deal with?) 3490 */ 3491 public Protocol setSubject(Reference value) { 3492 this.subject = value; 3493 return this; 3494 } 3495 3496 /** 3497 * @return {@link #subject} 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. (What does protocol deal with?) 3498 */ 3499 public Resource getSubjectTarget() { 3500 return this.subjectTarget; 3501 } 3502 3503 /** 3504 * @param value {@link #subject} 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. (What does protocol deal with?) 3505 */ 3506 public Protocol setSubjectTarget(Resource value) { 3507 this.subjectTarget = value; 3508 return this; 3509 } 3510 3511 /** 3512 * @return {@link #group} (To whom does Protocol apply?) 3513 */ 3514 public Reference getGroup() { 3515 if (this.group == null) 3516 if (Configuration.errorOnAutoCreate()) 3517 throw new Error("Attempt to auto-create Protocol.group"); 3518 else if (Configuration.doAutoCreate()) 3519 this.group = new Reference(); // cc 3520 return this.group; 3521 } 3522 3523 public boolean hasGroup() { 3524 return this.group != null && !this.group.isEmpty(); 3525 } 3526 3527 /** 3528 * @param value {@link #group} (To whom does Protocol apply?) 3529 */ 3530 public Protocol setGroup(Reference value) { 3531 this.group = value; 3532 return this; 3533 } 3534 3535 /** 3536 * @return {@link #group} 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. (To whom does Protocol apply?) 3537 */ 3538 public Group getGroupTarget() { 3539 if (this.groupTarget == null) 3540 if (Configuration.errorOnAutoCreate()) 3541 throw new Error("Attempt to auto-create Protocol.group"); 3542 else if (Configuration.doAutoCreate()) 3543 this.groupTarget = new Group(); // aa 3544 return this.groupTarget; 3545 } 3546 3547 /** 3548 * @param value {@link #group} 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. (To whom does Protocol apply?) 3549 */ 3550 public Protocol setGroupTarget(Group value) { 3551 this.groupTarget = value; 3552 return this; 3553 } 3554 3555 /** 3556 * @return {@link #purpose} (When is protocol to be used?). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value 3557 */ 3558 public StringType getPurposeElement() { 3559 if (this.purpose == null) 3560 if (Configuration.errorOnAutoCreate()) 3561 throw new Error("Attempt to auto-create Protocol.purpose"); 3562 else if (Configuration.doAutoCreate()) 3563 this.purpose = new StringType(); // bb 3564 return this.purpose; 3565 } 3566 3567 public boolean hasPurposeElement() { 3568 return this.purpose != null && !this.purpose.isEmpty(); 3569 } 3570 3571 public boolean hasPurpose() { 3572 return this.purpose != null && !this.purpose.isEmpty(); 3573 } 3574 3575 /** 3576 * @param value {@link #purpose} (When is protocol to be used?). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value 3577 */ 3578 public Protocol setPurposeElement(StringType value) { 3579 this.purpose = value; 3580 return this; 3581 } 3582 3583 /** 3584 * @return When is protocol to be used? 3585 */ 3586 public String getPurpose() { 3587 return this.purpose == null ? null : this.purpose.getValue(); 3588 } 3589 3590 /** 3591 * @param value When is protocol to be used? 3592 */ 3593 public Protocol setPurpose(String value) { 3594 if (this.purpose == null) 3595 this.purpose = new StringType(); 3596 this.purpose.setValue(value); 3597 return this; 3598 } 3599 3600 /** 3601 * @return {@link #author} (Who wrote protocol?) 3602 */ 3603 public Reference getAuthor() { 3604 if (this.author == null) 3605 if (Configuration.errorOnAutoCreate()) 3606 throw new Error("Attempt to auto-create Protocol.author"); 3607 else if (Configuration.doAutoCreate()) 3608 this.author = new Reference(); // cc 3609 return this.author; 3610 } 3611 3612 public boolean hasAuthor() { 3613 return this.author != null && !this.author.isEmpty(); 3614 } 3615 3616 /** 3617 * @param value {@link #author} (Who wrote protocol?) 3618 */ 3619 public Protocol setAuthor(Reference value) { 3620 this.author = value; 3621 return this; 3622 } 3623 3624 /** 3625 * @return {@link #author} 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. (Who wrote protocol?) 3626 */ 3627 public Organization getAuthorTarget() { 3628 if (this.authorTarget == null) 3629 if (Configuration.errorOnAutoCreate()) 3630 throw new Error("Attempt to auto-create Protocol.author"); 3631 else if (Configuration.doAutoCreate()) 3632 this.authorTarget = new Organization(); // aa 3633 return this.authorTarget; 3634 } 3635 3636 /** 3637 * @param value {@link #author} 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. (Who wrote protocol?) 3638 */ 3639 public Protocol setAuthorTarget(Organization value) { 3640 this.authorTarget = value; 3641 return this; 3642 } 3643 3644 /** 3645 * @return {@link #step} (What's done as part of protocol.) 3646 */ 3647 public List<ProtocolStepComponent> getStep() { 3648 if (this.step == null) 3649 this.step = new ArrayList<ProtocolStepComponent>(); 3650 return this.step; 3651 } 3652 3653 public boolean hasStep() { 3654 if (this.step == null) 3655 return false; 3656 for (ProtocolStepComponent item : this.step) 3657 if (!item.isEmpty()) 3658 return true; 3659 return false; 3660 } 3661 3662 /** 3663 * @return {@link #step} (What's done as part of protocol.) 3664 */ 3665 // syntactic sugar 3666 public ProtocolStepComponent addStep() { //3 3667 ProtocolStepComponent t = new ProtocolStepComponent(); 3668 if (this.step == null) 3669 this.step = new ArrayList<ProtocolStepComponent>(); 3670 this.step.add(t); 3671 return t; 3672 } 3673 3674 // syntactic sugar 3675 public Protocol addStep(ProtocolStepComponent t) { //3 3676 if (t == null) 3677 return this; 3678 if (this.step == null) 3679 this.step = new ArrayList<ProtocolStepComponent>(); 3680 this.step.add(t); 3681 return this; 3682 } 3683 3684 protected void listChildren(List<Property> childrenList) { 3685 super.listChildren(childrenList); 3686 childrenList.add(new Property("identifier", "Identifier", "A unique identifier for the protocol instance.", 0, java.lang.Integer.MAX_VALUE, identifier)); 3687 childrenList.add(new Property("title", "string", "Name of protocol.", 0, java.lang.Integer.MAX_VALUE, title)); 3688 childrenList.add(new Property("status", "code", "The status of the protocol.", 0, java.lang.Integer.MAX_VALUE, status)); 3689 childrenList.add(new Property("type", "code", "A code that classifies the general type of context to which these behavior definitions apply. This is used for searching, sorting and display purposes.", 0, java.lang.Integer.MAX_VALUE, type)); 3690 childrenList.add(new Property("subject", "Reference(Condition|Device|Medication)", "What does protocol deal with?", 0, java.lang.Integer.MAX_VALUE, subject)); 3691 childrenList.add(new Property("group", "Reference(Group)", "To whom does Protocol apply?", 0, java.lang.Integer.MAX_VALUE, group)); 3692 childrenList.add(new Property("purpose", "string", "When is protocol to be used?", 0, java.lang.Integer.MAX_VALUE, purpose)); 3693 childrenList.add(new Property("author", "Reference(Organization)", "Who wrote protocol?", 0, java.lang.Integer.MAX_VALUE, author)); 3694 childrenList.add(new Property("step", "", "What's done as part of protocol.", 0, java.lang.Integer.MAX_VALUE, step)); 3695 } 3696 3697 @Override 3698 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 3699 switch (hash) { 3700 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 3701 case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType 3702 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ProtocolStatus> 3703 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ProtocolType> 3704 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 3705 case 98629247: /*group*/ return this.group == null ? new Base[0] : new Base[] {this.group}; // Reference 3706 case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // StringType 3707 case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference 3708 case 3540684: /*step*/ return this.step == null ? new Base[0] : this.step.toArray(new Base[this.step.size()]); // ProtocolStepComponent 3709 default: return super.getProperty(hash, name, checkValid); 3710 } 3711 3712 } 3713 3714 @Override 3715 public void setProperty(int hash, String name, Base value) throws FHIRException { 3716 switch (hash) { 3717 case -1618432855: // identifier 3718 this.getIdentifier().add(castToIdentifier(value)); // Identifier 3719 break; 3720 case 110371416: // title 3721 this.title = castToString(value); // StringType 3722 break; 3723 case -892481550: // status 3724 this.status = new ProtocolStatusEnumFactory().fromType(value); // Enumeration<ProtocolStatus> 3725 break; 3726 case 3575610: // type 3727 this.type = new ProtocolTypeEnumFactory().fromType(value); // Enumeration<ProtocolType> 3728 break; 3729 case -1867885268: // subject 3730 this.subject = castToReference(value); // Reference 3731 break; 3732 case 98629247: // group 3733 this.group = castToReference(value); // Reference 3734 break; 3735 case -220463842: // purpose 3736 this.purpose = castToString(value); // StringType 3737 break; 3738 case -1406328437: // author 3739 this.author = castToReference(value); // Reference 3740 break; 3741 case 3540684: // step 3742 this.getStep().add((ProtocolStepComponent) value); // ProtocolStepComponent 3743 break; 3744 default: super.setProperty(hash, name, value); 3745 } 3746 3747 } 3748 3749 @Override 3750 public void setProperty(String name, Base value) throws FHIRException { 3751 if (name.equals("identifier")) 3752 this.getIdentifier().add(castToIdentifier(value)); 3753 else if (name.equals("title")) 3754 this.title = castToString(value); // StringType 3755 else if (name.equals("status")) 3756 this.status = new ProtocolStatusEnumFactory().fromType(value); // Enumeration<ProtocolStatus> 3757 else if (name.equals("type")) 3758 this.type = new ProtocolTypeEnumFactory().fromType(value); // Enumeration<ProtocolType> 3759 else if (name.equals("subject")) 3760 this.subject = castToReference(value); // Reference 3761 else if (name.equals("group")) 3762 this.group = castToReference(value); // Reference 3763 else if (name.equals("purpose")) 3764 this.purpose = castToString(value); // StringType 3765 else if (name.equals("author")) 3766 this.author = castToReference(value); // Reference 3767 else if (name.equals("step")) 3768 this.getStep().add((ProtocolStepComponent) value); 3769 else 3770 super.setProperty(name, value); 3771 } 3772 3773 @Override 3774 public Base makeProperty(int hash, String name) throws FHIRException { 3775 switch (hash) { 3776 case -1618432855: return addIdentifier(); // Identifier 3777 case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType 3778 case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<ProtocolStatus> 3779 case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration<ProtocolType> 3780 case -1867885268: return getSubject(); // Reference 3781 case 98629247: return getGroup(); // Reference 3782 case -220463842: throw new FHIRException("Cannot make property purpose as it is not a complex type"); // StringType 3783 case -1406328437: return getAuthor(); // Reference 3784 case 3540684: return addStep(); // ProtocolStepComponent 3785 default: return super.makeProperty(hash, name); 3786 } 3787 3788 } 3789 3790 @Override 3791 public Base addChild(String name) throws FHIRException { 3792 if (name.equals("identifier")) { 3793 return addIdentifier(); 3794 } 3795 else if (name.equals("title")) { 3796 throw new FHIRException("Cannot call addChild on a primitive type Protocol.title"); 3797 } 3798 else if (name.equals("status")) { 3799 throw new FHIRException("Cannot call addChild on a primitive type Protocol.status"); 3800 } 3801 else if (name.equals("type")) { 3802 throw new FHIRException("Cannot call addChild on a primitive type Protocol.type"); 3803 } 3804 else if (name.equals("subject")) { 3805 this.subject = new Reference(); 3806 return this.subject; 3807 } 3808 else if (name.equals("group")) { 3809 this.group = new Reference(); 3810 return this.group; 3811 } 3812 else if (name.equals("purpose")) { 3813 throw new FHIRException("Cannot call addChild on a primitive type Protocol.purpose"); 3814 } 3815 else if (name.equals("author")) { 3816 this.author = new Reference(); 3817 return this.author; 3818 } 3819 else if (name.equals("step")) { 3820 return addStep(); 3821 } 3822 else 3823 return super.addChild(name); 3824 } 3825 3826 public String fhirType() { 3827 return "Protocol"; 3828 3829 } 3830 3831 public Protocol copy() { 3832 Protocol dst = new Protocol(); 3833 copyValues(dst); 3834 if (identifier != null) { 3835 dst.identifier = new ArrayList<Identifier>(); 3836 for (Identifier i : identifier) 3837 dst.identifier.add(i.copy()); 3838 }; 3839 dst.title = title == null ? null : title.copy(); 3840 dst.status = status == null ? null : status.copy(); 3841 dst.type = type == null ? null : type.copy(); 3842 dst.subject = subject == null ? null : subject.copy(); 3843 dst.group = group == null ? null : group.copy(); 3844 dst.purpose = purpose == null ? null : purpose.copy(); 3845 dst.author = author == null ? null : author.copy(); 3846 if (step != null) { 3847 dst.step = new ArrayList<ProtocolStepComponent>(); 3848 for (ProtocolStepComponent i : step) 3849 dst.step.add(i.copy()); 3850 }; 3851 return dst; 3852 } 3853 3854 protected Protocol typedCopy() { 3855 return copy(); 3856 } 3857 3858 @Override 3859 public boolean equalsDeep(Base other) { 3860 if (!super.equalsDeep(other)) 3861 return false; 3862 if (!(other instanceof Protocol)) 3863 return false; 3864 Protocol o = (Protocol) other; 3865 return compareDeep(identifier, o.identifier, true) && compareDeep(title, o.title, true) && compareDeep(status, o.status, true) 3866 && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true) && compareDeep(group, o.group, true) 3867 && compareDeep(purpose, o.purpose, true) && compareDeep(author, o.author, true) && compareDeep(step, o.step, true) 3868 ; 3869 } 3870 3871 @Override 3872 public boolean equalsShallow(Base other) { 3873 if (!super.equalsShallow(other)) 3874 return false; 3875 if (!(other instanceof Protocol)) 3876 return false; 3877 Protocol o = (Protocol) other; 3878 return compareValues(title, o.title, true) && compareValues(status, o.status, true) && compareValues(type, o.type, true) 3879 && compareValues(purpose, o.purpose, true); 3880 } 3881 3882 public boolean isEmpty() { 3883 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (title == null || title.isEmpty()) 3884 && (status == null || status.isEmpty()) && (type == null || type.isEmpty()) && (subject == null || subject.isEmpty()) 3885 && (group == null || group.isEmpty()) && (purpose == null || purpose.isEmpty()) && (author == null || author.isEmpty()) 3886 && (step == null || step.isEmpty()); 3887 } 3888 3889 @Override 3890 public ResourceType getResourceType() { 3891 return ResourceType.Protocol; 3892 } 3893 3894 /** 3895 * Search parameter: <b>subject</b> 3896 * <p> 3897 * Description: <b>Protocols with specified subject</b><br> 3898 * Type: <b>reference</b><br> 3899 * Path: <b>Protocol.subject</b><br> 3900 * </p> 3901 */ 3902 @SearchParamDefinition(name="subject", path="Protocol.subject", description="Protocols with specified subject", type="reference" ) 3903 public static final String SP_SUBJECT = "subject"; 3904 /** 3905 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 3906 * <p> 3907 * Description: <b>Protocols with specified subject</b><br> 3908 * Type: <b>reference</b><br> 3909 * Path: <b>Protocol.subject</b><br> 3910 * </p> 3911 */ 3912 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 3913 3914/** 3915 * Constant for fluent queries to be used to add include statements. Specifies 3916 * the path value of "<b>Protocol:subject</b>". 3917 */ 3918 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Protocol:subject").toLocked(); 3919 3920 /** 3921 * Search parameter: <b>identifier</b> 3922 * <p> 3923 * Description: <b>The unique id for a particular protocol</b><br> 3924 * Type: <b>token</b><br> 3925 * Path: <b>Protocol.identifier</b><br> 3926 * </p> 3927 */ 3928 @SearchParamDefinition(name="identifier", path="Protocol.identifier", description="The unique id for a particular protocol", type="token" ) 3929 public static final String SP_IDENTIFIER = "identifier"; 3930 /** 3931 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 3932 * <p> 3933 * Description: <b>The unique id for a particular protocol</b><br> 3934 * Type: <b>token</b><br> 3935 * Path: <b>Protocol.identifier</b><br> 3936 * </p> 3937 */ 3938 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 3939 3940 3941}