Browse Source

Merge pull request #323 from kw-udon/lastaflute-dev

Lastaflute: log, failureUrl
Shinsuke Sugaya 9 years ago
parent
commit
ead53fab67

+ 0 - 8
pom.xml

@@ -98,22 +98,14 @@
 						<exclude>org/codelibs/fess/app/web/admin/dict/UserDictAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/dict/UserDictAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/dict/SynonymAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/dict/SynonymAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DocumentAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DocumentAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/SystemAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DictForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DictForm.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/SystemForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/SearchListAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/SearchListAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/SuggestElevateWordForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DocumentForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DocumentForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DataForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DataForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/IndexAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/IndexAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/LogAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/FailureUrlAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DictAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DictAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/SuggestElevateWordAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/LogForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DataAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DataAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/WizardForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/WizardForm.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/FailureUrlForm.java</exclude>
 					</excludes>
 					</excludes>
 				</configuration>
 				</configuration>
 			</plugin>
 			</plugin>

+ 0 - 331
src/main/java/org/codelibs/fess/app/web/admin/FailureUrlAction.java

@@ -1,331 +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.app.web.admin;
-
-import java.beans.Beans;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.codelibs.core.beans.util.BeanUtil;
-import org.codelibs.fess.annotation.Token;
-import org.codelibs.fess.app.web.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.es.exentity.FailureUrl;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.app.pager.FailureUrlPager;
-import org.codelibs.fess.app.service.FailureUrlService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FailureUrlAction extends FessAdminAction {
-
-    private static final Logger logger = LoggerFactory.getLogger(FailureUrlAction.class);
-
-    // for list
-
-    public List<FailureUrl> failureUrlItems;
-
-    // for edit/confirm/delete
-
-    //@ActionForm
-    @Resource
-    protected FailureUrlForm failureUrlForm;
-
-    @Resource
-    protected FailureUrlService failureUrlService;
-
-    @Resource
-    protected FailureUrlPager failureUrlPager;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("failureUrl");
-    }
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        failureUrlItems = failureUrlService.getFailureUrlList(failureUrlPager);
-
-        // restore from pager
-        BeanUtil.copyBeanToBean(failureUrlPager, failureUrlForm.searchParams,
-                option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        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(failureUrlForm.pageNumber)) {
-            try {
-                failureUrlPager.setCurrentPageNumber(Integer.parseInt(failureUrlForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Invalid value: " + failureUrlForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String search() {
-        BeanUtil.copyBeanToBean(failureUrlForm.searchParams, failureUrlPager,
-                option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        failureUrlPager.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 (failureUrlForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    failureUrlForm.crudMode });
-        }
-
-        loadFailureUrl();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        failureUrlForm.initialize();
-        failureUrlForm.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 (failureUrlForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.EDIT_MODE, failureUrlForm.crudMode });
-        }
-
-        loadFailureUrl();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        failureUrlForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadFailureUrl();
-
-        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 (failureUrlForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    failureUrlForm.crudMode });
-        }
-
-        loadFailureUrl();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        failureUrlForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadFailureUrl();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final FailureUrl failureUrl = createFailureUrl();
-            failureUrlService.store(failureUrl);
-            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 FailureUrl failureUrl = createFailureUrl();
-            failureUrlService.store(failureUrl);
-            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 (failureUrlForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    failureUrlForm.crudMode });
-        }
-
-        try {
-            final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap());
-            if (failureUrl == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { failureUrlForm.id });
-
-            }
-
-            failureUrlService.delete(failureUrl);
-            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 loadFailureUrl() {
-
-        final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap());
-        if (failureUrl == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-            new Object[] { failureUrlForm.id });
-
-        }
-
-        BeanUtil.copyBeanToBean(failureUrl, failureUrlForm, option -> option.exclude("searchParams", "mode"));
-    }
-
-    protected FailureUrl createFailureUrl() {
-        FailureUrl failureUrl;
-        if (failureUrlForm.crudMode == CommonConstants.EDIT_MODE) {
-            failureUrl = failureUrlService.getFailureUrl(createKeyMap());
-            if (failureUrl == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { failureUrlForm.id });
-
-            }
-        } else {
-            failureUrl = new FailureUrl();
-        }
-        BeanUtil.copyBeanToBean(failureUrlForm, failureUrl, option -> option.exclude("searchParams", "mode"));
-
-        return failureUrl;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", failureUrlForm.id);
-
-        return keys;
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String deleteall() {
-        failureUrlService.deleteAll(failureUrlPager);
-        SAStrutsUtil.addSessionMessage("success.failure_url_delete_all");
-        return displayList(true);
-    }
-}

+ 0 - 142
src/main/java/org/codelibs/fess/app/web/admin/LogAction.java

@@ -1,142 +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.app.web.admin;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.commons.codec.binary.Base64;
-import org.codelibs.core.lang.StringUtil;
-import org.codelibs.fess.Constants;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.util.ComponentUtil;
-import org.lastaflute.web.util.LaResponseUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LogAction implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final Logger logger = LoggerFactory.getLogger(LogAction.class);
-
-    //@ActionForm
-    @Resource
-    protected LogForm logForm;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("log");
-    }
-
-    //@Execute(validator = false)
-    public String index() {
-        return "index.jsp";
-    }
-
-    //@Execute(validator = true, input = "index", urlPattern = "download/{logFileName}")
-    public String download() {
-        final String logFilePath = ComponentUtil.getSystemHelper().getLogFilePath();
-        if (StringUtil.isNotBlank(logFilePath)) {
-            final File file = new File(logFilePath);
-            final File parentDir = file.getParentFile();
-            String fileName;
-            try {
-                fileName = new String(Base64.decodeBase64(logForm.logFileName.getBytes(Constants.UTF_8)), Constants.UTF_8);
-            } catch (final UnsupportedEncodingException e1) {
-                fileName =
-                        new String(Base64.decodeBase64(logForm.logFileName.getBytes(Charset.defaultCharset())), Charset.defaultCharset());
-            }
-            final File logFile = new File(parentDir, fileName);
-            if (logFile.isFile()) {
-                try {
-                    LaResponseUtil.download(fileName, new FileInputStream(logFile));
-                    return null;
-                } catch (final FileNotFoundException e) {
-                    logger.warn("Could not find " + logFile.getAbsolutePath(), e);
-                }
-            }
-        }
-        throw new SSCActionMessagesException("errors.could_not_find_log_file", new Object[] { logForm.logFileName });
-    }
-
-    public List<Map<String, Object>> getLogFileItems() {
-        final List<Map<String, Object>> logFileItems = new ArrayList<Map<String, Object>>();
-        final String logFilePath = ComponentUtil.getSystemHelper().getLogFilePath();
-        if (StringUtil.isNotBlank(logFilePath)) {
-            try {
-                final File file = new File(logFilePath);
-                final File parentDir = file.getParentFile();
-                if (!parentDir.exists()) {
-                    logger.warn("Log directory does not exist: " + parentDir.getAbsolutePath());
-                    return logFileItems;
-                }
-                final File[] files = parentDir.listFiles((FilenameFilter) (dir, name) -> {
-                    if (name.indexOf(".out") > 0) {
-                        return true;
-                    }
-                    return false;
-                });
-                if (files == null) {
-                    return logFileItems;
-                }
-                Arrays.sort(files, (o1, o2) -> {
-                    if (o1.lastModified() < o2.lastModified()) {
-                        return 1;
-                    } else {
-                        return -1;
-                    }
-                });
-                for (final File logFile : files) {
-                    logFileItems.add(createLogFileItem(logFile));
-                }
-            } catch (final Exception e) {
-                logger.warn("Could not find log files.", e);
-            }
-        }
-        return logFileItems;
-    }
-
-    protected Map<String, Object> createLogFileItem(final File file) {
-        final Map<String, Object> map = new HashMap<String, Object>();
-        map.put("name", file.getName());
-        try {
-            map.put("logFileName", new String(Base64.encodeBase64(file.getName().getBytes(Constants.UTF_8)), "UTF-8"));
-        } catch (final UnsupportedEncodingException e) {
-            map.put("logFileName",
-                    new String(Base64.encodeBase64(file.getName().getBytes(Charset.defaultCharset())), Charset.defaultCharset()));
-        }
-        map.put("lastModified", new Date(file.lastModified()));
-        return map;
-    }
-}

+ 164 - 0
src/main/java/org/codelibs/fess/app/web/admin/failureurl/AdminFailureurlAction.java

@@ -0,0 +1,164 @@
+/*
+ * 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.app.web.admin.failureurl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.annotation.Token;
+import org.codelibs.fess.app.pager.FailureUrlPager;
+import org.codelibs.fess.app.service.FailureUrlService;
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.es.exentity.FailureUrl;
+import org.codelibs.fess.helper.SystemHelper;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.callback.ActionRuntime;
+import org.lastaflute.web.response.HtmlResponse;
+import org.lastaflute.web.response.render.RenderData;
+import org.lastaflute.web.validation.VaErrorHook;
+
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class AdminFailureurlAction extends FessAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private FailureUrlService failureUrlService;
+    @Resource
+    private FailureUrlPager failureUrlPager;
+    @Resource
+    private SystemHelper systemHelper;
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("failureUrl"));
+    }
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+    @Execute
+    public HtmlResponse index(final FailureUrlSearchForm form) {
+        return asHtml(path_AdminFailureurl_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse list(final Integer pageNumber, final FailureUrlSearchForm form) {
+        failureUrlPager.setCurrentPageNumber(pageNumber);
+        return asHtml(path_AdminFailureurl_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse search(final FailureUrlSearchForm form) {
+        copyBeanToBean(form.searchParams, failureUrlPager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+        return asHtml(path_AdminFailureurl_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse reset(final FailureUrlSearchForm form) {
+        failureUrlPager.clear();
+        return asHtml(path_AdminFailureurl_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse back(final FailureUrlSearchForm form) {
+        return asHtml(path_AdminFailureurl_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    protected void searchPaging(final RenderData data, final FailureUrlSearchForm form) {
+        data.register("failureUrlItems", failureUrlService.getFailureUrlList(failureUrlPager)); // page navi
+
+        // restore from pager
+        copyBeanToBean(failureUrlPager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+    }
+
+    // -----------------------------------------------------
+    //                                               Confirm
+    //                                               -------
+    @Execute
+    public HtmlResponse confirmpage(final int crudMode, final String id, final FailureUrlEditForm form) {
+        // TODO
+        // form.crudMode = crudMode;
+        // form.id = id;
+        // verifyCrudMode(form, CommonConstants.CONFIRM_MODE);
+        loadFailureUrl(form);
+        return asHtml(path_AdminFailureurl_ConfirmJsp);
+    }
+
+    // -----------------------------------------------------
+    //                            Actually Crud (only Delete)
+    //                                         -------------
+
+    @Execute
+    public HtmlResponse delete(final FailureUrlEditForm form) {
+        // TODO verifyCrudMode(form, CommonConstants.DELETE_MODE);
+        failureUrlService.delete(getFailureUrl(form));
+        saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    @Execute
+    public HtmlResponse deleteall(final FailureUrlEditForm form) {
+        failureUrlService.deleteAll(failureUrlPager);
+        saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL));
+        return redirect(getClass());
+    }
+
+    // ===================================================================================
+    //                                                                        Assist Logic
+    //                                                                        ============
+
+    protected void loadFailureUrl(final FailureUrlEditForm form) {
+        copyBeanToBean(getFailureUrl(form), form, op -> op.exclude("crudMode"));
+    }
+
+    protected FailureUrl getFailureUrl(final FailureUrlEditForm form) {
+        final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap(form));
+        if (failureUrl == null) {
+            // TODO
+        }
+        return failureUrl;
+    }
+
+    protected Map<String, String> createKeyMap(final FailureUrlEditForm form) {
+        final Map<String, String> keys = new HashMap<String, String>();
+        keys.put("id", form.id);
+        return keys;
+    }
+
+}

+ 10 - 3
src/main/java/org/codelibs/fess/app/web/admin/FailureUrlForm.java → src/main/java/org/codelibs/fess/app/web/admin/failureurl/FailureUrlEditForm.java

@@ -14,13 +14,19 @@
  * governing permissions and limitations under the License.
  * governing permissions and limitations under the License.
  */
  */
 
 
-package org.codelibs.fess.app.web.admin;
+package org.codelibs.fess.app.web.admin.failureurl;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
 
 
-public class FailureUrlForm implements Serializable {
+import org.codelibs.fess.util.ComponentUtil;
+
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class FailureUrlEditForm implements Serializable {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
@@ -33,7 +39,8 @@ public class FailureUrlForm implements Serializable {
 
 
     public Map<String, String> searchParams = new HashMap<String, String>();
     public Map<String, String> searchParams = new HashMap<String, String>();
 
 
-    //@IntegerType
+    //@IntegerType 
+    // TODO necessary?
     public int crudMode;
     public int crudMode;
 
 
     public String getCurrentPageNumber() {
     public String getCurrentPageNumber() {

+ 32 - 0
src/main/java/org/codelibs/fess/app/web/admin/failureurl/FailureUrlSearchForm.java

@@ -0,0 +1,32 @@
+/*
+ * 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.app.web.admin.failureurl;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class FailureUrlSearchForm implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public Map<String, String> searchParams = new HashMap<String, String>();
+}

+ 89 - 0
src/main/java/org/codelibs/fess/app/web/admin/log/AdminLogAction.java

@@ -0,0 +1,89 @@
+/*
+ * 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.app.web.admin.log;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.helper.SystemHelper;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.callback.ActionRuntime;
+import org.lastaflute.web.response.HtmlResponse;
+
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class AdminLogAction extends FessAdminAction {
+
+    @Resource
+    private SystemHelper systemHelper;
+
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("log"));
+    }
+
+    @Execute
+    public HtmlResponse index(final LogForm form) {
+        return asHtml(path_AdminLog_IndexJsp).renderWith(data -> {
+            data.register("logFileItems", getLogFileItems());
+        });
+    }
+
+    //@Execute(validator = true, input = "index", urlPattern = "download/{logFileName}")
+    public HtmlResponse download(final LogForm form) {
+        // TODO
+        return redirect(getClass());
+        /*
+        final String logFilePath = ComponentUtil.getSystemHelper().getLogFilePath();
+        if (StringUtil.isNotBlank(logFilePath)) {
+            final File file = new File(logFilePath);
+            final File parentDir = file.getParentFile();
+            String fileName;
+            try {
+                fileName = new String(Base64.decodeBase64(logForm.logFileName.getBytes(Constants.UTF_8)), Constants.UTF_8);
+            } catch (final UnsupportedEncodingException e1) {
+                fileName =
+                        new String(Base64.decodeBase64(logForm.logFileName.getBytes(Charset.defaultCharset())), Charset.defaultCharset());
+            }
+            final File logFile = new File(parentDir, fileName);
+            if (logFile.isFile()) {
+                try {
+                    LaResponseUtil.download(fileName, new FileInputStream(logFile));
+                    return null;
+                } catch (final FileNotFoundException e) {
+                    logger.warn("Could not find " + logFile.getAbsolutePath(), e);
+                }
+            }
+        }
+        throw new SSCActionMessagesException("errors.could_not_find_log_file", new Object[] { logForm.logFileName });
+        */
+    }
+
+    public List<Map<String, Object>> getLogFileItems() {
+        // TODO
+        final List<Map<String, Object>> logFileItems = new ArrayList<Map<String, Object>>();
+        return logFileItems;
+    }
+
+}

+ 5 - 1
src/main/java/org/codelibs/fess/app/web/admin/LogForm.java → src/main/java/org/codelibs/fess/app/web/admin/log/LogForm.java

@@ -14,10 +14,14 @@
  * governing permissions and limitations under the License.
  * governing permissions and limitations under the License.
  */
  */
 
 
-package org.codelibs.fess.app.web.admin;
+package org.codelibs.fess.app.web.admin.log;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 
 
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
 public class LogForm implements Serializable {
 public class LogForm implements Serializable {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;

+ 8 - 6
src/main/java/org/codelibs/fess/app/web/admin/system/AdminSystemAction.java

@@ -27,6 +27,7 @@ import org.codelibs.core.misc.DynamicProperties;
 import org.codelibs.fess.annotation.Token;
 import org.codelibs.fess.annotation.Token;
 import org.codelibs.fess.app.service.ScheduledJobService;
 import org.codelibs.fess.app.service.ScheduledJobService;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.client.FessEsClient;
 import org.codelibs.fess.es.exentity.ScheduledJob;
 import org.codelibs.fess.es.exentity.ScheduledJob;
 import org.codelibs.fess.helper.JobHelper;
 import org.codelibs.fess.helper.JobHelper;
 import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.helper.SystemHelper;
@@ -53,6 +54,8 @@ public class AdminSystemAction extends FessAdminAction {
     protected JobHelper jobHelper;
     protected JobHelper jobHelper;
     @Resource
     @Resource
     protected ScheduledJobService scheduledJobService;
     protected ScheduledJobService scheduledJobService;
+    @Resource
+    protected FessEsClient fessEsClient;
 
 
     // ===================================================================================
     // ===================================================================================
     //                                                                               Hook
     //                                                                               Hook
@@ -69,12 +72,11 @@ public class AdminSystemAction extends FessAdminAction {
     @Execute
     @Execute
     public HtmlResponse index(final SystemForm form) {
     public HtmlResponse index(final SystemForm form) {
         return asHtml(path_AdminSystem_IndexJsp).renderWith(data -> {
         return asHtml(path_AdminSystem_IndexJsp).renderWith(data -> {
-            // TODO
-            // data.register("clusterName", );
-            // data.register("clusterStatus", );
-                data.register("crawlerRunning", isCrawlerRunning());
-                data.register("runningSessionIds", getRunningSessionIds());
-            });
+            data.register("clusterName", fessEsClient.getClusterName());
+            data.register("clusterStatus", fessEsClient.getStatus());
+            data.register("crawlerRunning", isCrawlerRunning());
+            data.register("runningSessionIds", getRunningSessionIds());
+        });
     }
     }
 
 
     @Token(save = false, validate = true)
     @Token(save = false, validate = true)

+ 4 - 0
src/main/java/org/codelibs/fess/client/FessEsClient.java

@@ -194,6 +194,10 @@ public class FessEsClient implements Client {
         this.clusterName = clusterName;
         this.clusterName = clusterName;
     }
     }
 
 
+    public String getStatus() {
+        return admin().cluster().prepareHealth().execute().actionGet().getStatus().name();
+    }
+
     public void setRunner(final ElasticsearchClusterRunner runner) {
     public void setRunner(final ElasticsearchClusterRunner runner) {
         this.runner = runner;
         this.runner = runner;
     }
     }

+ 100 - 111
src/main/webapp/WEB-INF/view/admin/system/index.jsp

@@ -1,119 +1,108 @@
 <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
 <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%><!DOCTYPE html>
 <html>
 <html>
-		<head>
-				<meta charset="UTF-8">
-				<title>Fess | <la:message key="labels.system_title_configuration" /></title>
-				<jsp:include page="/WEB-INF/view/common/admin2/head.jsp"></jsp:include>
-		</head>
-		<body class="skin-blue sidebar-mini">
-				<div class="wrapper">
-						<jsp:include page="/WEB-INF/view/common/admin2/header.jsp"></jsp:include>
-						<jsp:include page="/WEB-INF/view/common/admin2/sidebar.jsp">
-								<jsp:param name="menuCategoryType" value="system" />
-								<jsp:param name="menuType" value="system" />
-						</jsp:include>
+<head>
+<meta charset="UTF-8">
+<title>Fess | <la:message key="labels.system_title_configuration" /></title>
+<jsp:include page="/WEB-INF/view/common/admin2/head.jsp"></jsp:include>
+</head>
+<body class="skin-blue sidebar-mini">
+	<div class="wrapper">
+		<jsp:include page="/WEB-INF/view/common/admin2/header.jsp"></jsp:include>
+		<jsp:include page="/WEB-INF/view/common/admin2/sidebar.jsp">
+			<jsp:param name="menuCategoryType" value="system" />
+			<jsp:param name="menuType" value="system" />
+		</jsp:include>
 
 
-						<div class="content-wrapper">
-								<%-- Content Header --%>
-								<%-- Message --%>
-								<div>
-										<la:info id="msg" message="true">
-												<div class="alert-message info">
-														${msg}
-												</div>
-										</la:info>
-										<la:errors />
-								</div>
+		<div class="content-wrapper">
+			<%-- Content Header --%>
+			<%-- Message --%>
+			<div>
+				<la:info id="msg" message="true">
+					<div class="alert-message info">${msg}</div>
+				</la:info>
+				<la:errors />
+			</div>
 
 
-								<section class="content">
-										<div class="row">
-												<div class="col-md-12">
+			<section class="content">
+				<div class="row">
+					<div class="col-md-12">
+						<div class="box">
+							<%-- Box Header --%>
+							<div class="box-header">
+								<h3 class="box-title">
+									<la:message key="labels.system_title_system_status" />
+								</h3>
+							</div>
+							<%-- Box Body --%>
+							<div class="box-body">
+								<table class="table table-bordered table-hover table-striped">
+									<tbody>
+										<tr>
+											<th class="col-xs-3"><la:message
+													key="labels.es_cluster_name" /></th>
+											<td>${f:h(clusterName)}
+												(${f:h(clusterStatus)})</td>
+										</tr>
+									</tbody>
+								</table>
+							</div>
+						</div>
 
 
-														<div class="box">
-																<%-- Box Header --%>
-																<div class="box-header">
-																		<h3 class="box-title">
-																				<la:message key="labels.system_title_system_status" />
-																		</h3>
-																</div>
-																<%-- Box Body --%>
-																<div class="box-body">
-																		<table class="table table-bordered table-hover table-striped">
-																				<tbody>
-																						<tr>
-																								<th class="col-xs-3"><la:message key="labels.es_cluster_name" />
-																								</th>
-																								<td>${f:h(clusterName)}
-																										(<c:if test="${clusterStatus=='ACTIVE'}">
-																										<la:message key="labels.es_active" />
-																										</c:if> <c:if test="${clusterStatus!='ACTIVE'}">
-																												<la:message key="labels.es_inactive" />
-																										</c:if>)
-																								</td>
-																						</tr>
-																				</tbody>
-																		</table>
-																</div>
+						<la:form>
+							<div class="box">
+								<%-- Box Header --%>
+								<div class="box-header">
+									<h3 class="box-title">
+										<la:message key="labels.crawler_status_title" />
+									</h3>
+								</div>
+								<%-- Box Body --%>
+								<div class="box-body">
+									<%-- Message --%>
+									<table class="table table-bordered table-hover table-striped">
+										<tbody>
+											<tr>
+												<th class="col-xs-3"><la:message
+														key="labels.crawler_process_running" /></th>
+												<td><c:if test="${crawlerRunning}">
+														<la:message key="labels.crawler_running" />
+													</c:if>
+													<c:if test="${!crawlerRunning}">
+														<la:message key="labels.crawler_stopped" />
+													</c:if></td>
+											</tr>
+											<tr>
+												<th><la:message key="labels.crawler_process_action" />
+												</th>
+												<td><c:if test="${!crawlerRunning}">
+														<input type="submit" class="btn" name="start"
+															value="<la:message key="labels.crawler_button_start"/>" />
+													</c:if> <c:if test="${crawlerRunning}">
+														<div class="form-inline">
+															<la:select property="sessionId" styleClass="form-control">
+																<option value=""><la:message
+																		key="labels.crawler_sessionid_all" /></option>
+																<c:forEach var="runningSessionId"
+																	items="${runningSessionIds}">
+																	<option value="${f:h(runningSessionId)}">${f:h(runningSessionId)}</option>
+																</c:forEach>
+															</la:select>
+															<input type="submit" class="btn" name="stop"
+																value="<la:message key="labels.crawler_button_stop"/>" />
 														</div>
 														</div>
-
-														<la:form>
-																<div class="box">
-																		<%-- Box Header --%>
-																		<div class="box-header">
-																				<h3 class="box-title">
-																						<la:message key="labels.crawler_status_title" />
-																				</h3>
-																		</div>
-																		<%-- Box Body --%>
-																		<div class="box-body">
-																				<%-- Message --%>
-																				<table class="table table-bordered table-hover table-striped">
-																						<tbody>
-																								<tr>
-																										<th class="col-xs-3">
-																												<la:message key="labels.crawler_process_running" /></th>
-																										<td>
-																												<c:if test="${crawlerRunning}">
-																														<la:message key="labels.crawler_running" />
-																												</c:if><c:if test="${!crawlerRunning}">
-																														<la:message key="labels.crawler_stopped" />
-																												</c:if>
-																										</td>
-																								</tr>
-																								<tr>
-																										<th>
-																												<la:message key="labels.crawler_process_action" />
-																										</th>
-																										<td>
-																												<c:if test="${!crawlerRunning}">
-																														<input type="submit" class="btn" name="start"
-																																	 value="<la:message key="labels.crawler_button_start"/>" />
-																												</c:if>
-																												<c:if test="${crawlerRunning}">
-																														<div class="form-inline">
-																																<la:select property="sessionId" styleClass="form-control">
-																																		<option value=""><la:message key="labels.crawler_sessionid_all"/></option>
-																																		<c:forEach var="runningSessionId" items="${runningSessionIds}">
-																																				<option value="${f:h(runningSessionId)}">${f:h(runningSessionId)}</option>
-																																		</c:forEach>
-																																</la:select>
-																																<input type="submit" class="btn" name="stop"
-																																			 value="<la:message key="labels.crawler_button_stop"/>" />
-																														</div>
-																												</c:if>
-																										</td>
-																								</tr>
-																						</tbody>
-																				</table>
-																		</div>
-																</div>
-														</la:form>
-												</div>
-										</div>
-								</section>
-						</div>
-						<jsp:include page="/WEB-INF/view/common/admin2/footer.jsp"></jsp:include>
+													</c:if></td>
+											</tr>
+										</tbody>
+									</table>
+								</div>
+							</div>
+						</la:form>
+					</div>
 				</div>
 				</div>
-				<jsp:include page="/WEB-INF/view/common/admin2/foot.jsp"></jsp:include>
-		</body>
+			</section>
+		</div>
+		<jsp:include page="/WEB-INF/view/common/admin2/footer.jsp"></jsp:include>
+	</div>
+	<jsp:include page="/WEB-INF/view/common/admin2/foot.jsp"></jsp:include>
+</body>
 </html>
 </html>

+ 4 - 4
src/main/webapp/WEB-INF/view/common/admin2/sidebar.jsp

@@ -211,15 +211,15 @@
 							<span><la:message key="labels.menu.session_info" /></span>
 							<span><la:message key="labels.menu.session_info" /></span>
 						</la:link></li>
 						</la:link></li>
 
 
-					<li <c:if test="${param.menuType=='log'}">class="active"</c:if>><todo:link href="/admin/log/index">
+					<li <c:if test="${param.menuType=='log'}">class="active"</c:if>><la:link href="/admin/log/index">
 							<i class='fa fa-angle-right'></i>
 							<i class='fa fa-angle-right'></i>
 							<span><la:message key="labels.menu.log" /></span>
 							<span><la:message key="labels.menu.log" /></span>
-						</todo:link></li>
+						</la:link></li>
 
 
-					<li <c:if test="${param.menuType=='failureUrl'}">class="active"</c:if>><todo:link href="/admin/failureUrl/index">
+					<li <c:if test="${param.menuType=='failureUrl'}">class="active"</c:if>><la:link href="/admin/failureurl/index">
 							<i class='fa fa-angle-right'></i>
 							<i class='fa fa-angle-right'></i>
 							<span><la:message key="labels.menu.failure_url" /></span>
 							<span><la:message key="labels.menu.failure_url" /></span>
-						</todo:link></li>
+						</la:link></li>
 
 
 					<li <c:if test="${param.menuType=='searchList'}">class="active"</c:if>><todo:link href="/admin/searchList/index">
 					<li <c:if test="${param.menuType=='searchList'}">class="active"</c:if>><todo:link href="/admin/searchList/index">
 							<i class='fa fa-angle-right'></i>
 							<i class='fa fa-angle-right'></i>