HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
ActionForward actionFrwd = null;
log.debug("Updating Dist Group ...");
DistributionGroupVO distGroupVO = new DistributionGroupVO();
try {
BeanUtils.copyProperties(distGroupVO, form);
} catch (IllegalAccessException e) {
log.error("ERROR in updateDistGroup", e);
} catch (InvocationTargetException e) {
log.error("ERROR in updateDistGroup", e);
}
log.debug("Asking for DistGroupBD");
try {
DistributionGroupBD bd =
(DistributionGroupBD) BusinessDelegateFactory
.getInstance()
.getDelegate(
"com.eteam.ems.auth.delegates.DistributionGroupBD");
log.debug("BD got, calling updateDistGroup");
HttpSession session = request.getSession();
SessionUserVO sessUser =
(SessionUserVO) session.getAttribute(
IConstants.SESSION_ATTR_USER_SESSION_INFO);
String dsName = sessUser.getDsName();
String dbType = sessUser.getDbType();
bd.updateDistGroup(dsName, dbType, distGroupVO);
log.debug("distGroup Updated Successfully !!!");
request.setAttribute(
"fwd",
"/admin/DistributionGroup.do?target=viewDistGroup&id="
+ distGroupVO.getId());
actionFrwd = mapping.findForward("pop_success");
} catch (BusinessException be) {
// 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(mapping.getInput());
} catch(DAOException e){
ActionMessage message;
log.debug("Message Key:= "+e.getMessageKey());
log.debug("Error Message := "+IErrorMessageKeys.KEY_ERROR_DUPLICATE_DIST_GROUP);
if( e.getMessageKey().equals(IErrorMessageKeys.KEY_ERROR_DUPLICATE_DIST_GROUP)){
message = new ActionMessage(IErrorMessageKeys.KEY_ERROR_DUPLICATE_DIST_GROUP);
}
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(mapping.getInput());
actionFrwd = new ActionForward("/admin/DistributionGroup.do?target=viewForUpdateDistGroup&id="+distGroupVO.getId());
} catch (Exception e1) {
// TODO Auto-generated catch block
log.error("Error:" + e1);
// 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(mapping.getInput());
actionFrwd = new ActionForward("/admin/DistributionGroup.do?target=viewForUpdateDistGroup&id="+distGroupVO.getId());
}
return actionFrwd;
}