com.ibm.as400.util.reportwriter.processor
Class ReportProcessor

java.lang.Object
  |
  +--com.ibm.as400.util.reportwriter.processor.ReportProcessor
Direct Known Subclasses:
XSLReportProcessor

public abstract class ReportProcessor
extends java.lang.Object
implements java.io.Serializable

The ReportProcessor class is the superclass for all ReportProcessors. The methods of this class are used to set various attributes associated with a report processing job.

See Also:
Serialized Form

Field Summary
static int ALL
          Constant for specifying all pages of the report should be processed.
protected  com.ibm.as400.util.reportwriter.processor.Context context_
           
static int RANGE
          Constant for specifying page ranges of the report should be processed.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a vetoable change listener.
 void cancel()
          Cancels a report processor job that is in progress.
 int getCopies()
          Returns the number of copies the report processor should generate.
 java.awt.print.PageFormat getPageFormat()
          Returns the size and orientation of each page of the report.
 int[][] getPageRanges()
          Returns, for jobs using these attributes, the ranges of pages to be processed, if possible.
 int getPageSelection()
          Returns whether the report processor should process all pages or the range of pages specified by the return value of getPageRanges().
 java.lang.String getReportName()
          Returns the name of the report to be processed.
 boolean isCancelled()
          Returns true if a report processor job is in progress, but is going to be cancelled at the next opportunity; otherwise, returns false.
abstract  void processReport()
          Starts a report processing job.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes a vetoable change listener.
 void setContext(com.ibm.as400.util.reportwriter.processor.Context context)
          Sets the OutputGenerator to be used to generate pages of the report.
 void setCopies(int copies)
          Specifies the number of copies the report processor should generate.
 void setPageFormat(java.awt.print.PageFormat pageFormat)
          Specifies the size and orientation of each page of the report.
 void setPageRanges(int[][] pageRanges)
          Specifies, for jobs using these attributes, the ranges of pages to be processed, if possible.
 void setPageSelection(int selection)
          Specifies whether the report processor should process all pages or the range of pages specified by the return value of getPageRanges().
 void setReportName(java.lang.String reportName)
          Sets the name of the report to be processed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL

public static final int ALL
Constant for specifying all pages of the report should be processed.

RANGE

public static final int RANGE
Constant for specifying page ranges of the report should be processed.

context_

protected com.ibm.as400.util.reportwriter.processor.Context context_
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener.
Parameters:
listener - The property change listener to add.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a vetoable change listener.
Parameters:
listener - The vetoable change listener to add.

cancel

public void cancel()
Cancels a report processor job that is in progress. If processReport() has been called but has not returned, this method signals that the report processor job should be cancelled at the next available opportunity. If there is no job in progress, then this call does nothing.

getCopies

public int getCopies()
Returns the number of copies the report processor should generate.
Returns:
the number of copies.

getPageFormat

public java.awt.print.PageFormat getPageFormat()
Returns the size and orientation of each page of the report.
Returns:
the page format.

getPageRanges

public int[][] getPageRanges()
Returns, for jobs using these attributes, the ranges of pages to be processed, if possible. All range numbers are inclusive. An application should ignore this attribute on output unless the return value of the getSelection() method is ReportProcessorJobAttributes.RANGE.
Returns:
an array of integer arrays of 2 elements. An array is interpreted as a range spanning all pages including and between the specified pages. Ranges MUST be in ascending order and MUST NOT overlap. Specified page numbers cannot be less than 1. For example: new int[][]{ new int[]{1,3}, new int[]{5,5}, new int[]{15,19}}) specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19.

getPageSelection

public int getPageSelection()
Returns whether the report processor should process all pages or the range of pages specified by the return value of getPageRanges().
Returns:
the selection to process.

getReportName

public java.lang.String getReportName()
Returns the name of the report to be processed.
Returns:
the name of the report to be processed.

isCancelled

public boolean isCancelled()
Returns true if a report processor job is in progress, but is going to be cancelled at the next opportunity; otherwise, returns false.
Returns:
true if the report processor job in progress is going to be cancelled; false otherwise.

processReport

public abstract void processReport()
                            throws java.io.IOException,
                                   org.xml.sax.SAXException
Starts a report processing job. Subclasses implementing this method are responsible for periodically polling this class using isCancelled() to determine if processing should continue.
Throws:
java.io.IOException - Thrown if an error occurs retrieving the data.
XSLProcessorException - Thrown if an error occurs parsing/processing the data.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener.
Parameters:
listener - The property change listener to remove.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a vetoable change listener.
Parameters:
listener - The vetoable change listener to remove.

setCopies

public void setCopies(int copies)
Specifies the number of copies the report processor should generate. Not specifying this attribute is equivalent to specifying 1 (the default number of copies).
Parameters:
copies - an integer greater than 0 representing number of copies.
Throws:
java.lang.IllegalArgumentException - Thrown if copies is less than or equal to 0.

setContext

public void setContext(com.ibm.as400.util.reportwriter.processor.Context context)
Sets the OutputGenerator to be used to generate pages of the report. The OutputGenerator specifies the output data stream format, as well as the output destination for the processed report. A1C

setPageFormat

public void setPageFormat(java.awt.print.PageFormat pageFormat)
Specifies the size and orientation of each page of the report.
Parameters:
pageFormat - the page format.

setPageRanges

public void setPageRanges(int[][] pageRanges)
Specifies, for jobs using these attributes, the ranges of pages to be processed, if possible. All range numbers are inclusive. If this attribute is not specified, then the values returned from getFromPage() and getToPage() are used. If pageRanges is specified and either (or both) of fromPage and toPage are specified, pageRanges takes precedence.
Parameters:
pageRanges - an array of integer arrays of 2 elements. An array is interpreted as a range spanning all pages including and between the specified pages. Ranges MUST be in ascending order and MUST NOT overlap. Specified page numbers cannot be less than 1. For example: new int[][]{ new int[]{1,3}, new int[]{5,5}, new int[]{15,19}}) specifies pages 1, 2, 3, 5, 15, 16, 17, 18, and 19.
Throws:
Thrown - if one or more of the above conditions is violated.

setPageSelection

public void setPageSelection(int selection)
Specifies whether the report processor should process all pages or the range of pages specified by the return value of getPageRanges(). Not specifying this attribute is equivalent to specifying ReportProcessorJobAttributes.ALL
Parameters:
selection - the selection to process.
May be any of the following values:
  • ReportProcessorJobAttributes.ALL - process all pages
  • ReportProcessorJobAttributes.RANGE - process ranges of pages
Throws:
java.lang.IllegalArgumentException - Thrown if selection is not valid.

setReportName

public void setReportName(java.lang.String reportName)
Sets the name of the report to be processed. The report name cannot be null.
Parameters:
reportName - the name of the report to be processed.