Class TemplatesController


  • @Controller
    public class TemplatesController
    extends java.lang.Object
    The controller that deals with the templates pages
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String addGet​(org.springframework.ui.Model model)
      Handles GET requests to the add template page
      java.lang.String addPost​(@Valid TemplateForm templateForm, org.springframework.validation.BindingResult result, AccountWrapper account, boolean isAjax, org.springframework.ui.Model model)
      Handles POST requests to the add template page
      java.lang.String detectorsGetFragment​(org.springframework.ui.Model model, boolean isAjax, java.lang.String language)
      Handles GET requests to the detectors list page, which lists the detectors available for the specified language
      java.lang.String indexGet()
      Handles GET requests to the templates page
      java.lang.String listGetFragment​(AccountWrapper account, boolean isAjax, org.springframework.ui.Model model)
      Handles GET requests to the template list page
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TemplatesController

        public TemplatesController()
    • Method Detail

      • indexGet

        @GetMapping("/dashboard/templates")
        public java.lang.String indexGet()
        Handles GET requests to the templates page
        Returns:
        the path to the templates page template
      • listGetFragment

        @GetMapping("/dashboard/templates/list")
        public java.lang.String listGetFragment​(@ModelAttribute("account")
                                                AccountWrapper account,
                                                @ModelAttribute("isAjax")
                                                boolean isAjax,
                                                org.springframework.ui.Model model)
                                         throws NotAjaxRequest
        Handles GET requests to the template list page
        Parameters:
        account - the account of the current user
        isAjax - whether or not the request was ajax or not
        model - holder for model attributes
        Returns:
        the path to the template list page template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to
      • addGet

        @GetMapping("/dashboard/templates/add")
        public java.lang.String addGet​(org.springframework.ui.Model model)
        Handles GET requests to the add template page
        Parameters:
        model - holder for model attributes
        Returns:
        the path to the add template page template
      • addPost

        @PostMapping("/dashboard/templates/add")
        public java.lang.String addPost​(@Valid @ModelAttribute
                                        @Valid TemplateForm templateForm,
                                        org.springframework.validation.BindingResult result,
                                        @ModelAttribute("account")
                                        AccountWrapper account,
                                        @ModelAttribute("isAjax")
                                        boolean isAjax,
                                        org.springframework.ui.Model model)
                                 throws NotTemplateOwner
        Handles POST requests to the add template page
        Parameters:
        templateForm - the form that should be submitted in the request
        result - the results of the validation on the form above
        account - the account of the current user
        isAjax - whether or not the request was ajax or not
        model - holder for model attributes
        Returns:
        the path to the add template page template
        Throws:
        NotTemplateOwner - if the user attempts to modify a template that is public and not theirs
      • detectorsGetFragment

        @GetMapping("/dashboard/templates/detectors/{language}")
        public java.lang.String detectorsGetFragment​(org.springframework.ui.Model model,
                                                     @ModelAttribute("isAjax")
                                                     boolean isAjax,
                                                     @PathVariable("language")
                                                     java.lang.String language)
                                              throws NotAjaxRequest
        Handles GET requests to the detectors list page, which lists the detectors available for the specified language
        Parameters:
        model - holder for model attributes
        isAjax - whether or not the request was ajax or not
        language - the language to fetch the detectors for
        Returns:
        the path to the detectors list template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to