public final class SlotService extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addDateAndTimeToSlot(Slot slot)
Form the DTO, adding the date and the time to the slot
|
static List<Slot> |
buildListSlot(int nIdForm,
HashMap<LocalDate,WeekDefinition> mapWeekDefinition,
LocalDate startingDate,
LocalDate endingDate)
Build all the slot for a period with all the rules (open hours ...) to apply on each day, for each slot
|
static HashMap<LocalDateTime,Slot> |
buildMapSlotsByIdFormAndDateRangeWithDateForKey(int nIdForm,
LocalDateTime startingDateTime,
LocalDateTime endingDateTime)
Build a map (Date, Slot) of all the slots found between the two dates
|
static Slot |
buildSlot(int nIdForm,
Period period,
int nMaxCapacity,
int nNbRemainingPlaces,
int nNbPotentialRemainingPlaces,
int nNbPlacesTaken,
boolean bIsOpen,
boolean bIsSpecific)
Build a slot with all its values
|
static Slot |
createSlot(Slot slot)
Create a slot in db
|
static void |
deleteListSlots(List<Slot> listSlotToDelete)
Delete a list of slots
|
static void |
deleteSlot(Slot slot)
Delete a slot
|
static List<Slot> |
findListOpenSlotByIdFormAndDateRange(int nIdForm,
LocalDateTime startingDateTime,
LocalDateTime endingDateTime)
Find the open slots of a form on a given period of time
|
static List<Slot> |
findListSlot(int nIdForm)
Fins all the slots of a form
|
static Slot |
findSlotById(int nIdSlot)
Find a slot with its primary key
|
static List<Slot> |
findSlotsByIdFormAndDateRange(int nIdForm,
LocalDateTime startingDateTime,
LocalDateTime endingDateTime)
Find slots of a form on a given period of time
|
static Slot |
findSlotWithMaxDate(int nIdForm)
Return the slot with the max Date
|
static List<Slot> |
findSpecificSlotsByIdForm(int nIdForm)
Find specific slots of a form
|
static boolean |
isSpecificSlot(Slot slot)
To know if it's a specific slot, need to search for a similar time slot
|
static boolean |
isSpecificSlot(Slot slot,
WorkingDay workingDay,
List<TimeSlot> listTimeSlot,
int nMaxCapacity)
To know if it's a specific slot, need to search for a similar time slot
|
static Slot |
saveSlot(Slot slot)
Save a slot in database
|
static void |
updateRemainingPlaces(Slot slot)
Update the capacity of the slot
|
static Slot |
updateSlot(Slot slot)
Update a slot
|
static void |
updateSlot(Slot slot,
boolean bEndingTimeHasChanged,
LocalTime previousEndingTime,
boolean bShifSlot)
Update a slot in database and possibly all the slots after (if the ending hour has changed, all the next slots are impacted in case of the user decide to
shift the next slots)
|
public static List<Slot> findSlotsByIdFormAndDateRange(int nIdForm, LocalDateTime startingDateTime, LocalDateTime endingDateTime)
nIdForm
- the form IdstartingDateTime
- the starting date time to searchendingDateTime
- the ending date time to searchpublic static List<Slot> findSpecificSlotsByIdForm(int nIdForm)
nIdForm
- the form Idpublic static HashMap<LocalDateTime,Slot> buildMapSlotsByIdFormAndDateRangeWithDateForKey(int nIdForm, LocalDateTime startingDateTime, LocalDateTime endingDateTime)
nIdForm
- the form idstartingDateTime
- the starting date timeendingDateTime
- the ending date timepublic static List<Slot> findListSlot(int nIdForm)
nIdForm
- the form idpublic static List<Slot> findListOpenSlotByIdFormAndDateRange(int nIdForm, LocalDateTime startingDateTime, LocalDateTime endingDateTime)
nIdForm
- the form IdstartingDateTime
- the starting Date time to searchendingDateTime
- the ending Date time to searchpublic static Slot findSlotById(int nIdSlot)
nIdSlot
- the slot Idpublic static List<Slot> buildListSlot(int nIdForm, HashMap<LocalDate,WeekDefinition> mapWeekDefinition, LocalDate startingDate, LocalDate endingDate)
nIdForm
- the form IdmapWeekDefinition
- the map of the week definitionstartingDate
- the starting date of the periodnNbWeeksToDisplay
- the number of weeks to buildpublic static Slot buildSlot(int nIdForm, Period period, int nMaxCapacity, int nNbRemainingPlaces, int nNbPotentialRemainingPlaces, int nNbPlacesTaken, boolean bIsOpen, boolean bIsSpecific)
nIdForm
- the form IdstartingDateTime
- the starting date timeendingDateTime
- the ending date timenMaxCapacity
- the maximum capacity for the slotnNbRemainingPlaces
- the number of remaining places of the slotbIsOpen
- true if the slot is openpublic static boolean isSpecificSlot(Slot slot)
slot
- the slotpublic static boolean isSpecificSlot(Slot slot, WorkingDay workingDay, List<TimeSlot> listTimeSlot, int nMaxCapacity)
slot
- the slotworkingDay
- the working daylistTimeSlot
- the list of time slotspublic static void updateSlot(Slot slot, boolean bEndingTimeHasChanged, LocalTime previousEndingTime, boolean bShifSlot)
slot
- the slot to updatebEndingTimeHasChanged
- true if the ending time has changedpreviousEndingTime
- the previous ending timebShifSlot
- true if the user has decided to shift the next slotspublic static void updateRemainingPlaces(Slot slot)
slot
- the slot to updatepublic static Slot saveSlot(Slot slot)
slot
- the slot to savepublic static Slot updateSlot(Slot slot)
slot
- the slot updatedpublic static void addDateAndTimeToSlot(Slot slot)
slot
- the slot on which to add valuespublic static Slot createSlot(Slot slot)
slot
- the slot to createpublic static void deleteListSlots(List<Slot> listSlotToDelete)
listSlotToDelete
- the lost of slots to deletepublic static void deleteSlot(Slot slot)
slot
- the slot to deletepublic static Slot findSlotWithMaxDate(int nIdForm)
nIdForm
- the form idCopyright © 2020 City of Paris. All rights reserved.