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