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;
}
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;
}
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;
}
Aggregations