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