001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import ca.uhn.fhir.model.api.annotation.Child; 038import ca.uhn.fhir.model.api.annotation.Description; 039import ca.uhn.fhir.model.api.annotation.ResourceDef; 040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 041import org.hl7.fhir.exceptions.FHIRException; 042import org.hl7.fhir.utilities.Utilities; 043 044/** 045 * A slot of time on a schedule that may be available for booking appointments. 046 */ 047@ResourceDef(name = "Slot", profile = "http://hl7.org/fhir/Profile/Slot") 048public class Slot extends DomainResource { 049 050 public enum SlotStatus { 051 /** 052 * Indicates that the time interval is busy because one or more events have been 053 * scheduled for that interval. 054 */ 055 BUSY, 056 /** 057 * Indicates that the time interval is free for scheduling. 058 */ 059 FREE, 060 /** 061 * Indicates that the time interval is busy and that the interval can not be 062 * scheduled. 063 */ 064 BUSYUNAVAILABLE, 065 /** 066 * Indicates that the time interval is busy because one or more events have been 067 * tentatively scheduled for that interval. 068 */ 069 BUSYTENTATIVE, 070 /** 071 * added to help the parsers 072 */ 073 NULL; 074 075 public static SlotStatus fromCode(String codeString) throws FHIRException { 076 if (codeString == null || "".equals(codeString)) 077 return null; 078 if ("busy".equals(codeString)) 079 return BUSY; 080 if ("free".equals(codeString)) 081 return FREE; 082 if ("busy-unavailable".equals(codeString)) 083 return BUSYUNAVAILABLE; 084 if ("busy-tentative".equals(codeString)) 085 return BUSYTENTATIVE; 086 throw new FHIRException("Unknown SlotStatus code '" + codeString + "'"); 087 } 088 089 public String toCode() { 090 switch (this) { 091 case BUSY: 092 return "busy"; 093 case FREE: 094 return "free"; 095 case BUSYUNAVAILABLE: 096 return "busy-unavailable"; 097 case BUSYTENTATIVE: 098 return "busy-tentative"; 099 case NULL: 100 return null; 101 default: 102 return "?"; 103 } 104 } 105 106 public String getSystem() { 107 switch (this) { 108 case BUSY: 109 return "http://hl7.org/fhir/slotstatus"; 110 case FREE: 111 return "http://hl7.org/fhir/slotstatus"; 112 case BUSYUNAVAILABLE: 113 return "http://hl7.org/fhir/slotstatus"; 114 case BUSYTENTATIVE: 115 return "http://hl7.org/fhir/slotstatus"; 116 case NULL: 117 return null; 118 default: 119 return "?"; 120 } 121 } 122 123 public String getDefinition() { 124 switch (this) { 125 case BUSY: 126 return "Indicates that the time interval is busy because one or more events have been scheduled for that interval."; 127 case FREE: 128 return "Indicates that the time interval is free for scheduling."; 129 case BUSYUNAVAILABLE: 130 return "Indicates that the time interval is busy and that the interval can not be scheduled."; 131 case BUSYTENTATIVE: 132 return "Indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval."; 133 case NULL: 134 return null; 135 default: 136 return "?"; 137 } 138 } 139 140 public String getDisplay() { 141 switch (this) { 142 case BUSY: 143 return "Busy"; 144 case FREE: 145 return "Free"; 146 case BUSYUNAVAILABLE: 147 return "Busy (Unavailable)"; 148 case BUSYTENTATIVE: 149 return "Busy (Tentative)"; 150 case NULL: 151 return null; 152 default: 153 return "?"; 154 } 155 } 156 } 157 158 public static class SlotStatusEnumFactory implements EnumFactory<SlotStatus> { 159 public SlotStatus fromCode(String codeString) throws IllegalArgumentException { 160 if (codeString == null || "".equals(codeString)) 161 if (codeString == null || "".equals(codeString)) 162 return null; 163 if ("busy".equals(codeString)) 164 return SlotStatus.BUSY; 165 if ("free".equals(codeString)) 166 return SlotStatus.FREE; 167 if ("busy-unavailable".equals(codeString)) 168 return SlotStatus.BUSYUNAVAILABLE; 169 if ("busy-tentative".equals(codeString)) 170 return SlotStatus.BUSYTENTATIVE; 171 throw new IllegalArgumentException("Unknown SlotStatus code '" + codeString + "'"); 172 } 173 174 public Enumeration<SlotStatus> fromType(Base code) throws FHIRException { 175 if (code == null || code.isEmpty()) 176 return null; 177 String codeString = ((PrimitiveType) code).asStringValue(); 178 if (codeString == null || "".equals(codeString)) 179 return null; 180 if ("busy".equals(codeString)) 181 return new Enumeration<SlotStatus>(this, SlotStatus.BUSY); 182 if ("free".equals(codeString)) 183 return new Enumeration<SlotStatus>(this, SlotStatus.FREE); 184 if ("busy-unavailable".equals(codeString)) 185 return new Enumeration<SlotStatus>(this, SlotStatus.BUSYUNAVAILABLE); 186 if ("busy-tentative".equals(codeString)) 187 return new Enumeration<SlotStatus>(this, SlotStatus.BUSYTENTATIVE); 188 throw new FHIRException("Unknown SlotStatus code '" + codeString + "'"); 189 } 190 191 public String toCode(SlotStatus code) { 192 if (code == SlotStatus.BUSY) 193 return "busy"; 194 if (code == SlotStatus.FREE) 195 return "free"; 196 if (code == SlotStatus.BUSYUNAVAILABLE) 197 return "busy-unavailable"; 198 if (code == SlotStatus.BUSYTENTATIVE) 199 return "busy-tentative"; 200 return "?"; 201 } 202 } 203 204 /** 205 * External Ids for this item. 206 */ 207 @Child(name = "identifier", type = { 208 Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 209 @Description(shortDefinition = "External Ids for this item", formalDefinition = "External Ids for this item.") 210 protected List<Identifier> identifier; 211 212 /** 213 * The type of appointments that can be booked into this slot (ideally this 214 * would be an identifiable service - which is at a location, rather than the 215 * location itself). If provided then this overrides the value provided on the 216 * availability resource. 217 */ 218 @Child(name = "type", type = { 219 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false) 220 @Description(shortDefinition = "The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource", formalDefinition = "The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.") 221 protected CodeableConcept type; 222 223 /** 224 * The schedule resource that this slot defines an interval of status 225 * information. 226 */ 227 @Child(name = "schedule", type = { Schedule.class }, order = 2, min = 1, max = 1, modifier = false, summary = true) 228 @Description(shortDefinition = "The schedule resource that this slot defines an interval of status information", formalDefinition = "The schedule resource that this slot defines an interval of status information.") 229 protected Reference schedule; 230 231 /** 232 * The actual object that is the target of the reference (The schedule resource 233 * that this slot defines an interval of status information.) 234 */ 235 protected Schedule scheduleTarget; 236 237 /** 238 * busy | free | busy-unavailable | busy-tentative. 239 */ 240 @Child(name = "freeBusyType", type = { 241 CodeType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true) 242 @Description(shortDefinition = "busy | free | busy-unavailable | busy-tentative", formalDefinition = "busy | free | busy-unavailable | busy-tentative.") 243 protected Enumeration<SlotStatus> freeBusyType; 244 245 /** 246 * Date/Time that the slot is to begin. 247 */ 248 @Child(name = "start", type = { InstantType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true) 249 @Description(shortDefinition = "Date/Time that the slot is to begin", formalDefinition = "Date/Time that the slot is to begin.") 250 protected InstantType start; 251 252 /** 253 * Date/Time that the slot is to conclude. 254 */ 255 @Child(name = "end", type = { InstantType.class }, order = 5, min = 1, max = 1, modifier = false, summary = true) 256 @Description(shortDefinition = "Date/Time that the slot is to conclude", formalDefinition = "Date/Time that the slot is to conclude.") 257 protected InstantType end; 258 259 /** 260 * This slot has already been overbooked, appointments are unlikely to be 261 * accepted for this time. 262 */ 263 @Child(name = "overbooked", type = { 264 BooleanType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false) 265 @Description(shortDefinition = "This slot has already been overbooked, appointments are unlikely to be accepted for this time", formalDefinition = "This slot has already been overbooked, appointments are unlikely to be accepted for this time.") 266 protected BooleanType overbooked; 267 268 /** 269 * Comments on the slot to describe any extended information. Such as custom 270 * constraints on the slot. 271 */ 272 @Child(name = "comment", type = { StringType.class }, order = 7, min = 0, max = 1, modifier = false, summary = false) 273 @Description(shortDefinition = "Comments on the slot to describe any extended information. Such as custom constraints on the slot", formalDefinition = "Comments on the slot to describe any extended information. Such as custom constraints on the slot.") 274 protected StringType comment; 275 276 private static final long serialVersionUID = 1984269299L; 277 278 /* 279 * Constructor 280 */ 281 public Slot() { 282 super(); 283 } 284 285 /* 286 * Constructor 287 */ 288 public Slot(Reference schedule, Enumeration<SlotStatus> freeBusyType, InstantType start, InstantType end) { 289 super(); 290 this.schedule = schedule; 291 this.freeBusyType = freeBusyType; 292 this.start = start; 293 this.end = end; 294 } 295 296 /** 297 * @return {@link #identifier} (External Ids for this item.) 298 */ 299 public List<Identifier> getIdentifier() { 300 if (this.identifier == null) 301 this.identifier = new ArrayList<Identifier>(); 302 return this.identifier; 303 } 304 305 public boolean hasIdentifier() { 306 if (this.identifier == null) 307 return false; 308 for (Identifier item : this.identifier) 309 if (!item.isEmpty()) 310 return true; 311 return false; 312 } 313 314 /** 315 * @return {@link #identifier} (External Ids for this item.) 316 */ 317 // syntactic sugar 318 public Identifier addIdentifier() { // 3 319 Identifier t = new Identifier(); 320 if (this.identifier == null) 321 this.identifier = new ArrayList<Identifier>(); 322 this.identifier.add(t); 323 return t; 324 } 325 326 // syntactic sugar 327 public Slot addIdentifier(Identifier t) { // 3 328 if (t == null) 329 return this; 330 if (this.identifier == null) 331 this.identifier = new ArrayList<Identifier>(); 332 this.identifier.add(t); 333 return this; 334 } 335 336 /** 337 * @return {@link #type} (The type of appointments that can be booked into this 338 * slot (ideally this would be an identifiable service - which is at a 339 * location, rather than the location itself). If provided then this 340 * overrides the value provided on the availability resource.) 341 */ 342 public CodeableConcept getType() { 343 if (this.type == null) 344 if (Configuration.errorOnAutoCreate()) 345 throw new Error("Attempt to auto-create Slot.type"); 346 else if (Configuration.doAutoCreate()) 347 this.type = new CodeableConcept(); // cc 348 return this.type; 349 } 350 351 public boolean hasType() { 352 return this.type != null && !this.type.isEmpty(); 353 } 354 355 /** 356 * @param value {@link #type} (The type of appointments that can be booked into 357 * this slot (ideally this would be an identifiable service - which 358 * is at a location, rather than the location itself). If provided 359 * then this overrides the value provided on the availability 360 * resource.) 361 */ 362 public Slot setType(CodeableConcept value) { 363 this.type = value; 364 return this; 365 } 366 367 /** 368 * @return {@link #schedule} (The schedule resource that this slot defines an 369 * interval of status information.) 370 */ 371 public Reference getSchedule() { 372 if (this.schedule == null) 373 if (Configuration.errorOnAutoCreate()) 374 throw new Error("Attempt to auto-create Slot.schedule"); 375 else if (Configuration.doAutoCreate()) 376 this.schedule = new Reference(); // cc 377 return this.schedule; 378 } 379 380 public boolean hasSchedule() { 381 return this.schedule != null && !this.schedule.isEmpty(); 382 } 383 384 /** 385 * @param value {@link #schedule} (The schedule resource that this slot defines 386 * an interval of status information.) 387 */ 388 public Slot setSchedule(Reference value) { 389 this.schedule = value; 390 return this; 391 } 392 393 /** 394 * @return {@link #schedule} The actual object that is the target of the 395 * reference. The reference library doesn't populate this, but you can 396 * use it to hold the resource if you resolve it. (The schedule resource 397 * that this slot defines an interval of status information.) 398 */ 399 public Schedule getScheduleTarget() { 400 if (this.scheduleTarget == null) 401 if (Configuration.errorOnAutoCreate()) 402 throw new Error("Attempt to auto-create Slot.schedule"); 403 else if (Configuration.doAutoCreate()) 404 this.scheduleTarget = new Schedule(); // aa 405 return this.scheduleTarget; 406 } 407 408 /** 409 * @param value {@link #schedule} The actual object that is the target of the 410 * reference. The reference library doesn't use these, but you can 411 * use it to hold the resource if you resolve it. (The schedule 412 * resource that this slot defines an interval of status 413 * information.) 414 */ 415 public Slot setScheduleTarget(Schedule value) { 416 this.scheduleTarget = value; 417 return this; 418 } 419 420 /** 421 * @return {@link #freeBusyType} (busy | free | busy-unavailable | 422 * busy-tentative.). This is the underlying object with id, value and 423 * extensions. The accessor "getFreeBusyType" gives direct access to the 424 * value 425 */ 426 public Enumeration<SlotStatus> getFreeBusyTypeElement() { 427 if (this.freeBusyType == null) 428 if (Configuration.errorOnAutoCreate()) 429 throw new Error("Attempt to auto-create Slot.freeBusyType"); 430 else if (Configuration.doAutoCreate()) 431 this.freeBusyType = new Enumeration<SlotStatus>(new SlotStatusEnumFactory()); // bb 432 return this.freeBusyType; 433 } 434 435 public boolean hasFreeBusyTypeElement() { 436 return this.freeBusyType != null && !this.freeBusyType.isEmpty(); 437 } 438 439 public boolean hasFreeBusyType() { 440 return this.freeBusyType != null && !this.freeBusyType.isEmpty(); 441 } 442 443 /** 444 * @param value {@link #freeBusyType} (busy | free | busy-unavailable | 445 * busy-tentative.). This is the underlying object with id, value 446 * and extensions. The accessor "getFreeBusyType" gives direct 447 * access to the value 448 */ 449 public Slot setFreeBusyTypeElement(Enumeration<SlotStatus> value) { 450 this.freeBusyType = value; 451 return this; 452 } 453 454 /** 455 * @return busy | free | busy-unavailable | busy-tentative. 456 */ 457 public SlotStatus getFreeBusyType() { 458 return this.freeBusyType == null ? null : this.freeBusyType.getValue(); 459 } 460 461 /** 462 * @param value busy | free | busy-unavailable | busy-tentative. 463 */ 464 public Slot setFreeBusyType(SlotStatus value) { 465 if (this.freeBusyType == null) 466 this.freeBusyType = new Enumeration<SlotStatus>(new SlotStatusEnumFactory()); 467 this.freeBusyType.setValue(value); 468 return this; 469 } 470 471 /** 472 * @return {@link #start} (Date/Time that the slot is to begin.). This is the 473 * underlying object with id, value and extensions. The accessor 474 * "getStart" gives direct access to the value 475 */ 476 public InstantType getStartElement() { 477 if (this.start == null) 478 if (Configuration.errorOnAutoCreate()) 479 throw new Error("Attempt to auto-create Slot.start"); 480 else if (Configuration.doAutoCreate()) 481 this.start = new InstantType(); // bb 482 return this.start; 483 } 484 485 public boolean hasStartElement() { 486 return this.start != null && !this.start.isEmpty(); 487 } 488 489 public boolean hasStart() { 490 return this.start != null && !this.start.isEmpty(); 491 } 492 493 /** 494 * @param value {@link #start} (Date/Time that the slot is to begin.). This is 495 * the underlying object with id, value and extensions. The 496 * accessor "getStart" gives direct access to the value 497 */ 498 public Slot setStartElement(InstantType value) { 499 this.start = value; 500 return this; 501 } 502 503 /** 504 * @return Date/Time that the slot is to begin. 505 */ 506 public Date getStart() { 507 return this.start == null ? null : this.start.getValue(); 508 } 509 510 /** 511 * @param value Date/Time that the slot is to begin. 512 */ 513 public Slot setStart(Date value) { 514 if (this.start == null) 515 this.start = new InstantType(); 516 this.start.setValue(value); 517 return this; 518 } 519 520 /** 521 * @return {@link #end} (Date/Time that the slot is to conclude.). This is the 522 * underlying object with id, value and extensions. The accessor 523 * "getEnd" gives direct access to the value 524 */ 525 public InstantType getEndElement() { 526 if (this.end == null) 527 if (Configuration.errorOnAutoCreate()) 528 throw new Error("Attempt to auto-create Slot.end"); 529 else if (Configuration.doAutoCreate()) 530 this.end = new InstantType(); // bb 531 return this.end; 532 } 533 534 public boolean hasEndElement() { 535 return this.end != null && !this.end.isEmpty(); 536 } 537 538 public boolean hasEnd() { 539 return this.end != null && !this.end.isEmpty(); 540 } 541 542 /** 543 * @param value {@link #end} (Date/Time that the slot is to conclude.). This is 544 * the underlying object with id, value and extensions. The 545 * accessor "getEnd" gives direct access to the value 546 */ 547 public Slot setEndElement(InstantType value) { 548 this.end = value; 549 return this; 550 } 551 552 /** 553 * @return Date/Time that the slot is to conclude. 554 */ 555 public Date getEnd() { 556 return this.end == null ? null : this.end.getValue(); 557 } 558 559 /** 560 * @param value Date/Time that the slot is to conclude. 561 */ 562 public Slot setEnd(Date value) { 563 if (this.end == null) 564 this.end = new InstantType(); 565 this.end.setValue(value); 566 return this; 567 } 568 569 /** 570 * @return {@link #overbooked} (This slot has already been overbooked, 571 * appointments are unlikely to be accepted for this time.). This is the 572 * underlying object with id, value and extensions. The accessor 573 * "getOverbooked" gives direct access to the value 574 */ 575 public BooleanType getOverbookedElement() { 576 if (this.overbooked == null) 577 if (Configuration.errorOnAutoCreate()) 578 throw new Error("Attempt to auto-create Slot.overbooked"); 579 else if (Configuration.doAutoCreate()) 580 this.overbooked = new BooleanType(); // bb 581 return this.overbooked; 582 } 583 584 public boolean hasOverbookedElement() { 585 return this.overbooked != null && !this.overbooked.isEmpty(); 586 } 587 588 public boolean hasOverbooked() { 589 return this.overbooked != null && !this.overbooked.isEmpty(); 590 } 591 592 /** 593 * @param value {@link #overbooked} (This slot has already been overbooked, 594 * appointments are unlikely to be accepted for this time.). This 595 * is the underlying object with id, value and extensions. The 596 * accessor "getOverbooked" gives direct access to the value 597 */ 598 public Slot setOverbookedElement(BooleanType value) { 599 this.overbooked = value; 600 return this; 601 } 602 603 /** 604 * @return This slot has already been overbooked, appointments are unlikely to 605 * be accepted for this time. 606 */ 607 public boolean getOverbooked() { 608 return this.overbooked == null || this.overbooked.isEmpty() ? false : this.overbooked.getValue(); 609 } 610 611 /** 612 * @param value This slot has already been overbooked, appointments are unlikely 613 * to be accepted for this time. 614 */ 615 public Slot setOverbooked(boolean value) { 616 if (this.overbooked == null) 617 this.overbooked = new BooleanType(); 618 this.overbooked.setValue(value); 619 return this; 620 } 621 622 /** 623 * @return {@link #comment} (Comments on the slot to describe any extended 624 * information. Such as custom constraints on the slot.). This is the 625 * underlying object with id, value and extensions. The accessor 626 * "getComment" gives direct access to the value 627 */ 628 public StringType getCommentElement() { 629 if (this.comment == null) 630 if (Configuration.errorOnAutoCreate()) 631 throw new Error("Attempt to auto-create Slot.comment"); 632 else if (Configuration.doAutoCreate()) 633 this.comment = new StringType(); // bb 634 return this.comment; 635 } 636 637 public boolean hasCommentElement() { 638 return this.comment != null && !this.comment.isEmpty(); 639 } 640 641 public boolean hasComment() { 642 return this.comment != null && !this.comment.isEmpty(); 643 } 644 645 /** 646 * @param value {@link #comment} (Comments on the slot to describe any extended 647 * information. Such as custom constraints on the slot.). This is 648 * the underlying object with id, value and extensions. The 649 * accessor "getComment" gives direct access to the value 650 */ 651 public Slot setCommentElement(StringType value) { 652 this.comment = value; 653 return this; 654 } 655 656 /** 657 * @return Comments on the slot to describe any extended information. Such as 658 * custom constraints on the slot. 659 */ 660 public String getComment() { 661 return this.comment == null ? null : this.comment.getValue(); 662 } 663 664 /** 665 * @param value Comments on the slot to describe any extended information. Such 666 * as custom constraints on the slot. 667 */ 668 public Slot setComment(String value) { 669 if (Utilities.noString(value)) 670 this.comment = null; 671 else { 672 if (this.comment == null) 673 this.comment = new StringType(); 674 this.comment.setValue(value); 675 } 676 return this; 677 } 678 679 protected void listChildren(List<Property> childrenList) { 680 super.listChildren(childrenList); 681 childrenList.add(new Property("identifier", "Identifier", "External Ids for this item.", 0, 682 java.lang.Integer.MAX_VALUE, identifier)); 683 childrenList.add(new Property("type", "CodeableConcept", 684 "The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.", 685 0, java.lang.Integer.MAX_VALUE, type)); 686 childrenList.add(new Property("schedule", "Reference(Schedule)", 687 "The schedule resource that this slot defines an interval of status information.", 0, 688 java.lang.Integer.MAX_VALUE, schedule)); 689 childrenList.add(new Property("freeBusyType", "code", "busy | free | busy-unavailable | busy-tentative.", 0, 690 java.lang.Integer.MAX_VALUE, freeBusyType)); 691 childrenList.add(new Property("start", "instant", "Date/Time that the slot is to begin.", 0, 692 java.lang.Integer.MAX_VALUE, start)); 693 childrenList.add( 694 new Property("end", "instant", "Date/Time that the slot is to conclude.", 0, java.lang.Integer.MAX_VALUE, end)); 695 childrenList.add(new Property("overbooked", "boolean", 696 "This slot has already been overbooked, appointments are unlikely to be accepted for this time.", 0, 697 java.lang.Integer.MAX_VALUE, overbooked)); 698 childrenList.add(new Property("comment", "string", 699 "Comments on the slot to describe any extended information. Such as custom constraints on the slot.", 0, 700 java.lang.Integer.MAX_VALUE, comment)); 701 } 702 703 @Override 704 public void setProperty(String name, Base value) throws FHIRException { 705 if (name.equals("identifier")) 706 this.getIdentifier().add(castToIdentifier(value)); 707 else if (name.equals("type")) 708 this.type = castToCodeableConcept(value); // CodeableConcept 709 else if (name.equals("schedule")) 710 this.schedule = castToReference(value); // Reference 711 else if (name.equals("freeBusyType")) 712 this.freeBusyType = new SlotStatusEnumFactory().fromType(value); // Enumeration<SlotStatus> 713 else if (name.equals("start")) 714 this.start = castToInstant(value); // InstantType 715 else if (name.equals("end")) 716 this.end = castToInstant(value); // InstantType 717 else if (name.equals("overbooked")) 718 this.overbooked = castToBoolean(value); // BooleanType 719 else if (name.equals("comment")) 720 this.comment = castToString(value); // StringType 721 else 722 super.setProperty(name, value); 723 } 724 725 @Override 726 public Base addChild(String name) throws FHIRException { 727 if (name.equals("identifier")) { 728 return addIdentifier(); 729 } else if (name.equals("type")) { 730 this.type = new CodeableConcept(); 731 return this.type; 732 } else if (name.equals("schedule")) { 733 this.schedule = new Reference(); 734 return this.schedule; 735 } else if (name.equals("freeBusyType")) { 736 throw new FHIRException("Cannot call addChild on a singleton property Slot.freeBusyType"); 737 } else if (name.equals("start")) { 738 throw new FHIRException("Cannot call addChild on a singleton property Slot.start"); 739 } else if (name.equals("end")) { 740 throw new FHIRException("Cannot call addChild on a singleton property Slot.end"); 741 } else if (name.equals("overbooked")) { 742 throw new FHIRException("Cannot call addChild on a singleton property Slot.overbooked"); 743 } else if (name.equals("comment")) { 744 throw new FHIRException("Cannot call addChild on a singleton property Slot.comment"); 745 } else 746 return super.addChild(name); 747 } 748 749 public String fhirType() { 750 return "Slot"; 751 752 } 753 754 public Slot copy() { 755 Slot dst = new Slot(); 756 copyValues(dst); 757 if (identifier != null) { 758 dst.identifier = new ArrayList<Identifier>(); 759 for (Identifier i : identifier) 760 dst.identifier.add(i.copy()); 761 } 762 ; 763 dst.type = type == null ? null : type.copy(); 764 dst.schedule = schedule == null ? null : schedule.copy(); 765 dst.freeBusyType = freeBusyType == null ? null : freeBusyType.copy(); 766 dst.start = start == null ? null : start.copy(); 767 dst.end = end == null ? null : end.copy(); 768 dst.overbooked = overbooked == null ? null : overbooked.copy(); 769 dst.comment = comment == null ? null : comment.copy(); 770 return dst; 771 } 772 773 protected Slot typedCopy() { 774 return copy(); 775 } 776 777 @Override 778 public boolean equalsDeep(Base other) { 779 if (!super.equalsDeep(other)) 780 return false; 781 if (!(other instanceof Slot)) 782 return false; 783 Slot o = (Slot) other; 784 return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) 785 && compareDeep(schedule, o.schedule, true) && compareDeep(freeBusyType, o.freeBusyType, true) 786 && compareDeep(start, o.start, true) && compareDeep(end, o.end, true) 787 && compareDeep(overbooked, o.overbooked, true) && compareDeep(comment, o.comment, true); 788 } 789 790 @Override 791 public boolean equalsShallow(Base other) { 792 if (!super.equalsShallow(other)) 793 return false; 794 if (!(other instanceof Slot)) 795 return false; 796 Slot o = (Slot) other; 797 return compareValues(freeBusyType, o.freeBusyType, true) && compareValues(start, o.start, true) 798 && compareValues(end, o.end, true) && compareValues(overbooked, o.overbooked, true) 799 && compareValues(comment, o.comment, true); 800 } 801 802 public boolean isEmpty() { 803 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (type == null || type.isEmpty()) 804 && (schedule == null || schedule.isEmpty()) && (freeBusyType == null || freeBusyType.isEmpty()) 805 && (start == null || start.isEmpty()) && (end == null || end.isEmpty()) 806 && (overbooked == null || overbooked.isEmpty()) && (comment == null || comment.isEmpty()); 807 } 808 809 @Override 810 public ResourceType getResourceType() { 811 return ResourceType.Slot; 812 } 813 814 @SearchParamDefinition(name = "schedule", path = "Slot.schedule", description = "The Schedule Resource that we are seeking a slot within", type = "reference") 815 public static final String SP_SCHEDULE = "schedule"; 816 @SearchParamDefinition(name = "identifier", path = "Slot.identifier", description = "A Slot Identifier", type = "token") 817 public static final String SP_IDENTIFIER = "identifier"; 818 @SearchParamDefinition(name = "start", path = "Slot.start", description = "Appointment date/time.", type = "date") 819 public static final String SP_START = "start"; 820 @SearchParamDefinition(name = "slot-type", path = "Slot.type", description = "The type of appointments that can be booked into the slot", type = "token") 821 public static final String SP_SLOTTYPE = "slot-type"; 822 @SearchParamDefinition(name = "fb-type", path = "Slot.freeBusyType", description = "The free/busy status of the appointment", type = "token") 823 public static final String SP_FBTYPE = "fb-type"; 824 825}