Package de.xima.fc.appointment
Class FreeSlotQueryResultBuilder
java.lang.Object
de.xima.fc.appointment.FreeSlotQueryResultBuilder
Builder for a
IAppointmentFreeSlotQueryParams
. Handles blocking free slots with existing appointments.- Since:
- 6.5.0
- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
ConstructorsConstructorDescriptionFreeSlotQueryResultBuilder
(ZoneId targetZone) Creates a new frees slot builder that outputs free slots in the given target time zone. -
Method Summary
Modifier and TypeMethodDescriptionaddBlocker
(Instant instantFrom, Instant instantUntil) Adds a blocker to this builder, such as an appointment that is booked already.addFreeSlot
(com.google.common.collect.Range<ZonedDateTime> range, long capacity) Adds an available slot to this builder.appointmentType
(AppointmentType appointmentType) appointmentType
(String appointmentType) appointmentType
(UUID appointmentType) build()
Creates the free slots from the data of this builder.empty()
emptyWithZone
(ZoneId zoneId)
-
Constructor Details
-
FreeSlotQueryResultBuilder
Creates a new frees slot builder that outputs free slots in the given target time zone.- Parameters:
targetZone
- Zone ID in which the results are returned.
-
-
Method Details
-
addBlocker
Adds a blocker to this builder, such as an appointment that is booked already. A free slot that overlaps with a block cannot be booked and is excluded.- Parameters:
instantFrom
- Start date and time of the blocker.instantUntil
- End date and time of the blocker.- Returns:
- This for chaining.
-
addFreeSlot
public FreeSlotQueryResultBuilder addFreeSlot(com.google.common.collect.Range<ZonedDateTime> range, long capacity) Adds an available slot to this builder.- Parameters:
range
- Start and end time of the slot.capacity
- Capacity of the slot.- Returns:
- This for chaining.
-
appointmentType
- Parameters:
appointmentType
- The appointment type for which the appointment slots are meant for.- Returns:
- This for chaining.
-
appointmentType
- Parameters:
appointmentType
- The appointment type for which the appointment slots are meant for.- Returns:
- This for chaining.
-
appointmentType
- Parameters:
appointmentType
- The appointment type for which the appointment slots are meant for.- Returns:
- This for chaining.
-
build
Creates the free slots from the data of this builder.- Returns:
- The free slots from the data of this builder.
-
empty
- Returns:
- A query result that is empty.
-
emptyWithZone
- Parameters:
zoneId
- Zone ID to set on the result (IAppointmentFreeSlotQueryResult.getZoneId()
). As no times are returned, this has no effect.- Returns:
- A query result that is empty.
-