Class TimeSlotService
java.lang.Object
fr.paris.lutece.plugins.appointment.service.TimeSlotService
Service class for the time slot
- Author:
- Laurent Payen
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 slotfindListTimeSlotAfterThisTimeSlot(TimeSlot timeSlot) Find the next time slots of a given time slotfindListTimeSlotByWorkingDay(int nIdWorkingDay) Find the time slots of a working daystatic TimeSlotfindTimeSlotById(int nIdTimeSlot) Find a timeSlot with its primary keygenerateListTimeSlot(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 valuesgetListTimeSlotOfAListOfWorkingDay(List<WorkingDay> listWorkingDay, LocalDate dateInWeek) Get the time slots of a list of working daysgetNextTimeSlotsInAListOfTimeSlotAfterALocalTime(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 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 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
Save a time slot- Parameters:
timeSlot- the time slot to save- Returns:
- the time slot saved
-
createTimeSlot
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
Find the time slots of a working day- Parameters:
nIdWorkingDay- the working day Id- Returns:
- the list of the timeSlot of this workingDay
-
findTimeSlotById
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
Update a time slot- Parameters:
timeSlot- the time slot to update
-
createListTimeSlot
Create in database the slots given- Parameters:
listSlotToCreate- the list of slots to create in database
-
updateListTimeSlot
Create in database the slots given- Parameters:
listSlotToCreate- the list of slots to create in database
-
findListTimeSlotAfterThisTimeSlot
Find the next time slots of a given time slot- Parameters:
timeSlot- the time slot- Returns:
- a list of the next time slots
-
deleteListTimeSlot
Delete in database time slots- Parameters:
listTimeSlot- the list of time slots to delete
-
deleteTimeSlot
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
-