Style Intelligence v12.0

inetsoft.report.io
Class Builder

java.lang.Object
  extended by inetsoft.report.io.Builder

public class Builder
extends Object

Builder is used to export a report to a file or import a report from a file. A Builder can be created by calling one of the getBuilder() method. To export a report, call the write() method. To import a report, call the read() method.


Field Summary
static int BURST_REPORT
          This format is for saving a bursting file into archive.
static int CSV
          Comma separated report tables.
static int EXCEL
          Excel output match layout.
static int EXCEL_DATA
          Excel output for data editing.
static int EXCEL_SHEET
          Excel output with no pagination.
static int GENERATED_REPORT
          Generated report output.
static int HTML
          HTML output.
static int HTML_BUNDLE
          HTML_BUNDLE output, in which all the images in the HTML are exported into a ZIP file together with the html page.
static int HTML_BUNDLE_NO_PAGINATION
          Bundled HTML output without pagination.
static int HTML_NO_PAGINATION
          HTML output without pagination.
static int HTML_NO_PAGINATION_EMAIL
          Non-Paginated HTML for Inline Email
static int PDF
          Portable Document Format (PDF) output.
static int POSTSCRIPT
          Postscript output.
static int POWERPOINT
          Powerpoint output.
static int REPORT
          Report XML format.
static int RTF
          Rich Text Format (RTF) output.
static int RTF_LAYOUT
          Rich Text Format (RTF) output.
static int SVG
          SVG output.
static int TEMPLATE
          Report template format.
static int TEXT
          Pure text output.
static int USER_DEFINED
          All user defined export types must be identified with an ID of this value (5000) or greater.
static int XML
          XML output.
 
Constructor Summary
Builder(Formatter format)
          Create a builder with a formatter.
Builder(Parser parser)
          Create a builder with a parser.
 
Method Summary
static URL getBaseURL()
          Get the base url.
static Builder getBuilder(int type, InputStream input0)
          Get a builder object for importing a report.
static Builder getBuilder(int type, InputStream input0, String sourceName)
          Get a builder object for importing a report.
static Builder getBuilder(int type, OutputStream output)
          Get a builder object.
static Builder getBuilder(int type, OutputStream output, Object data)
          Get a builder object for exporting a report.
static Vector getEmbeddedStyles()
          Get the embedded style styles in the report.
static ExportType getExportType(int type)
          Gets the export type descriptor for the specified format type ID.
static String getFileExtension(int fmt)
          Get the default file extension for an export format.
static String getFormatOption(int type)
          Get format option string.
static String getFormatString(int type)
          Get format string.
 Formatter getFormatter()
          Get the formatter created in the builder.
 Generator getGenerator()
          Get the generator created in the builder.
 Parser getParser()
          Get the parser created in the builder.
static int[] getSupportedExportTypes()
          Gets the IDs of the export formats that are supported.
static int getType(String typename)
          Get the format type from a string.
 void initCache(inetsoft.report.internal.paging.ReportCache cache, Object repId)
          Set report cache for generator.
static boolean isBuildRegistry()
          Check if current thread parse report to build registry.
 boolean isCurrentVersion()
          Check current template and report file (*.srt) is current version.
 ReportSheet read()
          Import a report from input stream.
 ReportSheet read(String dir)
          Import a report.
static Enumeration readPages(InputStream input)
          Read the StylePage objects from a file saved with savePages.
static Enumeration readPages(InputStream input, ReportSheet report)
          Read the StylePage objects from a file saved with savePages.
static ReportSheet readReport(InputStream input)
          Read a file saved using saveTemplate and restore the data.
static ReportSheet readReport(InputStream input, boolean initData, Object controller)
          Read a file saved using saveTemplate and restore the data.
static void savePages(Enumeration pages, OutputStream out)
          Write a set of StylePage objects to a file.
static void saveReport(ReportSheet report, OutputStream output)
          Write a report as a template with embedded data.
static void setBaseURL(URL url)
          Set the base URL for using relative URLs.
static void setBuildRegistry(Boolean meta)
          Set current thread parse report to build registry.
static void setEmbeddedStyles(Vector styles)
          Set the embedded styles.
 void write(ReportSheet sheet)
          Export a report.
 void write(ReportSheet sheet, Enumeration pages)
          Export a report.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final int TEMPLATE
Report template format. This is the format created by the Style Report Designer. It could be a simple report skeleton, or a template with embedded queries, scripts.

See Also:
Constant Field Values

REPORT

public static final int REPORT
Report XML format. The report format always captures the entire report. If a report is created from a template, the report format saves the actual report data instead of meta data.

See Also:
Constant Field Values

CSV

public static final int CSV
Comma separated report tables. Only tables are exported. All other report elements are ignored. The output is intended to be loaded into table based (spreadsheet ...) for further manipulation.

See Also:
Constant Field Values

RTF

public static final int RTF
Rich Text Format (RTF) output. The RTF output contains all data in the report. The output generated using this parameter may has more differences in appearance comparing to using RTF_LAYOUT.

See Also:
Constant Field Values

RTF_LAYOUT

public static final int RTF_LAYOUT
Rich Text Format (RTF) output. The RTF output contains all data in the report. It is formatted as close to the report as possible. Howver, since the RTF does not support as many formatting options as the Style Report, the RTF file may not look exactly identical in a RTF viewer (e.g. Word ...) as the actual report.

See Also:
Constant Field Values

HTML

public static final int HTML
HTML output. The HTML format does not accomodate all the formatting in the report. It's possible the HTML will be rendered slightly different from the report that it's generated from. The directory of the output file should be supplied to the getBuilder as the data parameter (3rd parameter).

See Also:
Constant Field Values

HTML_BUNDLE

public static final int HTML_BUNDLE
HTML_BUNDLE output, in which all the images in the HTML are exported into a ZIP file together with the html page. The HTML format does not accommodate all the formatting in the report. It's possible the HTML will be rendered slightly different from the report that it's generated from. The directory of the output file should be supplied to the getBuilder as the data parameter (3rd parameter).

See Also:
Constant Field Values

SVG

public static final int SVG
SVG output. The SVG output captures the exact rendering of report pages in the standard XML based SVG format.

See Also:
Constant Field Values

PDF

public static final int PDF
Portable Document Format (PDF) output. The PDF output contains all data in the report. It is generated using PDFGenerator which supports the generation of a Table of Contents in PDF.

See Also:
Constant Field Values

HTML_NO_PAGINATION

public static final int HTML_NO_PAGINATION
HTML output without pagination.

See Also:
Constant Field Values

TEXT

public static final int TEXT
Pure text output.

See Also:
Constant Field Values

HTML_BUNDLE_NO_PAGINATION

public static final int HTML_BUNDLE_NO_PAGINATION
Bundled HTML output without pagination.

See Also:
Constant Field Values

POWERPOINT

public static final int POWERPOINT
Powerpoint output.

See Also:
Constant Field Values

POSTSCRIPT

public static final int POSTSCRIPT
Postscript output.

See Also:
Constant Field Values

XML

public static final int XML
XML output.

See Also:
Constant Field Values

HTML_NO_PAGINATION_EMAIL

public static final int HTML_NO_PAGINATION_EMAIL
Non-Paginated HTML for Inline Email

See Also:
Constant Field Values

GENERATED_REPORT

public static final int GENERATED_REPORT
Generated report output. This format is only supported for saving a report into a server report archive.

See Also:
Constant Field Values

EXCEL

public static final int EXCEL
Excel output match layout.

See Also:
Constant Field Values

EXCEL_SHEET

public static final int EXCEL_SHEET
Excel output with no pagination.

See Also:
Constant Field Values

EXCEL_DATA

public static final int EXCEL_DATA
Excel output for data editing.

See Also:
Constant Field Values

BURST_REPORT

public static final int BURST_REPORT
This format is for saving a bursting file into archive. It is only supported on the server side.

See Also:
Constant Field Values

USER_DEFINED

public static final int USER_DEFINED
All user defined export types must be identified with an ID of this value (5000) or greater.

See Also:
Constant Field Values
Constructor Detail

Builder

public Builder(Formatter format)
Create a builder with a formatter. The formatter is used to export the report contents.

Parameters:
format - formatter.

Builder

public Builder(Parser parser)
Create a builder with a parser. The parser is used to parse the report external format.

Parameters:
parser - report parser.
Method Detail

getBuilder

public static Builder getBuilder(int type,
                                 OutputStream output)
Get a builder object.

Parameters:
type - builder type.
output - output stream.

getBuilder

public static Builder getBuilder(int type,
                                 OutputStream output,
                                 Object data)
Get a builder object for exporting a report.

Parameters:
type - builder type.
output - output stream.
data - builder data specific to the type of the output.

getBuilder

public static Builder getBuilder(int type,
                                 InputStream input0)
Get a builder object for importing a report. Only TEMPLATE and REPORT formats are supported.

Parameters:
type - builder type.
input0 - input stream.

getBuilder

public static Builder getBuilder(int type,
                                 InputStream input0,
                                 String sourceName)
Get a builder object for importing a report. Only TEMPLATE and REPORT formats are supported.

Parameters:
type - builder type.
input0 - input stream.

getFileExtension

public static String getFileExtension(int fmt)
Get the default file extension for an export format.


saveReport

public static void saveReport(ReportSheet report,
                              OutputStream output)
                       throws IOException
Write a report as a template with embedded data. This method can be called to save a copy of a report that can be later use to re-construct the report output by running it as a template. When the template is saved, the data bound to the elements is saved in the template. Query binding information is ignored. Therefore, the template can be loaded back and used to create a complete report without the need to access the datasource.

This method can be called with a file object, which is used to store the template. The file should have a suffix of .sro. If the file parameter is ignored, the template is saved in a file in the directory specified by report.snapshot.directory property, which defaults to the current directory. The name of the file is constructed dynamically.

Throws:
IOException

readReport

public static ReportSheet readReport(InputStream input)
                              throws IOException
Read a file saved using saveTemplate and restore the data.

Throws:
IOException

readReport

public static ReportSheet readReport(InputStream input,
                                     boolean initData,
                                     Object controller)
                              throws IOException
Read a file saved using saveTemplate and restore the data.

Throws:
IOException

savePages

public static void savePages(Enumeration pages,
                             OutputStream out)
                      throws IOException
Write a set of StylePage objects to a file.

Throws:
IOException

readPages

public static Enumeration readPages(InputStream input)
                             throws IOException,
                                    ClassNotFoundException
Read the StylePage objects from a file saved with savePages. The InputStream is closed in the enumeration when the pages are exhausted. Don't close the input stream in the caller.

Throws:
IOException
ClassNotFoundException

readPages

public static Enumeration readPages(InputStream input,
                                    ReportSheet report)
                             throws IOException,
                                    ClassNotFoundException
Read the StylePage objects from a file saved with savePages. The InputStream is closed in the enumeration when the pages are exhausted. Don't close the input stream in the caller.

Throws:
IOException
ClassNotFoundException

getType

public static int getType(String typename)
Get the format type from a string. The string can be the file extension or the name of the type.


setBaseURL

public static void setBaseURL(URL url)
Set the base URL for using relative URLs. This is only used in relative URL's in image template elements for now.

Parameters:
url - base url.

getBaseURL

public static URL getBaseURL()
Get the base url.


getFormatter

public Formatter getFormatter()
Get the formatter created in the builder. If the builder is created for input, the formatter is null.


getParser

public Parser getParser()
Get the parser created in the builder. If the builder is created for output, the parser is null.


isCurrentVersion

public boolean isCurrentVersion()
Check current template and report file (*.srt) is current version.


getGenerator

public Generator getGenerator()
Get the generator created in the builder. If the builder is created for input, the generator is null.


write

public void write(ReportSheet sheet)
           throws IOException
Export a report.

Parameters:
sheet - report to export.
Throws:
IOException

write

public void write(ReportSheet sheet,
                  Enumeration pages)
           throws IOException
Export a report. If the format can be exported from generated pages, the pages are used. If the pages is null, the report is reprocessed if necessary.

Parameters:
sheet - report to export.
Throws:
IOException

read

public ReportSheet read()
                 throws IOException
Import a report from input stream.

Returns:
imported report.
Throws:
IOException

read

public ReportSheet read(String dir)
                 throws IOException
Import a report. The directory parameter is used if the report contains information with relative path. The directory serves as the current directory for the relative path. It could be null if it's not available, in this case the parser will use the current directory of the program if it has permission to get it.

Parameters:
dir - directory the report is imported from.
Returns:
imported report.
Throws:
IOException

setEmbeddedStyles

public static void setEmbeddedStyles(Vector styles)
Set the embedded styles. This should be called before the export() is performed. The specified styles will be embedded in the report.

Parameters:
styles - vector of XTableStyle.

getEmbeddedStyles

public static Vector getEmbeddedStyles()
Get the embedded style styles in the report. This should be called after import to get a list of embedded table styles.

Returns:
vector of XTableStyle.

getFormatOption

public static String getFormatOption(int type)
Get format option string.

Parameters:
type - format type.

getFormatString

public static String getFormatString(int type)
Get format string.

Parameters:
type - format type.

getExportType

public static ExportType getExportType(int type)
Gets the export type descriptor for the specified format type ID.

Parameters:
type - the format type ID.
Returns:
the descriptor for the specified type or null if the format type for the specified ID is undefined.

getSupportedExportTypes

public static int[] getSupportedExportTypes()
Gets the IDs of the export formats that are supported.

Returns:
an array of integers that are the IDs of each supported format.

setBuildRegistry

public static void setBuildRegistry(Boolean meta)
Set current thread parse report to build registry.


isBuildRegistry

public static boolean isBuildRegistry()
Check if current thread parse report to build registry.


initCache

public void initCache(inetsoft.report.internal.paging.ReportCache cache,
                      Object repId)
Set report cache for generator.


Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.