1 | package edu.iu.uis.sit.portal.portlet.admin.web; |
2 | |
3 | import javax.portlet.PortletRequest; |
4 | |
5 | import org.springframework.web.portlet.ModelAndView; |
6 | import org.springframework.web.portlet.mvc.SimpleFormController; |
7 | |
8 | import edu.iu.uis.sit.portal.portlet.admin.domain.ApplicationConstant; |
9 | import edu.iu.uis.sit.portal.portlet.admin.services.AdminService; |
10 | |
11 | public class ApplicationConstantDeleteController extends SimpleFormController { |
12 | |
13 | private AdminService adminService; |
14 | |
15 | protected void onSubmitAction(Object command) throws Exception { |
16 | ApplicationConstant applicationConstant = (ApplicationConstant) command; |
17 | getAdminService().deleteApplicationConstant(applicationConstant); |
18 | } |
19 | |
20 | protected ModelAndView onSubmitRender(Object command) throws Exception { |
21 | ModelAndView modelAndView = new ModelAndView("message"); |
22 | modelAndView.addObject("message", "Deleted successfully"); |
23 | return modelAndView; |
24 | } |
25 | |
26 | protected Object formBackingObject(PortletRequest request) throws Exception { |
27 | if (request.getParameter("constantId") != null) { |
28 | return getAdminService().findApplicationConstantById(Long.parseLong(request.getParameter("constantId"))); |
29 | } |
30 | return new ApplicationConstant(); |
31 | } |
32 | |
33 | public AdminService getAdminService() { |
34 | return adminService; |
35 | } |
36 | |
37 | public void setAdminService(AdminService adminService) { |
38 | this.adminService = adminService; |
39 | } |
40 | |
41 | } |