com.jrefinery.report.ext.demo
Class AbstractPageableReportServletWorker

java.lang.Object
  |
  +--com.jrefinery.report.ext.demo.AbstractReportServletWorker
        |
        +--com.jrefinery.report.ext.demo.AbstractPageableReportServletWorker
Direct Known Subclasses:
DefaultPageableReportServletWorker

public abstract class AbstractPageableReportServletWorker
extends AbstractReportServletWorker

The report servlet worker provides the infrastructure needed to process the report with a Pageable output target. The worker handles the repagination and report initiatisation.

Author:
Thomas Morgner

Constructor Summary
AbstractPageableReportServletWorker(javax.servlet.http.HttpSession session)
          Creates a new AbstractPageableReportServletWorker for the given session.
 
Method Summary
 int getNumberOfPages()
          Returns the number of pages of the paginated report.
 com.jrefinery.report.targets.pageable.OutputTarget getOutputTarget()
          Gets the output target that should be used to process the report.
 void processPage(int page)
          Processes a single page of the report.
 void processReport()
          Processes the complete report, this calls PageableReportProcessor.processReport() and generates the content.
 void setOutputTarget(com.jrefinery.report.targets.pageable.OutputTarget outputTarget)
          Defines the output target that should be used to process the report.
 
Methods inherited from class com.jrefinery.report.ext.demo.AbstractReportServletWorker
createReport, getPropertyPrefix, getReport, getReportPageFormat, getSession, isSessionRequired, loadReport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPageableReportServletWorker

public AbstractPageableReportServletWorker(javax.servlet.http.HttpSession session)
Creates a new AbstractPageableReportServletWorker for the given session. The session may be null, if a complete report is processed instead of single pages.

Parameters:
session - the used session or null, if no session processing is requested.
Method Detail

getOutputTarget

public com.jrefinery.report.targets.pageable.OutputTarget getOutputTarget()
Gets the output target that should be used to process the report.

Returns:
the defined output target.

setOutputTarget

public void setOutputTarget(com.jrefinery.report.targets.pageable.OutputTarget outputTarget)
Defines the output target that should be used to process the report.

Parameters:
outputTarget - the output target that should be used to repaginate and process the report if necessary.

getNumberOfPages

public int getNumberOfPages()
                     throws com.jrefinery.report.ReportInitialisationException,
                            com.jrefinery.report.ReportProcessingException,
                            com.jrefinery.report.function.FunctionInitializeException
Returns the number of pages of the paginated report. If the pagination fails one of the various exceptions is thrown.

Returns:
the number of pages for the report.
Throws:
com.jrefinery.report.ReportInitialisationException - if the report could not be initialized.
com.jrefinery.report.ReportProcessingException - if the report processing failes.
com.jrefinery.report.function.FunctionInitializeException - if the output function could not be initalized.

processPage

public void processPage(int page)
                 throws com.jrefinery.report.ReportProcessingException
Processes a single page of the report. If the report is not yet paginated, the pagination is done before.

Parameters:
page - the page that should be processed.
Throws:
com.jrefinery.report.ReportProcessingException - if the report processing failed.
java.lang.IndexOutOfBoundsException - if the page is invalid.

processReport

public void processReport()
                   throws com.jrefinery.report.ReportProcessingException
Processes the complete report, this calls PageableReportProcessor.processReport() and generates the content.

Specified by:
processReport in class AbstractReportServletWorker
Throws:
com.jrefinery.report.ReportProcessingException - if something went wrong during the report processing.