List of usage examples for org.apache.commons.beanutils PropertyUtils copyProperties
public static void copyProperties(Object dest, Object orig) throws IllegalAccessException, InvocationTargetException, NoSuchMethodException
Copy property values from the "origin" bean to the "destination" bean for all cases where the property names are the same (even though the actual getter and setter methods might have been customized via BeanInfo
classes).
For more details see PropertyUtilsBean
.
From source file:us.mn.state.health.lims.statusofsample.action.StatusOfSampleUpdateAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // The first job is to determine if we are coming to this action with an // ID parameter in the request. If there is no parameter, we are // creating a new StatusOfSample. // If there is a parameter present, we should bring up an existing // StatusOfSample to edit. String forward = FWD_SUCCESS; request.setAttribute(ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "false"); request.setAttribute(NEXT_DISABLED, "false"); String id = request.getParameter(ID); if (StringUtil.isNullorNill(id) || "0".equals(id)) { isNew = true;/*from ww w . ja va 2 s.c o m*/ } else { isNew = false; } BaseActionForm dynaForm = (BaseActionForm) form; // server-side validation (validation.xml) ActionMessages errors = dynaForm.validate(mapping, request); if (errors != null && errors.size() > 0) { saveErrors(request, errors); // since we forward to jsp - not Action we don't need to repopulate // the lists here return mapping.findForward(FWD_FAIL); } String start = (String) request.getParameter("startingRecNo"); String direction = (String) request.getParameter("direction"); StatusOfSample statusOfSample = new StatusOfSample(); //get sysUserId from login module UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); String sysUserId = String.valueOf(usd.getSystemUserId()); statusOfSample.setSysUserId(sysUserId); org.hibernate.Transaction tx = null; // populate valueholder from form PropertyUtils.copyProperties(statusOfSample, dynaForm); try { tx = HibernateUtil.getSession().beginTransaction(); StatusOfSampleDAO statusOfSampleDAO = new StatusOfSampleDAOImpl(); if (!isNew) { // UPDATE statusOfSampleDAO.updateData(statusOfSample); } else { // INSERT statusOfSampleDAO.insertData(statusOfSample); } tx.commit(); //bugzilla 2154 LogEvent.logDebug("StatusOfSampleUpdateAction", "performAction()", "Inserting statusOfSample id: " + statusOfSample.getId() + " Desc: " + statusOfSample.getDescription() + " Status Type: " + statusOfSample.getStatusType()); } catch (LIMSRuntimeException lre) { //bugzilla 2154 LogEvent.logError("StatusOfSampleUpdateAction", "performAction()", lre.toString()); tx.rollback(); ActionError error = null; errors = new ActionMessages(); Locale locale = (Locale) request.getSession().getAttribute("org.apache.struts.action.LOCALE"); if (lre.getException() instanceof org.hibernate.StaleObjectStateException) { // how can I get popup instead of struts error at the top of // page? // ActionMessages errors = dynaForm.validate(mapping, request); error = new ActionError("errors.OptimisticLockException", null, null); } else { // bugzilla 1482 if (lre.getException() instanceof LIMSDuplicateRecordException) { String messageKey = "statusofsample.statusofsample"; String msg = ResourceLocator.getInstance().getMessageResources().getMessage(locale, messageKey); error = new ActionError("errors.DuplicateRecord", msg, null); } else { error = new ActionError("errors.UpdateException", null, null); } } errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); request.setAttribute(Globals.ERROR_KEY, errors); //bugzilla 1485: allow change and try updating again (enable save button) //request.setAttribute(IActionConstants.ALLOW_EDITS_KEY, "false"); // disable previous and next request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); forward = FWD_FAIL; //bugzilla 2154 LogEvent.logError("StatusOfSampleUpdateAction", "performAction()", "Exception caught adding/updating Status Of Sample record id: " + statusOfSample.getId() + " Desc: " + statusOfSample.getDescription() + " Code: " + statusOfSample.getCode() + " Status Type: " + statusOfSample.getStatusType() + "\nException: " + lre.toString()); } finally { HibernateUtil.closeSession(); } if (forward.equals(FWD_FAIL)) return mapping.findForward(forward); // initialize the form dynaForm.initialize(mapping); // repopulate the form from valueholder PropertyUtils.copyProperties(dynaForm, statusOfSample); //PropertyUtils.setProperty(dynaForm, "domains", domains); if ("true".equalsIgnoreCase(request.getParameter("close"))) { forward = FWD_CLOSE; } if (statusOfSample.getId() != null && !statusOfSample.getId().equals("0")) { request.setAttribute(ID, statusOfSample.getId()); } //bugzilla 1400 if (isNew) forward = FWD_SUCCESS_INSERT; //bugzilla 1467 added direction for redirect to NextPreviousAction return getForward(mapping.findForward(forward), id, start, direction); }
From source file:us.mn.state.health.lims.statusofsample.daoimpl.StatusOfSampleDAOImpl.java
/** * getData()//from w w w.ja va 2 s. com * * @param statusOfSample * @throws LIMSRuntimeException */ public void getData(StatusOfSample statusOfSample) throws LIMSRuntimeException { try { StatusOfSample sos = (StatusOfSample) HibernateUtil.getSession().get(StatusOfSample.class, statusOfSample.getId()); HibernateUtil.getSession().flush(); HibernateUtil.getSession().clear(); if (sos != null) { PropertyUtils.copyProperties(statusOfSample, sos); } else { statusOfSample.setId(null); } } catch (Exception e) { //bugzilla 2154 LogEvent.logError("StatusOfSampleDAOImpl", "getData()", e.toString()); throw new LIMSRuntimeException("Error in StatusOfSample getData()", e); } }
From source file:us.mn.state.health.lims.systemmodule.action.SystemModuleAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String id = request.getParameter(ID); String forward = FWD_SUCCESS; request.setAttribute(ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); DynaActionForm dynaForm = (DynaActionForm) form; // initialize the form dynaForm.initialize(mapping);// w w w . j a v a2 s .com SystemModule systemModule = new SystemModule(); if ((id != null) && (!"0".equals(id))) { systemModule.setId(id); SystemModuleDAO systemModuleDAO = new SystemModuleDAOImpl(); systemModuleDAO.getData(systemModule); isNew = false; List systemModules = systemModuleDAO.getNextSystemModuleRecord(systemModule.getId()); if (systemModules.size() > 0) { // enable next button request.setAttribute(NEXT_DISABLED, "false"); } systemModules = systemModuleDAO.getPreviousSystemModuleRecord(systemModule.getId()); if (systemModules.size() > 0) { // enable next button request.setAttribute(PREVIOUS_DISABLED, "false"); } // end of logic to enable next or previous button } else { isNew = true; // this is to set correct page title } if (systemModule.getId() != null && !systemModule.getId().equals("0")) { request.setAttribute(ID, systemModule.getId()); } // populate form from valueholder PropertyUtils.copyProperties(form, systemModule); return mapping.findForward(forward); }
From source file:us.mn.state.health.lims.systemmodule.action.SystemModuleUpdateAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forward = FWD_SUCCESS; request.setAttribute(IActionConstants.ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "false"); request.setAttribute(NEXT_DISABLED, "false"); String id = request.getParameter("ID"); //get sysUserId from login module UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); String sysUserId = String.valueOf(usd.getSystemUserId()); if (StringUtil.isNullorNill(id) || "0".equals(id)) { isNew = true;//from w ww . jav a 2 s. c om } else { isNew = false; } BaseActionForm dynaForm = (BaseActionForm) form; // server-side validation (validation.xml) ActionMessages errors = dynaForm.validate(mapping, request); if (errors != null && errors.size() > 0) { saveErrors(request, errors); // since we forward to jsp - not Action we don't need to repopulate // the lists here return mapping.findForward(FWD_FAIL); } String start = (String) request.getParameter("startingRecNo"); String direction = (String) request.getParameter("direction"); SystemModule systemModule = new SystemModule(); systemModule.setSysUserId(sysUserId); org.hibernate.Transaction tx = HibernateUtil.getSession().beginTransaction(); // populate valueholder from form PropertyUtils.copyProperties(systemModule, dynaForm); try { SystemModuleDAO systemModuleDAO = new SystemModuleDAOImpl(); if (!isNew) { // UPDATE systemModuleDAO.updateData(systemModule); } else { // INSERT systemModuleDAO.insertData(systemModule); } tx.commit(); } catch (LIMSRuntimeException lre) { //bugzilla 2154 LogEvent.logError("SystemModuleUpdateAction", "performAction()", lre.toString()); tx.rollback(); errors = new ActionMessages(); java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute("org.apache.struts.action.LOCALE"); ActionError error = null; if (lre.getException() instanceof org.hibernate.StaleObjectStateException) { error = new ActionError("errors.OptimisticLockException", null, null); } else { if (lre.getException() instanceof LIMSDuplicateRecordException) { String messageKey = "systemmodule.name"; String msg = ResourceLocator.getInstance().getMessageResources().getMessage(locale, messageKey); error = new ActionError("errors.DuplicateRecord", msg, null); } else { error = new ActionError("errors.UpdateException", null, null); } } errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); request.setAttribute(Globals.ERROR_KEY, errors); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); forward = FWD_FAIL; } finally { HibernateUtil.closeSession(); } if (forward.equals(FWD_FAIL)) return mapping.findForward(forward); // initialize the form dynaForm.initialize(mapping); // repopulate the form from valueholder PropertyUtils.copyProperties(dynaForm, systemModule); if ("true".equalsIgnoreCase(request.getParameter("close"))) { forward = FWD_CLOSE; } if (systemModule.getId() != null && !systemModule.getId().equals("0")) { request.setAttribute("ID", systemModule.getId()); } if (isNew) forward = FWD_SUCCESS_INSERT; return getForward(mapping.findForward(forward), id, start, direction); }
From source file:us.mn.state.health.lims.systemmodule.daoimpl.SystemModuleDAOImpl.java
public void getData(SystemModule systemModule) throws LIMSRuntimeException { try {// w w w . j a v a 2s . c om SystemModule sysModule = (SystemModule) HibernateUtil.getSession().get(SystemModule.class, systemModule.getId()); HibernateUtil.getSession().flush(); HibernateUtil.getSession().clear(); if (sysModule != null) { PropertyUtils.copyProperties(systemModule, sysModule); } else { systemModule.setId(null); } } catch (Exception e) { //bugzilla 2154 LogEvent.logError("SystemModuleDAOImpl", "getData()", e.toString()); throw new LIMSRuntimeException("Error in SystemModule getData()", e); } }
From source file:us.mn.state.health.lims.systemuser.action.SystemUserAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // The first job is to determine if we are coming to this action with an // ID parameter in the request. If there is no parameter, we are // creating a new SystemUser. // If there is a parameter present, we should bring up an existing // SystemUser to edit. String id = request.getParameter(ID); String forward = FWD_SUCCESS; request.setAttribute(ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); DynaActionForm dynaForm = (DynaActionForm) form; // initialize the form dynaForm.initialize(mapping);/*w ww . j a v a 2 s . co m*/ SystemUser systemUser = new SystemUser(); //System.out.println("I am in SystemUserAction and this is id " + id); if ((id != null) && (!"0".equals(id))) { // this is an existing // systemUser systemUser.setId(id); SystemUserDAO systemUserDAO = new SystemUserDAOImpl(); systemUserDAO.getData(systemUser); isNew = false; // this is to set correct page title // do we need to enable next or previous? List systemUsers = systemUserDAO.getNextSystemUserRecord(systemUser.getId()); if (systemUsers.size() > 0) { // enable next button request.setAttribute(NEXT_DISABLED, "false"); } systemUsers = systemUserDAO.getPreviousSystemUserRecord(systemUser.getId()); if (systemUsers.size() > 0) { // enable next button request.setAttribute(PREVIOUS_DISABLED, "false"); } // end of logic to enable next or previous button } else { // this is a new systemUser isNew = true; // this is to set correct page title } if (systemUser.getId() != null && !systemUser.getId().equals("0")) { request.setAttribute(ID, systemUser.getId()); } // populate form from valueholder PropertyUtils.copyProperties(form, systemUser); return mapping.findForward(forward); }
From source file:us.mn.state.health.lims.systemuser.action.SystemUserUpdateAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // The first job is to determine if we are coming to this action with an // ID parameter in the request. If there is no parameter, we are // creating a new SystemUser. // If there is a parameter present, we should bring up an existing // SystemUser to edit. String forward = FWD_SUCCESS; request.setAttribute(ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "false"); request.setAttribute(NEXT_DISABLED, "false"); String id = request.getParameter(ID); if (StringUtil.isNullorNill(id) || "0".equals(id)) { isNew = true;//from ww w.jav a2 s . com } else { isNew = false; } BaseActionForm dynaForm = (BaseActionForm) form; // server-side validation (validation.xml) ActionMessages errors = dynaForm.validate(mapping, request); if (errors != null && errors.size() > 0) { saveErrors(request, errors); // since we forward to jsp - not Action we don't need to repopulate // the lists here return mapping.findForward(FWD_FAIL); } String start = (String) request.getParameter("startingRecNo"); String direction = (String) request.getParameter("direction"); SystemUser systemUser = new SystemUser(); //get sysUserId from login module UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); String sysUserId = String.valueOf(usd.getSystemUserId()); systemUser.setSysUserId(sysUserId); org.hibernate.Transaction tx = HibernateUtil.getSession().beginTransaction(); // populate valueholder from form PropertyUtils.copyProperties(systemUser, dynaForm); try { SystemUserDAO systemUserDAO = new SystemUserDAOImpl(); if (!isNew) { // UPDATE systemUserDAO.updateData(systemUser); } else { // INSERT systemUserDAO.insertData(systemUser); } tx.commit(); } catch (LIMSRuntimeException lre) { //bugzilla 2154 LogEvent.logError("SystemUserUpdateAction", "performAction()", lre.toString()); tx.rollback(); errors = new ActionMessages(); ActionError error = null; if (lre.getException() instanceof org.hibernate.StaleObjectStateException) { // how can I get popup instead of struts error at the top of // page? // ActionMessages errors = dynaForm.validate(mapping, request); error = new ActionError("errors.OptimisticLockException", null, null); } else { if (lre.getException() instanceof LIMSDuplicateRecordException) { java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute("org.apache.struts.action.LOCALE"); String messageKey = "systemuser.systemuser"; String msg = ResourceLocator.getInstance().getMessageResources().getMessage(locale, messageKey); error = new ActionError("errors.DuplicateRecord.activate", msg, null); } else { error = new ActionError("errors.UpdateException", null, null); } } errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); request.setAttribute(Globals.ERROR_KEY, errors); //bugzilla 1485: allow change and try updating again (enable save button) //request.setAttribute(IActionConstants.ALLOW_EDITS_KEY, "false"); // disable previous and next request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); forward = FWD_FAIL; } finally { HibernateUtil.closeSession(); } if (forward.equals(FWD_FAIL)) return mapping.findForward(forward); // initialize the form dynaForm.initialize(mapping); // repopulate the form from valueholder PropertyUtils.copyProperties(dynaForm, systemUser); if ("true".equalsIgnoreCase(request.getParameter("close"))) { forward = FWD_CLOSE; } if (systemUser.getId() != null && !systemUser.getId().equals("0")) { request.setAttribute(ID, systemUser.getId()); } //bugzilla 1400 if (isNew) forward = FWD_SUCCESS_INSERT; //bugzilla 1467 added direction for redirect to NextPreviousAction return getForward(mapping.findForward(forward), id, start, direction); }
From source file:us.mn.state.health.lims.systemuser.daoimpl.SystemUserDAOImpl.java
public void getData(SystemUser systemUser) throws LIMSRuntimeException { try {//from ww w . java 2 s . co m SystemUser sysUser = (SystemUser) HibernateUtil.getSession().get(SystemUser.class, systemUser.getId()); HibernateUtil.getSession().flush(); HibernateUtil.getSession().clear(); if (sysUser != null) { //System.out.println("Just read sysUser " + sysUser.getId() + " " + sysUser.getLastName()); PropertyUtils.copyProperties(systemUser, sysUser); } else { systemUser.setId(null); } } catch (Exception e) { //bugzilla 2154 LogEvent.logError("SystemUserDAOImpl", "getData()", e.toString()); throw new LIMSRuntimeException("Error in SystemUser getData()", e); } }
From source file:us.mn.state.health.lims.systemusermodule.action.SystemUserModuleAction.java
@SuppressWarnings("unchecked") protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String id = request.getParameter("ID"); String forward = FWD_SUCCESS; request.setAttribute(IActionConstants.ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); DynaActionForm dynaForm = (DynaActionForm) form; // initialize the form dynaForm.initialize(mapping);/*from w w w. j av a2 s . c o m*/ //bugzilla 2154 LogEvent.logDebug("SystemUserModuleAction", "performAction()", " I am in SystemUserModuleAction and this is id " + id); isNew = id == null || "0".equals(id); permissionAgentIsUser = SystemConfiguration.getInstance().getPermissionAgent().equals("USER"); PermissionModule permissionAgentModule = permissionAgentIsUser ? new SystemUserModule() : new RoleModule(); if (!isNew) { permissionAgentModule.setId(id); PermissionAgentModuleDAO permissionAgentModuleDAO = permissionAgentIsUser ? new SystemUserModuleDAOImpl() : new RoleModuleDAOImpl(); permissionAgentModuleDAO.getData(permissionAgentModule); List permissionAgentModules = permissionAgentModuleDAO .getNextPermissionModuleRecord(permissionAgentModule.getId()); if (permissionAgentModules.size() > 0) { // enable next button request.setAttribute(NEXT_DISABLED, "false"); } permissionAgentModules = permissionAgentModuleDAO .getPreviousPermissionModuleRecord(permissionAgentModule.getId()); if (permissionAgentModules.size() > 0) { // enable next button request.setAttribute(PREVIOUS_DISABLED, "false"); } // end of logic to enable next or previous button } if (permissionAgentModule.getId() != null && !permissionAgentModule.getId().equals("0")) { request.setAttribute("ID", permissionAgentModule.getId()); } // populate form from valueholder PropertyUtils.copyProperties(form, permissionAgentModule); List permissionAgents; if (permissionAgentIsUser) { SystemUserDAO systemUserDAO = new SystemUserDAOImpl(); permissionAgents = systemUserDAO.getAllSystemUsers(); } else { RoleDAO roleDAO = new RoleDAOImpl(); permissionAgents = roleDAO.getAllRoles(); } SystemModuleDAO systemModuleDAO = new SystemModuleDAOImpl(); List systemModules = systemModuleDAO.getAllSystemModules(); if (permissionAgentModule.getPermissionAgent() != null) PropertyUtils.setProperty(form, "systemUserId", permissionAgentModule.getPermissionAgent().getId()); else PropertyUtils.setProperty(form, "systemUserId", ""); if (permissionAgentModule.getSystemModule() != null) PropertyUtils.setProperty(form, "systemModuleId", permissionAgentModule.getSystemModule().getId()); else PropertyUtils.setProperty(form, "systemModuleId", ""); Collections.sort(systemModules, SystemModuleComparator.DESC_COMPARATOR); PropertyUtils.setProperty(form, "systemusers", permissionAgents); PropertyUtils.setProperty(form, "systemmodules", systemModules); //bugzilla 2154 LogEvent.logDebug("SystemUserModuleAction", "performAction()", " I am in SystemUserModuleAction this is forward " + forward); return mapping.findForward(forward); }
From source file:us.mn.state.health.lims.systemusermodule.action.SystemUserModuleUpdateAction.java
protected ActionForward performAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String forward = FWD_SUCCESS; request.setAttribute(IActionConstants.ALLOW_EDITS_KEY, "true"); request.setAttribute(PREVIOUS_DISABLED, "false"); request.setAttribute(NEXT_DISABLED, "false"); String id = request.getParameter("ID"); String sysUserId = getSysUserId(request); isNew = StringUtil.isNullorNill(id) || "0".equals(id); permissionAgentIsUser = SystemConfiguration.getInstance().getPermissionAgent().equals("USER"); BaseActionForm dynaForm = (BaseActionForm) form; // server-side validation (validation.xml) ActionMessages errors = dynaForm.validate(mapping, request); if (errors != null && errors.size() > 0) { saveErrors(request, errors);//w ww. ja v a2 s. c o m // since we forward to jsp - not Action we don't need to repopulate // the lists here return mapping.findForward(FWD_FAIL); } String start = (String) request.getParameter("startingRecNo"); String direction = (String) request.getParameter("direction"); PermissionModule permissionAgentModule = permissionAgentIsUser ? new SystemUserModule() : new RoleModule(); permissionAgentModule.setSysUserId(sysUserId); // populate valueholder from form PropertyUtils.copyProperties(permissionAgentModule, dynaForm); String systemUserId = (String) dynaForm.get("systemUserId"); PermissionAgent permissionAgent = getPermissionAgent(dynaForm, systemUserId); String systemModuleId = (String) dynaForm.get("systemModuleId"); SystemModule systemModule = getSystemModule(dynaForm, systemModuleId); permissionAgentModule.setPermissionAgent(permissionAgent); permissionAgentModule.setSystemModule(systemModule); org.hibernate.Transaction tx = HibernateUtil.getSession().beginTransaction(); try { PermissionAgentModuleDAO permissionAgentModuleDAO = permissionAgentIsUser ? new SystemUserModuleDAOImpl() : new RoleModuleDAOImpl(); if (!isNew) { // UPDATE permissionAgentModuleDAO.updateData(permissionAgentModule); } else { // INSERT permissionAgentModuleDAO.insertData(permissionAgentModule); } tx.commit(); } catch (LIMSRuntimeException lre) { //bugzilla 2154 LogEvent.logError("SystemUserModuleUpdateAction", "performAction()", lre.toString()); tx.rollback(); errors = new ActionMessages(); java.util.Locale locale = (java.util.Locale) request.getSession() .getAttribute("org.apache.struts.action.LOCALE"); ActionError error = null; if (lre.getException() instanceof org.hibernate.StaleObjectStateException) { error = new ActionError("errors.OptimisticLockException", null, null); } else { if (lre.getException() instanceof LIMSDuplicateRecordException) { String messageKey = "systemmodule.name"; String msg = ResourceLocator.getInstance().getMessageResources().getMessage(locale, messageKey); error = new ActionError("errors.DuplicateRecord", msg, null); } else { error = new ActionError("errors.UpdateException", null, null); } } errors.add(ActionMessages.GLOBAL_MESSAGE, error); saveErrors(request, errors); request.setAttribute(Globals.ERROR_KEY, errors); request.setAttribute(PREVIOUS_DISABLED, "true"); request.setAttribute(NEXT_DISABLED, "true"); forward = FWD_FAIL; } finally { HibernateUtil.closeSession(); } if (forward.equals(FWD_FAIL)) return mapping.findForward(forward); // initialize the form dynaForm.initialize(mapping); // repopulate the form from valueholder PropertyUtils.copyProperties(dynaForm, permissionAgentModule); if ("true".equalsIgnoreCase(request.getParameter("close"))) { forward = FWD_CLOSE; } if (permissionAgentModule.getId() != null && !permissionAgentModule.getId().equals("0")) { request.setAttribute("ID", permissionAgentModule.getId()); } if (isNew) forward = FWD_SUCCESS_INSERT; return getForward(mapping.findForward(forward), id, start, direction); }