Class MainController
java.lang.Object
de.gustavblass.fsu.fmi.roombooking.controller.MainController
Defines the behaviour of the web server for the path
/.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumRepresents templates in the resources. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NonNull RoomControllerUsed to pass the equipment types to theModel. -
Constructor Summary
ConstructorsConstructorDescriptionMainController(@NonNull RoomController roomController) Constructs a newMainController. -
Method Summary
Modifier and TypeMethodDescription@NonNull StringgetIndex(@NonNull BookRoomDTO reservationDTO, @NonNull org.springframework.ui.Model model) HandlesGETrequests to the root path and returns the home page, including a find-rooms form.
-
Field Details
-
roomController
Used to pass the equipment types to theModel.
-
-
Constructor Details
-
MainController
Constructs a newMainController.- Parameters:
roomController- TheroomController.
-
-
Method Details
-
getIndex
@GetMapping({"/","/en"}) @NonNull public @NonNull String getIndex(@NonNull @ModelAttribute("bookRoomDTO") @NonNull BookRoomDTO reservationDTO, @NonNull @NonNull org.springframework.ui.Model model) throws IllegalStateException HandlesGETrequests to the root path and returns the home page, including a find-rooms form.- Parameters:
reservationDTO- Used for form binding.model- Used to pass those equipment types to the form that exist in the database.- Returns:
- The
MainController.Template.INDEXpage. - Throws:
IllegalStateException- If the equipment could not be added for unknown reason.
-