Class TemplateController
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.module.web.controllers.dashboard.template.TemplateController
-
@Controller public class TemplateController extends java.lang.Object
The controller that deals with the manage template pages
-
-
Constructor Summary
Constructors Constructor Description TemplateController()
-
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 pagejava.lang.String
deleteGet()
Handles GET requests to the delete template pagejava.lang.String
deletePost(TemplateWrapper templateWrapper)
Handles POST requests to the delete template pagejava.lang.String
detailsGetFragment(long pathid, TemplateWrapper templateWrapper, boolean isAjax, org.springframework.ui.Model model)
Handles GET requests to the template details pagejava.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 pagejava.lang.String
detectorsGetFragment(long pathid, TemplateWrapper templateWrapper, boolean isAjax)
Handles GET requests to the template detectors pagejava.lang.String
manageGet()
Handles GET requests to the manage template pagejava.lang.String
templateDetailsGetFragment(boolean isAjax)
Handles GET requests to the template details fragment
-
-
-
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 templatetemplateWrapper
- the template being managedisAjax
- whether or not the request was ajax or notmodel
- 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 templatetemplateWrapper
- the template being managedisAjax
- whether or not the request was ajax or nottemplateForm
- the form that should be submitted in the requestresult
- the results of the validation on the form abovemodel
- 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 toNotTemplateOwner
- 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 templatetemplateWrapper
- the template being managedisAjax
- 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 usertemplateWrapper
- 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
-
-