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.PortletConfig; |
9 | import edu.iu.uis.sit.portal.portlet.admin.services.AdminService; |
10 | |
11 | public class PortletConfigDeleteController extends SimpleFormController { |
12 | |
13 | private AdminService adminService; |
14 | |
15 | protected void onSubmitAction(Object command) throws Exception { |
16 | PortletConfig portletConfig = (PortletConfig) command; |
17 | getAdminService().deletePortletConfig(portletConfig); |
18 | } |
19 | |
20 | protected ModelAndView onSubmitRender(Object command) throws Exception { |
21 | ModelAndView modelAndView = new ModelAndView("displayPortletConfigs"); |
22 | PortletConfig portletConfig = (PortletConfig) command; |
23 | modelAndView.addObject("portletApplicationId", portletConfig.getPortletApplicationId()); |
24 | modelAndView.addObject("portletConfigs", getAdminService().findPortletApplicationById(portletConfig.getPortletApplicationId()).getPortletConfigs()); |
25 | return modelAndView; |
26 | } |
27 | |
28 | protected Object formBackingObject(PortletRequest request) throws Exception { |
29 | if (request.getParameter("portletConfigId") != null) { |
30 | return getAdminService().findPortletConfigById(Long.parseLong(request.getParameter("portletConfigId"))); |
31 | } |
32 | return new PortletConfig(); |
33 | } |
34 | |
35 | public AdminService getAdminService() { |
36 | return adminService; |
37 | } |
38 | |
39 | public void setAdminService(AdminService adminService) { |
40 | this.adminService = adminService; |
41 | } |
42 | |
43 | } |