Class SchedulerController
java.lang.Object
org.cswteams.ms3.control.scheduler.SchedulerController
- All Implemented Interfaces:
ISchedulerController
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConcreteShift(RegisterConcreteShiftDTO registerConcreteShiftDTO, boolean forced) This method adds a new concrete shift to an existing schedule; the concrete shift is described by the DTO parameter.addConcreteShift(ConcreteShift concreteShift, boolean forced) This method adds a new concrete shift to an existing schedule.booleanThis method verifies the existence of a shift schedule for the dates we want to plan.createSchedule(LocalDate startDate, LocalDate endDate) Proxy of the method createSchedule, when the DoctorUffaPriority list cannot be retrieved.createSchedule(LocalDate startDate, LocalDate endDate, List<DoctorUffaPriority> doctorUffaPriorityList, List<DoctorUffaPrioritySnapshot> snapshot) Creates a schedule valid for the specified period and saves it in the DB.modifyConcreteShift(ModifyConcreteShiftDTO modifyConcreteShiftDTO) This method modifies an existing concrete shift.This method retrieves the illegal schedules from the database.This method retrieves all the existing schedules from the database.booleanrecreateSchedule(long id) This method recreates an existing shift scheduling.booleanremoveConcreteShift(Long concreteShiftId) This method removes a concrete shift from the database.voidremoveConcreteShiftFromSchedule(ConcreteShift concreteShiftOld) This method removes a concrete shift from a schedule but not from the database.booleanremoveSchedule(long id) This method removes an existing shift schedule.
-
Constructor Details
-
SchedulerController
public SchedulerController()
-
-
Method Details
-
getAllSchedulesWithDates
- Specified by:
getAllSchedulesWithDatesin interfaceISchedulerController
-
createSchedule
Description copied from interface:ISchedulerControllerProxy of the method createSchedule, when the DoctorUffaPriority list cannot be retrieved. This method creates a new shift schedule by specifying start date and end date.- Specified by:
createSchedulein interfaceISchedulerController- Parameters:
startDate- First date of the shift scheduleendDate- Last date of the shift schedule- Returns:
- An instance of schedule if correctly created and saved in persistence, null otherwise
-
createSchedule
public Schedule createSchedule(LocalDate startDate, LocalDate endDate, List<DoctorUffaPriority> doctorUffaPriorityList, List<DoctorUffaPrioritySnapshot> snapshot) Description copied from interface:ISchedulerControllerCreates a schedule valid for the specified period and saves it in the DB.- Specified by:
createSchedulein interfaceISchedulerController- Parameters:
startDate- starting day of the schedule validityendDate- end day (inclusive) of the validity of the schedule- Returns:
- the created schedule
-
recreateSchedule
public boolean recreateSchedule(long id) Description copied from interface:ISchedulerControllerThis method recreates an existing shift scheduling. It is not possible to recreate a schedule in the past.- Specified by:
recreateSchedulein interfaceISchedulerController- Parameters:
id- An existing schedule ID- Returns:
- Boolean that represents if the regeneration ended successfully
-
addConcreteShift
public Schedule addConcreteShift(ConcreteShift concreteShift, boolean forced) throws IllegalScheduleException Description copied from interface:ISchedulerControllerThis method adds a new concrete shift to an existing schedule. In particular, it looks for the schedule containing the date of the new concrete shift and passes it to ScheduleBuilder.- Specified by:
addConcreteShiftin interfaceISchedulerController- Parameters:
concreteShift- The new concrete shift to be added to the scheduleforced- If true, the concrete shift will be added if it respects all the non-violable constraints; if false, the concrete shift will be added only if it respects all the existing constraints.- Returns:
- An instance of the updated shift schedule
- Throws:
IllegalScheduleException- Rised if the new concrete shift makes the schedule illegal
-
removeConcreteShiftFromSchedule
Description copied from interface:ISchedulerControllerThis method removes a concrete shift from a schedule but not from the database.- Specified by:
removeConcreteShiftFromSchedulein interfaceISchedulerController- Parameters:
concreteShiftOld- Concrete shift to be removed
-
removeConcreteShift
Description copied from interface:ISchedulerControllerThis method removes a concrete shift from the database.- Specified by:
removeConcreteShiftin interfaceISchedulerController- Parameters:
concreteShiftId- ID of the concrete shift to be removed- Returns:
- Boolean that represents if the deletion was successful
-
addConcreteShift
public Schedule addConcreteShift(RegisterConcreteShiftDTO registerConcreteShiftDTO, boolean forced) throws ConcreteShiftException, IllegalScheduleException Description copied from interface:ISchedulerControllerThis method adds a new concrete shift to an existing schedule; the concrete shift is described by the DTO parameter.- Specified by:
addConcreteShiftin interfaceISchedulerController- Parameters:
registerConcreteShiftDTO- DTO class that describes the new concrete shiftforced- If true, the concrete shift will be added if it respects all the non-violable constraints; if false, the concrete shift will be added only if it respects all the existing constraints.- Returns:
- An instance of the updated shift schedule
- Throws:
ConcreteShiftException- Rised if the DTO parameter describes a non-existing concrete shiftIllegalScheduleException- Rised if the new concrete shift makes the schedule illegal
-
modifyConcreteShift
public Schedule modifyConcreteShift(ModifyConcreteShiftDTO modifyConcreteShiftDTO) throws IllegalScheduleException Description copied from interface:ISchedulerControllerThis method modifies an existing concrete shift. In particular, it removes the existing concrete shifts, checks if the new version of the concrete shift respects all the constraints and, if the checks succeed, then saves the new version of the concrete shift into the database. Instead, if there are some violated constraints, then the old version of the concrete shift is saved into the database again.- Specified by:
modifyConcreteShiftin interfaceISchedulerController- Parameters:
modifyConcreteShiftDTO- DTO instance representing the changes to make in an existing concrete shift- Returns:
- An instance of the updated shift schedule containing the modified concrete shift
- Throws:
IllegalScheduleException- Rised if the new concrete shift makes the schedule illegal
-
readSchedules
Description copied from interface:ISchedulerControllerThis method retrieves all the existing schedules from the database.- Specified by:
readSchedulesin interfaceISchedulerController- Returns:
- List of DTO instances representing all the existing schedules to be delivered to the frontend
-
readIllegalSchedules
Description copied from interface:ISchedulerControllerThis method retrieves the illegal schedules from the database.- Specified by:
readIllegalSchedulesin interfaceISchedulerController- Returns:
- List of DTO instances representing the illegal schedules to be delivered to the frontend
-
removeSchedule
public boolean removeSchedule(long id) Description copied from interface:ISchedulerControllerThis method removes an existing shift schedule. This operation can be performed correctly only if the schedule is in the future and not in the past.- Specified by:
removeSchedulein interfaceISchedulerController- Parameters:
id- ID of the shift schedule to be removed- Returns:
- Boolean that represents if the deletion was successful
-
check
This method verifies the existence of a shift schedule for the dates we want to plan.- Parameters:
startNewSchedule- First date to be planned for a shift scheduleendNewSchedule- Last date to be planned for a shift schedule- Returns:
- False if there already exists a shift schedule for the dates we want to plan, true otherwise
-