insertMode = true;
}
AdminBean adminBean = getAdminBean(request);
Site site = adminBean.getSite();
Report report = new Report();
if (!insertMode) {
report = ReportDAO.load(site.getSiteId(), Format.getLong(form.getReportId()));
}
ActionMessages errors = validate(form);
if (errors.size() != 0) {
saveMessages(request, errors);
return mapping.findForward("error");
}
if (insertMode) {
report.setRecCreateBy(adminBean.getUser().getUserId());
report.setRecCreateDatetime(new Date(System.currentTimeMillis()));
report.setSystemRecord(Constants.VALUE_NO);
}
report.setSite(site);
report.setReportName(form.getReportName());
report.setReportDesc(form.getReportDesc());
report.setReportText(form.getReportText());
report.setRecUpdateBy(adminBean.getUser().getUserId());
report.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
if (insertMode) {
em.persist(report);
}
form.setMode("U");
form.setReportId(report.getReportId().toString());
FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
return mapping.findForward("success");
}