浏览代码

JobLogAction.java

Shunji Makino 10 年之前
父节点
当前提交
81dc804122

二进制
src/main/h2/webapp/WEB-INF/db/fess.mv.db


+ 105 - 0
src/main/java/org/codelibs/fess/action/admin/FileCrawlingConfigAction.java

@@ -51,7 +51,11 @@ import org.slf4j.LoggerFactory;
 public class FileCrawlingConfigAction extends FessAdminAction {
 public class FileCrawlingConfigAction extends FessAdminAction {
 
 
     private static final Logger logger = LoggerFactory.getLogger(FileCrawlingConfigAction.class);
     private static final Logger logger = LoggerFactory.getLogger(FileCrawlingConfigAction.class);
+<<<<<<< HEAD
 
 
+=======
+    
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
     // for list
     // for list
 
 
     public List<FileCrawlingConfig> fileCrawlingConfigItems;
     public List<FileCrawlingConfig> fileCrawlingConfigItems;
@@ -83,7 +87,102 @@ public class FileCrawlingConfigAction extends FessAdminAction {
     public String getHelpLink() {
     public String getHelpLink() {
         return systemHelper.getHelpLink("fileCrawlingConfig");
         return systemHelper.getHelpLink("fileCrawlingConfig");
     }
     }
+    
+    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 });
+        }
 
 
+<<<<<<< HEAD
     protected String displayList(final boolean redirect) {
     protected String displayList(final boolean redirect) {
         // page navi
         // page navi
         fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
         fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
@@ -178,6 +277,8 @@ public class FileCrawlingConfigAction extends FessAdminAction {
                     fileCrawlingConfigForm.crudMode });
                     fileCrawlingConfigForm.crudMode });
         }
         }
 
 
+=======
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
         loadFileCrawlingConfig();
         loadFileCrawlingConfig();
 
 
         return "edit.jsp";
         return "edit.jsp";
@@ -277,7 +378,11 @@ public class FileCrawlingConfigAction extends FessAdminAction {
 
 
         return keys;
         return keys;
     }
     }
+<<<<<<< HEAD
 
 
+=======
+    
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
     protected void loadFileCrawlingConfig() {
     protected void loadFileCrawlingConfig() {
 
 
         final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
         final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());

+ 278 - 0
src/main/java/org/codelibs/fess/action/admin/JobLogAction.java

@@ -27,6 +27,13 @@ import org.codelibs.fess.Constants;
 import org.codelibs.fess.action.base.FessAdminAction;
 import org.codelibs.fess.action.base.FessAdminAction;
 import org.codelibs.fess.crud.CommonConstants;
 import org.codelibs.fess.crud.CommonConstants;
 import org.codelibs.fess.crud.CrudMessageException;
 import org.codelibs.fess.crud.CrudMessageException;
+<<<<<<< HEAD
+=======
+<<<<<<< HEAD
+=======
+import org.codelibs.fess.crud.action.admin.BsJobLogAction;
+>>>>>>> 51bcde16892e677a8f00914daaa2b948b12451c6
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
 import org.codelibs.fess.crud.util.SAStrutsUtil;
 import org.codelibs.fess.crud.util.SAStrutsUtil;
 import org.codelibs.fess.db.exentity.JobLog;
 import org.codelibs.fess.db.exentity.JobLog;
 import org.codelibs.fess.form.admin.JobLogForm;
 import org.codelibs.fess.form.admin.JobLogForm;
@@ -44,8 +51,17 @@ import org.slf4j.LoggerFactory;
 
 
 public class JobLogAction extends FessAdminAction {
 public class JobLogAction extends FessAdminAction {
 
 
+<<<<<<< HEAD
     private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
     private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
 
 
+=======
+<<<<<<< HEAD
+	private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
+=======
+	private static final Logger logger = LoggerFactory.getLogger(BsJobLogAction.class);
+>>>>>>> 51bcde16892e677a8f00914daaa2b948b12451c6
+    
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
     // for list
     // for list
 
 
     public List<JobLog> jobLogItems;
     public List<JobLog> jobLogItems;
@@ -68,6 +84,268 @@ public class JobLogAction extends FessAdminAction {
     public String getHelpLink() {
     public String getHelpLink() {
         return systemHelper.getHelpLink("jobLog");
         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;
+    }
 
 
     protected String displayList(final boolean redirect) {
     protected String displayList(final boolean redirect) {
         // page navi
         // page navi

+ 127 - 0
src/main/java/org/codelibs/fess/action/admin/KeyMatchAction.java

@@ -47,6 +47,7 @@ import org.slf4j.LoggerFactory;
 public class KeyMatchAction extends FessAdminAction {
 public class KeyMatchAction extends FessAdminAction {
 
 
     private static final Logger logger = LoggerFactory.getLogger(KeyMatchAction.class);
     private static final Logger logger = LoggerFactory.getLogger(KeyMatchAction.class);
+<<<<<<< HEAD
 
 
     // for list
     // for list
 
 
@@ -63,14 +64,126 @@ public class KeyMatchAction extends FessAdminAction {
 
 
     @Resource
     @Resource
     protected KeyMatchPager keyMatchPager;
     protected KeyMatchPager keyMatchPager;
+=======
+    
+    // for list
+
+    public List<KeyMatch> keyMatchItems;
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
+
+    // for edit/confirm/delete
+
+    @ActionForm
+    @Resource
+    protected KeyMatchForm keyMatchForm;
 
 
+    @Resource
+    protected KeyMatchService keyMatchService;
+
+    @Resource
+    protected KeyMatchPager keyMatchPager;
+    
     @Resource
     @Resource
     protected SystemHelper systemHelper;
     protected SystemHelper systemHelper;
 
 
     public String getHelpLink() {
     public String getHelpLink() {
         return systemHelper.getHelpLink("keyMatch");
         return systemHelper.getHelpLink("keyMatch");
     }
     }
+    
+    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 });
+        }
+
+<<<<<<< HEAD
     protected String displayList(final boolean redirect) {
     protected String displayList(final boolean redirect) {
         // page navi
         // page navi
         keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
         keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
@@ -164,6 +277,8 @@ public class KeyMatchAction extends FessAdminAction {
             throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
             throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
         }
         }
 
 
+=======
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
         loadKeyMatch();
         loadKeyMatch();
 
 
         return "edit.jsp";
         return "edit.jsp";
@@ -221,7 +336,11 @@ public class KeyMatchAction extends FessAdminAction {
 
 
         return keys;
         return keys;
     }
     }
+<<<<<<< HEAD
 
 
+=======
+    
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
     protected void loadKeyMatch() {
     protected void loadKeyMatch() {
 
 
         final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
         final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
@@ -280,14 +399,22 @@ public class KeyMatchAction extends FessAdminAction {
     @Token(save = false, validate = true)
     @Token(save = false, validate = true)
     @Execute(validator = true, input = "edit.jsp")
     @Execute(validator = true, input = "edit.jsp")
     public String update() {
     public String update() {
+<<<<<<< HEAD
+=======
+        ComponentUtil.getKeyMatchHelper().update();
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
         try {
         try {
             final KeyMatch keyMatch = createKeyMatch();
             final KeyMatch keyMatch = createKeyMatch();
             keyMatchService.store(keyMatch);
             keyMatchService.store(keyMatch);
             SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
             SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
 
 
+<<<<<<< HEAD
             final String result = displayList(true);
             final String result = displayList(true);
             ComponentUtil.getKeyMatchHelper().update();
             ComponentUtil.getKeyMatchHelper().update();
             return result;
             return result;
+=======
+            return displayList(true);
+>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
         } catch (final ActionMessagesException e) {
         } catch (final ActionMessagesException e) {
             logger.error(e.getMessage(), e);
             logger.error(e.getMessage(), e);
             throw e;
             throw e;