use of org.mifos.reports.business.ReportsJasperMap in project head by mifos.
the class AddReportIntegrationTest method testStartFromStandardStore.
@Test
public void testStartFromStandardStore() throws Exception {
short newId = 17032;
AddReport upgrade = new AddReport(ReportsCategoryBO.ANALYSIS, "Detailed Aging of Portfolio at Risk", "DetailedAgingPortfolioAtRisk.rptdesign");
upgrade.upgrade(session.connection());
ReportsBO fetched = (ReportsBO) session.get(ReportsBO.class, newId);
Assert.assertEquals(newId, (int) fetched.getReportId());
Assert.assertEquals(ReportsBO.ACTIVE, fetched.getIsActive());
Assert.assertEquals(null, fetched.getActivityId());
Assert.assertEquals("Detailed Aging of Portfolio at Risk", fetched.getReportName());
Assert.assertEquals("aging_portfolio_at_risk", fetched.getReportIdentifier());
Assert.assertEquals(ReportsCategoryBO.ANALYSIS, (int) fetched.getReportsCategoryBO().getReportCategoryId());
ReportsJasperMap map = fetched.getReportsJasperMap();
Assert.assertEquals("DetailedAgingPortfolioAtRisk.rptdesign", map.getReportJasper());
}
use of org.mifos.reports.business.ReportsJasperMap in project head by mifos.
the class ReportsPersistenceIntegrationTest method testCreateJasper.
@Test
public void testCreateJasper() throws Exception {
ReportsJasperMap jasperMap = new ReportsJasperMap(null, "report.jrxml");
new ReportsPersistence().createJasperMap(session, jasperMap);
short reportId = jasperMap.getReportId();
ReportsJasperMap reRead = new ReportsPersistence().oneJasperOfReportId(session, reportId);
Assert.assertEquals("report.jrxml", reRead.getReportJasper());
}
use of org.mifos.reports.business.ReportsJasperMap in project head by mifos.
the class BirtAdminDocumentUploadActionStrutsTest method testShouldSubmitSucessWhenUploadNewAdminDocument.
@Test
public void testShouldSubmitSucessWhenUploadNewAdminDocument() throws Exception {
setRequestPathInfo("/birtAdminDocumentUploadAction.do");
BirtAdminDocumentUploadActionForm form = new BirtAdminDocumentUploadActionForm();
form.setAdminiDocumentTitle("testShouldSubmitSucessWhenUploadNewAdminDocumentWithAVeryLongNameThatExceedsOneHundredCharactersInLength");
form.setIsActive("1");
form.setFile(new MockFormFile("testFileName1.rptdesign"));
setActionForm(form);
addRequestParameter("method", "upload");
actionPerform();
AdminDocumentBO adminDocument = (AdminDocumentBO) request.getAttribute(Constants.BUSINESS_KEY);
Assert.assertNotNull(adminDocument);
ReportsPersistence rp = new ReportsPersistence();
ReportsJasperMap jasper = rp.getPersistentObject(ReportsJasperMap.class, adminDocument.getAdmindocId());
Assert.assertNotNull(jasper);
verifyNoActionErrors();
verifyForward("create_success");
removeReport(adminDocument.getAdmindocId());
}
use of org.mifos.reports.business.ReportsJasperMap 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.business.ReportsJasperMap in project head by mifos.
the class ReportsUploadAction method uploadReport.
/**
* Uploads the Report
*/
public ActionForward uploadReport(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsUploadAction:uploadReport Method: ");
String filename = request.getParameter("filename") == null ? "" : request.getParameter("filename");
String strreportId = request.getParameter("reportId") == null || request.getParameter("reportId").equals("") ? "0" : request.getParameter("reportId");
int reportId = Integer.parseInt(strreportId);
File reportUploadFile = new File(filename);
String fname = reportUploadFile.getName();
if (fname != null) {
fname = fname.replaceAll(".jrxml", ".jasper");
}
ReportsJasperMap objmap = new ReportsJasperMap();
objmap.setReportId((short) reportId);
objmap.setReportJasper(fname);
reportsPersistence.updateReportsJasperMap(objmap);
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTS, new ReportsPersistence().getAllReportCategories());
return mapping.findForward("administerreports_path");
}
Aggregations