Class TimeSlotService
- java.lang.Object
-
- fr.paris.lutece.plugins.appointment.service.TimeSlotService
-
public final class TimeSlotService extends java.lang.ObjectService class for the time slot- Author:
- Laurent Payen
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateListTimeSlot(java.util.List<TimeSlot> listTimeSlotToCreate)Create in database the slots givenstatic TimeSlotcreateTimeSlot(TimeSlot timeSlot)Create a time slot in dbstatic voiddeleteListTimeSlot(java.util.List<TimeSlot> listTimeSlot)Delete in database time slotsstatic voiddeleteTimeSlot(TimeSlot timeSlot)Delete in database time slotstatic java.util.List<TimeSlot>findListTimeSlotAfterThisTimeSlot(TimeSlot timeSlot)Find the next time slots of a given time slotstatic java.util.List<TimeSlot>findListTimeSlotByWorkingDay(int nIdWorkingDay)Find the time slots of a working daystatic TimeSlotfindTimeSlotById(int nIdTimeSlot)Find a timeSlot with its primary keystatic java.util.List<TimeSlot>generateListTimeSlot(int nIdWorkingDay, java.time.LocalTime startingTime, java.time.LocalTime endingTime, int nDuration, int nMaxCapacity, boolean forceTimeSlotCreationWithMinTime)Build a list of timeSlot Object from a starting time to an endingTimestatic TimeSlotgenerateTimeSlot(int nIdWorkingDay, java.time.LocalTime startingTime, java.time.LocalTime endingTime, boolean isOpen, int nMaxCapacity)Build a timeSlot with all its valuesstatic java.util.List<TimeSlot>getListTimeSlotOfAListOfWorkingDay(java.util.List<WorkingDay> listWorkingDay, java.time.LocalDate dateInWeek)Get the time slots of a list of working daysstatic java.util.List<TimeSlot>getNextTimeSlotsInAListOfTimeSlotAfterALocalTime(java.util.List<TimeSlot> listTimeSlot, java.time.LocalTime time)Return an ordered and filtered list of time slots after a given timestatic TimeSlotgetTimeSlotInListOfTimeSlotWithStartingTime(java.util.List<TimeSlot> listTimeSlot, java.time.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(java.util.List<TimeSlot> listTimeSlotToCUpdate)Create in database the slots givenstatic TimeSlotupdateTimeSlot(TimeSlot timeSlot)Update a time slotstatic voidupdateTimeSlot(TimeSlot timeSlot, boolean bEndingTimeHasChanged, java.time.LocalTime previousEndingTime, boolean bShifSlot)Update a timeSLot in database
-
-
-
Method Detail
-
generateListTimeSlot
public static java.util.List<TimeSlot> generateListTimeSlot(int nIdWorkingDay, java.time.LocalTime startingTime, java.time.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, java.time.LocalTime startingTime, java.time.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 java.util.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, java.time.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(java.util.List<TimeSlot> listTimeSlotToCreate)
Create in database the slots given- Parameters:
listSlotToCreate- the list of slots to create in database
-
updateListTimeSlot
public static void updateListTimeSlot(java.util.List<TimeSlot> listTimeSlotToCUpdate)
Create in database the slots given- Parameters:
listSlotToCreate- the list of slots to create in database
-
findListTimeSlotAfterThisTimeSlot
public static java.util.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(java.util.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 java.util.List<TimeSlot> getListTimeSlotOfAListOfWorkingDay(java.util.List<WorkingDay> listWorkingDay, java.time.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 java.util.List<TimeSlot> getNextTimeSlotsInAListOfTimeSlotAfterALocalTime(java.util.List<TimeSlot> listTimeSlot, java.time.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(java.util.List<TimeSlot> listTimeSlot, java.time.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
-
-