public final class AppointmentUtilities extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_MESSAGE_CONFIRM_EMAIL |
static String |
ERROR_MESSAGE_DATE_APPOINTMENT |
static String |
ERROR_MESSAGE_EMPTY_CONFIRM_EMAIL |
static String |
ERROR_MESSAGE_EMPTY_EMAIL |
static String |
ERROR_MESSAGE_EMPTY_NB_BOOKED_SEAT |
static String |
ERROR_MESSAGE_ERROR_NB_BOOKED_SEAT |
static String |
ERROR_MESSAGE_FORMAT_NB_BOOKED_SEAT |
static String |
MARK_PERMISSION_ACCESS_CODE |
static String |
MARK_PERMISSION_ADD_COMMENT |
static String |
MARK_PERMISSION_MODERATE_COMMENT |
static String |
PROPERTY_DEFAULT_EXPIRED_TIME_EDIT_APPOINTMENT |
static String |
SESSION_TASK_TIMER_SLOT |
static int |
THIRTY_MINUTES |
| Modifier and Type | Method and Description |
|---|---|
static List<ResponseRecapDTO> |
buildListResponse(AppointmentDTO appointment,
javax.servlet.http.HttpServletRequest request,
Locale locale)
Build a list of response of the appointment
|
static void |
cancelTaskTimer(javax.servlet.http.HttpServletRequest request,
int idSlot)
Attempts to cancel execution of the task.
|
static int |
checkAndReturnNbBookedSeats(String strNbBookedSeats,
AppointmentFormDTO form,
AppointmentDTO appointmentDTO,
Locale locale,
List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
Check and validate all the rules for the number of booked seats asked
|
static void |
checkDateOfTheAppointmentIsNotBeforeNow(AppointmentDTO appointmentDTO,
Locale locale,
List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
Check that the date of the appointment we try to take is not in the past
|
static void |
checkEmail(String strEmail,
String strConfirmEmail,
AppointmentFormDTO form,
Locale locale,
List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
Check that the email is correct and matches the confirm email
|
static boolean |
checkListSlotIsBuildedCorrectly(int nIdForm,
List<Slot> listSlots)
Check if list of slot is builded correctly
|
static boolean |
checkNbDaysBetweenTwoAppointments(AppointmentDTO appointmentDTO,
String strEmail,
AppointmentFormDTO form)
Check that the delay between two appointments for the same use has been respected
|
static boolean |
checkNbDaysBetweenTwoAppointmentsTaken(AppointmentDTO appointmentDTO,
String strEmail,
AppointmentFormDTO form)
Check that the delay between two appointments for the same use has been respected
|
static boolean |
checkNbMaxAppointmentsDefinedOnCategory(AppointmentDTO appointmentDTO,
String strEmail,
AppointmentFormDTO form,
List<AppointmentDTO> listAppointments)
Check that the number of appointments on a defined category is not above the maximum authorized
|
static boolean |
checkNbMaxAppointmentsOnAGivenPeriod(AppointmentDTO appointmentDTO,
String strEmail,
AppointmentFormDTO form)
Check that the number of appointments on a defined period is not above the maximum authorized
|
static boolean |
checkNoAppointmentsImpacted(List<Appointment> listAppointment,
int nIdForm,
int nIdreservationRule,
AppointmentFormDTO appointmentForm)
Check if there are appointments impacted by the new week definition
|
static boolean |
checkNoAppointmentsImpacted(List<Appointment> listAppointment,
int nIdForm,
LocalDate dateOfModification,
AppointmentFormDTO appointmentForm)
Check if there are appointments impacted by the new week definition
|
static boolean |
checkNoAppointmentsImpacted(List<Slot> listSlotWithAppointment,
AppointmentFormDTO appointmentForm)
Check if there are appointments impacted by the new week definition
|
static boolean |
checkNoAppointmentsImpacted(List<Slot> listSlotsImpacted,
int idReservationRule)
Check if there are appointments impacted by the new week definition
|
static boolean |
checkNoValidatedAppointmentsOnThisSlot(Slot slot)
Check that there is no validated appointments on a slot
|
static void |
fillAppointmentDTO(AppointmentDTO appointmentDTO,
int nbBookedSeats,
String strEmail,
String strEmailConfirm,
String strFirstName,
String strLastName)
Fill the appoinmentFront DTO with the given parameters
|
static void |
fillInListResponseWithMapResponse(AppointmentDTO appointmentDTO) |
static void |
fillInReservationRuleAdvancedParam(ReservationRuleDTO reservationRuleDTO,
AppointmentFormDTO appointmentForm)
Fill the reservation rule object with the corresponding values of an appointmentForm DTO
|
static List<Slot> |
findSlotsImpactedByThisTimeSlot(TimeSlot timeSlot,
int nIdForm,
int nIdWeekDefinition,
boolean bShiftSlot)
Return the slots impacted by the modification of this time slot
|
static LocalDateTime |
getEndingDateTime(Appointment appointmentDTO) |
static LocalTime |
getMaxTimeToDisplay(LocalTime maxEndingTime)
Return the max ending time to display
|
static LocalTime |
getMinTimeToDisplay(LocalTime minStartingTime)
Return the min starting time to display
|
static String[][] |
getPermissions(List<AppointmentFormDTO> listForms,
fr.paris.lutece.portal.business.user.AdminUser user)
Get Form Permissions
|
static LocalDateTime |
getStartingDateTime(Appointment appointmentDTO) |
static boolean |
isConsecutiveSlots(List<Slot> allSlots)
return true if all slots are consecutive
|
static boolean |
isEditSlotTaskExpiredTime(javax.servlet.http.HttpServletRequest request,
int idSlot) |
static ScheduledFuture<Slot> |
putTimerInSession(javax.servlet.http.HttpServletRequest request,
int nIdSlot,
AppointmentDTO appointmentDTO,
int maxPeoplePerAppointment)
Create a timer on a slot
|
static void |
shutdownSecheduledExecutor()
The following method shuts down the _executorService in two phases, first by calling shutdown to reject incoming tasks, and then calling shutdownNow, if
necessary, to cancel any lingering tasks:
|
static void |
validateFormAndEntries(AppointmentDTO appointmentDTO,
javax.servlet.http.HttpServletRequest request,
List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors,
boolean allEntries)
Validate the form and the additional entries of the form
|
static boolean |
weekIsOpenInFO(AppointmentFormDTO appointmentFormDTO,
List<WeekDefinition> listWeek,
Locale locale)
check if one of the weeks in the list is open on the FO calendar
|
public static final String ERROR_MESSAGE_EMPTY_CONFIRM_EMAIL
public static final String ERROR_MESSAGE_CONFIRM_EMAIL
public static final String ERROR_MESSAGE_DATE_APPOINTMENT
public static final String ERROR_MESSAGE_EMPTY_EMAIL
public static final String ERROR_MESSAGE_EMPTY_NB_BOOKED_SEAT
public static final String ERROR_MESSAGE_FORMAT_NB_BOOKED_SEAT
public static final String ERROR_MESSAGE_ERROR_NB_BOOKED_SEAT
public static final String MARK_PERMISSION_ADD_COMMENT
public static final String MARK_PERMISSION_MODERATE_COMMENT
public static final String MARK_PERMISSION_ACCESS_CODE
public static final String SESSION_TASK_TIMER_SLOT
public static final String PROPERTY_DEFAULT_EXPIRED_TIME_EDIT_APPOINTMENT
public static final int THIRTY_MINUTES
public static void checkEmail(String strEmail, String strConfirmEmail, AppointmentFormDTO form, Locale locale, List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
strEmail - the emailstrConfirmEmail - the confirm emailform - the formlocale - the locallistFormErrors - the list of errors that can be fill in with the errors found for the emailpublic static void checkDateOfTheAppointmentIsNotBeforeNow(AppointmentDTO appointmentDTO, Locale locale, List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
appointmentDTO - the appointmentlocale - the locallistFormErrors - the list of errors that can be fill in with the error found with the datepublic static boolean checkNbDaysBetweenTwoAppointments(AppointmentDTO appointmentDTO, String strEmail, AppointmentFormDTO form)
appointmentDTO - the appointmentstrEmail - the emailform - the formpublic static boolean checkNbDaysBetweenTwoAppointmentsTaken(AppointmentDTO appointmentDTO, String strEmail, AppointmentFormDTO form)
appointmentDTO - the appointmentstrEmail - the emailform - the formpublic static boolean checkNbMaxAppointmentsOnAGivenPeriod(AppointmentDTO appointmentDTO, String strEmail, AppointmentFormDTO form)
appointmentDTO - the appointmentstrEmail - the email of the userform - the formpublic static boolean checkNbMaxAppointmentsDefinedOnCategory(AppointmentDTO appointmentDTO, String strEmail, AppointmentFormDTO form, List<AppointmentDTO> listAppointments)
appointmentDTO - the appointmentstrEmail - the email of the userform - the formpublic static int checkAndReturnNbBookedSeats(String strNbBookedSeats, AppointmentFormDTO form, AppointmentDTO appointmentDTO, Locale locale, List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors)
strNbBookedSeats - the number of booked seatsform - the formnbRemainingPlaces - the number of remaining places on the slot askedlocale - the localelistFormErrors - the list of errors that can be fill in with the errors found for the number of booked seatspublic static void fillAppointmentDTO(AppointmentDTO appointmentDTO, int nbBookedSeats, String strEmail, String strEmailConfirm, String strFirstName, String strLastName)
appointmentDTO - the appointmentFront DTOnbBookedSeats - the number of booked seatsstrEmail - the email of the userstrFirstName - the first name of the userstrLastName - the last name of the userpublic static void validateFormAndEntries(AppointmentDTO appointmentDTO, javax.servlet.http.HttpServletRequest request, List<fr.paris.lutece.plugins.genericattributes.business.GenericAttributeError> listFormErrors, boolean allEntries)
appointmentDTO - the appointmentFron DTo to validaterequest - the requestlistFormErrors - the list of errors that can be fill with the errors found at the validationpublic static void fillInListResponseWithMapResponse(AppointmentDTO appointmentDTO)
public static List<ResponseRecapDTO> buildListResponse(AppointmentDTO appointment, javax.servlet.http.HttpServletRequest request, Locale locale)
appointment - the appointmentrequest - the requestlocale - the localpublic static void cancelTaskTimer(javax.servlet.http.HttpServletRequest request,
int idSlot)
request - the requestidSlot - the id Slotpublic static boolean isEditSlotTaskExpiredTime(javax.servlet.http.HttpServletRequest request,
int idSlot)
public static ScheduledFuture<Slot> putTimerInSession(javax.servlet.http.HttpServletRequest request, int nIdSlot, AppointmentDTO appointmentDTO, int maxPeoplePerAppointment)
slot - the slotappointmentDTO - the appointmentmaxPeoplePerAppointment - the max people per appointmentpublic static String[][] getPermissions(List<AppointmentFormDTO> listForms, fr.paris.lutece.portal.business.user.AdminUser user)
listForms - request - public static LocalTime getMinTimeToDisplay(LocalTime minStartingTime)
minStartingTime - the min starting timepublic static LocalTime getMaxTimeToDisplay(LocalTime maxEndingTime)
maxEndingTime - the max ending timepublic static boolean checkNoAppointmentsImpacted(List<Appointment> listAppointment, int nIdForm, LocalDate dateOfModification, AppointmentFormDTO appointmentForm)
listAppointment - the list of appointmentsnIdForm - the form IddateOfModification - the date of modification (date of apply of the new week definition)appointmentForm - the appointment formpublic static boolean checkNoAppointmentsImpacted(List<Appointment> listAppointment, int nIdForm, int nIdreservationRule, AppointmentFormDTO appointmentForm)
listAppointment - the list of appointmentsnIdForm - the form IdnIdreservationRule - the reservationRule idappointmentForm - the appointment formpublic static boolean checkNoAppointmentsImpacted(List<Slot> listSlotWithAppointment, AppointmentFormDTO appointmentForm)
listSlotsImpacted - the list of slot impactedappointmentForm - the appointment formpublic static boolean checkNoAppointmentsImpacted(List<Slot> listSlotsImpacted, int idReservationRule)
listSlotsImpacted - the list of slot impactednewReservationRule - the reservation rulepublic static boolean checkNoValidatedAppointmentsOnThisSlot(Slot slot)
slot - the slotpublic static List<Slot> findSlotsImpactedByThisTimeSlot(TimeSlot timeSlot, int nIdForm, int nIdWeekDefinition, boolean bShiftSlot)
timeSlot - the time slotnIdForm - the form idnIdWeekDefinition - the week definition idbShiftSlot - the boolean value for the shiftpublic static LocalDateTime getStartingDateTime(Appointment appointmentDTO)
public static LocalDateTime getEndingDateTime(Appointment appointmentDTO)
public static boolean isConsecutiveSlots(List<Slot> allSlots)
allSlots - the list of slotspublic static void fillInReservationRuleAdvancedParam(ReservationRuleDTO reservationRuleDTO, AppointmentFormDTO appointmentForm)
reservationRuleDTO - the reservation rule object to fill inappointmentForm - the appointmentForm DTOpublic static boolean weekIsOpenInFO(AppointmentFormDTO appointmentFormDTO, List<WeekDefinition> listWeek, Locale locale)
appointmentFormDTO - the appointment formlistWeek - the list of weekDefinitionlocale - the localepublic static boolean checkListSlotIsBuildedCorrectly(int nIdForm,
List<Slot> listSlots)
nIdForm - the id formlistSlots - the list of slot to checkpublic static void shutdownSecheduledExecutor()
Copyright © 2023 City of Paris. All rights reserved.