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

Lastaflute: dict
This commit is contained in:
Shinsuke Sugaya 2015-10-05 22:03:08 +09:00
commit b9cb10c505
24 changed files with 777 additions and 884 deletions

View file

@ -115,15 +115,6 @@
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<!-- TODO remove -->
<excludes>
<exclude>org/codelibs/fess/app/web/admin/dict/UserDictForm.java</exclude>
<exclude>org/codelibs/fess/app/web/admin/dict/SynonymForm.java</exclude>
<exclude>org/codelibs/fess/app/web/admin/dict/UserDictAction.java</exclude>
<exclude>org/codelibs/fess/app/web/admin/dict/SynonymAction.java</exclude>
<exclude>org/codelibs/fess/app/web/admin/DictForm.java</exclude>
<exclude>org/codelibs/fess/app/web/admin/DictAction.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>

View file

@ -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";
}
}

View file

@ -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);
});
}
}

View file

@ -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>();
}

View file

@ -1,406 +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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
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.synonym.SynonymFile;
import org.codelibs.fess.dict.synonym.SynonymItem;
import org.codelibs.fess.exception.SSCActionMessagesException;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.app.pager.SynonymPager;
import org.codelibs.fess.app.service.SynonymService;
import org.lastaflute.web.util.LaResponseUtil;
public class SynonymAction {
private static final Log log = LogFactory.getLog(SynonymAction.class);
@Resource
//@ActionForm
protected SynonymForm synonymForm;
@Resource
protected SynonymService synonymService;
@Resource
protected SynonymPager synonymPager;
@Resource
protected SystemHelper systemHelper;
public List<SynonymItem> synonymItemItems;
public String filename;
public String getHelpLink() {
return systemHelper.getHelpLink("dict");
}
protected String displayList(final boolean redirect) {
// page navi
synonymItemItems = synonymService.getSynonymList(synonymForm.dictId, synonymPager);
// restore from pager
BeanUtil.copyBeanToBean(synonymPager, synonymForm.searchParams, option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
if (redirect) {
return "index?dictId=" + synonymForm.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(synonymForm.pageNumber)) {
try {
synonymPager.setCurrentPageNumber(Integer.parseInt(synonymForm.pageNumber));
} catch (final NumberFormatException e) {
if (log.isDebugEnabled()) {
log.debug("Invalid value: " + synonymForm.pageNumber, e);
}
}
}
return displayList(false);
}
//@Execute(validator = false, input = "error.jsp")
public String search() {
BeanUtil.copyBeanToBean(synonymForm.searchParams, synonymPager, option -> option.exclude(CommonConstants.PAGER_CONVERSION_RULE));
return displayList(false);
}
//@Execute(validator = false, input = "error.jsp")
public String reset() {
synonymPager.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 (synonymForm.crudMode != CommonConstants.CONFIRM_MODE) {
throw new ActionMessagesException("errors.crud_invalid_mode",
new Object[] { CommonConstants.CONFIRM_MODE, synonymForm.crudMode });
}
loadSynonym();
return "confirm.jsp";
}
@Token(save = true, validate = false)
//@Execute(validator = false, input = "error.jsp")
public String createpage() {
// page navi
synonymForm.initialize();
synonymForm.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 (synonymForm.crudMode != CommonConstants.EDIT_MODE) {
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, synonymForm.crudMode });
}
loadSynonym();
return "edit.jsp";
}
@Token(save = true, validate = false)
//@Execute(validator = false, input = "error.jsp")
public String editfromconfirm() {
synonymForm.crudMode = CommonConstants.EDIT_MODE;
loadSynonym();
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 (synonymForm.crudMode != CommonConstants.DELETE_MODE) {
throw new ActionMessagesException("errors.crud_invalid_mode",
new Object[] { CommonConstants.DELETE_MODE, synonymForm.crudMode });
}
loadSynonym();
return "confirm.jsp";
}
@Token(save = true, validate = false)
//@Execute(validator = false, input = "error.jsp")
public String deletefromconfirm() {
synonymForm.crudMode = CommonConstants.DELETE_MODE;
loadSynonym();
return "confirm.jsp";
}
@Token(save = false, validate = true)
//@Execute(validator = true, input = "edit.jsp")
public String create() {
try {
final SynonymItem synonymItem = createSynonym();
synonymService.store(synonymForm.dictId, synonymItem);
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 SynonymItem synonymItem = createSynonym();
synonymService.store(synonymForm.dictId, synonymItem);
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 (synonymForm.crudMode != CommonConstants.DELETE_MODE) {
throw new ActionMessagesException("errors.crud_invalid_mode",
new Object[] { CommonConstants.DELETE_MODE, synonymForm.crudMode });
}
try {
final SynonymItem synonymItem = synonymService.getSynonym(synonymForm.dictId, createKeyMap());
if (synonymItem == null) {
// throw an exception
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
new Object[] { synonymForm.id });
}
synonymService.delete(synonymForm.dictId, synonymItem);
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 SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
}
filename = synonymFile.getSimpleName();
return "download.jsp";
}
@Token(save = true, validate = true)
//@Execute(validator = false, input = "downloadpage")
public String download() {
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
}
try (InputStream in = synonymFile.getInputStream()) {
LaResponseUtil.download(synonymFile.getSimpleName(), in);
} catch (final IOException e) {
throw new SSCActionMessagesException("errors.failed_to_download_synonym_file");
}
return null;
}
@Token(save = true, validate = false)
//@Execute(validator = false, input = "uploadpage")
public String uploadpage() {
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
}
filename = synonymFile.getName();
return "upload.jsp";
}
@Token(save = false, validate = true)
//@Execute(validator = true, input = "uploadpage")
public String upload() {
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
if (synonymFile == null) {
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
}
try (InputStream in = synonymForm.synonymFile.getInputStream()) {
synonymFile.update(in);
} catch (final IOException e) {
throw new SSCActionMessagesException("errors.failed_to_upload_synonym_file");
}
SAStrutsUtil.addSessionMessage("success.upload_synonym_file");
return "uploadpage?dictId=" + synonymForm.dictId + "&redirect=true";
}
protected void loadSynonym() {
final SynonymItem synonymItem = synonymService.getSynonym(synonymForm.dictId, createKeyMap());
if (synonymItem == null) {
// throw an exception
throw new ActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { synonymForm.id });
}
synonymForm.id = Long.toString(synonymItem.getId());
synonymForm.inputs = StringUtils.join(synonymItem.getInputs(), "\n");
synonymForm.outputs = StringUtils.join(synonymItem.getOutputs(), "\n");
}
protected SynonymItem createSynonym() {
SynonymItem synonymItem;
if (synonymForm.crudMode == CommonConstants.EDIT_MODE) {
synonymItem = synonymService.getSynonym(synonymForm.dictId, createKeyMap());
if (synonymItem == null) {
// throw an exception
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
new Object[] { synonymForm.id });
}
} else {
synonymItem = new SynonymItem(0, StringUtil.EMPTY_STRINGS, StringUtil.EMPTY_STRINGS);
}
final String[] newInputs = splitLine(synonymForm.inputs);
synonymItem.setNewInputs(newInputs);
final String[] newOutputs = splitLine(synonymForm.outputs);
synonymItem.setNewOutputs(newOutputs);
return synonymItem;
}
private String[] splitLine(final String value) {
if (StringUtil.isBlank(value)) {
return StringUtil.EMPTY_STRINGS;
}
final String[] values = value.split("[\r\n]");
final List<String> list = new ArrayList<String>(values.length);
for (final String line : values) {
if (StringUtil.isNotBlank(line)) {
list.add(line.trim());
}
}
return list.toArray(new String[list.size()]);
}
protected Map<String, String> createKeyMap() {
final Map<String, String> keys = new HashMap<String, String>();
keys.put("id", synonymForm.id);
return keys;
}
}

View file

@ -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;
}
}

View file

@ -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.synonym;
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.SynonymPager;
import org.codelibs.fess.app.service.SynonymService;
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 AdminDictSynonymAction extends FessAdminAction {
// ===================================================================================
// Attribute
// =========
@Resource
private SynonymService synonymService;
@Resource
private SynonymPager synonymPager;
@Resource
private SystemHelper systemHelper;
@Resource
protected DynamicProperties crawlerProperties;
// ===================================================================================
// Hook
// ======
@Override
protected void setupHtmlData(final ActionRuntime runtime) {
super.setupHtmlData(runtime);
runtime.registerData("helpLink", systemHelper.getHelpLink("synonym"));
}
// ===================================================================================
// Search Execute
// ==============
@Execute
public HtmlResponse index(final SynonymSearchForm form) {
return asHtml(path_AdminDictSynonym_IndexJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse list(final Integer pageNumber, final SynonymSearchForm form) {
synonymPager.setCurrentPageNumber(pageNumber);
return asHtml(path_AdminDictSynonym_IndexJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse search(final SynonymSearchForm form) {
copyBeanToBean(form.searchParams, synonymPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
return asHtml(path_AdminDictSynonym_IndexJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse reset(final SynonymSearchForm form) {
synonymPager.clear();
return asHtml(path_AdminDictSynonym_IndexJsp).renderWith(data -> {
searchPaging(data, form);
});
}
@Execute
public HtmlResponse back(final SynonymSearchForm form) {
return asHtml(path_AdminDictSynonym_IndexJsp).renderWith(data -> {
searchPaging(data, form);
});
}
protected void searchPaging(final RenderData data, final SynonymSearchForm form) {
// TODO
}
// ===================================================================================
// Edit Execute
// ============
// -----------------------------------------------------
// Entry Page
// ----------
@Token(save = true, validate = false)
@Execute
public HtmlResponse createpage(final SynonymEditForm form) {
form.initialize();
form.crudMode = CrudMode.CREATE;
return asHtml(path_AdminDictSynonym_EditJsp);
}
@Token(save = true, validate = false)
@Execute
public HtmlResponse editpage(final int crudMode, final String id, final SynonymEditForm form) {
form.crudMode = crudMode;
form.id = id;
verifyCrudMode(form, CrudMode.EDIT);
// TODO loadSynonym(form);
return asHtml(path_AdminDictSynonym_EditJsp);
}
@Token(save = true, validate = false)
@Execute
public HtmlResponse editagain(final SynonymEditForm form) {
return asHtml(path_AdminDictSynonym_EditJsp);
}
@Token(save = true, validate = false)
@Execute
public HtmlResponse editfromconfirm(final SynonymEditForm form) {
form.crudMode = CrudMode.EDIT;
// TODO loadSynonym(form);
return asHtml(path_AdminDictSynonym_EditJsp);
}
@Token(save = true, validate = false)
@Execute
public HtmlResponse deletepage(final int crudMode, final String id, final SynonymEditForm form) {
form.crudMode = crudMode;
form.id = id;
verifyCrudMode(form, CrudMode.DELETE);
// TODO loadSynonym(form);
return asHtml(path_AdminDictSynonym_ConfirmJsp);
}
@Token(save = true, validate = false)
@Execute
public HtmlResponse deletefromconfirm(final SynonymEditForm form) {
form.crudMode = CrudMode.DELETE;
// TODO loadSynonym(form);
return asHtml(path_AdminDictSynonym_ConfirmJsp);
}
// -----------------------------------------------------
// Confirm
// -------
@Execute
public HtmlResponse confirmpage(final int crudMode, final String id, final SynonymEditForm form) {
form.crudMode = crudMode;
form.id = id;
verifyCrudMode(form, CrudMode.CONFIRM);
// TODO loadSynonym(form);
return asHtml(path_AdminDictSynonym_ConfirmJsp);
}
@Token(save = false, validate = true, keep = true)
@Execute
public HtmlResponse confirmfromcreate(final SynonymEditForm form) {
validate(form, messages -> {}, toEditHtml());
return asHtml(path_AdminDictSynonym_ConfirmJsp);
}
@Token(save = false, validate = true, keep = true)
@Execute
public HtmlResponse confirmfromupdate(final SynonymEditForm form) {
validate(form, messages -> {}, toEditHtml());
return asHtml(path_AdminDictSynonym_ConfirmJsp);
}
// -----------------------------------------------------
// Download
// -------
@Token(save = false, validate = true)
@Execute
public HtmlResponse downloadpage(final SynonymSearchForm form) {
return asHtml(path_AdminDictSynonym_DownloadJsp);
}
@Token(save = false, validate = true)
@Execute
public HtmlResponse download(final SynonymSearchForm form) {
// TODO Download
return asHtml(path_AdminDictSynonym_DownloadJsp);
}
// -----------------------------------------------------
// Upload
// -------
@Token(save = false, validate = true)
@Execute
public HtmlResponse uploadpage(final SynonymUploadForm form) {
// TODO Upload
return asHtml(path_AdminDictSynonym_UploadJsp);
}
// -----------------------------------------------------
// Actually Crud
// -------------
@Token(save = false, validate = true)
@Execute
public HtmlResponse create(final SynonymEditForm form) {
// TODO
return redirect(getClass());
}
@Token(save = false, validate = true)
@Execute
public HtmlResponse update(final SynonymEditForm form) {
// TODO
return redirect(getClass());
}
@Execute
public HtmlResponse delete(final SynonymEditForm form) {
// TODO
return redirect(getClass());
}
@Token(save = false, validate = true)
@Execute
public HtmlResponse upload(final SynonymUploadForm form) {
// TODO
return redirect(getClass());
}
//===================================================================================
// Assist Logic
// ============
protected void loadSynonym(final SuggestElevateWordEditForm form) {
// TODO
}
// ===================================================================================
// Small Helper
// ============
protected void verifyCrudMode(final SynonymEditForm 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_AdminDictSynonym_EditJsp);
};
}
}

View file

@ -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.synonym;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class SynonymForm {
/**
* @author codelibs
* @author Keiichi Watanabe
*/
public class SynonymEditForm implements Serializable {
private static final long serialVersionUID = 1L;
//@IntegerType
public String pageNumber;

View file

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

View file

@ -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.synonym;
import java.io.Serializable;
import org.lastaflute.web.ruts.multipart.MultipartFormFile;
/**
* @author codelibs
* @author Keiichi Watanabe
*/
public class SynonymUploadForm implements Serializable {
private static final long serialVersionUID = 1L;
public MultipartFormFile synonymFile;
}

View file

@ -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);
};
}
}

View file

@ -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;

View file

@ -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>();
}

View file

@ -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;
}

View file

@ -251,8 +251,7 @@ public class AdminSearchlistAction extends FessAdminAction {
} );
thread.start();
saveInfo(messages -> messages.addSuccessDeleteSolrIndex(GLOBAL));
final String contextPath = LaRequestUtil.getRequest().getContextPath();
return newHtmlResponseAsRediect(contextPath + "/search/?query=" + LaFunctions.u(form.query));
return redirectWith(getClass(), moreUrl("search").params("query", form.query));
}
public boolean isSolrProcessRunning() {

View file

@ -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");

View file

@ -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>

View file

@ -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>

View file

@ -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>