Class TimeSlotService

java.lang.Object
fr.paris.lutece.plugins.appointment.service.TimeSlotService

public final class TimeSlotService extends Object
Service class for the time slot
Author:
Laurent Payen
  • Method Details

    • generateListTimeSlot

      public static List<TimeSlot> generateListTimeSlot(int nIdWorkingDay, LocalTime startingTime, LocalTime endingTime, int nDuration, int nMaxCapacity, boolean forceTimeSlotCreationWithMinTime)
      Build a list of timeSlot Object from a starting time to an endingTime
      Parameters:
      nIdWorkingDay - the workingDay Id
      startingTime - the starting time
      endingTime - the ending time
      nDuration - the duration of the slot
      nMaxCapacity - the maximum capacity of the slot
      Returns:
      the list of TimeSlot built
    • saveTimeSlot

      public static TimeSlot saveTimeSlot(TimeSlot timeSlot)
      Save a time slot
      Parameters:
      timeSlot - the time slot to save
      Returns:
      the time slot saved
    • createTimeSlot

      public static TimeSlot createTimeSlot(TimeSlot timeSlot)
      Create a time slot in db
      Parameters:
      timeSlot - the time slot to create
      Returns:
      the time slot created
    • generateTimeSlot

      public static TimeSlot generateTimeSlot(int nIdWorkingDay, LocalTime startingTime, LocalTime endingTime, boolean isOpen, int nMaxCapacity)
      Build a timeSlot with all its values
      Parameters:
      nIdWorkingDay - the workingDay Id
      startingTime - the starting time
      endingTime - the ending time
      isOpen - true if the slot is open
      nMaxCapacity - the maximum capacity of the slot
      Returns:
      the timeSLot built
    • findListTimeSlotByWorkingDay

      public static List<TimeSlot> findListTimeSlotByWorkingDay(int nIdWorkingDay)
      Find the time slots of a working day
      Parameters:
      nIdWorkingDay - the working day Id
      Returns:
      the list of the timeSlot of this workingDay
    • findTimeSlotById

      public static TimeSlot findTimeSlotById(int nIdTimeSlot)
      Find a timeSlot with its primary key
      Parameters:
      nIdTimeSlot - the timeSlot Id
      Returns:
      the timeSlot found
    • updateTimeSlot

      public static void updateTimeSlot(TimeSlot timeSlot, boolean bEndingTimeHasChanged, LocalTime previousEndingTime, boolean bShifSlot)
      Update a timeSLot in database
      Parameters:
      timeSlot - the timeSlot to update
      bEndingTimeHasChanged - if the ending time has changed, need to regenerate and update all the next time slots
      previousEndingTime - the previous ending time of the current time slot
      bShifSlot - true if the user has decided to shift the next slots
    • updateTimeSlot

      public static TimeSlot updateTimeSlot(TimeSlot timeSlot)
      Update a time slot
      Parameters:
      timeSlot - the time slot to update
    • createListTimeSlot

      public static void createListTimeSlot(List<TimeSlot> listTimeSlotToCreate)
      Create in database the slots given
      Parameters:
      listSlotToCreate - the list of slots to create in database
    • updateListTimeSlot

      public static void updateListTimeSlot(List<TimeSlot> listTimeSlotToCUpdate)
      Create in database the slots given
      Parameters:
      listSlotToCreate - the list of slots to create in database
    • findListTimeSlotAfterThisTimeSlot

      public static List<TimeSlot> findListTimeSlotAfterThisTimeSlot(TimeSlot timeSlot)
      Find the next time slots of a given time slot
      Parameters:
      timeSlot - the time slot
      Returns:
      a list of the next time slots
    • deleteListTimeSlot

      public static void deleteListTimeSlot(List<TimeSlot> listTimeSlot)
      Delete in database time slots
      Parameters:
      listTimeSlot - the list of time slots to delete
    • deleteTimeSlot

      public static void deleteTimeSlot(TimeSlot timeSlot)
      Delete in database time slot
      Parameters:
      timeSlot - the time slot to delete
    • getListTimeSlotOfAListOfWorkingDay

      public static List<TimeSlot> getListTimeSlotOfAListOfWorkingDay(List<WorkingDay> listWorkingDay, LocalDate dateInWeek)
      Get the time slots of a list of working days
      Parameters:
      listWorkingDay - the list of the working days
      dateInWeek - the date in the week
      Returns:
      the list of the time slots
    • getNextTimeSlotsInAListOfTimeSlotAfterALocalTime

      public static List<TimeSlot> getNextTimeSlotsInAListOfTimeSlotAfterALocalTime(List<TimeSlot> listTimeSlot, LocalTime time)
      Return an ordered and filtered list of time slots after a given time
      Parameters:
      listTimeSlot - the list of time slot to sort and filter
      time - the time
      Returns:
      the list ordered and filtered
    • getTimeSlotInListOfTimeSlotWithStartingTime

      public static TimeSlot getTimeSlotInListOfTimeSlotWithStartingTime(List<TimeSlot> listTimeSlot, LocalTime timeToSearch)
      Returns the time slot in a list of time slot with the given starting time
      Parameters:
      listTimeSlot - the list of time slots
      timeToSearch - the starting time to search
      Returns:
      the time slot found