Search in sources :

Example 6 with AbstractPentahoParameter

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;
}
Also used : PentahoReport(org.mifos.reports.pentaho.PentahoReport) AbstractPentahoParameter(org.mifos.reports.pentaho.params.AbstractPentahoParameter) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) PentahoInputParameter(org.mifos.reports.pentaho.params.PentahoInputParameter) ModelAndView(org.springframework.web.servlet.ModelAndView) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with AbstractPentahoParameter

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;
}
Also used : AbstractPentahoParameter(org.mifos.reports.pentaho.params.AbstractPentahoParameter) DefaultListParameter(org.pentaho.reporting.engine.classic.core.parameters.DefaultListParameter) ListParameter(org.pentaho.reporting.engine.classic.core.parameters.ListParameter) PlainParameter(org.pentaho.reporting.engine.classic.core.parameters.PlainParameter)

Example 8 with AbstractPentahoParameter

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;
}
Also used : AbstractPentahoParameter(org.mifos.reports.pentaho.params.AbstractPentahoParameter) DefaultListParameter(org.pentaho.reporting.engine.classic.core.parameters.DefaultListParameter)

Aggregations

AbstractPentahoParameter (org.mifos.reports.pentaho.params.AbstractPentahoParameter)8 HashMap (java.util.HashMap)3 ArrayList (java.util.ArrayList)2 PentahoReport (org.mifos.reports.pentaho.PentahoReport)2 PentahoInputParameter (org.mifos.reports.pentaho.params.PentahoInputParameter)2 DefaultListParameter (org.pentaho.reporting.engine.classic.core.parameters.DefaultListParameter)2 ParameterDefinitionEntry (org.pentaho.reporting.engine.classic.core.parameters.ParameterDefinitionEntry)2 ReportParameterDefinition (org.pentaho.reporting.engine.classic.core.parameters.ReportParameterDefinition)2 File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 Test (org.junit.Test)1 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 AdminDocAccStateMixBO (org.mifos.reports.admindocuments.business.AdminDocAccStateMixBO)1 AdminDocumentBO (org.mifos.reports.admindocuments.business.AdminDocumentBO)1 PentahoMultiSelectParameter (org.mifos.reports.pentaho.params.PentahoMultiSelectParameter)1 PentahoSingleSelectParameter (org.mifos.reports.pentaho.params.PentahoSingleSelectParameter)1 PentahoOutputType (org.mifos.reports.pentaho.util.PentahoOutputType)1 ReportDataFactoryException (org.pentaho.reporting.engine.classic.core.ReportDataFactoryException)1 DefaultParameterContext (org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext)1