1
14
15 package com.liferay.portlet.journalcontentsearch.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
36 public class ConfigurationActionImpl extends BaseConfigurationAction {
37
38 public void processAction(
39 PortletConfig portletConfig, ActionRequest actionRequest,
40 ActionResponse actionResponse)
41 throws Exception {
42
43 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
44
45 if (!cmd.equals(Constants.UPDATE)) {
46 return;
47 }
48
49 boolean showListed = ParamUtil.getBoolean(
50 actionRequest, "showListed");
51 String targetPortletId = ParamUtil.getString(
52 actionRequest, "targetPortletId");
53 String type = ParamUtil.getString(actionRequest, "type");
54
55 String portletResource = ParamUtil.getString(
56 actionRequest, "portletResource");
57
58 PortletPreferences preferences =
59 PortletPreferencesFactoryUtil.getPortletSetup(
60 actionRequest, portletResource);
61
62 preferences.setValue("show-listed", String.valueOf(showListed));
63 preferences.setValue("target-portlet-id", targetPortletId);
64 preferences.setValue("type", type);
65
66 preferences.store();
67
68 SessionMessages.add(
69 actionRequest, portletConfig.getPortletName() + ".doConfigure");
70 }
71
72 public String render(
73 PortletConfig portletConfig, RenderRequest renderRequest,
74 RenderResponse renderResponse)
75 throws Exception {
76
77 return "/html/portlet/journal_content_search/configuration.jsp";
78 }
79
80 }