)
throws IOException, ServletException
{
ActionForward actionFrwd = null;
log.debug("Updating Role ...");
RoleVO roleVO = new RoleVO();
try
{
BeanUtils.copyProperties(roleVO,form);
}
catch (IllegalAccessException e)
{
log.error("ERROR in updateRole",e);
}
catch (InvocationTargetException e)
{
log.error("ERROR in updateRole",e);
}
log.debug("Asking for DistGroupBD");
try
{
RoleBD bd = (RoleBD)BusinessDelegateFactory.getInstance().getDelegate("com.eteam.ems.auth.delegates.RoleBD");
log.debug("BD got, calling updateRole");
HttpSession session = request.getSession();
SessionUserVO sessUser = (SessionUserVO) session.getAttribute(IConstants.SESSION_ATTR_USER_SESSION_INFO);
String dsName = sessUser.getDsName();
String dbType = sessUser.getDbType();
bd.updateRole(dsName , dbType, roleVO);
log.debug("Role Updated Successfully !!!");
request.setAttribute("fwd","/admin/Role.do?target=viewRole&id="+roleVO.getId());
actionFrwd=mapping.findForward("pop_success");
} catch(DAOException e){
ActionMessage message;
log.debug("Message Key:= "+e.getMessageKey());
log.debug("Error Message := "+IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
if( e.getMessageKey().equals(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE)){
message = new ActionMessage(IErrorMessageKeys.KEY_ERROR_DUPLICATE_ROLE);
}
else{
message = new ActionMessage(IErrorMessageKeys.KEY_DATABASE_ERROR);
}
//ActionMessage message = new ActionMessage(IErrorMessageKeys.KEY_DATABASE_ERROR);
ActionMessages messages = new ActionMessages();
messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
this.saveErrors(request, messages);
actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());
}
catch (BusinessException be)
{
// TODO Auto-generated catch block
// If some business error occured, will return to the input page
ActionMessage message = new ActionMessage(be.getMessageKey());
ActionMessages messages = new ActionMessages();
messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
this.saveErrors(request, messages);
actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());
}
catch (Exception e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
// If some business error occured, will return to the input page
ActionMessage message = new ActionMessage(IErrorMessageKeys.KEY_FATAL_ERROR);
ActionMessages messages = new ActionMessages();
messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
this.saveErrors(request, messages);
actionFrwd = new ActionForward("/admin/Role.do?target=viewForUpdateRole&id="+roleVO.getId());
}
return actionFrwd;
}