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,
boolean bIsOpen,
boolean bIsSpecific)
Build a slot with all its values
|
static Slot |
createSlot(Slot slot) |
static void |
deleteListSlots(List<Slot> listSlotToDelete)
Delete a list of slots
|
static void |
deleteSlot(Slot slot)
Delete a slot
|
static LocalDate |
findFirstDateOfFreeOpenSlot(int nIdForm,
LocalDate startingDate,
LocalDate endingDate)
Find the first open slot with free places
|
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 Slot |
saveSlot(Slot slot)
Save a slot in database
|
static Slot |
updateSlot(Slot slot)
Update a slot
|
static void |
updateSlot(Slot slot,
boolean bEndingTimeHasChanged,
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 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, 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 void updateSlot(Slot slot, boolean bEndingTimeHasChanged, boolean bShifSlot)
slot
- the slot to updatebEndingTimeHasChanged
- true if the ending time has changedbShifSlot
- true if the user has decided to shift the next slotspublic 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 void deleteListSlots(List<Slot> listSlotToDelete)
listSlotToDelete
- the lost of slots to deletepublic static void deleteSlot(Slot slot)
slot
- the slot to deletepublic static LocalDate findFirstDateOfFreeOpenSlot(int nIdForm, LocalDate startingDate, LocalDate endingDate)
nIdForm
- the form IdstartingDate
- the starting date to searchendingDate
- the ending date to searchpublic static Slot findSlotWithMaxDate(int nIdForm)
nIdForm
- the form idCopyright © 2018 City of Paris. All rights reserved.