Search in sources :

Example 16 with ReportsCategoryBO

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());
}
Also used : ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) ReportsCategoryActionForm(org.mifos.reports.struts.actionforms.ReportsCategoryActionForm) ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO)

Example 17 with ReportsCategoryBO

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);
}
Also used : ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) Session(org.hibernate.Session)

Example 18 with ReportsCategoryBO

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());
}
Also used : Query(org.hibernate.Query) ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) Test(org.junit.Test)

Example 19 with ReportsCategoryBO

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());
        }
    }
}
Also used : ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) ReportsBO(org.mifos.reports.business.ReportsBO) Test(org.junit.Test)

Example 20 with ReportsCategoryBO

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());
}
Also used : ReportsCategoryBO(org.mifos.reports.business.ReportsCategoryBO) Test(org.junit.Test)

Aggregations

ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)20 ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)15 ReportsCategoryActionForm (org.mifos.reports.struts.actionforms.ReportsCategoryActionForm)7 ReportsBO (org.mifos.reports.business.ReportsBO)5 BirtReportsUploadActionForm (org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm)5 ActionErrors (org.apache.struts.action.ActionErrors)4 ActionMessage (org.apache.struts.action.ActionMessage)4 Test (org.junit.Test)4 FormFile (org.apache.struts.upload.FormFile)2 ActivityGeneratorException (org.mifos.security.activity.ActivityGeneratorException)2 ArrayList (java.util.ArrayList)1 Query (org.hibernate.Query)1 Session (org.hibernate.Session)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 ReportCategoryDto (org.mifos.dto.domain.ReportCategoryDto)1 ApplicationException (org.mifos.framework.exceptions.ApplicationException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 SystemException (org.mifos.framework.exceptions.SystemException)1 ReportsJasperMap (org.mifos.reports.business.ReportsJasperMap)1