1
14
15 package com.liferay.portlet.recentbloggers.action;
16
17 import com.liferay.portal.kernel.portlet.BaseConfigurationAction;
18 import com.liferay.portal.kernel.servlet.SessionMessages;
19 import com.liferay.portal.kernel.util.Constants;
20 import com.liferay.portal.kernel.util.ParamUtil;
21 import com.liferay.portlet.PortletPreferencesFactoryUtil;
22
23 import javax.portlet.ActionRequest;
24 import javax.portlet.ActionResponse;
25 import javax.portlet.PortletConfig;
26 import javax.portlet.PortletPreferences;
27 import javax.portlet.RenderRequest;
28 import javax.portlet.RenderResponse;
29
30
35 public class ConfigurationActionImpl extends BaseConfigurationAction {
36
37 public void processAction(
38 PortletConfig portletConfig, ActionRequest actionRequest,
39 ActionResponse actionResponse)
40 throws Exception {
41
42 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
43
44 if (!cmd.equals(Constants.UPDATE)) {
45 return;
46 }
47
48 String selectionMethod = ParamUtil.getString(
49 actionRequest, "selectionMethod");
50 String organizationId = ParamUtil.getString(
51 actionRequest, "organizationId");
52 String displayStyle = ParamUtil.getString(
53 actionRequest, "displayStyle");
54 int max = ParamUtil.getInteger(actionRequest, "max");
55
56 String portletResource = ParamUtil.getString(
57 actionRequest, "portletResource");
58
59 PortletPreferences preferences =
60 PortletPreferencesFactoryUtil.getPortletSetup(
61 actionRequest, portletResource);
62
63 preferences.setValue("selection-method", selectionMethod);
64 preferences.setValue("organization-id", organizationId);
65 preferences.setValue("display-style", displayStyle);
66 preferences.setValue("max", String.valueOf(max));
67
68 preferences.store();
69
70 SessionMessages.add(
71 actionRequest, portletConfig.getPortletName() + ".doConfigure");
72 }
73
74 public String render(
75 PortletConfig portletConfig, RenderRequest renderRequest,
76 RenderResponse renderResponse)
77 throws Exception {
78
79 return "/html/portlet/recent_bloggers/configuration.jsp";
80 }
81
82 }