ro.nextreports.engine
Class FluentReportRunner

Package class diagram package FluentReportRunner
Package class diagram package FluentReportRunner
java.lang.Object
  extended by ro.nextreports.engine.FluentReportRunner

public class FluentReportRunner
extends java.lang.Object

Utilities class to run a report using a fluent syntax


Method Summary
 FluentReportRunner computeCount(boolean count)
          Set compute count property : default this property is false because this computation takes time
 FluentReportRunner connectTo(java.sql.Connection connection)
          Set the connection to database
 FluentReportRunner connectToCsv(java.sql.Connection connection)
          Set the connection to csv file
 FluentReportRunner formatAs(java.lang.String format)
          Set the output format
 java.util.Map<java.lang.String,java.lang.Object> getParameterValues()
          Get parameters values Values for dynamic parameters are set at runtime
 boolean isCancelled()
          See if runner is cancelled
 FluentReportRunner registerListener(ro.nextreports.engine.exporter.event.ExporterEventListener listener)
          Register a listener
static FluentReportRunner report(Report report)
          Create a FluentReportRunner object
 void run(java.io.OutputStream stream)
          Export the current report to the specified output format
 void stop()
          Stop the export process
 FluentReportRunner unregisterListener(ro.nextreports.engine.exporter.event.ExporterEventListener listener)
          Unregister a listener
 FluentReportRunner withAlerts(java.util.List<ro.nextreports.engine.exporter.Alert> alerts)
          Set an alert
 FluentReportRunner withChartImagePath(java.lang.String path)
          Set path to folder where chart generated images will be saved
 FluentReportRunner withParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
          Set the parameters values
 FluentReportRunner withQueryTimeout(int queryTimeout)
          Set the query timeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

report

public static FluentReportRunner report(Report report)
Create a FluentReportRunner object

Parameters:
report - next report object
Returns:
the newly created FluentReportRunner object

connectTo

public FluentReportRunner connectTo(java.sql.Connection connection)
Set the connection to database

Parameters:
connection - database connection
Returns:
FluentReportRunner object with database connection set

connectToCsv

public FluentReportRunner connectToCsv(java.sql.Connection connection)
Set the connection to csv file

Parameters:
connection - csv file connection
Returns:
FluentReportRunner object with csv file connection set

withQueryTimeout

public FluentReportRunner withQueryTimeout(int queryTimeout)
Set the query timeout

Parameters:
queryTimeout - database execution query timeout in seconds
Returns:
FluentReportRunner object with query timeout set

withParameterValues

public FluentReportRunner withParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Set the parameters values

Parameters:
parameterValues - map of parameters values where the key is the parameter name and the value is the parameter value(s) Such parameter value can be a simple java object if the parameter has SINGLE SELECTION, or in case of MULTIPLE SELECTION value is an array Object[] of java objects. For an empty list of values , the value must be : new Object[]{ParameterUtil.NULL} If we programatically add value(s) in parameterValues for a hidden parameter, the default values for that hidden parameter will be ignored and the engine will use those from the map.
Returns:
FluentReportRunner object with parameters values set

withChartImagePath

public FluentReportRunner withChartImagePath(java.lang.String path)
Set path to folder where chart generated images will be saved

Parameters:
path - folder path
Returns:
FluentReportRunner object with chart image path set

formatAs

public FluentReportRunner formatAs(java.lang.String format)
Set the output format

Parameters:
format - output format : ReportRunner.PDF_FORMAT, ReportRunner.EXCEL_FROMAT ReportRunner.HTML_FORMAT, ReportRunner.RTF_FORMAT, ReportRunner.CSV_FORMAT, ReportRunner.TSV_FROMAT
Returns:
FluentReportRunner object with output format set

withAlerts

public FluentReportRunner withAlerts(java.util.List<ro.nextreports.engine.exporter.Alert> alerts)
Set an alert

Parameters:
alerts - alerts list
Returns:
FluentReportRunner object with alert set

computeCount

public FluentReportRunner computeCount(boolean count)
Set compute count property : default this property is false because this computation takes time

Parameters:
count - true means the count will be computed
Returns:
FluentReportRunner object with count property set

registerListener

public FluentReportRunner registerListener(ro.nextreports.engine.exporter.event.ExporterEventListener listener)
Register a listener

Parameters:
listener - exporter event listener
Returns:
FluentReportRunner object with listener registered

unregisterListener

public FluentReportRunner unregisterListener(ro.nextreports.engine.exporter.event.ExporterEventListener listener)
Unregister a listener

Parameters:
listener - exporter event listener
Returns:
FluentReportRunner object with listener unregistered

run

public void run(java.io.OutputStream stream)
         throws ReportRunnerException,
                ro.nextreports.engine.exporter.exception.NoDataFoundException
Export the current report to the specified output format

Parameters:
stream - output stream to write the exported report
Throws:
ReportRunnerException - if FluentReportRunner object is not correctly configured
ro.nextreports.engine.exporter.exception.NoDataFoundException - if no data is found

stop

public void stop()
Stop the export process


isCancelled

public boolean isCancelled()
See if runner is cancelled

Returns:
true if runner is cancelled

getParameterValues

public java.util.Map<java.lang.String,java.lang.Object> getParameterValues()
Get parameters values Values for dynamic parameters are set at runtime

Returns:
parameters values