Class TemplateController


  • @Controller
    public class TemplateController
    extends java.lang.Object
    The controller that deals with the manage template pages
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String copyPost​(AccountWrapper account, TemplateWrapper templateWrapper)
      Handles POST requests to the copy template page
      java.lang.String deleteGet()
      Handles GET requests to the delete template page
      java.lang.String deletePost​(TemplateWrapper templateWrapper)
      Handles POST requests to the delete template page
      java.lang.String detailsGetFragment​(long pathid, TemplateWrapper templateWrapper, boolean isAjax, org.springframework.ui.Model model)
      Handles GET requests to the template details page
      java.lang.String detailsPostFragment​(long pathid, TemplateWrapper templateWrapper, boolean isAjax, @Valid TemplateForm templateForm, org.springframework.validation.BindingResult result, org.springframework.ui.Model model)
      Handles POST requests to the details template page
      java.lang.String detectorsGetFragment​(long pathid, TemplateWrapper templateWrapper, boolean isAjax)
      Handles GET requests to the template detectors page
      java.lang.String manageGet()
      Handles GET requests to the manage template page
      java.lang.String templateDetailsGetFragment​(boolean isAjax)
      Handles GET requests to the template details fragment
      • Methods inherited from class java.lang.Object

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

      • TemplateController

        public TemplateController()
    • Method Detail

      • manageGet

        @GetMapping("/dashboard/templates/manage/{pathid}")
        public java.lang.String manageGet()
        Handles GET requests to the manage template page
        Returns:
        the path to the manage template
      • detailsGetFragment

        @GetMapping("/dashboard/templates/manage/{pathid}/details")
        public java.lang.String detailsGetFragment​(@PathVariable("pathid")
                                                   long pathid,
                                                   @ModelAttribute("template")
                                                   TemplateWrapper templateWrapper,
                                                   @ModelAttribute("isAjax")
                                                   boolean isAjax,
                                                   org.springframework.ui.Model model)
                                            throws NotAjaxRequest
        Handles GET requests to the template details page
        Parameters:
        pathid - the id of the template
        templateWrapper - the template being managed
        isAjax - whether or not the request was ajax or not
        model - holder for model attributes
        Returns:
        the path to the details template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to
      • detailsPostFragment

        @PostMapping("/dashboard/templates/manage/{pathid}/details")
        public java.lang.String detailsPostFragment​(@PathVariable("pathid")
                                                    long pathid,
                                                    @ModelAttribute("template")
                                                    TemplateWrapper templateWrapper,
                                                    @ModelAttribute("isAjax")
                                                    boolean isAjax,
                                                    @Valid @ModelAttribute
                                                    @Valid TemplateForm templateForm,
                                                    org.springframework.validation.BindingResult result,
                                                    org.springframework.ui.Model model)
                                             throws NotAjaxRequest,
                                                    NotTemplateOwner
        Handles POST requests to the details template page
        Parameters:
        pathid - the id of the template
        templateWrapper - the template being managed
        isAjax - whether or not the request was ajax or not
        templateForm - the form that should be submitted in the request
        result - the results of the validation on the form above
        model - holder for model attributes
        Returns:
        the path to the details template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to
        NotTemplateOwner - if the user attempts to modify a template that is public and not theirs
      • detectorsGetFragment

        @GetMapping("/dashboard/templates/manage/{pathid}/detectors")
        public java.lang.String detectorsGetFragment​(@PathVariable("pathid")
                                                     long pathid,
                                                     @ModelAttribute("template")
                                                     TemplateWrapper templateWrapper,
                                                     @ModelAttribute("isAjax")
                                                     boolean isAjax)
                                              throws NotAjaxRequest
        Handles GET requests to the template detectors page
        Parameters:
        pathid - the id of the template
        templateWrapper - the template being managed
        isAjax - whether or not the request was ajax or not
        Returns:
        the path of the detectors template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to
      • copyPost

        @PostMapping("/dashboard/templates/{pathid}/copy")
        public java.lang.String copyPost​(@ModelAttribute("account")
                                         AccountWrapper account,
                                         @ModelAttribute("template")
                                         TemplateWrapper templateWrapper)
        Handles POST requests to the copy template page
        Parameters:
        account - the account of the current user
        templateWrapper - the template being managed
        Returns:
        a redirect to the new template
      • deleteGet

        @GetMapping("/dashboard/templates/{pathid}/delete")
        public java.lang.String deleteGet()
        Handles GET requests to the delete template page
        Returns:
        the path to the delete page
      • deletePost

        @PostMapping("/dashboard/templates/{pathid}/delete")
        public java.lang.String deletePost​(@ModelAttribute("template")
                                           TemplateWrapper templateWrapper)
                                    throws NotTemplateOwner
        Handles POST requests to the delete template page
        Parameters:
        templateWrapper - the template being managed
        Returns:
        a redirect to the templates page
        Throws:
        NotTemplateOwner - if the user attempts to modify a template that is public and not theirs
      • templateDetailsGetFragment

        @GetMapping("/dashboard/templates/details/{pathid}")
        public java.lang.String templateDetailsGetFragment​(@ModelAttribute("isAjax")
                                                           boolean isAjax)
                                                    throws NotAjaxRequest
        Handles GET requests to the template details fragment
        Parameters:
        isAjax - whether or not the request was ajax or not
        Returns:
        the path to the details template
        Throws:
        NotAjaxRequest - if the request was not an ajax one, the message is where to redirect the user to