Class AsyncJasperPrintAccessor
- java.lang.Object
-
- net.sf.jasperreports.web.servlets.AsyncJasperPrintAccessor
-
- All Implemented Interfaces:
AsynchronousFilllListener,FillListener,JasperPrintAccessor
public class AsyncJasperPrintAccessor extends Object implements JasperPrintAccessor, AsynchronousFilllListener, FillListener
Generated report accessor used for asynchronous report executions that publishes pages before the entire report has been generated.- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_ASYNC_REPORT_GENERATION_ERRORstatic StringEXCEPTION_MESSAGE_KEY_LOCK_ATTEMPT_INTERRUPTEDstatic StringEXCEPTION_MESSAGE_KEY_NO_JASPERPRINT_GENERATEDstatic StringEXCEPTION_MESSAGE_KEY_REPORT_GENERATION_CANCELLED-
Fields inherited from interface net.sf.jasperreports.web.servlets.JasperPrintAccessor
REPORT_CONTEXT_PARAMETER_JASPER_PRINT_ACCESSOR
-
-
Constructor Summary
Constructors Constructor Description AsyncJasperPrintAccessor(FillHandle fillHandle)Create a report accessor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JasperPrintgetFinalJasperPrint()Returns the generated report, ensuring before that the report generation has ended.JasperPrintgetJasperPrint()Returns the generated report.ReportExecutionStatusgetReportStatus()Returns the status of the report execution.protected voidlock()voidpageGenerated(JasperPrint jasperPrint, int pageIndex)Called when a report page has been generated.ReportPageStatuspageStatus(int pageIdx, Long pageTimestamp)Ensures that a page is available in the generated report.voidpageUpdated(JasperPrint jasperPrint, int pageIndex)Called when a previously generated page has been updated, usually by evaluating a delayed element.voidreportCancelled()Called when the report is cancelled.voidreportFillError(Throwable t)Called when the filling process exits in error.voidreportFinished(JasperPrint jasperPrint)Called when the report filling is done.protected voidunlock()booleanwaitForFinalJasperPrint(int milliseconds)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_LOCK_ATTEMPT_INTERRUPTED
public static final String EXCEPTION_MESSAGE_KEY_LOCK_ATTEMPT_INTERRUPTED
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_NO_JASPERPRINT_GENERATED
public static final String EXCEPTION_MESSAGE_KEY_NO_JASPERPRINT_GENERATED
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_CANCELLED
public static final String EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_CANCELLED
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_ASYNC_REPORT_GENERATION_ERROR
public static final String EXCEPTION_MESSAGE_KEY_ASYNC_REPORT_GENERATION_ERROR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AsyncJasperPrintAccessor
public AsyncJasperPrintAccessor(FillHandle fillHandle)
Create a report accessor.- Parameters:
fillHandle- the asynchronous fill handle used by this accessor
-
-
Method Detail
-
lock
protected void lock()
-
unlock
protected void unlock()
-
pageStatus
public ReportPageStatus pageStatus(int pageIdx, Long pageTimestamp)
Description copied from interface:JasperPrintAccessorEnsures that a page is available in the generated report.- Specified by:
pageStatusin interfaceJasperPrintAccessor- Parameters:
pageIdx- the page index- Returns:
- the status of the requested page
-
getJasperPrint
public JasperPrint getJasperPrint()
Description copied from interface:JasperPrintAccessorReturns the generated report.- Specified by:
getJasperPrintin interfaceJasperPrintAccessor- Returns:
- the generated report
-
waitForFinalJasperPrint
public boolean waitForFinalJasperPrint(int milliseconds)
-
getFinalJasperPrint
public JasperPrint getFinalJasperPrint()
Description copied from interface:JasperPrintAccessorReturns the generated report, ensuring before that the report generation has ended.- Specified by:
getFinalJasperPrintin interfaceJasperPrintAccessor- Returns:
- the final generated report
-
reportFinished
public void reportFinished(JasperPrint jasperPrint)
Description copied from interface:AsynchronousFilllListenerCalled when the report filling is done.- Specified by:
reportFinishedin interfaceAsynchronousFilllListener- Parameters:
jasperPrint- the filled report
-
reportCancelled
public void reportCancelled()
Description copied from interface:AsynchronousFilllListenerCalled when the report is cancelled.- Specified by:
reportCancelledin interfaceAsynchronousFilllListener
-
reportFillError
public void reportFillError(Throwable t)
Description copied from interface:AsynchronousFilllListenerCalled when the filling process exits in error.- Specified by:
reportFillErrorin interfaceAsynchronousFilllListener- Parameters:
t- the exception
-
pageGenerated
public void pageGenerated(JasperPrint jasperPrint, int pageIndex)
Description copied from interface:FillListenerCalled when a report page has been generated. The page might not be final due to delayed evaluation elements.- Specified by:
pageGeneratedin interfaceFillListener- Parameters:
jasperPrint- the report that is currently generatingpageIndex- the index of the page that has been generated
-
pageUpdated
public void pageUpdated(JasperPrint jasperPrint, int pageIndex)
Description copied from interface:FillListenerCalled when a previously generated page has been updated, usually by evaluating a delayed element.- Specified by:
pageUpdatedin interfaceFillListener- Parameters:
jasperPrint- the report that is currently generatingpageIndex- the index of the page that has been updated
-
getReportStatus
public ReportExecutionStatus getReportStatus()
Description copied from interface:JasperPrintAccessorReturns the status of the report execution.- Specified by:
getReportStatusin interfaceJasperPrintAccessor- Returns:
- the status of the report execution
-
-