浏览代码

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

fileConfig, dataConfig
Shinsuke Sugaya 9 年之前
父节点
当前提交
406bbbedef

+ 0 - 4
pom.xml

@@ -101,9 +101,7 @@
 						<exclude>org/codelibs/fess/app/web/admin/DocumentAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/SystemInfoForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/JobLogForm.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/DataConfigForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/SystemAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/DataConfigAction.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>
@@ -123,11 +121,9 @@
 						<exclude>org/codelibs/fess/app/web/admin/WebAuthenticationAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/DataAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/CrawlingSessionAction.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/FileConfigAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/SuggestBadWordForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/FileAuthenticationAction.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/CrawlingSessionForm.java</exclude>
-						<exclude>org/codelibs/fess/app/web/admin/FileConfigForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/CrawlForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/WizardForm.java</exclude>
 						<exclude>org/codelibs/fess/app/web/admin/FailureUrlForm.java</exclude>

+ 0 - 370
src/main/java/org/codelibs/fess/app/web/admin/DataConfigAction.java

@@ -1,370 +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.ArrayList;
-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.core.lang.StringUtil;
-import org.codelibs.fess.Constants;
-import org.codelibs.fess.annotation.Token;
-import org.codelibs.fess.app.web.base.FessAdminAction;
-import org.codelibs.fess.beans.FessBeans;
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.crud.util.SAStrutsUtil;
-import org.codelibs.fess.ds.DataStoreFactory;
-import org.codelibs.fess.es.exentity.DataConfig;
-import org.codelibs.fess.es.exentity.LabelType;
-import org.codelibs.fess.es.exentity.RoleType;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.app.pager.DataConfigPager;
-import org.codelibs.fess.app.service.DataConfigService;
-import org.codelibs.fess.app.service.FailureUrlService;
-import org.codelibs.fess.app.service.LabelTypeService;
-import org.codelibs.fess.app.service.RoleTypeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataConfigAction extends FessAdminAction {
-
-    private static final Logger logger = LoggerFactory.getLogger(DataConfigAction.class);
-
-    // for list
-
-    public List<DataConfig> dataConfigItems;
-
-    // for edit/confirm/delete
-
-    //@ActionForm
-    @Resource
-    protected DataConfigForm dataConfigForm;
-
-    @Resource
-    protected DataConfigService dataConfigService;
-
-    @Resource
-    protected DataConfigPager dataConfigPager;
-
-    @Resource
-    protected RoleTypeService roleTypeService;
-
-    @Resource
-    protected LabelTypeService labelTypeService;
-
-    @Resource
-    protected DataStoreFactory dataStoreFactory;
-
-    @Resource
-    protected FailureUrlService failureUrlService;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("dataConfig");
-    }
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        dataConfigItems = dataConfigService.getDataConfigList(dataConfigPager);
-
-        // restore from pager
-        BeanUtil.copyBeanToBean(dataConfigPager, dataConfigForm.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(dataConfigForm.pageNumber)) {
-            try {
-                dataConfigPager.setCurrentPageNumber(Integer.parseInt(dataConfigForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Invalid value: " + dataConfigForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String search() {
-        BeanUtil.copyBeanToBean(dataConfigForm.searchParams, dataConfigPager,
-                option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        dataConfigPager.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 (dataConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    dataConfigForm.crudMode });
-        }
-
-        loadDataConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        dataConfigForm.initialize();
-        dataConfigForm.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 (dataConfigForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.EDIT_MODE, dataConfigForm.crudMode });
-        }
-
-        loadDataConfig();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        dataConfigForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadDataConfig();
-
-        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 (dataConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    dataConfigForm.crudMode });
-        }
-
-        loadDataConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        dataConfigForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadDataConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final DataConfig dataConfig = createDataConfig();
-            dataConfigService.store(dataConfig);
-            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 DataConfig dataConfig = createDataConfig();
-            dataConfigService.store(dataConfig);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            logger.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            logger.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", dataConfigForm.id);
-
-        return keys;
-    }
-
-    protected void loadDataConfig() {
-
-        final DataConfig dataConfig = dataConfigService.getDataConfig(createKeyMap());
-        if (dataConfig == null) {
-            // throw an exception
-            throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataConfigForm.id });
-        }
-
-        BeanUtil.copyBeanToBean(dataConfig, dataConfigForm, option -> option.excludes("searchParams", "mode"));
-
-        // normalize boost
-        if (dataConfigForm.boost != null && dataConfigForm.boost.indexOf('.') > 0) {
-            dataConfigForm.boost = dataConfigForm.boost.substring(0, dataConfigForm.boost.indexOf('.'));
-        }
-    }
-
-    protected DataConfig createDataConfig() {
-        DataConfig dataConfig;
-        final String username = systemHelper.getUsername();
-        final long currentTime = systemHelper.getCurrentTimeAsLong();
-        if (dataConfigForm.crudMode == CommonConstants.EDIT_MODE) {
-            dataConfig = dataConfigService.getDataConfig(createKeyMap());
-            if (dataConfig == null) {
-                // throw an exception
-                throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataConfigForm.id });
-            }
-        } else {
-            dataConfig = new DataConfig();
-            dataConfig.setCreatedBy(username);
-            dataConfig.setCreatedTime(currentTime);
-        }
-        dataConfig.setUpdatedBy(username);
-        dataConfig.setUpdatedTime(currentTime);
-        BeanUtil.copyBeanToBean(dataConfigForm, dataConfig, option -> option.exclude(CommonConstants.COMMON_CONVERSION_RULE));
-
-        return dataConfig;
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (dataConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    dataConfigForm.crudMode });
-        }
-
-        try {
-            final DataConfig dataConfig = dataConfigService.getDataConfig(createKeyMap());
-            if (dataConfig == null) {
-                // throw an exception
-                throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataConfigForm.id });
-            }
-
-            failureUrlService.deleteByConfigId(dataConfig.getConfigId());
-
-            dataConfigService.delete(dataConfig);
-            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 SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    public List<RoleType> getRoleTypeItems() {
-        return roleTypeService.getRoleTypeList();
-    }
-
-    public List<LabelType> getLabelTypeItems() {
-        return labelTypeService.getLabelTypeList();
-    }
-
-    public List<Map<String, String>> getHandlerNameItems() {
-        final List<String> dataStoreNameList = dataStoreFactory.getDataStoreNameList();
-        final List<Map<String, String>> itemList = new ArrayList<Map<String, String>>();
-        for (final String name : dataStoreNameList) {
-            final Map<String, String> map = new HashMap<String, String>();
-            map.put(Constants.ITEM_LABEL, name);
-            map.put(Constants.ITEM_VALUE, name);
-            itemList.add(map);
-        }
-        return itemList;
-    }
-}

+ 0 - 352
src/main/java/org/codelibs/fess/app/web/admin/FileConfigAction.java

@@ -1,352 +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.beans.FessBeans;
-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.FileConfig;
-import org.codelibs.fess.es.exentity.LabelType;
-import org.codelibs.fess.es.exentity.RoleType;
-import org.codelibs.fess.exception.SSCActionMessagesException;
-import org.codelibs.fess.helper.SystemHelper;
-import org.codelibs.fess.app.pager.FileConfigPager;
-import org.codelibs.fess.app.service.FailureUrlService;
-import org.codelibs.fess.app.service.FileConfigService;
-import org.codelibs.fess.app.service.LabelTypeService;
-import org.codelibs.fess.app.service.RoleTypeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FileConfigAction extends FessAdminAction {
-
-    private static final Logger logger = LoggerFactory.getLogger(FileConfigAction.class);
-
-    // for list
-
-    public List<FileConfig> fileConfigItems;
-
-    // for edit/confirm/delete
-
-    //@ActionForm
-    @Resource
-    protected FileConfigForm fileConfigForm;
-
-    @Resource
-    protected FileConfigService fileConfigService;
-
-    @Resource
-    protected FileConfigPager fileConfigPager;
-
-    @Resource
-    protected RoleTypeService roleTypeService;
-
-    @Resource
-    protected LabelTypeService labelTypeService;
-
-    @Resource
-    protected FailureUrlService failureUrlService;
-
-    @Resource
-    protected SystemHelper systemHelper;
-
-    public String getHelpLink() {
-        return systemHelper.getHelpLink("fileConfig");
-    }
-
-    protected String displayList(final boolean redirect) {
-        // page navi
-        fileConfigItems = fileConfigService.getFileConfigList(fileConfigPager);
-
-        // restore from pager
-        BeanUtil.copyBeanToBean(fileConfigPager, fileConfigForm.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(fileConfigForm.pageNumber)) {
-            try {
-                fileConfigPager.setCurrentPageNumber(Integer.parseInt(fileConfigForm.pageNumber));
-            } catch (final NumberFormatException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Invalid value: " + fileConfigForm.pageNumber, e);
-                }
-            }
-        }
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String search() {
-        BeanUtil.copyBeanToBean(fileConfigForm.searchParams, fileConfigPager,
-                option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
-
-        return displayList(false);
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String reset() {
-        fileConfigPager.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 (fileConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
-                    fileConfigForm.crudMode });
-        }
-
-        loadFileConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String createpage() {
-        // page navi
-        fileConfigForm.initialize();
-        fileConfigForm.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 (fileConfigForm.crudMode != CommonConstants.EDIT_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode",
-                    new Object[] { CommonConstants.EDIT_MODE, fileConfigForm.crudMode });
-        }
-
-        loadFileConfig();
-
-        return "edit.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String editfromconfirm() {
-        fileConfigForm.crudMode = CommonConstants.EDIT_MODE;
-
-        loadFileConfig();
-
-        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 (fileConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    fileConfigForm.crudMode });
-        }
-
-        loadFileConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = true, validate = false)
-    //@Execute(validator = false, input = "error.jsp")
-    public String deletefromconfirm() {
-        fileConfigForm.crudMode = CommonConstants.DELETE_MODE;
-
-        loadFileConfig();
-
-        return "confirm.jsp";
-    }
-
-    @Token(save = false, validate = true)
-    //@Execute(validator = true, input = "edit.jsp")
-    public String create() {
-        try {
-            final FileConfig fileConfig = createFileConfig();
-            fileConfigService.store(fileConfig);
-            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 FileConfig fileConfig = createFileConfig();
-            fileConfigService.store(fileConfig);
-            SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
-
-            return displayList(true);
-        } catch (final ActionMessagesException e) {
-            logger.error(e.getMessage(), e);
-            throw e;
-        } catch (final CrudMessageException e) {
-            logger.error(e.getMessage(), e);
-            throw new ActionMessagesException(e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
-        }
-    }
-
-    protected Map<String, String> createKeyMap() {
-        final Map<String, String> keys = new HashMap<String, String>();
-
-        keys.put("id", fileConfigForm.id);
-
-        return keys;
-    }
-
-    protected void loadFileConfig() {
-
-        final FileConfig fileConfig = fileConfigService.getFileConfig(createKeyMap());
-        if (fileConfig == null) {
-            // throw an exception
-            throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileConfigForm.id });
-        }
-
-        BeanUtil.copyBeanToBean(fileConfig, fileConfigForm, option -> option.exclude("searchParams", "mode"));
-
-        // normalize boost
-        if (fileConfigForm.boost != null && fileConfigForm.boost.indexOf('.') > 0) {
-            fileConfigForm.boost = fileConfigForm.boost.substring(0, fileConfigForm.boost.indexOf('.'));
-        }
-    }
-
-    protected FileConfig createFileConfig() {
-        FileConfig fileConfig;
-        final String username = systemHelper.getUsername();
-        final long currentTime = systemHelper.getCurrentTimeAsLong();
-        if (fileConfigForm.crudMode == CommonConstants.EDIT_MODE) {
-            fileConfig = fileConfigService.getFileConfig(createKeyMap());
-            if (fileConfig == null) {
-                // throw an exception
-                throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileConfigForm.id });
-            }
-        } else {
-            fileConfig = new FileConfig();
-            fileConfig.setCreatedBy(username);
-            fileConfig.setCreatedTime(currentTime);
-        }
-        fileConfig.setUpdatedBy(username);
-        fileConfig.setUpdatedTime(currentTime);
-        BeanUtil.copyBeanToBean(fileConfigForm, fileConfig, option -> option.exclude(CommonConstants.COMMON_CONVERSION_RULE));
-
-        return fileConfig;
-    }
-
-    //@Execute(validator = false, input = "error.jsp")
-    public String delete() {
-        if (fileConfigForm.crudMode != CommonConstants.DELETE_MODE) {
-            throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
-                    fileConfigForm.crudMode });
-        }
-
-        try {
-            final FileConfig fileConfig = fileConfigService.getFileConfig(createKeyMap());
-            if (fileConfig == null) {
-                // throw an exception
-                throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileConfigForm.id });
-            }
-
-            failureUrlService.deleteByConfigId(fileConfig.getConfigId());
-
-            fileConfigService.delete(fileConfig);
-            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 SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
-        } catch (final Exception e) {
-            logger.error(e.getMessage(), e);
-            throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
-        }
-    }
-
-    public List<RoleType> getRoleTypeItems() {
-        return roleTypeService.getRoleTypeList();
-    }
-
-    public List<LabelType> getLabelTypeItems() {
-        return labelTypeService.getLabelTypeList();
-    }
-
-}

+ 311 - 0
src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java

@@ -0,0 +1,311 @@
+/*
+ * 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.dataconfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.annotation.Token;
+import org.codelibs.fess.app.pager.DataConfigPager;
+import org.codelibs.fess.app.service.DataConfigService;
+import org.codelibs.fess.app.service.LabelTypeService;
+import org.codelibs.fess.app.service.RoleTypeService;
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.es.exentity.DataConfig;
+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 jflute
+ */
+public class AdminDataconfigAction extends FessAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private DataConfigService dataConfigService;
+    @Resource
+    private DataConfigPager dataConfigPager;
+    @Resource
+    private SystemHelper systemHelper;
+    @Resource
+    protected RoleTypeService roleTypeService;
+    @Resource
+    protected LabelTypeService labelTypeService;
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("dataConfig"));
+    }
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+    @Execute
+    public HtmlResponse index(final DataConfigSearchForm form) {
+        return asHtml(path_AdminDataconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse list(final Integer pageNumber, final DataConfigSearchForm form) {
+        dataConfigPager.setCurrentPageNumber(pageNumber);
+        return asHtml(path_AdminDataconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse search(final DataConfigSearchForm form) {
+        copyBeanToBean(form.searchParams, dataConfigPager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+        return asHtml(path_AdminDataconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse reset(final DataConfigSearchForm form) {
+        dataConfigPager.clear();
+        return asHtml(path_AdminDataconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse back(final DataConfigSearchForm form) {
+        return asHtml(path_AdminDataconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    protected void searchPaging(final RenderData data, final DataConfigSearchForm form) {
+        data.register("dataConfigItems", dataConfigService.getDataConfigList(dataConfigPager)); // page navi
+
+        // restore from pager
+        copyBeanToBean(dataConfigPager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+    }
+
+    // ===================================================================================
+    //                                                                        Edit Execute
+    //                                                                        ============
+    // -----------------------------------------------------
+    //                                            Entry Page
+    //                                            ----------
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse createpage(final DataConfigEditForm form) {
+        form.initialize();
+        form.crudMode = CommonConstants.CREATE_MODE;
+        return asHtml(path_AdminDataconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editpage(final int crudMode, final String id, final DataConfigEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CommonConstants.EDIT_MODE);
+        loadDataConfig(form);
+        return asHtml(path_AdminDataconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editagain(final DataConfigEditForm form) {
+        return asHtml(path_AdminDataconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editfromconfirm(final DataConfigEditForm form) {
+        form.crudMode = CommonConstants.EDIT_MODE;
+        loadDataConfig(form);
+        return asHtml(path_AdminDataconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletepage(final int crudMode, final String id, final DataConfigEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CommonConstants.DELETE_MODE);
+        loadDataConfig(form);
+        return asHtml(path_AdminDataconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletefromconfirm(final DataConfigEditForm form) {
+        form.crudMode = CommonConstants.DELETE_MODE;
+        loadDataConfig(form);
+        return asHtml(path_AdminDataconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    // -----------------------------------------------------
+    //                                               Confirm
+    //                                               -------
+    @Execute
+    public HtmlResponse confirmpage(final int crudMode, final String id, final DataConfigEditForm form) {
+        try {
+            form.crudMode = crudMode;
+            form.id = id;
+            verifyCrudMode(form, CommonConstants.CONFIRM_MODE);
+            loadDataConfig(form);
+            return asHtml(path_AdminDataconfig_ConfirmJsp).renderWith(data -> {
+                registerRolesAndLabels(data);
+            });
+        } catch (final Exception e) {
+            e.printStackTrace();
+            return asHtml(path_AdminDataconfig_ConfirmJsp);
+        }
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromcreate(final DataConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminDataconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromupdate(final DataConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminDataconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    // -----------------------------------------------------
+    //                                         Actually Crud
+    //                                         -------------
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse create(final DataConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        dataConfigService.store(createDataConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse update(final DataConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        dataConfigService.store(createDataConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    @Execute
+    public HtmlResponse delete(final DataConfigEditForm form) {
+        verifyCrudMode(form, CommonConstants.DELETE_MODE);
+        dataConfigService.delete(getDataConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    // ===================================================================================
+    //                                                                        Assist Logic
+    //                                                                        ============
+    protected void loadDataConfig(final DataConfigEditForm form) {
+        copyBeanToBean(getDataConfig(form), form, op -> op.exclude("crudMode"));
+    }
+
+    protected DataConfig getDataConfig(final DataConfigEditForm form) {
+        final DataConfig dataConfig = dataConfigService.getDataConfig(createKeyMap(form));
+        if (dataConfig == null) {
+            throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml());
+        }
+        return dataConfig;
+    }
+
+    protected DataConfig createDataConfig(final DataConfigEditForm form) {
+        DataConfig dataConfig;
+        final String username = systemHelper.getUsername();
+        final long currentTime = systemHelper.getCurrentTimeAsLong();
+        if (form.crudMode == CommonConstants.EDIT_MODE) {
+            dataConfig = getDataConfig(form);
+        } else {
+            dataConfig = new DataConfig();
+            dataConfig.setCreatedBy(username);
+            dataConfig.setCreatedTime(currentTime);
+        }
+        dataConfig.setUpdatedBy(username);
+        dataConfig.setUpdatedTime(currentTime);
+        copyBeanToBean(form, dataConfig, op -> op.exclude(CommonConstants.COMMON_CONVERSION_RULE));
+        return dataConfig;
+    }
+
+    protected Map<String, String> createKeyMap(final DataConfigEditForm form) {
+        final Map<String, String> keys = new HashMap<String, String>();
+        keys.put("id", form.id);
+        return keys;
+    }
+
+    protected void registerRolesAndLabels(final RenderData data) {
+        data.register("roleTypeItems", roleTypeService.getRoleTypeList());
+        data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+    }
+
+    // ===================================================================================
+    //                                                                        Small Helper
+    //                                                                        ============
+    protected void verifyCrudMode(final DataConfigEditForm 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_AdminDataconfig_EditJsp).renderWith(data -> {
+                registerRolesAndLabels(data);
+            });
+        };
+    }
+}

+ 6 - 2
src/main/java/org/codelibs/fess/app/web/admin/DataConfigForm.java → src/main/java/org/codelibs/fess/app/web/admin/dataconfig/DataConfigEditForm.java

@@ -14,7 +14,7 @@
  * governing permissions and limitations under the License.
  */
 
-package org.codelibs.fess.app.web.admin;
+package org.codelibs.fess.app.web.admin.dataconfig;
 
 import java.io.Serializable;
 import java.util.HashMap;
@@ -22,7 +22,11 @@ import java.util.Map;
 
 import org.codelibs.fess.util.ComponentUtil;
 
-public class DataConfigForm implements Serializable {
+/**
+ * @author codelibs
+ * @author jflute
+ */
+public class DataConfigEditForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 

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

+ 311 - 0
src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java

@@ -0,0 +1,311 @@
+/*
+ * 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.fileconfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.codelibs.fess.annotation.Token;
+import org.codelibs.fess.app.pager.FileConfigPager;
+import org.codelibs.fess.app.service.FileConfigService;
+import org.codelibs.fess.app.service.LabelTypeService;
+import org.codelibs.fess.app.service.RoleTypeService;
+import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.es.exentity.FileConfig;
+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 jflute
+ */
+public class AdminFileconfigAction extends FessAdminAction {
+
+    // ===================================================================================
+    //                                                                           Attribute
+    //                                                                           =========
+    @Resource
+    private FileConfigService fileConfigService;
+    @Resource
+    private FileConfigPager fileConfigPager;
+    @Resource
+    private SystemHelper systemHelper;
+    @Resource
+    protected RoleTypeService roleTypeService;
+    @Resource
+    protected LabelTypeService labelTypeService;
+
+    // ===================================================================================
+    //                                                                               Hook
+    //                                                                              ======
+    @Override
+    protected void setupHtmlData(final ActionRuntime runtime) {
+        super.setupHtmlData(runtime);
+        runtime.registerData("helpLink", systemHelper.getHelpLink("fileConfig"));
+    }
+
+    // ===================================================================================
+    //                                                                      Search Execute
+    //                                                                      ==============
+    @Execute
+    public HtmlResponse index(final FileConfigSearchForm form) {
+        return asHtml(path_AdminFileconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse list(final Integer pageNumber, final FileConfigSearchForm form) {
+        fileConfigPager.setCurrentPageNumber(pageNumber);
+        return asHtml(path_AdminFileconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse search(final FileConfigSearchForm form) {
+        copyBeanToBean(form.searchParams, fileConfigPager, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+        return asHtml(path_AdminFileconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse reset(final FileConfigSearchForm form) {
+        fileConfigPager.clear();
+        return asHtml(path_AdminFileconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    @Execute
+    public HtmlResponse back(final FileConfigSearchForm form) {
+        return asHtml(path_AdminFileconfig_IndexJsp).renderWith(data -> {
+            searchPaging(data, form);
+        });
+    }
+
+    protected void searchPaging(final RenderData data, final FileConfigSearchForm form) {
+        data.register("fileConfigItems", fileConfigService.getFileConfigList(fileConfigPager)); // page navi
+
+        // restore from pager
+        copyBeanToBean(fileConfigPager, form.searchParams, op -> op.exclude(CommonConstants.PAGER_CONVERSION_RULE));
+    }
+
+    // ===================================================================================
+    //                                                                        Edit Execute
+    //                                                                        ============
+    // -----------------------------------------------------
+    //                                            Entry Page
+    //                                            ----------
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse createpage(final FileConfigEditForm form) {
+        form.initialize();
+        form.crudMode = CommonConstants.CREATE_MODE;
+        return asHtml(path_AdminFileconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editpage(final int crudMode, final String id, final FileConfigEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CommonConstants.EDIT_MODE);
+        loadFileConfig(form);
+        return asHtml(path_AdminFileconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editagain(final FileConfigEditForm form) {
+        return asHtml(path_AdminFileconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse editfromconfirm(final FileConfigEditForm form) {
+        form.crudMode = CommonConstants.EDIT_MODE;
+        loadFileConfig(form);
+        return asHtml(path_AdminFileconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletepage(final int crudMode, final String id, final FileConfigEditForm form) {
+        form.crudMode = crudMode;
+        form.id = id;
+        verifyCrudMode(form, CommonConstants.DELETE_MODE);
+        loadFileConfig(form);
+        return asHtml(path_AdminFileconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = true, validate = false)
+    @Execute
+    public HtmlResponse deletefromconfirm(final FileConfigEditForm form) {
+        form.crudMode = CommonConstants.DELETE_MODE;
+        loadFileConfig(form);
+        return asHtml(path_AdminFileconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    // -----------------------------------------------------
+    //                                               Confirm
+    //                                               -------
+    @Execute
+    public HtmlResponse confirmpage(final int crudMode, final String id, final FileConfigEditForm form) {
+        try {
+            form.crudMode = crudMode;
+            form.id = id;
+            verifyCrudMode(form, CommonConstants.CONFIRM_MODE);
+            loadFileConfig(form);
+            return asHtml(path_AdminFileconfig_ConfirmJsp).renderWith(data -> {
+                registerRolesAndLabels(data);
+            });
+        } catch (final Exception e) {
+            e.printStackTrace();
+            return asHtml(path_AdminFileconfig_ConfirmJsp);
+        }
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromcreate(final FileConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminFileconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    @Token(save = false, validate = true, keep = true)
+    @Execute
+    public HtmlResponse confirmfromupdate(final FileConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        return asHtml(path_AdminFileconfig_ConfirmJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
+        });
+    }
+
+    // -----------------------------------------------------
+    //                                         Actually Crud
+    //                                         -------------
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse create(final FileConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        fileConfigService.store(createFileConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    @Token(save = false, validate = true)
+    @Execute
+    public HtmlResponse update(final FileConfigEditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        fileConfigService.store(createFileConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    @Execute
+    public HtmlResponse delete(final FileConfigEditForm form) {
+        verifyCrudMode(form, CommonConstants.DELETE_MODE);
+        fileConfigService.delete(getFileConfig(form));
+        saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
+        return redirect(getClass());
+    }
+
+    // ===================================================================================
+    //                                                                        Assist Logic
+    //                                                                        ============
+    protected void loadFileConfig(final FileConfigEditForm form) {
+        copyBeanToBean(getFileConfig(form), form, op -> op.exclude("crudMode"));
+    }
+
+    protected FileConfig getFileConfig(final FileConfigEditForm form) {
+        final FileConfig fileConfig = fileConfigService.getFileConfig(createKeyMap(form));
+        if (fileConfig == null) {
+            throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml());
+        }
+        return fileConfig;
+    }
+
+    protected FileConfig createFileConfig(final FileConfigEditForm form) {
+        FileConfig fileConfig;
+        final String username = systemHelper.getUsername();
+        final long currentTime = systemHelper.getCurrentTimeAsLong();
+        if (form.crudMode == CommonConstants.EDIT_MODE) {
+            fileConfig = getFileConfig(form);
+        } else {
+            fileConfig = new FileConfig();
+            fileConfig.setCreatedBy(username);
+            fileConfig.setCreatedTime(currentTime);
+        }
+        fileConfig.setUpdatedBy(username);
+        fileConfig.setUpdatedTime(currentTime);
+        copyBeanToBean(form, fileConfig, op -> op.exclude(CommonConstants.COMMON_CONVERSION_RULE));
+        return fileConfig;
+    }
+
+    protected Map<String, String> createKeyMap(final FileConfigEditForm form) {
+        final Map<String, String> keys = new HashMap<String, String>();
+        keys.put("id", form.id);
+        return keys;
+    }
+
+    protected void registerRolesAndLabels(final RenderData data) {
+        data.register("roleTypeItems", roleTypeService.getRoleTypeList());
+        data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+    }
+
+    // ===================================================================================
+    //                                                                        Small Helper
+    //                                                                        ============
+    protected void verifyCrudMode(final FileConfigEditForm 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_AdminFileconfig_EditJsp).renderWith(data -> {
+                registerRolesAndLabels(data);
+            });
+        };
+    }
+}

+ 7 - 14
src/main/java/org/codelibs/fess/app/web/admin/FileConfigForm.java → src/main/java/org/codelibs/fess/app/web/admin/fileconfig/FileConfigEditForm.java

@@ -14,17 +14,19 @@
  * governing permissions and limitations under the License.
  */
 
-package org.codelibs.fess.app.web.admin;
+package org.codelibs.fess.app.web.admin.fileconfig;
 
 import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
 
 import org.codelibs.fess.Constants;
-import org.codelibs.fess.annotation.UriType;
 import org.codelibs.fess.util.ComponentUtil;
+import org.codelibs.fess.annotation.UriType;
 
-public class FileConfigForm implements Serializable {
+/**
+ * @author codelibs
+ * @author jflute
+ */
+public class FileConfigEditForm implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -32,18 +34,9 @@ public class FileConfigForm implements Serializable {
 
     public String[] labelTypeIds;
 
-    //@IntegerType
-    public String pageNumber;
-
-    public Map<String, String> searchParams = new HashMap<String, String>();
-
     //@IntegerType
     public int crudMode;
 
-    public String getCurrentPageNumber() {
-        return pageNumber;
-    }
-
     //@Required(target = "confirmfromupdate,update,delete")
     //@Maxbytelength(maxbytelength = 1000)
     public String id;

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

+ 21 - 26
src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java

@@ -124,8 +124,7 @@ public class AdminWebconfigAction extends FessAdminAction {
         form.initialize();
         form.crudMode = CommonConstants.CREATE_MODE;
         return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+            registerRolesAndLabels(data);
         });
     }
 
@@ -137,17 +136,15 @@ public class AdminWebconfigAction extends FessAdminAction {
         verifyCrudMode(form, CommonConstants.EDIT_MODE);
         loadWebConfig(form);
         return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+            registerRolesAndLabels(data);
         });
     }
 
     @Token(save = true, validate = false)
     @Execute
     public HtmlResponse editagain(final WebConfigEditForm form) {
-        return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+    	return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
         });
     }
 
@@ -157,8 +154,7 @@ public class AdminWebconfigAction extends FessAdminAction {
         form.crudMode = CommonConstants.EDIT_MODE;
         loadWebConfig(form);
         return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+            registerRolesAndLabels(data);
         });
     }
 
@@ -169,9 +165,8 @@ public class AdminWebconfigAction extends FessAdminAction {
         form.id = id;
         verifyCrudMode(form, CommonConstants.DELETE_MODE);
         loadWebConfig(form);
-        return asHtml(path_AdminWebconfig_ConfirmJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+        return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
         });
     }
 
@@ -180,9 +175,8 @@ public class AdminWebconfigAction extends FessAdminAction {
     public HtmlResponse deletefromconfirm(final WebConfigEditForm form) {
         form.crudMode = CommonConstants.DELETE_MODE;
         loadWebConfig(form);
-        return asHtml(path_AdminWebconfig_ConfirmJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+        return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
         });
     }
 
@@ -196,9 +190,8 @@ public class AdminWebconfigAction extends FessAdminAction {
             form.id = id;
             verifyCrudMode(form, CommonConstants.CONFIRM_MODE);
             loadWebConfig(form);
-            return asHtml(path_AdminWebconfig_ConfirmJsp).renderWith(data -> {
-                data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-                data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+            return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+                registerRolesAndLabels(data);
             });
         } catch (final Exception e) {
             e.printStackTrace();
@@ -211,9 +204,8 @@ public class AdminWebconfigAction extends FessAdminAction {
     @Execute
     public HtmlResponse confirmfromcreate(final WebConfigEditForm form) {
         validate(form, messages -> {}, toEditHtml());
-        return asHtml(path_AdminWebconfig_ConfirmJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+        return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
         });
     }
 
@@ -221,9 +213,8 @@ public class AdminWebconfigAction extends FessAdminAction {
     @Execute
     public HtmlResponse confirmfromupdate(final WebConfigEditForm form) {
         validate(form, messages -> {}, toEditHtml());
-        return asHtml(path_AdminWebconfig_ConfirmJsp).renderWith(data -> {
-            data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-            data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+        return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
+            registerRolesAndLabels(data);
         });
     }
 
@@ -294,6 +285,11 @@ public class AdminWebconfigAction extends FessAdminAction {
         return keys;
     }
 
+    protected void registerRolesAndLabels(final RenderData data) {
+        data.register("roleTypeItems", roleTypeService.getRoleTypeList());
+        data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+    }
+
     // ===================================================================================
     //                                                                        Small Helper
     //                                                                        ============
@@ -308,8 +304,7 @@ public class AdminWebconfigAction extends FessAdminAction {
     protected VaErrorHook toEditHtml() {
         return () -> {
             return asHtml(path_AdminWebconfig_EditJsp).renderWith(data -> {
-                data.register("roleTypeItems", roleTypeService.getRoleTypeList());
-                data.register("labelTypeItems", labelTypeService.getLabelTypeList());
+                registerRolesAndLabels(data);
             });
         };
     }

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

@@ -70,15 +70,15 @@
 							<span><la:message key="labels.menu.web" /></span>
 						</la:link></li>
 
-					<li <c:if test="${param.menuType=='fileConfig'}">class="active"</c:if>><todo:link href="/admin/fileConfig/index">
+					<li <c:if test="${param.menuType=='fileConfig'}">class="active"</c:if>><la:link href="/admin/fileconfig/index">
 							<i class='fa fa-angle-right'></i>
 							<span><la:message key="labels.menu.file_system" /></span>
-						</todo:link></li>
+						</la:link></li>
 
-					<li <c:if test="${param.menuType=='dataConfig'}">class="active"</c:if>><todo:link href="/admin/dataConfig/index">
+					<li <c:if test="${param.menuType=='dataConfig'}">class="active"</c:if>><la:link href="/admin/dataconfig/index">
 							<i class='fa fa-angle-right'></i>
 							<span><la:message key="labels.menu.data_store" /></span>
-						</todo:link></li>
+						</la:link></li>
 
 					<li <c:if test="${param.menuType=='labelType'}">class="active"</c:if>><la:link href="/admin/labeltype/index">
 							<i class='fa fa-angle-right'></i>