Class FreeSlotQueryResultBuilder

java.lang.Object
de.xima.fc.appointment.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 Details

    • 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 Details

    • 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

      Creates the free slots from the data of this builder.
      Returns:
      The free slots from the data of this builder.
    • empty

      public static IAppointmentFreeSlotQueryResult empty()
      Returns:
      A query result that is empty.
    • emptyWithZone

      public static IAppointmentFreeSlotQueryResult emptyWithZone(ZoneId zoneId)
      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.