Class FreeSlotQueryResultBuilder


  • public final class FreeSlotQueryResultBuilder
    extends Object
    Builder for a IAppointmentFreeSlotQueryParams. Handles blocking free slots with existing appointments.
    Since:
    6.5.0
    Author:
    XIMA MEDIA GmbH
    • Constructor Detail

      • FreeSlotQueryResultBuilder

        public FreeSlotQueryResultBuilder​(ZoneId targetZone)
        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 Detail

      • addBlocker

        public FreeSlotQueryResultBuilder addBlocker​(Instant instantFrom,
                                                     Instant instantUntil)
        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

        public FreeSlotQueryResultBuilder appointmentType​(AppointmentType appointmentType)
        Parameters:
        appointmentType - The appointment type for which the appointment slots are meant for.
        Returns:
        This for chaining.
      • appointmentType

        public FreeSlotQueryResultBuilder appointmentType​(String appointmentType)
        Parameters:
        appointmentType - The appointment type for which the appointment slots are meant for.
        Returns:
        This for chaining.
      • appointmentType

        public FreeSlotQueryResultBuilder appointmentType​(UUID appointmentType)
        Parameters:
        appointmentType - The appointment type for which the appointment slots are meant for.
        Returns:
        This for chaining.
      • build

        public IAppointmentFreeSlotQueryResult build()
        Creates the free slots from the data of this builder.
        Returns:
        The free slots from the data of this builder.