Class ReportsController

java.lang.Object
se.bth.pulse.controller.ReportsController

@Controller public class ReportsController extends Object
This class is a view controller that serves the reports page.
  • Constructor Details

    • ReportsController

      public ReportsController(ReportRepository reportRepository)
  • Method Details

    • showReports

      @GetMapping("/reports") public String showReports(org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      This serves the reports page to the user. The return string is the name of the view to be rendered.
      Parameters:
      model - - used to pass attributes to the view
      authentication - - used to get the username and role of the logged-in user
      Returns:
      String - the view to be rendered
    • showReport

      @GetMapping("/report/{id}") public String showReport(@PathVariable("id") Integer id, org.springframework.ui.Model model, org.springframework.security.core.Authentication authentication)
      Used to render a view for viewing a report. It uses the report repository to get the report with the given id.
      Parameters:
      id - - the id of the report to be viewed
      model - - used to pass attributes to the view
      authentication - - used to get the username and role of the logged-in user
      Returns:
      String - the view to be rendered