1
14
15 package com.liferay.portlet.blogsaggregator.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 organizationId = ParamUtil.getString(
49 actionRequest, "organizationId");
50 String displayStyle = ParamUtil.getString(
51 actionRequest, "displayStyle");
52 int max = ParamUtil.getInteger(actionRequest, "max");
53 boolean enableRssSubscription = ParamUtil.getBoolean(
54 actionRequest, "enableRssSubscription");
55 boolean showTags = ParamUtil.getBoolean(
56 actionRequest, "showTags");
57
58 String portletResource = ParamUtil.getString(
59 actionRequest, "portletResource");
60
61 PortletPreferences preferences =
62 PortletPreferencesFactoryUtil.getPortletSetup(
63 actionRequest, portletResource);
64
65 preferences.setValue("organization-id", organizationId);
66 preferences.setValue("display-style", displayStyle);
67 preferences.setValue("max", String.valueOf(max));
68 preferences.setValue(
69 "enable-rss-subscription", String.valueOf(enableRssSubscription));
70 preferences.setValue("show-tags", String.valueOf(showTags));
71
72 preferences.store();
73
74 SessionMessages.add(
75 actionRequest, portletConfig.getPortletName() + ".doConfigure");
76 }
77
78 public String render(
79 PortletConfig portletConfig, RenderRequest renderRequest,
80 RenderResponse renderResponse)
81 throws Exception {
82
83 return "/html/portlet/blogs_aggregator/configuration.jsp";
84 }
85
86 }