Search in sources :

Example 1 with ActionInput

use of org.pentaho.actionsequence.dom.ActionInput in project pentaho-platform by pentaho.

the class JFreeReportComponent method getInputParamDataFactory.

private PentahoTableDataFactory getInputParamDataFactory() {
    PentahoTableDataFactory factory = null;
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    ActionInput reportDataParam = (ActionInput) jFreeReportAction.getData();
    Object dataObject = reportDataParam != null ? reportDataParam.getValue() : null;
    if ((dataObject instanceof IPentahoResultSet) || (dataObject instanceof TableModel)) {
        factory = new PentahoTableDataFactory();
        if (dataObject instanceof IPentahoResultSet) {
            IPentahoResultSet resultset = (IPentahoResultSet) dataObject;
            if (resultset.isScrollable()) {
                resultset.beforeFirst();
            } else {
                // $NON-NLS-1$
                debug("ResultSet is not scrollable. Copying into memory");
                IPentahoResultSet memSet = resultset.memoryCopy();
                resultset.close();
                resultset = memSet;
            }
            factory.addTable(AbstractJFreeReportComponent.DATACOMPONENT_DEFAULTINPUT, new PentahoTableModel(resultset));
        } else if (dataObject instanceof TableModel) {
            factory.addTable(AbstractJFreeReportComponent.DATACOMPONENT_DEFAULTINPUT, (TableModel) dataObject);
        }
        IActionInput[] subreportQueries = jFreeReportAction.getSubreportQueryParams();
        for (IActionInput element : subreportQueries) {
            dataObject = element.getValue();
            if (dataObject instanceof IPreparedComponent) {
                factory.addPreparedComponent(element.getName(), (IPreparedComponent) dataObject);
            } else if (dataObject instanceof IPentahoResultSet) {
                final IPentahoResultSet resultset = (IPentahoResultSet) dataObject;
                resultset.beforeFirst();
                factory.addTable(element.getName(), new PentahoTableModel(resultset));
            } else if (dataObject instanceof TableModel) {
                factory.addTable(element.getName(), (TableModel) dataObject);
            }
        }
    }
    return factory;
}
Also used : JFreeReportAction(org.pentaho.actionsequence.dom.actions.JFreeReportAction) PentahoTableModel(org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableModel) IPentahoResultSet(org.pentaho.commons.connection.IPentahoResultSet) ActionInput(org.pentaho.actionsequence.dom.ActionInput) IActionInput(org.pentaho.actionsequence.dom.IActionInput) IActionInput(org.pentaho.actionsequence.dom.IActionInput) PentahoTableDataFactory(org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableDataFactory) TableModel(javax.swing.table.TableModel) PentahoTableModel(org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableModel) IPreparedComponent(org.pentaho.platform.api.data.IPreparedComponent)

Example 2 with ActionInput

use of org.pentaho.actionsequence.dom.ActionInput in project pentaho-platform by pentaho.

the class JFreeReportComponent method getReportFromInputParam.

private MasterReport getReportFromInputParam() throws ResourceException, UnsupportedEncodingException, IOException {
    MasterReport report = null;
    JFreeReportAction jFreeReportAction = (JFreeReportAction) getActionDefinition();
    Object reportDefinition = jFreeReportAction.getReportDefinition();
    if (reportDefinition instanceof ActionInput) {
        String repDef = ((ActionInput) reportDefinition).getStringValue();
        report = createReport(repDef);
    }
    return report;
}
Also used : JFreeReportAction(org.pentaho.actionsequence.dom.actions.JFreeReportAction) MasterReport(org.pentaho.reporting.engine.classic.core.MasterReport) ActionInput(org.pentaho.actionsequence.dom.ActionInput) IActionInput(org.pentaho.actionsequence.dom.IActionInput)

Example 3 with ActionInput

use of org.pentaho.actionsequence.dom.ActionInput in project pentaho-platform by pentaho.

the class UtilityComponent method executeCopyAction.

private boolean executeCopyAction(final CopyParamAction copyParamAction) {
    boolean result = true;
    IActionInput actionInput = copyParamAction.getCopyFrom();
    IActionOutput actionOutput = copyParamAction.getOutputCopy();
    if ((actionInput instanceof ActionInput) && (actionOutput != null)) {
        try {
            actionOutput.setValue(actionInput.getValue());
        } catch (Exception ex) {
            result = false;
        }
    }
    return result;
}
Also used : ActionInput(org.pentaho.actionsequence.dom.ActionInput) IActionInput(org.pentaho.actionsequence.dom.IActionInput) IActionInput(org.pentaho.actionsequence.dom.IActionInput) IActionOutput(org.pentaho.actionsequence.dom.IActionOutput)

Aggregations

ActionInput (org.pentaho.actionsequence.dom.ActionInput)3 IActionInput (org.pentaho.actionsequence.dom.IActionInput)3 JFreeReportAction (org.pentaho.actionsequence.dom.actions.JFreeReportAction)2 TableModel (javax.swing.table.TableModel)1 IActionOutput (org.pentaho.actionsequence.dom.IActionOutput)1 IPentahoResultSet (org.pentaho.commons.connection.IPentahoResultSet)1 IPreparedComponent (org.pentaho.platform.api.data.IPreparedComponent)1 PentahoTableDataFactory (org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableDataFactory)1 PentahoTableModel (org.pentaho.platform.plugin.action.jfreereport.helper.PentahoTableModel)1 MasterReport (org.pentaho.reporting.engine.classic.core.MasterReport)1