Search in sources :

Example 26 with ReportsPersistence

use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.

the class ReportsBusinessService method createReportsParams.

/**
     * Create Report Parameter
     */
public String createReportsParams(ReportsParamsValue objParams) throws ApplicationException {
    String error = "";
    boolean isInUse = false;
    List<ReportsParams> reportsParams = new ReportsPersistence().getAllReportParams();
    Object[] obj = reportsParams.toArray();
    if (obj != null && obj.length > 0) {
        for (Object element : obj) {
            ReportsParams rp = (ReportsParams) element;
            if (rp.getName().equalsIgnoreCase(objParams.getName())) {
                isInUse = true;
                break;
            }
        }
    }
    if (objParams.getName() == null || objParams.getName().equals("") || isInUse) {
        error = "Parameter Name is blank or has been already Used";
    } else if (objParams.getDescription() == null || objParams.getDescription().equals("") || isInUse) {
        error = "Description cannot be blank";
    } else {
        reportsPersistence.createReportParams(objParams);
    }
    return error;
}
Also used : ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) ReportsParams(org.mifos.reports.business.ReportsParams) AbstractBusinessObject(org.mifos.framework.business.AbstractBusinessObject)

Example 27 with ReportsPersistence

use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.

the class ActivityMapper method getReportsUserParamsSecurity.

private ActionSecurity getReportsUserParamsSecurity() {
    ReportActionSecurity security = new ReportActionSecurity("reportsUserParamsAction", "loadAddList");
    // FIXME: no associated activity exists for this constant
    security.allow("reportuserparamslist_path", SecurityConstants.ADMINISTER_REPORTPARAMS);
    for (ReportsBO report : new ReportsPersistence().getAllReports()) {
        security.allowReport(report.getReportId().intValue(), report.getActivityId());
    }
    // FIXME: no associated activity exists for this constant
    security.allow("loadAddList", SecurityConstants.ADMINISTER_REPORTPARAMS);
    security.allow("processReport", SecurityConstants.ADMINISTER_REPORTPARAMS);
    security.allow("reportsuserprocess_path", SecurityConstants.ADMINISTER_REPORTPARAMS);
    security.allow("loadAdminReport", SecurityConstants.CAN_VIEW_ADMIN_DOCUMENTS);
    return security;
}
Also used : ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) ReportsBO(org.mifos.reports.business.ReportsBO)

Example 28 with ReportsPersistence

use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.

the class BirtReportsUploadActionStrutsTest method removeReport.

private void removeReport(Short reportId) throws PersistenceException {
    ReportsPersistence reportPersistence = new ReportsPersistence();
    reportPersistence.getSession().clear();
    ReportsBO report = reportPersistence.getPersistentObject(ReportsBO.class, reportId);
    ActivityEntity activityEntity = legacyRolesPermissionsDao.getPersistentObject(ActivityEntity.class, report.getActivityId());
    reportPersistence.delete(report);
    LookUpValueEntity anLookUp = activityEntity.getActivityNameLookupValues();
    legacyRolesPermissionsDao.delete(activityEntity);
    legacyRolesPermissionsDao.delete(anLookUp);
    StaticHibernateUtil.flushSession();
}
Also used : ActivityEntity(org.mifos.security.rolesandpermission.business.ActivityEntity) ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) ReportsBO(org.mifos.reports.business.ReportsBO) LookUpValueEntity(org.mifos.application.master.business.LookUpValueEntity)

Example 29 with ReportsPersistence

use of org.mifos.reports.persistence.ReportsPersistence 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());
}
Also used : MockFormFile(org.mifos.reports.business.MockFormFile) ReportsPersistence(org.mifos.reports.persistence.ReportsPersistence) AdminDocumentBO(org.mifos.reports.admindocuments.business.AdminDocumentBO) BirtAdminDocumentUploadActionForm(org.mifos.reports.admindocuments.struts.actionforms.BirtAdminDocumentUploadActionForm) ReportsJasperMap(org.mifos.reports.business.ReportsJasperMap) Test(org.junit.Test)

Aggregations

ReportsPersistence (org.mifos.reports.persistence.ReportsPersistence)29 ReportsCategoryBO (org.mifos.reports.business.ReportsCategoryBO)16 ReportsBO (org.mifos.reports.business.ReportsBO)10 BirtReportsUploadActionForm (org.mifos.reports.struts.actionforms.BirtReportsUploadActionForm)9 ReportsJasperMap (org.mifos.reports.business.ReportsJasperMap)7 ReportsCategoryActionForm (org.mifos.reports.struts.actionforms.ReportsCategoryActionForm)7 ActionErrors (org.apache.struts.action.ActionErrors)5 ActionMessage (org.apache.struts.action.ActionMessage)5 File (java.io.File)3 Test (org.junit.Test)3 MockFormFile (org.mifos.reports.business.MockFormFile)3 FormFile (org.apache.struts.upload.FormFile)2 ActivityGeneratorException (org.mifos.security.activity.ActivityGeneratorException)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 LookUpValueEntity (org.mifos.application.master.business.LookUpValueEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 ReportCategoryDto (org.mifos.dto.domain.ReportCategoryDto)1 AbstractBusinessObject (org.mifos.framework.business.AbstractBusinessObject)1 ApplicationException (org.mifos.framework.exceptions.ApplicationException)1