浏览代码

modify dict.userdict action

Keiichi Watanabe 9 年之前
父节点
当前提交
05edce0a13

+ 0 - 52
src/main/java/org/codelibs/fess/app/web/admin/DictAction.java

@@ -1,52 +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.Serializable;
-
-import javax.annotation.Resource;
-
-import org.codelibs.fess.dict.DictionaryFile;
-import org.codelibs.fess.dict.DictionaryItem;
-import org.codelibs.fess.dict.DictionaryManager;
-import org.codelibs.fess.helper.SystemHelper;
-
-public class DictAction implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @Resource
-    //@ActionForm
-    protected DictForm dictForm;
-
-    @Resource
-    protected DictionaryManager dictionaryManager;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public DictionaryFile<? extends DictionaryItem>[] dictFiles;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("dict");
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String index() {
-        dictFiles = dictionaryManager.getDictionaryFiles();
-        return "index.jsp";
-    }
-}

+ 61 - 0
src/main/java/org/codelibs/fess/app/web/admin/dict/AdminDictAction.java

@@ -0,0 +1,61 @@
+/*
+ * 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.dict;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.dict.DictionaryManager;
+import org.codelibs.fess.helper.SystemHelper;
+import org.lastaflute.web.Execute;
+import org.lastaflute.web.callback.ActionRuntime;
+import org.lastaflute.web.response.HtmlResponse;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class AdminDictAction extends FessAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    protected SystemHelper systemHelper;
+    @Resource
+    protected DictionaryManager dictionaryManager;
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("dict"));
+    }
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+    @Execute
+    public HtmlResponse index(final DictForm form) {
+        return asHtml(path_AdminDict_IndexJsp).renderWith(data -> {
+            // TODO
+            // DictionaryFile<? extends DictionaryItem>[] dictFiles dictFiles = dictionaryManager.getDictionaryFiles();
+            // data.register("dictFiles", dictFiles);
+            });
+    }
+}

+ 7 - 1
src/main/java/org/codelibs/fess/app/web/admin/DictForm.java → src/main/java/org/codelibs/fess/app/web/admin/dict/DictForm.java

@@ -14,12 +14,18 @@
  * governing permissions and limitations under the License.
  */
 
-package org.codelibs.fess.app.web.admin;
+package org.codelibs.fess.app.web.admin.dict;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
 
+/**
+ * @author Keiichi Watanabe
+ */
 public class DictForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    public Map<String, String> searchParams = new HashMap<String, String>();
 }

+ 0 - 392
src/main/java/org/codelibs/fess/app/web/admin/dict/UserDictAction.java

@@ -1,392 +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.dict;
-
-import java.beans.Beans;
-import java.io.IOException;
-import java.io.InputStream;
-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.core.beans.util.BeanUtil;
-import org.codelibs.core.lang.StringUtil;
-import org.codelibs.fess.annotation.Token;
-import org.codelibs.fess.app.web.CrudMode;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.dict.DictionaryExpiredException;
-import org.codelibs.fess.dict.userdict.UserDictFile;
-import org.codelibs.fess.dict.userdict.UserDictItem;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.app.pager.UserDictPager;
-import org.codelibs.fess.app.service.UserDictService;
-import org.lastaflute.web.util.LaResponseUtil;
-
-public class UserDictAction {
-
-    private static final Log log = LogFactory.getLog(UserDictAction.class);
-
-    @Resource
-    //@ActionForm
-    protected UserDictForm userDictForm;
-
-    @Resource
-    protected UserDictService userDictService;
-
-    @Resource
-    protected UserDictPager userDictPager;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public List<UserDictItem> userDictItemItems;
-
-    public String filename;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("dict");
-    }
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        userDictItemItems = userDictService.getUserDictList(userDictForm.dictId, userDictPager);
-
-        // restore from pager
-        BeanUtil.copyBeanToBean(userDictPager, userDictForm.searchParams, option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        if (redirect) {
-            return "index?dictId=" + userDictForm.dictId + "&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/{dictId}/{pageNumber}")
-    public String list() {
-        // page navi
-        if (StringUtil.isNotBlank(userDictForm.pageNumber)) {
-            try {
-                userDictPager.setCurrentPageNumber(Integer.parseInt(userDictForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Invalid value: " + userDictForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String search() {
-        BeanUtil.copyBeanToBean(userDictForm.searchParams, userDictPager, option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        userDictPager.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/{dictId}/{crudMode}/{id}")
-    public String confirmpage() {
-        if (userDictForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    userDictForm.crudMode });
-        }
-
-        loadUserDict();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        userDictForm.initialize();
-        userDictForm.crudMode = CommonConstants.CREATE_MODE;
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{dictId}/{crudMode}/{id}")
-    public String editpage() {
-        if (userDictForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, userDictForm.crudMode });
-        }
-
-        loadUserDict();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        userDictForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadUserDict();
-
-        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/{dictId}/{crudMode}/{id}")
-    public String deletepage() {
-        if (userDictForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.DELETE_MODE, userDictForm.crudMode });
-        }
-
-        loadUserDict();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        userDictForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadUserDict();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final UserDictItem userDictItem = createUserDict();
-            userDictService.store(userDictForm.dictId, userDictItem);
-            SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
-
-            return displayList(true);
-        } catch (final DictionaryExpiredException e) {
-            throw e;
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, "errors.crud_failed_to_create_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "edit.jsp")
-    public String update() {
-        try {
-            final UserDictItem userDictItem = createUserDict();
-            userDictService.store(userDictForm.dictId, userDictItem);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final DictionaryExpiredException e) {
-            throw e;
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, "errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (userDictForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.DELETE_MODE, userDictForm.crudMode });
-        }
-
-        try {
-            final UserDictItem userDictItem = userDictService.getUserDict(userDictForm.dictId, createKeyMap());
-            if (userDictItem == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { userDictForm.id });
-
-            }
-
-            userDictService.delete(userDictForm.dictId, userDictItem);
-            SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
-
-            return displayList(true);
-        } catch (final DictionaryExpiredException e) {
-            throw e;
-        } catch (final ActionMessagesException e) {
-            log.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            log.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "downloadpage")
-    public String downloadpage() {
-        final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
-        if (userdictFile == null) {
-            throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
-        }
-        filename = userdictFile.getSimpleName();
-        return "download.jsp";
-    }
-
-    @Token(save = true, validate = true)
-    //@Execute(validator = false, input = "downloadpage")
-    public String download() {
-        final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
-        if (userdictFile == null) {
-            throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
-        }
-        try (InputStream in = userdictFile.getInputStream()) {
-            LaResponseUtil.download(userdictFile.getSimpleName(), in);
-        } catch (final IOException e) {
-            throw new SSCActionMessagesException("errors.failed_to_download_userdict_file");
-        }
-
-        return null;
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "uploadpage")
-    public String uploadpage() {
-        final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
-        if (userdictFile == null) {
-            throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
-        }
-        filename = userdictFile.getName();
-        return "upload.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "uploadpage")
-    public String upload() {
-        final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
-        if (userdictFile == null) {
-            throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
-        }
-        try (InputStream in = userDictForm.userDictFile.getInputStream()) {
-            userdictFile.update(in);
-        } catch (final IOException e) {
-            throw new SSCActionMessagesException("errors.failed_to_upload_userdict_file");
-        }
-
-        SAStrutsUtil.addSessionMessage("success.upload_userdict_file");
-
-        return "uploadpage?dictId=" + userDictForm.dictId + "&redirect=true";
-    }
-
-    protected void loadUserDict() {
-
-        final UserDictItem userDictItem = userDictService.getUserDict(userDictForm.dictId, createKeyMap());
-        if (userDictItem == null) {
-            // throw an exception
-            throw new ActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { userDictForm.id });
-
-        }
-
-        userDictForm.id = Long.toString(userDictItem.getId());
-        userDictForm.token = userDictItem.getToken();
-        userDictForm.segmentation = userDictItem.getSegmentation();
-        userDictForm.reading = userDictItem.getReading();
-        userDictForm.pos = userDictItem.getPos();
-    }
-
-    protected UserDictItem createUserDict() {
-        UserDictItem userDictItem;
-        if (userDictForm.crudMode == CommonConstants.EDIT_MODE) {
-            userDictItem = userDictService.getUserDict(userDictForm.dictId, createKeyMap());
-            if (userDictItem == null) {
-                // throw an exception
-                throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
-
-                new Object[] { userDictForm.id });
-
-            }
-        } else {
-            userDictItem = new UserDictItem(0, StringUtil.EMPTY, StringUtil.EMPTY, StringUtil.EMPTY, StringUtil.EMPTY);
-        }
-
-        userDictItem.setNewToken(userDictForm.token);
-        userDictItem.setNewSegmentation(userDictForm.segmentation);
-        userDictItem.setNewReading(userDictForm.reading);
-        userDictItem.setNewPos(userDictForm.pos);
-
-        return userDictItem;
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-        keys.put("id", userDictForm.id);
-        return keys;
-    }
-
-}

+ 270 - 0
src/main/java/org/codelibs/fess/app/web/admin/dict/userdict/AdminDictUserdictAction.java

@@ -0,0 +1,270 @@
+/*
+ * 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.dict.userdict;
+
+import javax.annotation.Resource;
+
+import org.codelibs.core.misc.DynamicProperties;
+import org.codelibs.fess.Constants;
+import org.codelibs.fess.annotation.Token;
+import org.codelibs.fess.app.pager.UserDictPager;
+import org.codelibs.fess.app.service.UserDictService;
+import org.codelibs.fess.app.web.CrudMode;
+import org.codelibs.fess.app.web.admin.suggestelevateword.SuggestElevateWordEditForm;
+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;
+import org.lastaflute.web.response.render.RenderData;
+import org.lastaflute.web.validation.VaErrorHook;
+
+/**
+ * @author Keiichi Watanabe
+ */
+public class AdminDictUserdictAction extends FessAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private UserDictService userDictService;
+    @Resource
+    private UserDictPager userDictPager;
+    @Resource
+    private SystemHelper systemHelper;
+    @Resource
+    protected DynamicProperties crawlerProperties;
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("userDict"));
+    }
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+    @Execute
+    public HtmlResponse index(final UserDictSearchForm form) {
+        return asHtml(path_AdminDictUserDict_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse list(final Integer pageNumber, final UserDictSearchForm form) {
+        userDictPager.setCurrentPageNumber(pageNumber);
+        return asHtml(path_AdminDictUserDict_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse search(final UserDictSearchForm form) {
+        copyBeanToBean(form.searchParams, userDictPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
+        return asHtml(path_AdminDictUserDict_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse reset(final UserDictSearchForm form) {
+        userDictPager.clear();
+        return asHtml(path_AdminDictUserDict_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse back(final UserDictSearchForm form) {
+        return asHtml(path_AdminDictUserDict_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    protected void searchPaging(final RenderData data, final UserDictSearchForm form) {
+        // TODO
+    }
+
+    // ===================================================================================
+    //                                                                        Edit Execute
+    //                                                                        ============
+    // -----------------------------------------------------
+    //                                            Entry Page
+    //                                            ----------
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse createpage(final UserDictEditForm form) {
+        form.initialize();
+        form.crudMode = CrudMode.CREATE;
+        return asHtml(path_AdminDictUserDict_EditJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editpage(final int crudMode, final String id, final UserDictEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CrudMode.EDIT);
+        // TODO loadUserDict(form);
+        return asHtml(path_AdminDictUserDict_EditJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editagain(final UserDictEditForm form) {
+        return asHtml(path_AdminDictUserDict_EditJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editfromconfirm(final UserDictEditForm form) {
+        form.crudMode = CrudMode.EDIT;
+        // TODO loadUserDict(form);
+        return asHtml(path_AdminDictUserDict_EditJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletepage(final int crudMode, final String id, final UserDictEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CrudMode.DELETE);
+        // TODO loadUserDict(form);
+        return asHtml(path_AdminDictUserDict_ConfirmJsp);
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletefromconfirm(final UserDictEditForm form) {
+        form.crudMode = CrudMode.DELETE;
+        // TODO loadUserDict(form);
+        return asHtml(path_AdminDictUserDict_ConfirmJsp);
+    }
+
+    // -----------------------------------------------------
+    //                                               Confirm
+    //                                               -------
+    @Execute
+    public HtmlResponse confirmpage(final int crudMode, final String id, final UserDictEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CrudMode.CONFIRM);
+        // TODO loadUserDict(form);
+        return asHtml(path_AdminDictUserDict_ConfirmJsp);
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromcreate(final UserDictEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminDictUserDict_ConfirmJsp);
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromupdate(final UserDictEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminDictUserDict_ConfirmJsp);
+    }
+
+    // -----------------------------------------------------
+    //                                              Download
+    //                                               -------
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse downloadpage(final UserDictSearchForm form) {
+        return asHtml(path_AdminDictUserDict_DownloadJsp);
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse download(final UserDictSearchForm form) {
+        // TODO Download
+
+        return asHtml(path_AdminDictUserDict_DownloadJsp);
+    }
+
+    // -----------------------------------------------------
+    //                                                Upload
+    //                                               -------
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse uploadpage(final UserDictUploadForm form) {
+        // TODO Upload
+
+        return asHtml(path_AdminDictUserDict_UploadJsp);
+    }
+
+    // -----------------------------------------------------
+    //                                         Actually Crud
+    //                                         -------------
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse create(final UserDictEditForm form) {
+        // TODO
+        return redirect(getClass());
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse update(final UserDictEditForm form) {
+        // TODO
+        return redirect(getClass());
+    }
+
+    @Execute
+    public HtmlResponse delete(final UserDictEditForm form) {
+        // TODO
+        return redirect(getClass());
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse upload(final UserDictUploadForm form) {
+        // TODO
+        return redirect(getClass());
+    }
+
+    //===================================================================================
+    //                                                                        Assist Logic
+    //                                                                        ============
+    protected void loadUserDict(final SuggestElevateWordEditForm form) {
+        // TODO
+    }
+
+    // ===================================================================================
+    //                                                                        Small Helper
+    //                                                                        ============
+    protected void verifyCrudMode(final UserDictEditForm form, final int expectedMode) {
+        if (form.crudMode != expectedMode) {
+            throwValidationError(messages -> {
+                messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(form.crudMode));
+            }, toEditHtml());
+        }
+    }
+
+    protected VaErrorHook toEditHtml() {
+        return () -> {
+            return asHtml(path_AdminDictUserDict_EditJsp);
+        };
+    }
+}

+ 10 - 2
src/main/java/org/codelibs/fess/app/web/admin/dict/UserDictForm.java → src/main/java/org/codelibs/fess/app/web/admin/dict/userdict/UserDictEditForm.java

@@ -14,12 +14,20 @@
  * governing permissions and limitations under the License.
  */
 
-package org.codelibs.fess.app.web.admin.dict;
+package org.codelibs.fess.app.web.admin.dict.userdict;
 
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 
-public class UserDictForm {
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class UserDictEditForm implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
     //@IntegerType
     public String pageNumber;
 

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

+ 33 - 0
src/main/java/org/codelibs/fess/app/web/admin/dict/userdict/UserDictUploadForm.java

@@ -0,0 +1,33 @@
+/*
+ * 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.dict.userdict;
+
+import java.io.Serializable;
+
+import org.lastaflute.web.ruts.multipart.MultipartFormFile;
+
+/**
+ * @author codelibs
+ * @author Keiichi Watanabe
+ */
+public class UserDictUploadForm implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public MultipartFormFile userDictFile;
+
+}

+ 12 - 12
src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java

@@ -77,23 +77,23 @@ public interface FessHtmlPath {
     /** The path of the HTML: /admin/dict/synonym/upload.jsp */
     HtmlNext path_AdminDictSynonym_UploadJsp = new HtmlNext("/admin/dict/synonym/upload.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/confirm.jsp */
-    HtmlNext path_AdminDictUserDict_ConfirmJsp = new HtmlNext("/admin/dict/userDict/confirm.jsp");
+    /** The path of the HTML: /admin/dict/userdict/confirm.jsp */
+    HtmlNext path_AdminDictUserDict_ConfirmJsp = new HtmlNext("/admin/dict/userdict/confirm.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/download.jsp */
-    HtmlNext path_AdminDictUserDict_DownloadJsp = new HtmlNext("/admin/dict/userDict/download.jsp");
+    /** The path of the HTML: /admin/dict/userdict/download.jsp */
+    HtmlNext path_AdminDictUserDict_DownloadJsp = new HtmlNext("/admin/dict/userdict/download.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/edit.jsp */
-    HtmlNext path_AdminDictUserDict_EditJsp = new HtmlNext("/admin/dict/userDict/edit.jsp");
+    /** The path of the HTML: /admin/dict/userdict/edit.jsp */
+    HtmlNext path_AdminDictUserDict_EditJsp = new HtmlNext("/admin/dict/userdict/edit.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/error.jsp */
-    HtmlNext path_AdminDictUserDict_ErrorJsp = new HtmlNext("/admin/dict/userDict/error.jsp");
+    /** The path of the HTML: /admin/dict/userdict/error.jsp */
+    HtmlNext path_AdminDictUserDict_ErrorJsp = new HtmlNext("/admin/dict/userdict/error.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/index.jsp */
-    HtmlNext path_AdminDictUserDict_IndexJsp = new HtmlNext("/admin/dict/userDict/index.jsp");
+    /** The path of the HTML: /admin/dict/userdict/index.jsp */
+    HtmlNext path_AdminDictUserDict_IndexJsp = new HtmlNext("/admin/dict/userdict/index.jsp");
 
-    /** The path of the HTML: /admin/dict/userDict/upload.jsp */
-    HtmlNext path_AdminDictUserDict_UploadJsp = new HtmlNext("/admin/dict/userDict/upload.jsp");
+    /** The path of the HTML: /admin/dict/userdict/upload.jsp */
+    HtmlNext path_AdminDictUserDict_UploadJsp = new HtmlNext("/admin/dict/userdict/upload.jsp");
 
     /** The path of the HTML: /admin/failureurl/confirm.jsp */
     HtmlNext path_AdminFailureurl_ConfirmJsp = new HtmlNext("/admin/failureurl/confirm.jsp");

+ 0 - 0
src/main/webapp/WEB-INF/view/admin/dict/userDict/confirm.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/confirm.jsp


+ 0 - 0
src/main/webapp/WEB-INF/view/admin/dict/userDict/download.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/download.jsp


+ 0 - 0
src/main/webapp/WEB-INF/view/admin/dict/userDict/edit.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/edit.jsp


+ 0 - 0
src/main/webapp/WEB-INF/view/admin/dict/userDict/error.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/error.jsp


+ 3 - 3
src/main/webapp/WEB-INF/view/admin/dict/userDict/index.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/index.jsp

@@ -21,7 +21,7 @@
 			<la:message key="labels.dict_userdict_title" />
 		</h1>
 		<ol class="breadcrumb">
-			<li class="active"><la:link href="index">
+			<li class="active"><la:link href="">
 			<la:message key="labels.dict_userdict_list_link" />
 			</la:link></li>
 		</ol>
@@ -39,7 +39,7 @@
 				</h3>
 				<div class="box-tools pull-right">
 					<span class="label label-default">
-					<la:link href="../index">
+					<la:link href="..">
 						<la:message key="labels.dict_list_link" />
 					</la:link>
 					</span>
@@ -97,7 +97,7 @@
 					</thead>
 					<tbody>
 						<c:forEach var="data" varStatus="s" items="${userDictItemItems}">
-						    <tr class="${s.index % 2 == 0 ? 'row1' : 'row2'}" data-href="${contextPath}/admin/dict/userDict/confirmpage/${f:u(dictId)}/4/${f:u(data.id)}">
+						    <tr class="${s.index % 2 == 0 ? 'row1' : 'row2'}" data-href="${contextPath}/admin/dict/userdict/confirmpage/${f:u(dictId)}/4/${f:u(data.id)}">
 							<td>${f:h(data.token)}</td>
 							<td>${f:h(data.reading)}</td>
 						</tr>

+ 0 - 0
src/main/webapp/WEB-INF/view/admin/dict/userDict/upload.jsp → src/main/webapp/WEB-INF/view/admin/dict/userdict/upload.jsp


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

@@ -54,10 +54,10 @@
 							<span><la:message key="labels.menu.design" /></span>
 						</la:link></li>
 
-					<li <c:if test="${param.menuType=='dict'}">class="active"</c:if>><todo:link href="/admin/dict/">
+					<li <c:if test="${param.menuType=='dict'}">class="active"</c:if>><la:link href="/admin/dict/">
 							<i class='fa fa-angle-right'></i>
 							<span><la:message key="labels.menu.dict" /></span>
-						</todo:link></li>
+						</la:link></li>
 
 				</ul>
 			</li>