use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsCategoryAction method deleteReportsCategory.
public ActionForward deleteReportsCategory(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsCategoryAction:deleteReportsCategory Method: ");
ReportsCategoryActionForm reportsCategoryActionForm = (ReportsCategoryActionForm) form;
ReportsCategoryBO reportsCategoryBO = new ReportsPersistence().getReportCategoryByCategoryId(Short.valueOf(reportsCategoryActionForm.getCategoryId()));
if (!isValidToDelete(request, reportsCategoryBO)) {
return mapping.findForward(ActionForwards.confirm_delete.toString());
}
new ReportsPersistence().delete(reportsCategoryBO);
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTCATEGORIES, new ReportsPersistence().getAllReportCategories());
return mapping.findForward(ActionForwards.delete_success.toString());
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class ReportsPersistenceIntegrationTest method testGetReportPath.
@Test
public void testGetReportPath() {
List<ReportsCategoryBO> listOfReportCategories = reportsPersistence.getAllReportCategories();
Set<ReportsBO> reportsSet = listOfReportCategories.get(0).getReportsSet();
for (ReportsBO reports : reportsSet) {
if (reports.getReportId().equals("1")) {
Assert.assertEquals("report_designer", reports.getReportIdentifier());
}
}
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class AdminServiceFacadeWebTier method createReportsCategory.
@Override
public void createReportsCategory(ReportCategoryDto reportCategory) {
ReportsCategoryBO newReportCategory = new ReportsCategoryBO();
newReportCategory.setReportCategoryName(reportCategory.getName());
try {
new ReportsPersistence().createOrUpdate(newReportCategory);
StaticHibernateUtil.commitTransaction();
} catch (Exception e) {
StaticHibernateUtil.rollbackTransaction();
} finally {
StaticHibernateUtil.closeSession();
}
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class BirtReportsUploadAction method preview.
public ActionForward preview(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm uploadForm = (BirtReportsUploadActionForm) form;
ReportsPersistence rp = new ReportsPersistence();
ReportsCategoryBO category = rp.getPersistentObject(ReportsCategoryBO.class, Short.valueOf(uploadForm.getReportCategoryId()));
request.setAttribute("category", category);
if (isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.preview_failure.toString());
}
return mapping.findForward(ActionForwards.preview_success.toString());
}
use of org.mifos.reports.business.ReportsCategoryBO in project head by mifos.
the class BirtReportsUploadAction method upload.
public ActionForward upload(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm uploadForm = (BirtReportsUploadActionForm) form;
ReportsPersistence rp = new ReportsPersistence();
ReportsCategoryBO category = rp.getPersistentObject(ReportsCategoryBO.class, Short.valueOf(uploadForm.getReportCategoryId()));
if (isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.preview_failure.toString());
}
short parentActivity = category.getActivityId();
int newActivityId;
String activityNameHead = "Can view ";
try {
newActivityId = legacyRolesPermissionsDao.calculateDynamicActivityId();
legacyRolesPermissionsDao.createActivityForReports(parentActivity, activityNameHead + uploadForm.getReportTitle());
} catch (ActivityGeneratorException ex) {
ActionErrors errors = new ActionErrors();
errors.add(ex.getKey(), new ActionMessage(ex.getKey()));
request.setAttribute(Globals.ERROR_KEY, errors);
return mapping.findForward(ActionForwards.preview_failure.toString());
}
FormFile formFile = uploadForm.getFile();
uploadFile(formFile);
ReportsBO reportBO = createOrUpdateReport(category, newActivityId, uploadForm.getReportTitle(), Short.valueOf(uploadForm.getIsActive()), formFile.getFileName(), uploadForm.getIsDW());
allowActivityPermission(reportBO, newActivityId);
request.setAttribute("report", reportBO);
return mapping.findForward(ActionForwards.create_success.toString());
}
Aggregations