Class WorkingDayService


  • public final class WorkingDayService
    extends java.lang.Object
    Service class of a working day
    Author:
    Laurent Payen
    • Method Detail

      • generateWorkingDay

        public static WorkingDay generateWorkingDay​(int nIdReservationRule,
                                                    java.time.DayOfWeek dayOfWeek)
        Create in database a working day object with the given parameters
        Parameters:
        nIdReservationRule - the week rule Id
        dayOfWeek - the day of week
        Returns:
        the working day object built
      • saveWorkingDay

        public static WorkingDay saveWorkingDay​(WorkingDay workingDay)
        Save a working day
        Parameters:
        workingDay - the working day to save
        Returns:
        the working day saved
      • generateWorkingDayAndListTimeSlot

        public static void generateWorkingDayAndListTimeSlot​(int nIdReservationRule,
                                                             java.time.DayOfWeek dayOfWeek,
                                                             java.time.LocalTime startingTime,
                                                             java.time.LocalTime endingTime,
                                                             int nDuration,
                                                             int nMaxCapacity)
        Create in database a working day and its time slots
        Parameters:
        nIdReservationRule - the week rule Id
        dayOfWeek - the day of week of the woking day
        startingTime - the starting time of the working day
        endingTime - the ending time of the working day
        nDuration - the duration of the time slot of the working day
        nMaxCapacity - the max capacity for the slots of the working day
      • getOpenDays

        public static java.util.List<java.time.DayOfWeek> getOpenDays​(AppointmentFormDTO appointmentForm)
        Get the open days of an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        Returns:
        the list of day of week opened
      • findListWorkingDayByWeekDefinitionRule

        public static java.util.List<WorkingDay> findListWorkingDayByWeekDefinitionRule​(int nIdWeekDefinitionRule)
        Find the working days of a week definition
        Parameters:
        nIdWeekDefinition - the week definition Id
        Returns:
        a list of the working days of the week definition
      • deleteListWorkingDay

        public static void deleteListWorkingDay​(java.util.List<WorkingDay> listWorkingDay)
        Delete a list of working days
        Parameters:
        listWorkingDay - the list of working days to delete
      • findWorkingDayLightById

        public static WorkingDay findWorkingDayLightById​(int nIdWorkingDay)
        Find a working day with its primary key
        Parameters:
        nIdWorkingDay - the working day Id
        Returns:
        the working day found
      • findWorkingDayById

        public static WorkingDay findWorkingDayById​(int nIdWorkingDay)
        Find a working day and set its time slots
        Parameters:
        nIdWorkingDay - the working day Id
        Returns:
        the working day found with its time slots
      • getMaxEndingTimeOfAWorkingDay

        public static java.time.LocalTime getMaxEndingTimeOfAWorkingDay​(WorkingDay workingDay)
        Get the max ending time of a working day
        Parameters:
        workingDay - the working day
        Returns:
        the max ending time of the working day
      • getMaxEndingTimeOfAListOfWorkingDay

        public static java.time.LocalTime getMaxEndingTimeOfAListOfWorkingDay​(java.util.List<WorkingDay> listWorkingDay)
        Get the max ending time of a list of working days
        Parameters:
        listWorkingDay - the list of working days
        Returns:
        the max ending time of the working days
      • getMinStartingTimeOfAWorkingDay

        public static java.time.LocalTime getMinStartingTimeOfAWorkingDay​(WorkingDay workingDay)
        Get the min starting time of a working day
        Parameters:
        workingDay - the working day
        Returns:
        the min starting time of the working day
      • getMinStartingTimeOfAListOfWorkingDay

        public static java.time.LocalTime getMinStartingTimeOfAListOfWorkingDay​(java.util.List<WorkingDay> listWorkingDay)
        Get the min starting time of a list of working days
        Parameters:
        listWorkingDay - the list of working days
        Returns:
        the min starting time of the working days
      • getMinDurationTimeSlotOfAWorkingDay

        public static int getMinDurationTimeSlotOfAWorkingDay​(WorkingDay workingDay)
        Get the min duration slot of a working day
        Parameters:
        workingDay - the working day
        Returns:
        the min duration slot of a working day
      • getMinDurationTimeSlotOfAListOfWorkingDay

        public static int getMinDurationTimeSlotOfAListOfWorkingDay​(java.util.List<WorkingDay> listWorkingDay)
        Get the min duration slot of a list of working days
        Parameters:
        listWorkingDay - the list of working days
        Returns:
        the min duration slot of the working days
      • getSetDaysOfWeekOfAListOfWorkingDayForFullCalendar

        public static java.util.HashSet<java.lang.String> getSetDaysOfWeekOfAListOfWorkingDayForFullCalendar​(java.util.List<WorkingDay> listWorkingDay)
        Get all the day of week of working days
        Parameters:
        listWorkingDay - the list of working days
        Returns:
        a set of day of week
      • getWorkingDayOfDayOfWeek

        public static WorkingDay getWorkingDayOfDayOfWeek​(java.util.List<WorkingDay> listWorkingDay,
                                                          java.time.DayOfWeek dayOfWeek)
        Find the working day in a list of working day which matches the day of week given
        Parameters:
        listWorkingDay - the list of working days
        dayOfWeek - the day of week to search
        Returns:
        the working day that matches