Search in sources :

Example 1 with ReportDataFactoryException

use of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException in project head by mifos.

the class PentahoParamParser method parseReportParams.

public List<AbstractPentahoParameter> parseReportParams(MasterReport report, HttpServletRequest request, Map<String, AbstractPentahoParameter> selectedValues, boolean update) {
    ParameterContext paramContext = null;
    try {
        paramContext = new DefaultParameterContext(report);
        ReportParameterDefinition paramDefinition = report.getParameterDefinition();
        List<AbstractPentahoParameter> result = new ArrayList<AbstractPentahoParameter>();
        for (ParameterDefinitionEntry paramDefEntry : paramDefinition.getParameterDefinitions()) {
            result.add(parseParam(paramDefEntry, paramContext, selectedValues, update));
        }
        return result;
    } catch (ReportDataFactoryException ex) {
        throw new JNDIException("Problem with Pentaho Reports", request);
    } catch (Exception ex) {
        throw new MifosRuntimeException(ex);
    } finally {
        if (paramContext != null) {
            try {
                paramContext.close();
            } catch (ReportDataFactoryException ex) {
                logger.error("Exception while closing parameter context", ex);
            }
        }
    }
}
Also used : ReportParameterDefinition(org.pentaho.reporting.engine.classic.core.parameters.ReportParameterDefinition) AbstractPentahoParameter(org.mifos.reports.pentaho.params.AbstractPentahoParameter) DefaultParameterContext(org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext) ParameterDefinitionEntry(org.pentaho.reporting.engine.classic.core.parameters.ParameterDefinitionEntry) ArrayList(java.util.ArrayList) ReportDataFactoryException(org.pentaho.reporting.engine.classic.core.ReportDataFactoryException) DefaultParameterContext(org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext) ParameterContext(org.pentaho.reporting.engine.classic.core.parameters.ParameterContext) ReportDataFactoryException(org.pentaho.reporting.engine.classic.core.ReportDataFactoryException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Example 2 with ReportDataFactoryException

use of org.pentaho.reporting.engine.classic.core.ReportDataFactoryException in project pentaho-platform by pentaho.

the class PentahoDataFactory method queryData.

@Override
public TableModel queryData(final String string, final DataRow dataRow) throws ReportDataFactoryException {
    final TableModel tableModel = super.queryData(string, dataRow);
    try {
        final Class cls = tableModel.getClass();
        final Map map = new HashMap();
        String[] columnNames = dataRow.getColumnNames();
        for (String columnName : columnNames) {
            map.put(columnName, dataRow.get(columnName));
        }
        final Object[] args = { map };
        final Class[] argt = { Map.class };
        // $NON-NLS-1$
        final Method theMethod = cls.getMethod("setParameters", argt);
        if (theMethod != null) {
            theMethod.invoke(tableModel, args);
        }
    } catch (Exception ignored) {
    // Method does not exist... ok, ignore it.
    }
    return tableModel;
}
Also used : HashMap(java.util.HashMap) Method(java.lang.reflect.Method) Map(java.util.Map) HashMap(java.util.HashMap) TableModel(javax.swing.table.TableModel) ReportDataFactoryException(org.pentaho.reporting.engine.classic.core.ReportDataFactoryException)

Aggregations

ReportDataFactoryException (org.pentaho.reporting.engine.classic.core.ReportDataFactoryException)2 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TableModel (javax.swing.table.TableModel)1 MifosRuntimeException (org.mifos.core.MifosRuntimeException)1 AbstractPentahoParameter (org.mifos.reports.pentaho.params.AbstractPentahoParameter)1 DefaultParameterContext (org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext)1 ParameterContext (org.pentaho.reporting.engine.classic.core.parameters.ParameterContext)1 ParameterDefinitionEntry (org.pentaho.reporting.engine.classic.core.parameters.ParameterDefinitionEntry)1 ReportParameterDefinition (org.pentaho.reporting.engine.classic.core.parameters.ReportParameterDefinition)1