use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsCategoryAction method edit.
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsCategoryAction:edit Method: ");
ReportsCategoryActionForm reportsCategoryActionForm = (ReportsCategoryActionForm) form;
String reportCategoryId = request.getParameter("categoryId");
ReportsCategoryBO reportCategory = new ReportsPersistence().getReportCategoryByCategoryId(Short.valueOf(reportCategoryId));
reportsCategoryActionForm.setCategoryName(reportCategory.getReportCategoryName());
return mapping.findForward(ActionForwards.edit_success.toString());
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsPersistence method getReportCategoryByCategoryId.
public ReportsCategoryBO getReportCategoryByCategoryId(Short reportCategoryId) {
Session session = null;
session = StaticHibernateUtil.getSessionTL();
return (ReportsCategoryBO) session.load(ReportsCategoryBO.class, reportCategoryId);
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsPersistenceIntegrationTest method testGetAllReportCategories.
@Test
public void testGetAllReportCategories() {
List<ReportsCategoryBO> listOfReportCategories = reportsPersistence.getAllReportCategories();
Query query = session.createQuery("select count(*) from ReportsCategoryBO");
List<?> list = query.list();
Assert.assertEquals(((Long) list.get(0)).intValue(), listOfReportCategories.size());
Assert.assertEquals("1", listOfReportCategories.get(0).getReportCategoryId().toString());
Assert.assertEquals("Client Detail", listOfReportCategories.get(0).getReportCategoryName());
Assert.assertEquals("2", listOfReportCategories.get(1).getReportCategoryId().toString());
Assert.assertEquals("Performance", listOfReportCategories.get(1).getReportCategoryName());
Assert.assertEquals("3", listOfReportCategories.get(2).getReportCategoryId().toString());
Assert.assertEquals("Center", listOfReportCategories.get(2).getReportCategoryName());
Assert.assertEquals("4", listOfReportCategories.get(3).getReportCategoryId().toString());
Assert.assertEquals("Loan Product Detail", listOfReportCategories.get(3).getReportCategoryName());
Assert.assertEquals("5", listOfReportCategories.get(4).getReportCategoryId().toString());
Assert.assertEquals("Status", listOfReportCategories.get(4).getReportCategoryName());
Assert.assertEquals("6", listOfReportCategories.get(5).getReportCategoryId().toString());
Assert.assertEquals("Analysis", listOfReportCategories.get(5).getReportCategoryName());
Assert.assertEquals("7", listOfReportCategories.get(6).getReportCategoryId().toString());
Assert.assertEquals("Miscellaneous", listOfReportCategories.get(6).getReportCategoryName());
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsPersistenceIntegrationTest method testGetAllReportsForACategory.
@Test
public void testGetAllReportsForACategory() {
List<ReportsCategoryBO> listOfReportCategories = reportsPersistence.getAllReportCategories();
Set<ReportsBO> reportsSet = listOfReportCategories.get(0).getReportsSet();
for (Object element : reportsSet) {
ReportsBO reports = (ReportsBO) element;
if (reports.getReportId().equals("1")) {
Assert.assertEquals("Client Detail", reports.getReportName());
} else if (reports.getReportId().equals("2")) {
Assert.assertEquals("Performance", reports.getReportName());
} else if (reports.getReportId().equals("3")) {
Assert.assertEquals("Kendra", reports.getReportName());
} else if (reports.getReportId().equals("4")) {
Assert.assertEquals("Loan Product Detail", reports.getReportName());
} else if (reports.getReportId().equals("5")) {
Assert.assertEquals("Status", reports.getReportName());
} else if (reports.getReportId().equals("6")) {
Assert.assertEquals("Analysis", reports.getReportName());
} else if (reports.getReportId().equals("7")) {
Assert.assertEquals("Miscellaneous", reports.getReportName());
} else {
/*
* We always get here, because the above code is comparing a
* Short to a String. TODO: how do we really want to test this,
* anyway?
*/
// Assert.fail("unexpected report " + reports.getReportId());
}
}
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsPersistenceIntegrationTest method testGetReportCategoryByCategoryId.
@Test
public void testGetReportCategoryByCategoryId() {
Short reportCategoryId = 1;
ReportsCategoryBO reportCategory = reportsPersistence.getReportCategoryByCategoryId(reportCategoryId);
Assert.assertEquals(reportCategoryId, reportCategory.getReportCategoryId());
}
Aggregations