Class RoomController

java.lang.Object
de.gustavblass.fsu.fmi.roombooking.controller.RoomController

@Controller public class RoomController extends Object
Defines the behaviour of the web server for the path /rooms.
  • Field Details

  • Constructor Details

  • Method Details

    • getRooms

      @GetMapping({"/r\u00e4ume","/en/rooms"}) public String getRooms(@RequestParam(name="page",defaultValue="0") int page, @Max(20L) @RequestParam(name="size",defaultValue="5") @Max(20L) int size, @NonNull @RequestParam(name="sortBy",defaultValue="id") @NonNull String sortBy, @RequestParam(name="ascending",defaultValue="true") boolean ascending, @NonNull @NonNull org.springframework.ui.Model model)
      Handles GET requests to /rooms. Retrieves a paginated subset of all Rooms according to the URL parameters given.
      Parameters:
      page - The index of the page requested.
      size - How many Reservation items each page in the pagination has.
      sortBy - Which of the Rooms' fields shall be used to sort the items. Determines the order of the items and thereby also which items are present on the requested page.
      ascending - Whether to count from the start or from the end of the list sorted using sortBy.
      model - Will be filled with the data for the Thymeleaf template.
      Returns:
      The reservations.html page with the requested reservations.
    • getRoom

      @ExceptionHandler(IllegalStateException.class) @GetMapping({"/r\u00e4ume/{number}","/en/rooms/{number}"}) public String getRoom(@NonNull @PathVariable @NonNull String number, @NonNull @NonNull org.springframework.ui.Model model) throws NotFoundException
      Handles GET requests to /räume/{number}. Retrieves a specific Room denoted by the path parameter number.
      Parameters:
      number - The path parameter {number} denoting a specific Room.
      model - Will be filled with the data for the Thymeleaf template.
      Returns:
      The room.html template filled with the requested Room.
      Throws:
      NotFoundException - If no Room with the given number exists.
    • getSchedule

      @GetMapping({"/r\u00e4ume/{number}/plan","/en/rooms/{number}/schedule"}) @NonNull public @NonNull String getSchedule(@NonNull @PathVariable @NonNull String number, @Nullable @Nullable LocalDate date, @NonNull @NonNull org.springframework.ui.Model model) throws NotFoundException
      Handles GET requests to /rooms/{number}/schedule and returns the RoomSchedule for the Room with the given Room.number on the given LocalDate.
      Parameters:
      number - The number of the Room whose schedule shall be returned.
      date - The day for which the Room's schedule shall be built.
      model - Will be filled with the data for the Thymeleaf template.
      Returns:
      The RoomController.Template.SCHEDULE page.
      Throws:
      NotFoundException - If the given Room number does not belong to any Room.
    • getWeekSchedule

      @GetMapping({"/r\u00e4ume/{number}/plan/woche","/en/rooms/{number}/schedule/week"}) @NonNull public @NonNull String getWeekSchedule(@NonNull @PathVariable @NonNull String number, @Nullable @Nullable LocalDate date, @NonNull @NonNull org.springframework.ui.Model model) throws NotFoundException
      Handles GET requests to /rooms/{number}/schedule/week and returns the RoomSchedules for each day in the given LocalDate's week for the Room with the given Room.number on the given LocalDate.
      Parameters:
      number - The number of the Room whose schedule shall be returned.
      date - The Room's schedule will be built for the week that contains this date.
      model - Will be filled with the data for the Thymeleaf template.
      Returns:
      The RoomController.Template.SCHEDULE page.
      Throws:
      NotFoundException - If the given Room number does not belong to any Room.