use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class AdminServiceFacadeWebTier method retrieveReportCategories.
@Override
public List<ReportCategoryDto> retrieveReportCategories() {
List<ReportCategoryDto> reportCategories = new ArrayList<ReportCategoryDto>();
List<ReportsCategoryBO> allCategories = new ReportsPersistence().getAllReportCategories();
for (ReportsCategoryBO category : allCategories) {
reportCategories.add(category.toDto());
}
return reportCategories;
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class ReportsUserParamsAction method loadAddList.
/**
* Loads the Parameter Add page
*/
@SuppressWarnings("unchecked")
public ActionForward loadAddList(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In ReportsUserParamsAction:load Method: ");
request.getSession().setAttribute("listOfAllParameters", new ReportsPersistence().getAllReportParams());
ReportsParamQueryDAO paramDAO = new ReportsParamQueryDAO();
ReportsUserParamsActionForm actionForm = (ReportsUserParamsActionForm) form;
String strReportId = request.getParameter("reportId");
if (strReportId == null) {
strReportId = actionForm.getReportId() + "";
}
if (strReportId.equals("")) {
strReportId = "0";
}
int reportId = Integer.parseInt(strReportId);
String reportName = reportsPersistence.getReport((short) reportId).getReportName();
List<ReportsJasperMap> reports = reportsPersistence.findJasperOfReportId(reportId);
if (reports.size() > 0) {
ReportsJasperMap reportFile = reports.get(0);
String filename = reportFile.getReportJasper();
File file = new File(BirtReportsUploadAction.getCustomReportStorageDirectory(), filename);
if (file.exists()) {
filename = file.getAbsolutePath();
} else {
filename = "report/" + filename;
}
if (filename.endsWith(".rptdesign")) {
request.setAttribute("reportFile", filename);
request.setAttribute("reportName", reportName);
return mapping.findForward(ReportsConstants.BIRTREPORTPATH);
}
}
actionForm.setReportId(reportId);
request.getSession().setAttribute("listOfAllParametersForReportId", reportsPersistence.findParamsOfReportId(reportId));
request.getSession().setAttribute("listOfReportJasper", reportsPersistence.findJasperOfReportId(reportId));
List<ReportsParamsMap> reportParams = (List) request.getSession().getAttribute("listOfAllParametersForReportId");
Object[] obj = reportParams.toArray();
if (obj != null && obj.length > 0) {
for (int i = 0; i < obj.length; i++) {
ReportsParamsMap rp = (ReportsParamsMap) obj[i];
if (rp.getReportsParams().getType().equalsIgnoreCase("Query")) {
request.getSession().setAttribute("para" + (i + 1), paramDAO.listValuesOfParameters(rp.getReportsParams()));
}
}
}
return mapping.findForward(ReportsConstants.ADDLISTREPORTSUSERPARAMS);
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class ReportsUserParamsAction method loadAdminReport.
/**
* To allow loading Administrative documents
*/
public ActionForward loadAdminReport(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
request.getSession().setAttribute("listOfAllParameters", new ReportsPersistence().getAllReportParams());
String strReportId = request.getParameter("admindocId");
String account_id = request.getParameter("globalAccountNum");
if (strReportId == null || strReportId.equals("")) {
strReportId = "0";
}
int reportId = Integer.parseInt(strReportId);
String reportName = legacyAdminDocumentDao.getAdminDocumentById((short) reportId).getAdminDocumentName();
String filename = legacyAdminDocumentDao.getAdminDocumentById((short) reportId).getAdminDocumentIdentifier();
File file = new File(viewOrganizationSettingsServiceFacade.getAdminDocumentStorageDirectory(), filename);
if (file.exists()) {
filename = file.getAbsolutePath();
} else {
filename = "adminReport/" + filename;
}
if (filename.endsWith(".rptdesign")) {
request.setAttribute("reportFile", filename);
request.setAttribute("reportName", reportName);
request.setAttribute("account_id", account_id);
return mapping.findForward(ReportsConstants.ADMINDOCBIRTREPORTPATH);
}
return mapping.findForward(ReportsConstants.ADMINDOCBIRTREPORTPATH);
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadAction method editpreview.
public ActionForward editpreview(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);
ReportsBO report = new ReportsPersistence().getReport(Short.valueOf(uploadForm.getReportId()));
if (isReportInfoNotEdit(request, uploadForm, report)) {
return mapping.findForward(ActionForwards.editpreview_failure.toString());
} else if (!isReportItsSelf(uploadForm, report) && isReportAlreadyExist(request, uploadForm.getReportTitle(), category)) {
return mapping.findForward(ActionForwards.editpreview_failure.toString());
}
return mapping.findForward(ActionForwards.editpreview_success.toString());
}
use of org.mifos.reports.persistence.ReportsPersistence in project head by mifos.
the class BirtReportsUploadAction method edit.
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
BirtReportsUploadActionForm birtReportsUploadActionForm = (BirtReportsUploadActionForm) form;
ReportsBO report = new ReportsPersistence().getReport(Short.valueOf(request.getParameter("reportId")));
request.setAttribute(Constants.BUSINESS_KEY, report);
birtReportsUploadActionForm.setReportTitle(report.getReportName());
birtReportsUploadActionForm.setReportCategoryId(report.getReportsCategoryBO().getReportCategoryId().toString());
birtReportsUploadActionForm.setIsActive(report.getIsActive().toString());
request.getSession().setAttribute(ReportsConstants.LISTOFREPORTS, new ReportsPersistence().getAllReportCategories());
return mapping.findForward(ActionForwards.edit_success.toString());
}
Aggregations