001
014
015 package com.liferay.portlet.xslcontent.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.portlet.PortletPreferencesFactoryUtil;
022
023 import javax.portlet.ActionRequest;
024 import javax.portlet.ActionResponse;
025 import javax.portlet.PortletConfig;
026 import javax.portlet.PortletPreferences;
027 import javax.portlet.RenderRequest;
028 import javax.portlet.RenderResponse;
029
030
033 public class ConfigurationActionImpl extends BaseConfigurationAction {
034
035 public void processAction(
036 PortletConfig portletConfig, ActionRequest actionRequest,
037 ActionResponse actionResponse)
038 throws Exception {
039
040 String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
041
042 if (!cmd.equals(Constants.UPDATE)) {
043 return;
044 }
045
046 String xmlURL = ParamUtil.getString(actionRequest, "xmlURL");
047 String xslURL = ParamUtil.getString(actionRequest, "xslURL");
048
049 String portletResource = ParamUtil.getString(
050 actionRequest, "portletResource");
051
052 PortletPreferences preferences =
053 PortletPreferencesFactoryUtil.getPortletSetup(
054 actionRequest, portletResource);
055
056 preferences.setValue("xml-url", xmlURL);
057 preferences.setValue("xsl-url", xslURL);
058
059 preferences.store();
060
061 SessionMessages.add(
062 actionRequest, portletConfig.getPortletName() + ".doConfigure");
063 }
064
065 public String render(
066 PortletConfig portletConfig, RenderRequest renderRequest,
067 RenderResponse renderResponse)
068 throws Exception {
069
070 return "/html/portlet/xsl_content/configuration.jsp";
071 }
072
073 }