use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtReportsUploadAction method editpreview.
public ActionForward editpreview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm uploadForm = (BirtReportsUploadActionForm) form;
ReportsPersistence rp = new ReportsPersistence();
ReportsCategoryBO category = rp.getPersistentObject(ReportsCategoryBO.class, Short.valueOf(uploadForm.getReportCategoryId()));
request.setAttribute("category", category);
ReportsBO report = new ReportsPersistence().getReport(Short.valueOf(uploadForm.getReportId()));
if (isReportInfoNotEdit(request, uploadForm, report)) {
return mapping.findForward(ActionForwards.editpreview_failure.toString());
} else if (!isReportItsSelf(uploadForm, report) && isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.editpreview_failure.toString());
}
return mapping.findForward(ActionForwards.editpreview_success.toString());
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtReportsUploadAction method edit.
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm birtReportsUploadActionForm = (BirtReportsUploadActionForm) form;
ReportsBO report = new ReportsPersistence().getReport(Short.valueOf(request.getParameter("reportId")));
request.setAttribute(Constants.BUSINESS_KEY, report);
birtReportsUploadActionForm.setReportTitle(report.getReportName());
birtReportsUploadActionForm.setReportCategoryId(report.getReportsCategoryBO().getReportCategoryId().toString());
birtReportsUploadActionForm.setIsActive(report.getIsActive().toString());
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTS, new ReportsPersistence().getAllReportCategories());
return mapping.findForward(ActionForwards.edit_success.toString());
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtReportsUploadAction method editThenUpload.
public ActionForward editThenUpload(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm uploadForm = (BirtReportsUploadActionForm) form;
ReportsPersistence rp = new ReportsPersistence();
ReportsCategoryBO category = rp.getPersistentObject(ReportsCategoryBO.class, Short.valueOf(uploadForm.getReportCategoryId()));
ReportsBO reportBO = rp.getReport(Short.valueOf(uploadForm.getReportId()));
ReportsJasperMap reportJasperMap = reportBO.getReportsJasperMap();
if (!isReportItsSelf(uploadForm, reportBO) && isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.editpreview_failure.toString());
} else if (isReportActivityIdNull(request, reportBO)) {
return mapping.findForward(ActionForwards.create_failure.toString());
}
reportBO.setReportName(uploadForm.getReportTitle());
reportBO.setIsActive(Short.valueOf(uploadForm.getIsActive()));
reportBO.setReportsCategoryBO(category);
rp.createOrUpdate(reportBO);
// kim
String activityNameHead = "Can view ";
rp.updateLookUpValue(reportBO.getActivityId(), activityNameHead + uploadForm.getReportTitle());
legacyRolesPermissionsDao.reparentActivityUsingHibernate(reportBO.getActivityId(), category.getActivityId());
legacyRolesPermissionsDao.changeActivityMessage(reportBO.getActivityId(), Localization.ENGLISH_LOCALE_ID, "Can view " + reportBO.getReportName());
FormFile formFile = uploadForm.getFile();
if (StringUtils.isEmpty(formFile.getFileName())) {
formFile.destroy();
} else {
reportJasperMap.setReportJasper(formFile.getFileName());
rp.createOrUpdate(reportJasperMap);
uploadFile(formFile);
}
return mapping.findForward(ActionForwards.create_success.toString());
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class ReportsPersistence method getReport.
public ReportsBO getReport(Short reportId) {
Session session = null;
session = StaticHibernateUtil.getSessionTL();
return (ReportsBO) session.load(ReportsBO.class, reportId);
}
use of org.mifos.reports.business.ReportsBO in project head by mifos.
the class BirtAdminDocumentUploadActionStrutsTest method removeReport.
private void removeReport(Short reportId) throws PersistenceException {
legacyAdminDocumentDao.getSession().clear();
ReportsBO report = legacyAdminDocumentDao.getPersistentObject(ReportsBO.class, reportId);
ActivityEntity activityEntity = legacyRolesPermissionsDao.getPersistentObject(ActivityEntity.class, report.getActivityId());
legacyAdminDocumentDao.delete(report);
LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
legacyRolesPermissionsDao.delete(activityEntity);
legacyRolesPermissionsDao.delete(anLookUp);
StaticHibernateUtil.flushSession();
}
Aggregations