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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateListTimeSlot(List<TimeSlot> listTimeSlotToCreate)Create in database the slots givenstatic TimeSlotcreateTimeSlot(TimeSlot timeSlot)Create a time slot in dbstatic voiddeleteListTimeSlot(List<TimeSlot> listTimeSlot)Delete in database time slotsstatic voiddeleteTimeSlot(TimeSlot timeSlot)Delete in database time slotstatic List<TimeSlot>findListTimeSlotAfterThisTimeSlot(TimeSlot timeSlot)Find the next time slots of a given time slotstatic List<TimeSlot>findListTimeSlotByWorkingDay(int nIdWorkingDay)Find the time slots of a working daystatic TimeSlotfindTimeSlotById(int nIdTimeSlot)Find a timeSlot with its primary keystatic 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 endingTimestatic TimeSlotgenerateTimeSlot(int nIdWorkingDay, LocalTime startingTime, LocalTime endingTime, boolean isOpen, int nMaxCapacity)Build a timeSlot with all its valuesstatic List<TimeSlot>getListTimeSlotOfAListOfWorkingDay(List<WorkingDay> listWorkingDay, LocalDate dateInWeek)Get the time slots of a list of working daysstatic List<TimeSlot>getNextTimeSlotsInAListOfTimeSlotAfterALocalTime(List<TimeSlot> listTimeSlot, LocalTime time)Return an ordered and filtered list of time slots after a given timestatic TimeSlotgetTimeSlotInListOfTimeSlotWithStartingTime(List<TimeSlot> listTimeSlot, LocalTime timeToSearch)Returns the time slot in a list of time slot with the given starting timestatic TimeSlotsaveTimeSlot(TimeSlot timeSlot)Save a time slotstatic voidupdateListTimeSlot(List<TimeSlot> listTimeSlotToCUpdate)Create in database the slots givenstatic TimeSlotupdateTimeSlot(TimeSlot timeSlot)Update a time slotstatic voidupdateTimeSlot(TimeSlot timeSlot, boolean bEndingTimeHasChanged, LocalTime previousEndingTime, boolean bShifSlot)Update a timeSLot in database
-
-
-
Method Detail
-
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 IdstartingTime- the starting timeendingTime- the ending timenDuration- the duration of the slotnMaxCapacity- 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 IdstartingTime- the starting timeendingTime- the ending timeisOpen- true if the slot is opennMaxCapacity- 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 updatebEndingTimeHasChanged- if the ending time has changed, need to regenerate and update all the next time slotspreviousEndingTime- the previous ending time of the current time slotbShifSlot- 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 daysdateInWeek- 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 filtertime- 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 slotstimeToSearch- the starting time to search- Returns:
- the time slot found
-
-