001
014
015 package com.liferay.portlet.journalcontentsearch.action;
016
017 import com.liferay.portal.kernel.portlet.BaseConfigurationAction;
018 import com.liferay.portal.kernel.servlet.SessionMessages;
019 import com.liferay.portal.kernel.util.Constants;
020 import com.liferay.portal.kernel.util.ParamUtil;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portlet.PortletPreferencesFactoryUtil;
023
024 import javax.portlet.ActionRequest;
025 import javax.portlet.ActionResponse;
026 import javax.portlet.PortletConfig;
027 import javax.portlet.PortletPreferences;
028 import javax.portlet.RenderRequest;
029 import javax.portlet.RenderResponse;
030
031
035 public class ConfigurationActionImpl extends BaseConfigurationAction {
036
037 public void processAction(
038 PortletConfig portletConfig, ActionRequest actionRequest,
039 ActionResponse actionResponse)
040 throws Exception {
041
042 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
043
044 if (!cmd.equals(Constants.UPDATE)) {
045 return;
046 }
047
048 boolean showListed = ParamUtil.getBoolean(
049 actionRequest, "showListed");
050 String targetPortletId = ParamUtil.getString(
051 actionRequest, "targetPortletId");
052 String type = ParamUtil.getString(actionRequest, "type");
053
054 String portletResource = ParamUtil.getString(
055 actionRequest, "portletResource");
056
057 PortletPreferences preferences =
058 PortletPreferencesFactoryUtil.getPortletSetup(
059 actionRequest, portletResource);
060
061 preferences.setValue("show-listed", String.valueOf(showListed));
062
063 if (!showListed) {
064 preferences.setValue("target-portlet-id", targetPortletId);
065 }
066 else {
067 preferences.setValue("target-portlet-id", StringPool.BLANK);
068 }
069
070 preferences.setValue("type", type);
071
072 preferences.store();
073
074 SessionMessages.add(
075 actionRequest, portletConfig.getPortletName() + ".doConfigure");
076 }
077
078 public String render(
079 PortletConfig portletConfig, RenderRequest renderRequest,
080 RenderResponse renderResponse)
081 throws Exception {
082
083 return "/html/portlet/journal_content_search/configuration.jsp";
084 }
085
086 }