Class ReservationRuleService
java.lang.Object
fr.paris.lutece.plugins.appointment.service.ReservationRuleService
Service class for the reservation rule
- Author:
- Laurent Payen
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcopyReservationRule(int nIdReservationRule) Make a copy of typical week, with all its valuesstatic ReservationRulecreateReservationRule(AppointmentFormDTO appointmentForm, int nIdForm) Create in database a reservation rule object from an appointmentForm DTOstatic intcreateTypicalWeek(AppointmentFormDTO appointmentForm) Create in database a reservation rule object from an appointmentForm DTOstatic voidfillInReservationRule(ReservationRule reservationRule, AppointmentFormDTO appointmentForm, int nIdForm) Fill the reservation rule object with the corresponding values of an appointmentForm DTOstatic fr.paris.lutece.util.ReferenceListfindAllReservationRule(int nIdForm) Build a reference list of all reservation rules of a formstatic Map<WeekDefinition,ReservationRule> findAllReservationRule(int nIdForm, Collection<WeekDefinition> listWeekDefinition) Find all the reservation rule of a formstatic List<ReservationRule>findListReservationRule(int nIdForm) Returns a list of the reservation rules of a formstatic List<ReservationRule>findListReservationRule(int nIdForm, Collection<WeekDefinition> listWeekDefinition) Returns a list of the reservation rules of a formstatic ReservationRulefindReservationRuleById(int nIdReservationRule) Find a reservation rule with its primary keystatic ReservationRulefindReservationRuleByIdFormAndClosestToDateOfApply(int nIdForm, LocalDate dateOfApply) Find in database a reservation rule of a form closest to a datestatic ReservationRulefindReservationRuleByIdFormAndDateOfApply(int nIdForm, LocalDate dateOfApply) Find the reservation rule of a form on a specific datestatic voidremoveReservationRule(int nIdReservationRule) Delete a reservation rule by its idstatic voidsaveReservationRule(ReservationRule reservationRule) save a reservation rulestatic voidupdateAdvancedParameters(AppointmentFormDTO appointmentForm) Update a form with the new values of an appointmentForm DTO Advanced Parameters (with a date of application) --> new Typical Weekstatic ReservationRuleupdateReservationRule(AppointmentFormDTO appointmentForm, int nIdForm) Update in database a reservation rule with the values of an appointmentForm DTO
-
Method Details
-
createReservationRule
public static ReservationRule createReservationRule(AppointmentFormDTO appointmentForm, int nIdForm) Create in database a reservation rule object from an appointmentForm DTO- Parameters:
appointmentForm- the appointmentForm DTOnIdForm- the form IddateOfApply- the date of the reservation rule- Returns:
- the Reservation Rule object created
-
createTypicalWeek
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
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
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 DTOnIdForm- 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 inappointmentForm- the appointmentForm DTOnIdForm- the form Id
-
findReservationRuleByIdFormAndClosestToDateOfApply
public static ReservationRule findReservationRuleByIdFormAndClosestToDateOfApply(int nIdForm, LocalDate dateOfApply) Find in database a reservation rule of a form closest to a date- Parameters:
nIdForm- the form IddateOfApply- the date- Returns:
- the reservation rule to apply at this date
-
findReservationRuleByIdFormAndDateOfApply
public static ReservationRule findReservationRuleByIdFormAndDateOfApply(int nIdForm, LocalDate dateOfApply) Find the reservation rule of a form on a specific date- Parameters:
nIdForm- the form IddateOfApply- the date of the reservation rule- Returns:
- the reservation rule object
-
findReservationRuleById
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 Map<WeekDefinition,ReservationRule> findAllReservationRule(int nIdForm, 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
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 List<ReservationRule> findListReservationRule(int nIdForm, Collection<WeekDefinition> listWeekDefinition) Returns a list of the reservation rules of a form- Parameters:
nIdForm- the form idlistWeekDefinition- the week definition list- Returns:
- a list of reservation rules of the form
-