use of org.mifos.reports.pentaho.params.AbstractPentahoParameter in project head by mifos.
the class AdminDocumentController method executeAdminDocument.
@RequestMapping(value = "/executeAdminDocument.ftl", method = RequestMethod.GET)
public ModelAndView executeAdminDocument(final HttpServletRequest request, HttpServletResponse response, @RequestParam Integer adminDocumentId, @RequestParam String entityId, @RequestParam Integer outputTypeId) throws IOException {
ModelAndView mav = null;
String fileName = pentahoReportsService.getAdminReportFileName(adminDocumentId);
if (fileName.endsWith(".rptdesign")) {
response.sendRedirect(String.format(LEGACY_BIRT_ADMIN_DOCUMENT_LOAD_PATH, adminDocumentId.toString(), entityId));
} else {
Map<String, AbstractPentahoParameter> params = new HashMap<String, AbstractPentahoParameter>();
PentahoInputParameter entityIdParameter = new PentahoInputParameter();
entityIdParameter.setParamName("entity_id");
entityIdParameter.setValue(entityId);
params.put("entity_id", entityIdParameter);
PentahoReport report = pentahoReportsService.getAdminReport(adminDocumentId, outputTypeId, params);
if (!outputTypeId.equals(PENTAHO_OUTPUT_TYPE_HTML_ID)) {
response.setHeader("Content-Disposition", "attachment; filename=\"" + report.getFilename() + "\"");
}
response.setContentType(report.getContentType());
response.setContentLength(report.getContentSize());
response.getOutputStream().write(report.getContent());
}
return mav;
}
use of org.mifos.reports.pentaho.params.AbstractPentahoParameter in project head by mifos.
the class PentahoParamParser method parseParam.
private AbstractPentahoParameter parseParam(ParameterDefinitionEntry paramDefEntry, ParameterContext paramContext, Map<String, AbstractPentahoParameter> selectedValues, boolean update) throws ReportDataFactoryException {
AbstractPentahoParameter result = null;
if (paramDefEntry instanceof PlainParameter) {
result = parsePlainParameter((PlainParameter) paramDefEntry);
} else if (paramDefEntry instanceof ListParameter) {
result = parseListParameter((ListParameter) paramDefEntry, paramContext, selectedValues, update);
} else {
return null;
}
result.setMandatory(paramDefEntry.isMandatory());
result.setParamName(paramDefEntry.getName());
if (null != paramDefEntry.getParameterAttribute(paramDefEntry.getParameterAttributeNamespaces()[0], "label", paramContext)) {
result.setLabelName(paramDefEntry.getParameterAttribute(paramDefEntry.getParameterAttributeNamespaces()[0], "label", paramContext).replace(":", ""));
} else {
result.setLabelName(paramDefEntry.getName());
}
return result;
}
use of org.mifos.reports.pentaho.params.AbstractPentahoParameter in project head by mifos.
the class PentahoParamParser method parseListParameter.
private AbstractPentahoParameter parseListParameter(ListParameter paramDefEntry, ParameterContext paramContext, Map<String, AbstractPentahoParameter> selectedValues, boolean update) throws ReportDataFactoryException {
DefaultListParameter listParam = (DefaultListParameter) paramDefEntry;
AbstractPentahoParameter result;
if (listParam.isAllowMultiSelection()) {
result = parseMultiListParameter(paramDefEntry, paramContext);
} else {
result = parseSingleListParameter(paramDefEntry, paramContext, selectedValues, update);
}
return result;
}
Aggregations