com.jrefinery.report.ext.demo
Class AbstractReportServletWorker

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

public abstract class AbstractReportServletWorker
extends java.lang.Object

The report servlet worker provides the infrastructure needed to process the report. The worker stores the processed data in the provided session.

Author:
Thomas Morgner

Constructor Summary
AbstractReportServletWorker(javax.servlet.http.HttpSession session)
          Creates a new Report servlet worker for the given session.
 
Method Summary
protected abstract  com.jrefinery.report.JFreeReport createReport()
          Parses the report and returns the fully initialized report.
protected  java.lang.String getPropertyPrefix()
          Returns a property prefix for the various used report properties.
 com.jrefinery.report.JFreeReport getReport()
          Load or parses the report definition.
 java.awt.print.PageFormat getReportPageFormat()
          Get the page format that should be used to process the report.
protected  javax.servlet.http.HttpSession getSession()
          Gets the current session.
protected  boolean isSessionRequired()
          Checks, whether the session should be used to store some of the generated data.
 com.jrefinery.report.JFreeReport loadReport()
          Loads the report.
abstract  void processReport()
          Processes the report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractReportServletWorker

public AbstractReportServletWorker(javax.servlet.http.HttpSession session)
Creates a new Report servlet worker for the given session.

Parameters:
session - the session.
Method Detail

loadReport

public com.jrefinery.report.JFreeReport loadReport()
                                            throws com.jrefinery.report.ReportInitialisationException
Loads the report. If a session is used, it is checked, whether a report is bound to the session (using the attribute "Report"), if no report is bound to the session or no session is used at all, the report is created using createReport.

Returns:
the loaded or created report
Throws:
com.jrefinery.report.ReportInitialisationException - if loading the report was not successfull.

getReport

public com.jrefinery.report.JFreeReport getReport()
                                           throws com.jrefinery.report.ReportInitialisationException
Load or parses the report definition. The report is fully initialized. The data model has to be assigned to the report.

Returns:
the initialized report definition.
Throws:
com.jrefinery.report.ReportInitialisationException

createReport

protected abstract com.jrefinery.report.JFreeReport createReport()
                                                          throws com.jrefinery.report.ReportInitialisationException
Parses the report and returns the fully initialized report. A data model is already assigned to the report.

Returns:
the created report.
Throws:
com.jrefinery.report.ReportInitialisationException - if the report creation failed.

isSessionRequired

protected boolean isSessionRequired()
Checks, whether the session should be used to store some of the generated data.

Returns:
true, if the session should be used to store the data, false otherwise.

getSession

protected javax.servlet.http.HttpSession getSession()
Gets the current session. The session can be null.

Returns:
the session or null, if no session is set.

getReportPageFormat

public java.awt.print.PageFormat getReportPageFormat()
                                              throws com.jrefinery.report.ReportInitialisationException
Get the page format that should be used to process the report.

Returns:
the report's page format.
Throws:
com.jrefinery.report.ReportInitialisationException - if the report could not be initialized, so that no page format could be read.

processReport

public abstract void processReport()
                            throws com.jrefinery.report.ReportProcessingException
Processes the report. How this is done, is implementation specific.

Throws:
com.jrefinery.report.ReportProcessingException - if something went wrong during the report processing.

getPropertyPrefix

protected java.lang.String getPropertyPrefix()
Returns a property prefix for the various used report properties. This can be used to host several reports on a single session.

Returns:
the property prefix, an empty string by default.