use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadActionStrutsTest method testShouldSubmitSucessWhenUploadNewReport.
@Test
public void testShouldSubmitSucessWhenUploadNewReport() throws Exception {
setRequestPathInfo("/birtReportsUploadAction.do");
BirtReportsUploadActionForm form = new BirtReportsUploadActionForm();
form.setReportTitle("testShouldSubmitSucessWhenUploadNewReport");
form.setReportCategoryId("1");
form.setIsActive("1");
form.setFile(new MockFormFile("testFileName1.rptdesign"));
setActionForm(form);
addRequestParameter("method", "upload");
actionPerform();
ReportsBO report = (ReportsBO) request.getAttribute("report");
Assert.assertNotNull(report);
ReportsPersistence rp = new ReportsPersistence();
ReportsJasperMap jasper = rp.getPersistentObject(ReportsJasperMap.class, report.getReportsJasperMap().getReportId());
Assert.assertNotNull(jasper);
verifyNoActionErrors();
verifyForward("create_success");
removeReport(report.getReportId());
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class AdminServiceFacadeWebTier method createReportsCategory.
@Override
public void createReportsCategory(ReportCategoryDto reportCategory) {
ReportsCategoryBO newReportCategory = new ReportsCategoryBO();
newReportCategory.setReportCategoryName(reportCategory.getName());
try {
new ReportsPersistence().createOrUpdate(newReportCategory);
StaticHibernateUtil.commitTransaction();
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadAction method preview.
public ActionForward preview(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);
if (isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.preview_failure.toString());
}
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadAction method createOrUpdateReport.
private ReportsBO createOrUpdateReport(ReportsCategoryBO category, int newActivityId, String reportTitle, Short isActive, String fileName, Boolean isDW) throws PersistenceException {
ReportsBO reportBO = new ReportsBO();
reportBO.setReportName(reportTitle);
reportBO.setReportsCategoryBO(category);
reportBO.setActivityId((short) newActivityId);
reportBO.setIsActive(isActive);
reportBO.setIsDW(isDW);
ReportsJasperMap reportsJasperMap = reportBO.getReportsJasperMap();
reportsJasperMap.setReportJasper(fileName);
reportBO.setReportsJasperMap(reportsJasperMap);
new ReportsPersistence().createOrUpdate(reportBO);
return reportBO;
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadAction method getBirtReportsUploadPage.
public ActionForward getBirtReportsUploadPage(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsAction:getBirtReportPage Method: ");
StaticHibernateUtil.flushAndCloseSession();
BirtReportsUploadActionForm uploadForm = (BirtReportsUploadActionForm) form;
uploadForm.clear();
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTS, new ReportsPersistence().getAllReportCategories());
return mapping.findForward(ActionForwards.load_success.toString());
}
Aggregations