merge WebAuthenticationAction and BsWebAuthenticationAction
This commit is contained in:
parent
86eedeffaf
commit
7dba3a43e1
2 changed files with 222 additions and 340 deletions
|
@ -24,31 +24,50 @@ import java.util.Map;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
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;
|
||||
import org.codelibs.fess.crud.action.admin.BsWebAuthenticationAction;
|
||||
import org.codelibs.fess.crud.util.SAStrutsUtil;
|
||||
import org.codelibs.fess.db.exentity.WebAuthentication;
|
||||
import org.codelibs.fess.db.exentity.WebCrawlingConfig;
|
||||
import org.codelibs.fess.form.admin.WebAuthenticationForm;
|
||||
import org.codelibs.fess.helper.SystemHelper;
|
||||
import org.codelibs.fess.pager.WebAuthenticationPager;
|
||||
import org.codelibs.fess.service.WebAuthenticationService;
|
||||
import org.codelibs.fess.service.WebCrawlingConfigService;
|
||||
import org.codelibs.sastruts.core.annotation.Token;
|
||||
import org.codelibs.sastruts.core.exception.SSCActionMessagesException;
|
||||
import org.seasar.framework.beans.util.Beans;
|
||||
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 WebAuthenticationAction extends BsWebAuthenticationAction {
|
||||
public class WebAuthenticationAction extends FessAdminAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger logger = LoggerFactory.getLogger(WebAuthenticationAction.class);
|
||||
|
||||
private static final Log log = LogFactory.getLog(WebAuthenticationAction.class);
|
||||
// for list
|
||||
|
||||
public List<WebAuthentication> webAuthenticationItems;
|
||||
|
||||
// for edit/confirm/delete
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
protected WebAuthenticationForm webAuthenticationForm;
|
||||
|
||||
@Resource
|
||||
protected WebAuthenticationService webAuthenticationService;
|
||||
|
||||
@Resource
|
||||
protected WebAuthenticationPager webAuthenticationPager;
|
||||
|
||||
@Resource
|
||||
protected WebCrawlingConfigService webCrawlingConfigService;
|
||||
|
@ -56,11 +75,204 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
@Resource
|
||||
protected SystemHelper systemHelper;
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
webAuthenticationItems = webAuthenticationService.getWebAuthenticationList(webAuthenticationPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(webAuthenticationPager, webAuthenticationForm.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(webAuthenticationForm.pageNumber)) {
|
||||
try {
|
||||
webAuthenticationPager.setCurrentPageNumber(Integer.parseInt(webAuthenticationForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Invalid value: " + webAuthenticationForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(webAuthenticationForm.searchParams, webAuthenticationPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
webAuthenticationPager.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 (webAuthenticationForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
webAuthenticationForm.initialize();
|
||||
webAuthenticationForm.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 (webAuthenticationForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editfromconfirm() {
|
||||
webAuthenticationForm.crudMode = CommonConstants.EDIT_MODE;
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
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 (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deletefromconfirm() {
|
||||
webAuthenticationForm.crudMode = CommonConstants.DELETE_MODE;
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String create() {
|
||||
try {
|
||||
final WebAuthentication webAuthentication = createWebAuthentication();
|
||||
webAuthenticationService.store(webAuthentication);
|
||||
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 WebAuthentication webAuthentication = createWebAuthentication();
|
||||
webAuthenticationService.store(webAuthentication);
|
||||
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", webAuthenticationForm.id);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
public String getHelpLink() {
|
||||
return systemHelper.getHelpLink("webAuthentication");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadWebAuthentication() {
|
||||
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
|
@ -75,7 +287,6 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WebAuthentication createWebAuthentication() {
|
||||
WebAuthentication webAuthentication;
|
||||
final String username = systemHelper.getUsername();
|
||||
|
@ -101,7 +312,6 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
return webAuthentication;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String delete() {
|
||||
|
@ -127,13 +337,13 @@ public class WebAuthenticationAction extends BsWebAuthenticationAction {
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,328 +0,0 @@
|
|||
/*
|
||||
* Copyright 2009-2015 the CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.codelibs.fess.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.WebAuthentication;
|
||||
import org.codelibs.fess.form.admin.WebAuthenticationForm;
|
||||
import org.codelibs.fess.pager.WebAuthenticationPager;
|
||||
import org.codelibs.fess.service.WebAuthenticationService;
|
||||
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 BsWebAuthenticationAction implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final Log log = LogFactory.getLog(BsWebAuthenticationAction.class);
|
||||
|
||||
// for list
|
||||
|
||||
public List<WebAuthentication> webAuthenticationItems;
|
||||
|
||||
// for edit/confirm/delete
|
||||
|
||||
@ActionForm
|
||||
@Resource
|
||||
protected WebAuthenticationForm webAuthenticationForm;
|
||||
|
||||
@Resource
|
||||
protected WebAuthenticationService webAuthenticationService;
|
||||
|
||||
@Resource
|
||||
protected WebAuthenticationPager webAuthenticationPager;
|
||||
|
||||
protected String displayList(final boolean redirect) {
|
||||
// page navi
|
||||
webAuthenticationItems = webAuthenticationService.getWebAuthenticationList(webAuthenticationPager);
|
||||
|
||||
// restore from pager
|
||||
Beans.copy(webAuthenticationPager, webAuthenticationForm.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(webAuthenticationForm.pageNumber)) {
|
||||
try {
|
||||
webAuthenticationPager.setCurrentPageNumber(Integer.parseInt(webAuthenticationForm.pageNumber));
|
||||
} catch (final NumberFormatException e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invalid value: " + webAuthenticationForm.pageNumber, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String search() {
|
||||
Beans.copy(webAuthenticationForm.searchParams, webAuthenticationPager).excludes(CommonConstants.PAGER_CONVERSION_RULE)
|
||||
|
||||
.execute();
|
||||
|
||||
return displayList(false);
|
||||
}
|
||||
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String reset() {
|
||||
webAuthenticationPager.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 (webAuthenticationForm.crudMode != CommonConstants.CONFIRM_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.CONFIRM_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String createpage() {
|
||||
// page navi
|
||||
webAuthenticationForm.initialize();
|
||||
webAuthenticationForm.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 (webAuthenticationForm.crudMode != CommonConstants.EDIT_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.EDIT_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "edit.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String editfromconfirm() {
|
||||
webAuthenticationForm.crudMode = CommonConstants.EDIT_MODE;
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
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 (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = true, validate = false)
|
||||
@Execute(validator = false, input = "error.jsp")
|
||||
public String deletefromconfirm() {
|
||||
webAuthenticationForm.crudMode = CommonConstants.DELETE_MODE;
|
||||
|
||||
loadWebAuthentication();
|
||||
|
||||
return "confirm.jsp";
|
||||
}
|
||||
|
||||
@Token(save = false, validate = true)
|
||||
@Execute(validator = true, input = "edit.jsp")
|
||||
public String create() {
|
||||
try {
|
||||
final WebAuthentication webAuthentication = createWebAuthentication();
|
||||
webAuthenticationService.store(webAuthentication);
|
||||
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 WebAuthentication webAuthentication = createWebAuthentication();
|
||||
webAuthenticationService.store(webAuthentication);
|
||||
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 (webAuthenticationForm.crudMode != CommonConstants.DELETE_MODE) {
|
||||
throw new ActionMessagesException("errors.crud_invalid_mode", new Object[] { CommonConstants.DELETE_MODE,
|
||||
webAuthenticationForm.crudMode });
|
||||
}
|
||||
|
||||
try {
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
webAuthenticationService.delete(webAuthentication);
|
||||
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 loadWebAuthentication() {
|
||||
|
||||
final WebAuthentication webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
|
||||
Beans.copy(webAuthentication, webAuthenticationForm).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
}
|
||||
|
||||
protected WebAuthentication createWebAuthentication() {
|
||||
WebAuthentication webAuthentication;
|
||||
if (webAuthenticationForm.crudMode == CommonConstants.EDIT_MODE) {
|
||||
webAuthentication = webAuthenticationService.getWebAuthentication(createKeyMap());
|
||||
if (webAuthentication == null) {
|
||||
// throw an exception
|
||||
throw new ActionMessagesException("errors.crud_could_not_find_crud_table",
|
||||
|
||||
new Object[] { webAuthenticationForm.id });
|
||||
|
||||
}
|
||||
} else {
|
||||
webAuthentication = new WebAuthentication();
|
||||
}
|
||||
Beans.copy(webAuthenticationForm, webAuthentication).excludes("searchParams", "mode")
|
||||
|
||||
.execute();
|
||||
|
||||
return webAuthentication;
|
||||
}
|
||||
|
||||
protected Map<String, String> createKeyMap() {
|
||||
final Map<String, String> keys = new HashMap<String, String>();
|
||||
|
||||
keys.put("id", webAuthenticationForm.id);
|
||||
|
||||
return keys;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue