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;
}
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;
}
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();
}
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());
}
Aggregations