fix #247
This commit is contained in:
parent
a4e7b24218
commit
737c887bb7
267 changed files with 4999 additions and 10699 deletions
File diff suppressed because it is too large
Load diff
|
@ -26,11 +26,9 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final int MINOR_VERSION = 3;
|
||||
|
||||
public static final String FESS_VERSION = String.valueOf(MAJOR_VERSION)
|
||||
+ "." + String.valueOf(MINOR_VERSION);
|
||||
public static final String FESS_VERSION = String.valueOf(MAJOR_VERSION) + "." + String.valueOf(MINOR_VERSION);
|
||||
|
||||
public static final String LINE_SEPARATOR = System
|
||||
.getProperty("line.separator");
|
||||
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
|
||||
public static final int DEFAULT_ADMIN_PAGE_SIZE = 25;
|
||||
|
||||
|
@ -191,10 +189,8 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String DEFAULT_PURGE_DAY = "30";
|
||||
|
||||
public static final String DEFAULT_PURGE_BY_BOTS = "BaiduMobaider,"
|
||||
+ "Baiduspider," + "CCBot," + "Googlebot," + "ia_archive,"
|
||||
+ "Mediapartners-Google," + "mobile goo," + "msnbot,"
|
||||
+ "Slurp,Yeti";
|
||||
public static final String DEFAULT_PURGE_BY_BOTS = "BaiduMobaider," + "Baiduspider," + "CCBot," + "Googlebot," + "ia_archive,"
|
||||
+ "Mediapartners-Google," + "mobile goo," + "msnbot," + "Slurp,Yeti";
|
||||
|
||||
public static final String DEFAULT_FROM_EMAIL = "Administrator <root@localhost>";
|
||||
|
||||
|
@ -256,14 +252,12 @@ public class Constants extends CoreLibConstants {
|
|||
|
||||
public static final String SAMBA = "SAMBA";
|
||||
|
||||
public static final String[] RESERVED = { "+", "-", "&&", "||", "!", "(",
|
||||
")", "{", "}", "[", "]", "^", "~", "*", "?", "\\", ";", ":", "/" };
|
||||
public static final String[] RESERVED = { "+", "-", "&&", "||", "!", "(", ")", "{", "}", "[", "]", "^", "~", "*", "?", "\\", ";", ":",
|
||||
"/" };
|
||||
|
||||
public static final Pattern SOLR_FIELD_RESERVED_PATTERN = Pattern
|
||||
.compile("([+\\-!\\(\\){}\\[\\]^\"~\\\\:\\p{Zs}]|(&&)|(\\|\\|))"); // "*", "?",
|
||||
public static final Pattern SOLR_FIELD_RESERVED_PATTERN = Pattern.compile("([+\\-!\\(\\){}\\[\\]^\"~\\\\:\\p{Zs}]|(&&)|(\\|\\|))"); // "*", "?",
|
||||
|
||||
public static final Pattern SOLR_RANGE_FIELD_RESERVED_PATTERN = Pattern
|
||||
.compile("([!\\(\\){}\\[\\]\"~\\\\:\\p{Zs}]|(&&)|(\\|\\|))");
|
||||
public static final Pattern SOLR_RANGE_FIELD_RESERVED_PATTERN = Pattern.compile("([!\\(\\){}\\[\\]\"~\\\\:\\p{Zs}]|(&&)|(\\|\\|))");
|
||||
|
||||
public static final String SEARCH_LOG_ACCESS_TYPE = "searchLogAccessType";
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ public class InvalidQueryException extends FessSystemException {
|
|||
|
||||
private final String messageCode;
|
||||
|
||||
public InvalidQueryException(final String messageCode,
|
||||
final String message, final Throwable cause) {
|
||||
public InvalidQueryException(final String messageCode, final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
this.messageCode = messageCode;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ public class WebApiException extends FessSystemException {
|
|||
return statusCode;
|
||||
}
|
||||
|
||||
public WebApiException(final int statusCode, final String message,
|
||||
final Throwable cause) {
|
||||
public WebApiException(final int statusCode, final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class AppletAction {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(AppletAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AppletAction.class);
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
|
@ -61,8 +60,7 @@ public class AppletAction {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_redirect", appletForm.uri);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_redirect", appletForm.uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -71,13 +69,11 @@ public class AppletAction {
|
|||
public String launcher() {
|
||||
launcherJarFile = systemHelper.getLauncherJarPath();
|
||||
if (StringUtil.isBlank(launcherJarFile)) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.no_launcher_applet_jar");
|
||||
throw new SSCActionMessagesException("errors.no_launcher_applet_jar");
|
||||
}
|
||||
launcherJnlpFile = systemHelper.getLauncherJnlpPath();
|
||||
if (StringUtil.isBlank(launcherJnlpFile)) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.no_launcher_applet_jar");
|
||||
throw new SSCActionMessagesException("errors.no_launcher_applet_jar");
|
||||
}
|
||||
|
||||
String encoding = appletForm.encoding;
|
||||
|
|
|
@ -113,8 +113,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class IndexAction {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(IndexAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(IndexAction.class);
|
||||
|
||||
private static final String REDIRECT_TO_INDEX = "index?redirect=true";
|
||||
|
||||
|
@ -130,8 +129,7 @@ public class IndexAction {
|
|||
|
||||
protected static final int DEFAULT_SPELLCHECK_PAGE_SIZE = 5;
|
||||
|
||||
protected static final Pattern FIELD_EXTRACTION_PATTERN = Pattern
|
||||
.compile("^([a-zA-Z0-9_]+):.*");
|
||||
protected static final Pattern FIELD_EXTRACTION_PATTERN = Pattern.compile("^([a-zA-Z0-9_]+):.*");
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
|
@ -238,10 +236,8 @@ public class IndexAction {
|
|||
|
||||
@InitMethod
|
||||
public void init() {
|
||||
searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.SEARCH_LOG_PROPERTY, Constants.TRUE));
|
||||
favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
|
||||
searchLogSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE));
|
||||
favoriteSupport = Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE));
|
||||
}
|
||||
|
||||
public String getPagingQuery() {
|
||||
|
@ -250,11 +246,8 @@ public class IndexAction {
|
|||
if (indexForm.additional != null) {
|
||||
final Set<String> fieldSet = new HashSet<String>();
|
||||
for (final String additional : indexForm.additional) {
|
||||
if (StringUtil.isNotBlank(additional)
|
||||
&& additional.length() < 1000
|
||||
&& !hasFieldInQuery(fieldSet, additional)) {
|
||||
buf.append("&additional=").append(
|
||||
S2Functions.u(additional));
|
||||
if (StringUtil.isNotBlank(additional) && additional.length() < 1000 && !hasFieldInQuery(fieldSet, additional)) {
|
||||
buf.append("&additional=").append(S2Functions.u(additional));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,8 +265,7 @@ public class IndexAction {
|
|||
langSet.clear();
|
||||
break;
|
||||
}
|
||||
final String normalizeLang = systemHelper
|
||||
.normalizeLang(lang);
|
||||
final String normalizeLang = systemHelper.normalizeLang(lang);
|
||||
if (normalizeLang != null) {
|
||||
langSet.add(normalizeLang);
|
||||
}
|
||||
|
@ -286,15 +278,12 @@ public class IndexAction {
|
|||
}
|
||||
}
|
||||
if (!indexForm.fields.isEmpty()) {
|
||||
for (final Map.Entry<String, String[]> entry : indexForm.fields
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, String[]> entry : indexForm.fields.entrySet()) {
|
||||
final String[] values = entry.getValue();
|
||||
if (values != null) {
|
||||
for (final String v : values) {
|
||||
if (StringUtil.isNotBlank(v)) {
|
||||
buf.append("&fields.")
|
||||
.append(S2Functions.u(entry.getKey()))
|
||||
.append('=').append(S2Functions.u(v));
|
||||
buf.append("&fields.").append(S2Functions.u(entry.getKey())).append('=').append(S2Functions.u(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,12 +306,10 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
protected void searchAvailable() {
|
||||
final String supportedSearch = crawlerProperties.getProperty(
|
||||
Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY,
|
||||
Constants.SUPPORTED_SEARCH_WEB);
|
||||
final String supportedSearch =
|
||||
crawlerProperties.getProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, Constants.SUPPORTED_SEARCH_WEB);
|
||||
if (Constants.SUPPORTED_SEARCH_NONE.equals(supportedSearch)) {
|
||||
throw new UnsupportedSearchException("A search is not supported: "
|
||||
+ RequestUtil.getRequest().getRequestURL());
|
||||
throw new UnsupportedSearchException("A search is not supported: " + RequestUtil.getRequest().getRequestURL());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,8 +318,7 @@ public class IndexAction {
|
|||
|
||||
if (StringUtil.isBlank(indexForm.query)) {
|
||||
try {
|
||||
final String optionQuery = queryHelper
|
||||
.buildOptionQuery(indexForm.options);
|
||||
final String optionQuery = queryHelper.buildOptionQuery(indexForm.options);
|
||||
indexForm.query = optionQuery;
|
||||
} catch (final InvalidQueryException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
@ -359,24 +345,18 @@ public class IndexAction {
|
|||
public String cache() {
|
||||
Map<String, Object> doc = null;
|
||||
try {
|
||||
doc = searchService.getDocument(fieldHelper.docIdField + ":"
|
||||
+ indexForm.docId, queryHelper.getCacheResponseFields(),
|
||||
null);
|
||||
doc = searchService.getDocument(fieldHelper.docIdField + ":" + indexForm.docId, queryHelper.getCacheResponseFields(), null);
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to request: " + indexForm.docId, e);
|
||||
}
|
||||
if (doc == null) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "errors.docid_not_found",
|
||||
indexForm.docId);
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
|
||||
return "error.jsp";
|
||||
}
|
||||
|
||||
final String content = viewHelper.createCacheContent(doc, indexForm.hq);
|
||||
if (content == null) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "errors.docid_not_found",
|
||||
indexForm.docId);
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
|
||||
return "error.jsp";
|
||||
}
|
||||
ResponseUtil.write(content, "text/html", Constants.UTF_8);
|
||||
|
@ -388,39 +368,33 @@ public class IndexAction {
|
|||
public String go() throws IOException {
|
||||
Map<String, Object> doc = null;
|
||||
try {
|
||||
doc = searchService.getDocument(fieldHelper.docIdField + ":"
|
||||
+ indexForm.docId, queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.clickCountField });
|
||||
doc =
|
||||
searchService.getDocument(fieldHelper.docIdField + ":" + indexForm.docId, queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.clickCountField });
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to request: " + indexForm.docId, e);
|
||||
}
|
||||
if (doc == null) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "errors.docid_not_found",
|
||||
indexForm.docId);
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.docid_not_found", indexForm.docId);
|
||||
return "error.jsp";
|
||||
}
|
||||
final Object urlObj = doc.get(fieldHelper.urlField);
|
||||
if (urlObj == null) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "errors.document_not_found",
|
||||
indexForm.docId);
|
||||
errorMessage =
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.document_not_found", indexForm.docId);
|
||||
return "error.jsp";
|
||||
}
|
||||
final String url = urlObj.toString();
|
||||
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE))) {
|
||||
final String userSessionId = userInfoHelper.getUserCode();
|
||||
if (userSessionId != null) {
|
||||
final SearchLogHelper searchLogHelper = ComponentUtil
|
||||
.getSearchLogHelper();
|
||||
final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
|
||||
final ClickLog clickLog = new ClickLog();
|
||||
clickLog.setUrl(url);
|
||||
LocalDateTime now = systemHelper.getCurrentTime();
|
||||
clickLog.setRequestedTime(now);
|
||||
clickLog.setQueryRequestedTime(LocalDateTime.ofInstant(
|
||||
Instant.ofEpochMilli(Long.parseLong(indexForm.rt)),
|
||||
clickLog.setQueryRequestedTime(LocalDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(indexForm.rt)),
|
||||
ZoneId.systemDefault()));
|
||||
clickLog.setUserSessionId(userSessionId);
|
||||
clickLog.setDocId(indexForm.docId);
|
||||
|
@ -436,16 +410,14 @@ public class IndexAction {
|
|||
|
||||
String hash;
|
||||
if (StringUtil.isNotBlank(indexForm.hash)) {
|
||||
final String value = URLUtil
|
||||
.decode(indexForm.hash, Constants.UTF_8);
|
||||
final String value = URLUtil.decode(indexForm.hash, Constants.UTF_8);
|
||||
final StringBuilder buf = new StringBuilder(value.length() + 100);
|
||||
for (final char c : value.toCharArray()) {
|
||||
if (CharUtil.isUrlChar(c) || c == ' ') {
|
||||
buf.append(c);
|
||||
} else {
|
||||
try {
|
||||
buf.append(URLEncoder.encode(String.valueOf(c),
|
||||
Constants.UTF_8));
|
||||
buf.append(URLEncoder.encode(String.valueOf(c), Constants.UTF_8));
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
// NOP
|
||||
}
|
||||
|
@ -457,49 +429,40 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
if (isFileSystemPath(url)) {
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.SEARCH_FILE_PROXY_PROPERTY, Constants.TRUE))) {
|
||||
final CrawlingConfigHelper crawlingConfigHelper = ComponentUtil
|
||||
.getCrawlingConfigHelper();
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_FILE_PROXY_PROPERTY, Constants.TRUE))) {
|
||||
final CrawlingConfigHelper crawlingConfigHelper = ComponentUtil.getCrawlingConfigHelper();
|
||||
try {
|
||||
crawlingConfigHelper.writeContent(doc);
|
||||
return null;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to load: " + doc, e);
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"errors.not_load_from_server", url);
|
||||
errorMessage =
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.not_load_from_server", url);
|
||||
return "error.jsp";
|
||||
}
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.SEARCH_DESKTOP_PROPERTY, Constants.FALSE))) {
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_DESKTOP_PROPERTY, Constants.FALSE))) {
|
||||
final String path = url.replaceFirst("file:/+", "//");
|
||||
final File file = new File(path);
|
||||
if (!file.exists()) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"errors.not_found_on_file_system", url);
|
||||
errorMessage =
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.not_found_on_file_system", url);
|
||||
return "error.jsp";
|
||||
}
|
||||
final Desktop desktop = Desktop.getDesktop();
|
||||
try {
|
||||
desktop.open(file);
|
||||
} catch (final Exception e) {
|
||||
errorMessage = MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"errors.could_not_open_on_system", url);
|
||||
errorMessage =
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "errors.could_not_open_on_system", url);
|
||||
logger.warn("Could not open " + path, e);
|
||||
return "error.jsp";
|
||||
}
|
||||
|
||||
ResponseUtil.getResponse().setStatus(
|
||||
HttpServletResponse.SC_NO_CONTENT);
|
||||
ResponseUtil.getResponse().setStatus(HttpServletResponse.SC_NO_CONTENT);
|
||||
return null;
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.SEARCH_FILE_LAUNCHER_PROPERTY, Constants.TRUE))) {
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.SEARCH_FILE_LAUNCHER_PROPERTY, Constants.TRUE))) {
|
||||
ResponseUtil.getResponse().sendRedirect(
|
||||
RequestUtil.getRequest().getContextPath()
|
||||
+ "/applet/launcher?uri=" + S2Functions.u(url));
|
||||
RequestUtil.getRequest().getContextPath() + "/applet/launcher?uri=" + S2Functions.u(url));
|
||||
} else {
|
||||
ResponseUtil.getResponse().sendRedirect(url + hash);
|
||||
}
|
||||
|
@ -542,19 +505,15 @@ public class IndexAction {
|
|||
OutputStream out = null;
|
||||
BufferedInputStream in = null;
|
||||
try {
|
||||
final Map<String, Object> doc = searchService
|
||||
.getDocument(fieldHelper.docIdField + ":" + indexForm.docId);
|
||||
final String url = doc == null ? null : (String) doc
|
||||
.get(fieldHelper.urlField);
|
||||
if (StringUtil.isBlank(indexForm.queryId)
|
||||
|| StringUtil.isBlank(url) || screenShotManager == null) {
|
||||
final Map<String, Object> doc = searchService.getDocument(fieldHelper.docIdField + ":" + indexForm.docId);
|
||||
final String url = doc == null ? null : (String) doc.get(fieldHelper.urlField);
|
||||
if (StringUtil.isBlank(indexForm.queryId) || StringUtil.isBlank(url) || screenShotManager == null) {
|
||||
// 404
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
|
||||
final File screenShotFile = screenShotManager.getScreenShotFile(
|
||||
indexForm.queryId, indexForm.docId);
|
||||
final File screenShotFile = screenShotManager.getScreenShotFile(indexForm.queryId, indexForm.docId);
|
||||
if (screenShotFile == null) {
|
||||
// 404
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
|
@ -600,8 +559,7 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String suggestApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.WEB_API_SUGGEST_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_SUGGEST_PROPERTY, Constants.TRUE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
@ -649,9 +607,8 @@ public class IndexAction {
|
|||
roleSet = new HashSet<>();
|
||||
}
|
||||
|
||||
final SuggestResponse suggestResponse = suggestService
|
||||
.getSuggestResponse(indexForm.query, suggestFieldName,
|
||||
labelList, new ArrayList<String>(roleSet), num);
|
||||
final SuggestResponse suggestResponse =
|
||||
suggestService.getSuggestResponse(indexForm.query, suggestFieldName, labelList, new ArrayList<String>(roleSet), num);
|
||||
|
||||
if (!suggestResponse.isEmpty()) {
|
||||
suggestResultList.add(suggestResponse);
|
||||
|
@ -666,8 +623,7 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String spellCheckApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.WEB_API_SPELLCHECK_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_SPELLCHECK_PROPERTY, Constants.TRUE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
@ -715,10 +671,9 @@ public class IndexAction {
|
|||
roleSet = new HashSet<>();
|
||||
}
|
||||
|
||||
final SpellCheckResponse spellCheckResponse = suggestService
|
||||
.getSpellCheckResponse(indexForm.query,
|
||||
spellCheckFieldName, labelList,
|
||||
new ArrayList<String>(roleSet), num);
|
||||
final SpellCheckResponse spellCheckResponse =
|
||||
suggestService.getSpellCheckResponse(indexForm.query, spellCheckFieldName, labelList, new ArrayList<String>(roleSet),
|
||||
num);
|
||||
|
||||
if (!spellCheckResponse.isEmpty()) {
|
||||
spellCheckResultList.add(spellCheckResponse);
|
||||
|
@ -733,8 +688,7 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String analysisApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.WEB_API_ANALYSIS_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_ANALYSIS_PROPERTY, Constants.TRUE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
@ -751,8 +705,7 @@ public class IndexAction {
|
|||
|
||||
try {
|
||||
final String[] fieldNames = indexForm.fn;
|
||||
final FieldAnalysisResponse fieldAnalysis = searchService
|
||||
.getFieldAnalysisResponse(fieldNames, indexForm.query);
|
||||
final FieldAnalysisResponse fieldAnalysis = searchService.getFieldAnalysisResponse(fieldNames, indexForm.query);
|
||||
WebApiUtil.setObject("fieldAnalysis", fieldAnalysis);
|
||||
} catch (final Exception e) {
|
||||
WebApiUtil.setError(1, e);
|
||||
|
@ -762,8 +715,7 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String hotSearchWordApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
@ -773,24 +725,19 @@ public class IndexAction {
|
|||
range = Range.ENTIRE;
|
||||
} else if ("day".equals(indexForm.range) || "1".equals(indexForm.range)) {
|
||||
range = Range.ONE_DAY;
|
||||
} else if ("week".equals(indexForm.range)
|
||||
|| "7".equals(indexForm.range)) {
|
||||
} else if ("week".equals(indexForm.range) || "7".equals(indexForm.range)) {
|
||||
range = Range.ONE_DAY;
|
||||
} else if ("month".equals(indexForm.range)
|
||||
|| "30".equals(indexForm.range)) {
|
||||
} else if ("month".equals(indexForm.range) || "30".equals(indexForm.range)) {
|
||||
range = Range.ONE_DAY;
|
||||
} else if ("year".equals(indexForm.range)
|
||||
|| "365".equals(indexForm.range)) {
|
||||
} else if ("year".equals(indexForm.range) || "365".equals(indexForm.range)) {
|
||||
range = Range.ONE_DAY;
|
||||
} else {
|
||||
range = Range.ENTIRE;
|
||||
}
|
||||
|
||||
try {
|
||||
final HotSearchWordHelper hotSearchWordHelper = ComponentUtil
|
||||
.getHotSearchWordHelper();
|
||||
final List<String> hotSearchWordList = hotSearchWordHelper
|
||||
.getHotSearchWordList(range);
|
||||
final HotSearchWordHelper hotSearchWordHelper = ComponentUtil.getHotSearchWordHelper();
|
||||
final List<String> hotSearchWordList = hotSearchWordHelper.getHotSearchWordList(range);
|
||||
WebApiUtil.setObject("hotSearchWordList", hotSearchWordList);
|
||||
} catch (final Exception e) {
|
||||
WebApiUtil.setError(1, e);
|
||||
|
@ -801,20 +748,17 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String favoriteApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
final Map<String, Object> doc = indexForm.docId == null ? null
|
||||
: searchService.getDocument(fieldHelper.docIdField + ":"
|
||||
+ indexForm.docId, queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.favoriteCountField });
|
||||
final Map<String, Object> doc =
|
||||
indexForm.docId == null ? null : searchService.getDocument(fieldHelper.docIdField + ":" + indexForm.docId,
|
||||
queryHelper.getResponseFields(), new String[] { fieldHelper.favoriteCountField });
|
||||
final String userCode = userInfoHelper.getUserCode();
|
||||
final String favoriteUrl = doc == null ? null : (String) doc
|
||||
.get(fieldHelper.urlField);
|
||||
final String favoriteUrl = doc == null ? null : (String) doc.get(fieldHelper.urlField);
|
||||
|
||||
if (StringUtil.isBlank(userCode)) {
|
||||
WebApiUtil.setError(2, "No user session.");
|
||||
|
@ -824,8 +768,7 @@ public class IndexAction {
|
|||
return null;
|
||||
}
|
||||
|
||||
final String[] docIds = userInfoHelper.getResultDocIds(URLDecoder
|
||||
.decode(indexForm.queryId, Constants.UTF_8));
|
||||
final String[] docIds = userInfoHelper.getResultDocIds(URLDecoder.decode(indexForm.queryId, Constants.UTF_8));
|
||||
if (docIds == null) {
|
||||
WebApiUtil.setError(6, "No searched urls.");
|
||||
return null;
|
||||
|
@ -848,16 +791,12 @@ public class IndexAction {
|
|||
return null;
|
||||
}
|
||||
|
||||
final DocumentHelper documentHelper = ComponentUtil
|
||||
.getDocumentHelper();
|
||||
final DocumentHelper documentHelper = ComponentUtil.getDocumentHelper();
|
||||
final Object count = doc.get(fieldHelper.favoriteCountField);
|
||||
if (count instanceof Long) {
|
||||
documentHelper.update(indexForm.docId,
|
||||
fieldHelper.favoriteCountField,
|
||||
((Long) count).longValue() + 1);
|
||||
documentHelper.update(indexForm.docId, fieldHelper.favoriteCountField, ((Long) count).longValue() + 1);
|
||||
} else {
|
||||
WebApiUtil
|
||||
.setError(7, "Failed to update count: " + favoriteUrl);
|
||||
WebApiUtil.setError(7, "Failed to update count: " + favoriteUrl);
|
||||
return null;
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
|
@ -869,8 +808,7 @@ public class IndexAction {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String favoritesApi() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE))) {
|
||||
WebApiUtil.setError(9, "Unsupported operation.");
|
||||
return null;
|
||||
}
|
||||
|
@ -886,13 +824,10 @@ public class IndexAction {
|
|||
return null;
|
||||
}
|
||||
|
||||
final String[] docIds = userInfoHelper
|
||||
.getResultDocIds(indexForm.queryId);
|
||||
final List<Map<String, Object>> docList = searchService
|
||||
.getDocumentListByDocIds(docIds,
|
||||
queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.favoriteCountField },
|
||||
getMaxPageSize());
|
||||
final String[] docIds = userInfoHelper.getResultDocIds(indexForm.queryId);
|
||||
final List<Map<String, Object>> docList =
|
||||
searchService.getDocumentListByDocIds(docIds, queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.favoriteCountField }, getMaxPageSize());
|
||||
List<String> urlList = new ArrayList<String>(docList.size());
|
||||
for (final Map<String, Object> doc : docList) {
|
||||
final Object urlObj = doc.get(fieldHelper.urlField);
|
||||
|
@ -947,16 +882,13 @@ public class IndexAction {
|
|||
if (indexForm.additional != null) {
|
||||
final Set<String> fieldSet = new HashSet<String>();
|
||||
for (final String additional : indexForm.additional) {
|
||||
if (StringUtil.isNotBlank(additional)
|
||||
&& additional.length() < 1000
|
||||
&& !hasFieldInQuery(fieldSet, additional)) {
|
||||
if (StringUtil.isNotBlank(additional) && additional.length() < 1000 && !hasFieldInQuery(fieldSet, additional)) {
|
||||
queryBuf.append(' ').append(additional);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!indexForm.fields.isEmpty()) {
|
||||
for (final Map.Entry<String, String[]> entry : indexForm.fields
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, String[]> entry : indexForm.fields.entrySet()) {
|
||||
final List<String> valueList = new ArrayList<String>();
|
||||
final String[] values = entry.getValue();
|
||||
if (values != null) {
|
||||
|
@ -965,17 +897,14 @@ public class IndexAction {
|
|||
}
|
||||
}
|
||||
if (valueList.size() == 1) {
|
||||
queryBuf.append(' ').append(entry.getKey()).append(":\"")
|
||||
.append(valueList.get(0)).append('\"');
|
||||
queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(0)).append('\"');
|
||||
} else if (valueList.size() > 1) {
|
||||
queryBuf.append(" (");
|
||||
for (int i = 0; i < valueList.size(); i++) {
|
||||
if (i != 0) {
|
||||
queryBuf.append(" OR");
|
||||
}
|
||||
queryBuf.append(' ').append(entry.getKey())
|
||||
.append(":\"").append(valueList.get(i))
|
||||
.append('\"');
|
||||
queryBuf.append(' ').append(entry.getKey()).append(":\"").append(valueList.get(i)).append('\"');
|
||||
}
|
||||
queryBuf.append(')');
|
||||
}
|
||||
|
@ -992,8 +921,7 @@ public class IndexAction {
|
|||
if (Constants.ALL_LANGUAGES.equalsIgnoreCase(lang)) {
|
||||
langSet.add(Constants.ALL_LANGUAGES);
|
||||
} else {
|
||||
final String normalizeLang = systemHelper
|
||||
.normalizeLang(lang);
|
||||
final String normalizeLang = systemHelper.normalizeLang(lang);
|
||||
if (normalizeLang != null) {
|
||||
langSet.add(normalizeLang);
|
||||
}
|
||||
|
@ -1007,16 +935,13 @@ public class IndexAction {
|
|||
langSet.remove(Constants.ALL_LANGUAGES);
|
||||
}
|
||||
appendLangQuery(queryBuf, langSet);
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY,
|
||||
Constants.FALSE))) {
|
||||
} else if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USE_BROWSER_LOCALE_FOR_SEARCH_PROPERTY, Constants.FALSE))) {
|
||||
final Set<String> langSet = new HashSet<>();
|
||||
final Enumeration<Locale> locales = request.getLocales();
|
||||
if (locales != null) {
|
||||
while (locales.hasMoreElements()) {
|
||||
final Locale locale = locales.nextElement();
|
||||
final String normalizeLang = systemHelper
|
||||
.normalizeLang(locale.toString());
|
||||
final String normalizeLang = systemHelper.normalizeLang(locale.toString());
|
||||
if (normalizeLang != null) {
|
||||
langSet.add(normalizeLang);
|
||||
}
|
||||
|
@ -1047,16 +972,14 @@ public class IndexAction {
|
|||
final int pageStart = Integer.parseInt(indexForm.start);
|
||||
final int pageNum = Integer.parseInt(indexForm.num);
|
||||
try {
|
||||
documentItems = searchService.getDocumentList(query, pageStart,
|
||||
pageNum, indexForm.facet, indexForm.geo, indexForm.mlt,
|
||||
queryHelper.getResponseFields(),
|
||||
queryHelper.getResponseDocValuesFields());
|
||||
documentItems =
|
||||
searchService.getDocumentList(query, pageStart, pageNum, indexForm.facet, indexForm.geo, indexForm.mlt,
|
||||
queryHelper.getResponseFields(), queryHelper.getResponseDocValuesFields());
|
||||
} catch (final SolrLibQueryException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.invalid_query_unknown");
|
||||
throw new SSCActionMessagesException(e, "errors.invalid_query_unknown");
|
||||
} catch (final InvalidQueryException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
|
@ -1066,20 +989,17 @@ public class IndexAction {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.result_size_exceeded");
|
||||
throw new SSCActionMessagesException(e, "errors.result_size_exceeded");
|
||||
}
|
||||
// search
|
||||
final QueryResponseList queryResponseList = (QueryResponseList) documentItems;
|
||||
facetResponse = queryResponseList.getFacetResponse();
|
||||
moreLikeThisResponse = queryResponseList.getMoreLikeThisResponse();
|
||||
final NumberFormat nf = NumberFormat.getInstance(RequestUtil
|
||||
.getRequest().getLocale());
|
||||
final NumberFormat nf = NumberFormat.getInstance(RequestUtil.getRequest().getLocale());
|
||||
nf.setMaximumIntegerDigits(2);
|
||||
nf.setMaximumFractionDigits(2);
|
||||
try {
|
||||
execTime = nf
|
||||
.format((double) queryResponseList.getExecTime() / 1000);
|
||||
execTime = nf.format((double) queryResponseList.getExecTime() / 1000);
|
||||
} catch (final Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
@ -1089,11 +1009,9 @@ public class IndexAction {
|
|||
|
||||
// favorite
|
||||
if (favoriteSupport || screenShotManager != null) {
|
||||
indexForm.queryId = userInfoHelper.generateQueryId(query,
|
||||
documentItems);
|
||||
indexForm.queryId = userInfoHelper.generateQueryId(query, documentItems);
|
||||
if (screenShotManager != null) {
|
||||
screenShotManager
|
||||
.storeRequest(indexForm.queryId, documentItems);
|
||||
screenShotManager.storeRequest(indexForm.queryId, documentItems);
|
||||
screenShotSupport = true;
|
||||
}
|
||||
}
|
||||
|
@ -1102,13 +1020,11 @@ public class IndexAction {
|
|||
if (searchLogSupport) {
|
||||
final LocalDateTime now = systemHelper.getCurrentTime();
|
||||
|
||||
final SearchLogHelper searchLogHelper = ComponentUtil
|
||||
.getSearchLogHelper();
|
||||
final SearchLogHelper searchLogHelper = ComponentUtil.getSearchLogHelper();
|
||||
final SearchLog searchLog = new SearchLog();
|
||||
|
||||
String userCode = null;
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(
|
||||
Constants.USER_INFO_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.TRUE.equals(crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE))) {
|
||||
userCode = userInfoHelper.getUserCode();
|
||||
if (StringUtil.isNotBlank(userCode)) {
|
||||
final UserInfo userInfo = new UserInfo();
|
||||
|
@ -1120,58 +1036,48 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
searchLog.setHitCount(queryResponseList.getAllRecordCount());
|
||||
searchLog.setResponseTime(Integer.valueOf((int) queryResponseList
|
||||
.getExecTime()));
|
||||
searchLog.setResponseTime(Integer.valueOf((int) queryResponseList.getExecTime()));
|
||||
searchLog.setSearchWord(StringUtils.abbreviate(query, 1000));
|
||||
searchLog.setSearchQuery(StringUtils.abbreviate(
|
||||
queryResponseList.getSearchQuery(), 1000));
|
||||
searchLog.setSolrQuery(StringUtils.abbreviate(
|
||||
queryResponseList.getSolrQuery(), 1000));
|
||||
searchLog.setSearchQuery(StringUtils.abbreviate(queryResponseList.getSearchQuery(), 1000));
|
||||
searchLog.setSolrQuery(StringUtils.abbreviate(queryResponseList.getSolrQuery(), 1000));
|
||||
searchLog.setRequestedTime(now);
|
||||
searchLog.setQueryOffset(pageStart);
|
||||
searchLog.setQueryPageSize(pageNum);
|
||||
|
||||
searchLog.setClientIp(StringUtils.abbreviate(
|
||||
request.getRemoteAddr(), 50));
|
||||
searchLog.setReferer(StringUtils.abbreviate(
|
||||
request.getHeader("referer"), 1000));
|
||||
searchLog.setUserAgent(StringUtils.abbreviate(
|
||||
request.getHeader("user-agent"), 255));
|
||||
searchLog.setClientIp(StringUtils.abbreviate(request.getRemoteAddr(), 50));
|
||||
searchLog.setReferer(StringUtils.abbreviate(request.getHeader("referer"), 1000));
|
||||
searchLog.setUserAgent(StringUtils.abbreviate(request.getHeader("user-agent"), 255));
|
||||
if (userCode != null) {
|
||||
searchLog.setUserSessionId(userCode);
|
||||
}
|
||||
final Object accessType = request
|
||||
.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE);
|
||||
final Object accessType = request.getAttribute(Constants.SEARCH_LOG_ACCESS_TYPE);
|
||||
if (accessType instanceof CDef.AccessType) {
|
||||
switch ((CDef.AccessType) accessType) {
|
||||
case Json:
|
||||
searchLog.setAccessType_Json();
|
||||
searchLog.setAccessType_Others();
|
||||
searchLog.setAccessType_Xml();
|
||||
break;
|
||||
case Xml:
|
||||
searchLog.setAccessType_Xml();
|
||||
break;
|
||||
case Others:
|
||||
searchLog.setAccessType_Others();
|
||||
break;
|
||||
default:
|
||||
searchLog.setAccessType_Web();
|
||||
break;
|
||||
case Json:
|
||||
searchLog.setAccessType_Json();
|
||||
searchLog.setAccessType_Others();
|
||||
searchLog.setAccessType_Xml();
|
||||
break;
|
||||
case Xml:
|
||||
searchLog.setAccessType_Xml();
|
||||
break;
|
||||
case Others:
|
||||
searchLog.setAccessType_Others();
|
||||
break;
|
||||
default:
|
||||
searchLog.setAccessType_Web();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
searchLog.setAccessType_Web();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, List<String>> fieldLogMap = (Map<String, List<String>>) request
|
||||
.getAttribute(Constants.FIELD_LOGS);
|
||||
final Map<String, List<String>> fieldLogMap = (Map<String, List<String>>) request.getAttribute(Constants.FIELD_LOGS);
|
||||
if (fieldLogMap != null) {
|
||||
for (final Map.Entry<String, List<String>> logEntry : fieldLogMap
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, List<String>> logEntry : fieldLogMap.entrySet()) {
|
||||
for (final String value : logEntry.getValue()) {
|
||||
searchLog.addSearchFieldLogValue(logEntry.getKey(),
|
||||
StringUtils.abbreviate(value, 1000));
|
||||
searchLog.addSearchFieldLogValue(logEntry.getKey(), StringUtils.abbreviate(value, 1000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1179,8 +1085,7 @@ public class IndexAction {
|
|||
searchLogHelper.addSearchLog(searchLog);
|
||||
}
|
||||
|
||||
final String[] highlightQueries = (String[]) request
|
||||
.getAttribute(Constants.HIGHLIGHT_QUERIES);
|
||||
final String[] highlightQueries = (String[]) request.getAttribute(Constants.HIGHLIGHT_QUERIES);
|
||||
if (highlightQueries != null) {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
for (final String q : highlightQueries) {
|
||||
|
@ -1190,20 +1095,16 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
Beans.copy(documentItems, this)
|
||||
.includes("pageSize", "currentPageNumber", "allRecordCount",
|
||||
"allPageCount", "existNextPage", "existPrevPage",
|
||||
"currentStartRecordNumber", "currentEndRecordNumber",
|
||||
"pageNumberList", "partialResults", "queryTime",
|
||||
"searchTime").execute();
|
||||
.includes("pageSize", "currentPageNumber", "allRecordCount", "allPageCount", "existNextPage", "existPrevPage",
|
||||
"currentStartRecordNumber", "currentEndRecordNumber", "pageNumberList", "partialResults", "queryTime", "searchTime")
|
||||
.execute();
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
private void appendLangQuery(final StringBuilder queryBuf,
|
||||
final Set<String> langSet) {
|
||||
private void appendLangQuery(final StringBuilder queryBuf, final Set<String> langSet) {
|
||||
if (langSet.size() == 1) {
|
||||
queryBuf.append(' ').append(fieldHelper.langField).append(':')
|
||||
.append(langSet.iterator().next());
|
||||
queryBuf.append(' ').append(fieldHelper.langField).append(':').append(langSet.iterator().next());
|
||||
} else if (langSet.size() > 1) {
|
||||
boolean first = true;
|
||||
for (final String lang : langSet) {
|
||||
|
@ -1282,8 +1183,7 @@ public class IndexAction {
|
|||
public String getDisplayQuery() {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
buf.append(indexForm.query);
|
||||
if (!indexForm.fields.isEmpty()
|
||||
&& indexForm.fields.containsKey(LABEL_FIELD)) {
|
||||
if (!indexForm.fields.isEmpty() && indexForm.fields.containsKey(LABEL_FIELD)) {
|
||||
final String[] values = indexForm.fields.get(LABEL_FIELD);
|
||||
final List<String> labelList = new ArrayList<String>();
|
||||
if (values != null) {
|
||||
|
@ -1308,23 +1208,19 @@ public class IndexAction {
|
|||
// label
|
||||
labelTypeItems = labelTypeHelper.getLabelTypeItemList();
|
||||
|
||||
if (!labelTypeItems.isEmpty()
|
||||
&& !indexForm.fields.containsKey(LABEL_FIELD)) {
|
||||
final String defaultLabelValue = crawlerProperties.getProperty(
|
||||
Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
if (!labelTypeItems.isEmpty() && !indexForm.fields.containsKey(LABEL_FIELD)) {
|
||||
final String defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
if (StringUtil.isNotBlank(defaultLabelValue)) {
|
||||
final String[] values = defaultLabelValue.split("\n");
|
||||
if (values != null && values.length > 0) {
|
||||
final List<String> list = new ArrayList<String>(
|
||||
values.length);
|
||||
final List<String> list = new ArrayList<String>(values.length);
|
||||
for (final String value : values) {
|
||||
if (StringUtil.isNotBlank(value)) {
|
||||
list.add(value);
|
||||
}
|
||||
}
|
||||
if (!list.isEmpty()) {
|
||||
indexForm.fields.put(LABEL_FIELD,
|
||||
list.toArray(new String[list.size()]));
|
||||
indexForm.fields.put(LABEL_FIELD, list.toArray(new String[list.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1333,8 +1229,7 @@ public class IndexAction {
|
|||
final Map<String, String> labelMap = new LinkedHashMap<String, String>();
|
||||
if (!labelTypeItems.isEmpty()) {
|
||||
for (final Map<String, String> map : labelTypeItems) {
|
||||
labelMap.put(map.get(Constants.ITEM_VALUE),
|
||||
map.get(Constants.ITEM_LABEL));
|
||||
labelMap.put(map.get(Constants.ITEM_VALUE), map.get(Constants.ITEM_LABEL));
|
||||
}
|
||||
}
|
||||
request.setAttribute(Constants.LABEL_VALUE_MAP, labelMap);
|
||||
|
@ -1342,8 +1237,7 @@ public class IndexAction {
|
|||
if (viewHelper.isUseSession()) {
|
||||
final HttpSession session = request.getSession(false);
|
||||
if (session != null) {
|
||||
final Object resultsPerPage = session
|
||||
.getAttribute(Constants.RESULTS_PER_PAGE);
|
||||
final Object resultsPerPage = session.getAttribute(Constants.RESULTS_PER_PAGE);
|
||||
if (resultsPerPage != null) {
|
||||
indexForm.num = resultsPerPage.toString();
|
||||
}
|
||||
|
@ -1368,16 +1262,12 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
protected void buildInitParams() {
|
||||
buildInitParamMap(viewHelper.getInitFacetParamMap(),
|
||||
Constants.FACET_QUERY, Constants.FACET_FORM);
|
||||
buildInitParamMap(viewHelper.getInitMltParamMap(), Constants.MLT_QUERY,
|
||||
Constants.MLT_FORM);
|
||||
buildInitParamMap(viewHelper.getInitGeoParamMap(), Constants.GEO_QUERY,
|
||||
Constants.GEO_FORM);
|
||||
buildInitParamMap(viewHelper.getInitFacetParamMap(), Constants.FACET_QUERY, Constants.FACET_FORM);
|
||||
buildInitParamMap(viewHelper.getInitMltParamMap(), Constants.MLT_QUERY, Constants.MLT_FORM);
|
||||
buildInitParamMap(viewHelper.getInitGeoParamMap(), Constants.GEO_QUERY, Constants.GEO_FORM);
|
||||
}
|
||||
|
||||
protected void buildInitParamMap(final Map<String, String> paramMap,
|
||||
final String queryKey, final String formKey) {
|
||||
protected void buildInitParamMap(final Map<String, String> paramMap, final String queryKey, final String formKey) {
|
||||
if (!paramMap.isEmpty()) {
|
||||
final StringBuilder queryBuf = new StringBuilder(100);
|
||||
final StringBuilder formBuf = new StringBuilder(100);
|
||||
|
@ -1416,8 +1306,7 @@ public class IndexAction {
|
|||
}
|
||||
|
||||
protected int getMaxPageSize() {
|
||||
Object maxPageSize = crawlerProperties
|
||||
.get(Constants.SEARCH_RESULT_MAX_PAGE_SIZE);
|
||||
Object maxPageSize = crawlerProperties.get(Constants.SEARCH_RESULT_MAX_PAGE_SIZE);
|
||||
if (maxPageSize == null) {
|
||||
return MAX_PAGE_SIZE;
|
||||
}
|
||||
|
@ -1436,8 +1325,7 @@ public class IndexAction {
|
|||
return viewHelper.getPagePath("common/help");
|
||||
}
|
||||
|
||||
protected boolean hasFieldInQuery(final Set<String> fieldSet,
|
||||
final String query) {
|
||||
protected boolean hasFieldInQuery(final Set<String> fieldSet, final String query) {
|
||||
final Matcher matcher = FIELD_EXTRACTION_PATTERN.matcher(query);
|
||||
if (matcher.matches()) {
|
||||
final String field = matcher.replaceFirst("$1");
|
||||
|
|
|
@ -48,8 +48,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LoginAction implements Serializable {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(LoginAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(LoginAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -78,34 +77,28 @@ public class LoginAction implements Serializable {
|
|||
|
||||
if ("logout".equals(loginForm.type)) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Invalidated session. The username is "
|
||||
+ request.getRemoteUser());
|
||||
logger.info("Invalidated session. The username is " + request.getRemoteUser());
|
||||
}
|
||||
session.invalidate();
|
||||
}
|
||||
|
||||
String returnPath;
|
||||
if (StringUtil.isNotBlank(loginForm.returnPath)) {
|
||||
final CachedCipher cipher = ComponentUtil
|
||||
.getCipher(Constants.AUTH_CIPHER);
|
||||
final CachedCipher cipher = ComponentUtil.getCipher(Constants.AUTH_CIPHER);
|
||||
if (cipher == null) {
|
||||
throw new FessSystemException(
|
||||
"A cipher for authentication is null. Please check a filter setting.");
|
||||
throw new FessSystemException("A cipher for authentication is null. Please check a filter setting.");
|
||||
}
|
||||
final String value = cipher.decryptoText(loginForm.returnPath);
|
||||
final int idx = value.indexOf('|');
|
||||
if (idx >= 0) {
|
||||
returnPath = value.substring(idx + 1);
|
||||
RequestUtil.getRequest().getSession()
|
||||
.setAttribute(Constants.RETURN_PATH, returnPath);
|
||||
RequestUtil.getRequest().getSession().setAttribute(Constants.RETURN_PATH, returnPath);
|
||||
} else {
|
||||
// invalid returnPath
|
||||
RequestUtil.getRequest().getSession()
|
||||
.removeAttribute(Constants.RETURN_PATH);
|
||||
RequestUtil.getRequest().getSession().removeAttribute(Constants.RETURN_PATH);
|
||||
}
|
||||
} else {
|
||||
RequestUtil.getRequest().getSession()
|
||||
.removeAttribute(Constants.RETURN_PATH);
|
||||
RequestUtil.getRequest().getSession().removeAttribute(Constants.RETURN_PATH);
|
||||
}
|
||||
|
||||
return "login?redirect=true";
|
||||
|
@ -137,8 +130,7 @@ public class LoginAction implements Serializable {
|
|||
session.setAttribute(SSCConstants.USER_INFO, loginInfo);
|
||||
|
||||
String returnPath;
|
||||
final Set<String> authenticatedRoleList = systemHelper
|
||||
.getAuthenticatedRoleSet();
|
||||
final Set<String> authenticatedRoleList = systemHelper.getAuthenticatedRoleSet();
|
||||
final Set<String> roleSet = new HashSet<>();
|
||||
for (final String role : authenticatedRoleList) {
|
||||
if (request.isUserInRole(role)) {
|
||||
|
@ -162,8 +154,7 @@ public class LoginAction implements Serializable {
|
|||
ActivityUtil.login(request.getRemoteUser(), request);
|
||||
} else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Login Failure: " + request.getRemoteUser()
|
||||
+ " does not have authenticated roles.");
|
||||
logger.warn("Login Failure: " + request.getRemoteUser() + " does not have authenticated roles.");
|
||||
}
|
||||
// logout
|
||||
session.invalidate();
|
||||
|
@ -181,8 +172,7 @@ public class LoginAction implements Serializable {
|
|||
try {
|
||||
response.sendRedirect(response.encodeURL(returnPath));
|
||||
} catch (final IOException e) {
|
||||
throw new FessSystemException(
|
||||
"Failed to redirect to " + returnPath, e);
|
||||
throw new FessSystemException("Failed to redirect to " + returnPath, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BoostDocumentRuleAction.class);
|
||||
private static final Log log = LogFactory.getLog(BoostDocumentRuleAction.class);
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
@ -50,18 +49,13 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
@Override
|
||||
protected void loadBoostDocumentRule() {
|
||||
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { boostDocumentRuleForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(boostDocumentRule, boostDocumentRuleForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(boostDocumentRule, boostDocumentRuleForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,13 +64,10 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (boostDocumentRuleForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { boostDocumentRuleForm.id });
|
||||
}
|
||||
} else {
|
||||
boostDocumentRule = new BoostDocumentRule();
|
||||
|
@ -85,8 +76,7 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
}
|
||||
boostDocumentRule.setUpdatedBy(username);
|
||||
boostDocumentRule.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(boostDocumentRuleForm, boostDocumentRule)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(boostDocumentRuleForm, boostDocumentRule).excludesCommonColumns().execute();
|
||||
|
||||
return boostDocumentRule;
|
||||
}
|
||||
|
@ -95,19 +85,15 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (boostDocumentRuleForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { boostDocumentRuleForm.id });
|
||||
}
|
||||
|
||||
// boostDocumentRuleService.delete(boostDocumentRule);
|
||||
|
@ -124,12 +110,10 @@ public class BoostDocumentRuleAction extends BsBoostDocumentRuleAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CrawlAction implements Serializable {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(CrawlAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(CrawlAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -60,61 +59,33 @@ public class CrawlAction implements Serializable {
|
|||
}
|
||||
|
||||
protected String showIndex(final boolean redirect) {
|
||||
crawlForm.diffCrawling = crawlerProperties.getProperty(
|
||||
Constants.DIFF_CRAWLING_PROPERTY, Constants.TRUE);
|
||||
crawlForm.useAclAsRole = crawlerProperties.getProperty(
|
||||
Constants.USE_ACL_AS_ROLE, Constants.FALSE);
|
||||
crawlForm.serverRotation = crawlerProperties.getProperty(
|
||||
Constants.SERVER_ROTATION_PROPERTY, Constants.FALSE);
|
||||
crawlForm.dayForCleanup = crawlerProperties.getProperty(
|
||||
Constants.DAY_FOR_CLEANUP_PROPERTY, "1");
|
||||
crawlForm.crawlingThreadCount = crawlerProperties.getProperty(
|
||||
Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5");
|
||||
crawlForm.searchLog = crawlerProperties.getProperty(
|
||||
Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userInfo = crawlerProperties.getProperty(
|
||||
Constants.USER_INFO_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userFavorite = crawlerProperties.getProperty(
|
||||
Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
|
||||
crawlForm.webApiXml = crawlerProperties.getProperty(
|
||||
Constants.WEB_API_XML_PROPERTY, Constants.TRUE);
|
||||
crawlForm.webApiJson = crawlerProperties.getProperty(
|
||||
Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
|
||||
crawlForm.defaultLabelValue = crawlerProperties.getProperty(
|
||||
Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.appendQueryParameter = crawlerProperties.getProperty(
|
||||
Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
|
||||
crawlForm.supportedSearch = crawlerProperties.getProperty(
|
||||
Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY,
|
||||
Constants.SUPPORTED_SEARCH_WEB);
|
||||
crawlForm.ignoreFailureType = crawlerProperties.getProperty(
|
||||
Constants.IGNORE_FAILURE_TYPE_PROPERTY,
|
||||
Constants.DEFAULT_IGNORE_FAILURE_TYPE);
|
||||
crawlForm.failureCountThreshold = crawlerProperties.getProperty(
|
||||
Constants.FAILURE_COUNT_THRESHOLD_PROPERTY,
|
||||
Constants.DEFAULT_FAILURE_COUNT);
|
||||
crawlForm.hotSearchWord = crawlerProperties.getProperty(
|
||||
Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE);
|
||||
crawlForm.csvFileEncoding = crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
crawlForm.purgeSearchLogDay = crawlerProperties.getProperty(
|
||||
Constants.PURGE_SEARCH_LOG_DAY_PROPERTY,
|
||||
Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeJobLogDay = crawlerProperties.getProperty(
|
||||
Constants.PURGE_JOB_LOG_DAY_PROPERTY,
|
||||
Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeUserInfoDay = crawlerProperties.getProperty(
|
||||
Constants.PURGE_USER_INFO_DAY_PROPERTY,
|
||||
Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeByBots = crawlerProperties.getProperty(
|
||||
Constants.PURGE_BY_BOTS_PROPERTY,
|
||||
Constants.DEFAULT_PURGE_BY_BOTS);
|
||||
crawlForm.notificationTo = crawlerProperties.getProperty(
|
||||
Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.suggestSearchLog = crawlerProperties.getProperty(
|
||||
Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.purgeSuggestSearchLogDay = crawlerProperties.getProperty(
|
||||
Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, "30");
|
||||
crawlForm.diffCrawling = crawlerProperties.getProperty(Constants.DIFF_CRAWLING_PROPERTY, Constants.TRUE);
|
||||
crawlForm.useAclAsRole = crawlerProperties.getProperty(Constants.USE_ACL_AS_ROLE, Constants.FALSE);
|
||||
crawlForm.serverRotation = crawlerProperties.getProperty(Constants.SERVER_ROTATION_PROPERTY, Constants.FALSE);
|
||||
crawlForm.dayForCleanup = crawlerProperties.getProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, "1");
|
||||
crawlForm.crawlingThreadCount = crawlerProperties.getProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, "5");
|
||||
crawlForm.searchLog = crawlerProperties.getProperty(Constants.SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userInfo = crawlerProperties.getProperty(Constants.USER_INFO_PROPERTY, Constants.TRUE);
|
||||
crawlForm.userFavorite = crawlerProperties.getProperty(Constants.USER_FAVORITE_PROPERTY, Constants.FALSE);
|
||||
crawlForm.webApiXml = crawlerProperties.getProperty(Constants.WEB_API_XML_PROPERTY, Constants.TRUE);
|
||||
crawlForm.webApiJson = crawlerProperties.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE);
|
||||
crawlForm.defaultLabelValue = crawlerProperties.getProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.appendQueryParameter = crawlerProperties.getProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY, Constants.FALSE);
|
||||
crawlForm.supportedSearch =
|
||||
crawlerProperties.getProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, Constants.SUPPORTED_SEARCH_WEB);
|
||||
crawlForm.ignoreFailureType =
|
||||
crawlerProperties.getProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, Constants.DEFAULT_IGNORE_FAILURE_TYPE);
|
||||
crawlForm.failureCountThreshold =
|
||||
crawlerProperties.getProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, Constants.DEFAULT_FAILURE_COUNT);
|
||||
crawlForm.hotSearchWord = crawlerProperties.getProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY, Constants.TRUE);
|
||||
crawlForm.csvFileEncoding = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
crawlForm.purgeSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeJobLogDay = crawlerProperties.getProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeUserInfoDay = crawlerProperties.getProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, Constants.DEFAULT_PURGE_DAY);
|
||||
crawlForm.purgeByBots = crawlerProperties.getProperty(Constants.PURGE_BY_BOTS_PROPERTY, Constants.DEFAULT_PURGE_BY_BOTS);
|
||||
crawlForm.notificationTo = crawlerProperties.getProperty(Constants.NOTIFICATION_TO_PROPERTY, StringUtil.EMPTY);
|
||||
crawlForm.suggestSearchLog = crawlerProperties.getProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY, Constants.TRUE);
|
||||
crawlForm.purgeSuggestSearchLogDay = crawlerProperties.getProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, "30");
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
|
@ -131,120 +102,52 @@ public class CrawlAction implements Serializable {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "index.jsp")
|
||||
public String update() {
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.DIFF_CRAWLING_PROPERTY,
|
||||
crawlForm.diffCrawling != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.diffCrawling) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.USE_ACL_AS_ROLE,
|
||||
crawlForm.useAclAsRole != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.useAclAsRole) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.SERVER_ROTATION_PROPERTY,
|
||||
crawlForm.serverRotation != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.serverRotation) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DAY_FOR_CLEANUP_PROPERTY,
|
||||
crawlForm.dayForCleanup);
|
||||
crawlerProperties.setProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY,
|
||||
crawlForm.crawlingThreadCount);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.SEARCH_LOG_PROPERTY,
|
||||
crawlForm.searchLog != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.searchLog) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.USER_INFO_PROPERTY,
|
||||
crawlForm.userInfo != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.userInfo) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.USER_FAVORITE_PROPERTY,
|
||||
crawlForm.userFavorite != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.userFavorite) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.WEB_API_XML_PROPERTY,
|
||||
crawlForm.webApiXml != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.webApiXml) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.WEB_API_JSON_PROPERTY,
|
||||
crawlForm.webApiJson != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.webApiJson) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY,
|
||||
crawlForm.defaultLabelValue);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.APPEND_QUERY_PARAMETER_PROPERTY,
|
||||
crawlForm.appendQueryParameter != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.appendQueryParameter) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(
|
||||
Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY,
|
||||
crawlForm.supportedSearch);
|
||||
crawlerProperties.setProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY,
|
||||
crawlForm.ignoreFailureType);
|
||||
crawlerProperties.setProperty(
|
||||
Constants.FAILURE_COUNT_THRESHOLD_PROPERTY,
|
||||
crawlForm.failureCountThreshold);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY,
|
||||
crawlForm.hotSearchWord != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.hotSearchWord) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.CSV_FILE_ENCODING_PROPERTY,
|
||||
crawlForm.csvFileEncoding);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY,
|
||||
crawlForm.purgeSearchLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY,
|
||||
crawlForm.purgeJobLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY,
|
||||
crawlForm.purgeUserInfoDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_BY_BOTS_PROPERTY,
|
||||
crawlForm.purgeByBots);
|
||||
crawlerProperties.setProperty(Constants.NOTIFICATION_TO_PROPERTY,
|
||||
crawlForm.notificationTo);
|
||||
crawlerProperties
|
||||
.setProperty(
|
||||
Constants.SUGGEST_SEARCH_LOG_PROPERTY,
|
||||
crawlForm.suggestSearchLog != null
|
||||
&& Constants.ON
|
||||
.equalsIgnoreCase(crawlForm.suggestSearchLog) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(
|
||||
Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY,
|
||||
crawlForm.purgeSuggestSearchLogDay);
|
||||
crawlerProperties.setProperty(Constants.DIFF_CRAWLING_PROPERTY,
|
||||
crawlForm.diffCrawling != null && Constants.ON.equalsIgnoreCase(crawlForm.diffCrawling) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USE_ACL_AS_ROLE,
|
||||
crawlForm.useAclAsRole != null && Constants.ON.equalsIgnoreCase(crawlForm.useAclAsRole) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.SERVER_ROTATION_PROPERTY,
|
||||
crawlForm.serverRotation != null && Constants.ON.equalsIgnoreCase(crawlForm.serverRotation) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DAY_FOR_CLEANUP_PROPERTY, crawlForm.dayForCleanup);
|
||||
crawlerProperties.setProperty(Constants.CRAWLING_THREAD_COUNT_PROPERTY, crawlForm.crawlingThreadCount);
|
||||
crawlerProperties.setProperty(Constants.SEARCH_LOG_PROPERTY,
|
||||
crawlForm.searchLog != null && Constants.ON.equalsIgnoreCase(crawlForm.searchLog) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_INFO_PROPERTY,
|
||||
crawlForm.userInfo != null && Constants.ON.equalsIgnoreCase(crawlForm.userInfo) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.USER_FAVORITE_PROPERTY,
|
||||
crawlForm.userFavorite != null && Constants.ON.equalsIgnoreCase(crawlForm.userFavorite) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_XML_PROPERTY,
|
||||
crawlForm.webApiXml != null && Constants.ON.equalsIgnoreCase(crawlForm.webApiXml) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_JSON_PROPERTY,
|
||||
crawlForm.webApiJson != null && Constants.ON.equalsIgnoreCase(crawlForm.webApiJson) ? Constants.TRUE : Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.DEFAULT_LABEL_VALUE_PROPERTY, crawlForm.defaultLabelValue);
|
||||
crawlerProperties.setProperty(Constants.APPEND_QUERY_PARAMETER_PROPERTY,
|
||||
crawlForm.appendQueryParameter != null && Constants.ON.equalsIgnoreCase(crawlForm.appendQueryParameter) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.SUPPORTED_SEARCH_FEATURE_PROPERTY, crawlForm.supportedSearch);
|
||||
crawlerProperties.setProperty(Constants.IGNORE_FAILURE_TYPE_PROPERTY, crawlForm.ignoreFailureType);
|
||||
crawlerProperties.setProperty(Constants.FAILURE_COUNT_THRESHOLD_PROPERTY, crawlForm.failureCountThreshold);
|
||||
crawlerProperties.setProperty(Constants.WEB_API_HOT_SEARCH_WORD_PROPERTY,
|
||||
crawlForm.hotSearchWord != null && Constants.ON.equalsIgnoreCase(crawlForm.hotSearchWord) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.CSV_FILE_ENCODING_PROPERTY, crawlForm.csvFileEncoding);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SEARCH_LOG_DAY_PROPERTY, crawlForm.purgeSearchLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_JOB_LOG_DAY_PROPERTY, crawlForm.purgeJobLogDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_USER_INFO_DAY_PROPERTY, crawlForm.purgeUserInfoDay);
|
||||
crawlerProperties.setProperty(Constants.PURGE_BY_BOTS_PROPERTY, crawlForm.purgeByBots);
|
||||
crawlerProperties.setProperty(Constants.NOTIFICATION_TO_PROPERTY, crawlForm.notificationTo);
|
||||
crawlerProperties.setProperty(Constants.SUGGEST_SEARCH_LOG_PROPERTY,
|
||||
crawlForm.suggestSearchLog != null && Constants.ON.equalsIgnoreCase(crawlForm.suggestSearchLog) ? Constants.TRUE
|
||||
: Constants.FALSE);
|
||||
crawlerProperties.setProperty(Constants.PURGE_SUGGEST_SEARCH_LOG_DAY_PROPERTY, crawlForm.purgeSuggestSearchLogDay);
|
||||
try {
|
||||
crawlerProperties.store();
|
||||
SAStrutsUtil.addSessionMessage("success.update_crawler_params");
|
||||
return showIndex(true);
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update crawler parameters.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_update_crawler_params", e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_update_crawler_params", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,17 +165,14 @@ public class CrawlAction implements Serializable {
|
|||
|
||||
public List<Map<String, String>> getSupportedSearchItems() {
|
||||
final List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "labels.supported_search_web"),
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.supported_search_web"),
|
||||
Constants.SUPPORTED_SEARCH_WEB));
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(), "labels.supported_search_none"),
|
||||
list.add(createItem(MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.supported_search_none"),
|
||||
Constants.SUPPORTED_SEARCH_NONE));
|
||||
return list;
|
||||
}
|
||||
|
||||
private Map<String, String> createItem(final String label,
|
||||
final String value) {
|
||||
private Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
map.put(Constants.ITEM_LABEL, label);
|
||||
map.put(Constants.ITEM_VALUE, value);
|
||||
|
|
|
@ -44,16 +44,14 @@ public class CrawlingSessionAction extends BsCrawlingSessionAction {
|
|||
|
||||
public List<CrawlingSessionInfo> getCrawlingSessionInfoItems() {
|
||||
if (crawlingSessionForm.id != null) {
|
||||
return crawlingSessionService.getCrawlingSessionInfoList(Long
|
||||
.parseLong(crawlingSessionForm.id));
|
||||
return crawlingSessionService.getCrawlingSessionInfoList(Long.parseLong(crawlingSessionForm.id));
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deleteall() {
|
||||
crawlingSessionService.deleteOldSessions(jobHelper
|
||||
.getRunningSessionIdSet());
|
||||
crawlingSessionService.deleteOldSessions(jobHelper.getRunningSessionIdSet());
|
||||
SAStrutsUtil.addSessionMessage("success.crawling_session_delete_all");
|
||||
return displayList(true);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ public class DataAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(DataAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataAction.class);
|
||||
|
||||
@Resource
|
||||
@ActionForm
|
||||
|
@ -98,8 +97,7 @@ public class DataAction implements Serializable {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String download() {
|
||||
final DateFormat df = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final DateFormat df = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append("backup-");
|
||||
buf.append(df.format(new Date()));
|
||||
|
@ -107,8 +105,7 @@ public class DataAction implements Serializable {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ buf.toString() + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + buf.toString() + "\"");
|
||||
|
||||
try {
|
||||
final ServletOutputStream sos = response.getOutputStream();
|
||||
|
@ -121,15 +118,13 @@ public class DataAction implements Serializable {
|
|||
return null;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false)
|
||||
public String downloadCrawlingSession() {
|
||||
final DateFormat df = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final DateFormat df = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append("backup-cs-");
|
||||
buf.append(df.format(new Date()));
|
||||
|
@ -137,22 +132,19 @@ public class DataAction implements Serializable {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ buf.toString() + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + buf.toString() + "\"");
|
||||
|
||||
Writer writer = null;
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY,
|
||||
Constants.UTF_8)));
|
||||
writer =
|
||||
new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8)));
|
||||
crawlingSessionService.exportCsv(writer);
|
||||
writer.flush();
|
||||
return null;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
|
@ -160,8 +152,7 @@ public class DataAction implements Serializable {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String downloadSearchLog() {
|
||||
final DateFormat df = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final DateFormat df = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append("backup-sl-");
|
||||
buf.append(df.format(new Date()));
|
||||
|
@ -169,22 +160,19 @@ public class DataAction implements Serializable {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ buf.toString() + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + buf.toString() + "\"");
|
||||
|
||||
Writer writer = null;
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY,
|
||||
Constants.UTF_8)));
|
||||
writer =
|
||||
new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8)));
|
||||
searchLogService.exportCsv(writer);
|
||||
writer.flush();
|
||||
return null;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
|
@ -192,8 +180,7 @@ public class DataAction implements Serializable {
|
|||
|
||||
@Execute(validator = false)
|
||||
public String downloadClickLog() {
|
||||
final DateFormat df = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final DateFormat df = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_DIGIT_ONLY);
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append("backup-cl-");
|
||||
buf.append(df.format(new Date()));
|
||||
|
@ -201,22 +188,19 @@ public class DataAction implements Serializable {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ buf.toString() + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + buf.toString() + "\"");
|
||||
|
||||
Writer writer = null;
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY,
|
||||
Constants.UTF_8)));
|
||||
writer =
|
||||
new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8)));
|
||||
clickLogService.exportCsv(writer);
|
||||
writer.flush();
|
||||
return null;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
|
@ -227,16 +211,13 @@ public class DataAction implements Serializable {
|
|||
final String fileName = dataForm.uploadedFile.getFileName();
|
||||
if (fileName.endsWith(".xml")) {
|
||||
try {
|
||||
databaseService.importData(
|
||||
dataForm.uploadedFile.getInputStream(),
|
||||
dataForm.overwrite != null
|
||||
&& "on".equalsIgnoreCase(dataForm.overwrite));
|
||||
databaseService.importData(dataForm.uploadedFile.getInputStream(),
|
||||
dataForm.overwrite != null && "on".equalsIgnoreCase(dataForm.overwrite));
|
||||
SAStrutsUtil.addSessionMessage("success.importing_data");
|
||||
return "index?redirect=true";
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
}
|
||||
} else if (fileName.endsWith(".csv")) {
|
||||
BufferedInputStream is = null;
|
||||
|
@ -245,8 +226,7 @@ public class DataAction implements Serializable {
|
|||
final byte[] b = new byte[20];
|
||||
try {
|
||||
tempFile = File.createTempFile("fess-import-", ".csv");
|
||||
is = new BufferedInputStream(
|
||||
dataForm.uploadedFile.getInputStream());
|
||||
is = new BufferedInputStream(dataForm.uploadedFile.getInputStream());
|
||||
is.mark(20);
|
||||
if (is.read(b, 0, 20) <= 0) {
|
||||
throw new FessSystemException("no import data.");
|
||||
|
@ -256,12 +236,10 @@ public class DataAction implements Serializable {
|
|||
StreamUtil.drain(is, fos);
|
||||
} catch (final Exception e) {
|
||||
if (tempFile != null && !tempFile.delete()) {
|
||||
logger.warn("Could not delete "
|
||||
+ tempFile.getAbsolutePath());
|
||||
logger.warn("Could not delete " + tempFile.getAbsolutePath());
|
||||
}
|
||||
logger.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
IOUtils.closeQuietly(fos);
|
||||
|
@ -270,22 +248,17 @@ public class DataAction implements Serializable {
|
|||
final File oFile = tempFile;
|
||||
try {
|
||||
final String head = new String(b, Constants.UTF_8);
|
||||
if (!head.startsWith("SessionId,")
|
||||
&& !head.startsWith("SearchWord,")
|
||||
&& !head.startsWith("SearchId,")) {
|
||||
if (!head.startsWith("SessionId,") && !head.startsWith("SearchWord,") && !head.startsWith("SearchId,")) {
|
||||
logger.error("Unknown file: " + dataForm.uploadedFile);
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.unknown_import_file");
|
||||
throw new SSCActionMessagesException("errors.unknown_import_file");
|
||||
}
|
||||
final String enc = crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
final String enc = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(oFile), enc));
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(oFile), enc));
|
||||
if (head.startsWith("SessionId,")) {
|
||||
// Crawling Session
|
||||
crawlingSessionService.importCsv(reader);
|
||||
|
@ -298,12 +271,10 @@ public class DataAction implements Serializable {
|
|||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to import data.", e);
|
||||
throw new FessSystemException(
|
||||
"Failed to import data.", e);
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
} finally {
|
||||
if (!oFile.delete()) {
|
||||
logger.warn("Could not delete "
|
||||
+ oFile.getAbsolutePath());
|
||||
logger.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
IOUtils.closeQuietly(reader);
|
||||
}
|
||||
|
@ -319,8 +290,7 @@ public class DataAction implements Serializable {
|
|||
logger.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
logger.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(DataCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(DataCrawlingConfigAction.class);
|
||||
|
||||
@Resource
|
||||
protected RoleTypeService roleTypeService;
|
||||
|
@ -73,24 +72,17 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
@Override
|
||||
protected void loadDataCrawlingConfig() {
|
||||
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(dataCrawlingConfig, dataCrawlingConfigForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(dataCrawlingConfig, dataCrawlingConfigForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
|
||||
// normalize boost
|
||||
if (dataCrawlingConfigForm.boost != null
|
||||
&& dataCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
dataCrawlingConfigForm.boost = dataCrawlingConfigForm.boost
|
||||
.substring(0, dataCrawlingConfigForm.boost.indexOf('.'));
|
||||
if (dataCrawlingConfigForm.boost != null && dataCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
dataCrawlingConfigForm.boost = dataCrawlingConfigForm.boost.substring(0, dataCrawlingConfigForm.boost.indexOf('.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,13 +92,10 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (dataCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataCrawlingConfigForm.id });
|
||||
}
|
||||
} else {
|
||||
dataCrawlingConfig = new DataCrawlingConfig();
|
||||
|
@ -115,8 +104,7 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
}
|
||||
dataCrawlingConfig.setUpdatedBy(username);
|
||||
dataCrawlingConfig.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(dataCrawlingConfigForm, dataCrawlingConfig)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(dataCrawlingConfigForm, dataCrawlingConfig).excludesCommonColumns().execute();
|
||||
|
||||
return dataCrawlingConfig;
|
||||
}
|
||||
|
@ -125,23 +113,18 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (dataCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { dataCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
failureUrlService
|
||||
.deleteByConfigId(dataCrawlingConfig.getConfigId());
|
||||
failureUrlService.deleteByConfigId(dataCrawlingConfig.getConfigId());
|
||||
|
||||
//dataCrawlingConfigService.delete(dataCrawlingConfig);
|
||||
final String username = systemHelper.getUsername();
|
||||
|
@ -157,12 +140,10 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,8 +156,7 @@ public class DataCrawlingConfigAction extends BsDataCrawlingConfigAction {
|
|||
}
|
||||
|
||||
public List<Map<String, String>> getHandlerNameItems() {
|
||||
final List<String> dataStoreNameList = dataStoreFactory
|
||||
.getDataStoreNameList();
|
||||
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>();
|
||||
|
|
|
@ -49,8 +49,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class DesignAction implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(DesignAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DesignAction.class);
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
|
@ -116,54 +115,41 @@ public class DesignAction implements Serializable {
|
|||
fileName = fileName.substring(pos + 1);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.design_file_name_is_invalid");
|
||||
throw new SSCActionMessagesException(e, "errors.design_file_name_is_invalid");
|
||||
}
|
||||
}
|
||||
if (StringUtil.isBlank(fileName)) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.design_file_name_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.design_file_name_is_not_found");
|
||||
}
|
||||
|
||||
String baseDir = null;
|
||||
// normalize filename
|
||||
if (checkFileType(fileName,
|
||||
systemHelper.getSupportedUploadedMediaExtentions())
|
||||
&& checkFileType(uploadedFileName,
|
||||
systemHelper.getSupportedUploadedMediaExtentions())) {
|
||||
if (checkFileType(fileName, systemHelper.getSupportedUploadedMediaExtentions())
|
||||
&& checkFileType(uploadedFileName, systemHelper.getSupportedUploadedMediaExtentions())) {
|
||||
baseDir = "/images/";
|
||||
} else if (checkFileType(fileName,
|
||||
systemHelper.getSupportedUploadedCssExtentions())
|
||||
&& checkFileType(uploadedFileName,
|
||||
systemHelper.getSupportedUploadedCssExtentions())) {
|
||||
} else if (checkFileType(fileName, systemHelper.getSupportedUploadedCssExtentions())
|
||||
&& checkFileType(uploadedFileName, systemHelper.getSupportedUploadedCssExtentions())) {
|
||||
baseDir = "/css/";
|
||||
} else if (checkFileType(fileName,
|
||||
systemHelper.getSupportedUploadedJSExtentions())
|
||||
&& checkFileType(uploadedFileName,
|
||||
systemHelper.getSupportedUploadedJSExtentions())) {
|
||||
} else if (checkFileType(fileName, systemHelper.getSupportedUploadedJSExtentions())
|
||||
&& checkFileType(uploadedFileName, systemHelper.getSupportedUploadedJSExtentions())) {
|
||||
baseDir = "/js/";
|
||||
} else {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.design_file_is_unsupported_type");
|
||||
throw new SSCActionMessagesException("errors.design_file_is_unsupported_type");
|
||||
}
|
||||
|
||||
final File uploadFile = new File(ServletContextUtil.getServletContext()
|
||||
.getRealPath(baseDir + fileName));
|
||||
final File uploadFile = new File(ServletContextUtil.getServletContext().getRealPath(baseDir + fileName));
|
||||
final File parentFile = uploadFile.getParentFile();
|
||||
if (!parentFile.exists() && !parentFile.mkdirs()) {
|
||||
logger.warn("Could not create " + parentFile.getAbsolutePath());
|
||||
}
|
||||
|
||||
try {
|
||||
FileUtil.write(uploadFile.getAbsolutePath(),
|
||||
designForm.designFile.getFileData());
|
||||
SAStrutsUtil.addSessionMessage("success.upload_design_file",
|
||||
fileName);
|
||||
FileUtil.write(uploadFile.getAbsolutePath(), designForm.designFile.getFileData());
|
||||
SAStrutsUtil.addSessionMessage("success.upload_design_file", fileName);
|
||||
return "index?redirect=true";
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to write an image file.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_write_design_image_file");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_write_design_image_file");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -176,8 +162,7 @@ public class DesignAction implements Serializable {
|
|||
final File jspFile = getJspFile(jspType);
|
||||
|
||||
try {
|
||||
designForm.content = new String(FileUtil.getBytes(jspFile),
|
||||
Constants.UTF_8);
|
||||
designForm.content = new String(FileUtil.getBytes(jspFile), Constants.UTF_8);
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
throw new FessSystemException("Invalid encoding", e);
|
||||
}
|
||||
|
@ -193,8 +178,7 @@ public class DesignAction implements Serializable {
|
|||
final File jspFile = getJspFile(jspType);
|
||||
|
||||
try {
|
||||
designForm.content = new String(FileUtil.getBytes(jspFile),
|
||||
Constants.UTF_8);
|
||||
designForm.content = new String(FileUtil.getBytes(jspFile), Constants.UTF_8);
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
throw new FessSystemException("Invalid encoding", e);
|
||||
}
|
||||
|
@ -214,15 +198,12 @@ public class DesignAction implements Serializable {
|
|||
}
|
||||
|
||||
try {
|
||||
FileUtil.write(jspFile.getAbsolutePath(),
|
||||
designForm.content.getBytes(Constants.UTF_8));
|
||||
SAStrutsUtil.addSessionMessage("success.update_design_jsp_file",
|
||||
systemHelper.getDesignJspFileName(designForm.fileName));
|
||||
FileUtil.write(jspFile.getAbsolutePath(), designForm.content.getBytes(Constants.UTF_8));
|
||||
SAStrutsUtil.addSessionMessage("success.update_design_jsp_file", systemHelper.getDesignJspFileName(designForm.fileName));
|
||||
return "index?redirect=true";
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update " + designForm.fileName, e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_update_jsp_file");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_update_jsp_file");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,8 +213,7 @@ public class DesignAction implements Serializable {
|
|||
|
||||
final File file = getTargetFile();
|
||||
if (file == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.target_file_does_not_exist", designForm.fileName);
|
||||
throw new SSCActionMessagesException("errors.target_file_does_not_exist", designForm.fileName);
|
||||
}
|
||||
|
||||
BufferedInputStream bis = null;
|
||||
|
@ -242,8 +222,7 @@ public class DesignAction implements Serializable {
|
|||
ResponseUtil.download(file.getName(), bis);
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to download " + file.getAbsolutePath(), e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_download_file", designForm.fileName);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_download_file", designForm.fileName);
|
||||
} finally {
|
||||
IOUtils.closeQuietly(bis);
|
||||
}
|
||||
|
@ -257,49 +236,39 @@ public class DesignAction implements Serializable {
|
|||
|
||||
final File file = getTargetFile();
|
||||
if (file == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.target_file_does_not_exist", designForm.fileName);
|
||||
throw new SSCActionMessagesException("errors.target_file_does_not_exist", designForm.fileName);
|
||||
}
|
||||
|
||||
if (file.delete()) {
|
||||
SAStrutsUtil.addSessionMessage("success.delete_file",
|
||||
designForm.fileName);
|
||||
SAStrutsUtil.addSessionMessage("success.delete_file", designForm.fileName);
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
logger.error("Failed to delete " + file.getAbsolutePath());
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_delete_file", designForm.fileName);
|
||||
throw new SSCActionMessagesException("errors.failed_to_delete_file", designForm.fileName);
|
||||
}
|
||||
}
|
||||
|
||||
private File getJspFile(final String jspType) {
|
||||
final String jspFileName = systemHelper
|
||||
.getDesignJspFileName(designForm.fileName);
|
||||
final String jspFileName = systemHelper.getDesignJspFileName(designForm.fileName);
|
||||
if (jspFileName == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.invalid_design_jsp_file_name");
|
||||
throw new SSCActionMessagesException("errors.invalid_design_jsp_file_name");
|
||||
}
|
||||
final File jspFile = new File(ServletContextUtil.getServletContext()
|
||||
.getRealPath("/WEB-INF/" + jspType + "/" + jspFileName));
|
||||
final File jspFile = new File(ServletContextUtil.getServletContext().getRealPath("/WEB-INF/" + jspType + "/" + jspFileName));
|
||||
if (jspFile == null || !jspFile.exists()) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.design_jsp_file_does_not_exist");
|
||||
throw new SSCActionMessagesException("errors.design_jsp_file_does_not_exist");
|
||||
}
|
||||
return jspFile;
|
||||
}
|
||||
|
||||
private void checkEditorStatus() {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(
|
||||
Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(crawlerProperties.getProperty(Constants.WEB_DESIGN_EDITOR_PROPERTY, Constants.TRUE))) {
|
||||
editable = false;
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.design_editor_disabled");
|
||||
throw new SSCActionMessagesException("errors.design_editor_disabled");
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFileNameItems() {
|
||||
final File baseDir = new File(ServletContextUtil.getServletContext()
|
||||
.getRealPath("/"));
|
||||
final File baseDir = new File(ServletContextUtil.getServletContext().getRealPath("/"));
|
||||
fileNameItems = new ArrayList<String>();
|
||||
final List<File> fileList = getAccessibleFileList(baseDir);
|
||||
final int length = baseDir.getAbsolutePath().length();
|
||||
|
@ -310,20 +279,15 @@ public class DesignAction implements Serializable {
|
|||
|
||||
private List<File> getAccessibleFileList(final File baseDir) {
|
||||
final List<File> fileList = new ArrayList<File>();
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"),
|
||||
systemHelper.getSupportedUploadedMediaExtentions(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"),
|
||||
systemHelper.getSupportedUploadedCssExtentions(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"),
|
||||
systemHelper.getSupportedUploadedJSExtentions(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "images"), systemHelper.getSupportedUploadedMediaExtentions(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "css"), systemHelper.getSupportedUploadedCssExtentions(), true));
|
||||
fileList.addAll(FileUtils.listFiles(new File(baseDir, "js"), systemHelper.getSupportedUploadedJSExtentions(), true));
|
||||
return fileList;
|
||||
}
|
||||
|
||||
private File getTargetFile() {
|
||||
final File baseDir = new File(ServletContextUtil.getServletContext()
|
||||
.getRealPath("/"));
|
||||
final File targetFile = new File(ServletContextUtil.getServletContext()
|
||||
.getRealPath(designForm.fileName));
|
||||
final File baseDir = new File(ServletContextUtil.getServletContext().getRealPath("/"));
|
||||
final File targetFile = new File(ServletContextUtil.getServletContext().getRealPath(designForm.fileName));
|
||||
final List<File> fileList = getAccessibleFileList(baseDir);
|
||||
boolean exist = false;
|
||||
for (final File file : fileList) {
|
||||
|
|
|
@ -63,8 +63,7 @@ public class DocumentAction implements Serializable {
|
|||
|
||||
private static final String SUGGEST_TYPE_CONTENT = "content";
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(DocumentAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DocumentAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -102,8 +101,7 @@ public class DocumentAction implements Serializable {
|
|||
protected String showIndex(final boolean redirect) {
|
||||
final Map<String, DynamicProperties> groupPropMap = new HashMap<String, DynamicProperties>();
|
||||
for (final String groupName : solrGroupManager.getSolrGroupNames()) {
|
||||
final DynamicProperties props = ComponentUtil
|
||||
.getSolrGroupProperties(groupName);
|
||||
final DynamicProperties props = ComponentUtil.getSolrGroupProperties(groupName);
|
||||
if (props != null) {
|
||||
groupPropMap.put(groupName, props);
|
||||
}
|
||||
|
@ -118,16 +116,12 @@ public class DocumentAction implements Serializable {
|
|||
map.put("serverName", names[1]);
|
||||
final DynamicProperties props = groupPropMap.get(names[0]);
|
||||
if (props != null) {
|
||||
String status = props
|
||||
.getProperty(StatusPolicyImpl.STATUS_PREFIX
|
||||
+ names[1]);
|
||||
String status = props.getProperty(StatusPolicyImpl.STATUS_PREFIX + names[1]);
|
||||
if (StringUtil.isBlank(status)) {
|
||||
status = StatusPolicyImpl.ACTIVE;
|
||||
}
|
||||
map.put("status", status);
|
||||
String index = props
|
||||
.getProperty(StatusPolicyImpl.INDEX_PREFIX
|
||||
+ names[1]);
|
||||
String index = props.getProperty(StatusPolicyImpl.INDEX_PREFIX + names[1]);
|
||||
if (StringUtil.isBlank(index)) {
|
||||
index = StatusPolicyImpl.READY;
|
||||
}
|
||||
|
@ -143,24 +137,18 @@ public class DocumentAction implements Serializable {
|
|||
suggestDocumentNums = getSuggestDocumentNum();
|
||||
|
||||
// select group status
|
||||
documentForm.currentServerForSelect = solrProperties
|
||||
.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup selectSolrGroup = solrGroupManager
|
||||
.getSolrGroup(documentForm.currentServerForSelect);
|
||||
if (selectSolrGroup != null
|
||||
&& selectSolrGroup.isActive(QueryType.QUERY)) {
|
||||
documentForm.currentServerForSelect = solrProperties.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup selectSolrGroup = solrGroupManager.getSolrGroup(documentForm.currentServerForSelect);
|
||||
if (selectSolrGroup != null && selectSolrGroup.isActive(QueryType.QUERY)) {
|
||||
documentForm.currentServerStatusForSelect = Constants.ACTIVE;
|
||||
} else {
|
||||
documentForm.currentServerStatusForSelect = Constants.INACTIVE;
|
||||
}
|
||||
|
||||
// update group status
|
||||
documentForm.currentServerForUpdate = solrProperties
|
||||
.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup updateSolrGroup = solrGroupManager
|
||||
.getSolrGroup(documentForm.currentServerForUpdate);
|
||||
if (updateSolrGroup != null
|
||||
&& updateSolrGroup.isActive(QueryType.QUERY)) {
|
||||
documentForm.currentServerForUpdate = solrProperties.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup updateSolrGroup = solrGroupManager.getSolrGroup(documentForm.currentServerForUpdate);
|
||||
if (updateSolrGroup != null && updateSolrGroup.isActive(QueryType.QUERY)) {
|
||||
documentForm.currentServerStatusForUpdate = Constants.ACTIVE;
|
||||
} else {
|
||||
documentForm.currentServerStatusForUpdate = Constants.INACTIVE;
|
||||
|
@ -183,14 +171,11 @@ public class DocumentAction implements Serializable {
|
|||
@Execute(validator = true, input = "index")
|
||||
public String commit() {
|
||||
if (jobHelper.isCrawlProcessRunning()) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_start_solr_process_because_of_running");
|
||||
throw new SSCActionMessagesException("errors.failed_to_start_solr_process_because_of_running");
|
||||
}
|
||||
final SolrGroup solrGroup = solrGroupManager
|
||||
.getSolrGroup(documentForm.groupName);
|
||||
final SolrGroup solrGroup = solrGroupManager.getSolrGroup(documentForm.groupName);
|
||||
if (solrGroup == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_commit_solr_index");
|
||||
throw new SSCActionMessagesException("errors.failed_to_commit_solr_index");
|
||||
} else {
|
||||
final Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -200,20 +185,16 @@ public class DocumentAction implements Serializable {
|
|||
try {
|
||||
systemHelper.updateStatus(solrGroup, QueryType.ADD);
|
||||
solrGroup.commit(true, true, false, true);
|
||||
systemHelper.updateStatus(solrGroup,
|
||||
QueryType.COMMIT);
|
||||
systemHelper.updateStatus(solrGroup, QueryType.COMMIT);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("[EXEC TIME] index commit time: "
|
||||
+ (System.currentTimeMillis() - execTime)
|
||||
+ "ms");
|
||||
logger.info("[EXEC TIME] index commit time: " + (System.currentTimeMillis() - execTime) + "ms");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to commit index.", e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("could not start index cleanup process"
|
||||
+ " because of running solr process.");
|
||||
logger.info("could not start index cleanup process" + " because of running solr process.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,14 +209,11 @@ public class DocumentAction implements Serializable {
|
|||
@Execute(validator = true, input = "index")
|
||||
public String optimize() {
|
||||
if (jobHelper.isCrawlProcessRunning()) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_start_solr_process_because_of_running");
|
||||
throw new SSCActionMessagesException("errors.failed_to_start_solr_process_because_of_running");
|
||||
}
|
||||
final SolrGroup solrGroup = solrGroupManager
|
||||
.getSolrGroup(documentForm.groupName);
|
||||
final SolrGroup solrGroup = solrGroupManager.getSolrGroup(documentForm.groupName);
|
||||
if (solrGroup == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_optimize_solr_index");
|
||||
throw new SSCActionMessagesException("errors.failed_to_optimize_solr_index");
|
||||
} else {
|
||||
final Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -245,20 +223,16 @@ public class DocumentAction implements Serializable {
|
|||
try {
|
||||
systemHelper.updateStatus(solrGroup, QueryType.ADD);
|
||||
solrGroup.optimize();
|
||||
systemHelper.updateStatus(solrGroup,
|
||||
QueryType.OPTIMIZE);
|
||||
systemHelper.updateStatus(solrGroup, QueryType.OPTIMIZE);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("[EXEC TIME] index optimize time: "
|
||||
+ (System.currentTimeMillis() - execTime)
|
||||
+ "ms");
|
||||
logger.info("[EXEC TIME] index optimize time: " + (System.currentTimeMillis() - execTime) + "ms");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to optimize index.", e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("could not start index cleanup process"
|
||||
+ " because of running solr process.");
|
||||
logger.info("could not start index cleanup process" + " because of running solr process.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,8 +250,7 @@ public class DocumentAction implements Serializable {
|
|||
if ("*".equals(documentForm.sessionId)) {
|
||||
deleteQuery = "*:*";
|
||||
} else {
|
||||
deleteQuery = fieldHelper.segmentField + ":"
|
||||
+ documentForm.sessionId;
|
||||
deleteQuery = fieldHelper.segmentField + ":" + documentForm.sessionId;
|
||||
}
|
||||
return deleteByQuery(deleteQuery);
|
||||
}
|
||||
|
@ -285,31 +258,25 @@ public class DocumentAction implements Serializable {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "index")
|
||||
public String confirmByUrl() {
|
||||
final String confirmQuery = fieldHelper.urlField + ":\""
|
||||
+ documentForm.deleteUrl + "\"";
|
||||
return "/admin/searchList/search?query=" + S2Functions.u(confirmQuery)
|
||||
+ "&redirect=true";
|
||||
final String confirmQuery = fieldHelper.urlField + ":\"" + documentForm.deleteUrl + "\"";
|
||||
return "/admin/searchList/search?query=" + S2Functions.u(confirmQuery) + "&redirect=true";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "index")
|
||||
public String deleteByUrl() {
|
||||
final String deleteUrl = documentForm.deleteUrl;
|
||||
final String deleteQuery = fieldHelper.urlField + ":\"" + deleteUrl
|
||||
+ "\"";
|
||||
final String deleteQuery = fieldHelper.urlField + ":\"" + deleteUrl + "\"";
|
||||
return deleteByQuery(deleteQuery);
|
||||
}
|
||||
|
||||
private String deleteByQuery(final String deleteQuery) {
|
||||
if (jobHelper.isCrawlProcessRunning()) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_start_solr_process_because_of_running");
|
||||
throw new SSCActionMessagesException("errors.failed_to_start_solr_process_because_of_running");
|
||||
}
|
||||
final SolrGroup solrGroup = solrGroupManager
|
||||
.getSolrGroup(documentForm.groupName);
|
||||
final SolrGroup solrGroup = solrGroupManager.getSolrGroup(documentForm.groupName);
|
||||
if (solrGroup == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_delete_solr_index");
|
||||
throw new SSCActionMessagesException("errors.failed_to_delete_solr_index");
|
||||
} else {
|
||||
final Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -317,25 +284,19 @@ public class DocumentAction implements Serializable {
|
|||
if (!jobHelper.isCrawlProcessRunning()) {
|
||||
final long execTime = System.currentTimeMillis();
|
||||
try {
|
||||
systemHelper.updateStatus(solrGroup,
|
||||
QueryType.DELETE);
|
||||
systemHelper.updateStatus(solrGroup, QueryType.DELETE);
|
||||
solrGroup.deleteByQuery(deleteQuery);
|
||||
solrGroup.commit(true, true, false, true);
|
||||
systemHelper.updateStatus(solrGroup,
|
||||
QueryType.OPTIMIZE);
|
||||
systemHelper.updateStatus(solrGroup, QueryType.OPTIMIZE);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("[EXEC TIME] index cleanup time: "
|
||||
+ (System.currentTimeMillis() - execTime)
|
||||
+ "ms");
|
||||
logger.info("[EXEC TIME] index cleanup time: " + (System.currentTimeMillis() - execTime) + "ms");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete index (query="
|
||||
+ deleteQuery + ").", e);
|
||||
logger.error("Failed to delete index (query=" + deleteQuery + ").", e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("could not start index cleanup process"
|
||||
+ " because of running solr process.");
|
||||
logger.info("could not start index cleanup process" + " because of running solr process.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,8 +324,7 @@ public class DocumentAction implements Serializable {
|
|||
return groupActionItems;
|
||||
}
|
||||
|
||||
protected SessionIdList<Map<String, String>> getSessionIdList(
|
||||
final String groupName) {
|
||||
protected SessionIdList<Map<String, String>> getSessionIdList(final String groupName) {
|
||||
final SessionIdList<Map<String, String>> sessionIdList = new SessionIdList<Map<String, String>>();
|
||||
|
||||
SolrGroup serverGroup;
|
||||
|
@ -389,10 +349,8 @@ public class DocumentAction implements Serializable {
|
|||
final List<FacetField.Count> facetEntries = facet.getValues();
|
||||
if (facetEntries != null) {
|
||||
for (final FacetField.Count fcount : facetEntries) {
|
||||
final Map<String, String> map = new HashMap<String, String>(
|
||||
3);
|
||||
map.put("label",
|
||||
fcount.getName() + " (" + fcount.getCount() + ")");
|
||||
final Map<String, String> map = new HashMap<String, String>(3);
|
||||
map.put("label", fcount.getName() + " (" + fcount.getCount() + ")");
|
||||
map.put("value", fcount.getName());
|
||||
map.put("count", Long.toString(fcount.getCount()));
|
||||
sessionIdList.add(map);
|
||||
|
@ -414,8 +372,7 @@ public class DocumentAction implements Serializable {
|
|||
protected Map<String, Long> getSuggestDocumentNum() {
|
||||
final Map<String, Long> map = new HashMap<String, Long>();
|
||||
map.put(SUGGEST_TYPE_CONTENT, suggestService.getContentDocumentNum());
|
||||
map.put(SUGGEST_TYPE_SEARCH_LOG,
|
||||
suggestService.getSearchLogDocumentNum());
|
||||
map.put(SUGGEST_TYPE_SEARCH_LOG, suggestService.getSearchLogDocumentNum());
|
||||
map.put(SUGGEST_TYPE_ALL, suggestService.getDocumentNum());
|
||||
return map;
|
||||
}
|
||||
|
@ -423,18 +380,14 @@ public class DocumentAction implements Serializable {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "index")
|
||||
public String deleteSuggest() {
|
||||
final SuggestSolrServer suggestSolrServer = suggestService
|
||||
.getSuggestSolrServer();
|
||||
final SuggestSolrServer suggestSolrServer = suggestService.getSuggestSolrServer();
|
||||
final String query;
|
||||
if (SUGGEST_TYPE_CONTENT.equals(documentForm.deleteSuggestType)) {
|
||||
query = "*:* NOT " + SuggestConstants.SuggestFieldNames.SEGMENT
|
||||
+ ":" + SuggestConstants.SEGMENT_ELEVATE + " NOT "
|
||||
+ SuggestConstants.SuggestFieldNames.SEGMENT + ":"
|
||||
+ SuggestConstants.SEGMENT_QUERY;
|
||||
} else if (SUGGEST_TYPE_SEARCH_LOG
|
||||
.equals(documentForm.deleteSuggestType)) {
|
||||
query = SuggestConstants.SuggestFieldNames.SEGMENT + ":"
|
||||
+ SuggestConstants.SEGMENT_QUERY;
|
||||
query =
|
||||
"*:* NOT " + SuggestConstants.SuggestFieldNames.SEGMENT + ":" + SuggestConstants.SEGMENT_ELEVATE + " NOT "
|
||||
+ SuggestConstants.SuggestFieldNames.SEGMENT + ":" + SuggestConstants.SEGMENT_QUERY;
|
||||
} else if (SUGGEST_TYPE_SEARCH_LOG.equals(documentForm.deleteSuggestType)) {
|
||||
query = SuggestConstants.SuggestFieldNames.SEGMENT + ":" + SuggestConstants.SEGMENT_QUERY;
|
||||
} else {
|
||||
query = "";
|
||||
}
|
||||
|
@ -449,19 +402,14 @@ public class DocumentAction implements Serializable {
|
|||
suggestSolrServer.deleteByQuery(query);
|
||||
suggestSolrServer.commit();
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("[EXEC TIME] suggest index cleanup time: "
|
||||
+ (System.currentTimeMillis() - execTime)
|
||||
+ "ms");
|
||||
logger.info("[EXEC TIME] suggest index cleanup time: " + (System.currentTimeMillis() - execTime) + "ms");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error(
|
||||
"Failed to delete suggest index (query="
|
||||
+ query + ").", e);
|
||||
logger.error("Failed to delete suggest index (query=" + query + ").", e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("could not start index cleanup process"
|
||||
+ " because of running solr process.");
|
||||
logger.info("could not start index cleanup process" + " because of running solr process.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,21 +62,17 @@ public class FavoriteLogAction extends BsFavoriteLogAction {
|
|||
public String download() {
|
||||
BufferedWriter writer = null;
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
final String fileName = "FessFavoriteLog_" + sdf.format(new Date())
|
||||
+ ".csv";
|
||||
final String fileName = "FessFavoriteLog_" + sdf.format(new Date()) + ".csv";
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("text/csv");
|
||||
response.setHeader("Content-disposition", "attachment; filename=\""
|
||||
+ fileName + "\"");
|
||||
response.setHeader("Content-disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), getCsvEncoding()));
|
||||
writer = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), getCsvEncoding()));
|
||||
favoriteLogService.dump(writer, favoriteLogPager);
|
||||
writer.flush();
|
||||
} catch (final Exception e) {
|
||||
log.error("Could not create FessSearchLog.csv.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.could_not_create_search_log_csv");
|
||||
throw new SSCActionMessagesException(e, "errors.could_not_create_search_log_csv");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
|
|
|
@ -47,8 +47,7 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(FileAuthenticationAction.class);
|
||||
private static final Log log = LogFactory.getLog(FileAuthenticationAction.class);
|
||||
|
||||
@Resource
|
||||
protected FileCrawlingConfigService fileCrawlingConfigService;
|
||||
|
@ -63,18 +62,13 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
@Override
|
||||
protected void loadFileAuthentication() {
|
||||
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileAuthenticationForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(fileAuthentication, fileAuthenticationForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(fileAuthentication, fileAuthenticationForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
if ("-1".equals(fileAuthenticationForm.port)) {
|
||||
fileAuthenticationForm.port = StringUtil.EMPTY;
|
||||
}
|
||||
|
@ -86,13 +80,10 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (fileAuthenticationForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileAuthenticationForm.id });
|
||||
}
|
||||
} else {
|
||||
fileAuthentication = new FileAuthentication();
|
||||
|
@ -104,8 +95,7 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
if (StringUtil.isBlank(fileAuthenticationForm.port)) {
|
||||
fileAuthenticationForm.port = "-1";
|
||||
}
|
||||
FessBeans.copy(fileAuthenticationForm, fileAuthentication)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(fileAuthenticationForm, fileAuthentication).excludesCommonColumns().execute();
|
||||
|
||||
return fileAuthentication;
|
||||
}
|
||||
|
@ -114,19 +104,15 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (fileAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileAuthenticationForm.id });
|
||||
}
|
||||
|
||||
// fileAuthenticationService.delete(fileAuthentication);
|
||||
|
@ -143,41 +129,36 @@ public class FileAuthenticationAction extends BsFileAuthenticationAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDisplayCreateLink() {
|
||||
return !fileCrawlingConfigService.getAllFileCrawlingConfigList(false,
|
||||
false, false, null).isEmpty();
|
||||
return !fileCrawlingConfigService.getAllFileCrawlingConfigList(false, false, false, null).isEmpty();
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getFileCrawlingConfigItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
final List<FileCrawlingConfig> fileCrawlingConfigList = fileCrawlingConfigService
|
||||
.getAllFileCrawlingConfigList(false, false, false, null);
|
||||
final List<FileCrawlingConfig> fileCrawlingConfigList =
|
||||
fileCrawlingConfigService.getAllFileCrawlingConfigList(false, false, false, null);
|
||||
for (final FileCrawlingConfig fileCrawlingConfig : fileCrawlingConfigList) {
|
||||
items.add(createItem(fileCrawlingConfig.getName(),
|
||||
fileCrawlingConfig.getId().toString()));
|
||||
items.add(createItem(fileCrawlingConfig.getName(), fileCrawlingConfig.getId().toString()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getProtocolSchemeItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.file_authentication_scheme_samba"), Constants.SAMBA));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.file_authentication_scheme_samba"),
|
||||
Constants.SAMBA));
|
||||
return items;
|
||||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label,
|
||||
final String value) {
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
map.put("label", label);
|
||||
map.put("value", value);
|
||||
|
|
|
@ -42,8 +42,7 @@ import org.seasar.struts.exception.ActionMessagesException;
|
|||
public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(FileCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(FileCrawlingConfigAction.class);
|
||||
|
||||
@Resource
|
||||
protected RoleTypeService roleTypeService;
|
||||
|
@ -64,24 +63,17 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
|||
@Override
|
||||
protected void loadFileCrawlingConfig() {
|
||||
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(fileCrawlingConfig, fileCrawlingConfigForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(fileCrawlingConfig, fileCrawlingConfigForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
|
||||
// normalize boost
|
||||
if (fileCrawlingConfigForm.boost != null
|
||||
&& fileCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
fileCrawlingConfigForm.boost = fileCrawlingConfigForm.boost
|
||||
.substring(0, fileCrawlingConfigForm.boost.indexOf('.'));
|
||||
if (fileCrawlingConfigForm.boost != null && fileCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
fileCrawlingConfigForm.boost = fileCrawlingConfigForm.boost.substring(0, fileCrawlingConfigForm.boost.indexOf('.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,13 +83,10 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (fileCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileCrawlingConfigForm.id });
|
||||
}
|
||||
} else {
|
||||
fileCrawlingConfig = new FileCrawlingConfig();
|
||||
|
@ -106,8 +95,7 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
|||
}
|
||||
fileCrawlingConfig.setUpdatedBy(username);
|
||||
fileCrawlingConfig.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(fileCrawlingConfigForm, fileCrawlingConfig)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(fileCrawlingConfigForm, fileCrawlingConfig).excludesCommonColumns().execute();
|
||||
|
||||
return fileCrawlingConfig;
|
||||
}
|
||||
|
@ -116,23 +104,18 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { fileCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
failureUrlService
|
||||
.deleteByConfigId(fileCrawlingConfig.getConfigId());
|
||||
failureUrlService.deleteByConfigId(fileCrawlingConfig.getConfigId());
|
||||
|
||||
//fileCrawlingConfigService.delete(fileCrawlingConfig);
|
||||
final String username = systemHelper.getUsername();
|
||||
|
@ -148,12 +131,10 @@ public class FileCrawlingConfigAction extends BsFileCrawlingConfigAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,10 @@ public class KeyMatchAction extends BsKeyMatchAction {
|
|||
final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { keyMatchForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { keyMatchForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(keyMatch, keyMatchForm).commonColumnDateConverter()
|
||||
.excludes("searchParams", "mode").execute();
|
||||
FessBeans.copy(keyMatch, keyMatchForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,9 +69,7 @@ public class KeyMatchAction extends BsKeyMatchAction {
|
|||
keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { keyMatchForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { keyMatchForm.id });
|
||||
}
|
||||
} else {
|
||||
keyMatch = new KeyMatch();
|
||||
|
@ -83,8 +78,7 @@ public class KeyMatchAction extends BsKeyMatchAction {
|
|||
}
|
||||
keyMatch.setUpdatedBy(username);
|
||||
keyMatch.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(keyMatchForm, keyMatch).excludesCommonColumns()
|
||||
.execute();
|
||||
FessBeans.copy(keyMatchForm, keyMatch).excludesCommonColumns().execute();
|
||||
|
||||
return keyMatch;
|
||||
}
|
||||
|
@ -111,19 +105,15 @@ public class KeyMatchAction extends BsKeyMatchAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final KeyMatch keyMatch = keyMatchService
|
||||
.getKeyMatch(createKeyMap());
|
||||
final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { keyMatchForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { keyMatchForm.id });
|
||||
}
|
||||
|
||||
// keyMatchService.delete(keyMatch);
|
||||
|
@ -142,12 +132,10 @@ public class KeyMatchAction extends BsKeyMatchAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,17 +54,13 @@ public class LabelTypeAction extends BsLabelTypeAction {
|
|||
@Override
|
||||
protected void loadLabelType() {
|
||||
|
||||
final LabelType labelType = labelTypeService
|
||||
.getLabelType(createKeyMap());
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { labelTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { labelTypeForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(labelType, labelTypeForm).commonColumnDateConverter()
|
||||
.excludes("searchParams", "mode").execute();
|
||||
FessBeans.copy(labelType, labelTypeForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,9 +72,7 @@ public class LabelTypeAction extends BsLabelTypeAction {
|
|||
labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { labelTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { labelTypeForm.id });
|
||||
}
|
||||
} else {
|
||||
labelType = new LabelType();
|
||||
|
@ -87,8 +81,7 @@ public class LabelTypeAction extends BsLabelTypeAction {
|
|||
}
|
||||
labelType.setUpdatedBy(username);
|
||||
labelType.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(labelTypeForm, labelType).excludesCommonColumns()
|
||||
.execute();
|
||||
FessBeans.copy(labelTypeForm, labelType).excludesCommonColumns().execute();
|
||||
|
||||
return labelType;
|
||||
}
|
||||
|
@ -97,19 +90,15 @@ public class LabelTypeAction extends BsLabelTypeAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final LabelType labelType = labelTypeService
|
||||
.getLabelType(createKeyMap());
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { labelTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { labelTypeForm.id });
|
||||
}
|
||||
|
||||
// labelTypeService.delete(labelType);
|
||||
|
@ -126,12 +115,10 @@ public class LabelTypeAction extends BsLabelTypeAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ public class LogAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(LogAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(LogAction.class);
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
|
@ -71,47 +70,39 @@ public class LogAction implements Serializable {
|
|||
|
||||
@Execute(validator = true, input = "index", urlPattern = "download/{logFileName}")
|
||||
public String download() {
|
||||
final String logFilePath = ComponentUtil.getSystemHelper()
|
||||
.getLogFilePath();
|
||||
final String logFilePath = ComponentUtil.getSystemHelper().getLogFilePath();
|
||||
if (StringUtil.isNotBlank(logFilePath)) {
|
||||
final File file = new File(logFilePath);
|
||||
final File parentDir = file.getParentFile();
|
||||
String fileName;
|
||||
try {
|
||||
fileName = new String(Base64.decodeBase64(logForm.logFileName
|
||||
.getBytes(Constants.UTF_8)), Constants.UTF_8);
|
||||
fileName = new String(Base64.decodeBase64(logForm.logFileName.getBytes(Constants.UTF_8)), Constants.UTF_8);
|
||||
} catch (final UnsupportedEncodingException e1) {
|
||||
fileName = new String(Base64.decodeBase64(logForm.logFileName
|
||||
.getBytes(Charset.defaultCharset())),
|
||||
Charset.defaultCharset());
|
||||
fileName =
|
||||
new String(Base64.decodeBase64(logForm.logFileName.getBytes(Charset.defaultCharset())), Charset.defaultCharset());
|
||||
}
|
||||
final File logFile = new File(parentDir, fileName);
|
||||
if (logFile.isFile()) {
|
||||
try {
|
||||
ResponseUtil.download(fileName,
|
||||
new FileInputStream(logFile));
|
||||
ResponseUtil.download(fileName, new FileInputStream(logFile));
|
||||
return null;
|
||||
} catch (final FileNotFoundException e) {
|
||||
logger.warn("Could not find " + logFile.getAbsolutePath(),
|
||||
e);
|
||||
logger.warn("Could not find " + logFile.getAbsolutePath(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new SSCActionMessagesException("errors.could_not_find_log_file",
|
||||
new Object[] { logForm.logFileName });
|
||||
throw new SSCActionMessagesException("errors.could_not_find_log_file", new Object[] { logForm.logFileName });
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getLogFileItems() {
|
||||
final List<Map<String, Object>> logFileItems = new ArrayList<Map<String, Object>>();
|
||||
final String logFilePath = ComponentUtil.getSystemHelper()
|
||||
.getLogFilePath();
|
||||
final String logFilePath = ComponentUtil.getSystemHelper().getLogFilePath();
|
||||
if (StringUtil.isNotBlank(logFilePath)) {
|
||||
try {
|
||||
final File file = new File(logFilePath);
|
||||
final File parentDir = file.getParentFile();
|
||||
if (!parentDir.exists()) {
|
||||
logger.warn("Log directory does not exist: "
|
||||
+ parentDir.getAbsolutePath());
|
||||
logger.warn("Log directory does not exist: " + parentDir.getAbsolutePath());
|
||||
return logFileItems;
|
||||
}
|
||||
final File[] files = parentDir.listFiles(new FilenameFilter() {
|
||||
|
@ -150,14 +141,10 @@ public class LogAction implements Serializable {
|
|||
final Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("name", file.getName());
|
||||
try {
|
||||
map.put("logFileName",
|
||||
new String(Base64.encodeBase64(file.getName().getBytes(
|
||||
Constants.UTF_8)), "UTF-8"));
|
||||
map.put("logFileName", new String(Base64.encodeBase64(file.getName().getBytes(Constants.UTF_8)), "UTF-8"));
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
map.put("logFileName",
|
||||
new String(Base64.encodeBase64(file.getName().getBytes(
|
||||
Charset.defaultCharset())), Charset
|
||||
.defaultCharset()));
|
||||
new String(Base64.encodeBase64(file.getName().getBytes(Charset.defaultCharset())), Charset.defaultCharset()));
|
||||
}
|
||||
map.put("lastModified", new Date(file.lastModified()));
|
||||
return map;
|
||||
|
|
|
@ -37,8 +37,7 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(OverlappingHostAction.class);
|
||||
private static final Log log = LogFactory.getLog(OverlappingHostAction.class);
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
@ -50,18 +49,13 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
@Override
|
||||
protected void loadOverlappingHost() {
|
||||
|
||||
final OverlappingHost overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
final OverlappingHost overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { overlappingHostForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { overlappingHostForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(overlappingHost, overlappingHostForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(overlappingHost, overlappingHostForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,13 +64,10 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (overlappingHostForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { overlappingHostForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { overlappingHostForm.id });
|
||||
}
|
||||
} else {
|
||||
overlappingHost = new OverlappingHost();
|
||||
|
@ -85,8 +76,7 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
}
|
||||
overlappingHost.setUpdatedBy(username);
|
||||
overlappingHost.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(overlappingHostForm, overlappingHost)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(overlappingHostForm, overlappingHost).excludesCommonColumns().execute();
|
||||
|
||||
return overlappingHost;
|
||||
}
|
||||
|
@ -95,19 +85,15 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (overlappingHostForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final OverlappingHost overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
final OverlappingHost overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { overlappingHostForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { overlappingHostForm.id });
|
||||
}
|
||||
|
||||
// overlappingHostService.delete(overlappingHost);
|
||||
|
@ -124,12 +110,10 @@ public class OverlappingHostAction extends BsOverlappingHostAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,18 +61,13 @@ public class PathMappingAction extends BsPathMappingAction {
|
|||
@Override
|
||||
protected void loadPathMapping() {
|
||||
|
||||
final PathMapping pathMapping = pathMappingService
|
||||
.getPathMapping(createKeyMap());
|
||||
final PathMapping pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { pathMappingForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { pathMappingForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(pathMapping, pathMappingForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(pathMapping, pathMappingForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,9 +79,7 @@ public class PathMappingAction extends BsPathMappingAction {
|
|||
pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { pathMappingForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { pathMappingForm.id });
|
||||
}
|
||||
} else {
|
||||
pathMapping = new PathMapping();
|
||||
|
@ -95,8 +88,7 @@ public class PathMappingAction extends BsPathMappingAction {
|
|||
}
|
||||
pathMapping.setUpdatedBy(username);
|
||||
pathMapping.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(pathMappingForm, pathMapping).excludesCommonColumns()
|
||||
.execute();
|
||||
FessBeans.copy(pathMappingForm, pathMapping).excludesCommonColumns().execute();
|
||||
|
||||
return pathMapping;
|
||||
}
|
||||
|
@ -105,19 +97,15 @@ public class PathMappingAction extends BsPathMappingAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (pathMappingForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final PathMapping pathMapping = pathMappingService
|
||||
.getPathMapping(createKeyMap());
|
||||
final PathMapping pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { pathMappingForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { pathMappingForm.id });
|
||||
}
|
||||
|
||||
// pathMappingService.delete(pathMapping);
|
||||
|
@ -134,12 +122,10 @@ public class PathMappingAction extends BsPathMappingAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,18 +60,13 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
@Override
|
||||
protected void loadRequestHeader() {
|
||||
|
||||
final RequestHeader requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
final RequestHeader requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { requestHeaderForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { requestHeaderForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(requestHeader, requestHeaderForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(requestHeader, requestHeaderForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,13 +75,10 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (requestHeaderForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { requestHeaderForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { requestHeaderForm.id });
|
||||
}
|
||||
} else {
|
||||
requestHeader = new RequestHeader();
|
||||
|
@ -95,8 +87,7 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
}
|
||||
requestHeader.setUpdatedBy(username);
|
||||
requestHeader.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(requestHeaderForm, requestHeader)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(requestHeaderForm, requestHeader).excludesCommonColumns().execute();
|
||||
|
||||
return requestHeader;
|
||||
}
|
||||
|
@ -105,19 +96,15 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (requestHeaderForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final RequestHeader requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
final RequestHeader requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { requestHeaderForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { requestHeaderForm.id });
|
||||
}
|
||||
|
||||
// requestHeaderService.delete(requestHeader);
|
||||
|
@ -134,39 +121,33 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getWebCrawlingConfigItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
final List<WebCrawlingConfig> webCrawlingConfigList = webCrawlingConfigService
|
||||
.getAllWebCrawlingConfigList(false, false, false, null);
|
||||
final List<WebCrawlingConfig> webCrawlingConfigList =
|
||||
webCrawlingConfigService.getAllWebCrawlingConfigList(false, false, false, null);
|
||||
for (final WebCrawlingConfig webCrawlingConfig : webCrawlingConfigList) {
|
||||
items.add(createItem(webCrawlingConfig.getName(), webCrawlingConfig
|
||||
.getId().toString()));
|
||||
items.add(createItem(webCrawlingConfig.getName(), webCrawlingConfig.getId().toString()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getProtocolSchemeItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.web_authentication_scheme_basic"), "BASIC"));
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.web_authentication_scheme_digest"), "DIGEST"));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.web_authentication_scheme_basic"), "BASIC"));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.web_authentication_scheme_digest"), "DIGEST"));
|
||||
return items;
|
||||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label,
|
||||
final String value) {
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
map.put("label", label);
|
||||
map.put("value", value);
|
||||
|
@ -174,7 +155,6 @@ public class RequestHeaderAction extends BsRequestHeaderAction {
|
|||
}
|
||||
|
||||
public boolean isDisplayCreateLink() {
|
||||
return !webCrawlingConfigService.getAllWebCrawlingConfigList(false,
|
||||
false, false, null).isEmpty();
|
||||
return !webCrawlingConfigService.getAllWebCrawlingConfigList(false, false, false, null).isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,13 +68,10 @@ public class RoleTypeAction extends BsRoleTypeAction {
|
|||
final RoleType roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { roleTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { roleTypeForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(roleType, roleTypeForm).commonColumnDateConverter()
|
||||
.excludes("searchParams", "mode").execute();
|
||||
FessBeans.copy(roleType, roleTypeForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,9 +83,7 @@ public class RoleTypeAction extends BsRoleTypeAction {
|
|||
roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { roleTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { roleTypeForm.id });
|
||||
}
|
||||
} else {
|
||||
roleType = new RoleType();
|
||||
|
@ -98,8 +93,7 @@ public class RoleTypeAction extends BsRoleTypeAction {
|
|||
roleType.setUpdatedBy(username);
|
||||
roleType.setUpdatedTime(currentTime);
|
||||
roleTypeForm.value = roleTypeForm.value.trim();
|
||||
FessBeans.copy(roleTypeForm, roleType).excludesCommonColumns()
|
||||
.execute();
|
||||
FessBeans.copy(roleTypeForm, roleType).excludesCommonColumns().execute();
|
||||
|
||||
return roleType;
|
||||
}
|
||||
|
@ -109,19 +103,15 @@ public class RoleTypeAction extends BsRoleTypeAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (roleTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final RoleType roleType = roleTypeService
|
||||
.getRoleType(createKeyMap());
|
||||
final RoleType roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { roleTypeForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { roleTypeForm.id });
|
||||
}
|
||||
|
||||
// roleTypeService.delete(roleType);
|
||||
|
@ -138,12 +128,10 @@ public class RoleTypeAction extends BsRoleTypeAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,15 +65,10 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
|
||||
final ScheduledJob scheduledJob = getScheduledJob();
|
||||
|
||||
FessBeans.copy(scheduledJob, scheduledJobForm)
|
||||
.commonColumnDateConverter()
|
||||
.excludes("searchParams", "mode", "jobLogging").execute();
|
||||
scheduledJobForm.jobLogging = scheduledJob.isLoggingEnabled() ? Constants.ON
|
||||
: null;
|
||||
scheduledJobForm.crawler = scheduledJob.isCrawlerJob() ? Constants.ON
|
||||
: null;
|
||||
scheduledJobForm.available = scheduledJob.isEnabled() ? Constants.ON
|
||||
: null;
|
||||
FessBeans.copy(scheduledJob, scheduledJobForm).commonColumnDateConverter().excludes("searchParams", "mode", "jobLogging").execute();
|
||||
scheduledJobForm.jobLogging = scheduledJob.isLoggingEnabled() ? Constants.ON : null;
|
||||
scheduledJobForm.crawler = scheduledJob.isCrawlerJob() ? Constants.ON : null;
|
||||
scheduledJobForm.available = scheduledJob.isEnabled() ? Constants.ON : null;
|
||||
running = scheduledJob.isRunning();
|
||||
}
|
||||
|
||||
|
@ -86,9 +81,7 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
scheduledJob = scheduledJobService.getScheduledJob(createKeyMap());
|
||||
if (scheduledJob == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { scheduledJobForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { scheduledJobForm.id });
|
||||
}
|
||||
} else {
|
||||
scheduledJob = new ScheduledJob();
|
||||
|
@ -97,17 +90,10 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
}
|
||||
scheduledJob.setUpdatedBy(username);
|
||||
scheduledJob.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(scheduledJobForm, scheduledJob).excludesCommonColumns()
|
||||
.execute();
|
||||
scheduledJob.setJobLogging(Constants.ON
|
||||
.equals(scheduledJobForm.jobLogging) ? Constants.T
|
||||
: Constants.F);
|
||||
scheduledJob
|
||||
.setCrawler(Constants.ON.equals(scheduledJobForm.crawler) ? Constants.T
|
||||
: Constants.F);
|
||||
scheduledJob
|
||||
.setAvailable(Constants.ON.equals(scheduledJobForm.available) ? Constants.T
|
||||
: Constants.F);
|
||||
FessBeans.copy(scheduledJobForm, scheduledJob).excludesCommonColumns().execute();
|
||||
scheduledJob.setJobLogging(Constants.ON.equals(scheduledJobForm.jobLogging) ? Constants.T : Constants.F);
|
||||
scheduledJob.setCrawler(Constants.ON.equals(scheduledJobForm.crawler) ? Constants.T : Constants.F);
|
||||
scheduledJob.setAvailable(Constants.ON.equals(scheduledJobForm.available) ? Constants.T : Constants.F);
|
||||
|
||||
return scheduledJob;
|
||||
}
|
||||
|
@ -116,9 +102,8 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (scheduledJobForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -137,12 +122,10 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,13 +134,11 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
final ScheduledJob scheduledJob = getScheduledJob();
|
||||
try {
|
||||
scheduledJob.start();
|
||||
SAStrutsUtil.addSessionMessage("success.job_started",
|
||||
scheduledJob.getName());
|
||||
SAStrutsUtil.addSessionMessage("success.job_started", scheduledJob.getName());
|
||||
return displayList(true);
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_start_job", scheduledJob.getName());
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_start_job", scheduledJob.getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -166,16 +147,13 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
public String stop() {
|
||||
final ScheduledJob scheduledJob = getScheduledJob();
|
||||
try {
|
||||
final JobExecutor jobExecutoer = jobHelper
|
||||
.getJobExecutoer(scheduledJob.getId());
|
||||
final JobExecutor jobExecutoer = jobHelper.getJobExecutoer(scheduledJob.getId());
|
||||
jobExecutoer.shutdown();
|
||||
SAStrutsUtil.addSessionMessage("success.job_stopped",
|
||||
scheduledJob.getName());
|
||||
SAStrutsUtil.addSessionMessage("success.job_stopped", scheduledJob.getName());
|
||||
return displayList(true);
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_stop_job", scheduledJob.getName());
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_stop_job", scheduledJob.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,13 +162,10 @@ public class ScheduledJobAction extends BsScheduledJobAction {
|
|||
}
|
||||
|
||||
protected ScheduledJob getScheduledJob() {
|
||||
final ScheduledJob scheduledJob = scheduledJobService
|
||||
.getScheduledJob(createKeyMap());
|
||||
final ScheduledJob scheduledJob = scheduledJobService.getScheduledJob(createKeyMap());
|
||||
if (scheduledJob == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { scheduledJobForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { scheduledJobForm.id });
|
||||
}
|
||||
return scheduledJob;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class SearchListAction implements Serializable {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(SearchListAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SearchListAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -161,10 +160,9 @@ public class SearchListAction implements Serializable {
|
|||
final int offset = Integer.parseInt(searchListForm.start);
|
||||
final int size = Integer.parseInt(searchListForm.num);
|
||||
try {
|
||||
documentItems = searchService.getDocumentList(query, offset, size,
|
||||
null, null, null, queryHelper.getResponseFields(),
|
||||
new String[] { fieldHelper.clickCountField,
|
||||
fieldHelper.favoriteCountField }, false);
|
||||
documentItems =
|
||||
searchService.getDocumentList(query, offset, size, null, null, null, queryHelper.getResponseFields(), new String[] {
|
||||
fieldHelper.clickCountField, fieldHelper.favoriteCountField }, false);
|
||||
} catch (final InvalidQueryException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
|
@ -174,25 +172,19 @@ public class SearchListAction implements Serializable {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.result_size_exceeded");
|
||||
throw new SSCActionMessagesException(e, "errors.result_size_exceeded");
|
||||
}
|
||||
final QueryResponseList queryResponseList = (QueryResponseList) documentItems;
|
||||
final NumberFormat nf = NumberFormat.getInstance(RequestUtil
|
||||
.getRequest().getLocale());
|
||||
final NumberFormat nf = NumberFormat.getInstance(RequestUtil.getRequest().getLocale());
|
||||
nf.setMaximumIntegerDigits(2);
|
||||
nf.setMaximumFractionDigits(2);
|
||||
try {
|
||||
execTime = nf
|
||||
.format((double) queryResponseList.getExecTime() / 1000);
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
execTime = nf.format((double) queryResponseList.getExecTime() / 1000);
|
||||
} catch (final Exception e) {}
|
||||
|
||||
Beans.copy(documentItems, this)
|
||||
.includes("pageSize", "currentPageNumber", "allRecordCount",
|
||||
"allPageCount", "existNextPage", "existPrevPage",
|
||||
"currentStartRecordNumber", "currentEndRecordNumber",
|
||||
"pageNumberList").execute();
|
||||
.includes("pageSize", "currentPageNumber", "allRecordCount", "allPageCount", "existNextPage", "existPrevPage",
|
||||
"currentStartRecordNumber", "currentEndRecordNumber", "pageNumberList").execute();
|
||||
|
||||
return query;
|
||||
}
|
||||
|
@ -261,14 +253,11 @@ public class SearchListAction implements Serializable {
|
|||
|
||||
private String deleteByQuery(final String docId) {
|
||||
if (jobHelper.isCrawlProcessRunning()) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_start_solr_process_because_of_running");
|
||||
throw new SSCActionMessagesException("errors.failed_to_start_solr_process_because_of_running");
|
||||
}
|
||||
final SolrGroup solrGroup = solrGroupManager
|
||||
.getSolrGroup(QueryType.DELETE);
|
||||
final SolrGroup solrGroup = solrGroupManager.getSolrGroup(QueryType.DELETE);
|
||||
if (solrGroup == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_delete_solr_index");
|
||||
throw new SSCActionMessagesException("errors.failed_to_delete_solr_index");
|
||||
} else {
|
||||
final Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -276,23 +265,17 @@ public class SearchListAction implements Serializable {
|
|||
if (!jobHelper.isCrawlProcessRunning()) {
|
||||
final long time = System.currentTimeMillis();
|
||||
try {
|
||||
solrGroup.deleteByQuery(fieldHelper.docIdField
|
||||
+ ":" + docId);
|
||||
solrGroup.deleteByQuery(fieldHelper.docIdField + ":" + docId);
|
||||
solrGroup.commit(true, true, false, true);
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("[EXEC TIME] index cleanup time: "
|
||||
+ (System.currentTimeMillis() - time)
|
||||
+ "ms");
|
||||
logger.info("[EXEC TIME] index cleanup time: " + (System.currentTimeMillis() - time) + "ms");
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete index (query="
|
||||
+ fieldHelper.docIdField + ":" + docId
|
||||
+ ").", e);
|
||||
logger.error("Failed to delete index (query=" + fieldHelper.docIdField + ":" + docId + ").", e);
|
||||
}
|
||||
} else {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("could not start index cleanup process"
|
||||
+ " because of running solr process.");
|
||||
logger.info("could not start index cleanup process" + " because of running solr process.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -300,8 +283,7 @@ public class SearchListAction implements Serializable {
|
|||
thread.start();
|
||||
SAStrutsUtil.addSessionMessage("success.delete_solr_index");
|
||||
}
|
||||
return "search?query=" + S2Functions.u(searchListForm.query)
|
||||
+ "&redirect=true";
|
||||
return "search?query=" + S2Functions.u(searchListForm.query) + "&redirect=true";
|
||||
}
|
||||
|
||||
public boolean isSolrProcessRunning() {
|
||||
|
|
|
@ -61,8 +61,7 @@ public class SearchLogAction extends BsSearchLogAction {
|
|||
if (!searchParams.containsKey("startPage")) {
|
||||
searchParams.put("startPage", StringUtil.EMPTY);
|
||||
}
|
||||
Beans.copy(searchParams, searchLogPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(searchParams, searchLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -78,21 +77,17 @@ public class SearchLogAction extends BsSearchLogAction {
|
|||
public String download() {
|
||||
BufferedWriter writer = null;
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||
final String fileName = "FessSearchLog_" + sdf.format(new Date())
|
||||
+ ".csv";
|
||||
final String fileName = "FessSearchLog_" + sdf.format(new Date()) + ".csv";
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("text/csv");
|
||||
response.setHeader("Content-disposition", "attachment; filename=\""
|
||||
+ fileName + "\"");
|
||||
response.setHeader("Content-disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), getCsvEncoding()));
|
||||
writer = new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), getCsvEncoding()));
|
||||
searchLogService.dump(writer, searchLogPager);
|
||||
writer.flush();
|
||||
} catch (final Exception e) {
|
||||
log.error("Could not create FessSearchLog.csv.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.could_not_create_search_log_csv");
|
||||
throw new SSCActionMessagesException(e, "errors.could_not_create_search_log_csv");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(writer);
|
||||
}
|
||||
|
@ -111,7 +106,6 @@ public class SearchLogAction extends BsSearchLogAction {
|
|||
}
|
||||
|
||||
public boolean isHasClickLog() {
|
||||
return searchLogForm.clickLogList != null
|
||||
&& !searchLogForm.clickLogList.isEmpty();
|
||||
return searchLogForm.clickLogList != null && !searchLogForm.clickLogList.isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,8 +70,7 @@ public class StatsAction implements Serializable {
|
|||
reportTypeItems = searchFieldLogService.getGroupedFieldNames();
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(statsPager, statsForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(statsPager, statsForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,8 +89,7 @@ public class StatsAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(statsForm.pageNumber)) {
|
||||
try {
|
||||
statsPager.setCurrentPageNumber(Integer
|
||||
.parseInt(statsForm.pageNumber));
|
||||
statsPager.setCurrentPageNumber(Integer.parseInt(statsForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + statsForm.pageNumber, e);
|
||||
|
@ -104,8 +102,7 @@ public class StatsAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(statsForm.searchParams, statsPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(statsForm.searchParams, statsPager).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(SuggestBadWordAction.class);
|
||||
private static final Log log = LogFactory.getLog(SuggestBadWordAction.class);
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
@ -75,18 +74,13 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
@Override
|
||||
protected void loadSuggestBadWord() {
|
||||
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestBadWordForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(suggestBadWord, suggestBadWordForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(suggestBadWord, suggestBadWordForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,13 +89,10 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (suggestBadWordForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestBadWordForm.id });
|
||||
}
|
||||
} else {
|
||||
suggestBadWord = new SuggestBadWord();
|
||||
|
@ -110,8 +101,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
}
|
||||
suggestBadWord.setUpdatedBy(username);
|
||||
suggestBadWord.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(suggestBadWordForm, suggestBadWord)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(suggestBadWordForm, suggestBadWord).excludesCommonColumns().execute();
|
||||
|
||||
return suggestBadWord;
|
||||
}
|
||||
|
@ -120,19 +110,15 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (suggestBadWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestBadWordForm.id });
|
||||
}
|
||||
|
||||
// suggestBadWordService.delete(suggestBadWord);
|
||||
|
@ -151,12 +137,10 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,8 +164,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,8 +188,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,17 +204,15 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ "badword.csv" + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + "badword.csv" + "\"");
|
||||
|
||||
try (Writer writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), crawlerProperties.getProperty(
|
||||
try (Writer writer =
|
||||
new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8)))) {
|
||||
suggestBadWordService.exportCsv(writer);
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -252,8 +232,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
final byte[] b = new byte[20];
|
||||
try {
|
||||
tempFile = File.createTempFile("suggestbadword-import-", ".csv");
|
||||
is = new BufferedInputStream(
|
||||
suggestBadWordForm.suggestBadWordFile.getInputStream());
|
||||
is = new BufferedInputStream(suggestBadWordForm.suggestBadWordFile.getInputStream());
|
||||
is.mark(20);
|
||||
if (is.read(b, 0, 20) <= 0) {
|
||||
throw new FessSystemException("no import data.");
|
||||
|
@ -266,8 +245,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
log.warn("Could not delete " + tempFile.getAbsolutePath());
|
||||
}
|
||||
log.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
IOUtils.closeQuietly(fos);
|
||||
|
@ -277,29 +255,23 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
try {
|
||||
final String head = new String(b, Constants.UTF_8);
|
||||
if (!(head.startsWith("\"BadWord\"") || head.startsWith("BadWord"))) {
|
||||
log.error("Unknown file: "
|
||||
+ suggestBadWordForm.suggestBadWordFile);
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.unknown_import_file");
|
||||
log.error("Unknown file: " + suggestBadWordForm.suggestBadWordFile);
|
||||
throw new SSCActionMessagesException("errors.unknown_import_file");
|
||||
}
|
||||
final String enc = crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
final String enc = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(oFile), enc));
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(oFile), enc));
|
||||
suggestBadWordService.importCsv(reader);
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to import data.", e);
|
||||
throw new FessSystemException("Failed to import data.",
|
||||
e);
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
} finally {
|
||||
if (!oFile.delete()) {
|
||||
log.warn("Could not delete "
|
||||
+ oFile.getAbsolutePath());
|
||||
log.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
IOUtils.closeQuietly(reader);
|
||||
suggestHelper.deleteAllBadWord();
|
||||
|
@ -317,8 +289,7 @@ public class SuggestBadWordAction extends BsSuggestBadWordAction {
|
|||
log.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
log.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
}
|
||||
SAStrutsUtil.addSessionMessage("success.upload_suggest_bad_word");
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(SuggestElevateWordAction.class);
|
||||
private static final Log log = LogFactory.getLog(SuggestElevateWordAction.class);
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
@ -75,18 +74,13 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
@Override
|
||||
protected void loadSuggestElevateWord() {
|
||||
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestElevateWordForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(suggestElevateWord, suggestElevateWordForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(suggestElevateWord, suggestElevateWordForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,13 +89,10 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (suggestElevateWordForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestElevateWordForm.id });
|
||||
}
|
||||
} else {
|
||||
suggestElevateWord = new SuggestElevateWord();
|
||||
|
@ -110,8 +101,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
}
|
||||
suggestElevateWord.setUpdatedBy(username);
|
||||
suggestElevateWord.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(suggestElevateWordForm, suggestElevateWord)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(suggestElevateWordForm, suggestElevateWord).excludesCommonColumns().execute();
|
||||
|
||||
return suggestElevateWord;
|
||||
}
|
||||
|
@ -135,8 +125,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,8 +148,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,19 +156,15 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (suggestElevateWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { suggestElevateWordForm.id });
|
||||
}
|
||||
|
||||
// suggestElevateWordService.delete(suggestElevateWord);
|
||||
|
@ -198,12 +182,10 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,17 +201,15 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
|
||||
final HttpServletResponse response = ResponseUtil.getResponse();
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\""
|
||||
+ "elevateword.csv" + "\"");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + "elevateword.csv" + "\"");
|
||||
|
||||
try (Writer writer = new BufferedWriter(new OutputStreamWriter(
|
||||
response.getOutputStream(), crawlerProperties.getProperty(
|
||||
try (Writer writer =
|
||||
new BufferedWriter(new OutputStreamWriter(response.getOutputStream(), crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8)))) {
|
||||
suggestElevateWordService.exportCsv(writer);
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to export data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_export_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_export_data");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -248,11 +228,8 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
FileOutputStream fos = null;
|
||||
final byte[] b = new byte[20];
|
||||
try {
|
||||
tempFile = File
|
||||
.createTempFile("suggestelevateword-import-", ".csv");
|
||||
is = new BufferedInputStream(
|
||||
suggestElevateWordForm.suggestElevateWordFile
|
||||
.getInputStream());
|
||||
tempFile = File.createTempFile("suggestelevateword-import-", ".csv");
|
||||
is = new BufferedInputStream(suggestElevateWordForm.suggestElevateWordFile.getInputStream());
|
||||
is.mark(20);
|
||||
if (is.read(b, 0, 20) <= 0) {
|
||||
throw new FessSystemException("no import data.");
|
||||
|
@ -265,8 +242,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
log.warn("Could not delete " + tempFile.getAbsolutePath());
|
||||
}
|
||||
log.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
} finally {
|
||||
IOUtils.closeQuietly(is);
|
||||
IOUtils.closeQuietly(fos);
|
||||
|
@ -275,31 +251,24 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
final File oFile = tempFile;
|
||||
try {
|
||||
final String head = new String(b, Constants.UTF_8);
|
||||
if (!(head.startsWith("\"SuggestWord\"") || head
|
||||
.startsWith("SuggestWord"))) {
|
||||
log.error("Unknown file: "
|
||||
+ suggestElevateWordForm.suggestElevateWordFile);
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.unknown_import_file");
|
||||
if (!(head.startsWith("\"SuggestWord\"") || head.startsWith("SuggestWord"))) {
|
||||
log.error("Unknown file: " + suggestElevateWordForm.suggestElevateWordFile);
|
||||
throw new SSCActionMessagesException("errors.unknown_import_file");
|
||||
}
|
||||
final String enc = crawlerProperties.getProperty(
|
||||
Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
final String enc = crawlerProperties.getProperty(Constants.CSV_FILE_ENCODING_PROPERTY, Constants.UTF_8);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new BufferedReader(new InputStreamReader(
|
||||
new FileInputStream(oFile), enc));
|
||||
reader = new BufferedReader(new InputStreamReader(new FileInputStream(oFile), enc));
|
||||
suggestElevateWordService.importCsv(reader);
|
||||
} catch (final Exception e) {
|
||||
log.error("Failed to import data.", e);
|
||||
throw new FessSystemException("Failed to import data.",
|
||||
e);
|
||||
throw new FessSystemException("Failed to import data.", e);
|
||||
} finally {
|
||||
if (!oFile.delete()) {
|
||||
log.warn("Could not delete "
|
||||
+ oFile.getAbsolutePath());
|
||||
log.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
IOUtils.closeQuietly(reader);
|
||||
suggestHelper.storeAllElevateWords();
|
||||
|
@ -316,8 +285,7 @@ public class SuggestElevateWordAction extends BsSuggestElevateWordAction {
|
|||
log.warn("Could not delete " + oFile.getAbsolutePath());
|
||||
}
|
||||
log.error("Failed to import data.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_import_data");
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_import_data");
|
||||
}
|
||||
SAStrutsUtil.addSessionMessage("success.upload_suggest_elevate_word");
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class SystemAction implements Serializable {
|
||||
private static final String STARTING_CRAWL_PROCESS = "startingCrawlProcess";
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(SystemAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(SystemAction.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -88,8 +87,7 @@ public class SystemAction implements Serializable {
|
|||
protected String showIndex(final boolean redirect) {
|
||||
final Map<String, DynamicProperties> groupPropMap = new HashMap<String, DynamicProperties>();
|
||||
for (final String groupName : solrGroupManager.getSolrGroupNames()) {
|
||||
final DynamicProperties props = ComponentUtil
|
||||
.getSolrGroupProperties(groupName);
|
||||
final DynamicProperties props = ComponentUtil.getSolrGroupProperties(groupName);
|
||||
if (props != null) {
|
||||
groupPropMap.put(groupName, props);
|
||||
}
|
||||
|
@ -106,16 +104,12 @@ public class SystemAction implements Serializable {
|
|||
map.put("serverName", names[1]);
|
||||
final DynamicProperties props = groupPropMap.get(names[0]);
|
||||
if (props != null) {
|
||||
String status = props
|
||||
.getProperty(StatusPolicyImpl.STATUS_PREFIX
|
||||
+ names[1]);
|
||||
String status = props.getProperty(StatusPolicyImpl.STATUS_PREFIX + names[1]);
|
||||
if (StringUtil.isBlank(status)) {
|
||||
status = StatusPolicyImpl.ACTIVE;
|
||||
}
|
||||
map.put("status", status);
|
||||
String index = props
|
||||
.getProperty(StatusPolicyImpl.INDEX_PREFIX
|
||||
+ names[1]);
|
||||
String index = props.getProperty(StatusPolicyImpl.INDEX_PREFIX + names[1]);
|
||||
if (StringUtil.isBlank(index)) {
|
||||
index = StatusPolicyImpl.READY;
|
||||
}
|
||||
|
@ -128,24 +122,18 @@ public class SystemAction implements Serializable {
|
|||
}
|
||||
}
|
||||
// select group status
|
||||
systemForm.currentServerForSelect = solrProperties
|
||||
.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup selectSolrGroup = solrGroupManager
|
||||
.getSolrGroup(systemForm.currentServerForSelect);
|
||||
if (selectSolrGroup != null
|
||||
&& selectSolrGroup.isActive(QueryType.QUERY)) {
|
||||
systemForm.currentServerForSelect = solrProperties.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup selectSolrGroup = solrGroupManager.getSolrGroup(systemForm.currentServerForSelect);
|
||||
if (selectSolrGroup != null && selectSolrGroup.isActive(QueryType.QUERY)) {
|
||||
systemForm.currentServerStatusForSelect = Constants.ACTIVE;
|
||||
} else {
|
||||
systemForm.currentServerStatusForSelect = Constants.INACTIVE;
|
||||
}
|
||||
|
||||
// update group status
|
||||
systemForm.currentServerForUpdate = solrProperties
|
||||
.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup updateSolrGroup = solrGroupManager
|
||||
.getSolrGroup(systemForm.currentServerForUpdate);
|
||||
if (updateSolrGroup != null
|
||||
&& updateSolrGroup.isActive(QueryType.QUERY)) {
|
||||
systemForm.currentServerForUpdate = solrProperties.getProperty(SolrLibConstants.SELECT_GROUP);
|
||||
final SolrGroup updateSolrGroup = solrGroupManager.getSolrGroup(systemForm.currentServerForUpdate);
|
||||
if (updateSolrGroup != null && updateSolrGroup.isActive(QueryType.QUERY)) {
|
||||
systemForm.currentServerStatusForUpdate = Constants.ACTIVE;
|
||||
} else {
|
||||
systemForm.currentServerStatusForUpdate = Constants.INACTIVE;
|
||||
|
@ -170,8 +158,7 @@ public class SystemAction implements Serializable {
|
|||
// load solr group properties
|
||||
final Map<String, DynamicProperties> groupPropMap = new HashMap<String, DynamicProperties>();
|
||||
for (final String groupName : solrGroupManager.getSolrGroupNames()) {
|
||||
final DynamicProperties props = ComponentUtil
|
||||
.getSolrGroupProperties(groupName);
|
||||
final DynamicProperties props = ComponentUtil.getSolrGroupProperties(groupName);
|
||||
if (props != null) {
|
||||
groupPropMap.put(groupName, props);
|
||||
}
|
||||
|
@ -180,12 +167,10 @@ public class SystemAction implements Serializable {
|
|||
try {
|
||||
// server status
|
||||
for (final Map<String, String> statusMap : systemForm.serverStatusList) {
|
||||
for (final Map.Entry<String, String> entry : statusMap
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, String> entry : statusMap.entrySet()) {
|
||||
final String[] names = entry.getKey().split("/");
|
||||
if (names.length == 3) {
|
||||
final DynamicProperties props = groupPropMap
|
||||
.get(names[0]);
|
||||
final DynamicProperties props = groupPropMap.get(names[0]);
|
||||
if (props != null) {
|
||||
final String value = entry.getValue();
|
||||
String key;
|
||||
|
@ -194,16 +179,13 @@ public class SystemAction implements Serializable {
|
|||
} else if ("index".equals(names[2])) {
|
||||
key = StatusPolicyImpl.INDEX_PREFIX + names[1];
|
||||
} else {
|
||||
logger.error("Invalid parameter: "
|
||||
+ entry.getKey());
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_update_solr_params");
|
||||
logger.error("Invalid parameter: " + entry.getKey());
|
||||
throw new SSCActionMessagesException("errors.failed_to_update_solr_params");
|
||||
}
|
||||
props.setProperty(key, value);
|
||||
props.store();
|
||||
} else {
|
||||
logger.warn("Solr group properties is not found: "
|
||||
+ names[0]);
|
||||
logger.warn("Solr group properties is not found: " + names[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -212,8 +194,7 @@ public class SystemAction implements Serializable {
|
|||
SAStrutsUtil.addSessionMessage("success.update_solr_params");
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update solr parameters.", e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_update_solr_params", e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_update_solr_params", e);
|
||||
}
|
||||
|
||||
return showIndex(true);
|
||||
|
@ -223,26 +204,21 @@ public class SystemAction implements Serializable {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "index")
|
||||
public String start() {
|
||||
final String groupName = solrProperties
|
||||
.getProperty(SolrLibConstants.UPDATE_GROUP);
|
||||
final String groupName = solrProperties.getProperty(SolrLibConstants.UPDATE_GROUP);
|
||||
final SolrGroup solrGroup = solrGroupManager.getSolrGroup(groupName);
|
||||
if (solrGroup != null) {
|
||||
if (!jobHelper.isCrawlProcessRunning()) {
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService
|
||||
.getCrawloerJobList();
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService.getCrawloerJobList();
|
||||
for (final ScheduledJob scheduledJob : scheduledJobList) {
|
||||
scheduledJob.start();
|
||||
}
|
||||
SAStrutsUtil.addSessionMessage("success.start_crawl_process");
|
||||
RequestUtil.getRequest().getSession()
|
||||
.setAttribute(STARTING_CRAWL_PROCESS, Boolean.TRUE);
|
||||
RequestUtil.getRequest().getSession().setAttribute(STARTING_CRAWL_PROCESS, Boolean.TRUE);
|
||||
} else {
|
||||
SAStrutsUtil
|
||||
.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
SAStrutsUtil.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
}
|
||||
} else {
|
||||
SAStrutsUtil
|
||||
.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
SAStrutsUtil.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
}
|
||||
return showIndex(true);
|
||||
}
|
||||
|
@ -254,8 +230,7 @@ public class SystemAction implements Serializable {
|
|||
if (StringUtil.isNotBlank(systemForm.sessionId)) {
|
||||
jobHelper.destroyCrawlerProcess(systemForm.sessionId);
|
||||
} else {
|
||||
for (final String sessionId : jobHelper
|
||||
.getRunningSessionIdSet()) {
|
||||
for (final String sessionId : jobHelper.getRunningSessionIdSet()) {
|
||||
jobHelper.destroyCrawlerProcess(sessionId);
|
||||
}
|
||||
}
|
||||
|
@ -273,10 +248,8 @@ public class SystemAction implements Serializable {
|
|||
webManagementHelper.start(systemForm.solrInstanceName);
|
||||
SAStrutsUtil.addSessionMessage("success.starting_solr_instance");
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to start a solr instance: "
|
||||
+ systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_start_solr_instance");
|
||||
logger.error("Failed to start a solr instance: " + systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_start_solr_instance");
|
||||
}
|
||||
return showIndex(true);
|
||||
}
|
||||
|
@ -288,10 +261,8 @@ public class SystemAction implements Serializable {
|
|||
webManagementHelper.stop(systemForm.solrInstanceName);
|
||||
SAStrutsUtil.addSessionMessage("success.stopping_solr_instance");
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to stop a solr instance: "
|
||||
+ systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_stop_solr_instance");
|
||||
logger.error("Failed to stop a solr instance: " + systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_stop_solr_instance");
|
||||
}
|
||||
return showIndex(true);
|
||||
}
|
||||
|
@ -303,17 +274,14 @@ public class SystemAction implements Serializable {
|
|||
webManagementHelper.reload(systemForm.solrInstanceName);
|
||||
SAStrutsUtil.addSessionMessage("success.reloading_solr_instance");
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to reload a solr instance: "
|
||||
+ systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_reload_solr_instance");
|
||||
logger.error("Failed to reload a solr instance: " + systemForm.solrInstanceName, e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_reload_solr_instance");
|
||||
}
|
||||
return showIndex(true);
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getSolrInstanceList() {
|
||||
final List<String> solrInstanceNameList = webManagementHelper
|
||||
.getSolrInstanceNameList();
|
||||
final List<String> solrInstanceNameList = webManagementHelper.getSolrInstanceNameList();
|
||||
final List<Map<String, String>> solrInstanceList = new ArrayList<Map<String, String>>();
|
||||
for (final String solrInstanceName : solrInstanceNameList) {
|
||||
final Map<String, String> map = new HashMap<String, String>();
|
||||
|
|
|
@ -69,13 +69,11 @@ public class SystemInfoAction implements Serializable {
|
|||
envItems.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
for (final Map.Entry<Object, Object> entry : System.getProperties()
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
|
||||
propItems.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
for (final Map.Entry<Object, Object> entry : crawlerProperties
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> entry : crawlerProperties.entrySet()) {
|
||||
fessPropItems.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
|
||||
|
@ -92,11 +90,9 @@ public class SystemInfoAction implements Serializable {
|
|||
bugReportItems.add(createPropItem("user.country"));
|
||||
bugReportItems.add(createPropItem("user.language"));
|
||||
bugReportItems.add(createPropItem("user.timezone"));
|
||||
for (final Map.Entry<Object, Object> entry : crawlerProperties
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<Object, Object> entry : crawlerProperties.entrySet()) {
|
||||
if (isBugReportTarget(entry.getKey())) {
|
||||
bugReportItems
|
||||
.add(createItem(entry.getKey(), entry.getValue()));
|
||||
bugReportItems.add(createItem(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,13 +110,10 @@ public class SystemInfoAction implements Serializable {
|
|||
return createItem(key, System.getProperty(key));
|
||||
}
|
||||
|
||||
private Map<String, String> createItem(final Object label,
|
||||
final Object value) {
|
||||
private Map<String, String> createItem(final Object label, final Object value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
map.put(Constants.ITEM_LABEL, label != null ? label.toString()
|
||||
: StringUtil.EMPTY);
|
||||
map.put(Constants.ITEM_VALUE, value != null ? value.toString()
|
||||
: StringUtil.EMPTY);
|
||||
map.put(Constants.ITEM_LABEL, label != null ? label.toString() : StringUtil.EMPTY);
|
||||
map.put(Constants.ITEM_VALUE, value != null ? value.toString() : StringUtil.EMPTY);
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -48,8 +48,7 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(WebAuthenticationAction.class);
|
||||
private static final Log log = LogFactory.getLog(WebAuthenticationAction.class);
|
||||
|
||||
@Resource
|
||||
protected WebCrawlingConfigService webCrawlingConfigService;
|
||||
|
@ -64,18 +63,13 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
@Override
|
||||
protected void loadWebAuthentication() {
|
||||
|
||||
final WebAuthentication webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webAuthenticationForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(webAuthentication, webAuthenticationForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(webAuthentication, webAuthenticationForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
if ("-1".equals(webAuthenticationForm.port)) {
|
||||
webAuthenticationForm.port = StringUtil.EMPTY;
|
||||
}
|
||||
|
@ -87,13 +81,10 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (webAuthenticationForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webAuthenticationForm.id });
|
||||
}
|
||||
} else {
|
||||
webAuthentication = new WebAuthentication();
|
||||
|
@ -105,8 +96,7 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
if (StringUtil.isBlank(webAuthenticationForm.port)) {
|
||||
webAuthenticationForm.port = "-1";
|
||||
}
|
||||
FessBeans.copy(webAuthenticationForm, webAuthentication)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(webAuthenticationForm, webAuthentication).excludesCommonColumns().execute();
|
||||
|
||||
return webAuthentication;
|
||||
}
|
||||
|
@ -116,19 +106,15 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final WebAuthentication webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webAuthenticationForm.id });
|
||||
}
|
||||
|
||||
// webAuthenticationService.delete(webAuthentication);
|
||||
|
@ -145,47 +131,42 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDisplayCreateLink() {
|
||||
return !webCrawlingConfigService.getAllWebCrawlingConfigList(false,
|
||||
false, false, null).isEmpty();
|
||||
return !webCrawlingConfigService.getAllWebCrawlingConfigList(false, false, false, null).isEmpty();
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getWebCrawlingConfigItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
final List<WebCrawlingConfig> webCrawlingConfigList = webCrawlingConfigService
|
||||
.getAllWebCrawlingConfigList(false, false, false, null);
|
||||
final List<WebCrawlingConfig> webCrawlingConfigList =
|
||||
webCrawlingConfigService.getAllWebCrawlingConfigList(false, false, false, null);
|
||||
for (final WebCrawlingConfig webCrawlingConfig : webCrawlingConfigList) {
|
||||
items.add(createItem(webCrawlingConfig.getName(), webCrawlingConfig
|
||||
.getId().toString()));
|
||||
items.add(createItem(webCrawlingConfig.getName(), webCrawlingConfig.getId().toString()));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getProtocolSchemeItems() {
|
||||
final List<Map<String, String>> items = new ArrayList<Map<String, String>>();
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.web_authentication_scheme_basic"), Constants.BASIC));
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.web_authentication_scheme_digest"), Constants.DIGEST));
|
||||
items.add(createItem(MessageResourcesUtil.getMessage(RequestUtil
|
||||
.getRequest().getLocale(),
|
||||
"labels.web_authentication_scheme_ntlm"), Constants.NTLM));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.web_authentication_scheme_basic"),
|
||||
Constants.BASIC));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.web_authentication_scheme_digest"),
|
||||
Constants.DIGEST));
|
||||
items.add(createItem(
|
||||
MessageResourcesUtil.getMessage(RequestUtil.getRequest().getLocale(), "labels.web_authentication_scheme_ntlm"),
|
||||
Constants.NTLM));
|
||||
return items;
|
||||
}
|
||||
|
||||
protected Map<String, String> createItem(final String label,
|
||||
final String value) {
|
||||
protected Map<String, String> createItem(final String label, final String value) {
|
||||
final Map<String, String> map = new HashMap<String, String>(2);
|
||||
map.put("label", label);
|
||||
map.put("value", value);
|
||||
|
|
|
@ -44,8 +44,7 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(WebCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(WebCrawlingConfigAction.class);
|
||||
|
||||
@Resource
|
||||
protected RoleTypeService roleTypeService;
|
||||
|
@ -66,24 +65,17 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
@Override
|
||||
protected void loadWebCrawlingConfig() {
|
||||
|
||||
final CrawlingConfig webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
final CrawlingConfig webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
FessBeans.copy(webCrawlingConfig, webCrawlingConfigForm)
|
||||
.commonColumnDateConverter().excludes("searchParams", "mode")
|
||||
.execute();
|
||||
FessBeans.copy(webCrawlingConfig, webCrawlingConfigForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
|
||||
// normalize boost
|
||||
if (webCrawlingConfigForm.boost != null
|
||||
&& webCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
webCrawlingConfigForm.boost = webCrawlingConfigForm.boost
|
||||
.substring(0, webCrawlingConfigForm.boost.indexOf('.'));
|
||||
if (webCrawlingConfigForm.boost != null && webCrawlingConfigForm.boost.indexOf('.') > 0) {
|
||||
webCrawlingConfigForm.boost = webCrawlingConfigForm.boost.substring(0, webCrawlingConfigForm.boost.indexOf('.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,13 +85,10 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
final String username = systemHelper.getUsername();
|
||||
final LocalDateTime currentTime = systemHelper.getCurrentTime();
|
||||
if (webCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webCrawlingConfigForm.id });
|
||||
}
|
||||
} else {
|
||||
webCrawlingConfig = new WebCrawlingConfig();
|
||||
|
@ -108,8 +97,7 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
}
|
||||
webCrawlingConfig.setUpdatedBy(username);
|
||||
webCrawlingConfig.setUpdatedTime(currentTime);
|
||||
FessBeans.copy(webCrawlingConfigForm, webCrawlingConfig)
|
||||
.excludesCommonColumns().execute();
|
||||
FessBeans.copy(webCrawlingConfigForm, webCrawlingConfig).excludesCommonColumns().execute();
|
||||
|
||||
return webCrawlingConfig;
|
||||
}
|
||||
|
@ -118,19 +106,15 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (webCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
throw new SSCActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
throw new SSCActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { webCrawlingConfigForm.id });
|
||||
}
|
||||
|
||||
failureUrlService.deleteByConfigId(webCrawlingConfig.getConfigId());
|
||||
|
@ -149,12 +133,10 @@ public class WebCrawlingConfigAction extends BsWebCrawlingConfigAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class WizardAction implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(WizardAction.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(WizardAction.class);
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
|
@ -95,25 +94,20 @@ public class WizardAction implements Serializable {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "crawlingConfigForm")
|
||||
public String crawlingConfig() {
|
||||
final String name = crawlingConfigInternal(
|
||||
wizardForm.crawlingConfigName, wizardForm.crawlingConfigPath);
|
||||
SAStrutsUtil.addSessionMessage(
|
||||
"success.create_crawling_config_at_wizard", name);
|
||||
final String name = crawlingConfigInternal(wizardForm.crawlingConfigName, wizardForm.crawlingConfigPath);
|
||||
SAStrutsUtil.addSessionMessage("success.create_crawling_config_at_wizard", name);
|
||||
return "crawlingConfigForm?redirect=true";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "crawlingConfigForm")
|
||||
public String crawlingConfigNext() {
|
||||
final String name = crawlingConfigInternal(
|
||||
wizardForm.crawlingConfigName, wizardForm.crawlingConfigPath);
|
||||
SAStrutsUtil.addSessionMessage(
|
||||
"success.create_crawling_config_at_wizard", name);
|
||||
final String name = crawlingConfigInternal(wizardForm.crawlingConfigName, wizardForm.crawlingConfigPath);
|
||||
SAStrutsUtil.addSessionMessage("success.create_crawling_config_at_wizard", name);
|
||||
return "startCrawlingForm?redirect=true";
|
||||
}
|
||||
|
||||
protected String crawlingConfigInternal(final String crawlingConfigName,
|
||||
final String crawlingConfigPath) {
|
||||
protected String crawlingConfigInternal(final String crawlingConfigName, final String crawlingConfigPath) {
|
||||
|
||||
String configName = crawlingConfigName;
|
||||
String configPath = crawlingConfigPath.trim();
|
||||
|
@ -133,10 +127,8 @@ public class WizardAction implements Serializable {
|
|||
buf.append(c);
|
||||
} else {
|
||||
try {
|
||||
buf.append(URLEncoder.encode(String.valueOf(c),
|
||||
Constants.UTF_8));
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
}
|
||||
buf.append(URLEncoder.encode(String.valueOf(c), Constants.UTF_8));
|
||||
} catch (final UnsupportedEncodingException e) {}
|
||||
}
|
||||
}
|
||||
configPath = convertCrawlingPath(buf.toString());
|
||||
|
@ -155,33 +147,21 @@ public class WizardAction implements Serializable {
|
|||
if (StringUtil.isNotBlank(wizardForm.depth)) {
|
||||
wConfig.setDepth(Integer.parseInt(wizardForm.depth));
|
||||
}
|
||||
wConfig.setExcludedDocUrls(getDefaultString(
|
||||
"default.config.web.excludedDocUrls", StringUtil.EMPTY));
|
||||
wConfig.setExcludedUrls(getDefaultString(
|
||||
"default.config.web.excludedUrls", StringUtil.EMPTY));
|
||||
wConfig.setIncludedDocUrls(getDefaultString(
|
||||
"default.config.web.includedDocUrls", StringUtil.EMPTY));
|
||||
wConfig.setIncludedUrls(getDefaultString(
|
||||
"default.config.web.includedUrls", StringUtil.EMPTY));
|
||||
wConfig.setIntervalTime(getDefaultInteger(
|
||||
"default.config.web.intervalTime",
|
||||
Constants.DEFAULT_INTERVAL_TIME_FOR_WEB));
|
||||
wConfig.setExcludedDocUrls(getDefaultString("default.config.web.excludedDocUrls", StringUtil.EMPTY));
|
||||
wConfig.setExcludedUrls(getDefaultString("default.config.web.excludedUrls", StringUtil.EMPTY));
|
||||
wConfig.setIncludedDocUrls(getDefaultString("default.config.web.includedDocUrls", StringUtil.EMPTY));
|
||||
wConfig.setIncludedUrls(getDefaultString("default.config.web.includedUrls", StringUtil.EMPTY));
|
||||
wConfig.setIntervalTime(getDefaultInteger("default.config.web.intervalTime", Constants.DEFAULT_INTERVAL_TIME_FOR_WEB));
|
||||
if (StringUtil.isNotBlank(wizardForm.maxAccessCount)) {
|
||||
wConfig.setMaxAccessCount(Long
|
||||
.parseLong(wizardForm.maxAccessCount));
|
||||
wConfig.setMaxAccessCount(Long.parseLong(wizardForm.maxAccessCount));
|
||||
}
|
||||
wConfig.setName(configName);
|
||||
wConfig.setNumOfThread(getDefaultInteger(
|
||||
"default.config.web.numOfThread",
|
||||
Constants.DEFAULT_NUM_OF_THREAD_FOR_WEB));
|
||||
wConfig.setSortOrder(getDefaultInteger(
|
||||
"default.config.web.sortOrder", 1));
|
||||
wConfig.setNumOfThread(getDefaultInteger("default.config.web.numOfThread", Constants.DEFAULT_NUM_OF_THREAD_FOR_WEB));
|
||||
wConfig.setSortOrder(getDefaultInteger("default.config.web.sortOrder", 1));
|
||||
wConfig.setUpdatedBy(username);
|
||||
wConfig.setUpdatedTime(now);
|
||||
wConfig.setUrls(configPath);
|
||||
wConfig.setUserAgent(getDefaultString(
|
||||
"default.config.web.userAgent",
|
||||
ComponentUtil.getUserAgentName()));
|
||||
wConfig.setUserAgent(getDefaultString("default.config.web.userAgent", ComponentUtil.getUserAgentName()));
|
||||
|
||||
webCrawlingConfigService.store(wConfig);
|
||||
|
||||
|
@ -195,29 +175,17 @@ public class WizardAction implements Serializable {
|
|||
if (StringUtil.isNotBlank(wizardForm.depth)) {
|
||||
fConfig.setDepth(Integer.parseInt(wizardForm.depth));
|
||||
}
|
||||
fConfig.setExcludedDocPaths(getDefaultString(
|
||||
"default.config.file.excludedDocPaths",
|
||||
StringUtil.EMPTY));
|
||||
fConfig.setExcludedPaths(getDefaultString(
|
||||
"default.config.file.excludedPaths", StringUtil.EMPTY));
|
||||
fConfig.setIncludedDocPaths(getDefaultString(
|
||||
"default.config.file.includedDocPaths",
|
||||
StringUtil.EMPTY));
|
||||
fConfig.setIncludedPaths(getDefaultString(
|
||||
"default.config.file.includedPaths", StringUtil.EMPTY));
|
||||
fConfig.setIntervalTime(getDefaultInteger(
|
||||
"default.config.file.intervalTime",
|
||||
Constants.DEFAULT_INTERVAL_TIME_FOR_FS));
|
||||
fConfig.setExcludedDocPaths(getDefaultString("default.config.file.excludedDocPaths", StringUtil.EMPTY));
|
||||
fConfig.setExcludedPaths(getDefaultString("default.config.file.excludedPaths", StringUtil.EMPTY));
|
||||
fConfig.setIncludedDocPaths(getDefaultString("default.config.file.includedDocPaths", StringUtil.EMPTY));
|
||||
fConfig.setIncludedPaths(getDefaultString("default.config.file.includedPaths", StringUtil.EMPTY));
|
||||
fConfig.setIntervalTime(getDefaultInteger("default.config.file.intervalTime", Constants.DEFAULT_INTERVAL_TIME_FOR_FS));
|
||||
if (StringUtil.isNotBlank(wizardForm.maxAccessCount)) {
|
||||
fConfig.setMaxAccessCount(Long
|
||||
.parseLong(wizardForm.maxAccessCount));
|
||||
fConfig.setMaxAccessCount(Long.parseLong(wizardForm.maxAccessCount));
|
||||
}
|
||||
fConfig.setName(configName);
|
||||
fConfig.setNumOfThread(getDefaultInteger(
|
||||
"default.config.file.numOfThread",
|
||||
Constants.DEFAULT_NUM_OF_THREAD_FOR_FS));
|
||||
fConfig.setSortOrder(getDefaultInteger(
|
||||
"default.config.file.sortOrder", 1));
|
||||
fConfig.setNumOfThread(getDefaultInteger("default.config.file.numOfThread", Constants.DEFAULT_NUM_OF_THREAD_FOR_FS));
|
||||
fConfig.setSortOrder(getDefaultInteger("default.config.file.sortOrder", 1));
|
||||
fConfig.setUpdatedBy(username);
|
||||
fConfig.setUpdatedTime(now);
|
||||
fConfig.setPaths(configPath);
|
||||
|
@ -226,22 +194,17 @@ public class WizardAction implements Serializable {
|
|||
}
|
||||
return configName;
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to create crawling config: "
|
||||
+ wizardForm.crawlingConfigPath, e);
|
||||
throw new SSCActionMessagesException(e,
|
||||
"errors.failed_to_create_crawling_config_at_wizard",
|
||||
wizardForm.crawlingConfigPath);
|
||||
logger.error("Failed to create crawling config: " + wizardForm.crawlingConfigPath, e);
|
||||
throw new SSCActionMessagesException(e, "errors.failed_to_create_crawling_config_at_wizard", wizardForm.crawlingConfigPath);
|
||||
}
|
||||
}
|
||||
|
||||
protected Integer getDefaultInteger(final String key,
|
||||
final Integer defaultValue) {
|
||||
protected Integer getDefaultInteger(final String key, final Integer defaultValue) {
|
||||
final String value = crawlerProperties.getProperty(key);
|
||||
if (value != null) {
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (final NumberFormatException e) {
|
||||
}
|
||||
} catch (final NumberFormatException e) {}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
@ -251,14 +214,12 @@ public class WizardAction implements Serializable {
|
|||
if (value != null) {
|
||||
try {
|
||||
return Long.parseLong(value);
|
||||
} catch (final NumberFormatException e) {
|
||||
}
|
||||
} catch (final NumberFormatException e) {}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
protected String getDefaultString(final String key,
|
||||
final String defaultValue) {
|
||||
protected String getDefaultString(final String key, final String defaultValue) {
|
||||
final String value = crawlerProperties.getProperty(key);
|
||||
if (value != null) {
|
||||
return value;
|
||||
|
@ -275,8 +236,7 @@ public class WizardAction implements Serializable {
|
|||
}
|
||||
|
||||
protected String convertCrawlingPath(final String path) {
|
||||
if (path.startsWith("http:") || path.startsWith("https:")
|
||||
|| path.startsWith("smb:")) {
|
||||
if (path.startsWith("http:") || path.startsWith("https:") || path.startsWith("smb:")) {
|
||||
return path;
|
||||
}
|
||||
|
||||
|
@ -304,8 +264,7 @@ public class WizardAction implements Serializable {
|
|||
@Execute(validator = false)
|
||||
public String startCrawling() {
|
||||
if (!jobHelper.isCrawlProcessRunning()) {
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService
|
||||
.getCrawloerJobList();
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService.getCrawloerJobList();
|
||||
for (final ScheduledJob scheduledJob : scheduledJobList) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -316,8 +275,7 @@ public class WizardAction implements Serializable {
|
|||
}
|
||||
SAStrutsUtil.addSessionMessage("success.start_crawl_process");
|
||||
} else {
|
||||
SAStrutsUtil
|
||||
.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
SAStrutsUtil.addSessionMessage("success.failed_to_start_crawl_process");
|
||||
}
|
||||
return "../system/index?redirect=true";
|
||||
}
|
||||
|
|
|
@ -74,12 +74,10 @@ public class SynonymAction {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
synonymItemItems = synonymService.getSynonymList(synonymForm.dictId,
|
||||
synonymPager);
|
||||
synonymItemItems = synonymService.getSynonymList(synonymForm.dictId, synonymPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(synonymPager, synonymForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(synonymPager, synonymForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?dictId=" + synonymForm.dictId + "&redirect=true";
|
||||
|
@ -98,8 +96,7 @@ public class SynonymAction {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(synonymForm.pageNumber)) {
|
||||
try {
|
||||
synonymPager.setCurrentPageNumber(Integer
|
||||
.parseInt(synonymForm.pageNumber));
|
||||
synonymPager.setCurrentPageNumber(Integer.parseInt(synonymForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + synonymForm.pageNumber, e);
|
||||
|
@ -112,8 +109,7 @@ public class SynonymAction {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(synonymForm.searchParams, synonymPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(synonymForm.searchParams, synonymPager).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -140,8 +136,7 @@ public class SynonymAction {
|
|||
public String confirmpage() {
|
||||
if (synonymForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
synonymForm.crudMode });
|
||||
new Object[] { CommonConstants.CONFIRM_MODE, synonymForm.crudMode });
|
||||
}
|
||||
|
||||
loadSynonym();
|
||||
|
@ -163,9 +158,7 @@ public class SynonymAction {
|
|||
@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 });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, synonymForm.crudMode });
|
||||
}
|
||||
|
||||
loadSynonym();
|
||||
|
@ -200,8 +193,7 @@ public class SynonymAction {
|
|||
public String deletepage() {
|
||||
if (synonymForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
synonymForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, synonymForm.crudMode });
|
||||
}
|
||||
|
||||
loadSynonym();
|
||||
|
@ -235,12 +227,10 @@ public class SynonymAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,12 +250,10 @@ public class SynonymAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,19 +262,16 @@ public class SynonymAction {
|
|||
public String delete() {
|
||||
if (synonymForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
synonymForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, synonymForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SynonymItem synonymItem = synonymService.getSynonym(
|
||||
synonymForm.dictId, createKeyMap());
|
||||
final SynonymItem synonymItem = synonymService.getSynonym(synonymForm.dictId, createKeyMap());
|
||||
if (synonymItem == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { synonymForm.id });
|
||||
new Object[] { synonymForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -301,23 +286,19 @@ public class SynonymAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
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);
|
||||
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
|
||||
if (synonymFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.synonym_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
|
||||
}
|
||||
filename = synonymFile.getSimpleName();
|
||||
return "download.jsp";
|
||||
|
@ -326,17 +307,14 @@ public class SynonymAction {
|
|||
@Token(save = true, validate = true)
|
||||
@Execute(validator = false, input = "downloadpage")
|
||||
public String download() {
|
||||
final SynonymFile synonymFile = synonymService
|
||||
.getSynonymFile(synonymForm.dictId);
|
||||
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
|
||||
if (synonymFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.synonym_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
|
||||
}
|
||||
try (InputStream in = synonymFile.getInputStream()) {
|
||||
ResponseUtil.download(synonymFile.getSimpleName(), in);
|
||||
} catch (final IOException e) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_download_synonym_file");
|
||||
throw new SSCActionMessagesException("errors.failed_to_download_synonym_file");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -345,11 +323,9 @@ public class SynonymAction {
|
|||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "uploadpage")
|
||||
public String uploadpage() {
|
||||
final SynonymFile synonymFile = synonymService
|
||||
.getSynonymFile(synonymForm.dictId);
|
||||
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
|
||||
if (synonymFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.synonym_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.synonym_file_is_not_found");
|
||||
}
|
||||
filename = synonymFile.getName();
|
||||
return "upload.jsp";
|
||||
|
@ -358,17 +334,14 @@ public class SynonymAction {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "uploadpage")
|
||||
public String upload() {
|
||||
final SynonymFile synonymFile = synonymService
|
||||
.getSynonymFile(synonymForm.dictId);
|
||||
final SynonymFile synonymFile = synonymService.getSynonymFile(synonymForm.dictId);
|
||||
if (synonymFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.synonym_file_is_not_found");
|
||||
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");
|
||||
throw new SSCActionMessagesException("errors.failed_to_upload_synonym_file");
|
||||
}
|
||||
|
||||
SAStrutsUtil.addSessionMessage("success.upload_synonym_file");
|
||||
|
@ -378,13 +351,10 @@ public class SynonymAction {
|
|||
|
||||
protected void loadSynonym() {
|
||||
|
||||
final SynonymItem synonymItem = synonymService.getSynonym(
|
||||
synonymForm.dictId, createKeyMap());
|
||||
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 });
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { synonymForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -396,19 +366,16 @@ public class SynonymAction {
|
|||
protected SynonymItem createSynonym() {
|
||||
SynonymItem synonymItem;
|
||||
if (synonymForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
synonymItem = synonymService.getSynonym(synonymForm.dictId,
|
||||
createKeyMap());
|
||||
synonymItem = synonymService.getSynonym(synonymForm.dictId, createKeyMap());
|
||||
if (synonymItem == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { synonymForm.id });
|
||||
new Object[] { synonymForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
synonymItem = new SynonymItem(0, StringUtil.EMPTY_STRINGS,
|
||||
StringUtil.EMPTY_STRINGS);
|
||||
synonymItem = new SynonymItem(0, StringUtil.EMPTY_STRINGS, StringUtil.EMPTY_STRINGS);
|
||||
}
|
||||
|
||||
final String[] newInputs = splitLine(synonymForm.inputs);
|
||||
|
|
|
@ -72,12 +72,10 @@ public class UserDictAction {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
userDictItemItems = userDictService.getUserDictList(
|
||||
userDictForm.dictId, userDictPager);
|
||||
userDictItemItems = userDictService.getUserDictList(userDictForm.dictId, userDictPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(userDictPager, userDictForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(userDictPager, userDictForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?dictId=" + userDictForm.dictId + "&redirect=true";
|
||||
|
@ -96,8 +94,7 @@ public class UserDictAction {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(userDictForm.pageNumber)) {
|
||||
try {
|
||||
userDictPager.setCurrentPageNumber(Integer
|
||||
.parseInt(userDictForm.pageNumber));
|
||||
userDictPager.setCurrentPageNumber(Integer.parseInt(userDictForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + userDictForm.pageNumber, e);
|
||||
|
@ -110,8 +107,7 @@ public class UserDictAction {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(userDictForm.searchParams, userDictPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(userDictForm.searchParams, userDictPager).excludes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -137,9 +133,8 @@ public class UserDictAction {
|
|||
@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 });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
userDictForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserDict();
|
||||
|
@ -161,9 +156,7 @@ public class UserDictAction {
|
|||
@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 });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, userDictForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserDict();
|
||||
|
@ -198,8 +191,7 @@ public class UserDictAction {
|
|||
public String deletepage() {
|
||||
if (userDictForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
userDictForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, userDictForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserDict();
|
||||
|
@ -233,12 +225,10 @@ public class UserDictAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,12 +248,10 @@ public class UserDictAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,19 +260,16 @@ public class UserDictAction {
|
|||
public String delete() {
|
||||
if (userDictForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
userDictForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, userDictForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final UserDictItem userDictItem = userDictService.getUserDict(
|
||||
userDictForm.dictId, createKeyMap());
|
||||
final UserDictItem userDictItem = userDictService.getUserDict(userDictForm.dictId, createKeyMap());
|
||||
if (userDictItem == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { userDictForm.id });
|
||||
new Object[] { userDictForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -299,23 +284,19 @@ public class UserDictAction {
|
|||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(),
|
||||
e.getArgs());
|
||||
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");
|
||||
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);
|
||||
final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
|
||||
if (userdictFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.userdict_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
|
||||
}
|
||||
filename = userdictFile.getSimpleName();
|
||||
return "download.jsp";
|
||||
|
@ -324,17 +305,14 @@ public class UserDictAction {
|
|||
@Token(save = true, validate = true)
|
||||
@Execute(validator = false, input = "downloadpage")
|
||||
public String download() {
|
||||
final UserDictFile userdictFile = userDictService
|
||||
.getUserDictFile(userDictForm.dictId);
|
||||
final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
|
||||
if (userdictFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.userdict_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
|
||||
}
|
||||
try (InputStream in = userdictFile.getInputStream()) {
|
||||
ResponseUtil.download(userdictFile.getSimpleName(), in);
|
||||
} catch (final IOException e) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.failed_to_download_userdict_file");
|
||||
throw new SSCActionMessagesException("errors.failed_to_download_userdict_file");
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -343,11 +321,9 @@ public class UserDictAction {
|
|||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "uploadpage")
|
||||
public String uploadpage() {
|
||||
final UserDictFile userdictFile = userDictService
|
||||
.getUserDictFile(userDictForm.dictId);
|
||||
final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
|
||||
if (userdictFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.userdict_file_is_not_found");
|
||||
throw new SSCActionMessagesException("errors.userdict_file_is_not_found");
|
||||
}
|
||||
filename = userdictFile.getName();
|
||||
return "upload.jsp";
|
||||
|
@ -356,17 +332,14 @@ public class UserDictAction {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "uploadpage")
|
||||
public String upload() {
|
||||
final UserDictFile userdictFile = userDictService
|
||||
.getUserDictFile(userDictForm.dictId);
|
||||
final UserDictFile userdictFile = userDictService.getUserDictFile(userDictForm.dictId);
|
||||
if (userdictFile == null) {
|
||||
throw new SSCActionMessagesException(
|
||||
"errors.userdict_file_is_not_found");
|
||||
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");
|
||||
throw new SSCActionMessagesException("errors.failed_to_upload_userdict_file");
|
||||
}
|
||||
|
||||
SAStrutsUtil.addSessionMessage("success.upload_userdict_file");
|
||||
|
@ -376,13 +349,10 @@ public class UserDictAction {
|
|||
|
||||
protected void loadUserDict() {
|
||||
|
||||
final UserDictItem userDictItem = userDictService.getUserDict(
|
||||
userDictForm.dictId, createKeyMap());
|
||||
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 });
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table", new Object[] { userDictForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -396,19 +366,16 @@ public class UserDictAction {
|
|||
protected UserDictItem createUserDict() {
|
||||
UserDictItem userDictItem;
|
||||
if (userDictForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
userDictItem = userDictService.getUserDict(userDictForm.dictId,
|
||||
createKeyMap());
|
||||
userDictItem = userDictService.getUserDict(userDictForm.dictId, createKeyMap());
|
||||
if (userDictItem == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { userDictForm.id });
|
||||
new Object[] { userDictForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
userDictItem = new UserDictItem(0, StringUtil.EMPTY,
|
||||
StringUtil.EMPTY, StringUtil.EMPTY, StringUtil.EMPTY);
|
||||
userDictItem = new UserDictItem(0, StringUtil.EMPTY, StringUtil.EMPTY, StringUtil.EMPTY, StringUtil.EMPTY);
|
||||
}
|
||||
|
||||
userDictItem.setNewToken(userDictForm.token);
|
||||
|
|
|
@ -27,7 +27,6 @@ public interface WebApiManager {
|
|||
|
||||
boolean matches(HttpServletRequest request);
|
||||
|
||||
void process(HttpServletRequest request, HttpServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException;
|
||||
void process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,16 +22,14 @@ import javax.servlet.http.HttpServletRequestWrapper;
|
|||
public class WebApiRequest extends HttpServletRequestWrapper {
|
||||
protected String servletPath;
|
||||
|
||||
public WebApiRequest(final HttpServletRequest request,
|
||||
final String servletPath) {
|
||||
public WebApiRequest(final HttpServletRequest request, final String servletPath) {
|
||||
super(request);
|
||||
this.servletPath = servletPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServletPath() {
|
||||
if (getQueryString() != null
|
||||
&& getQueryString().indexOf("SAStruts.method") != -1) {
|
||||
if (getQueryString() != null && getQueryString().indexOf("SAStruts.method") != -1) {
|
||||
return super.getServletPath();
|
||||
} else {
|
||||
return servletPath;
|
||||
|
|
|
@ -58,15 +58,13 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(JsonApiManager.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(JsonApiManager.class);
|
||||
|
||||
protected String jsonPathPrefix = "/json";
|
||||
|
||||
@Override
|
||||
public boolean matches(final HttpServletRequest request) {
|
||||
if (Constants.FALSE.equals(ComponentUtil.getCrawlerProperties()
|
||||
.getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(ComponentUtil.getCrawlerProperties().getProperty(Constants.WEB_API_JSON_PROPERTY, Constants.TRUE))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -75,46 +73,44 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void process(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
public void process(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException,
|
||||
ServletException {
|
||||
final String formatType = request.getParameter("type");
|
||||
switch (getFormatType(formatType)) {
|
||||
case SEARCH:
|
||||
processSearchRequest(request, response, chain);
|
||||
break;
|
||||
case LABEL:
|
||||
processLabelRequest(request, response, chain);
|
||||
break;
|
||||
case SUGGEST:
|
||||
processSuggestRequest(request, response, chain);
|
||||
break;
|
||||
case SPELLCHECK:
|
||||
processSpellCheckRequest(request, response, chain);
|
||||
break;
|
||||
case ANALYSIS:
|
||||
processAnalysisRequest(request, response, chain);
|
||||
break;
|
||||
case HOTSEARCHWORD:
|
||||
processHotSearchWordRequest(request, response, chain);
|
||||
break;
|
||||
case FAVORITE:
|
||||
processFavoriteRequest(request, response, chain);
|
||||
break;
|
||||
case FAVORITES:
|
||||
processFavoritesRequest(request, response, chain);
|
||||
break;
|
||||
case PING:
|
||||
processPingRequest(request, response, chain);
|
||||
break;
|
||||
default:
|
||||
writeJsonResponse(99, StringUtil.EMPTY, "Not found.");
|
||||
break;
|
||||
case SEARCH:
|
||||
processSearchRequest(request, response, chain);
|
||||
break;
|
||||
case LABEL:
|
||||
processLabelRequest(request, response, chain);
|
||||
break;
|
||||
case SUGGEST:
|
||||
processSuggestRequest(request, response, chain);
|
||||
break;
|
||||
case SPELLCHECK:
|
||||
processSpellCheckRequest(request, response, chain);
|
||||
break;
|
||||
case ANALYSIS:
|
||||
processAnalysisRequest(request, response, chain);
|
||||
break;
|
||||
case HOTSEARCHWORD:
|
||||
processHotSearchWordRequest(request, response, chain);
|
||||
break;
|
||||
case FAVORITE:
|
||||
processFavoriteRequest(request, response, chain);
|
||||
break;
|
||||
case FAVORITES:
|
||||
processFavoritesRequest(request, response, chain);
|
||||
break;
|
||||
case PING:
|
||||
processPingRequest(request, response, chain);
|
||||
break;
|
||||
default:
|
||||
writeJsonResponse(99, StringUtil.EMPTY, "Not found.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void processPingRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processPingRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
final SearchService searchService = ComponentUtil.getSearchService();
|
||||
int status;
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
|
@ -155,35 +151,27 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeJsonResponse(status, buf.toString(), errMsg);
|
||||
}
|
||||
|
||||
protected void processSearchRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSearchRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
String query = null;
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
request.setAttribute(Constants.SEARCH_LOG_ACCESS_TYPE,
|
||||
CDef.AccessType.Json);
|
||||
request.setAttribute(Constants.SEARCH_LOG_ACCESS_TYPE, CDef.AccessType.Json);
|
||||
final String queryId = request.getParameter("queryId");
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SEARCH_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SEARCH_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
query = WebApiUtil.getObject("searchQuery");
|
||||
final String execTime = WebApiUtil.getObject("execTime");
|
||||
final String queryTime = WebApiUtil.getObject("queryTime");
|
||||
final String searchTime = WebApiUtil.getObject("searchTime");
|
||||
final String pageSize = WebApiUtil.getObject("pageSize");
|
||||
final String currentPageNumber = WebApiUtil
|
||||
.getObject("currentPageNumber");
|
||||
final String allRecordCount = WebApiUtil
|
||||
.getObject("allRecordCount");
|
||||
final String currentPageNumber = WebApiUtil.getObject("currentPageNumber");
|
||||
final String allRecordCount = WebApiUtil.getObject("allRecordCount");
|
||||
final String allPageCount = WebApiUtil.getObject("allPageCount");
|
||||
final List<Map<String, Object>> documentItems = WebApiUtil
|
||||
.getObject("documentItems");
|
||||
final FacetResponse facetResponse = WebApiUtil
|
||||
.getObject("facetResponse");
|
||||
final MoreLikeThisResponse moreLikeThisResponse = WebApiUtil
|
||||
.getObject("moreLikeThisResponse");
|
||||
final List<Map<String, Object>> documentItems = WebApiUtil.getObject("documentItems");
|
||||
final FacetResponse facetResponse = WebApiUtil.getObject("facetResponse");
|
||||
final MoreLikeThisResponse moreLikeThisResponse = WebApiUtil.getObject("moreLikeThisResponse");
|
||||
|
||||
buf.append("\"query\":");
|
||||
buf.append(escapeJson(query));
|
||||
|
@ -222,13 +210,10 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
buf.append('{');
|
||||
boolean first2 = true;
|
||||
for (final Map.Entry<String, Object> entry : document
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Object> entry : document.entrySet()) {
|
||||
final String name = entry.getKey();
|
||||
if (StringUtil.isNotBlank(name)
|
||||
&& entry.getValue() != null
|
||||
&& ComponentUtil.getQueryHelper()
|
||||
.isApiResponseField(name)) {
|
||||
if (StringUtil.isNotBlank(name) && entry.getValue() != null
|
||||
&& ComponentUtil.getQueryHelper().isApiResponseField(name)) {
|
||||
if (!first2) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -259,8 +244,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(escapeJson(field.getName()));
|
||||
buf.append(",\"result\":[");
|
||||
boolean first2 = true;
|
||||
for (final Map.Entry<String, Long> entry : field
|
||||
.getValueCountMap().entrySet()) {
|
||||
for (final Map.Entry<String, Long> entry : field.getValueCountMap().entrySet()) {
|
||||
if (!first2) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -282,8 +266,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(',');
|
||||
buf.append("\"facetQuery\":[");
|
||||
boolean first1 = true;
|
||||
for (final Map.Entry<String, Long> entry : facetResponse
|
||||
.getQueryCountMap().entrySet()) {
|
||||
for (final Map.Entry<String, Long> entry : facetResponse.getQueryCountMap().entrySet()) {
|
||||
if (!first1) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -302,8 +285,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(',');
|
||||
buf.append("\"moreLikeThis\":[");
|
||||
boolean first = true;
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> mltEntry : moreLikeThisResponse
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> mltEntry : moreLikeThisResponse.entrySet()) {
|
||||
if (!first) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -313,8 +295,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(escapeJson(mltEntry.getKey()));
|
||||
buf.append(",\"result\":[");
|
||||
boolean first1 = true;
|
||||
for (final Map<String, Object> document : mltEntry
|
||||
.getValue()) {
|
||||
for (final Map<String, Object> document : mltEntry.getValue()) {
|
||||
if (!first1) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -322,10 +303,8 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
buf.append('{');
|
||||
boolean first2 = true;
|
||||
for (final Map.Entry<String, Object> entry : document
|
||||
.entrySet()) {
|
||||
if (StringUtil.isNotBlank(entry.getKey())
|
||||
&& entry.getValue() != null) {
|
||||
for (final Map.Entry<String, Object> entry : document.entrySet()) {
|
||||
if (StringUtil.isNotBlank(entry.getKey()) && entry.getValue() != null) {
|
||||
if (!first2) {
|
||||
buf.append(',');
|
||||
} else {
|
||||
|
@ -357,14 +336,12 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processLabelRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processLabelRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
final List<Map<String, String>> labelTypeItems = ComponentUtil
|
||||
.getLabelTypeHelper().getLabelTypeItemList();
|
||||
final List<Map<String, String>> labelTypeItems = ComponentUtil.getLabelTypeHelper().getLabelTypeItemList();
|
||||
buf.append("\"recordCount\":");
|
||||
buf.append(labelTypeItems.size());
|
||||
if (!labelTypeItems.isEmpty()) {
|
||||
|
@ -397,22 +374,17 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processSuggestRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSuggestRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SUGGEST_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SUGGEST_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final Integer suggestRecordCount = WebApiUtil
|
||||
.getObject("suggestRecordCount");
|
||||
final List<SuggestResponse> suggestResultList = WebApiUtil
|
||||
.getObject("suggestResultList");
|
||||
final List<String> suggestFieldName = WebApiUtil
|
||||
.getObject("suggestFieldName");
|
||||
final Integer suggestRecordCount = WebApiUtil.getObject("suggestRecordCount");
|
||||
final List<SuggestResponse> suggestResultList = WebApiUtil.getObject("suggestResultList");
|
||||
final List<String> suggestFieldName = WebApiUtil.getObject("suggestFieldName");
|
||||
|
||||
buf.append("\"recordCount\":");
|
||||
buf.append(suggestRecordCount);
|
||||
|
@ -423,11 +395,9 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
boolean first1 = true;
|
||||
for (int i = 0; i < suggestResultList.size(); i++) {
|
||||
|
||||
final SuggestResponse suggestResponse = suggestResultList
|
||||
.get(i);
|
||||
final SuggestResponse suggestResponse = suggestResultList.get(i);
|
||||
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse.entrySet()) {
|
||||
final String fn = suggestFieldName.get(i);
|
||||
if (!first1) {
|
||||
buf.append(',');
|
||||
|
@ -435,8 +405,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
first1 = false;
|
||||
}
|
||||
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry
|
||||
.getValue();
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry.getValue();
|
||||
|
||||
buf.append("{\"token\":");
|
||||
buf.append(escapeJson(entry.getKey()));
|
||||
|
@ -481,22 +450,17 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processSpellCheckRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSpellCheckRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SPELLCHECK_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SPELLCHECK_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final Integer spellCheckRecordCount = WebApiUtil
|
||||
.getObject("spellCheckRecordCount");
|
||||
final List<SpellCheckResponse> spellCheckResultList = WebApiUtil
|
||||
.getObject("spellCheckResultList");
|
||||
final List<String> spellCheckFieldName = WebApiUtil
|
||||
.getObject("spellCheckFieldName");
|
||||
final Integer spellCheckRecordCount = WebApiUtil.getObject("spellCheckRecordCount");
|
||||
final List<SpellCheckResponse> spellCheckResultList = WebApiUtil.getObject("spellCheckResultList");
|
||||
final List<String> spellCheckFieldName = WebApiUtil.getObject("spellCheckFieldName");
|
||||
|
||||
buf.append("\"recordCount\":");
|
||||
buf.append(spellCheckRecordCount);
|
||||
|
@ -507,11 +471,9 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
boolean first1 = true;
|
||||
for (int i = 0; i < spellCheckResultList.size(); i++) {
|
||||
|
||||
final SuggestResponse suggestResponse = spellCheckResultList
|
||||
.get(i);
|
||||
final SuggestResponse suggestResponse = spellCheckResultList.get(i);
|
||||
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse.entrySet()) {
|
||||
final String fn = spellCheckFieldName.get(i);
|
||||
if (!first1) {
|
||||
buf.append(',');
|
||||
|
@ -519,8 +481,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
first1 = false;
|
||||
}
|
||||
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry
|
||||
.getValue();
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry.getValue();
|
||||
|
||||
buf.append("{\"token\":");
|
||||
buf.append(escapeJson(entry.getKey()));
|
||||
|
@ -565,18 +526,15 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processAnalysisRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processAnalysisRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, ANALYSIS_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, ANALYSIS_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final FieldAnalysisResponse fieldAnalysis = WebApiUtil
|
||||
.getObject("fieldAnalysis");
|
||||
final FieldAnalysisResponse fieldAnalysis = WebApiUtil.getObject("fieldAnalysis");
|
||||
|
||||
buf.append("\"recordCount\":");
|
||||
buf.append(fieldAnalysis.size());
|
||||
|
@ -585,30 +543,23 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(',');
|
||||
buf.append("\"result\":[");
|
||||
boolean first1 = true;
|
||||
for (final Map.Entry<String, Map<String, List<Map<String, Object>>>> fEntry : fieldAnalysis
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Map<String, List<Map<String, Object>>>> fEntry : fieldAnalysis.entrySet()) {
|
||||
if (first1) {
|
||||
first1 = false;
|
||||
} else {
|
||||
buf.append(',');
|
||||
}
|
||||
buf.append("{\"field\":")
|
||||
.append(escapeJson(fEntry.getKey()))
|
||||
.append(",\"analysis\":[");
|
||||
buf.append("{\"field\":").append(escapeJson(fEntry.getKey())).append(",\"analysis\":[");
|
||||
boolean first2 = true;
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> aEntry : fEntry
|
||||
.getValue().entrySet()) {
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> aEntry : fEntry.getValue().entrySet()) {
|
||||
if (first2) {
|
||||
first2 = false;
|
||||
} else {
|
||||
buf.append(',');
|
||||
}
|
||||
buf.append("{\"name\":")
|
||||
.append(escapeJson(aEntry.getKey()))
|
||||
.append(",\"data\":[");
|
||||
buf.append("{\"name\":").append(escapeJson(aEntry.getKey())).append(",\"data\":[");
|
||||
boolean first3 = true;
|
||||
for (final Map<String, Object> dataMap : aEntry
|
||||
.getValue()) {
|
||||
for (final Map<String, Object> dataMap : aEntry.getValue()) {
|
||||
if (first3) {
|
||||
first3 = false;
|
||||
} else {
|
||||
|
@ -616,8 +567,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
buf.append('{');
|
||||
boolean first4 = true;
|
||||
for (final Map.Entry<String, Object> dEntry : dataMap
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Object> dEntry : dataMap.entrySet()) {
|
||||
final String key = dEntry.getKey();
|
||||
final Object value = dEntry.getValue();
|
||||
if (StringUtil.isNotBlank(key) && value != null) {
|
||||
|
@ -626,8 +576,7 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
} else {
|
||||
buf.append(',');
|
||||
}
|
||||
buf.append(escapeJson(key)).append(':')
|
||||
.append(escapeJson(value));
|
||||
buf.append(escapeJson(key)).append(':').append(escapeJson(value));
|
||||
}
|
||||
}
|
||||
buf.append('}');
|
||||
|
@ -654,19 +603,15 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processHotSearchWordRequest(
|
||||
final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processHotSearchWordRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, HOT_SEARCH_WORD_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, HOT_SEARCH_WORD_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final List<String> hotSearchWordList = WebApiUtil
|
||||
.getObject("hotSearchWordList");
|
||||
final List<String> hotSearchWordList = WebApiUtil.getObject("hotSearchWordList");
|
||||
|
||||
buf.append("\"result\":[");
|
||||
boolean first1 = true;
|
||||
|
@ -695,14 +640,12 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void processFavoriteRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processFavoriteRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String body = null;
|
||||
String errMsg = null;
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, FAVORITE_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, FAVORITE_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
|
||||
body = "\"result\":\"ok\"";
|
||||
|
@ -722,15 +665,13 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeJsonResponse(status, body, errMsg);
|
||||
}
|
||||
|
||||
protected void processFavoritesRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processFavoritesRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String body = null;
|
||||
String errMsg = null;
|
||||
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, FAVORITES_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, FAVORITES_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final List<String> docIdList = WebApiUtil.getObject("docIdList");
|
||||
|
||||
|
@ -763,10 +704,8 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
}
|
||||
|
||||
protected void writeJsonResponse(final int status, final String body,
|
||||
final String errMsg) {
|
||||
final String callback = RequestUtil.getRequest().getParameter(
|
||||
"callback");
|
||||
protected void writeJsonResponse(final int status, final String body, final String errMsg) {
|
||||
final String callback = RequestUtil.getRequest().getParameter("callback");
|
||||
final boolean isJsonp = StringUtil.isNotBlank(callback);
|
||||
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
|
@ -792,15 +731,12 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
if (isJsonp) {
|
||||
buf.append(')');
|
||||
}
|
||||
ResponseUtil.write(buf.toString(), "text/javascript+json",
|
||||
Constants.UTF_8);
|
||||
ResponseUtil.write(buf.toString(), "text/javascript+json", Constants.UTF_8);
|
||||
|
||||
}
|
||||
|
||||
protected String escapeCallbackName(final String callbackName) {
|
||||
return "/**/"
|
||||
+ callbackName.replaceAll("[^0-9a-zA-Z_\\$\\.]",
|
||||
StringUtil.EMPTY);
|
||||
return "/**/" + callbackName.replaceAll("[^0-9a-zA-Z_\\$\\.]", StringUtil.EMPTY);
|
||||
}
|
||||
|
||||
protected String escapeJson(final Object obj) {
|
||||
|
@ -830,23 +766,16 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
} else {
|
||||
buf.append(',');
|
||||
}
|
||||
buf.append(escapeJson(entry.getKey())).append(':')
|
||||
.append(escapeJson(entry.getValue()));
|
||||
buf.append(escapeJson(entry.getKey())).append(':').append(escapeJson(entry.getValue()));
|
||||
}
|
||||
buf.append('}');
|
||||
} else if (obj instanceof Integer || obj instanceof Long
|
||||
|| obj instanceof Float || obj instanceof Double
|
||||
|| obj instanceof Short) {
|
||||
} else if (obj instanceof Integer || obj instanceof Long || obj instanceof Float || obj instanceof Double || obj instanceof Short) {
|
||||
buf.append(obj);
|
||||
} else if (obj instanceof Date) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
|
||||
buf.append('\"')
|
||||
.append(StringEscapeUtils.escapeXml(sdf.format(obj)))
|
||||
.append('\"');
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
|
||||
buf.append('\"').append(StringEscapeUtils.escapeXml(sdf.format(obj))).append('\"');
|
||||
} else {
|
||||
buf.append('\"').append(escapeJsonString(obj.toString()))
|
||||
.append('\"');
|
||||
buf.append('\"').append(escapeJsonString(obj.toString())).append('\"');
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
@ -871,50 +800,50 @@ public class JsonApiManager extends BaseApiManager implements WebApiManager {
|
|||
out.write(hex(ch));
|
||||
} else if (ch < 32) {
|
||||
switch (ch) {
|
||||
case '\b':
|
||||
out.write('\\');
|
||||
out.write('b');
|
||||
break;
|
||||
case '\n':
|
||||
out.write('\\');
|
||||
out.write('n');
|
||||
break;
|
||||
case '\t':
|
||||
out.write('\\');
|
||||
out.write('t');
|
||||
break;
|
||||
case '\f':
|
||||
out.write('\\');
|
||||
out.write('f');
|
||||
break;
|
||||
case '\r':
|
||||
out.write('\\');
|
||||
out.write('r');
|
||||
break;
|
||||
default:
|
||||
if (ch > 0xf) {
|
||||
out.write("\\u00");
|
||||
out.write(hex(ch));
|
||||
} else {
|
||||
out.write("\\u000");
|
||||
out.write(hex(ch));
|
||||
}
|
||||
break;
|
||||
case '\b':
|
||||
out.write('\\');
|
||||
out.write('b');
|
||||
break;
|
||||
case '\n':
|
||||
out.write('\\');
|
||||
out.write('n');
|
||||
break;
|
||||
case '\t':
|
||||
out.write('\\');
|
||||
out.write('t');
|
||||
break;
|
||||
case '\f':
|
||||
out.write('\\');
|
||||
out.write('f');
|
||||
break;
|
||||
case '\r':
|
||||
out.write('\\');
|
||||
out.write('r');
|
||||
break;
|
||||
default:
|
||||
if (ch > 0xf) {
|
||||
out.write("\\u00");
|
||||
out.write(hex(ch));
|
||||
} else {
|
||||
out.write("\\u000");
|
||||
out.write(hex(ch));
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (ch) {
|
||||
case '"':
|
||||
out.write("\\u0022");
|
||||
break;
|
||||
case '\\':
|
||||
out.write("\\u005C");
|
||||
break;
|
||||
case '/':
|
||||
out.write("\\u002F");
|
||||
break;
|
||||
default:
|
||||
out.write(ch);
|
||||
break;
|
||||
case '"':
|
||||
out.write("\\u0022");
|
||||
break;
|
||||
case '\\':
|
||||
out.write("\\u005C");
|
||||
break;
|
||||
case '/':
|
||||
out.write("\\u002F");
|
||||
break;
|
||||
default:
|
||||
out.write(ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,15 +55,13 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(XmlApiManager.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(XmlApiManager.class);
|
||||
|
||||
protected String xmlPathPrefix = "/xml";
|
||||
|
||||
@Override
|
||||
public boolean matches(final HttpServletRequest request) {
|
||||
if (Constants.FALSE.equals(ComponentUtil.getCrawlerProperties()
|
||||
.getProperty(Constants.WEB_API_XML_PROPERTY, Constants.TRUE))) {
|
||||
if (Constants.FALSE.equals(ComponentUtil.getCrawlerProperties().getProperty(Constants.WEB_API_XML_PROPERTY, Constants.TRUE))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -72,38 +70,36 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void process(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
public void process(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException,
|
||||
ServletException {
|
||||
final String formatType = request.getParameter("type");
|
||||
switch (getFormatType(formatType)) {
|
||||
case SEARCH:
|
||||
processSearchRequest(request, response, chain);
|
||||
break;
|
||||
case LABEL:
|
||||
processLabelRequest(request, response, chain);
|
||||
break;
|
||||
case SUGGEST:
|
||||
processSuggestRequest(request, response, chain);
|
||||
break;
|
||||
case SPELLCHECK:
|
||||
processSpellCheckRequest(request, response, chain);
|
||||
break;
|
||||
case ANALYSIS:
|
||||
processAnalysisRequest(request, response, chain);
|
||||
break;
|
||||
case PING:
|
||||
processPingRequest(request, response, chain);
|
||||
break;
|
||||
default:
|
||||
writeXmlResponse(-1, StringUtil.EMPTY, "Not found.");
|
||||
break;
|
||||
case SEARCH:
|
||||
processSearchRequest(request, response, chain);
|
||||
break;
|
||||
case LABEL:
|
||||
processLabelRequest(request, response, chain);
|
||||
break;
|
||||
case SUGGEST:
|
||||
processSuggestRequest(request, response, chain);
|
||||
break;
|
||||
case SPELLCHECK:
|
||||
processSpellCheckRequest(request, response, chain);
|
||||
break;
|
||||
case ANALYSIS:
|
||||
processAnalysisRequest(request, response, chain);
|
||||
break;
|
||||
case PING:
|
||||
processPingRequest(request, response, chain);
|
||||
break;
|
||||
default:
|
||||
writeXmlResponse(-1, StringUtil.EMPTY, "Not found.");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void processPingRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processPingRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
final SearchService searchService = ComponentUtil.getSearchService();
|
||||
int status;
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
|
@ -138,35 +134,27 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeXmlResponse(status, buf.toString(), errMsg);
|
||||
}
|
||||
|
||||
protected void processSearchRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSearchRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
String query = null;
|
||||
request.setAttribute(Constants.SEARCH_LOG_ACCESS_TYPE,
|
||||
CDef.AccessType.Xml);
|
||||
request.setAttribute(Constants.SEARCH_LOG_ACCESS_TYPE, CDef.AccessType.Xml);
|
||||
final String queryId = request.getParameter("queryId");
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SEARCH_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SEARCH_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
query = WebApiUtil.getObject("searchQuery");
|
||||
final String execTime = WebApiUtil.getObject("execTime");
|
||||
final String queryTime = WebApiUtil.getObject("queryTime");
|
||||
final String searchTime = WebApiUtil.getObject("searchTime");
|
||||
final String pageSize = WebApiUtil.getObject("pageSize");
|
||||
final String currentPageNumber = WebApiUtil
|
||||
.getObject("currentPageNumber");
|
||||
final String allRecordCount = WebApiUtil
|
||||
.getObject("allRecordCount");
|
||||
final String currentPageNumber = WebApiUtil.getObject("currentPageNumber");
|
||||
final String allRecordCount = WebApiUtil.getObject("allRecordCount");
|
||||
final String allPageCount = WebApiUtil.getObject("allPageCount");
|
||||
final List<Map<String, Object>> documentItems = WebApiUtil
|
||||
.getObject("documentItems");
|
||||
final FacetResponse facetResponse = WebApiUtil
|
||||
.getObject("facetResponse");
|
||||
final MoreLikeThisResponse moreLikeThisResponse = WebApiUtil
|
||||
.getObject("moreLikeThisResponse");
|
||||
final List<Map<String, Object>> documentItems = WebApiUtil.getObject("documentItems");
|
||||
final FacetResponse facetResponse = WebApiUtil.getObject("facetResponse");
|
||||
final MoreLikeThisResponse moreLikeThisResponse = WebApiUtil.getObject("moreLikeThisResponse");
|
||||
|
||||
buf.append("<query>");
|
||||
buf.append(escapeXml(query));
|
||||
|
@ -200,13 +188,9 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append("<result>");
|
||||
for (final Map<String, Object> document : documentItems) {
|
||||
buf.append("<doc>");
|
||||
for (final Map.Entry<String, Object> entry : document
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Object> entry : document.entrySet()) {
|
||||
final String name = entry.getKey();
|
||||
if (StringUtil.isNotBlank(name)
|
||||
&& entry.getValue() != null
|
||||
&& ComponentUtil.getQueryHelper()
|
||||
.isApiResponseField(name)) {
|
||||
if (StringUtil.isNotBlank(name) && entry.getValue() != null && ComponentUtil.getQueryHelper().isApiResponseField(name)) {
|
||||
final String tagName = convertTagName(name);
|
||||
buf.append('<');
|
||||
buf.append(tagName);
|
||||
|
@ -228,8 +212,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append("<field name=\"");
|
||||
buf.append(escapeXml(field.getName()));
|
||||
buf.append("\">");
|
||||
for (final Map.Entry<String, Long> entry : field
|
||||
.getValueCountMap().entrySet()) {
|
||||
for (final Map.Entry<String, Long> entry : field.getValueCountMap().entrySet()) {
|
||||
buf.append("<value count=\"");
|
||||
buf.append(escapeXml(entry.getValue()));
|
||||
buf.append("\">");
|
||||
|
@ -242,8 +225,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
// facet query
|
||||
if (facetResponse.getQueryCountMap() != null) {
|
||||
buf.append("<query>");
|
||||
for (final Map.Entry<String, Long> entry : facetResponse
|
||||
.getQueryCountMap().entrySet()) {
|
||||
for (final Map.Entry<String, Long> entry : facetResponse.getQueryCountMap().entrySet()) {
|
||||
buf.append("<value count=\"");
|
||||
buf.append(escapeXml(entry.getValue()));
|
||||
buf.append("\">");
|
||||
|
@ -256,25 +238,19 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
if (moreLikeThisResponse != null && !moreLikeThisResponse.isEmpty()) {
|
||||
buf.append("<more-like-this>");
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> mltEntry : moreLikeThisResponse
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> mltEntry : moreLikeThisResponse.entrySet()) {
|
||||
buf.append("<result id=\"");
|
||||
buf.append(escapeXml(mltEntry.getKey()));
|
||||
buf.append("\">");
|
||||
for (final Map<String, Object> document : mltEntry
|
||||
.getValue()) {
|
||||
for (final Map<String, Object> document : mltEntry.getValue()) {
|
||||
buf.append("<doc>");
|
||||
for (final Map.Entry<String, Object> entry : document
|
||||
.entrySet()) {
|
||||
if (StringUtil.isNotBlank(entry.getKey())
|
||||
&& entry.getValue() != null) {
|
||||
final String tagName = convertTagName(entry
|
||||
.getKey());
|
||||
for (final Map.Entry<String, Object> entry : document.entrySet()) {
|
||||
if (StringUtil.isNotBlank(entry.getKey()) && entry.getValue() != null) {
|
||||
final String tagName = convertTagName(entry.getKey());
|
||||
buf.append('<');
|
||||
buf.append(tagName);
|
||||
buf.append('>');
|
||||
buf.append(escapeXml(entry.getValue()
|
||||
.toString()));
|
||||
buf.append(escapeXml(entry.getValue().toString()));
|
||||
buf.append("</");
|
||||
buf.append(tagName);
|
||||
buf.append('>');
|
||||
|
@ -301,19 +277,16 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
}
|
||||
|
||||
private String convertTagName(final String name) {
|
||||
final String tagName = StringUtil.decamelize(name).replaceAll("_", "-")
|
||||
.toLowerCase();
|
||||
final String tagName = StringUtil.decamelize(name).replaceAll("_", "-").toLowerCase();
|
||||
return tagName;
|
||||
}
|
||||
|
||||
protected void processLabelRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processLabelRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
final List<Map<String, String>> labelTypeItems = ComponentUtil
|
||||
.getLabelTypeHelper().getLabelTypeItemList();
|
||||
final List<Map<String, String>> labelTypeItems = ComponentUtil.getLabelTypeHelper().getLabelTypeItemList();
|
||||
buf.append("<record-count>");
|
||||
buf.append(labelTypeItems.size());
|
||||
buf.append("</record-count>");
|
||||
|
@ -341,22 +314,17 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeXmlResponse(status, buf.toString(), errMsg);
|
||||
}
|
||||
|
||||
protected void processSuggestRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSuggestRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SUGGEST_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SUGGEST_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final Integer suggestRecordCount = WebApiUtil
|
||||
.getObject("suggestRecordCount");
|
||||
final List<SuggestResponse> suggestResultList = WebApiUtil
|
||||
.getObject("suggestResultList");
|
||||
final List<String> suggestFieldName = WebApiUtil
|
||||
.getObject("suggestFieldName");
|
||||
final Integer suggestRecordCount = WebApiUtil.getObject("suggestRecordCount");
|
||||
final List<SuggestResponse> suggestResultList = WebApiUtil.getObject("suggestResultList");
|
||||
final List<String> suggestFieldName = WebApiUtil.getObject("suggestFieldName");
|
||||
|
||||
buf.append("<record-count>");
|
||||
buf.append(suggestRecordCount);
|
||||
|
@ -366,13 +334,10 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
for (int i = 0; i < suggestResultList.size(); i++) {
|
||||
|
||||
final SuggestResponse suggestResponse = suggestResultList
|
||||
.get(i);
|
||||
final SuggestResponse suggestResponse = suggestResultList.get(i);
|
||||
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse
|
||||
.entrySet()) {
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry
|
||||
.getValue();
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse.entrySet()) {
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry.getValue();
|
||||
final String fn = suggestFieldName.get(i);
|
||||
buf.append("<suggest>");
|
||||
buf.append("<token>");
|
||||
|
@ -382,16 +347,13 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(escapeXml(fn));
|
||||
buf.append("</fn>");
|
||||
buf.append("<start-offset>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getStartOffset())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getStartOffset())));
|
||||
buf.append("</start-offset>");
|
||||
buf.append("<end-offset>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getEndOffset())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getEndOffset())));
|
||||
buf.append("</end-offset>");
|
||||
buf.append("<num-found>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getNumFound())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getNumFound())));
|
||||
buf.append("</num-found>");
|
||||
buf.append("<result>");
|
||||
for (final String value : srList) {
|
||||
|
@ -421,22 +383,17 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeXmlResponse(status, buf.toString(), errMsg);
|
||||
}
|
||||
|
||||
protected void processSpellCheckRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected void processSpellCheckRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, SPELLCHECK_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, SPELLCHECK_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final Integer spellCheckRecordCount = WebApiUtil
|
||||
.getObject("spellCheckRecordCount");
|
||||
final List<SpellCheckResponse> spellCheckResultList = WebApiUtil
|
||||
.getObject("spellCheckResultList");
|
||||
final List<String> spellCheckFieldName = WebApiUtil
|
||||
.getObject("spellCheckFieldName");
|
||||
final Integer spellCheckRecordCount = WebApiUtil.getObject("spellCheckRecordCount");
|
||||
final List<SpellCheckResponse> spellCheckResultList = WebApiUtil.getObject("spellCheckResultList");
|
||||
final List<String> spellCheckFieldName = WebApiUtil.getObject("spellCheckFieldName");
|
||||
|
||||
buf.append("<record-count>");
|
||||
buf.append(spellCheckRecordCount);
|
||||
|
@ -446,13 +403,10 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
|
||||
for (int i = 0; i < spellCheckResultList.size(); i++) {
|
||||
|
||||
final SuggestResponse suggestResponse = spellCheckResultList
|
||||
.get(i);
|
||||
final SuggestResponse suggestResponse = spellCheckResultList.get(i);
|
||||
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse
|
||||
.entrySet()) {
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry
|
||||
.getValue();
|
||||
for (final Map.Entry<String, List<String>> entry : suggestResponse.entrySet()) {
|
||||
final SuggestResponseList srList = (SuggestResponseList) entry.getValue();
|
||||
final String fn = spellCheckFieldName.get(i);
|
||||
buf.append("<suggest>");
|
||||
buf.append("<token>");
|
||||
|
@ -462,16 +416,13 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append(escapeXml(fn));
|
||||
buf.append("</fn>");
|
||||
buf.append("<start-offset>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getStartOffset())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getStartOffset())));
|
||||
buf.append("</start-offset>");
|
||||
buf.append("<end-offset>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getEndOffset())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getEndOffset())));
|
||||
buf.append("</end-offset>");
|
||||
buf.append("<num-found>");
|
||||
buf.append(escapeXml(Integer.toString(srList
|
||||
.getNumFound())));
|
||||
buf.append(escapeXml(Integer.toString(srList.getNumFound())));
|
||||
buf.append("</num-found>");
|
||||
buf.append("<result>");
|
||||
for (final String value : srList) {
|
||||
|
@ -501,46 +452,33 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
writeXmlResponse(status, buf.toString(), errMsg);
|
||||
}
|
||||
|
||||
protected String processAnalysisRequest(final HttpServletRequest request,
|
||||
final HttpServletResponse response, final FilterChain chain) {
|
||||
protected String processAnalysisRequest(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) {
|
||||
|
||||
int status = 0;
|
||||
String errMsg = StringUtil.EMPTY;
|
||||
final StringBuilder buf = new StringBuilder(255);
|
||||
try {
|
||||
chain.doFilter(new WebApiRequest(request, ANALYSIS_API),
|
||||
new WebApiResponse(response));
|
||||
chain.doFilter(new WebApiRequest(request, ANALYSIS_API), new WebApiResponse(response));
|
||||
WebApiUtil.validate();
|
||||
final FieldAnalysisResponse fieldAnalysis = WebApiUtil
|
||||
.getObject("fieldAnalysis");
|
||||
final FieldAnalysisResponse fieldAnalysis = WebApiUtil.getObject("fieldAnalysis");
|
||||
|
||||
buf.append("<record-count>");
|
||||
buf.append(fieldAnalysis.size());
|
||||
buf.append("</record-count>");
|
||||
if (fieldAnalysis.size() > 0) {
|
||||
buf.append("<result>");
|
||||
for (final Map.Entry<String, Map<String, List<Map<String, Object>>>> fEntry : fieldAnalysis
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Map<String, List<Map<String, Object>>>> fEntry : fieldAnalysis.entrySet()) {
|
||||
|
||||
buf.append("<field name=\"")
|
||||
.append(escapeXml(fEntry.getKey())).append("\">");
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> aEntry : fEntry
|
||||
.getValue().entrySet()) {
|
||||
buf.append("<analysis name=\"")
|
||||
.append(escapeXml(aEntry.getKey()))
|
||||
.append("\">");
|
||||
for (final Map<String, Object> dataMap : aEntry
|
||||
.getValue()) {
|
||||
buf.append("<field name=\"").append(escapeXml(fEntry.getKey())).append("\">");
|
||||
for (final Map.Entry<String, List<Map<String, Object>>> aEntry : fEntry.getValue().entrySet()) {
|
||||
buf.append("<analysis name=\"").append(escapeXml(aEntry.getKey())).append("\">");
|
||||
for (final Map<String, Object> dataMap : aEntry.getValue()) {
|
||||
buf.append("<token>");
|
||||
for (final Map.Entry<String, Object> dEntry : dataMap
|
||||
.entrySet()) {
|
||||
for (final Map.Entry<String, Object> dEntry : dataMap.entrySet()) {
|
||||
final String key = dEntry.getKey();
|
||||
final Object value = dEntry.getValue();
|
||||
if (StringUtil.isNotBlank(key) && value != null) {
|
||||
buf.append("<value name=\"")
|
||||
.append(escapeXml(key))
|
||||
.append("\">")
|
||||
.append(escapeXml(value))
|
||||
buf.append("<value name=\"").append(escapeXml(key)).append("\">").append(escapeXml(value))
|
||||
.append("</value>");
|
||||
}
|
||||
}
|
||||
|
@ -569,8 +507,7 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
protected void writeXmlResponse(final int status, final String body,
|
||||
final String errMsg) {
|
||||
protected void writeXmlResponse(final int status, final String body, final String errMsg) {
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
|
||||
buf.append("<response>");
|
||||
|
@ -604,14 +541,12 @@ public class XmlApiManager extends BaseApiManager implements WebApiManager {
|
|||
buf.append("<data>");
|
||||
for (final Map.Entry<?, ?> entry : ((Map<?, ?>) obj).entrySet()) {
|
||||
|
||||
buf.append("<name>").append(escapeXml(entry.getKey()))
|
||||
.append("</name><value>")
|
||||
.append(escapeXml(entry.getValue())).append("</value>");
|
||||
buf.append("<name>").append(escapeXml(entry.getKey())).append("</name><value>").append(escapeXml(entry.getValue()))
|
||||
.append("</value>");
|
||||
}
|
||||
buf.append("</data>");
|
||||
} else if (obj instanceof Date) {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
|
||||
buf.append(StringEscapeUtils.escapeXml(sdf.format(obj)));
|
||||
} else if (obj != null) {
|
||||
buf.append(StringEscapeUtils.escapeXml(obj.toString()));
|
||||
|
|
|
@ -33,9 +33,8 @@ public class CommonConstants {
|
|||
|
||||
public static final String FALSE = "F";
|
||||
|
||||
public static final String[] PAGER_CONVERSION_RULE = { "allRecordCount",
|
||||
"pageSize", "currentPageNumber", "allPageCount", "existPrePage",
|
||||
"existNextPage" };
|
||||
public static final String[] PAGER_CONVERSION_RULE = { "allRecordCount", "pageSize", "currentPageNumber", "allPageCount",
|
||||
"existPrePage", "existNextPage" };
|
||||
|
||||
protected CommonConstants() {
|
||||
// nothing
|
||||
|
|
|
@ -56,15 +56,13 @@ public class CrudMessageException extends RuntimeException {
|
|||
this.args = args;
|
||||
}
|
||||
|
||||
public CrudMessageException(final String messageId, final String message,
|
||||
final Throwable cause) {
|
||||
public CrudMessageException(final String messageId, final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
this.messageId = messageId;
|
||||
args = null;
|
||||
}
|
||||
|
||||
public CrudMessageException(final String messageId, final Object[] args,
|
||||
final String message, final Throwable cause) {
|
||||
public CrudMessageException(final String messageId, final Object[] args, final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
this.messageId = messageId;
|
||||
this.args = args;
|
||||
|
@ -76,8 +74,7 @@ public class CrudMessageException extends RuntimeException {
|
|||
args = null;
|
||||
}
|
||||
|
||||
public CrudMessageException(final String messageId, final Object[] args,
|
||||
final String message) {
|
||||
public CrudMessageException(final String messageId, final Object[] args, final String message) {
|
||||
super(message);
|
||||
this.messageId = messageId;
|
||||
this.args = args;
|
||||
|
@ -89,8 +86,7 @@ public class CrudMessageException extends RuntimeException {
|
|||
args = null;
|
||||
}
|
||||
|
||||
public CrudMessageException(final String messageId, final Object[] args,
|
||||
final Throwable cause) {
|
||||
public CrudMessageException(final String messageId, final Object[] args, final Throwable cause) {
|
||||
super(cause);
|
||||
this.messageId = messageId;
|
||||
this.args = args;
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsBoostDocumentRuleAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsBoostDocumentRuleAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
boostDocumentRuleItems = boostDocumentRuleService
|
||||
.getBoostDocumentRuleList(boostDocumentRulePager);
|
||||
boostDocumentRuleItems = boostDocumentRuleService.getBoostDocumentRuleList(boostDocumentRulePager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(boostDocumentRulePager, boostDocumentRuleForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(boostDocumentRulePager, boostDocumentRuleForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(boostDocumentRuleForm.pageNumber)) {
|
||||
try {
|
||||
boostDocumentRulePager.setCurrentPageNumber(Integer
|
||||
.parseInt(boostDocumentRuleForm.pageNumber));
|
||||
boostDocumentRulePager.setCurrentPageNumber(Integer.parseInt(boostDocumentRuleForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ boostDocumentRuleForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + boostDocumentRuleForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(boostDocumentRuleForm.searchParams, boostDocumentRulePager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(boostDocumentRuleForm.searchParams, boostDocumentRulePager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (boostDocumentRuleForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
}
|
||||
|
||||
loadBoostDocumentRule();
|
||||
|
@ -158,9 +151,8 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (boostDocumentRuleForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
}
|
||||
|
||||
loadBoostDocumentRule();
|
||||
|
@ -194,9 +186,8 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (boostDocumentRuleForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
}
|
||||
|
||||
loadBoostDocumentRule();
|
||||
|
@ -231,8 +222,7 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (boostDocumentRuleForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
boostDocumentRuleForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsBoostDocumentRuleAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadBoostDocumentRule() {
|
||||
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(boostDocumentRule, boostDocumentRuleForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(boostDocumentRule, boostDocumentRuleForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected BoostDocumentRule createBoostDocumentRule() {
|
||||
BoostDocumentRule boostDocumentRule;
|
||||
if (boostDocumentRuleForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
boostDocumentRule = boostDocumentRuleService
|
||||
.getBoostDocumentRule(createKeyMap());
|
||||
boostDocumentRule = boostDocumentRuleService.getBoostDocumentRule(createKeyMap());
|
||||
if (boostDocumentRule == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
new Object[] { boostDocumentRuleForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
boostDocumentRule = new BoostDocumentRule();
|
||||
}
|
||||
Beans.copy(boostDocumentRuleForm, boostDocumentRule)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(boostDocumentRuleForm, boostDocumentRule).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return boostDocumentRule;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsCrawlingSessionAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsCrawlingSessionAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
crawlingSessionItems = crawlingSessionService
|
||||
.getCrawlingSessionList(crawlingSessionPager);
|
||||
crawlingSessionItems = crawlingSessionService.getCrawlingSessionList(crawlingSessionPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(crawlingSessionPager, crawlingSessionForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(crawlingSessionPager, crawlingSessionForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(crawlingSessionForm.pageNumber)) {
|
||||
try {
|
||||
crawlingSessionPager.setCurrentPageNumber(Integer
|
||||
.parseInt(crawlingSessionForm.pageNumber));
|
||||
crawlingSessionPager.setCurrentPageNumber(Integer.parseInt(crawlingSessionForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ crawlingSessionForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + crawlingSessionForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(crawlingSessionForm.searchParams, crawlingSessionPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(crawlingSessionForm.searchParams, crawlingSessionPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (crawlingSessionForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
}
|
||||
|
||||
loadCrawlingSession();
|
||||
|
@ -158,9 +151,8 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (crawlingSessionForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
}
|
||||
|
||||
loadCrawlingSession();
|
||||
|
@ -194,9 +186,8 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (crawlingSessionForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
}
|
||||
|
||||
loadCrawlingSession();
|
||||
|
@ -231,8 +222,7 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (crawlingSessionForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
crawlingSessionForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final CrawlingSession crawlingSession = crawlingSessionService
|
||||
.getCrawlingSession(createKeyMap());
|
||||
final CrawlingSession crawlingSession = crawlingSessionService.getCrawlingSession(createKeyMap());
|
||||
if (crawlingSession == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsCrawlingSessionAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadCrawlingSession() {
|
||||
|
||||
final CrawlingSession crawlingSession = crawlingSessionService
|
||||
.getCrawlingSession(createKeyMap());
|
||||
final CrawlingSession crawlingSession = crawlingSessionService.getCrawlingSession(createKeyMap());
|
||||
if (crawlingSession == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(crawlingSession, crawlingSessionForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(crawlingSession, crawlingSessionForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected CrawlingSession createCrawlingSession() {
|
||||
CrawlingSession crawlingSession;
|
||||
if (crawlingSessionForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
crawlingSession = crawlingSessionService
|
||||
.getCrawlingSession(createKeyMap());
|
||||
crawlingSession = crawlingSessionService.getCrawlingSession(createKeyMap());
|
||||
if (crawlingSession == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
new Object[] { crawlingSessionForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
crawlingSession = new CrawlingSession();
|
||||
}
|
||||
Beans.copy(crawlingSessionForm, crawlingSession)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(crawlingSessionForm, crawlingSession).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return crawlingSession;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsDataCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsDataCrawlingConfigAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
dataCrawlingConfigItems = dataCrawlingConfigService
|
||||
.getDataCrawlingConfigList(dataCrawlingConfigPager);
|
||||
dataCrawlingConfigItems = dataCrawlingConfigService.getDataCrawlingConfigList(dataCrawlingConfigPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(dataCrawlingConfigPager, dataCrawlingConfigForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(dataCrawlingConfigPager, dataCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(dataCrawlingConfigForm.pageNumber)) {
|
||||
try {
|
||||
dataCrawlingConfigPager.setCurrentPageNumber(Integer
|
||||
.parseInt(dataCrawlingConfigForm.pageNumber));
|
||||
dataCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(dataCrawlingConfigForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ dataCrawlingConfigForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + dataCrawlingConfigForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(dataCrawlingConfigForm.searchParams, dataCrawlingConfigPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(dataCrawlingConfigForm.searchParams, dataCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (dataCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadDataCrawlingConfig();
|
||||
|
@ -158,9 +151,8 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (dataCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadDataCrawlingConfig();
|
||||
|
@ -194,9 +186,8 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (dataCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadDataCrawlingConfig();
|
||||
|
@ -231,8 +222,7 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (dataCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
dataCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsDataCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadDataCrawlingConfig() {
|
||||
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(dataCrawlingConfig, dataCrawlingConfigForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(dataCrawlingConfig, dataCrawlingConfigForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected DataCrawlingConfig createDataCrawlingConfig() {
|
||||
DataCrawlingConfig dataCrawlingConfig;
|
||||
if (dataCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
dataCrawlingConfig = dataCrawlingConfigService
|
||||
.getDataCrawlingConfig(createKeyMap());
|
||||
dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());
|
||||
if (dataCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
new Object[] { dataCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
dataCrawlingConfig = new DataCrawlingConfig();
|
||||
}
|
||||
Beans.copy(dataCrawlingConfigForm, dataCrawlingConfig)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(dataCrawlingConfigForm, dataCrawlingConfig).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return dataCrawlingConfig;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsFailureUrlAction implements Serializable {
|
|||
failureUrlItems = failureUrlService.getFailureUrlList(failureUrlPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(failureUrlPager, failureUrlForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(failureUrlPager, failureUrlForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsFailureUrlAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(failureUrlForm.pageNumber)) {
|
||||
try {
|
||||
failureUrlPager.setCurrentPageNumber(Integer
|
||||
.parseInt(failureUrlForm.pageNumber));
|
||||
failureUrlPager.setCurrentPageNumber(Integer.parseInt(failureUrlForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + failureUrlForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsFailureUrlAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(failureUrlForm.searchParams, failureUrlPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(failureUrlForm.searchParams, failureUrlPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -131,9 +128,8 @@ public class BsFailureUrlAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (failureUrlForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
}
|
||||
|
||||
loadFailureUrl();
|
||||
|
@ -156,8 +152,7 @@ public class BsFailureUrlAction implements Serializable {
|
|||
public String editpage() {
|
||||
if (failureUrlForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
new Object[] { CommonConstants.EDIT_MODE, failureUrlForm.crudMode });
|
||||
}
|
||||
|
||||
loadFailureUrl();
|
||||
|
@ -191,9 +186,8 @@ public class BsFailureUrlAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (failureUrlForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
}
|
||||
|
||||
loadFailureUrl();
|
||||
|
@ -228,8 +222,7 @@ public class BsFailureUrlAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +243,7 @@ public class BsFailureUrlAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,20 +251,17 @@ public class BsFailureUrlAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (failureUrlForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
failureUrlForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FailureUrl failureUrl = failureUrlService
|
||||
.getFailureUrl(createKeyMap());
|
||||
final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap());
|
||||
if (failureUrl == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { failureUrlForm.id });
|
||||
new Object[] { failureUrlForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -288,21 +277,18 @@ public class BsFailureUrlAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadFailureUrl() {
|
||||
|
||||
final FailureUrl failureUrl = failureUrlService
|
||||
.getFailureUrl(createKeyMap());
|
||||
final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap());
|
||||
if (failureUrl == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { failureUrlForm.id });
|
||||
new Object[] { failureUrlForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -317,10 +303,9 @@ public class BsFailureUrlAction implements Serializable {
|
|||
failureUrl = failureUrlService.getFailureUrl(createKeyMap());
|
||||
if (failureUrl == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { failureUrlForm.id });
|
||||
new Object[] { failureUrlForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -63,14 +63,12 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
favoriteLogItems = favoriteLogService
|
||||
.getFavoriteLogList(favoriteLogPager);
|
||||
favoriteLogItems = favoriteLogService.getFavoriteLogList(favoriteLogPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(favoriteLogPager, favoriteLogForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(favoriteLogPager, favoriteLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -89,8 +87,7 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(favoriteLogForm.pageNumber)) {
|
||||
try {
|
||||
favoriteLogPager.setCurrentPageNumber(Integer
|
||||
.parseInt(favoriteLogForm.pageNumber));
|
||||
favoriteLogPager.setCurrentPageNumber(Integer.parseInt(favoriteLogForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + favoriteLogForm.pageNumber, e);
|
||||
|
@ -103,10 +100,9 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(favoriteLogForm.searchParams, favoriteLogPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(favoriteLogForm.searchParams, favoriteLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -132,9 +128,8 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (favoriteLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadFavoriteLog();
|
||||
|
@ -156,9 +151,8 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (favoriteLogForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadFavoriteLog();
|
||||
|
@ -192,9 +186,8 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadFavoriteLog();
|
||||
|
@ -229,8 +222,7 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,8 +243,7 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,20 +251,17 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (favoriteLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
favoriteLogForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FavoriteLog favoriteLog = favoriteLogService
|
||||
.getFavoriteLog(createKeyMap());
|
||||
final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
|
||||
if (favoriteLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { favoriteLogForm.id });
|
||||
new Object[] { favoriteLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,28 +277,24 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadFavoriteLog() {
|
||||
|
||||
final FavoriteLog favoriteLog = favoriteLogService
|
||||
.getFavoriteLog(createKeyMap());
|
||||
final FavoriteLog favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
|
||||
if (favoriteLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { favoriteLogForm.id });
|
||||
new Object[] { favoriteLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(favoriteLog, favoriteLogForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(favoriteLog, favoriteLogForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected FavoriteLog createFavoriteLog() {
|
||||
|
@ -319,19 +303,17 @@ public class BsFavoriteLogAction implements Serializable {
|
|||
favoriteLog = favoriteLogService.getFavoriteLog(createKeyMap());
|
||||
if (favoriteLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { favoriteLogForm.id });
|
||||
new Object[] { favoriteLogForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
favoriteLog = new FavoriteLog();
|
||||
}
|
||||
Beans.copy(favoriteLogForm, favoriteLog)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(favoriteLogForm, favoriteLog).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return favoriteLog;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsFileAuthenticationAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsFileAuthenticationAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
fileAuthenticationItems = fileAuthenticationService
|
||||
.getFileAuthenticationList(fileAuthenticationPager);
|
||||
fileAuthenticationItems = fileAuthenticationService.getFileAuthenticationList(fileAuthenticationPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(fileAuthenticationPager, fileAuthenticationForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(fileAuthenticationPager, fileAuthenticationForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(fileAuthenticationForm.pageNumber)) {
|
||||
try {
|
||||
fileAuthenticationPager.setCurrentPageNumber(Integer
|
||||
.parseInt(fileAuthenticationForm.pageNumber));
|
||||
fileAuthenticationPager.setCurrentPageNumber(Integer.parseInt(fileAuthenticationForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ fileAuthenticationForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + fileAuthenticationForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(fileAuthenticationForm.searchParams, fileAuthenticationPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(fileAuthenticationForm.searchParams, fileAuthenticationPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (fileAuthenticationForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileAuthentication();
|
||||
|
@ -158,9 +151,8 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (fileAuthenticationForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileAuthentication();
|
||||
|
@ -194,9 +186,8 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (fileAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileAuthentication();
|
||||
|
@ -231,8 +222,7 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (fileAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsFileAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadFileAuthentication() {
|
||||
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(fileAuthentication, fileAuthenticationForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(fileAuthentication, fileAuthenticationForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected FileAuthentication createFileAuthentication() {
|
||||
FileAuthentication fileAuthentication;
|
||||
if (fileAuthenticationForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
fileAuthentication = fileAuthenticationService
|
||||
.getFileAuthentication(createKeyMap());
|
||||
fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
|
||||
if (fileAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
new Object[] { fileAuthenticationForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
fileAuthentication = new FileAuthentication();
|
||||
}
|
||||
Beans.copy(fileAuthenticationForm, fileAuthentication)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(fileAuthenticationForm, fileAuthentication).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return fileAuthentication;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsFileCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsFileCrawlingConfigAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
fileCrawlingConfigItems = fileCrawlingConfigService
|
||||
.getFileCrawlingConfigList(fileCrawlingConfigPager);
|
||||
fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(fileCrawlingConfigPager, fileCrawlingConfigForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(fileCrawlingConfigPager, fileCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(fileCrawlingConfigForm.pageNumber)) {
|
||||
try {
|
||||
fileCrawlingConfigPager.setCurrentPageNumber(Integer
|
||||
.parseInt(fileCrawlingConfigForm.pageNumber));
|
||||
fileCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(fileCrawlingConfigForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ fileCrawlingConfigForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + fileCrawlingConfigForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(fileCrawlingConfigForm.searchParams, fileCrawlingConfigPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(fileCrawlingConfigForm.searchParams, fileCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileCrawlingConfig();
|
||||
|
@ -158,9 +151,8 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileCrawlingConfig();
|
||||
|
@ -194,9 +186,8 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileCrawlingConfig();
|
||||
|
@ -231,8 +222,7 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsFileCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadFileCrawlingConfig() {
|
||||
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(fileCrawlingConfig, fileCrawlingConfigForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(fileCrawlingConfig, fileCrawlingConfigForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected FileCrawlingConfig createFileCrawlingConfig() {
|
||||
FileCrawlingConfig fileCrawlingConfig;
|
||||
if (fileCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
fileCrawlingConfig = fileCrawlingConfigService
|
||||
.getFileCrawlingConfig(createKeyMap());
|
||||
fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
if (fileCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
new Object[] { fileCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
fileCrawlingConfig = new FileCrawlingConfig();
|
||||
}
|
||||
Beans.copy(fileCrawlingConfigForm, fileCrawlingConfig)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(fileCrawlingConfigForm, fileCrawlingConfig).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return fileCrawlingConfig;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsJobLogAction implements Serializable {
|
|||
jobLogItems = jobLogService.getJobLogList(jobLogPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(jobLogPager, jobLogForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(jobLogPager, jobLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsJobLogAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(jobLogForm.pageNumber)) {
|
||||
try {
|
||||
jobLogPager.setCurrentPageNumber(Integer
|
||||
.parseInt(jobLogForm.pageNumber));
|
||||
jobLogPager.setCurrentPageNumber(Integer.parseInt(jobLogForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + jobLogForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsJobLogAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(jobLogForm.searchParams, jobLogPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(jobLogForm.searchParams, jobLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -132,8 +129,7 @@ public class BsJobLogAction implements Serializable {
|
|||
public String confirmpage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
jobLogForm.crudMode });
|
||||
new Object[] { CommonConstants.CONFIRM_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
@ -155,9 +151,7 @@ public class BsJobLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
jobLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
@ -191,9 +185,7 @@ public class BsJobLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
jobLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
@ -228,8 +220,7 @@ public class BsJobLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +241,7 @@ public class BsJobLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,19 +249,16 @@ public class BsJobLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
jobLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -287,8 +274,7 @@ public class BsJobLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,10 +283,9 @@ public class BsJobLogAction implements Serializable {
|
|||
final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -315,10 +300,9 @@ public class BsJobLogAction implements Serializable {
|
|||
jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsKeyMatchAction implements Serializable {
|
|||
keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(keyMatchPager, keyMatchForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(keyMatchPager, keyMatchForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(keyMatchForm.pageNumber)) {
|
||||
try {
|
||||
keyMatchPager.setCurrentPageNumber(Integer
|
||||
.parseInt(keyMatchForm.pageNumber));
|
||||
keyMatchPager.setCurrentPageNumber(Integer.parseInt(keyMatchForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + keyMatchForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsKeyMatchAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(keyMatchForm.searchParams, keyMatchPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(keyMatchForm.searchParams, keyMatchPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -131,9 +128,8 @@ public class BsKeyMatchAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
loadKeyMatch();
|
||||
|
@ -155,9 +151,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
loadKeyMatch();
|
||||
|
@ -192,8 +186,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
public String deletepage() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
loadKeyMatch();
|
||||
|
@ -228,8 +221,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +242,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,19 +251,16 @@ public class BsKeyMatchAction implements Serializable {
|
|||
public String delete() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final KeyMatch keyMatch = keyMatchService
|
||||
.getKeyMatch(createKeyMap());
|
||||
final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { keyMatchForm.id });
|
||||
new Object[] { keyMatchForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -288,8 +276,7 @@ public class BsKeyMatchAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,10 +285,9 @@ public class BsKeyMatchAction implements Serializable {
|
|||
final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { keyMatchForm.id });
|
||||
new Object[] { keyMatchForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -316,10 +302,9 @@ public class BsKeyMatchAction implements Serializable {
|
|||
keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
if (keyMatch == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { keyMatchForm.id });
|
||||
new Object[] { keyMatchForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsLabelTypeAction implements Serializable {
|
|||
labelTypeItems = labelTypeService.getLabelTypeList(labelTypePager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(labelTypePager, labelTypeForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(labelTypePager, labelTypeForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsLabelTypeAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(labelTypeForm.pageNumber)) {
|
||||
try {
|
||||
labelTypePager.setCurrentPageNumber(Integer
|
||||
.parseInt(labelTypeForm.pageNumber));
|
||||
labelTypePager.setCurrentPageNumber(Integer.parseInt(labelTypeForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + labelTypeForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsLabelTypeAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(labelTypeForm.searchParams, labelTypePager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(labelTypeForm.searchParams, labelTypePager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -131,9 +128,8 @@ public class BsLabelTypeAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
@ -156,8 +152,7 @@ public class BsLabelTypeAction implements Serializable {
|
|||
public String editpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
new Object[] { CommonConstants.EDIT_MODE, labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
@ -191,9 +186,8 @@ public class BsLabelTypeAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
@ -228,8 +222,7 @@ public class BsLabelTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +243,7 @@ public class BsLabelTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,20 +251,17 @@ public class BsLabelTypeAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final LabelType labelType = labelTypeService
|
||||
.getLabelType(createKeyMap());
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -288,21 +277,18 @@ public class BsLabelTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadLabelType() {
|
||||
|
||||
final LabelType labelType = labelTypeService
|
||||
.getLabelType(createKeyMap());
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -317,10 +303,9 @@ public class BsLabelTypeAction implements Serializable {
|
|||
labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsOverlappingHostAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsOverlappingHostAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
overlappingHostItems = overlappingHostService
|
||||
.getOverlappingHostList(overlappingHostPager);
|
||||
overlappingHostItems = overlappingHostService.getOverlappingHostList(overlappingHostPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(overlappingHostPager, overlappingHostForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(overlappingHostPager, overlappingHostForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(overlappingHostForm.pageNumber)) {
|
||||
try {
|
||||
overlappingHostPager.setCurrentPageNumber(Integer
|
||||
.parseInt(overlappingHostForm.pageNumber));
|
||||
overlappingHostPager.setCurrentPageNumber(Integer.parseInt(overlappingHostForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ overlappingHostForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + overlappingHostForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(overlappingHostForm.searchParams, overlappingHostPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(overlappingHostForm.searchParams, overlappingHostPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (overlappingHostForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
}
|
||||
|
||||
loadOverlappingHost();
|
||||
|
@ -158,9 +151,8 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (overlappingHostForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
}
|
||||
|
||||
loadOverlappingHost();
|
||||
|
@ -194,9 +186,8 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (overlappingHostForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
}
|
||||
|
||||
loadOverlappingHost();
|
||||
|
@ -231,8 +222,7 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (overlappingHostForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
overlappingHostForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final OverlappingHost overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
final OverlappingHost overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { overlappingHostForm.id });
|
||||
new Object[] { overlappingHostForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsOverlappingHostAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadOverlappingHost() {
|
||||
|
||||
final OverlappingHost overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
final OverlappingHost overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { overlappingHostForm.id });
|
||||
new Object[] { overlappingHostForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(overlappingHost, overlappingHostForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(overlappingHost, overlappingHostForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected OverlappingHost createOverlappingHost() {
|
||||
OverlappingHost overlappingHost;
|
||||
if (overlappingHostForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
overlappingHost = overlappingHostService
|
||||
.getOverlappingHost(createKeyMap());
|
||||
overlappingHost = overlappingHostService.getOverlappingHost(createKeyMap());
|
||||
if (overlappingHost == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { overlappingHostForm.id });
|
||||
new Object[] { overlappingHostForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
overlappingHost = new OverlappingHost();
|
||||
}
|
||||
Beans.copy(overlappingHostForm, overlappingHost)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(overlappingHostForm, overlappingHost).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return overlappingHost;
|
||||
}
|
||||
|
|
|
@ -63,14 +63,12 @@ public class BsPathMappingAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
pathMappingItems = pathMappingService
|
||||
.getPathMappingList(pathMappingPager);
|
||||
pathMappingItems = pathMappingService.getPathMappingList(pathMappingPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(pathMappingPager, pathMappingForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(pathMappingPager, pathMappingForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -89,8 +87,7 @@ public class BsPathMappingAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(pathMappingForm.pageNumber)) {
|
||||
try {
|
||||
pathMappingPager.setCurrentPageNumber(Integer
|
||||
.parseInt(pathMappingForm.pageNumber));
|
||||
pathMappingPager.setCurrentPageNumber(Integer.parseInt(pathMappingForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + pathMappingForm.pageNumber, e);
|
||||
|
@ -103,10 +100,9 @@ public class BsPathMappingAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(pathMappingForm.searchParams, pathMappingPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(pathMappingForm.searchParams, pathMappingPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -132,9 +128,8 @@ public class BsPathMappingAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (pathMappingForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
}
|
||||
|
||||
loadPathMapping();
|
||||
|
@ -156,9 +151,8 @@ public class BsPathMappingAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (pathMappingForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
}
|
||||
|
||||
loadPathMapping();
|
||||
|
@ -192,9 +186,8 @@ public class BsPathMappingAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (pathMappingForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
}
|
||||
|
||||
loadPathMapping();
|
||||
|
@ -229,8 +222,7 @@ public class BsPathMappingAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,8 +243,7 @@ public class BsPathMappingAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,20 +251,17 @@ public class BsPathMappingAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (pathMappingForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
pathMappingForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final PathMapping pathMapping = pathMappingService
|
||||
.getPathMapping(createKeyMap());
|
||||
final PathMapping pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { pathMappingForm.id });
|
||||
new Object[] { pathMappingForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,28 +277,24 @@ public class BsPathMappingAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadPathMapping() {
|
||||
|
||||
final PathMapping pathMapping = pathMappingService
|
||||
.getPathMapping(createKeyMap());
|
||||
final PathMapping pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { pathMappingForm.id });
|
||||
new Object[] { pathMappingForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(pathMapping, pathMappingForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(pathMapping, pathMappingForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected PathMapping createPathMapping() {
|
||||
|
@ -319,19 +303,17 @@ public class BsPathMappingAction implements Serializable {
|
|||
pathMapping = pathMappingService.getPathMapping(createKeyMap());
|
||||
if (pathMapping == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { pathMappingForm.id });
|
||||
new Object[] { pathMappingForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
pathMapping = new PathMapping();
|
||||
}
|
||||
Beans.copy(pathMappingForm, pathMapping)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(pathMappingForm, pathMapping).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return pathMapping;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsRequestHeaderAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsRequestHeaderAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
requestHeaderItems = requestHeaderService
|
||||
.getRequestHeaderList(requestHeaderPager);
|
||||
requestHeaderItems = requestHeaderService.getRequestHeaderList(requestHeaderPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(requestHeaderPager, requestHeaderForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(requestHeaderPager, requestHeaderForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(requestHeaderForm.pageNumber)) {
|
||||
try {
|
||||
requestHeaderPager.setCurrentPageNumber(Integer
|
||||
.parseInt(requestHeaderForm.pageNumber));
|
||||
requestHeaderPager.setCurrentPageNumber(Integer.parseInt(requestHeaderForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + requestHeaderForm.pageNumber,
|
||||
e);
|
||||
log.debug("Invalid value: " + requestHeaderForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(requestHeaderForm.searchParams, requestHeaderPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(requestHeaderForm.searchParams, requestHeaderPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (requestHeaderForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
}
|
||||
|
||||
loadRequestHeader();
|
||||
|
@ -158,9 +151,8 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (requestHeaderForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
}
|
||||
|
||||
loadRequestHeader();
|
||||
|
@ -194,9 +186,8 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (requestHeaderForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
}
|
||||
|
||||
loadRequestHeader();
|
||||
|
@ -231,8 +222,7 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (requestHeaderForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
requestHeaderForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final RequestHeader requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
final RequestHeader requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { requestHeaderForm.id });
|
||||
new Object[] { requestHeaderForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsRequestHeaderAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadRequestHeader() {
|
||||
|
||||
final RequestHeader requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
final RequestHeader requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { requestHeaderForm.id });
|
||||
new Object[] { requestHeaderForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(requestHeader, requestHeaderForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(requestHeader, requestHeaderForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected RequestHeader createRequestHeader() {
|
||||
RequestHeader requestHeader;
|
||||
if (requestHeaderForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
requestHeader = requestHeaderService
|
||||
.getRequestHeader(createKeyMap());
|
||||
requestHeader = requestHeaderService.getRequestHeader(createKeyMap());
|
||||
if (requestHeader == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { requestHeaderForm.id });
|
||||
new Object[] { requestHeaderForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
requestHeader = new RequestHeader();
|
||||
}
|
||||
Beans.copy(requestHeaderForm, requestHeader)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(requestHeaderForm, requestHeader).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return requestHeader;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsRoleTypeAction implements Serializable {
|
|||
roleTypeItems = roleTypeService.getRoleTypeList(roleTypePager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(roleTypePager, roleTypeForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(roleTypePager, roleTypeForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(roleTypeForm.pageNumber)) {
|
||||
try {
|
||||
roleTypePager.setCurrentPageNumber(Integer
|
||||
.parseInt(roleTypeForm.pageNumber));
|
||||
roleTypePager.setCurrentPageNumber(Integer.parseInt(roleTypeForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + roleTypeForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsRoleTypeAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(roleTypeForm.searchParams, roleTypePager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(roleTypeForm.searchParams, roleTypePager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -131,9 +128,8 @@ public class BsRoleTypeAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (roleTypeForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadRoleType();
|
||||
|
@ -155,9 +151,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (roleTypeForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, roleTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadRoleType();
|
||||
|
@ -192,8 +186,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
public String deletepage() {
|
||||
if (roleTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, roleTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadRoleType();
|
||||
|
@ -228,8 +221,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +242,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,19 +251,16 @@ public class BsRoleTypeAction implements Serializable {
|
|||
public String delete() {
|
||||
if (roleTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
roleTypeForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, roleTypeForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final RoleType roleType = roleTypeService
|
||||
.getRoleType(createKeyMap());
|
||||
final RoleType roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { roleTypeForm.id });
|
||||
new Object[] { roleTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -288,8 +276,7 @@ public class BsRoleTypeAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -298,10 +285,9 @@ public class BsRoleTypeAction implements Serializable {
|
|||
final RoleType roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { roleTypeForm.id });
|
||||
new Object[] { roleTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -316,10 +302,9 @@ public class BsRoleTypeAction implements Serializable {
|
|||
roleType = roleTypeService.getRoleType(createKeyMap());
|
||||
if (roleType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { roleTypeForm.id });
|
||||
new Object[] { roleTypeForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsScheduledJobAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsScheduledJobAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsScheduledJobAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsScheduledJobAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
scheduledJobItems = scheduledJobService
|
||||
.getScheduledJobList(scheduledJobPager);
|
||||
scheduledJobItems = scheduledJobService.getScheduledJobList(scheduledJobPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(scheduledJobPager, scheduledJobForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(scheduledJobPager, scheduledJobForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsScheduledJobAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(scheduledJobForm.pageNumber)) {
|
||||
try {
|
||||
scheduledJobPager.setCurrentPageNumber(Integer
|
||||
.parseInt(scheduledJobForm.pageNumber));
|
||||
scheduledJobPager.setCurrentPageNumber(Integer.parseInt(scheduledJobForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + scheduledJobForm.pageNumber,
|
||||
e);
|
||||
log.debug("Invalid value: " + scheduledJobForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsScheduledJobAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(scheduledJobForm.searchParams, scheduledJobPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(scheduledJobForm.searchParams, scheduledJobPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsScheduledJobAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (scheduledJobForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
}
|
||||
|
||||
loadScheduledJob();
|
||||
|
@ -158,9 +151,8 @@ public class BsScheduledJobAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (scheduledJobForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
}
|
||||
|
||||
loadScheduledJob();
|
||||
|
@ -194,9 +186,8 @@ public class BsScheduledJobAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (scheduledJobForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
}
|
||||
|
||||
loadScheduledJob();
|
||||
|
@ -231,8 +222,7 @@ public class BsScheduledJobAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsScheduledJobAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsScheduledJobAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (scheduledJobForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
scheduledJobForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final ScheduledJob scheduledJob = scheduledJobService
|
||||
.getScheduledJob(createKeyMap());
|
||||
final ScheduledJob scheduledJob = scheduledJobService.getScheduledJob(createKeyMap());
|
||||
if (scheduledJob == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { scheduledJobForm.id });
|
||||
new Object[] { scheduledJobForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,28 +277,24 @@ public class BsScheduledJobAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadScheduledJob() {
|
||||
|
||||
final ScheduledJob scheduledJob = scheduledJobService
|
||||
.getScheduledJob(createKeyMap());
|
||||
final ScheduledJob scheduledJob = scheduledJobService.getScheduledJob(createKeyMap());
|
||||
if (scheduledJob == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { scheduledJobForm.id });
|
||||
new Object[] { scheduledJobForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(scheduledJob, scheduledJobForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(scheduledJob, scheduledJobForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected ScheduledJob createScheduledJob() {
|
||||
|
@ -321,19 +303,17 @@ public class BsScheduledJobAction implements Serializable {
|
|||
scheduledJob = scheduledJobService.getScheduledJob(createKeyMap());
|
||||
if (scheduledJob == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { scheduledJobForm.id });
|
||||
new Object[] { scheduledJobForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
scheduledJob = new ScheduledJob();
|
||||
}
|
||||
Beans.copy(scheduledJobForm, scheduledJob)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(scheduledJobForm, scheduledJob).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return scheduledJob;
|
||||
}
|
||||
|
|
|
@ -66,10 +66,9 @@ public class BsSearchLogAction implements Serializable {
|
|||
searchLogItems = searchLogService.getSearchLogList(searchLogPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(searchLogPager, searchLogForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(searchLogPager, searchLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -88,8 +87,7 @@ public class BsSearchLogAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(searchLogForm.pageNumber)) {
|
||||
try {
|
||||
searchLogPager.setCurrentPageNumber(Integer
|
||||
.parseInt(searchLogForm.pageNumber));
|
||||
searchLogPager.setCurrentPageNumber(Integer.parseInt(searchLogForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + searchLogForm.pageNumber, e);
|
||||
|
@ -102,10 +100,9 @@ public class BsSearchLogAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(searchLogForm.searchParams, searchLogPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(searchLogForm.searchParams, searchLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -131,9 +128,8 @@ public class BsSearchLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (searchLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
searchLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
searchLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadSearchLog();
|
||||
|
@ -156,8 +152,7 @@ public class BsSearchLogAction implements Serializable {
|
|||
public String editpage() {
|
||||
if (searchLogForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
searchLogForm.crudMode });
|
||||
new Object[] { CommonConstants.EDIT_MODE, searchLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadSearchLog();
|
||||
|
@ -191,9 +186,8 @@ public class BsSearchLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (searchLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
searchLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
searchLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadSearchLog();
|
||||
|
@ -228,8 +222,7 @@ public class BsSearchLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,8 +243,7 @@ public class BsSearchLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,20 +251,17 @@ public class BsSearchLogAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (searchLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
searchLogForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
searchLogForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SearchLog searchLog = searchLogService
|
||||
.getSearchLog(createKeyMap());
|
||||
final SearchLog searchLog = searchLogService.getSearchLog(createKeyMap());
|
||||
if (searchLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { searchLogForm.id });
|
||||
new Object[] { searchLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -288,21 +277,18 @@ public class BsSearchLogAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadSearchLog() {
|
||||
|
||||
final SearchLog searchLog = searchLogService
|
||||
.getSearchLog(createKeyMap());
|
||||
final SearchLog searchLog = searchLogService.getSearchLog(createKeyMap());
|
||||
if (searchLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { searchLogForm.id });
|
||||
new Object[] { searchLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -317,10 +303,9 @@ public class BsSearchLogAction implements Serializable {
|
|||
searchLog = searchLogService.getSearchLog(createKeyMap());
|
||||
if (searchLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { searchLogForm.id });
|
||||
new Object[] { searchLogForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsSuggestBadWordAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsSuggestBadWordAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
suggestBadWordItems = suggestBadWordService
|
||||
.getSuggestBadWordList(suggestBadWordPager);
|
||||
suggestBadWordItems = suggestBadWordService.getSuggestBadWordList(suggestBadWordPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(suggestBadWordPager, suggestBadWordForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(suggestBadWordPager, suggestBadWordForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,13 +87,10 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(suggestBadWordForm.pageNumber)) {
|
||||
try {
|
||||
suggestBadWordPager.setCurrentPageNumber(Integer
|
||||
.parseInt(suggestBadWordForm.pageNumber));
|
||||
suggestBadWordPager.setCurrentPageNumber(Integer.parseInt(suggestBadWordForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
"Invalid value: " + suggestBadWordForm.pageNumber,
|
||||
e);
|
||||
log.debug("Invalid value: " + suggestBadWordForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,10 +100,9 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(suggestBadWordForm.searchParams, suggestBadWordPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(suggestBadWordForm.searchParams, suggestBadWordPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -135,9 +128,8 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (suggestBadWordForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestBadWord();
|
||||
|
@ -159,9 +151,8 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (suggestBadWordForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestBadWord();
|
||||
|
@ -195,9 +186,8 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (suggestBadWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestBadWord();
|
||||
|
@ -232,8 +222,7 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,8 +243,7 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,20 +251,17 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (suggestBadWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestBadWordForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -292,50 +277,43 @@ public class BsSuggestBadWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadSuggestBadWord() {
|
||||
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(suggestBadWord, suggestBadWordForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(suggestBadWord, suggestBadWordForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected SuggestBadWord createSuggestBadWord() {
|
||||
SuggestBadWord suggestBadWord;
|
||||
if (suggestBadWordForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
suggestBadWord = suggestBadWordService
|
||||
.getSuggestBadWord(createKeyMap());
|
||||
suggestBadWord = suggestBadWordService.getSuggestBadWord(createKeyMap());
|
||||
if (suggestBadWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
new Object[] { suggestBadWordForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
suggestBadWord = new SuggestBadWord();
|
||||
}
|
||||
Beans.copy(suggestBadWordForm, suggestBadWord)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(suggestBadWordForm, suggestBadWord).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return suggestBadWord;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsSuggestElevateWordAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsSuggestElevateWordAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
suggestElevateWordItems = suggestElevateWordService
|
||||
.getSuggestElevateWordList(suggestElevateWordPager);
|
||||
suggestElevateWordItems = suggestElevateWordService.getSuggestElevateWordList(suggestElevateWordPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(suggestElevateWordPager, suggestElevateWordForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(suggestElevateWordPager, suggestElevateWordForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(suggestElevateWordForm.pageNumber)) {
|
||||
try {
|
||||
suggestElevateWordPager.setCurrentPageNumber(Integer
|
||||
.parseInt(suggestElevateWordForm.pageNumber));
|
||||
suggestElevateWordPager.setCurrentPageNumber(Integer.parseInt(suggestElevateWordForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ suggestElevateWordForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + suggestElevateWordForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(suggestElevateWordForm.searchParams, suggestElevateWordPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(suggestElevateWordForm.searchParams, suggestElevateWordPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (suggestElevateWordForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestElevateWord();
|
||||
|
@ -158,9 +151,8 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (suggestElevateWordForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestElevateWord();
|
||||
|
@ -194,9 +186,8 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (suggestElevateWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
}
|
||||
|
||||
loadSuggestElevateWord();
|
||||
|
@ -231,8 +222,7 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (suggestElevateWordForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
suggestElevateWordForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsSuggestElevateWordAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadSuggestElevateWord() {
|
||||
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(suggestElevateWord, suggestElevateWordForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(suggestElevateWord, suggestElevateWordForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected SuggestElevateWord createSuggestElevateWord() {
|
||||
SuggestElevateWord suggestElevateWord;
|
||||
if (suggestElevateWordForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
suggestElevateWord = suggestElevateWordService
|
||||
.getSuggestElevateWord(createKeyMap());
|
||||
suggestElevateWord = suggestElevateWordService.getSuggestElevateWord(createKeyMap());
|
||||
if (suggestElevateWord == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
new Object[] { suggestElevateWordForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
suggestElevateWord = new SuggestElevateWord();
|
||||
}
|
||||
Beans.copy(suggestElevateWordForm, suggestElevateWord)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(suggestElevateWordForm, suggestElevateWord).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return suggestElevateWord;
|
||||
}
|
||||
|
|
|
@ -67,10 +67,9 @@ public class BsUserInfoAction implements Serializable {
|
|||
userInfoItems = userInfoService.getUserInfoList(userInfoPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(userInfoPager, userInfoForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(userInfoPager, userInfoForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -89,8 +88,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(userInfoForm.pageNumber)) {
|
||||
try {
|
||||
userInfoPager.setCurrentPageNumber(Integer
|
||||
.parseInt(userInfoForm.pageNumber));
|
||||
userInfoPager.setCurrentPageNumber(Integer.parseInt(userInfoForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + userInfoForm.pageNumber, e);
|
||||
|
@ -103,10 +101,9 @@ public class BsUserInfoAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(userInfoForm.searchParams, userInfoPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(userInfoForm.searchParams, userInfoPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -132,9 +129,8 @@ public class BsUserInfoAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (userInfoForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
userInfoForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
userInfoForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserInfo();
|
||||
|
@ -156,9 +152,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (userInfoForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
userInfoForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, userInfoForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserInfo();
|
||||
|
@ -193,8 +187,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
public String deletepage() {
|
||||
if (userInfoForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
userInfoForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, userInfoForm.crudMode });
|
||||
}
|
||||
|
||||
loadUserInfo();
|
||||
|
@ -229,8 +222,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,8 +243,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -261,19 +252,16 @@ public class BsUserInfoAction implements Serializable {
|
|||
public String delete() {
|
||||
if (userInfoForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
userInfoForm.crudMode });
|
||||
new Object[] { CommonConstants.DELETE_MODE, userInfoForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final UserInfo userInfo = userInfoService
|
||||
.getUserInfo(createKeyMap());
|
||||
final UserInfo userInfo = userInfoService.getUserInfo(createKeyMap());
|
||||
if (userInfo == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { userInfoForm.id });
|
||||
new Object[] { userInfoForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,8 +277,7 @@ public class BsUserInfoAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,18 +286,15 @@ public class BsUserInfoAction implements Serializable {
|
|||
final UserInfo userInfo = userInfoService.getUserInfo(createKeyMap());
|
||||
if (userInfo == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { userInfoForm.id });
|
||||
new Object[] { userInfoForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(userInfo, userInfoForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(userInfo, userInfoForm).excludes("searchParams", "mode")
|
||||
|
||||
.timestampConverter(Constants.DEFAULT_DATETIME_FORMAT,
|
||||
"createdTime", "updatedTime").execute();
|
||||
.timestampConverter(Constants.DEFAULT_DATETIME_FORMAT, "createdTime", "updatedTime").execute();
|
||||
}
|
||||
|
||||
protected UserInfo createUserInfo() {
|
||||
|
@ -319,20 +303,17 @@ public class BsUserInfoAction implements Serializable {
|
|||
userInfo = userInfoService.getUserInfo(createKeyMap());
|
||||
if (userInfo == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { userInfoForm.id });
|
||||
new Object[] { userInfoForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
userInfo = new UserInfo();
|
||||
}
|
||||
Beans.copy(userInfoForm, userInfo)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(userInfoForm, userInfo).excludes("searchParams", "mode")
|
||||
|
||||
.timestampConverter(Constants.DEFAULT_DATETIME_FORMAT,
|
||||
"createdTime", "updatedTime").execute();
|
||||
.timestampConverter(Constants.DEFAULT_DATETIME_FORMAT, "createdTime", "updatedTime").execute();
|
||||
|
||||
return userInfo;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsWebAuthenticationAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsWebAuthenticationAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
webAuthenticationItems = webAuthenticationService
|
||||
.getWebAuthenticationList(webAuthenticationPager);
|
||||
webAuthenticationItems = webAuthenticationService.getWebAuthenticationList(webAuthenticationPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(webAuthenticationPager, webAuthenticationForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(webAuthenticationPager, webAuthenticationForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(webAuthenticationForm.pageNumber)) {
|
||||
try {
|
||||
webAuthenticationPager.setCurrentPageNumber(Integer
|
||||
.parseInt(webAuthenticationForm.pageNumber));
|
||||
webAuthenticationPager.setCurrentPageNumber(Integer.parseInt(webAuthenticationForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ webAuthenticationForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + webAuthenticationForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(webAuthenticationForm.searchParams, webAuthenticationPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(webAuthenticationForm.searchParams, webAuthenticationPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (webAuthenticationForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
@ -158,9 +151,8 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (webAuthenticationForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
@ -194,9 +186,8 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
@ -231,8 +222,7 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final WebAuthentication webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsWebAuthenticationAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadWebAuthentication() {
|
||||
|
||||
final WebAuthentication webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(webAuthentication, webAuthenticationForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(webAuthentication, webAuthenticationForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected WebAuthentication createWebAuthentication() {
|
||||
WebAuthentication webAuthentication;
|
||||
if (webAuthenticationForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
webAuthentication = webAuthenticationService
|
||||
.getWebAuthentication(createKeyMap());
|
||||
webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
webAuthentication = new WebAuthentication();
|
||||
}
|
||||
Beans.copy(webAuthenticationForm, webAuthentication)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(webAuthenticationForm, webAuthentication).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return webAuthentication;
|
||||
}
|
||||
|
|
|
@ -43,8 +43,7 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(BsWebCrawlingConfigAction.class);
|
||||
private static final Log log = LogFactory.getLog(BsWebCrawlingConfigAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,14 +63,12 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
webCrawlingConfigItems = webCrawlingConfigService
|
||||
.getWebCrawlingConfigList(webCrawlingConfigPager);
|
||||
webCrawlingConfigItems = webCrawlingConfigService.getWebCrawlingConfigList(webCrawlingConfigPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(webCrawlingConfigPager, webCrawlingConfigForm.searchParams)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(webCrawlingConfigPager, webCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
|
@ -90,12 +87,10 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
// page navi
|
||||
if (StringUtil.isNotBlank(webCrawlingConfigForm.pageNumber)) {
|
||||
try {
|
||||
webCrawlingConfigPager.setCurrentPageNumber(Integer
|
||||
.parseInt(webCrawlingConfigForm.pageNumber));
|
||||
webCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(webCrawlingConfigForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: "
|
||||
+ webCrawlingConfigForm.pageNumber, e);
|
||||
log.debug("Invalid value: " + webCrawlingConfigForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,10 +100,9 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(webCrawlingConfigForm.searchParams, webCrawlingConfigPager)
|
||||
.excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
Beans.copy(webCrawlingConfigForm.searchParams, webCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
@ -134,9 +128,8 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (webCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebCrawlingConfig();
|
||||
|
@ -158,9 +151,8 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (webCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebCrawlingConfig();
|
||||
|
@ -194,9 +186,8 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (webCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebCrawlingConfig();
|
||||
|
@ -231,8 +222,7 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_create_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +243,7 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_update_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,20 +251,17 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (webCrawlingConfigForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
|
@ -291,50 +277,43 @@ public class BsWebCrawlingConfigAction implements Serializable {
|
|||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_failed_to_delete_crud_table");
|
||||
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadWebCrawlingConfig() {
|
||||
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(webCrawlingConfig, webCrawlingConfigForm)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(webCrawlingConfig, webCrawlingConfigForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected WebCrawlingConfig createWebCrawlingConfig() {
|
||||
WebCrawlingConfig webCrawlingConfig;
|
||||
if (webCrawlingConfigForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
webCrawlingConfig = webCrawlingConfigService
|
||||
.getWebCrawlingConfig(createKeyMap());
|
||||
webCrawlingConfig = webCrawlingConfigService.getWebCrawlingConfig(createKeyMap());
|
||||
if (webCrawlingConfig == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException(
|
||||
"errors.crud_could_not_find_crud_table",
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
new Object[] { webCrawlingConfigForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
webCrawlingConfig = new WebCrawlingConfig();
|
||||
}
|
||||
Beans.copy(webCrawlingConfigForm, webCrawlingConfig)
|
||||
.excludes("searchParams", "mode")
|
||||
Beans.copy(webCrawlingConfigForm, webCrawlingConfig).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
.execute();
|
||||
|
||||
return webCrawlingConfig;
|
||||
}
|
||||
|
|
|
@ -39,33 +39,27 @@ public abstract class BsBoostDocumentRuleService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<BoostDocumentRule> getBoostDocumentRuleList(
|
||||
final BoostDocumentRulePager boostDocumentRulePager) {
|
||||
public List<BoostDocumentRule> getBoostDocumentRuleList(final BoostDocumentRulePager boostDocumentRulePager) {
|
||||
|
||||
final PagingResultBean<BoostDocumentRule> boostDocumentRuleList = boostDocumentRuleBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(boostDocumentRulePager.getPageSize(),
|
||||
boostDocumentRulePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, boostDocumentRulePager);
|
||||
});
|
||||
final PagingResultBean<BoostDocumentRule> boostDocumentRuleList = boostDocumentRuleBhv.selectPage(cb -> {
|
||||
cb.paging(boostDocumentRulePager.getPageSize(), boostDocumentRulePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, boostDocumentRulePager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(boostDocumentRuleList, boostDocumentRulePager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
boostDocumentRulePager.setPageNumberList(boostDocumentRuleList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(boostDocumentRuleList, boostDocumentRulePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
boostDocumentRulePager.setPageNumberList(boostDocumentRuleList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return boostDocumentRuleList;
|
||||
}
|
||||
|
||||
public BoostDocumentRule getBoostDocumentRule(final Map<String, String> keys) {
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final BoostDocumentRule boostDocumentRule = boostDocumentRuleBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (boostDocumentRule == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsBoostDocumentRuleService {
|
|||
return boostDocumentRule;
|
||||
}
|
||||
|
||||
public void store(final BoostDocumentRule boostDocumentRule)
|
||||
throws CrudMessageException {
|
||||
public void store(final BoostDocumentRule boostDocumentRule) throws CrudMessageException {
|
||||
setupStoreCondition(boostDocumentRule);
|
||||
|
||||
boostDocumentRuleBhv.insertOrUpdate(boostDocumentRule);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final BoostDocumentRule boostDocumentRule)
|
||||
throws CrudMessageException {
|
||||
public void delete(final BoostDocumentRule boostDocumentRule) throws CrudMessageException {
|
||||
setupDeleteCondition(boostDocumentRule);
|
||||
|
||||
boostDocumentRuleBhv.delete(boostDocumentRule);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final BoostDocumentRuleCB cb,
|
||||
final BoostDocumentRulePager boostDocumentRulePager) {
|
||||
protected void setupListCondition(final BoostDocumentRuleCB cb, final BoostDocumentRulePager boostDocumentRulePager) {
|
||||
|
||||
if (boostDocumentRulePager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(boostDocumentRulePager.id));
|
||||
|
@ -99,14 +90,12 @@ public abstract class BsBoostDocumentRuleService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final BoostDocumentRuleCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final BoostDocumentRuleCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final BoostDocumentRule boostDocumentRule) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final BoostDocumentRule boostDocumentRule) {
|
||||
protected void setupDeleteCondition(final BoostDocumentRule boostDocumentRule) {
|
||||
}
|
||||
}
|
|
@ -39,33 +39,27 @@ public abstract class BsCrawlingSessionService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<CrawlingSession> getCrawlingSessionList(
|
||||
final CrawlingSessionPager crawlingSessionPager) {
|
||||
public List<CrawlingSession> getCrawlingSessionList(final CrawlingSessionPager crawlingSessionPager) {
|
||||
|
||||
final PagingResultBean<CrawlingSession> crawlingSessionList = crawlingSessionBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(crawlingSessionPager.getPageSize(),
|
||||
crawlingSessionPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, crawlingSessionPager);
|
||||
});
|
||||
final PagingResultBean<CrawlingSession> crawlingSessionList = crawlingSessionBhv.selectPage(cb -> {
|
||||
cb.paging(crawlingSessionPager.getPageSize(), crawlingSessionPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, crawlingSessionPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(crawlingSessionList, crawlingSessionPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
crawlingSessionPager.setPageNumberList(crawlingSessionList.pageRange(
|
||||
op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(crawlingSessionList, crawlingSessionPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
crawlingSessionPager.setPageNumberList(crawlingSessionList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return crawlingSessionList;
|
||||
}
|
||||
|
||||
public CrawlingSession getCrawlingSession(final Map<String, String> keys) {
|
||||
final CrawlingSession crawlingSession = crawlingSessionBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final CrawlingSession crawlingSession = crawlingSessionBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (crawlingSession == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsCrawlingSessionService {
|
|||
return crawlingSession;
|
||||
}
|
||||
|
||||
public void store(final CrawlingSession crawlingSession)
|
||||
throws CrudMessageException {
|
||||
public void store(final CrawlingSession crawlingSession) throws CrudMessageException {
|
||||
setupStoreCondition(crawlingSession);
|
||||
|
||||
crawlingSessionBhv.insertOrUpdate(crawlingSession);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final CrawlingSession crawlingSession)
|
||||
throws CrudMessageException {
|
||||
public void delete(final CrawlingSession crawlingSession) throws CrudMessageException {
|
||||
setupDeleteCondition(crawlingSession);
|
||||
|
||||
crawlingSessionBhv.delete(crawlingSession);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final CrawlingSessionCB cb,
|
||||
final CrawlingSessionPager crawlingSessionPager) {
|
||||
protected void setupListCondition(final CrawlingSessionCB cb, final CrawlingSessionPager crawlingSessionPager) {
|
||||
|
||||
if (crawlingSessionPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(crawlingSessionPager.id));
|
||||
|
@ -99,8 +90,7 @@ public abstract class BsCrawlingSessionService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final CrawlingSessionCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final CrawlingSessionCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final CrawlingSession crawlingSession) {
|
||||
|
|
|
@ -39,35 +39,28 @@ public abstract class BsDataCrawlingConfigService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<DataCrawlingConfig> getDataCrawlingConfigList(
|
||||
final DataCrawlingConfigPager dataCrawlingConfigPager) {
|
||||
public List<DataCrawlingConfig> getDataCrawlingConfigList(final DataCrawlingConfigPager dataCrawlingConfigPager) {
|
||||
|
||||
final PagingResultBean<DataCrawlingConfig> dataCrawlingConfigList = dataCrawlingConfigBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(dataCrawlingConfigPager.getPageSize(),
|
||||
dataCrawlingConfigPager.getCurrentPageNumber());
|
||||
final PagingResultBean<DataCrawlingConfig> dataCrawlingConfigList = dataCrawlingConfigBhv.selectPage(cb -> {
|
||||
cb.paging(dataCrawlingConfigPager.getPageSize(), dataCrawlingConfigPager.getCurrentPageNumber());
|
||||
|
||||
setupListCondition(cb, dataCrawlingConfigPager);
|
||||
});
|
||||
setupListCondition(cb, dataCrawlingConfigPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(dataCrawlingConfigList, dataCrawlingConfigPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
dataCrawlingConfigPager.setPageNumberList(dataCrawlingConfigList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(dataCrawlingConfigList, dataCrawlingConfigPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
dataCrawlingConfigPager.setPageNumberList(dataCrawlingConfigList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return dataCrawlingConfigList;
|
||||
}
|
||||
|
||||
public DataCrawlingConfig getDataCrawlingConfig(
|
||||
final Map<String, String> keys) {
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
public DataCrawlingConfig getDataCrawlingConfig(final Map<String, String> keys) {
|
||||
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (dataCrawlingConfig == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -76,24 +69,21 @@ public abstract class BsDataCrawlingConfigService {
|
|||
return dataCrawlingConfig;
|
||||
}
|
||||
|
||||
public void store(final DataCrawlingConfig dataCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void store(final DataCrawlingConfig dataCrawlingConfig) throws CrudMessageException {
|
||||
setupStoreCondition(dataCrawlingConfig);
|
||||
|
||||
dataCrawlingConfigBhv.insertOrUpdate(dataCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final DataCrawlingConfig dataCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void delete(final DataCrawlingConfig dataCrawlingConfig) throws CrudMessageException {
|
||||
setupDeleteCondition(dataCrawlingConfig);
|
||||
|
||||
dataCrawlingConfigBhv.delete(dataCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final DataCrawlingConfigCB cb,
|
||||
final DataCrawlingConfigPager dataCrawlingConfigPager) {
|
||||
protected void setupListCondition(final DataCrawlingConfigCB cb, final DataCrawlingConfigPager dataCrawlingConfigPager) {
|
||||
|
||||
if (dataCrawlingConfigPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(dataCrawlingConfigPager.id));
|
||||
|
@ -101,15 +91,12 @@ public abstract class BsDataCrawlingConfigService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final DataCrawlingConfigCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final DataCrawlingConfigCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(
|
||||
final DataCrawlingConfig dataCrawlingConfig) {
|
||||
protected void setupStoreCondition(final DataCrawlingConfig dataCrawlingConfig) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final DataCrawlingConfig dataCrawlingConfig) {
|
||||
protected void setupDeleteCondition(final DataCrawlingConfig dataCrawlingConfig) {
|
||||
}
|
||||
}
|
|
@ -39,19 +39,15 @@ public abstract class BsFailureUrlService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<FailureUrl> getFailureUrlList(
|
||||
final FailureUrlPager failureUrlPager) {
|
||||
public List<FailureUrl> getFailureUrlList(final FailureUrlPager failureUrlPager) {
|
||||
|
||||
final PagingResultBean<FailureUrl> failureUrlList = failureUrlBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(failureUrlPager.getPageSize(),
|
||||
failureUrlPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, failureUrlPager);
|
||||
});
|
||||
final PagingResultBean<FailureUrl> failureUrlList = failureUrlBhv.selectPage(cb -> {
|
||||
cb.paging(failureUrlPager.getPageSize(), failureUrlPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, failureUrlPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(failureUrlList, failureUrlPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(failureUrlList, failureUrlPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
failureUrlPager.setPageNumberList(failureUrlList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -86,8 +82,7 @@ public abstract class BsFailureUrlService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final FailureUrlCB cb,
|
||||
final FailureUrlPager failureUrlPager) {
|
||||
protected void setupListCondition(final FailureUrlCB cb, final FailureUrlPager failureUrlPager) {
|
||||
|
||||
if (failureUrlPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(failureUrlPager.id));
|
||||
|
@ -95,8 +90,7 @@ public abstract class BsFailureUrlService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final FailureUrlCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final FailureUrlCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final FailureUrl failureUrl) {
|
||||
|
|
|
@ -39,19 +39,15 @@ public abstract class BsFavoriteLogService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<FavoriteLog> getFavoriteLogList(
|
||||
final FavoriteLogPager favoriteLogPager) {
|
||||
public List<FavoriteLog> getFavoriteLogList(final FavoriteLogPager favoriteLogPager) {
|
||||
|
||||
final PagingResultBean<FavoriteLog> favoriteLogList = favoriteLogBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(favoriteLogPager.getPageSize(),
|
||||
favoriteLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, favoriteLogPager);
|
||||
});
|
||||
final PagingResultBean<FavoriteLog> favoriteLogList = favoriteLogBhv.selectPage(cb -> {
|
||||
cb.paging(favoriteLogPager.getPageSize(), favoriteLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, favoriteLogPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(favoriteLogList, favoriteLogPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(favoriteLogList, favoriteLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
favoriteLogPager.setPageNumberList(favoriteLogList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -72,24 +68,21 @@ public abstract class BsFavoriteLogService {
|
|||
return favoriteLog;
|
||||
}
|
||||
|
||||
public void store(final FavoriteLog favoriteLog)
|
||||
throws CrudMessageException {
|
||||
public void store(final FavoriteLog favoriteLog) throws CrudMessageException {
|
||||
setupStoreCondition(favoriteLog);
|
||||
|
||||
favoriteLogBhv.insertOrUpdate(favoriteLog);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final FavoriteLog favoriteLog)
|
||||
throws CrudMessageException {
|
||||
public void delete(final FavoriteLog favoriteLog) throws CrudMessageException {
|
||||
setupDeleteCondition(favoriteLog);
|
||||
|
||||
favoriteLogBhv.delete(favoriteLog);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final FavoriteLogCB cb,
|
||||
final FavoriteLogPager favoriteLogPager) {
|
||||
protected void setupListCondition(final FavoriteLogCB cb, final FavoriteLogPager favoriteLogPager) {
|
||||
|
||||
if (favoriteLogPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(favoriteLogPager.id));
|
||||
|
@ -97,8 +90,7 @@ public abstract class BsFavoriteLogService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final FavoriteLogCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final FavoriteLogCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final FavoriteLog favoriteLog) {
|
||||
|
|
|
@ -39,34 +39,27 @@ public abstract class BsFileAuthenticationService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<FileAuthentication> getFileAuthenticationList(
|
||||
final FileAuthenticationPager fileAuthenticationPager) {
|
||||
public List<FileAuthentication> getFileAuthenticationList(final FileAuthenticationPager fileAuthenticationPager) {
|
||||
|
||||
final PagingResultBean<FileAuthentication> fileAuthenticationList = fileAuthenticationBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(fileAuthenticationPager.getPageSize(),
|
||||
fileAuthenticationPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, fileAuthenticationPager);
|
||||
});
|
||||
final PagingResultBean<FileAuthentication> fileAuthenticationList = fileAuthenticationBhv.selectPage(cb -> {
|
||||
cb.paging(fileAuthenticationPager.getPageSize(), fileAuthenticationPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, fileAuthenticationPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(fileAuthenticationList, fileAuthenticationPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
fileAuthenticationPager.setPageNumberList(fileAuthenticationList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(fileAuthenticationList, fileAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
fileAuthenticationPager.setPageNumberList(fileAuthenticationList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return fileAuthenticationList;
|
||||
}
|
||||
|
||||
public FileAuthentication getFileAuthentication(
|
||||
final Map<String, String> keys) {
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
public FileAuthentication getFileAuthentication(final Map<String, String> keys) {
|
||||
final FileAuthentication fileAuthentication = fileAuthenticationBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (fileAuthentication == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -75,24 +68,21 @@ public abstract class BsFileAuthenticationService {
|
|||
return fileAuthentication;
|
||||
}
|
||||
|
||||
public void store(final FileAuthentication fileAuthentication)
|
||||
throws CrudMessageException {
|
||||
public void store(final FileAuthentication fileAuthentication) throws CrudMessageException {
|
||||
setupStoreCondition(fileAuthentication);
|
||||
|
||||
fileAuthenticationBhv.insertOrUpdate(fileAuthentication);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final FileAuthentication fileAuthentication)
|
||||
throws CrudMessageException {
|
||||
public void delete(final FileAuthentication fileAuthentication) throws CrudMessageException {
|
||||
setupDeleteCondition(fileAuthentication);
|
||||
|
||||
fileAuthenticationBhv.delete(fileAuthentication);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final FileAuthenticationCB cb,
|
||||
final FileAuthenticationPager fileAuthenticationPager) {
|
||||
protected void setupListCondition(final FileAuthenticationCB cb, final FileAuthenticationPager fileAuthenticationPager) {
|
||||
|
||||
if (fileAuthenticationPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(fileAuthenticationPager.id));
|
||||
|
@ -100,15 +90,12 @@ public abstract class BsFileAuthenticationService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final FileAuthenticationCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final FileAuthenticationCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(
|
||||
final FileAuthentication fileAuthentication) {
|
||||
protected void setupStoreCondition(final FileAuthentication fileAuthentication) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final FileAuthentication fileAuthentication) {
|
||||
protected void setupDeleteCondition(final FileAuthentication fileAuthentication) {
|
||||
}
|
||||
}
|
|
@ -39,34 +39,27 @@ public abstract class BsFileCrawlingConfigService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<FileCrawlingConfig> getFileCrawlingConfigList(
|
||||
final FileCrawlingConfigPager fileCrawlingConfigPager) {
|
||||
public List<FileCrawlingConfig> getFileCrawlingConfigList(final FileCrawlingConfigPager fileCrawlingConfigPager) {
|
||||
|
||||
final PagingResultBean<FileCrawlingConfig> fileCrawlingConfigList = fileCrawlingConfigBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(fileCrawlingConfigPager.getPageSize(),
|
||||
fileCrawlingConfigPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, fileCrawlingConfigPager);
|
||||
});
|
||||
final PagingResultBean<FileCrawlingConfig> fileCrawlingConfigList = fileCrawlingConfigBhv.selectPage(cb -> {
|
||||
cb.paging(fileCrawlingConfigPager.getPageSize(), fileCrawlingConfigPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, fileCrawlingConfigPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(fileCrawlingConfigList, fileCrawlingConfigPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
fileCrawlingConfigPager.setPageNumberList(fileCrawlingConfigList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(fileCrawlingConfigList, fileCrawlingConfigPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
fileCrawlingConfigPager.setPageNumberList(fileCrawlingConfigList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return fileCrawlingConfigList;
|
||||
}
|
||||
|
||||
public FileCrawlingConfig getFileCrawlingConfig(
|
||||
final Map<String, String> keys) {
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
public FileCrawlingConfig getFileCrawlingConfig(final Map<String, String> keys) {
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (fileCrawlingConfig == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -75,24 +68,21 @@ public abstract class BsFileCrawlingConfigService {
|
|||
return fileCrawlingConfig;
|
||||
}
|
||||
|
||||
public void store(final FileCrawlingConfig fileCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void store(final FileCrawlingConfig fileCrawlingConfig) throws CrudMessageException {
|
||||
setupStoreCondition(fileCrawlingConfig);
|
||||
|
||||
fileCrawlingConfigBhv.insertOrUpdate(fileCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final FileCrawlingConfig fileCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void delete(final FileCrawlingConfig fileCrawlingConfig) throws CrudMessageException {
|
||||
setupDeleteCondition(fileCrawlingConfig);
|
||||
|
||||
fileCrawlingConfigBhv.delete(fileCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final FileCrawlingConfigCB cb,
|
||||
final FileCrawlingConfigPager fileCrawlingConfigPager) {
|
||||
protected void setupListCondition(final FileCrawlingConfigCB cb, final FileCrawlingConfigPager fileCrawlingConfigPager) {
|
||||
|
||||
if (fileCrawlingConfigPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(fileCrawlingConfigPager.id));
|
||||
|
@ -100,15 +90,12 @@ public abstract class BsFileCrawlingConfigService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final FileCrawlingConfigCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final FileCrawlingConfigCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(
|
||||
final FileCrawlingConfig fileCrawlingConfig) {
|
||||
protected void setupStoreCondition(final FileCrawlingConfig fileCrawlingConfig) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final FileCrawlingConfig fileCrawlingConfig) {
|
||||
protected void setupDeleteCondition(final FileCrawlingConfig fileCrawlingConfig) {
|
||||
}
|
||||
}
|
|
@ -41,16 +41,13 @@ public abstract class BsJobLogService {
|
|||
|
||||
public List<JobLog> getJobLogList(final JobLogPager jobLogPager) {
|
||||
|
||||
final PagingResultBean<JobLog> jobLogList = jobLogBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(jobLogPager.getPageSize(),
|
||||
jobLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, jobLogPager);
|
||||
});
|
||||
final PagingResultBean<JobLog> jobLogList = jobLogBhv.selectPage(cb -> {
|
||||
cb.paging(jobLogPager.getPageSize(), jobLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, jobLogPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(jobLogList, jobLogPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(jobLogList, jobLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
jobLogPager.setPageNumberList(jobLogList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsJobLogService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final JobLogCB cb,
|
||||
final JobLogPager jobLogPager) {
|
||||
protected void setupListCondition(final JobLogCB cb, final JobLogPager jobLogPager) {
|
||||
|
||||
if (jobLogPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(jobLogPager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsJobLogService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final JobLogCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final JobLogCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final JobLog jobLog) {
|
||||
|
|
|
@ -41,16 +41,13 @@ public abstract class BsKeyMatchService {
|
|||
|
||||
public List<KeyMatch> getKeyMatchList(final KeyMatchPager keyMatchPager) {
|
||||
|
||||
final PagingResultBean<KeyMatch> keyMatchList = keyMatchBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(keyMatchPager.getPageSize(),
|
||||
keyMatchPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, keyMatchPager);
|
||||
});
|
||||
final PagingResultBean<KeyMatch> keyMatchList = keyMatchBhv.selectPage(cb -> {
|
||||
cb.paging(keyMatchPager.getPageSize(), keyMatchPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, keyMatchPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(keyMatchList, keyMatchPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(keyMatchList, keyMatchPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
keyMatchPager.setPageNumberList(keyMatchList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsKeyMatchService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final KeyMatchCB cb,
|
||||
final KeyMatchPager keyMatchPager) {
|
||||
protected void setupListCondition(final KeyMatchCB cb, final KeyMatchPager keyMatchPager) {
|
||||
|
||||
if (keyMatchPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(keyMatchPager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsKeyMatchService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final KeyMatchCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final KeyMatchCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final KeyMatch keyMatch) {
|
||||
|
|
|
@ -41,16 +41,13 @@ public abstract class BsLabelTypeService {
|
|||
|
||||
public List<LabelType> getLabelTypeList(final LabelTypePager labelTypePager) {
|
||||
|
||||
final PagingResultBean<LabelType> labelTypeList = labelTypeBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(labelTypePager.getPageSize(),
|
||||
labelTypePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, labelTypePager);
|
||||
});
|
||||
final PagingResultBean<LabelType> labelTypeList = labelTypeBhv.selectPage(cb -> {
|
||||
cb.paging(labelTypePager.getPageSize(), labelTypePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, labelTypePager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(labelTypeList, labelTypePager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(labelTypeList, labelTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
labelTypePager.setPageNumberList(labelTypeList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsLabelTypeService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final LabelTypeCB cb,
|
||||
final LabelTypePager labelTypePager) {
|
||||
protected void setupListCondition(final LabelTypeCB cb, final LabelTypePager labelTypePager) {
|
||||
|
||||
if (labelTypePager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(labelTypePager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsLabelTypeService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final LabelTypeCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final LabelTypeCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final LabelType labelType) {
|
||||
|
|
|
@ -39,33 +39,27 @@ public abstract class BsOverlappingHostService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<OverlappingHost> getOverlappingHostList(
|
||||
final OverlappingHostPager overlappingHostPager) {
|
||||
public List<OverlappingHost> getOverlappingHostList(final OverlappingHostPager overlappingHostPager) {
|
||||
|
||||
final PagingResultBean<OverlappingHost> overlappingHostList = overlappingHostBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(overlappingHostPager.getPageSize(),
|
||||
overlappingHostPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, overlappingHostPager);
|
||||
});
|
||||
final PagingResultBean<OverlappingHost> overlappingHostList = overlappingHostBhv.selectPage(cb -> {
|
||||
cb.paging(overlappingHostPager.getPageSize(), overlappingHostPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, overlappingHostPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(overlappingHostList, overlappingHostPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
overlappingHostPager.setPageNumberList(overlappingHostList.pageRange(
|
||||
op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(overlappingHostList, overlappingHostPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
overlappingHostPager.setPageNumberList(overlappingHostList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return overlappingHostList;
|
||||
}
|
||||
|
||||
public OverlappingHost getOverlappingHost(final Map<String, String> keys) {
|
||||
final OverlappingHost overlappingHost = overlappingHostBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final OverlappingHost overlappingHost = overlappingHostBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (overlappingHost == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsOverlappingHostService {
|
|||
return overlappingHost;
|
||||
}
|
||||
|
||||
public void store(final OverlappingHost overlappingHost)
|
||||
throws CrudMessageException {
|
||||
public void store(final OverlappingHost overlappingHost) throws CrudMessageException {
|
||||
setupStoreCondition(overlappingHost);
|
||||
|
||||
overlappingHostBhv.insertOrUpdate(overlappingHost);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final OverlappingHost overlappingHost)
|
||||
throws CrudMessageException {
|
||||
public void delete(final OverlappingHost overlappingHost) throws CrudMessageException {
|
||||
setupDeleteCondition(overlappingHost);
|
||||
|
||||
overlappingHostBhv.delete(overlappingHost);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final OverlappingHostCB cb,
|
||||
final OverlappingHostPager overlappingHostPager) {
|
||||
protected void setupListCondition(final OverlappingHostCB cb, final OverlappingHostPager overlappingHostPager) {
|
||||
|
||||
if (overlappingHostPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(overlappingHostPager.id));
|
||||
|
@ -99,8 +90,7 @@ public abstract class BsOverlappingHostService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final OverlappingHostCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final OverlappingHostCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final OverlappingHost overlappingHost) {
|
||||
|
|
|
@ -39,19 +39,15 @@ public abstract class BsPathMappingService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<PathMapping> getPathMappingList(
|
||||
final PathMappingPager pathMappingPager) {
|
||||
public List<PathMapping> getPathMappingList(final PathMappingPager pathMappingPager) {
|
||||
|
||||
final PagingResultBean<PathMapping> pathMappingList = pathMappingBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(pathMappingPager.getPageSize(),
|
||||
pathMappingPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, pathMappingPager);
|
||||
});
|
||||
final PagingResultBean<PathMapping> pathMappingList = pathMappingBhv.selectPage(cb -> {
|
||||
cb.paging(pathMappingPager.getPageSize(), pathMappingPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, pathMappingPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(pathMappingList, pathMappingPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(pathMappingList, pathMappingPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
pathMappingPager.setPageNumberList(pathMappingList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -72,24 +68,21 @@ public abstract class BsPathMappingService {
|
|||
return pathMapping;
|
||||
}
|
||||
|
||||
public void store(final PathMapping pathMapping)
|
||||
throws CrudMessageException {
|
||||
public void store(final PathMapping pathMapping) throws CrudMessageException {
|
||||
setupStoreCondition(pathMapping);
|
||||
|
||||
pathMappingBhv.insertOrUpdate(pathMapping);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final PathMapping pathMapping)
|
||||
throws CrudMessageException {
|
||||
public void delete(final PathMapping pathMapping) throws CrudMessageException {
|
||||
setupDeleteCondition(pathMapping);
|
||||
|
||||
pathMappingBhv.delete(pathMapping);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final PathMappingCB cb,
|
||||
final PathMappingPager pathMappingPager) {
|
||||
protected void setupListCondition(final PathMappingCB cb, final PathMappingPager pathMappingPager) {
|
||||
|
||||
if (pathMappingPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(pathMappingPager.id));
|
||||
|
@ -97,8 +90,7 @@ public abstract class BsPathMappingService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final PathMappingCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final PathMappingCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final PathMapping pathMapping) {
|
||||
|
|
|
@ -39,33 +39,27 @@ public abstract class BsRequestHeaderService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<RequestHeader> getRequestHeaderList(
|
||||
final RequestHeaderPager requestHeaderPager) {
|
||||
public List<RequestHeader> getRequestHeaderList(final RequestHeaderPager requestHeaderPager) {
|
||||
|
||||
final PagingResultBean<RequestHeader> requestHeaderList = requestHeaderBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(requestHeaderPager.getPageSize(),
|
||||
requestHeaderPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, requestHeaderPager);
|
||||
});
|
||||
final PagingResultBean<RequestHeader> requestHeaderList = requestHeaderBhv.selectPage(cb -> {
|
||||
cb.paging(requestHeaderPager.getPageSize(), requestHeaderPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, requestHeaderPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(requestHeaderList, requestHeaderPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
requestHeaderPager.setPageNumberList(requestHeaderList.pageRange(
|
||||
op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(requestHeaderList, requestHeaderPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
requestHeaderPager.setPageNumberList(requestHeaderList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return requestHeaderList;
|
||||
}
|
||||
|
||||
public RequestHeader getRequestHeader(final Map<String, String> keys) {
|
||||
final RequestHeader requestHeader = requestHeaderBhv.selectEntity(
|
||||
cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final RequestHeader requestHeader = requestHeaderBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (requestHeader == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsRequestHeaderService {
|
|||
return requestHeader;
|
||||
}
|
||||
|
||||
public void store(final RequestHeader requestHeader)
|
||||
throws CrudMessageException {
|
||||
public void store(final RequestHeader requestHeader) throws CrudMessageException {
|
||||
setupStoreCondition(requestHeader);
|
||||
|
||||
requestHeaderBhv.insertOrUpdate(requestHeader);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final RequestHeader requestHeader)
|
||||
throws CrudMessageException {
|
||||
public void delete(final RequestHeader requestHeader) throws CrudMessageException {
|
||||
setupDeleteCondition(requestHeader);
|
||||
|
||||
requestHeaderBhv.delete(requestHeader);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final RequestHeaderCB cb,
|
||||
final RequestHeaderPager requestHeaderPager) {
|
||||
protected void setupListCondition(final RequestHeaderCB cb, final RequestHeaderPager requestHeaderPager) {
|
||||
|
||||
if (requestHeaderPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(requestHeaderPager.id));
|
||||
|
@ -99,8 +90,7 @@ public abstract class BsRequestHeaderService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final RequestHeaderCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final RequestHeaderCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final RequestHeader requestHeader) {
|
||||
|
|
|
@ -41,16 +41,13 @@ public abstract class BsRoleTypeService {
|
|||
|
||||
public List<RoleType> getRoleTypeList(final RoleTypePager roleTypePager) {
|
||||
|
||||
final PagingResultBean<RoleType> roleTypeList = roleTypeBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(roleTypePager.getPageSize(),
|
||||
roleTypePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, roleTypePager);
|
||||
});
|
||||
final PagingResultBean<RoleType> roleTypeList = roleTypeBhv.selectPage(cb -> {
|
||||
cb.paging(roleTypePager.getPageSize(), roleTypePager.getCurrentPageNumber());
|
||||
setupListCondition(cb, roleTypePager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(roleTypeList, roleTypePager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(roleTypeList, roleTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
roleTypePager.setPageNumberList(roleTypeList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsRoleTypeService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final RoleTypeCB cb,
|
||||
final RoleTypePager roleTypePager) {
|
||||
protected void setupListCondition(final RoleTypeCB cb, final RoleTypePager roleTypePager) {
|
||||
|
||||
if (roleTypePager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(roleTypePager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsRoleTypeService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final RoleTypeCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final RoleTypeCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final RoleType roleType) {
|
||||
|
|
|
@ -39,19 +39,15 @@ public abstract class BsScheduledJobService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<ScheduledJob> getScheduledJobList(
|
||||
final ScheduledJobPager scheduledJobPager) {
|
||||
public List<ScheduledJob> getScheduledJobList(final ScheduledJobPager scheduledJobPager) {
|
||||
|
||||
final PagingResultBean<ScheduledJob> scheduledJobList = scheduledJobBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(scheduledJobPager.getPageSize(),
|
||||
scheduledJobPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, scheduledJobPager);
|
||||
});
|
||||
final PagingResultBean<ScheduledJob> scheduledJobList = scheduledJobBhv.selectPage(cb -> {
|
||||
cb.paging(scheduledJobPager.getPageSize(), scheduledJobPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, scheduledJobPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(scheduledJobList, scheduledJobPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(scheduledJobList, scheduledJobPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
scheduledJobPager.setPageNumberList(scheduledJobList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -72,24 +68,21 @@ public abstract class BsScheduledJobService {
|
|||
return scheduledJob;
|
||||
}
|
||||
|
||||
public void store(final ScheduledJob scheduledJob)
|
||||
throws CrudMessageException {
|
||||
public void store(final ScheduledJob scheduledJob) throws CrudMessageException {
|
||||
setupStoreCondition(scheduledJob);
|
||||
|
||||
scheduledJobBhv.insertOrUpdate(scheduledJob);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final ScheduledJob scheduledJob)
|
||||
throws CrudMessageException {
|
||||
public void delete(final ScheduledJob scheduledJob) throws CrudMessageException {
|
||||
setupDeleteCondition(scheduledJob);
|
||||
|
||||
scheduledJobBhv.delete(scheduledJob);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final ScheduledJobCB cb,
|
||||
final ScheduledJobPager scheduledJobPager) {
|
||||
protected void setupListCondition(final ScheduledJobCB cb, final ScheduledJobPager scheduledJobPager) {
|
||||
|
||||
if (scheduledJobPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(scheduledJobPager.id));
|
||||
|
@ -97,8 +90,7 @@ public abstract class BsScheduledJobService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final ScheduledJobCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final ScheduledJobCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final ScheduledJob scheduledJob) {
|
||||
|
|
|
@ -41,16 +41,13 @@ public abstract class BsSearchLogService {
|
|||
|
||||
public List<SearchLog> getSearchLogList(final SearchLogPager searchLogPager) {
|
||||
|
||||
final PagingResultBean<SearchLog> searchLogList = searchLogBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(searchLogPager.getPageSize(),
|
||||
searchLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, searchLogPager);
|
||||
});
|
||||
final PagingResultBean<SearchLog> searchLogList = searchLogBhv.selectPage(cb -> {
|
||||
cb.paging(searchLogPager.getPageSize(), searchLogPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, searchLogPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(searchLogList, searchLogPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(searchLogList, searchLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
searchLogPager.setPageNumberList(searchLogList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsSearchLogService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final SearchLogCB cb,
|
||||
final SearchLogPager searchLogPager) {
|
||||
protected void setupListCondition(final SearchLogCB cb, final SearchLogPager searchLogPager) {
|
||||
|
||||
if (searchLogPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(searchLogPager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsSearchLogService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final SearchLogCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final SearchLogCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final SearchLog searchLog) {
|
||||
|
|
|
@ -39,33 +39,27 @@ public abstract class BsSuggestBadWordService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<SuggestBadWord> getSuggestBadWordList(
|
||||
final SuggestBadWordPager suggestBadWordPager) {
|
||||
public List<SuggestBadWord> getSuggestBadWordList(final SuggestBadWordPager suggestBadWordPager) {
|
||||
|
||||
final PagingResultBean<SuggestBadWord> suggestBadWordList = suggestBadWordBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(suggestBadWordPager.getPageSize(),
|
||||
suggestBadWordPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, suggestBadWordPager);
|
||||
});
|
||||
final PagingResultBean<SuggestBadWord> suggestBadWordList = suggestBadWordBhv.selectPage(cb -> {
|
||||
cb.paging(suggestBadWordPager.getPageSize(), suggestBadWordPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, suggestBadWordPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(suggestBadWordList, suggestBadWordPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
suggestBadWordPager.setPageNumberList(suggestBadWordList.pageRange(
|
||||
op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(suggestBadWordList, suggestBadWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
suggestBadWordPager.setPageNumberList(suggestBadWordList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return suggestBadWordList;
|
||||
}
|
||||
|
||||
public SuggestBadWord getSuggestBadWord(final Map<String, String> keys) {
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordBhv.selectEntity(
|
||||
cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final SuggestBadWord suggestBadWord = suggestBadWordBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (suggestBadWord == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsSuggestBadWordService {
|
|||
return suggestBadWord;
|
||||
}
|
||||
|
||||
public void store(final SuggestBadWord suggestBadWord)
|
||||
throws CrudMessageException {
|
||||
public void store(final SuggestBadWord suggestBadWord) throws CrudMessageException {
|
||||
setupStoreCondition(suggestBadWord);
|
||||
|
||||
suggestBadWordBhv.insertOrUpdate(suggestBadWord);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final SuggestBadWord suggestBadWord)
|
||||
throws CrudMessageException {
|
||||
public void delete(final SuggestBadWord suggestBadWord) throws CrudMessageException {
|
||||
setupDeleteCondition(suggestBadWord);
|
||||
|
||||
suggestBadWordBhv.delete(suggestBadWord);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final SuggestBadWordCB cb,
|
||||
final SuggestBadWordPager suggestBadWordPager) {
|
||||
protected void setupListCondition(final SuggestBadWordCB cb, final SuggestBadWordPager suggestBadWordPager) {
|
||||
|
||||
if (suggestBadWordPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(suggestBadWordPager.id));
|
||||
|
@ -99,8 +90,7 @@ public abstract class BsSuggestBadWordService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final SuggestBadWordCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final SuggestBadWordCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final SuggestBadWord suggestBadWord) {
|
||||
|
|
|
@ -39,34 +39,27 @@ public abstract class BsSuggestElevateWordService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<SuggestElevateWord> getSuggestElevateWordList(
|
||||
final SuggestElevateWordPager suggestElevateWordPager) {
|
||||
public List<SuggestElevateWord> getSuggestElevateWordList(final SuggestElevateWordPager suggestElevateWordPager) {
|
||||
|
||||
final PagingResultBean<SuggestElevateWord> suggestElevateWordList = suggestElevateWordBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(suggestElevateWordPager.getPageSize(),
|
||||
suggestElevateWordPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, suggestElevateWordPager);
|
||||
});
|
||||
final PagingResultBean<SuggestElevateWord> suggestElevateWordList = suggestElevateWordBhv.selectPage(cb -> {
|
||||
cb.paging(suggestElevateWordPager.getPageSize(), suggestElevateWordPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, suggestElevateWordPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(suggestElevateWordList, suggestElevateWordPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
suggestElevateWordPager.setPageNumberList(suggestElevateWordList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(suggestElevateWordList, suggestElevateWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
suggestElevateWordPager.setPageNumberList(suggestElevateWordList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return suggestElevateWordList;
|
||||
}
|
||||
|
||||
public SuggestElevateWord getSuggestElevateWord(
|
||||
final Map<String, String> keys) {
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
public SuggestElevateWord getSuggestElevateWord(final Map<String, String> keys) {
|
||||
final SuggestElevateWord suggestElevateWord = suggestElevateWordBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (suggestElevateWord == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -75,24 +68,21 @@ public abstract class BsSuggestElevateWordService {
|
|||
return suggestElevateWord;
|
||||
}
|
||||
|
||||
public void store(final SuggestElevateWord suggestElevateWord)
|
||||
throws CrudMessageException {
|
||||
public void store(final SuggestElevateWord suggestElevateWord) throws CrudMessageException {
|
||||
setupStoreCondition(suggestElevateWord);
|
||||
|
||||
suggestElevateWordBhv.insertOrUpdate(suggestElevateWord);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final SuggestElevateWord suggestElevateWord)
|
||||
throws CrudMessageException {
|
||||
public void delete(final SuggestElevateWord suggestElevateWord) throws CrudMessageException {
|
||||
setupDeleteCondition(suggestElevateWord);
|
||||
|
||||
suggestElevateWordBhv.delete(suggestElevateWord);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final SuggestElevateWordCB cb,
|
||||
final SuggestElevateWordPager suggestElevateWordPager) {
|
||||
protected void setupListCondition(final SuggestElevateWordCB cb, final SuggestElevateWordPager suggestElevateWordPager) {
|
||||
|
||||
if (suggestElevateWordPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(suggestElevateWordPager.id));
|
||||
|
@ -100,15 +90,12 @@ public abstract class BsSuggestElevateWordService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final SuggestElevateWordCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final SuggestElevateWordCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(
|
||||
final SuggestElevateWord suggestElevateWord) {
|
||||
protected void setupStoreCondition(final SuggestElevateWord suggestElevateWord) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final SuggestElevateWord suggestElevateWord) {
|
||||
protected void setupDeleteCondition(final SuggestElevateWord suggestElevateWord) {
|
||||
}
|
||||
}
|
|
@ -41,16 +41,13 @@ public abstract class BsUserInfoService {
|
|||
|
||||
public List<UserInfo> getUserInfoList(final UserInfoPager userInfoPager) {
|
||||
|
||||
final PagingResultBean<UserInfo> userInfoList = userInfoBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(userInfoPager.getPageSize(),
|
||||
userInfoPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, userInfoPager);
|
||||
});
|
||||
final PagingResultBean<UserInfo> userInfoList = userInfoBhv.selectPage(cb -> {
|
||||
cb.paging(userInfoPager.getPageSize(), userInfoPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, userInfoPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(userInfoList, userInfoPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
Beans.copy(userInfoList, userInfoPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
userInfoPager.setPageNumberList(userInfoList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
@ -85,8 +82,7 @@ public abstract class BsUserInfoService {
|
|||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final UserInfoCB cb,
|
||||
final UserInfoPager userInfoPager) {
|
||||
protected void setupListCondition(final UserInfoCB cb, final UserInfoPager userInfoPager) {
|
||||
|
||||
if (userInfoPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(userInfoPager.id));
|
||||
|
@ -94,8 +90,7 @@ public abstract class BsUserInfoService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final UserInfoCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final UserInfoCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final UserInfo userInfo) {
|
||||
|
|
|
@ -39,33 +39,27 @@ public abstract class BsWebAuthenticationService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<WebAuthentication> getWebAuthenticationList(
|
||||
final WebAuthenticationPager webAuthenticationPager) {
|
||||
public List<WebAuthentication> getWebAuthenticationList(final WebAuthenticationPager webAuthenticationPager) {
|
||||
|
||||
final PagingResultBean<WebAuthentication> webAuthenticationList = webAuthenticationBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(webAuthenticationPager.getPageSize(),
|
||||
webAuthenticationPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, webAuthenticationPager);
|
||||
});
|
||||
final PagingResultBean<WebAuthentication> webAuthenticationList = webAuthenticationBhv.selectPage(cb -> {
|
||||
cb.paging(webAuthenticationPager.getPageSize(), webAuthenticationPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, webAuthenticationPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(webAuthenticationList, webAuthenticationPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
webAuthenticationPager.setPageNumberList(webAuthenticationList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(webAuthenticationList, webAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
webAuthenticationPager.setPageNumberList(webAuthenticationList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return webAuthenticationList;
|
||||
}
|
||||
|
||||
public WebAuthentication getWebAuthentication(final Map<String, String> keys) {
|
||||
final WebAuthentication webAuthentication = webAuthenticationBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final WebAuthentication webAuthentication = webAuthenticationBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (webAuthentication == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsWebAuthenticationService {
|
|||
return webAuthentication;
|
||||
}
|
||||
|
||||
public void store(final WebAuthentication webAuthentication)
|
||||
throws CrudMessageException {
|
||||
public void store(final WebAuthentication webAuthentication) throws CrudMessageException {
|
||||
setupStoreCondition(webAuthentication);
|
||||
|
||||
webAuthenticationBhv.insertOrUpdate(webAuthentication);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final WebAuthentication webAuthentication)
|
||||
throws CrudMessageException {
|
||||
public void delete(final WebAuthentication webAuthentication) throws CrudMessageException {
|
||||
setupDeleteCondition(webAuthentication);
|
||||
|
||||
webAuthenticationBhv.delete(webAuthentication);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final WebAuthenticationCB cb,
|
||||
final WebAuthenticationPager webAuthenticationPager) {
|
||||
protected void setupListCondition(final WebAuthenticationCB cb, final WebAuthenticationPager webAuthenticationPager) {
|
||||
|
||||
if (webAuthenticationPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(webAuthenticationPager.id));
|
||||
|
@ -99,14 +90,12 @@ public abstract class BsWebAuthenticationService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final WebAuthenticationCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final WebAuthenticationCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final WebAuthentication webAuthentication) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final WebAuthentication webAuthentication) {
|
||||
protected void setupDeleteCondition(final WebAuthentication webAuthentication) {
|
||||
}
|
||||
}
|
|
@ -39,33 +39,27 @@ public abstract class BsWebCrawlingConfigService {
|
|||
super();
|
||||
}
|
||||
|
||||
public List<WebCrawlingConfig> getWebCrawlingConfigList(
|
||||
final WebCrawlingConfigPager webCrawlingConfigPager) {
|
||||
public List<WebCrawlingConfig> getWebCrawlingConfigList(final WebCrawlingConfigPager webCrawlingConfigPager) {
|
||||
|
||||
final PagingResultBean<WebCrawlingConfig> webCrawlingConfigList = webCrawlingConfigBhv
|
||||
.selectPage(cb -> {
|
||||
cb.paging(webCrawlingConfigPager.getPageSize(),
|
||||
webCrawlingConfigPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, webCrawlingConfigPager);
|
||||
});
|
||||
final PagingResultBean<WebCrawlingConfig> webCrawlingConfigList = webCrawlingConfigBhv.selectPage(cb -> {
|
||||
cb.paging(webCrawlingConfigPager.getPageSize(), webCrawlingConfigPager.getCurrentPageNumber());
|
||||
setupListCondition(cb, webCrawlingConfigPager);
|
||||
});
|
||||
|
||||
// update pager
|
||||
Beans.copy(webCrawlingConfigList, webCrawlingConfigPager)
|
||||
.includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
webCrawlingConfigPager.setPageNumberList(webCrawlingConfigList
|
||||
.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
Beans.copy(webCrawlingConfigList, webCrawlingConfigPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
|
||||
webCrawlingConfigPager.setPageNumberList(webCrawlingConfigList.pageRange(op -> {
|
||||
op.rangeSize(5);
|
||||
}).createPageNumberList());
|
||||
|
||||
return webCrawlingConfigList;
|
||||
}
|
||||
|
||||
public WebCrawlingConfig getWebCrawlingConfig(final Map<String, String> keys) {
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigBhv
|
||||
.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigBhv.selectEntity(cb -> {
|
||||
cb.query().setId_Equal(Long.parseLong(keys.get("id")));
|
||||
setupEntityCondition(cb, keys);
|
||||
}).orElse(null);//TODO
|
||||
if (webCrawlingConfig == null) {
|
||||
// TODO exception?
|
||||
return null;
|
||||
|
@ -74,24 +68,21 @@ public abstract class BsWebCrawlingConfigService {
|
|||
return webCrawlingConfig;
|
||||
}
|
||||
|
||||
public void store(final WebCrawlingConfig webCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void store(final WebCrawlingConfig webCrawlingConfig) throws CrudMessageException {
|
||||
setupStoreCondition(webCrawlingConfig);
|
||||
|
||||
webCrawlingConfigBhv.insertOrUpdate(webCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
public void delete(final WebCrawlingConfig webCrawlingConfig)
|
||||
throws CrudMessageException {
|
||||
public void delete(final WebCrawlingConfig webCrawlingConfig) throws CrudMessageException {
|
||||
setupDeleteCondition(webCrawlingConfig);
|
||||
|
||||
webCrawlingConfigBhv.delete(webCrawlingConfig);
|
||||
|
||||
}
|
||||
|
||||
protected void setupListCondition(final WebCrawlingConfigCB cb,
|
||||
final WebCrawlingConfigPager webCrawlingConfigPager) {
|
||||
protected void setupListCondition(final WebCrawlingConfigCB cb, final WebCrawlingConfigPager webCrawlingConfigPager) {
|
||||
|
||||
if (webCrawlingConfigPager.id != null) {
|
||||
cb.query().setId_Equal(Long.parseLong(webCrawlingConfigPager.id));
|
||||
|
@ -99,14 +90,12 @@ public abstract class BsWebCrawlingConfigService {
|
|||
// TODO Long, Integer, String supported only.
|
||||
}
|
||||
|
||||
protected void setupEntityCondition(final WebCrawlingConfigCB cb,
|
||||
final Map<String, String> keys) {
|
||||
protected void setupEntityCondition(final WebCrawlingConfigCB cb, final Map<String, String> keys) {
|
||||
}
|
||||
|
||||
protected void setupStoreCondition(final WebCrawlingConfig webCrawlingConfig) {
|
||||
}
|
||||
|
||||
protected void setupDeleteCondition(
|
||||
final WebCrawlingConfig webCrawlingConfig) {
|
||||
protected void setupDeleteCondition(final WebCrawlingConfig webCrawlingConfig) {
|
||||
}
|
||||
}
|
|
@ -32,8 +32,7 @@ public class SAStrutsUtil {
|
|||
addMessage(RequestUtil.getRequest(), key);
|
||||
}
|
||||
|
||||
public static void addMessage(final HttpServletRequest request,
|
||||
final String key) {
|
||||
public static void addMessage(final HttpServletRequest request, final String key) {
|
||||
final ActionMessages msgs = new ActionMessages();
|
||||
msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(key));
|
||||
ActionMessagesUtil.saveMessages(request, msgs);
|
||||
|
@ -43,8 +42,7 @@ public class SAStrutsUtil {
|
|||
addMessage(RequestUtil.getRequest(), key, values);
|
||||
}
|
||||
|
||||
public static void addMessage(final HttpServletRequest request,
|
||||
final String key, final Object... values) {
|
||||
public static void addMessage(final HttpServletRequest request, final String key, final Object... values) {
|
||||
final ActionMessages msgs = new ActionMessages();
|
||||
msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(key, values));
|
||||
ActionMessagesUtil.saveMessages(request, msgs);
|
||||
|
@ -54,20 +52,17 @@ public class SAStrutsUtil {
|
|||
addSessionMessage(RequestUtil.getRequest(), key);
|
||||
}
|
||||
|
||||
public static void addSessionMessage(final HttpServletRequest request,
|
||||
final String key) {
|
||||
public static void addSessionMessage(final HttpServletRequest request, final String key) {
|
||||
final ActionMessages msgs = new ActionMessages();
|
||||
msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(key));
|
||||
ActionMessagesUtil.saveMessages(request.getSession(), msgs);
|
||||
}
|
||||
|
||||
public static void addSessionMessage(final String key,
|
||||
final Object... values) {
|
||||
public static void addSessionMessage(final String key, final Object... values) {
|
||||
addSessionMessage(RequestUtil.getRequest(), key, values);
|
||||
}
|
||||
|
||||
public static void addSessionMessage(final HttpServletRequest request,
|
||||
final String key, final Object... values) {
|
||||
public static void addSessionMessage(final HttpServletRequest request, final String key, final Object... values) {
|
||||
final ActionMessages msgs = new ActionMessages();
|
||||
msgs.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(key, values));
|
||||
ActionMessagesUtil.saveMessages(request.getSession(), msgs);
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsDataConfigToLabelTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class DataConfigToLabelTypeMappingBhv extends
|
||||
BsDataConfigToLabelTypeMappingBhv {
|
||||
public class DataConfigToLabelTypeMappingBhv extends BsDataConfigToLabelTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsDataConfigToRoleTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class DataConfigToRoleTypeMappingBhv extends
|
||||
BsDataConfigToRoleTypeMappingBhv {
|
||||
public class DataConfigToRoleTypeMappingBhv extends BsDataConfigToRoleTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsFileConfigToLabelTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class FileConfigToLabelTypeMappingBhv extends
|
||||
BsFileConfigToLabelTypeMappingBhv {
|
||||
public class FileConfigToLabelTypeMappingBhv extends BsFileConfigToLabelTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsFileConfigToRoleTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class FileConfigToRoleTypeMappingBhv extends
|
||||
BsFileConfigToRoleTypeMappingBhv {
|
||||
public class FileConfigToRoleTypeMappingBhv extends BsFileConfigToRoleTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsLabelTypeToRoleTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class LabelTypeToRoleTypeMappingBhv extends
|
||||
BsLabelTypeToRoleTypeMappingBhv {
|
||||
public class LabelTypeToRoleTypeMappingBhv extends BsLabelTypeToRoleTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsWebConfigToLabelTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class WebConfigToLabelTypeMappingBhv extends
|
||||
BsWebConfigToLabelTypeMappingBhv {
|
||||
public class WebConfigToLabelTypeMappingBhv extends BsWebConfigToLabelTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -26,6 +26,5 @@ import org.codelibs.fess.db.bsbhv.BsWebConfigToRoleTypeMappingBhv;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class WebConfigToRoleTypeMappingBhv extends
|
||||
BsWebConfigToRoleTypeMappingBhv {
|
||||
public class WebConfigToRoleTypeMappingBhv extends BsWebConfigToRoleTypeMappingBhv {
|
||||
}
|
||||
|
|
|
@ -60,8 +60,7 @@ public class ClickLog extends BsClickLog {
|
|||
}
|
||||
|
||||
public String getRequestedTimeForList() {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
Constants.DEFAULT_DATETIME_FORMAT);
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(Constants.DEFAULT_DATETIME_FORMAT);
|
||||
if (getRequestedTime() != null) {
|
||||
return sdf.format(getRequestedTime());
|
||||
}
|
||||
|
@ -86,10 +85,8 @@ public class ClickLog extends BsClickLog {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClickLog [queryRequestedTime=" + queryRequestedTime
|
||||
+ ", userSessionId=" + userSessionId + ", docId=" + docId
|
||||
+ ", clickCount=" + clickCount + ", _id=" + _id
|
||||
+ ", _searchId=" + _searchId + ", _url=" + _url
|
||||
+ ", _requestedTime=" + _requestedTime + "]";
|
||||
return "ClickLog [queryRequestedTime=" + queryRequestedTime + ", userSessionId=" + userSessionId + ", docId=" + docId
|
||||
+ ", clickCount=" + clickCount + ", _id=" + _id + ", _searchId=" + _searchId + ", _url=" + _url + ", _requestedTime="
|
||||
+ _requestedTime + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public class CrawlingSessionInfo extends BsCrawlingSessionInfo {
|
|||
|
||||
public String getKeyMsg() {
|
||||
final Locale locale = RequestUtil.getRequest().getLocale();
|
||||
final String message = MessageResourcesUtil.getMessage(locale,
|
||||
"labels.crawling_session_" + getKey());
|
||||
final String message = MessageResourcesUtil.getMessage(locale, "labels.crawling_session_" + getKey());
|
||||
if (message == null || message.startsWith("???")) {
|
||||
return getKey();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.codelibs.fess.db.bsentity.BsDataConfigToLabelTypeMapping;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class DataConfigToLabelTypeMapping extends
|
||||
BsDataConfigToLabelTypeMapping {
|
||||
public class DataConfigToLabelTypeMapping extends BsDataConfigToLabelTypeMapping {
|
||||
|
||||
/** Serial version UID. (Default) */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -54,14 +54,12 @@ import org.slf4j.LoggerFactory;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
||||
CrawlingConfig {
|
||||
public class DataCrawlingConfig extends BsDataCrawlingConfig implements CrawlingConfig {
|
||||
|
||||
/** Serial version UID. (Default) */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(DataCrawlingConfig.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(DataCrawlingConfig.class);
|
||||
|
||||
private static final String S2ROBOT_WEB_HEADER_PREFIX = "s2robot.web.header.";
|
||||
|
||||
|
@ -156,8 +154,7 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
if (value != null) {
|
||||
try {
|
||||
_boost = new BigDecimal(value);
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
} catch (final Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,8 +184,7 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initializeClientFactory(
|
||||
final S2RobotClientFactory robotClientFactory) {
|
||||
public void initializeClientFactory(final S2RobotClientFactory robotClientFactory) {
|
||||
final Map<String, String> paramMap = getHandlerParameterMap();
|
||||
|
||||
final Map<String, Object> factoryParamMap = new HashMap<String, Object>();
|
||||
|
@ -198,9 +194,7 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
for (final Map.Entry<String, String> entry : paramMap.entrySet()) {
|
||||
final String key = entry.getKey();
|
||||
if (key.startsWith(S2ROBOT_PARAM_PREFIX)) {
|
||||
factoryParamMap.put(
|
||||
key.substring(S2ROBOT_PARAM_PREFIX.length()),
|
||||
entry.getValue());
|
||||
factoryParamMap.put(key.substring(S2ROBOT_PARAM_PREFIX.length()), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,18 +210,12 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
final String[] webAuthNames = webAuthStr.split(",");
|
||||
final List<Authentication> basicAuthList = new ArrayList<Authentication>();
|
||||
for (final String webAuthName : webAuthNames) {
|
||||
final String scheme = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".scheme");
|
||||
final String hostname = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".host");
|
||||
final String port = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".port");
|
||||
final String realm = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".realm");
|
||||
final String username = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".username");
|
||||
final String password = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".password");
|
||||
final String scheme = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".scheme");
|
||||
final String hostname = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".host");
|
||||
final String port = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".port");
|
||||
final String realm = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".realm");
|
||||
final String username = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".username");
|
||||
final String password = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".password");
|
||||
|
||||
if (StringUtil.isEmpty(username)) {
|
||||
logger.warn("username is empty. webAuth:" + webAuthName);
|
||||
|
@ -262,8 +250,7 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
}
|
||||
|
||||
String s = scheme;
|
||||
if (StringUtil.isBlank(scheme)
|
||||
|| Constants.NTLM.equals(scheme)) {
|
||||
if (StringUtil.isBlank(scheme) || Constants.NTLM.equals(scheme)) {
|
||||
s = AuthScope.ANY_SCHEME;
|
||||
}
|
||||
authScope = new AuthScope(hostname, p, r, s);
|
||||
|
@ -271,47 +258,34 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
|
||||
Credentials credentials;
|
||||
if (Constants.NTLM.equals(scheme)) {
|
||||
final String workstation = paramMap.get(S2ROBOT_WEB_AUTH
|
||||
+ "." + webAuthName + ".workstation");
|
||||
final String domain = paramMap.get(S2ROBOT_WEB_AUTH + "."
|
||||
+ webAuthName + ".domain");
|
||||
credentials = new NTCredentials(username,
|
||||
password == null ? StringUtil.EMPTY : password,
|
||||
workstation == null ? StringUtil.EMPTY
|
||||
: workstation,
|
||||
domain == null ? StringUtil.EMPTY : domain);
|
||||
final String workstation = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".workstation");
|
||||
final String domain = paramMap.get(S2ROBOT_WEB_AUTH + "." + webAuthName + ".domain");
|
||||
credentials =
|
||||
new NTCredentials(username, password == null ? StringUtil.EMPTY : password,
|
||||
workstation == null ? StringUtil.EMPTY : workstation, domain == null ? StringUtil.EMPTY : domain);
|
||||
} else {
|
||||
credentials = new UsernamePasswordCredentials(username,
|
||||
password == null ? StringUtil.EMPTY : password);
|
||||
credentials = new UsernamePasswordCredentials(username, password == null ? StringUtil.EMPTY : password);
|
||||
}
|
||||
|
||||
basicAuthList.add(new AuthenticationImpl(authScope,
|
||||
credentials, authScheme));
|
||||
basicAuthList.add(new AuthenticationImpl(authScope, credentials, authScheme));
|
||||
}
|
||||
factoryParamMap.put(HcHttpClient.BASIC_AUTHENTICATIONS_PROPERTY,
|
||||
basicAuthList.toArray(new Authentication[basicAuthList
|
||||
.size()]));
|
||||
basicAuthList.toArray(new Authentication[basicAuthList.size()]));
|
||||
}
|
||||
|
||||
// request header
|
||||
final List<org.codelibs.robot.client.http.RequestHeader> rhList = new ArrayList<org.codelibs.robot.client.http.RequestHeader>();
|
||||
int count = 1;
|
||||
String headerName = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX + count
|
||||
+ ".name");
|
||||
String headerName = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX + count + ".name");
|
||||
while (StringUtil.isNotBlank(headerName)) {
|
||||
final String headerValue = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX
|
||||
+ count + ".value");
|
||||
rhList.add(new org.codelibs.robot.client.http.RequestHeader(
|
||||
headerName, headerValue));
|
||||
final String headerValue = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX + count + ".value");
|
||||
rhList.add(new org.codelibs.robot.client.http.RequestHeader(headerName, headerValue));
|
||||
count++;
|
||||
headerName = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX + count
|
||||
+ ".name");
|
||||
headerName = paramMap.get(S2ROBOT_WEB_HEADER_PREFIX + count + ".name");
|
||||
}
|
||||
if (!rhList.isEmpty()) {
|
||||
factoryParamMap
|
||||
.put(HcHttpClient.REQUERT_HEADERS_PROPERTY,
|
||||
rhList.toArray(new org.codelibs.robot.client.http.RequestHeader[rhList
|
||||
.size()]));
|
||||
factoryParamMap.put(HcHttpClient.REQUERT_HEADERS_PROPERTY,
|
||||
rhList.toArray(new org.codelibs.robot.client.http.RequestHeader[rhList.size()]));
|
||||
}
|
||||
|
||||
// file auth
|
||||
|
@ -320,29 +294,21 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
final String[] fileAuthNames = fileAuthStr.split(",");
|
||||
final List<SmbAuthentication> smbAuthList = new ArrayList<SmbAuthentication>();
|
||||
for (final String fileAuthName : fileAuthNames) {
|
||||
final String scheme = paramMap.get(S2ROBOT_FILE_AUTH + "."
|
||||
+ fileAuthName + ".scheme");
|
||||
final String scheme = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".scheme");
|
||||
if (Constants.SAMBA.equals(scheme)) {
|
||||
final String domain = paramMap.get(S2ROBOT_FILE_AUTH + "."
|
||||
+ fileAuthName + ".domain");
|
||||
final String hostname = paramMap.get(S2ROBOT_FILE_AUTH
|
||||
+ "." + fileAuthName + ".host");
|
||||
final String port = paramMap.get(S2ROBOT_FILE_AUTH + "."
|
||||
+ fileAuthName + ".port");
|
||||
final String username = paramMap.get(S2ROBOT_FILE_AUTH
|
||||
+ "." + fileAuthName + ".username");
|
||||
final String password = paramMap.get(S2ROBOT_FILE_AUTH
|
||||
+ "." + fileAuthName + ".password");
|
||||
final String domain = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".domain");
|
||||
final String hostname = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".host");
|
||||
final String port = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".port");
|
||||
final String username = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".username");
|
||||
final String password = paramMap.get(S2ROBOT_FILE_AUTH + "." + fileAuthName + ".password");
|
||||
|
||||
if (StringUtil.isEmpty(username)) {
|
||||
logger.warn("username is empty. fileAuth:"
|
||||
+ fileAuthName);
|
||||
logger.warn("username is empty. fileAuth:" + fileAuthName);
|
||||
continue;
|
||||
}
|
||||
|
||||
final SmbAuthentication smbAuth = new SmbAuthentication();
|
||||
smbAuth.setDomain(domain == null ? StringUtil.EMPTY
|
||||
: domain);
|
||||
smbAuth.setDomain(domain == null ? StringUtil.EMPTY : domain);
|
||||
smbAuth.setServer(hostname);
|
||||
if (StringUtil.isNotBlank(port)) {
|
||||
try {
|
||||
|
@ -352,15 +318,12 @@ public class DataCrawlingConfig extends BsDataCrawlingConfig implements
|
|||
}
|
||||
}
|
||||
smbAuth.setUsername(username);
|
||||
smbAuth.setPassword(password == null ? StringUtil.EMPTY
|
||||
: password);
|
||||
smbAuth.setPassword(password == null ? StringUtil.EMPTY : password);
|
||||
smbAuthList.add(smbAuth);
|
||||
}
|
||||
}
|
||||
if (!smbAuthList.isEmpty()) {
|
||||
factoryParamMap.put(SmbClient.SMB_AUTHENTICATIONS_PROPERTY,
|
||||
smbAuthList.toArray(new SmbAuthentication[smbAuthList
|
||||
.size()]));
|
||||
factoryParamMap.put(SmbClient.SMB_AUTHENTICATIONS_PROPERTY, smbAuthList.toArray(new SmbAuthentication[smbAuthList.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,7 @@ public class FailureUrl extends BsFailureUrl {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public String getLastAccessTimeForList() {
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
Constants.DEFAULT_DATETIME_FORMAT);
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(Constants.DEFAULT_DATETIME_FORMAT);
|
||||
if (getLastAccessTime() != null) {
|
||||
return sdf.format(getLastAccessTime());
|
||||
}
|
||||
|
@ -46,8 +45,7 @@ public class FailureUrl extends BsFailureUrl {
|
|||
}
|
||||
|
||||
public String getWebConfigName() {
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil
|
||||
.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
if (crawlingConfig != null) {
|
||||
return crawlingConfig.getName();
|
||||
}
|
||||
|
@ -55,8 +53,7 @@ public class FailureUrl extends BsFailureUrl {
|
|||
}
|
||||
|
||||
public String getFileConfigName() {
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil
|
||||
.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
if (crawlingConfig != null) {
|
||||
return crawlingConfig.getName();
|
||||
}
|
||||
|
@ -64,8 +61,7 @@ public class FailureUrl extends BsFailureUrl {
|
|||
}
|
||||
|
||||
public String getDataConfigName() {
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil
|
||||
.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
final CrawlingConfig crawlingConfig = ComponentUtil.getCrawlingConfigHelper().getCrawlingConfig(getConfigId());
|
||||
if (crawlingConfig != null) {
|
||||
return crawlingConfig.getName();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import org.codelibs.fess.db.bsentity.BsFileConfigToLabelTypeMapping;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class FileConfigToLabelTypeMapping extends
|
||||
BsFileConfigToLabelTypeMapping {
|
||||
public class FileConfigToLabelTypeMapping extends BsFileConfigToLabelTypeMapping {
|
||||
|
||||
/** Serial version UID. (Default) */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -44,8 +44,7 @@ import org.seasar.framework.container.SingletonS2Container;
|
|||
* </p>
|
||||
* @author DBFlute(AutoGenerator)
|
||||
*/
|
||||
public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
||||
CrawlingConfig {
|
||||
public class FileCrawlingConfig extends BsFileCrawlingConfig implements CrawlingConfig {
|
||||
|
||||
/** Serial version UID. (Default) */
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -126,8 +125,7 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
initDocPathPattern();
|
||||
}
|
||||
|
||||
if (includedDocPathPatterns.length == 0
|
||||
&& excludedDocPathPatterns.length == 0) {
|
||||
if (includedDocPathPatterns.length == 0 && excludedDocPathPatterns.length == 0) {
|
||||
return Constants.TRUE;
|
||||
}
|
||||
|
||||
|
@ -156,12 +154,10 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
final String[] paths = getIncludedDocPaths().split("[\r\n]");
|
||||
for (final String u : paths) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
pathPatterList.add(Pattern.compile(systemHelper
|
||||
.encodeUrlFilter(u.trim())));
|
||||
pathPatterList.add(Pattern.compile(systemHelper.encodeUrlFilter(u.trim())));
|
||||
}
|
||||
}
|
||||
includedDocPathPatterns = pathPatterList
|
||||
.toArray(new Pattern[pathPatterList.size()]);
|
||||
includedDocPathPatterns = pathPatterList.toArray(new Pattern[pathPatterList.size()]);
|
||||
} else {
|
||||
includedDocPathPatterns = new Pattern[0];
|
||||
}
|
||||
|
@ -173,12 +169,10 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
final String[] paths = getExcludedDocPaths().split("[\r\n]");
|
||||
for (final String u : paths) {
|
||||
if (StringUtil.isNotBlank(u) && !u.trim().startsWith("#")) {
|
||||
pathPatterList.add(Pattern.compile(systemHelper
|
||||
.encodeUrlFilter(u.trim())));
|
||||
pathPatterList.add(Pattern.compile(systemHelper.encodeUrlFilter(u.trim())));
|
||||
}
|
||||
}
|
||||
excludedDocPathPatterns = pathPatterList
|
||||
.toArray(new Pattern[pathPatterList.size()]);
|
||||
excludedDocPathPatterns = pathPatterList.toArray(new Pattern[pathPatterList.size()]);
|
||||
} else if (includedDocPathPatterns.length > 0) {
|
||||
excludedDocPathPatterns = new Pattern[] { Pattern.compile(".*") };
|
||||
} else {
|
||||
|
@ -198,8 +192,7 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
if (value != null) {
|
||||
try {
|
||||
_boost = new BigDecimal(value);
|
||||
} catch (final Exception e) {
|
||||
}
|
||||
} catch (final Exception e) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -210,8 +203,7 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
|
||||
@Override
|
||||
public void initializeClientFactory(final S2RobotClientFactory clientFactory) {
|
||||
final FileAuthenticationService fileAuthenticationService = SingletonS2Container
|
||||
.getComponent(FileAuthenticationService.class);
|
||||
final FileAuthenticationService fileAuthenticationService = SingletonS2Container.getComponent(FileAuthenticationService.class);
|
||||
|
||||
// Parameters
|
||||
final Map<String, Object> paramMap = new HashMap<String, Object>();
|
||||
|
@ -223,14 +215,12 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
}
|
||||
|
||||
// auth params
|
||||
final List<FileAuthentication> fileAuthList = fileAuthenticationService
|
||||
.getFileAuthenticationList(getId());
|
||||
final List<FileAuthentication> fileAuthList = fileAuthenticationService.getFileAuthenticationList(getId());
|
||||
final List<SmbAuthentication> smbAuthList = new ArrayList<SmbAuthentication>();
|
||||
for (final FileAuthentication fileAuth : fileAuthList) {
|
||||
if (Constants.SAMBA.equals(fileAuth.getProtocolScheme())) {
|
||||
final SmbAuthentication smbAuth = new SmbAuthentication();
|
||||
final Map<String, String> map = ParameterUtil.parse(fileAuth
|
||||
.getParameters());
|
||||
final Map<String, String> map = ParameterUtil.parse(fileAuth.getParameters());
|
||||
final String domain = map.get("domain");
|
||||
smbAuth.setDomain(domain == null ? StringUtil.EMPTY : domain);
|
||||
smbAuth.setServer(fileAuth.getHostname());
|
||||
|
@ -240,16 +230,14 @@ public class FileCrawlingConfig extends BsFileCrawlingConfig implements
|
|||
smbAuthList.add(smbAuth);
|
||||
}
|
||||
}
|
||||
paramMap.put(SmbClient.SMB_AUTHENTICATIONS_PROPERTY,
|
||||
smbAuthList.toArray(new SmbAuthentication[smbAuthList.size()]));
|
||||
paramMap.put(SmbClient.SMB_AUTHENTICATIONS_PROPERTY, smbAuthList.toArray(new SmbAuthentication[smbAuthList.size()]));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getConfigParameterMap(final ConfigName name) {
|
||||
if (configParameterMap == null) {
|
||||
configParameterMap = ParameterUtil
|
||||
.createConfigParameterMap(getConfigParameter());
|
||||
configParameterMap = ParameterUtil.createConfigParameterMap(getConfigParameter());
|
||||
}
|
||||
|
||||
final Map<String, String> configMap = configParameterMap.get(name);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue