use of org.mifos.reports.business.dao.ReportsParamQueryDAO 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);
}
Aggregations