Merge pull request #268 from codelibs/revert-267-issue-250
Revert "Issue 250"
This commit is contained in:
commit
d1d0ec16a5
7 changed files with 343 additions and 741 deletions
Binary file not shown.
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.codelibs.fess.action.admin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -51,11 +51,7 @@ import org.slf4j.LoggerFactory;
|
|||
public class FileCrawlingConfigAction extends FessAdminAction {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(FileCrawlingConfigAction.class);
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
// for list
|
||||
|
||||
public List<FileCrawlingConfig> fileCrawlingConfigItems;
|
||||
|
@ -87,7 +83,7 @@ public class FileCrawlingConfigAction extends FessAdminAction {
|
|||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("fileCrawlingConfig");
|
||||
}
|
||||
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
|
||||
|
@ -182,103 +178,6 @@ public class FileCrawlingConfigAction extends FessAdminAction {
|
|||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
fileCrawlingConfigItems = fileCrawlingConfigService.getFileCrawlingConfigList(fileCrawlingConfigPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(fileCrawlingConfigPager, fileCrawlingConfigForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String index() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
|
||||
public String list() {
|
||||
// page navi
|
||||
if (StringUtil.isNotBlank(fileCrawlingConfigForm.pageNumber)) {
|
||||
try {
|
||||
fileCrawlingConfigPager.setCurrentPageNumber(Integer.parseInt(fileCrawlingConfigForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Invalid value: " + fileCrawlingConfigForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(fileCrawlingConfigForm.searchParams, fileCrawlingConfigPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
fileCrawlingConfigPager.clear();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String back() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editagain() {
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
loadFileCrawlingConfig();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
fileCrawlingConfigForm.initialize();
|
||||
fileCrawlingConfigForm.crudMode = CommonConstants.CREATE_MODE;
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (fileCrawlingConfigForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
fileCrawlingConfigForm.crudMode });
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
loadFileCrawlingConfig();
|
||||
|
||||
return "edit.jsp";
|
||||
|
@ -378,11 +277,7 @@ public class FileCrawlingConfigAction extends FessAdminAction {
|
|||
|
||||
return keys;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
protected void loadFileCrawlingConfig() {
|
||||
|
||||
final FileCrawlingConfig fileCrawlingConfig = fileCrawlingConfigService.getFileCrawlingConfig(createKeyMap());
|
||||
|
|
|
@ -27,13 +27,6 @@ import org.codelibs.fess.Constants;
|
|||
import org.codelibs.fess.action.base.FessAdminAction;
|
||||
import org.codelibs.fess.crud.CommonConstants;
|
||||
import org.codelibs.fess.crud.CrudMessageException;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import org.codelibs.fess.crud.action.admin.BsJobLogAction;
|
||||
>>>>>>> 51bcde16892e677a8f00914daaa2b948b12451c6
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.db.exentity.JobLog;
|
||||
import org.codelibs.fess.form.admin.JobLogForm;
|
||||
|
@ -51,17 +44,8 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
public class JobLogAction extends FessAdminAction {
|
||||
|
||||
<<<<<<< HEAD
|
||||
private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
|
||||
|
||||
=======
|
||||
<<<<<<< HEAD
|
||||
private static final Logger logger = LoggerFactory.getLogger(JobLogAction.class);
|
||||
=======
|
||||
private static final Logger logger = LoggerFactory.getLogger(BsJobLogAction.class);
|
||||
>>>>>>> 51bcde16892e677a8f00914daaa2b948b12451c6
|
||||
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
// for list
|
||||
|
||||
public List<JobLog> jobLogItems;
|
||||
|
@ -84,268 +68,6 @@ public class JobLogAction extends FessAdminAction {
|
|||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("jobLog");
|
||||
}
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
jobLogItems = jobLogService.getJobLogList(jobLogPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(jobLogPager, jobLogForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String index() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
|
||||
public String list() {
|
||||
// page navi
|
||||
if (StringUtil.isNotBlank(jobLogForm.pageNumber)) {
|
||||
try {
|
||||
jobLogPager.setCurrentPageNumber(Integer.parseInt(jobLogForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Invalid value: " + jobLogForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(jobLogForm.searchParams, jobLogPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
jobLogPager.clear();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String back() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editagain() {
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.CONFIRM_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
jobLogForm.initialize();
|
||||
jobLogForm.crudMode = CommonConstants.CREATE_MODE;
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editfromconfirm() {
|
||||
jobLogForm.crudMode = CommonConstants.EDIT_MODE;
|
||||
|
||||
loadJobLog();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromcreate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromupdate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (jobLogForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE, jobLogForm.crudMode });
|
||||
}
|
||||
|
||||
loadJobLog();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deletefromconfirm() {
|
||||
jobLogForm.crudMode = CommonConstants.DELETE_MODE;
|
||||
|
||||
loadJobLog();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String create() {
|
||||
try {
|
||||
final JobLog jobLog = createJobLog();
|
||||
jobLogService.store(jobLog);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String update() {
|
||||
try {
|
||||
final JobLog jobLog = createJobLog();
|
||||
jobLogService.store(jobLog);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@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 });
|
||||
}
|
||||
|
||||
try {
|
||||
final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
jobLogService.delete(jobLog);
|
||||
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 loadJobLog() {
|
||||
|
||||
final JobLog jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(jobLog, jobLogForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected JobLog createJobLog() {
|
||||
JobLog jobLog;
|
||||
if (jobLogForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
jobLog = jobLogService.getJobLog(createKeyMap());
|
||||
if (jobLog == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { jobLogForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
jobLog = new JobLog();
|
||||
}
|
||||
Beans.copy(jobLogForm, jobLog).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
|
||||
return jobLog;
|
||||
}
|
||||
|
||||
protected Map<String, String> createKeyMap() {
|
||||
final Map<String, String> keys = new HashMap<String, String>();
|
||||
|
||||
keys.put("id", jobLogForm.id);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
|
|
|
@ -47,7 +47,6 @@ import org.slf4j.LoggerFactory;
|
|||
public class KeyMatchAction extends FessAdminAction {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(KeyMatchAction.class);
|
||||
<<<<<<< HEAD
|
||||
|
||||
// for list
|
||||
|
||||
|
@ -64,32 +63,14 @@ public class KeyMatchAction extends FessAdminAction {
|
|||
|
||||
@Resource
|
||||
protected KeyMatchPager keyMatchPager;
|
||||
=======
|
||||
|
||||
// for list
|
||||
|
||||
public List<KeyMatch> keyMatchItems;
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
|
||||
// for edit/confirm/delete
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
protected KeyMatchForm keyMatchForm;
|
||||
|
||||
@Resource
|
||||
protected KeyMatchService keyMatchService;
|
||||
|
||||
@Resource
|
||||
protected KeyMatchPager keyMatchPager;
|
||||
|
||||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
||||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("keyMatch");
|
||||
}
|
||||
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
|
||||
|
@ -183,102 +164,6 @@ public class KeyMatchAction extends FessAdminAction {
|
|||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
keyMatchItems = keyMatchService.getKeyMatchList(keyMatchPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(keyMatchPager, keyMatchForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String index() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
|
||||
public String list() {
|
||||
// page navi
|
||||
if (StringUtil.isNotBlank(keyMatchForm.pageNumber)) {
|
||||
try {
|
||||
keyMatchPager.setCurrentPageNumber(Integer.parseInt(keyMatchForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Invalid value: " + keyMatchForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(keyMatchForm.searchParams, keyMatchPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
keyMatchPager.clear();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String back() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editagain() {
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
loadKeyMatch();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
keyMatchForm.initialize();
|
||||
keyMatchForm.crudMode = CommonConstants.CREATE_MODE;
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (keyMatchForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE, keyMatchForm.crudMode });
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
loadKeyMatch();
|
||||
|
||||
return "edit.jsp";
|
||||
|
@ -336,11 +221,7 @@ public class KeyMatchAction extends FessAdminAction {
|
|||
|
||||
return keys;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
protected void loadKeyMatch() {
|
||||
|
||||
final KeyMatch keyMatch = keyMatchService.getKeyMatch(createKeyMap());
|
||||
|
@ -399,22 +280,14 @@ public class KeyMatchAction extends FessAdminAction {
|
|||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String update() {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
try {
|
||||
final KeyMatch keyMatch = createKeyMatch();
|
||||
keyMatchService.store(keyMatch);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
|
||||
|
||||
<<<<<<< HEAD
|
||||
final String result = displayList(true);
|
||||
ComponentUtil.getKeyMatchHelper().update();
|
||||
return result;
|
||||
=======
|
||||
return displayList(true);
|
||||
>>>>>>> 54e5e6c69f136354f051f88cbbd9aa07a3648500
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
|
|
|
@ -17,54 +17,30 @@
|
|||
package org.codelibs.fess.action.admin;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.action.base.FessAdminAction;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.codelibs.fess.beans.FessBeans;
|
||||
import org.codelibs.fess.crud.CommonConstants;
|
||||
import org.codelibs.fess.crud.CrudMessageException;
|
||||
import org.codelibs.fess.crud.action.admin.BsLabelTypeAction;
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.db.exentity.LabelType;
|
||||
import org.codelibs.fess.db.exentity.RoleType;
|
||||
import org.codelibs.fess.form.admin.LabelTypeForm;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.codelibs.fess.pager.LabelTypePager;
|
||||
import org.codelibs.fess.service.LabelTypeService;
|
||||
import org.codelibs.fess.service.RoleTypeService;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class LabelTypeAction extends FessAdminAction {
|
||||
public class LabelTypeAction extends BsLabelTypeAction {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(LabelTypeAction.class);
|
||||
|
||||
// for list
|
||||
private static final Log log = LogFactory.getLog(LabelTypeAction.class);
|
||||
|
||||
public List<LabelType> labelTypeItems;
|
||||
|
||||
// for edit/confirm/delete
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
protected LabelTypeForm labelTypeForm;
|
||||
|
||||
@Resource
|
||||
protected LabelTypeService labelTypeService;
|
||||
|
||||
@Resource
|
||||
protected LabelTypePager labelTypePager;
|
||||
|
||||
@Resource
|
||||
protected RoleTypeService roleTypeService;
|
||||
|
||||
|
@ -74,203 +50,8 @@ public class LabelTypeAction extends FessAdminAction {
|
|||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("labelType");
|
||||
}
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
labelTypeItems = labelTypeService.getLabelTypeList(labelTypePager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(labelTypePager, labelTypeForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String index() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
|
||||
public String list() {
|
||||
// page navi
|
||||
if (StringUtil.isNotBlank(labelTypeForm.pageNumber)) {
|
||||
try {
|
||||
labelTypePager.setCurrentPageNumber(Integer.parseInt(labelTypeForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Invalid value: " + labelTypeForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(labelTypeForm.searchParams, labelTypePager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
labelTypePager.clear();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String back() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editagain() {
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
labelTypeForm.initialize();
|
||||
labelTypeForm.crudMode = CommonConstants.CREATE_MODE;
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE, labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editfromconfirm() {
|
||||
labelTypeForm.crudMode = CommonConstants.EDIT_MODE;
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromcreate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromupdate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deletefromconfirm() {
|
||||
labelTypeForm.crudMode = CommonConstants.DELETE_MODE;
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String create() {
|
||||
try {
|
||||
final LabelType labelType = createLabelType();
|
||||
labelTypeService.store(labelType);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException("errors.crud_failed_to_create_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String update() {
|
||||
try {
|
||||
final LabelType labelType = createLabelType();
|
||||
labelTypeService.store(labelType);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException(e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
throw new ActionMessagesException("errors.crud_failed_to_update_crud_table");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected Map<String, String> createKeyMap() {
|
||||
final Map<String, String> keys = new HashMap<String, String>();
|
||||
|
||||
keys.put("id", labelTypeForm.id);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void loadLabelType() {
|
||||
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
|
@ -282,6 +63,7 @@ public class LabelTypeAction extends FessAdminAction {
|
|||
FessBeans.copy(labelType, labelTypeForm).commonColumnDateConverter().excludes("searchParams", "mode").execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LabelType createLabelType() {
|
||||
LabelType labelType;
|
||||
final String username = systemHelper.getUsername();
|
||||
|
@ -304,6 +86,7 @@ public class LabelTypeAction extends FessAdminAction {
|
|||
return labelType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
|
@ -328,13 +111,13 @@ public class LabelTypeAction extends FessAdminAction {
|
|||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, e.getMessageId(), e.getArgs());
|
||||
} catch (final Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
log.error(e.getMessage(), e);
|
||||
throw new SSCActionMessagesException(e, "errors.crud_failed_to_delete_crud_table");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.crud.action.admin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.codelibs.fess.crud.CommonConstants;
|
||||
import org.codelibs.fess.crud.CrudMessageException;
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.db.exentity.LabelType;
|
||||
import org.codelibs.fess.form.admin.LabelTypeForm;
|
||||
import org.codelibs.fess.pager.LabelTypePager;
|
||||
import org.codelibs.fess.service.LabelTypeService;
|
||||
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;
|
||||
|
||||
public class BsLabelTypeAction implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory.getLog(BsLabelTypeAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
public List<LabelType> labelTypeItems;
|
||||
|
||||
// for edit/confirm/delete
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
protected LabelTypeForm labelTypeForm;
|
||||
|
||||
@Resource
|
||||
protected LabelTypeService labelTypeService;
|
||||
|
||||
@Resource
|
||||
protected LabelTypePager labelTypePager;
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
labelTypeItems = labelTypeService.getLabelTypeList(labelTypePager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(labelTypePager, labelTypeForm.searchParams).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
if (redirect) {
|
||||
return "index?redirect=true";
|
||||
} else {
|
||||
return "index.jsp";
|
||||
}
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String index() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "list/{pageNumber}")
|
||||
public String list() {
|
||||
// page navi
|
||||
if (StringUtil.isNotBlank(labelTypeForm.pageNumber)) {
|
||||
try {
|
||||
labelTypePager.setCurrentPageNumber(Integer.parseInt(labelTypeForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + labelTypeForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(labelTypeForm.searchParams, labelTypePager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
labelTypePager.clear();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String back() {
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editagain() {
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "confirmpage/{crudMode}/{id}")
|
||||
public String confirmpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
labelTypeForm.initialize();
|
||||
labelTypeForm.crudMode = CommonConstants.CREATE_MODE;
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "editpage/{crudMode}/{id}")
|
||||
public String editpage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode",
|
||||
new Object[] { CommonConstants.EDIT_MODE, labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editfromconfirm() {
|
||||
labelTypeForm.crudMode = CommonConstants.EDIT_MODE;
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromcreate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true, keep = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String confirmfromupdate() {
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp", urlPattern = "deletepage/{crudMode}/{id}")
|
||||
public String deletepage() {
|
||||
if (labelTypeForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
labelTypeForm.crudMode });
|
||||
}
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deletefromconfirm() {
|
||||
labelTypeForm.crudMode = CommonConstants.DELETE_MODE;
|
||||
|
||||
loadLabelType();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String create() {
|
||||
try {
|
||||
final LabelType labelType = createLabelType();
|
||||
labelTypeService.store(labelType);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_create_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String update() {
|
||||
try {
|
||||
final LabelType labelType = createLabelType();
|
||||
labelTypeService.store(labelType);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_update_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@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 });
|
||||
}
|
||||
|
||||
try {
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
labelTypeService.delete(labelType);
|
||||
SAStrutsUtil.addSessionMessage("success.crud_delete_crud_table");
|
||||
|
||||
return displayList(true);
|
||||
} catch (final ActionMessagesException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch (final CrudMessageException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadLabelType() {
|
||||
|
||||
final LabelType labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(labelType, labelTypeForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected LabelType createLabelType() {
|
||||
LabelType labelType;
|
||||
if (labelTypeForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
labelType = labelTypeService.getLabelType(createKeyMap());
|
||||
if (labelType == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { labelTypeForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
labelType = new LabelType();
|
||||
}
|
||||
Beans.copy(labelTypeForm, labelType).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
|
||||
return labelType;
|
||||
}
|
||||
|
||||
protected Map<String, String> createKeyMap() {
|
||||
final Map<String, String> keys = new HashMap<String, String>();
|
||||
|
||||
keys.put("id", labelTypeForm.id);
|
||||
|
||||
return keys;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue