001
014
015 package com.liferay.portal.editor.fckeditor;
016
017 import com.liferay.portal.editor.fckeditor.command.Command;
018 import com.liferay.portal.editor.fckeditor.command.CommandArgument;
019 import com.liferay.portal.editor.fckeditor.command.CommandFactory;
020 import com.liferay.portal.kernel.log.Log;
021 import com.liferay.portal.kernel.log.LogFactoryUtil;
022 import com.liferay.portal.kernel.util.ParamUtil;
023 import com.liferay.portal.theme.ThemeDisplay;
024 import com.liferay.portal.util.WebKeys;
025
026 import javax.servlet.http.HttpServletRequest;
027 import javax.servlet.http.HttpServletResponse;
028
029 import org.apache.struts.action.Action;
030 import org.apache.struts.action.ActionForm;
031 import org.apache.struts.action.ActionForward;
032 import org.apache.struts.action.ActionMapping;
033
034
037 public class ConnectorAction extends Action {
038
039 @Override
040 public ActionForward execute(
041 ActionMapping actionMapping, ActionForm actionForm,
042 HttpServletRequest request, HttpServletResponse response)
043 throws Exception {
044
045 try {
046 String command = request.getParameter("Command");
047 String type = request.getParameter("Type");
048 String currentFolder = request.getParameter("CurrentFolder");
049 String newFolder = ParamUtil.getString(request, "NewFolderName");
050
051 if (_log.isDebugEnabled()) {
052 _log.debug("Command " + command);
053 _log.debug("Type " + type);
054 _log.debug("Current folder " + currentFolder);
055 _log.debug("New folder " + newFolder);
056 }
057
058 ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
059 WebKeys.THEME_DISPLAY);
060
061 CommandArgument commandArgument = new CommandArgument(
062 command, type, currentFolder, newFolder, themeDisplay, request);
063
064 Command commandModel = CommandFactory.getCommand(command);
065
066 commandModel.execute(commandArgument, request, response);
067 }
068 catch (Exception e) {
069 _log.error(e, e);
070 }
071
072 return null;
073 }
074
075 private static Log _log = LogFactoryUtil.getLog(ConnectorAction.class);
076
077 }