Keel 2.1RC2

org.keel.services.report
Interface ReportFactory


public interface ReportFactory

Interface (Role) for a Factory class that can generate a Report. The resulting report should be able to be stored in a file and the file name returned to the caller. This filename can then be passed to a UI in order to display the finished report. Alternately, the report can be returned as an encoded String, ready to pass on the client UI for rendering.

Author:
Michael Nash

Field Summary
static java.lang.String ROLE
           
 
Method Summary
 java.lang.String getReportEncoded(java.lang.String fileType)
          Prepare the report and return it as a base64 encoded string, suitable for serialization via JMS (or anything else) to a client, saving in a database, etc.
 java.util.Set getSupportedFileTypes()
          Return a set of strings, where each string represents the file-type extension of a type of file supported by this implementation.
 java.util.Set getSupportedOptions()
          Once the report type is set, getSupportedOptions can be called to determine what options (if any) this type of report supports with this implementation.
 void saveReport(java.lang.String fileName, java.lang.String fileType)
          Produce the report and save it as the specified file.
 void setData(ReportData theData)
          Pass the data from which the chart is produced.
 void setOption(java.lang.String optionName, java.lang.Object option)
          Set a specific report-specific or implementation-specific option.
 void setReportFormat(java.lang.String fileName)
          Specify the report format file, the file that (for this implementation) lays out what a report should look like.
 

Field Detail

ROLE

public static final java.lang.String ROLE
See Also:
Constant Field Values
Method Detail

getSupportedFileTypes

public java.util.Set getSupportedFileTypes()
Return a set of strings, where each string represents the file-type extension of a type of file supported by this implementation. A supported file-type must be specified when calling "saveReport"

Returns:
A set of strings, each one representing a possible extension for a file type.

setReportFormat

public void setReportFormat(java.lang.String fileName)
                     throws ReportException
Specify the report format file, the file that (for this implementation) lays out what a report should look like.

Parameters:
fileName - A full pathname to a report template file. The format of this file depends on the implementation.
Throws:
ReportException - If the file cannot be used for some reason or is not in the correct format for this implementation

getSupportedOptions

public java.util.Set getSupportedOptions()
Once the report type is set, getSupportedOptions can be called to determine what options (if any) this type of report supports with this implementation. setOption can then be called to specify the option values before saveChart is called. This method should be called after setReportFormat is called, as different report support different options.

Returns:
A Set of strings, where each string is the name of an option recognized by this implementation and this type of report.

setOption

public void setOption(java.lang.String optionName,
                      java.lang.Object option)
               throws ReportException
Set a specific report-specific or implementation-specific option. An implementation should *not* throw an exception if an unsupported option is requested, the option should just be ignored.

Parameters:
optionName - The name of the implementation-specific option
option - The value to set the option to
Throws:
ReportException

setData

public void setData(ReportData theData)
             throws ReportException
Pass the data from which the chart is produced. Must be called before "saveReport" is called.

Parameters:
theData - A ReportData object containing the report data to be reported on.
Throws:
ReportException

saveReport

public void saveReport(java.lang.String fileName,
                       java.lang.String fileType)
                throws ReportException
Produce the report and save it as the specified file.

Parameters:
fileName - Name of the file in which to save the report
fileType - Valid file type (supported by this implementation)
Throws:
ReportException

getReportEncoded

public java.lang.String getReportEncoded(java.lang.String fileType)
                                  throws ReportException
Prepare the report and return it as a base64 encoded string, suitable for serialization via JMS (or anything else) to a client, saving in a database, etc.

Parameters:
fileType - The type of the file encoding to be used, represented as a file extension
Returns:
A base64 encoded string containing the report
Throws:
ReportException - If the report cannot be produced or an error occurrs in the implementation.

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.