HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
ActionForward actionFrwd = null;
GroupVO groupVO = new GroupVO();
DynaActionForm dynaForm = (DynaActionForm) form;
try {
// Copying form objects to VO objects
BeanUtils.copyProperties(groupVO, form);
// Added by Arindam
} catch (IllegalAccessException ex) {
log.error("Error GroupAction:viewGroup()");
} catch (InvocationTargetException ex) {
log.error("Error GroupAction:viewGroup()");
}
HttpSession session = request.getSession();
SessionUserVO sessUser =
(SessionUserVO) session.getAttribute(
IConstants.SESSION_ATTR_USER_SESSION_INFO);
String dsName = sessUser.getDsName();
String dbType = sessUser.getDbType();
GroupBD groupbd =
(GroupBD) BusinessDelegateFactory.getInstance().getDelegate(
"com.eteam.ems.auth.delegates.GroupBD");
try {
groupbd.updateGroup(dsName, dbType, groupVO);
log.debug("new report id = " + groupVO.getId());
request.setAttribute(
"fwd",
"/admin/Group.do?target=viewGroup&id=" + groupVO.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_GROUP);
if( e.getMessageKey().equals(IErrorMessageKeys.KEY_ERROR_DUPLICATE_GROUP)){
message = new ActionMessage(IErrorMessageKeys.KEY_ERROR_DUPLICATE_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/Group.do?target=viewGroupForUpdate&id="+groupVO.getId()+"&mode=update&page=updateMain");
} catch(BusinessException e){
ActionMessage message = new ActionMessage(e.getMessageKey());
ActionMessages messages = new ActionMessages();
messages.add(IConstants.PAGE_ERROR_MSG_ERROR_MESSAGE, message);
this.saveErrors(request, messages);
actionFrwd = new ActionForward("/admin/Group.do?target=viewGroupForUpdate&id="+groupVO.getId()+"&mode=update&page=updateMain");
}
return actionFrwd;
}