Shinsuke Sugaya 10 tahun lalu
induk
melakukan
5e222b8fda

+ 300 - 7
src/main/java/org/codelibs/fess/action/admin/FavoriteLogAction.java

@@ -19,30 +19,58 @@ package org.codelibs.fess.action.admin;
 import java.io.BufferedWriter;
 import java.io.OutputStreamWriter;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.codelibs.core.util.StringUtil;
 import org.codelibs.fess.Constants;
-import org.codelibs.fess.crud.action.admin.BsFavoriteLogAction;
+import org.codelibs.fess.action.base.FessAdminAction;
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.crud.CrudMessageException;
 import org.codelibs.fess.crud.util.SAStrutsUtil;
+import org.codelibs.fess.db.exentity.FavoriteLog;
+import org.codelibs.fess.form.admin.FavoriteLogForm;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.pager.FavoriteLogPager;
+import org.codelibs.fess.service.FavoriteLogService;
+import org.codelibs.sastruts.core.annotation.Token;
 import org.codelibs.sastruts.core.exception.SSCActionMessagesException;
+import org.seasar.framework.beans.util.Beans;
+import org.seasar.struts.annotation.ActionForm;
 import org.seasar.struts.annotation.Execute;
+import org.seasar.struts.exception.ActionMessagesException;
 import org.seasar.struts.util.RequestUtil;
 import org.seasar.struts.util.ResponseUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.ibm.icu.text.SimpleDateFormat;
 
-public class FavoriteLogAction extends BsFavoriteLogAction {
-    private static final Log log = LogFactory.getLog(FavoriteLogAction.class);
+public class FavoriteLogAction extends FessAdminAction {
 
-    private static final long serialVersionUID = 1L;
+    private static final Logger logger = LoggerFactory.getLogger(FavoriteLogAction.class);
+
+    // for list
+
+    public List<FavoriteLog> favoriteLogItems;
+
+    // for edit/confirm/delete
+
+    @ActionForm
+    @Resource
+    protected FavoriteLogForm favoriteLogForm;
+
+    @Resource
+    protected FavoriteLogService favoriteLogService;
+
+    @Resource
+    protected FavoriteLogPager favoriteLogPager;
 
     @Resource
     protected SystemHelper systemHelper;
@@ -51,6 +79,271 @@ public class FavoriteLogAction extends BsFavoriteLogAction {
         return systemHelper.getHelpLink("favoriteLog");
     }
 
+    protected String displayList(final boolean redirect) {
+        // page navi
+        favoriteLogItems = favoriteLogService.getFavoriteLogList(favoriteLogPager);
+
+        // restore from pager
+        Beans.copy(favoriteLogPager, favoriteLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        if (redirect) {
+            return "index?redirect=true";
+        } else {
+            return "index.jsp";
+        }
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String index() {
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
+    public String list() {
+        // page navi
+        if (StringUtil.isNotBlank(favoriteLogForm.pageNumber)) {
+            try {
+                favoriteLogPager.setCurrentPageNumber(Integer.parseInt(favoriteLogForm.pageNumber));
+            } catch (final NumberFormatException e) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Invalid value: " + favoriteLogForm.pageNumber, e);
+                }
+            }
+        }
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String search() {
+        Beans.copy(favoriteLogForm.searchParams, favoriteLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String reset() {
+        favoriteLogPager.clear();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String back() {
+        return displayList(false);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editagain() {
+        return "edit.jsp";
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
+    public String confirmpage() {
+        if (favoriteLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
+                    favoriteLogForm.crudMode });
+        }
+
+        loadFavoriteLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String createpage() {
+        // page navi
+        favoriteLogForm.initialize();
+        favoriteLogForm.crudMode = CommonConstants.CREATE_MODE;
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
+    public String editpage() {
+        if (favoriteLogForm.crudMode != CommonConstants.EDIT_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
+                    favoriteLogForm.crudMode });
+        }
+
+        loadFavoriteLog();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editfromconfirm() {
+        favoriteLogForm.crudMode = CommonConstants.EDIT_MODE;
+
+        loadFavoriteLog();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromcreate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromupdate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
+    public String deletepage() {
+        if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
+                    favoriteLogForm.crudMode });
+        }
+
+        loadFavoriteLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String deletefromconfirm() {
+        favoriteLogForm.crudMode = CommonConstants.DELETE_MODE;
+
+        loadFavoriteLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String create() {
+        try {
+            final FavoriteLog favoriteLog = createFavoriteLog();
+            favoriteLogService.store(favoriteLog);
+            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
+        }
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String update() {
+        try {
+            final FavoriteLog favoriteLog = createFavoriteLog();
+            favoriteLogService.store(favoriteLog);
+            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
+        }
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = false, input = "error.jsp")
+    public String delete() {
+        if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
+                    favoriteLogForm.crudMode });
+        }
+
+        try {
+            final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
+            if (favoriteLog == null) {
+                // throw an exception
+                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+                new Object[] { favoriteLogForm.id });
+
+            }
+
+            favoriteLogService.delete(favoriteLog);
+            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
+        }
+    }
+
+    protected void loadFavoriteLog() {
+
+        final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
+        if (favoriteLog == null) {
+            // throw an exception
+            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+            new Object[] { favoriteLogForm.id });
+
+        }
+
+        Beans.copy(favoriteLog, favoriteLogForm).excludes("searchParams", "mode")
+
+        .execute();
+    }
+
+    protected FavoriteLog createFavoriteLog() {
+        FavoriteLog favoriteLog;
+        if (favoriteLogForm.crudMode == CommonConstants.EDIT_MODE) {
+            favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
+            if (favoriteLog == null) {
+                // throw an exception
+                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+                new Object[] { favoriteLogForm.id });
+
+            }
+        } else {
+            favoriteLog = new FavoriteLog();
+        }
+        Beans.copy(favoriteLogForm, favoriteLog).excludes("searchParams", "mode")
+
+        .execute();
+
+        return favoriteLog;
+    }
+
+    protected Map<String, String> createKeyMap() {
+        final Map<String, String> keys = new HashMap<String, String>();
+
+        keys.put("id", favoriteLogForm.id);
+
+        return keys;
+    }
+
     @Execute(validator = false, input = "error.jsp")
     public String deleteall() {
         favoriteLogService.deleteAll(favoriteLogPager);
@@ -71,7 +364,7 @@ public class FavoriteLogAction extends BsFavoriteLogAction {
             favoriteLogService.dump(writer, favoriteLogPager);
             writer.flush();
         } catch (final Exception e) {
-            log.error("Could not create FessSearchLog.csv.", e);
+            logger.error("Could not create FessSearchLog.csv.", e);
             throw new SSCActionMessagesException(e, "errors.could_not_create_search_log_csv");
         } finally {
             IOUtils.closeQuietly(writer);

+ 227 - 12
src/main/java/org/codelibs/fess/action/admin/FileCrawlingConfigAction.java

@@ -18,31 +18,55 @@ package org.codelibs.fess.action.admin;
 
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.codelibs.fess.action.base.FessAdminAction;
 import org.codelibs.fess.beans.FessBeans;
 import org.codelibs.fess.crud.CommonConstants;
 import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.action.admin.BsFileCrawlingConfigAction;
 import org.codelibs.fess.crud.util.SAStrutsUtil;
 import org.codelibs.fess.db.exentity.FileCrawlingConfig;
 import org.codelibs.fess.db.exentity.LabelType;
 import org.codelibs.fess.db.exentity.RoleType;
+import org.codelibs.fess.form.admin.FileCrawlingConfigForm;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.pager.FileCrawlingConfigPager;
 import org.codelibs.fess.service.FailureUrlService;
+import org.codelibs.fess.service.FileCrawlingConfigService;
 import org.codelibs.fess.service.LabelTypeService;
 import org.codelibs.fess.service.RoleTypeService;
+import org.codelibs.sastruts.core.annotation.Token;
 import org.codelibs.sastruts.core.exception.SSCActionMessagesException;
+import org.seasar.framework.beans.util.Beans;
+import org.seasar.framework.util.StringUtil;
+import org.seasar.struts.annotation.ActionForm;
 import org.seasar.struts.annotation.Execute;
 import org.seasar.struts.exception.ActionMessagesException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
-    private static final long serialVersionUID = 1L;
+public class FileCrawlingConfigAction extends FessAdminAction {
 
-    private static final Log log = LogFactory.getLog(FileCrawlingConfigAction.class);
+    private static final Logger logger = LoggerFactory.getLogger(FileCrawlingConfigAction.class);
+
+    // for list
+
+    public List<FileCrawlingConfig> fileCrawlingConfigItems;
+
+    // for edit/confirm/delete
+
+    @ActionForm
+    @Resource
+    protected FileCrawlingConfigForm fileCrawlingConfigForm;
+
+    @Resource
+    protected FileCrawlingConfigService fileCrawlingConfigService;
+
+    @Resource
+    protected FileCrawlingConfigPager fileCrawlingConfigPager;
 
     @Resource
     protected RoleTypeService roleTypeService;
@@ -60,7 +84,200 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
         return systemHelper.getHelpLink("fileCrawlingConfig");
     }
 
-    @Override
+    protected String displayList(final boolean redirect) {
+        // page navi
+        fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
+
+        // restore from pager
+        Beans.copy(fileCrawlingConfigPager, fileCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        if (redirect) {
+            return "index?redirect=true";
+        } else {
+            return "index.jsp";
+        }
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String index() {
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
+    public String list() {
+        // page navi
+        if (StringUtil.isNotBlank(fileCrawlingConfigForm.pageNumber)) {
+            try {
+                fileCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(fileCrawlingConfigForm.pageNumber));
+            } catch (final NumberFormatException e) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Invalid value: " + fileCrawlingConfigForm.pageNumber, e);
+                }
+            }
+        }
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String search() {
+        Beans.copy(fileCrawlingConfigForm.searchParams, fileCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String reset() {
+        fileCrawlingConfigPager.clear();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String back() {
+        return displayList(false);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editagain() {
+        return "edit.jsp";
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
+    public String confirmpage() {
+        if (fileCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
+                    fileCrawlingConfigForm.crudMode });
+        }
+
+        loadFileCrawlingConfig();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String createpage() {
+        // page navi
+        fileCrawlingConfigForm.initialize();
+        fileCrawlingConfigForm.crudMode = CommonConstants.CREATE_MODE;
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
+    public String editpage() {
+        if (fileCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
+                    fileCrawlingConfigForm.crudMode });
+        }
+
+        loadFileCrawlingConfig();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editfromconfirm() {
+        fileCrawlingConfigForm.crudMode = CommonConstants.EDIT_MODE;
+
+        loadFileCrawlingConfig();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromcreate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromupdate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
+    public String deletepage() {
+        if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
+                    fileCrawlingConfigForm.crudMode });
+        }
+
+        loadFileCrawlingConfig();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String deletefromconfirm() {
+        fileCrawlingConfigForm.crudMode = CommonConstants.DELETE_MODE;
+
+        loadFileCrawlingConfig();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String create() {
+        try {
+            final FileCrawlingConfig fileCrawlingConfig = createFileCrawlingConfig();
+            fileCrawlingConfigService.store(fileCrawlingConfig);
+            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
+        }
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String update() {
+        try {
+            final FileCrawlingConfig fileCrawlingConfig = createFileCrawlingConfig();
+            fileCrawlingConfigService.store(fileCrawlingConfig);
+            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
+        }
+    }
+
+    protected Map<String, String> createKeyMap() {
+        final Map<String, String> keys = new HashMap<String, String>();
+
+        keys.put("id", fileCrawlingConfigForm.id);
+
+        return keys;
+    }
+
     protected void loadFileCrawlingConfig() {
 
         final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
@@ -77,7 +294,6 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
         }
     }
 
-    @Override
     protected FileCrawlingConfig createFileCrawlingConfig() {
         FileCrawlingConfig fileCrawlingConfig;
         final String username = systemHelper.getUsername();
@@ -100,7 +316,6 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
         return fileCrawlingConfig;
     }
 
-    @Override
     @Execute(validator = false, input = "error.jsp")
     public String delete() {
         if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
@@ -127,13 +342,13 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
 
             return displayList(true);
         } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw e;
         } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
         } catch (final Exception e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
         }
     }

+ 296 - 3
src/main/java/org/codelibs/fess/action/admin/JobLogAction.java

@@ -17,19 +17,50 @@
 package org.codelibs.fess.action.admin;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
 import org.codelibs.fess.Constants;
-import org.codelibs.fess.crud.action.admin.BsJobLogAction;
+import org.codelibs.fess.action.base.FessAdminAction;
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.crud.CrudMessageException;
 import org.codelibs.fess.crud.util.SAStrutsUtil;
+import org.codelibs.fess.db.exentity.JobLog;
+import org.codelibs.fess.form.admin.JobLogForm;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.pager.JobLogPager;
+import org.codelibs.fess.service.JobLogService;
+import org.codelibs.sastruts.core.annotation.Token;
+import org.seasar.framework.beans.util.Beans;
+import org.seasar.framework.util.StringUtil;
+import org.seasar.struts.annotation.ActionForm;
 import org.seasar.struts.annotation.Execute;
+import org.seasar.struts.exception.ActionMessagesException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class JobLogAction extends BsJobLogAction {
+public class JobLogAction extends FessAdminAction {
 
-    private static final long serialVersionUID = 1L;
+    private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
+
+    // for list
+
+    public List<JobLog> jobLogItems;
+
+    // for edit/confirm/delete
+
+    @ActionForm
+    @Resource
+    protected JobLogForm jobLogForm;
+
+    @Resource
+    protected JobLogService jobLogService;
+
+    @Resource
+    protected JobLogPager jobLogPager;
 
     @Resource
     protected SystemHelper systemHelper;
@@ -38,6 +69,268 @@ public class JobLogAction extends BsJobLogAction {
         return systemHelper.getHelpLink("jobLog");
     }
 
+    protected String displayList(final boolean redirect) {
+        // page navi
+        jobLogItems = jobLogService.getJobLogList(jobLogPager);
+
+        // restore from pager
+        Beans.copy(jobLogPager, jobLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        if (redirect) {
+            return "index?redirect=true";
+        } else {
+            return "index.jsp";
+        }
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String index() {
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
+    public String list() {
+        // page navi
+        if (StringUtil.isNotBlank(jobLogForm.pageNumber)) {
+            try {
+                jobLogPager.setCurrentPageNumber(Integer.parseInt(jobLogForm.pageNumber));
+            } catch (final NumberFormatException e) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Invalid value: " + jobLogForm.pageNumber, e);
+                }
+            }
+        }
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String search() {
+        Beans.copy(jobLogForm.searchParams, jobLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String reset() {
+        jobLogPager.clear();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String back() {
+        return displayList(false);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editagain() {
+        return "edit.jsp";
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
+    public String confirmpage() {
+        if (jobLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode",
+                    new Object[] { CommonConstants.CONFIRM_MODE, jobLogForm.crudMode });
+        }
+
+        loadJobLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String createpage() {
+        // page navi
+        jobLogForm.initialize();
+        jobLogForm.crudMode = CommonConstants.CREATE_MODE;
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
+    public String editpage() {
+        if (jobLogForm.crudMode != CommonConstants.EDIT_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, jobLogForm.crudMode });
+        }
+
+        loadJobLog();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editfromconfirm() {
+        jobLogForm.crudMode = CommonConstants.EDIT_MODE;
+
+        loadJobLog();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromcreate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromupdate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
+    public String deletepage() {
+        if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
+        }
+
+        loadJobLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String deletefromconfirm() {
+        jobLogForm.crudMode = CommonConstants.DELETE_MODE;
+
+        loadJobLog();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String create() {
+        try {
+            final JobLog jobLog = createJobLog();
+            jobLogService.store(jobLog);
+            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
+        }
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String update() {
+        try {
+            final JobLog jobLog = createJobLog();
+            jobLogService.store(jobLog);
+            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
+        }
+    }
+
+    @Token(save = false, validate = true)
+    @Execute(validator = false, input = "error.jsp")
+    public String delete() {
+        if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
+        }
+
+        try {
+            final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
+            if (jobLog == null) {
+                // throw an exception
+                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+                new Object[] { jobLogForm.id });
+
+            }
+
+            jobLogService.delete(jobLog);
+            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
+        }
+    }
+
+    protected void loadJobLog() {
+
+        final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
+        if (jobLog == null) {
+            // throw an exception
+            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+            new Object[] { jobLogForm.id });
+
+        }
+
+        Beans.copy(jobLog, jobLogForm).excludes("searchParams", "mode")
+
+        .execute();
+    }
+
+    protected JobLog createJobLog() {
+        JobLog jobLog;
+        if (jobLogForm.crudMode == CommonConstants.EDIT_MODE) {
+            jobLog = jobLogService.getJobLog(createKeyMap());
+            if (jobLog == null) {
+                // throw an exception
+                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
+
+                new Object[] { jobLogForm.id });
+
+            }
+        } else {
+            jobLog = new JobLog();
+        }
+        Beans.copy(jobLogForm, jobLog).excludes("searchParams", "mode")
+
+        .execute();
+
+        return jobLog;
+    }
+
+    protected Map<String, String> createKeyMap() {
+        final Map<String, String> keys = new HashMap<String, String>();
+
+        keys.put("id", jobLogForm.id);
+
+        return keys;
+    }
+
     @Execute(validator = false, input = "error.jsp")
     public String deleteall() {
         final List<String> jobStatusList = new ArrayList<String>();

+ 215 - 18
src/main/java/org/codelibs/fess/action/admin/KeyMatchAction.java

@@ -17,29 +17,52 @@
 package org.codelibs.fess.action.admin;
 
 import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.codelibs.fess.action.base.FessAdminAction;
 import org.codelibs.fess.beans.FessBeans;
 import org.codelibs.fess.crud.CommonConstants;
 import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.action.admin.BsKeyMatchAction;
 import org.codelibs.fess.crud.util.SAStrutsUtil;
 import org.codelibs.fess.db.exentity.KeyMatch;
+import org.codelibs.fess.form.admin.KeyMatchForm;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.pager.KeyMatchPager;
+import org.codelibs.fess.service.KeyMatchService;
 import org.codelibs.fess.util.ComponentUtil;
 import org.codelibs.sastruts.core.annotation.Token;
 import org.codelibs.sastruts.core.exception.SSCActionMessagesException;
+import org.seasar.framework.beans.util.Beans;
+import org.seasar.framework.util.StringUtil;
+import org.seasar.struts.annotation.ActionForm;
 import org.seasar.struts.annotation.Execute;
 import org.seasar.struts.exception.ActionMessagesException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class KeyMatchAction extends BsKeyMatchAction {
+public class KeyMatchAction extends FessAdminAction {
 
-    private static final long serialVersionUID = 1L;
+    private static final Logger logger = LoggerFactory.getLogger(KeyMatchAction.class);
 
-    private static final Log log = LogFactory.getLog(KeyMatchAction.class);
+    // for list
+
+    public List<KeyMatch> keyMatchItems;
+
+    // for edit/confirm/delete
+
+    @ActionForm
+    @Resource
+    protected KeyMatchForm keyMatchForm;
+
+    @Resource
+    protected KeyMatchService keyMatchService;
+
+    @Resource
+    protected KeyMatchPager keyMatchPager;
 
     @Resource
     protected SystemHelper systemHelper;
@@ -48,7 +71,157 @@ public class KeyMatchAction extends BsKeyMatchAction {
         return systemHelper.getHelpLink("keyMatch");
     }
 
-    @Override
+    protected String displayList(final boolean redirect) {
+        // page navi
+        keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
+
+        // restore from pager
+        Beans.copy(keyMatchPager, keyMatchForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        if (redirect) {
+            return "index?redirect=true";
+        } else {
+            return "index.jsp";
+        }
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String index() {
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
+    public String list() {
+        // page navi
+        if (StringUtil.isNotBlank(keyMatchForm.pageNumber)) {
+            try {
+                keyMatchPager.setCurrentPageNumber(Integer.parseInt(keyMatchForm.pageNumber));
+            } catch (final NumberFormatException e) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Invalid value: " + keyMatchForm.pageNumber, e);
+                }
+            }
+        }
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String search() {
+        Beans.copy(keyMatchForm.searchParams, keyMatchPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
+
+        .execute();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String reset() {
+        keyMatchPager.clear();
+
+        return displayList(false);
+    }
+
+    @Execute(validator = false, input = "error.jsp")
+    public String back() {
+        return displayList(false);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editagain() {
+        return "edit.jsp";
+    }
+
+    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
+    public String confirmpage() {
+        if (keyMatchForm.crudMode != CommonConstants.CONFIRM_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
+                    keyMatchForm.crudMode });
+        }
+
+        loadKeyMatch();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String createpage() {
+        // page navi
+        keyMatchForm.initialize();
+        keyMatchForm.crudMode = CommonConstants.CREATE_MODE;
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
+    public String editpage() {
+        if (keyMatchForm.crudMode != CommonConstants.EDIT_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
+        }
+
+        loadKeyMatch();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String editfromconfirm() {
+        keyMatchForm.crudMode = CommonConstants.EDIT_MODE;
+
+        loadKeyMatch();
+
+        return "edit.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromcreate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute(validator = true, input = "edit.jsp")
+    public String confirmfromupdate() {
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
+    public String deletepage() {
+        if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
+            throw new ActionMessagesException("errors.crud_invalid_mode",
+                    new Object[] { CommonConstants.DELETE_MODE, keyMatchForm.crudMode });
+        }
+
+        loadKeyMatch();
+
+        return "confirm.jsp";
+    }
+
+    @Token(save = true, validate = false)
+    @Execute(validator = false, input = "error.jsp")
+    public String deletefromconfirm() {
+        keyMatchForm.crudMode = CommonConstants.DELETE_MODE;
+
+        loadKeyMatch();
+
+        return "confirm.jsp";
+    }
+
+    protected Map<String, String> createKeyMap() {
+        final Map<String, String> keys = new HashMap<String, String>();
+
+        keys.put("id", keyMatchForm.id);
+
+        return keys;
+    }
+
     protected void loadKeyMatch() {
 
         final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
@@ -60,7 +233,6 @@ public class KeyMatchAction extends BsKeyMatchAction {
         FessBeans.copy(keyMatch, keyMatchForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
     }
 
-    @Override
     protected KeyMatch createKeyMatch() {
         KeyMatch keyMatch;
         final String username = systemHelper.getUsername();
@@ -83,25 +255,50 @@ public class KeyMatchAction extends BsKeyMatchAction {
         return keyMatch;
     }
 
-    @Override
     @Token(save = false, validate = true)
     @Execute(validator = true, input = "edit.jsp")
     public String create() {
-        final String result = super.create();
         ComponentUtil.getKeyMatchHelper().update();
-        return result;
+        try {
+            final KeyMatch keyMatch = createKeyMatch();
+            keyMatchService.store(keyMatch);
+            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
+        }
     }
 
-    @Override
     @Token(save = false, validate = true)
     @Execute(validator = true, input = "edit.jsp")
     public String update() {
-        final String result = super.update();
         ComponentUtil.getKeyMatchHelper().update();
-        return result;
+        try {
+            final KeyMatch keyMatch = createKeyMatch();
+            keyMatchService.store(keyMatch);
+            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
+
+            return displayList(true);
+        } catch (final ActionMessagesException e) {
+            logger.error(e.getMessage(), e);
+            throw e;
+        } catch (final CrudMessageException e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
+        } catch (final Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
+        }
     }
 
-    @Override
     @Execute(validator = false, input = "error.jsp")
     public String delete() {
         if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
@@ -128,13 +325,13 @@ public class KeyMatchAction extends BsKeyMatchAction {
 
             return displayList(true);
         } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw e;
         } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
         } catch (final Exception e) {
-            log.error(e.getMessage(), e);
+            logger.error(e.getMessage(), e);
             throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
         }
     }

+ 0 - 328
src/main/java/org/codelibs/fess/crud/action/admin/BsFavoriteLogAction.java

@@ -1,328 +0,0 @@
-/*
- * Copyright 2009-2015 the CodeLibs Project and the Others.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-package org.codelibs.fess.crud.action.admin;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.db.exentity.FavoriteLog;
-import org.codelibs.fess.form.admin.FavoriteLogForm;
-import org.codelibs.fess.pager.FavoriteLogPager;
-import org.codelibs.fess.service.FavoriteLogService;
-import org.codelibs.sastruts.core.annotation.Token;
-import org.seasar.framework.beans.util.Beans;
-import org.seasar.framework.util.StringUtil;
-import org.seasar.struts.annotation.ActionForm;
-import org.seasar.struts.annotation.Execute;
-import org.seasar.struts.exception.ActionMessagesException;
-
-public class BsFavoriteLogAction implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final Log log = LogFactory.getLog(BsFavoriteLogAction.class);
-
-    // for list
-
-    public List<FavoriteLog> favoriteLogItems;
-
-    // for edit/confirm/delete
-
-    @ActionForm
-    @Resource
-    protected FavoriteLogForm favoriteLogForm;
-
-    @Resource
-    protected FavoriteLogService favoriteLogService;
-
-    @Resource
-    protected FavoriteLogPager favoriteLogPager;
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        favoriteLogItems = favoriteLogService.getFavoriteLogList(favoriteLogPager);
-
-        // restore from pager
-        Beans.copy(favoriteLogPager, favoriteLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        if (redirect) {
-            return "index?redirect=true";
-        } else {
-            return "index.jsp";
-        }
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String index() {
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
-    public String list() {
-        // page navi
-        if (StringUtil.isNotBlank(favoriteLogForm.pageNumber)) {
-            try {
-                favoriteLogPager.setCurrentPageNumber(Integer.parseInt(favoriteLogForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Invalid value: " + favoriteLogForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String search() {
-        Beans.copy(favoriteLogForm.searchParams, favoriteLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        favoriteLogPager.clear();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String back() {
-        return displayList(false);
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editagain() {
-        return "edit.jsp";
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
-    public String confirmpage() {
-        if (favoriteLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    favoriteLogForm.crudMode });
-        }
-
-        loadFavoriteLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        favoriteLogForm.initialize();
-        favoriteLogForm.crudMode = CommonConstants.CREATE_MODE;
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
-    public String editpage() {
-        if (favoriteLogForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
-                    favoriteLogForm.crudMode });
-        }
-
-        loadFavoriteLog();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        favoriteLogForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadFavoriteLog();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromcreate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromupdate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
-    public String deletepage() {
-        if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    favoriteLogForm.crudMode });
-        }
-
-        loadFavoriteLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        favoriteLogForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadFavoriteLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final FavoriteLog favoriteLog = createFavoriteLog();
-            favoriteLogService.store(favoriteLog);
-            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String update() {
-        try {
-            final FavoriteLog favoriteLog = createFavoriteLog();
-            favoriteLogService.store(favoriteLog);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    favoriteLogForm.crudMode });
-        }
-
-        try {
-            final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
-            if (favoriteLog == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { favoriteLogForm.id });
-
-            }
-
-            favoriteLogService.delete(favoriteLog);
-            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    protected void loadFavoriteLog() {
-
-        final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
-        if (favoriteLog == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-            new Object[] { favoriteLogForm.id });
-
-        }
-
-        Beans.copy(favoriteLog, favoriteLogForm).excludes("searchParams", "mode")
-
-        .execute();
-    }
-
-    protected FavoriteLog createFavoriteLog() {
-        FavoriteLog favoriteLog;
-        if (favoriteLogForm.crudMode == CommonConstants.EDIT_MODE) {
-            favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
-            if (favoriteLog == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { favoriteLogForm.id });
-
-            }
-        } else {
-            favoriteLog = new FavoriteLog();
-        }
-        Beans.copy(favoriteLogForm, favoriteLog).excludes("searchParams", "mode")
-
-        .execute();
-
-        return favoriteLog;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", favoriteLogForm.id);
-
-        return keys;
-    }
-}

+ 0 - 328
src/main/java/org/codelibs/fess/crud/action/admin/BsFileCrawlingConfigAction.java

@@ -1,328 +0,0 @@
-/*
- * Copyright 2009-2015 the CodeLibs Project and the Others.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-package org.codelibs.fess.crud.action.admin;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.db.exentity.FileCrawlingConfig;
-import org.codelibs.fess.form.admin.FileCrawlingConfigForm;
-import org.codelibs.fess.pager.FileCrawlingConfigPager;
-import org.codelibs.fess.service.FileCrawlingConfigService;
-import org.codelibs.sastruts.core.annotation.Token;
-import org.seasar.framework.beans.util.Beans;
-import org.seasar.framework.util.StringUtil;
-import org.seasar.struts.annotation.ActionForm;
-import org.seasar.struts.annotation.Execute;
-import org.seasar.struts.exception.ActionMessagesException;
-
-public class BsFileCrawlingConfigAction implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final Log log = LogFactory.getLog(BsFileCrawlingConfigAction.class);
-
-    // for list
-
-    public List<FileCrawlingConfig> fileCrawlingConfigItems;
-
-    // for edit/confirm/delete
-
-    @ActionForm
-    @Resource
-    protected FileCrawlingConfigForm fileCrawlingConfigForm;
-
-    @Resource
-    protected FileCrawlingConfigService fileCrawlingConfigService;
-
-    @Resource
-    protected FileCrawlingConfigPager fileCrawlingConfigPager;
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
-
-        // restore from pager
-        Beans.copy(fileCrawlingConfigPager, fileCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        if (redirect) {
-            return "index?redirect=true";
-        } else {
-            return "index.jsp";
-        }
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String index() {
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
-    public String list() {
-        // page navi
-        if (StringUtil.isNotBlank(fileCrawlingConfigForm.pageNumber)) {
-            try {
-                fileCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(fileCrawlingConfigForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Invalid value: " + fileCrawlingConfigForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String search() {
-        Beans.copy(fileCrawlingConfigForm.searchParams, fileCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        fileCrawlingConfigPager.clear();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String back() {
-        return displayList(false);
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editagain() {
-        return "edit.jsp";
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
-    public String confirmpage() {
-        if (fileCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    fileCrawlingConfigForm.crudMode });
-        }
-
-        loadFileCrawlingConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        fileCrawlingConfigForm.initialize();
-        fileCrawlingConfigForm.crudMode = CommonConstants.CREATE_MODE;
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
-    public String editpage() {
-        if (fileCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
-                    fileCrawlingConfigForm.crudMode });
-        }
-
-        loadFileCrawlingConfig();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        fileCrawlingConfigForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadFileCrawlingConfig();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromcreate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromupdate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
-    public String deletepage() {
-        if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    fileCrawlingConfigForm.crudMode });
-        }
-
-        loadFileCrawlingConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        fileCrawlingConfigForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadFileCrawlingConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final FileCrawlingConfig fileCrawlingConfig = createFileCrawlingConfig();
-            fileCrawlingConfigService.store(fileCrawlingConfig);
-            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String update() {
-        try {
-            final FileCrawlingConfig fileCrawlingConfig = createFileCrawlingConfig();
-            fileCrawlingConfigService.store(fileCrawlingConfig);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    fileCrawlingConfigForm.crudMode });
-        }
-
-        try {
-            final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
-            if (fileCrawlingConfig == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { fileCrawlingConfigForm.id });
-
-            }
-
-            fileCrawlingConfigService.delete(fileCrawlingConfig);
-            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    protected void loadFileCrawlingConfig() {
-
-        final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
-        if (fileCrawlingConfig == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-            new Object[] { fileCrawlingConfigForm.id });
-
-        }
-
-        Beans.copy(fileCrawlingConfig, fileCrawlingConfigForm).excludes("searchParams", "mode")
-
-        .execute();
-    }
-
-    protected FileCrawlingConfig createFileCrawlingConfig() {
-        FileCrawlingConfig fileCrawlingConfig;
-        if (fileCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
-            fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
-            if (fileCrawlingConfig == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { fileCrawlingConfigForm.id });
-
-            }
-        } else {
-            fileCrawlingConfig = new FileCrawlingConfig();
-        }
-        Beans.copy(fileCrawlingConfigForm, fileCrawlingConfig).excludes("searchParams", "mode")
-
-        .execute();
-
-        return fileCrawlingConfig;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", fileCrawlingConfigForm.id);
-
-        return keys;
-    }
-}

+ 0 - 325
src/main/java/org/codelibs/fess/crud/action/admin/BsJobLogAction.java

@@ -1,325 +0,0 @@
-/*
- * Copyright 2009-2015 the CodeLibs Project and the Others.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-package org.codelibs.fess.crud.action.admin;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.db.exentity.JobLog;
-import org.codelibs.fess.form.admin.JobLogForm;
-import org.codelibs.fess.pager.JobLogPager;
-import org.codelibs.fess.service.JobLogService;
-import org.codelibs.sastruts.core.annotation.Token;
-import org.seasar.framework.beans.util.Beans;
-import org.seasar.framework.util.StringUtil;
-import org.seasar.struts.annotation.ActionForm;
-import org.seasar.struts.annotation.Execute;
-import org.seasar.struts.exception.ActionMessagesException;
-
-public class BsJobLogAction implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final Log log = LogFactory.getLog(BsJobLogAction.class);
-
-    // for list
-
-    public List<JobLog> jobLogItems;
-
-    // for edit/confirm/delete
-
-    @ActionForm
-    @Resource
-    protected JobLogForm jobLogForm;
-
-    @Resource
-    protected JobLogService jobLogService;
-
-    @Resource
-    protected JobLogPager jobLogPager;
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        jobLogItems = jobLogService.getJobLogList(jobLogPager);
-
-        // restore from pager
-        Beans.copy(jobLogPager, jobLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        if (redirect) {
-            return "index?redirect=true";
-        } else {
-            return "index.jsp";
-        }
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String index() {
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
-    public String list() {
-        // page navi
-        if (StringUtil.isNotBlank(jobLogForm.pageNumber)) {
-            try {
-                jobLogPager.setCurrentPageNumber(Integer.parseInt(jobLogForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Invalid value: " + jobLogForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String search() {
-        Beans.copy(jobLogForm.searchParams, jobLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        jobLogPager.clear();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String back() {
-        return displayList(false);
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editagain() {
-        return "edit.jsp";
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
-    public String confirmpage() {
-        if (jobLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.CONFIRM_MODE, jobLogForm.crudMode });
-        }
-
-        loadJobLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        jobLogForm.initialize();
-        jobLogForm.crudMode = CommonConstants.CREATE_MODE;
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
-    public String editpage() {
-        if (jobLogForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, jobLogForm.crudMode });
-        }
-
-        loadJobLog();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        jobLogForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadJobLog();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromcreate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromupdate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
-    public String deletepage() {
-        if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
-        }
-
-        loadJobLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        jobLogForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadJobLog();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final JobLog jobLog = createJobLog();
-            jobLogService.store(jobLog);
-            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String update() {
-        try {
-            final JobLog jobLog = createJobLog();
-            jobLogService.store(jobLog);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
-        }
-
-        try {
-            final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
-            if (jobLog == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { jobLogForm.id });
-
-            }
-
-            jobLogService.delete(jobLog);
-            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    protected void loadJobLog() {
-
-        final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
-        if (jobLog == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-            new Object[] { jobLogForm.id });
-
-        }
-
-        Beans.copy(jobLog, jobLogForm).excludes("searchParams", "mode")
-
-        .execute();
-    }
-
-    protected JobLog createJobLog() {
-        JobLog jobLog;
-        if (jobLogForm.crudMode == CommonConstants.EDIT_MODE) {
-            jobLog = jobLogService.getJobLog(createKeyMap());
-            if (jobLog == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { jobLogForm.id });
-
-            }
-        } else {
-            jobLog = new JobLog();
-        }
-        Beans.copy(jobLogForm, jobLog).excludes("searchParams", "mode")
-
-        .execute();
-
-        return jobLog;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", jobLogForm.id);
-
-        return keys;
-    }
-}

+ 0 - 327
src/main/java/org/codelibs/fess/crud/action/admin/BsKeyMatchAction.java

@@ -1,327 +0,0 @@
-/*
- * Copyright 2009-2015 the CodeLibs Project and the Others.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
- */
-
-package org.codelibs.fess.crud.action.admin;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.db.exentity.KeyMatch;
-import org.codelibs.fess.form.admin.KeyMatchForm;
-import org.codelibs.fess.pager.KeyMatchPager;
-import org.codelibs.fess.service.KeyMatchService;
-import org.codelibs.sastruts.core.annotation.Token;
-import org.seasar.framework.beans.util.Beans;
-import org.seasar.framework.util.StringUtil;
-import org.seasar.struts.annotation.ActionForm;
-import org.seasar.struts.annotation.Execute;
-import org.seasar.struts.exception.ActionMessagesException;
-
-public class BsKeyMatchAction implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final Log log = LogFactory.getLog(BsKeyMatchAction.class);
-
-    // for list
-
-    public List<KeyMatch> keyMatchItems;
-
-    // for edit/confirm/delete
-
-    @ActionForm
-    @Resource
-    protected KeyMatchForm keyMatchForm;
-
-    @Resource
-    protected KeyMatchService keyMatchService;
-
-    @Resource
-    protected KeyMatchPager keyMatchPager;
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
-
-        // restore from pager
-        Beans.copy(keyMatchPager, keyMatchForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        if (redirect) {
-            return "index?redirect=true";
-        } else {
-            return "index.jsp";
-        }
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String index() {
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
-    public String list() {
-        // page navi
-        if (StringUtil.isNotBlank(keyMatchForm.pageNumber)) {
-            try {
-                keyMatchPager.setCurrentPageNumber(Integer.parseInt(keyMatchForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Invalid value: " + keyMatchForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String search() {
-        Beans.copy(keyMatchForm.searchParams, keyMatchPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
-
-        .execute();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        keyMatchPager.clear();
-
-        return displayList(false);
-    }
-
-    @Execute(validator = false, input = "error.jsp")
-    public String back() {
-        return displayList(false);
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editagain() {
-        return "edit.jsp";
-    }
-
-    @Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
-    public String confirmpage() {
-        if (keyMatchForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    keyMatchForm.crudMode });
-        }
-
-        loadKeyMatch();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        keyMatchForm.initialize();
-        keyMatchForm.crudMode = CommonConstants.CREATE_MODE;
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
-    public String editpage() {
-        if (keyMatchForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
-        }
-
-        loadKeyMatch();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        keyMatchForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadKeyMatch();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromcreate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true, keep = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String confirmfromupdate() {
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
-    public String deletepage() {
-        if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.DELETE_MODE, keyMatchForm.crudMode });
-        }
-
-        loadKeyMatch();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    @Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        keyMatchForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadKeyMatch();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final KeyMatch keyMatch = createKeyMatch();
-            keyMatchService.store(keyMatch);
-            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = true, input = "edit.jsp")
-    public String update() {
-        try {
-            final KeyMatch keyMatch = createKeyMatch();
-            keyMatchService.store(keyMatch);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    @Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.DELETE_MODE, keyMatchForm.crudMode });
-        }
-
-        try {
-            final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
-            if (keyMatch == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { keyMatchForm.id });
-
-            }
-
-            keyMatchService.delete(keyMatch);
-            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    protected void loadKeyMatch() {
-
-        final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
-        if (keyMatch == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-            new Object[] { keyMatchForm.id });
-
-        }
-
-        Beans.copy(keyMatch, keyMatchForm).excludes("searchParams", "mode")
-
-        .execute();
-    }
-
-    protected KeyMatch createKeyMatch() {
-        KeyMatch keyMatch;
-        if (keyMatchForm.crudMode == CommonConstants.EDIT_MODE) {
-            keyMatch = keyMatchService.getKeyMatch(createKeyMap());
-            if (keyMatch == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { keyMatchForm.id });
-
-            }
-        } else {
-            keyMatch = new KeyMatch();
-        }
-        Beans.copy(keyMatchForm, keyMatch).excludes("searchParams", "mode")
-
-        .execute();
-
-        return keyMatch;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", keyMatchForm.id);
-
-        return keys;
-    }
-}