This commit is contained in:
Shinsuke Sugaya 2015-03-20 06:39:14 +09:00
parent 624e0db1cc
commit 6c7ee4a44a
4 changed files with 46 additions and 84 deletions

View file

@ -16,7 +16,6 @@
package org.codelibs.fess.action.admin;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -24,42 +23,44 @@ import java.util.Map;
import javax.annotation.Resource;
import org.codelibs.fess.action.base.FessAdminAction;
import org.codelibs.fess.crud.CommonConstants;
import org.codelibs.fess.crud.CrudMessageException;
import org.codelibs.fess.crud.util.SAStrutsUtil;
import org.codelibs.fess.db.exentity.CrawlingSession;
import org.codelibs.fess.db.exentity.CrawlingSessionInfo;
import org.codelibs.fess.form.admin.CrawlingSessionForm;
import org.codelibs.fess.pager.CrawlingSessionPager;
import org.codelibs.fess.service.CrawlingSessionService;
import org.codelibs.fess.helper.JobHelper;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.pager.CrawlingSessionPager;
import org.codelibs.fess.service.CrawlingSessionService;
import org.codelibs.sastruts.core.annotation.Token;
import org.seasar.framework.beans.util.Beans;
import org.seasar.framework.util.StringUtil;
import org.seasar.struts.annotation.ActionForm;
import org.seasar.struts.annotation.Execute;
import org.seasar.struts.exception.ActionMessagesException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CrawlingSessionAction extends FessAdminAction {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(CrawlingSessionAction.class);
//for list
public List<CrawlingSession> crawlingSessionItems;
// for edit/confirm/delete
@ActionForm
@Resource
protected CrawlingSessionForm crawlingSessionForm;
@Resource
protected CrawlingSessionService crawlingSessionService;
@Resource
protected CrawlingSessionPager crawlingSessionPager;
@Resource
protected SystemHelper systemHelper;
@ -69,7 +70,7 @@ public class CrawlingSessionAction extends FessAdminAction {
public String getHelpLink() {
return systemHelper.getHelpLink("crawlingSession");
}
protected String displayList(final boolean redirect) {
// page navi
crawlingSessionItems = crawlingSessionService.getCrawlingSessionList(crawlingSessionPager);
@ -99,13 +100,12 @@ public class CrawlingSessionAction extends FessAdminAction {
SAStrutsUtil.addSessionMessage("success.crawling_session_delete_all");
return displayList(true);
}
@Execute(validator = false, input = "error.jsp")
public String index() {
return displayList(false);
}
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
public String list() {
// page navi
@ -170,7 +170,7 @@ public class CrawlingSessionAction extends FessAdminAction {
return "edit.jsp";
}
@Token(save = true, validate = false)
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
public String editpage() {
@ -183,7 +183,7 @@ public class CrawlingSessionAction extends FessAdminAction {
return "edit.jsp";
}
@Token(save = true, validate = false)
@Execute(validator = false, input = "error.jsp")
public String editfromconfirm() {
@ -305,7 +305,6 @@ public class CrawlingSessionAction extends FessAdminAction {
}
}
protected void loadCrawlingSession() {
final CrawlingSession crawlingSession = crawlingSessionService.getCrawlingSession(createKeyMap());
@ -350,5 +349,5 @@ public class CrawlingSessionAction extends FessAdminAction {
return keys;
}
}

View file

@ -53,10 +53,9 @@ import org.slf4j.LoggerFactory;
public class DataCrawlingConfigAction extends FessAdminAction {
private static final Logger logger = LoggerFactory.getLogger(DataCrawlingConfigAction.class);
private static final Logger logger = LoggerFactory.getLogger(DataCrawlingConfigAction.class);
// for list
// for list
public List<DataCrawlingConfig> dataCrawlingConfigItems;
@ -284,8 +283,7 @@ public class DataCrawlingConfigAction extends FessAdminAction {
return keys;
}
protected void loadDataCrawlingConfig() {
final DataCrawlingConfig dataCrawlingConfig = dataCrawlingConfigService.getDataCrawlingConfig(createKeyMap());

View file

@ -43,9 +43,9 @@ import org.slf4j.LoggerFactory;
public class FailureUrlAction extends FessAdminAction {
private static final Logger logger = LoggerFactory.getLogger(FailureUrlAction.class);
// for list
private static final Logger logger = LoggerFactory.getLogger(FailureUrlAction.class);
// for list
public List<FailureUrl> failureUrlItems;
@ -60,14 +60,14 @@ public class FailureUrlAction extends FessAdminAction {
@Resource
protected FailureUrlPager failureUrlPager;
@Resource
protected SystemHelper systemHelper;
public String getHelpLink() {
return systemHelper.getHelpLink("failureUrl");
}
protected String displayList(final boolean redirect) {
// page navi
failureUrlItems = failureUrlService.getFailureUrlList(failureUrlPager);
@ -332,7 +332,7 @@ public class FailureUrlAction extends FessAdminAction {
return keys;
}
@Execute(validator = false, input = "error.jsp")
public String deleteall() {
failureUrlService.deleteAll(failureUrlPager);

View file

@ -16,7 +16,6 @@
package org.codelibs.fess.action.admin;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
@ -25,9 +24,9 @@ import java.util.Map;
import javax.annotation.Resource;
import org.codelibs.fess.action.base.FessAdminAction;
import org.codelibs.core.util.StringUtil;
import org.codelibs.fess.Constants;
import org.codelibs.fess.action.base.FessAdminAction;
import org.codelibs.fess.beans.FessBeans;
import org.codelibs.fess.crud.CommonConstants;
import org.codelibs.fess.crud.CrudMessageException;
@ -35,36 +34,37 @@ import org.codelibs.fess.crud.util.SAStrutsUtil;
import org.codelibs.fess.db.exentity.FileAuthentication;
import org.codelibs.fess.db.exentity.FileCrawlingConfig;
import org.codelibs.fess.form.admin.FileAuthenticationForm;
import org.codelibs.fess.pager.FileAuthenticationPager;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.pager.FileAuthenticationPager;
import org.codelibs.fess.service.FileAuthenticationService;
import org.codelibs.fess.service.FileCrawlingConfigService;
import org.codelibs.sastruts.core.annotation.Token;
import org.codelibs.sastruts.core.exception.SSCActionMessagesException;
import org.seasar.framework.beans.util.Beans;
import org.seasar.framework.util.StringUtil;
import org.seasar.struts.annotation.ActionForm;
import org.seasar.struts.annotation.Execute;
import org.seasar.struts.exception.ActionMessagesException;
import org.seasar.struts.util.MessageResourcesUtil;
import org.seasar.struts.util.RequestUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FileAuthenticationAction extends FessAdminAction {
private static final Logger logger = LoggerFactory.getLogger(FileAuthenticationAction.class);
// for list
private static final Logger logger = LoggerFactory.getLogger(FileAuthenticationAction.class);
// for list
public List<FileAuthentication> fileAuthenticationItems;
// for edit/confirm/delete
@ActionForm
@ActionForm
@Resource
protected FileCrawlingConfigService fileCrawlingConfigService;
@Resource
protected SystemHelper systemHelper;
@Resource
protected FileAuthenticationForm fileAuthenticationForm;
@ -77,7 +77,7 @@ public class FileAuthenticationAction extends FessAdminAction {
public String getHelpLink() {
return systemHelper.getHelpLink("fileAuthentication");
}
protected String displayList(final boolean redirect) {
// page navi
fileAuthenticationItems = fileAuthenticationService.getFileAuthenticationList(fileAuthenticationPager);
@ -93,7 +93,7 @@ public class FileAuthenticationAction extends FessAdminAction {
return "index.jsp";
}
}
@Execute(validator = false, input = "error.jsp")
public String index() {
return displayList(false);
@ -253,52 +253,17 @@ public class FileAuthenticationAction extends FessAdminAction {
return displayList(true);
} catch (final ActionMessagesException e) {
logger.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw e;
} catch (final CrudMessageException e) {
logger.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
} catch (final Exception e) {
logger.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
}
}
@Token(save = false, validate = true)
@Execute(validator = false, input = "error.jsp")
public String delete() {
if (fileAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
fileAuthenticationForm.crudMode });
}
try {
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
if (fileAuthentication == null) {
// throw an exception
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
new Object[] { fileAuthenticationForm.id });
}
fileAuthenticationService.delete(fileAuthentication);
SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
return displayList(true);
} catch (final ActionMessagesException e) {
logger.error(e.getMessage(), e);
throw e;
} catch (final CrudMessageException e) {
logger.error(e.getMessage(), e);
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
} catch (final Exception e) {
logger.error(e.getMessage(), e);
throw new ActionMessagesException("errors.crud_failed_to_delete_crud_table");
}
}
protected void loadFileAuthentication() {
final FileAuthentication fileAuthentication = fileAuthenticationService.getFileAuthentication(createKeyMap());
@ -362,13 +327,13 @@ public class FileAuthenticationAction extends FessAdminAction {
return displayList(true);
} catch (final ActionMessagesException e) {
log.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw e;
} catch (final CrudMessageException e) {
log.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
} catch (final Exception e) {
log.error(e.getMessage(), e);
logger.error(e.getMessage(), e);
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
}
}
@ -380,7 +345,7 @@ public class FileAuthenticationAction extends FessAdminAction {
return keys;
}
public boolean isDisplayCreateLink() {
return !fileCrawlingConfigService.getAllFileCrawlingConfigList(false, false, false, null).isEmpty();
}