Interface ISchedulerController

All Known Implementing Classes:
SchedulerController

public interface ISchedulerController
This controller is responsible for handling creation requests planning and its management.
  • Method Details

    • getAllSchedulesWithDates

      Set<ShowScheduleToPlannerDTO> getAllSchedulesWithDates()
    • createSchedule

      Schedule 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.
      Parameters:
      startDate - starting day of the schedule validity
      endDate - end day (inclusive) of the validity of the schedule
      Returns:
      the created schedule
    • createSchedule

      Schedule createSchedule(LocalDate startDate, LocalDate endDate)
      Proxy 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.
      Parameters:
      startDate - First date of the shift schedule
      endDate - Last date of the shift schedule
      Returns:
      An instance of schedule if correctly created and saved in persistence, null otherwise
    • recreateSchedule

      boolean recreateSchedule(long id) throws UnableToBuildScheduleException
      This method recreates an existing shift scheduling. It is not possible to recreate a schedule in the past.
      Parameters:
      id - An existing schedule ID
      Returns:
      Boolean that represents if the regeneration ended successfully
      Throws:
      UnableToBuildScheduleException
    • addConcreteShift

      Schedule addConcreteShift(ConcreteShift concreteShift, boolean forced) throws IllegalScheduleException
      This 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.
      Parameters:
      concreteShift - The new concrete shift to be added to the schedule
      forced - 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
    • modifyConcreteShift

      Schedule modifyConcreteShift(ModifyConcreteShiftDTO modifyConcreteShiftDTO) throws IllegalScheduleException
      This 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.
      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

      List<ScheduleDTO> readSchedules()
      This method retrieves all the existing schedules from the database.
      Returns:
      List of DTO instances representing all the existing schedules to be delivered to the frontend
    • readIllegalSchedules

      List<ScheduleDTO> readIllegalSchedules()
      This method retrieves the illegal schedules from the database.
      Returns:
      List of DTO instances representing the illegal schedules to be delivered to the frontend
    • removeSchedule

      boolean removeSchedule(long id)
      This 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.
      Parameters:
      id - ID of the shift schedule to be removed
      Returns:
      Boolean that represents if the deletion was successful
    • removeConcreteShiftFromSchedule

      void removeConcreteShiftFromSchedule(ConcreteShift concreteShiftOld)
      This method removes a concrete shift from a schedule but not from the database.
      Parameters:
      concreteShiftOld - Concrete shift to be removed
    • removeConcreteShift

      boolean removeConcreteShift(Long concreteShiftId)
      This method removes a concrete shift from the database.
      Parameters:
      concreteShiftId - ID of the concrete shift to be removed
      Returns:
      Boolean that represents if the deletion was successful
    • addConcreteShift

      Schedule addConcreteShift(RegisterConcreteShiftDTO registerConcreteShiftDTO, boolean forced) throws ConcreteShiftException, IllegalScheduleException
      This method adds a new concrete shift to an existing schedule; the concrete shift is described by the DTO parameter.
      Parameters:
      registerConcreteShiftDTO - DTO class that describes the new concrete shift
      forced - 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 shift
      IllegalScheduleException - Rised if the new concrete shift makes the schedule illegal