Class ReservationRuleService


  • public final class ReservationRuleService
    extends java.lang.Object
    Service class for the reservation rule
    Author:
    Laurent Payen
    • Method Detail

      • createReservationRule

        public static ReservationRule createReservationRule​(AppointmentFormDTO appointmentForm,
                                                            int nIdForm)
        Create in database a reservation rule object from an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        nIdForm - the form Id
        dateOfApply - the date of the reservation rule
        Returns:
        the Reservation Rule object created
      • createTypicalWeek

        public static int createTypicalWeek​(AppointmentFormDTO appointmentForm)
        Create in database a reservation rule object from an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        Returns:
        the Reservation Rule id
      • copyReservationRule

        public static int copyReservationRule​(int nIdReservationRule)
        Make a copy of typical week, with all its values
        Parameters:
        nIdReservationRule - the reservationRule Id to copy
        Returns:
        the id of the reservation rule created
      • updateAdvancedParameters

        public static void updateAdvancedParameters​(AppointmentFormDTO appointmentForm)
        Update a form with the new values of an appointmentForm DTO Advanced Parameters (with a date of application) --> new Typical Week
        Parameters:
        appointmentForm - the appointmentForm DTO
      • removeReservationRule

        public static void removeReservationRule​(int nIdReservationRule)
        Delete a reservation rule by its id
        Parameters:
        reservationRule - the reservation rule to delete
      • saveReservationRule

        public static void saveReservationRule​(ReservationRule reservationRule)
        save a reservation rule
        Parameters:
        reservationRule - the reservation rule to save
      • updateReservationRule

        public static ReservationRule updateReservationRule​(AppointmentFormDTO appointmentForm,
                                                            int nIdForm)
        Update in database a reservation rule with the values of an appointmentForm DTO
        Parameters:
        appointmentForm - the appointmentForm DTO
        nIdForm - the form Id
        Returns:
        the reservation rule object updated
      • fillInReservationRule

        public static void fillInReservationRule​(ReservationRule reservationRule,
                                                 AppointmentFormDTO appointmentForm,
                                                 int nIdForm)
        Fill the reservation rule object with the corresponding values of an appointmentForm DTO
        Parameters:
        reservationRule - the reservation rule object to fill in
        appointmentForm - the appointmentForm DTO
        nIdForm - the form Id
      • findReservationRuleByIdFormAndClosestToDateOfApply

        public static ReservationRule findReservationRuleByIdFormAndClosestToDateOfApply​(int nIdForm,
                                                                                         java.time.LocalDate dateOfApply)
        Find in database a reservation rule of a form closest to a date
        Parameters:
        nIdForm - the form Id
        dateOfApply - the date
        Returns:
        the reservation rule to apply at this date
      • findReservationRuleByIdFormAndDateOfApply

        public static ReservationRule findReservationRuleByIdFormAndDateOfApply​(int nIdForm,
                                                                                java.time.LocalDate dateOfApply)
        Find the reservation rule of a form on a specific date
        Parameters:
        nIdForm - the form Id
        dateOfApply - the date of the reservation rule
        Returns:
        the reservation rule object
      • findReservationRuleById

        public static ReservationRule findReservationRuleById​(int nIdReservationRule)
        Find a reservation rule with its primary key
        Parameters:
        nIdReservationRule - the reservation rule Id
        Returns:
        the Reservation Rule Object
      • findAllReservationRule

        public static fr.paris.lutece.util.ReferenceList findAllReservationRule​(int nIdForm)
        Build a reference list of all reservation rules of a form
        Parameters:
        nIdForm - the form Id
        Returns:
        the reference list (id reservation rule / date of apply of the reservation rule)
      • findAllReservationRule

        public static java.util.Map<WeekDefinition,​ReservationRule> findAllReservationRule​(int nIdForm,
                                                                                                 java.util.Collection<WeekDefinition> listWeekDefinition)
        Find all the reservation rule of a form
        Parameters:
        nIdForm - the form Id
        Returns:
        an HashMap with the date of apply in key and the reservation rule in value
      • findListReservationRule

        public static java.util.List<ReservationRule> findListReservationRule​(int nIdForm)
        Returns a list of the reservation rules of a form
        Parameters:
        nIdForm - the form id
        Returns:
        a list of reservation rules of the form
      • findListReservationRule

        public static java.util.List<ReservationRule> findListReservationRule​(int nIdForm,
                                                                              java.util.Collection<WeekDefinition> listWeekDefinition)
        Returns a list of the reservation rules of a form
        Parameters:
        nIdForm - the form id
        listWeekDefinition - the week definition list
        Returns:
        a list of reservation rules of the form