|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.inet.report.Engine
public class Engine
This is the i-net Clear Reports report engine.
Its purpose is to transform a report template and its associated data. The
result can either be binary data to be viewed/printed by the Java viewer
bean or it can be exported into a lot of export formats, like: HTML, PDF, PS, RTF, XLS, XML, ....
You can find a complete list of supported output formats in the documentation
(click here to read it online).
The engine reads the report file and creates an array of output data that can be used by the client
(java viewer or CSV, HTML, PDF, RTF, XLS, XML, PS viewer, ...).
The output data can be created by executing the following steps:
engine = new Engine().engine = new Engine(Engine.EXPORT_PDF).engine.setReportFile("file:c:/report1.rpt") on windows or
engine.setReportFile("/usr/share/clearreports/report1.rpt") on unix.
DatabaseTables dbTables = engine.getDatabaseTables();
Datasource ds = dbTables.getDatasource(0);
ds.setDataSourceConfigurationName("Oracle_DataSourceConfiguration");
Also, you could change the selection formula and examine or change other parts of the report template using RDC if you wish.
engine.setData()) into the target format (PDF, RTF, HTML, binary, ...).engine.getPageData(int) which returns the requested report page.engine.setReportFile() nor
all other set or get methods other then the getPage*() methods on an executed report.checkProperties(Engine e, Properties p) callback of the ReportServlet or
the ReportSocket. The callback will always be invoked when the viewer requests data from you.http://localhost:9000/?report=file:c:/report1.rpt&datasource=Oracle_DataSourceConfiguration
then the ReportSocket will automatically invoke the above code sequence.
However, you can use one of the checkProperties() callbacks to change the
parameters before the above set methods are called (for example if you want to set or change the password).
If you want to use RDC, you can use the checkProperties(Engine e, Properties p)
callback to examine and change the fields of the engine before the engine will execute the report.
| Field Summary | |
|---|---|
static java.lang.String |
AREA_TYPE_DETAIL
Constant for getArea(String): Detail Area |
static java.lang.String |
AREA_TYPE_GROUP_FOOTER_PREFIX
Constant for getArea(String): Group Footer Prefix: To access a Group Footer, use
this prefix in front of the 1-based group index you wish to access. |
static java.lang.String |
AREA_TYPE_GROUP_HEADER_PREFIX
Constant for getArea(String): Group Header Prefix: To access a Group Header, use
this prefix in front of the 1-based group index you wish to access. |
static java.lang.String |
AREA_TYPE_PAGE_FOOTER
Constant for getArea(String): Page Footer |
static java.lang.String |
AREA_TYPE_PAGE_HEADER
Constant for getArea(String): Page Header |
static java.lang.String |
AREA_TYPE_REPORT_FOOTER
Constant for getArea(String): Report Footer |
static java.lang.String |
AREA_TYPE_REPORT_HEADER
Constant for getArea(String): Report Header |
static int |
DETAILS
The constant for the index number of the details area. |
static java.lang.String |
EXPORT_BMP
Engine creates BMP output. |
static java.lang.String |
EXPORT_CSV
Engine creates CSV output. |
static java.lang.String |
EXPORT_DATA
Engine creates data output. |
static java.lang.String |
EXPORT_GIF
Engine creates GIF output. |
static java.lang.String |
EXPORT_HTML
Engine creates HTML output. |
static java.lang.String |
EXPORT_JPG
Engine creates JPG output. |
static java.lang.String |
EXPORT_PDF
Engine creates PDF output. |
static java.lang.String |
EXPORT_PNG
Engine creates PNG output. |
static java.lang.String |
EXPORT_PS
Engine creates postscript output. |
static java.lang.String |
EXPORT_PS2
Engine creates postscript 2 output. |
static java.lang.String |
EXPORT_PS3
Engine creates postscript 3 output. |
static java.lang.String |
EXPORT_RTF
Engine creates RTF output. |
static java.lang.String |
EXPORT_SVG
Engine creates SVG output. |
static java.lang.String |
EXPORT_TXT
Engine creates plain text output. |
static java.lang.String |
EXPORT_XLS
Engine creates XLS output. |
static java.lang.String |
EXPORT_XML
Engine creates XML output. |
static int |
LOG_DEBUG
Useful if you want to send bug reports to the i-net Clear Reports support at ClearReports@inetsoftware.de |
static int |
LOG_ERROR
Log include error messages such as "report file could not be read, rendering aborted". |
static int |
LOG_INFO
Log include information messages such as the JDBC driver that i-net Clear Reports uses. |
static int |
LOG_STATUS
Log nothing except a status line for each rendered report. |
static int |
LOG_WARN
Log include warning messages such as "font not found, using a replacement font" |
static java.lang.String |
NO_EXPORT
No export, use java viewer. |
static int |
PAGE_FOOTER
The constant for the index number of the report header area. |
static int |
PAGE_HEADER
The constant for the index number of the page header area. |
static int |
REPORT_FOOTER
The constant for the index number of the report footer area. |
static int |
REPORT_HEADER
The constant for the index number of the report header area. |
| Constructor Summary | |
|---|---|
Engine()
Constructor creates an Engine for the binary data used by the Java report viewer. |
|
Engine(java.lang.String export_fmt)
Constructor creates an Engine for different file output formats. |
|
| Method Summary | |
|---|---|
void |
addClippingListener(ClippingListener listener)
Registers a clipping listener with the engine - any time an element is clipped while rendering, this listener's method "clippingOnElement" is called |
void |
addFinishListener(EngineFinishListener listener)
Add a EngineFinishListener to this engine. |
Group |
addGroup(Field groupField)
Adds a newly created grouping into the grouping set and returns it. |
void |
execute()
Executes the report and stores the result data in an internal cache. |
Area |
getArea(int idx)
Returns an AreaElement of the Area set. |
Area |
getArea(java.lang.String item)
Returns an area element of the set of areas. |
int |
getAreaCount()
Returns the number of Areas of the report. |
int |
getCacheSize()
This function returns the current cache size. |
static java.lang.String |
getCreator()
Returns the creator string that i-net Clear Reports writes into the exported files. |
DatabaseTables |
getDatabaseTables()
Returns the DatabaseTables object for this report. |
java.lang.String |
getDefaultSql()
Deprecated. As of i-net Crystal-Clear 10.0, use getDefaultSqlOfAllStatements(boolean) |
java.lang.String[] |
getDefaultSqlOfAllStatements(boolean leavePrompts)
Returns the statements that will be send to the database. |
int |
getDocumentPageCount()
Returns the number of pages in the finally document, e.g. |
static java.util.List |
getEmbeddableFontNames()
Returns true type font names for all fonts from fontPath (set in the i-net Clear Reports configuration) that are licensed for embedding. |
java.lang.String |
getErrorMsg()
Returns the error message as string. |
Fields |
getFields()
Returns a new Fields Object. |
byte[] |
getFontData(int fontID)
Returns the byte array of the embedded font at the specified fontId, encoded in the Viewer's protocol. |
java.lang.String |
getGF()
Returns the group selection formula used in the current main or subreport. |
FormulaField |
getGFField()
Returns the group selection formula used in the current main or subreport as a field. |
Group |
getGroup(int grNum)
Returns the grouping with the specified number, where number is greater than 1 or
lesser than count of groupings. |
Group |
getGroupByField(Field field)
Returns the group which is based on the parameter field if exists -
otherwise null is returned. |
int |
getGroupCount()
Returns the count of groupings in report without the count of page, report and detail area pairs. |
byte[] |
getGroupTree()
Returns the group tree which can be sent to the java viewer as a byte array. |
java.lang.Exception[] |
getLoadExceptions()
If one or more errors occurred while loading a report template, you can get this error(s) as Exception[] from engine. |
java.util.Locale |
getLocale()
Returns the locale that is used by the renderer. |
static int |
getLogLevel()
Returns the logging/tracing level that is used by the Engine. |
static java.io.PrintStream |
getLogStream()
Returns the logging/tracing PrintStream that is used by the Engine. |
static int |
getMajorVersion()
Returns the Engine's major version number. |
java.util.Properties |
getMetaProperties()
Returns any meta properties belonging to this engine. |
static int |
getMinorVersion()
Returns the Engine's minor version number. |
com.inet.report.RDC.MsgListener |
getMsgListener()
Returns the MsgListener for RDC. |
int |
getNumeralLanguage()
Returns the language of numerals for numbers, date, time and datetime values. |
int |
getPageCount()
Returns the number of pages (Java Viewer) or chunks (byte arrays in that the report will be streamed to the client) of the report. |
byte[] |
getPageData(int page)
Returns the data of a single report page. |
Engine |
getParent()
Returns the parent Engine for the current subreport or null if the current engine is the engine for the main report. |
java.util.Date |
getPrintDate()
Returns the print date for this report. |
java.lang.Object |
getPrompt(int i)
Returns the current value for a parameter field in the report. |
java.util.Vector |
getPrompts()
Returns the current values for parameter fields in the report. |
java.lang.String |
getQueryFile()
Returns the name of the query file that was specified at design time, in the report url or with the method setQueryFile. |
int |
getRecordCount()
Returns count of records this report has read from database. |
java.net.URL |
getReportFile()
Returns the url of the report template file. |
int |
getReportID()
Returns the identifier of this report element. |
ReportProperties |
getReportProperties()
Returns the reports global properties. |
java.lang.String |
getReportTitle()
Returns the title of the report specified either in the "Summary Info" dialog of the report designer or with the method setReportTitle. |
java.lang.String |
getSF()
Returns the record selection formula used in the current main or subreport. |
FormulaField |
getSFField()
Returns the record selection formula used in the current main or subreport as a formula field. |
java.util.Vector |
getSections()
Returns a vector containing all sections the report consists of. |
java.lang.String |
getSproc(int i)
Deprecated. As of i-net Crystal-Clear 10.1, use TableSource.getInputParameters() |
java.util.Vector |
getSprocs()
Deprecated. As of i-net Crystal-Clear 10.1, use TableSource.getInputParameters() |
EngineStatus |
getStatus()
Returns an EngineStatus object including information about the status of this Engine . |
Engine |
getSubReport(int idx)
Every engine object of a main report may have several subreport engines. |
int |
getSubReportCount()
Returns the number of sub-reports. |
Subreport |
getSubReportElement()
Returns the subreport element of the main report. |
SummaryInfo |
getSummaryInfo()
Returns the SummaryInfo class with that you can get/set the report summary info specified in the "Summary Info" of the Reports Designer or with the setXXX methods in the class SummaryInfo. |
long |
getTime()
Returns the timestamp that was set with setTime. |
Translations |
getTranslations()
Get the Translations of the report. |
Trigger |
getTrigger()
Request the Trigger object of this Engine. |
java.util.Hashtable |
getUserData()
Returns the user data that has been set with setUserData(Hashtable). |
java.util.Properties |
getUserProperties()
Returns the user data that has been set either with setUserProperties(), checkProperties() or in the report URL. |
FormulaField[] |
getVariableReferences(java.lang.String varName)
Returns an array of all FormulaFields referencing the variable with the name varName - this array is empty if there is no such FormulaField referencing the variable. |
static java.lang.String |
getVersion()
Returns the release version of this i-net Clear Reports installation, e.g. "8.1.24" |
boolean |
isPageLimitExceeded()
Check if the rendering of the report ran into a page limit. |
boolean |
isSubEngine()
Returns whether this engine is an engine of a subreport ( true) or not (false). |
boolean |
isXml()
Deprecated. As of i-net Clear Reports, use ReportProperties.isCCFormat(). |
void |
moveGroup(int source,
int dest)
Moves the group with group number source to target. |
void |
removeClippingListener(ClippingListener listener)
Unregisters a clipping listener with the engine. |
void |
removeFinishListener(EngineFinishListener listener)
Remove a EngineFinishListener that was added with addFinishListener. |
void |
removeGroup(Group group)
Removes the given group object from engine. |
void |
removeGroup(int grNum)
Remove the group specified with parameter grNum. |
void |
setCatalog(java.lang.String catalog)
Sets the database name that will be used at runtime instead of the database name that was specified at design time in the report template. |
void |
setClientLocale(java.util.Locale locale)
This method do the same as the method setLocale(Locale) except that the country from the locale of the server is used for the currency format. |
void |
setConnection(java.sql.Connection con)
Sets the connection object to the engine of the main- or subreport. |
void |
setConnectionCloseOnFinishing(boolean closeConnectionOnFinishing)
Sets if the set connection should be closed or not be closed after the report executing has been finished. |
static void |
setCreator(java.lang.String creator)
Sets the creator string that is visible in the exported files. |
void |
setData(java.lang.String[] columns,
java.lang.Object[][] data,
boolean longColumnNames)
Sets the report data with external data without the use of a JDBC driver. |
void |
setData(java.util.Vector columns,
java.util.Vector data,
boolean longColumnNames)
This method is used from the J2EE CAS Bridge in ASP scripts. |
void |
setData(java.lang.String[] columns,
java.lang.Object[][] data)
Sets the report data with external data without the use of a JDBC driver. |
void |
setData(java.sql.ResultSet resultSet)
Sets the report data with an ResultSet. |
void |
setDataSourceConfigurationName(java.lang.String datasourceName)
Sets the name of datasource configuration. |
void |
setErrorMsg(java.lang.String msg)
Sets an error message. |
void |
setGF(java.lang.String gf)
Specifies a group selection formula. |
void |
setLocale(java.util.Locale locale)
Sets the locale, which will be used for language independent reports. |
static void |
setLogLevel(int level)
Sets the logging/tracing level that is used by the Engine. |
static void |
setLogStream(java.io.PrintStream stream)
Sets the logging/tracing PrintStream that is used by the Engine and Viewer. |
void |
setMetaProperties(java.util.Properties props)
Sets (and overwrites!) |
void |
setMsgListener(com.inet.report.RDC.MsgListener msgl)
Sets the MsgListener for RDC. |
void |
setNumeralLanguage(int language)
Sets the language of the numerals in numbers, date, time and datetime values. |
void |
setPassword(java.lang.String password)
Sets the password for the main and all subreports for logging on to SQL, ODBC, or password protected databases used by the report. |
void |
setPrintDate(java.util.Date date)
Sets the print date for this report. |
void |
setPrompt(java.lang.String prompt,
int i)
Specifies the value for a parameter field in the report. |
void |
setPrompt(java.lang.String name,
java.lang.String prompt)
Specifies the value for a parameter field in the report. |
void |
setPrompts(java.util.Vector prompts)
Specifies value for parameter fields in the report. |
void |
setQueryFile(java.net.URL url,
int i)
Sets the name of the query file for subreport $n$. |
void |
setQueryFile(java.net.URL url)
Sets the name of the query file in main report. |
void |
setReportFile(java.lang.String url)
Sets the report template file. |
void |
setReportFile(java.net.URL url)
Sets the report file URL. |
void |
setReportTitle(java.lang.String title)
Sets the title of the report. |
void |
setSF(java.lang.String sf)
Specifies a record selection formula. |
void |
setSchema(java.lang.String schema)
Sets the database schema that will be used with this report at runtime instead of the schema that was specified at report creation. |
void |
setSproc(java.lang.String sproc,
int i)
Sets the value for a stored procedure parameter accessed by the report. |
void |
setSprocs(java.util.Vector sprocs)
Deprecated. As of i-net Crystal-Clear 10.1, use setSproc(String, int) |
void |
setSql(java.lang.String statement)
Replaces all defined tables and joins by this SQL statement. |
void |
setSql(java.lang.String statement,
boolean useColumnIndexFromReportDesign)
Manually sets the SQL statement that will be send to the database to fetch the report data. |
void |
setSqlIgnoreMetaData(java.lang.String statement)
Replaces all defined tables and joins of this report with the supplied sql statement. |
void |
setTime(long time)
Sets a timestamp. |
void |
setUser(java.lang.String user)
Sets the same username for all reports (main and subreports) for logging on to password protected databases used by the report. |
void |
setUserData(java.util.Hashtable hash)
With this method you can associate additional data with the engine and retrieve it later (e.g. in a class that is derived from Database). |
void |
setUserProperties(java.util.Properties props)
With this method you can associate additional data with the engine of the main report. |
static void |
shutdown()
Attempts to interrupt all Threads created by i-net Clear Reports. |
void |
stop()
Stops the execution of the report after the rendering of the current page was finished. |
void |
stop(java.lang.String message)
Stops the execution of the report after the rendering of the current page was finished. |
void |
stopAfterPage(int maxPageNo)
Sets the maximum number of report pages rendered by these engine. |
static void |
stopAll()
Stops all Engines in this JVM or container. |
| Methods inherited from interface com.inet.report.parser.NodeParser |
|---|
isDOMParser, parseDOM, parseElement, parseEndElement, parseText |
| Field Detail |
|---|
public static final java.lang.String AREA_TYPE_REPORT_HEADER
getArea(String): Report Header
public static final java.lang.String AREA_TYPE_PAGE_HEADER
getArea(String): Page Header
public static final java.lang.String AREA_TYPE_GROUP_HEADER_PREFIX
getArea(String): Group Header Prefix: To access a Group Header, use
this prefix in front of the 1-based group index you wish to access. E.g. GH1, GH2...
public static final java.lang.String AREA_TYPE_DETAIL
getArea(String): Detail Area
public static final java.lang.String AREA_TYPE_GROUP_FOOTER_PREFIX
getArea(String): Group Footer Prefix: To access a Group Footer, use
this prefix in front of the 1-based group index you wish to access. E.g. GF1, GF2...
public static final java.lang.String AREA_TYPE_REPORT_FOOTER
getArea(String): Report Footer
public static final java.lang.String AREA_TYPE_PAGE_FOOTER
getArea(String): Page Footer
public static final int REPORT_HEADER
public static final int PAGE_HEADER
public static final int DETAILS
public static final int REPORT_FOOTER
public static final int PAGE_FOOTER
public static final java.lang.String NO_EXPORT
public static final java.lang.String EXPORT_PDF
public static final java.lang.String EXPORT_RTF
public static final java.lang.String EXPORT_HTML
public static final java.lang.String EXPORT_XLS
public static final java.lang.String EXPORT_XML
public static final java.lang.String EXPORT_TXT
public static final java.lang.String EXPORT_CSV
public static final java.lang.String EXPORT_PS
public static final java.lang.String EXPORT_PS2
public static final java.lang.String EXPORT_PS3
public static final java.lang.String EXPORT_DATA
public static final java.lang.String EXPORT_SVG
public static final java.lang.String EXPORT_PNG
public static final java.lang.String EXPORT_GIF
public static final java.lang.String EXPORT_JPG
public static final java.lang.String EXPORT_BMP
public static int LOG_STATUS
public static int LOG_ERROR
public static int LOG_WARN
public static int LOG_INFO
public static int LOG_DEBUG
| Constructor Detail |
|---|
public Engine()
public Engine(java.lang.String export_fmt)
throws ReportException
setUserProperties(Properties).
export_fmt - the output format. The following values are valid:
Engine engine = new Engine(Engine.EXPORT_PDF);
engine.setReportFile( "file:D:/reports/MySample.rpt" );
//engine.setPassword("...."); // if you like to change/set the password
//engine.setPrompt("...","..."); // if you like to set a parameter field value
engine.execute();
File pdfFile = new File("D:/exports/sample.pdf");
FileOutputStream fos = new FileOutputStream(pdfFile);
for(int i=1;i<=engine.getPageCount();i++){
fos.write(engine.getPageData(i));
}
fos.close();
ReportException - throw if the format is wrong.NO_EXPORT,
EXPORT_PDF,
EXPORT_PS,
EXPORT_PS2,
EXPORT_PS3,
EXPORT_RTF,
EXPORT_HTML,
EXPORT_XLS,
EXPORT_XML,
EXPORT_TXT,
EXPORT_CSV,
EXPORT_DATA,
EXPORT_SVG,
EXPORT_BMP,
EXPORT_GIF,
EXPORT_JPEG,
EXPORT_PNG| Method Detail |
|---|
public static void shutdown()
public int getRecordCount()
public static java.lang.String getCreator()
setCreator(String)public static void setCreator(java.lang.String creator)
creator - The default value is "i-net Clear Reports " + Engine.getVersion()
java.lang.NullPointerException - If creator is nullgetCreator()
public void setLocale(java.util.Locale locale)
throws ReportException
locale - The locale to be used by the client
ReportException - if Engine is not initialized or finished.getLocale(),
setClientLocale(java.util.Locale),
setNumeralLanguage(int)
public void setClientLocale(java.util.Locale locale)
throws ReportException
locale - The locale to be used by the client
ReportException - if Engine is not initialized or finished.getLocale(),
setLocale(Locale)
public java.util.Locale getLocale()
throws ReportException
ReportException - if Engine is not initialized or finished.setLocale(Locale locale)
public void setNumeralLanguage(int language)
throws ReportException
language - one of the language constant values or -1 for the current locale as default.
ReportException - if Engine is not initialized or finished.setLocale(Locale),
getNumeralLanguage(),
ValueProperties.setNumeralLanguage(int),
ValueProperties.NUMERAL_LANGUAGE_EUROPEAN,
ValueProperties.NUMERAL_LANGUAGE_ARABIC,
ValueProperties.NUMERAL_LANGUAGE_EASTERN_ARABIC,
ValueProperties.NUMERAL_LANGUAGE_DEVANAGARI,
ValueProperties.NUMERAL_LANGUAGE_BENGALI,
ValueProperties.NUMERAL_LANGUAGE_GURMUKHI,
ValueProperties.NUMERAL_LANGUAGE_GUJARATI,
ValueProperties.NUMERAL_LANGUAGE_ORIYA,
ValueProperties.NUMERAL_LANGUAGE_TAMIL,
ValueProperties.NUMERAL_LANGUAGE_TELUGU,
ValueProperties.NUMERAL_LANGUAGE_KANNADA,
ValueProperties.NUMERAL_LANGUAGE_MALAYALAM,
ValueProperties.NUMERAL_LANGUAGE_THAI,
ValueProperties.NUMERAL_LANGUAGE_LAO,
ValueProperties.NUMERAL_LANGUAGE_TIBETAN,
ValueProperties.NUMERAL_LANGUAGE_MYANMAR,
ValueProperties.NUMERAL_LANGUAGE_ETHIOPIC,
ValueProperties.NUMERAL_LANGUAGE_KHMER,
ValueProperties.NUMERAL_LANGUAGE_MONGOLIAN
public int getNumeralLanguage()
throws ReportException
ReportException - if Engine is not initialized or finished.setNumeralLanguage(int)
public void setUserProperties(java.util.Properties props)
throws ReportException
props - The data to be set in a Properties object.
ReportException - if Engine is not initialized or finished.getUserProperties(),
setUserData(Hashtable),
getUserData()
public java.util.Properties getUserProperties()
throws ReportException
setUserProperties(), checkProperties() or in the report URL.set/getUserData(Hashtable data) which is
probably more useful.
ReportException - if Engine is not initialized or finished.setUserProperties(Properties props),
setUserData(Hashtable data),
getUserData()public java.util.Hashtable getUserData()
public void getReportData( Engine engine, String configs ) {
try {
...
// get the url properties from the report URL
Hashtable p = engine.getUserData();
String[] cols = p.get("my_cols"));
...
engine.setData(cols, data, true);
} catch (Throwable t) {Utils.printStackTrace(t);}
}
In the report URL you can set these parameter, e.g.:
setUserData(Hashtable),
setUserProperties(Properties props),
getUserProperties()public void setUserData(java.util.Hashtable hash)
hash - The data to be set.getUserData(),
setUserProperties(Properties props),
getUserProperties()
public Engine getParent()
throws ReportException
ReportException - if Engine is not initialized or finished.
public void execute()
throws ReportException
ReportException - if Engine is not initialized or finished.getPageData(int)
public byte[] getPageData(int page)
throws ReportException
Engine engine = new Engine(Engine.EXPORT_PDF);
engine.setReportFile( "file:D:/reports/MySample.rpt" );
engine.execute();
File pdfFile = new File("D:/exports/sample.pdf");
FileOutputStream fos = new FileOutputStream(pdfFile);
for(int i=1;i<=engine.getPageCount();i++){
fos.write(engine.getPageData(i));
}
fos.close();
Please note: Before you can call this method you need to call engine.execute() to execute and render the report.
page - The number of the page. The first page is 1, the second is 2, ... .
If the page number is bigger than the page count then null will be returned.
java.lang.IllegalArgumentException - if the page number is zero or negative.
ReportException - If rendering the page encounters a problemgetPageCount(),
Engine(String export_fmt)public byte[] getFontData(int fontID)
null will be returned if there are no fonts embedded for the
report of this Engine. If fontID is greater than the number of embedded
fonts available it will return the last font available.
fontID - Identifying number of font to fetch
null if not font is available.
java.lang.IllegalArgumentException - If fontID is less than 1.
public int getPageCount()
throws ReportException
ReportException - If rendering the report encounters a problemgetPageData(int),
getDocumentPageCount()
public int getDocumentPageCount()
throws ReportException
getPageCount() which returns the number of separate
chunks (byte arrays in that the report will be streamed to the client).
ReportException - If rendering the report encounters a problemgetPageCount()
public void setCatalog(java.lang.String catalog)
throws ReportException
catalog - name of the catalog
ReportException - if Engine is not initialized or finished.setDataSourceConfigurationName(String),
setSchema(String),
setUser(String),
setPassword(String),
DataSourceConfiguration.setCatalog(String),
DataSourceConfiguration.getCatalog(),
DatabaseTables.createDatasource(String)
public void setSchema(java.lang.String schema)
throws ReportException
schema - Name of the schema
ReportException - if Engine is not initialized or finished.Datasource.getSchema(),
setCatalog(String),
setDataSourceConfigurationName(String),
setUser(String),
setPassword(String),
Datasource.setSchema(String),
Datasource.setSchema(String),
DatabaseTables.createDatasource(String)
public void setData(java.lang.String[] columns,
java.lang.Object[][] data,
boolean longColumnNames)
throws ReportException
setSF(String) and/or
setGF(String).
Engine eng = new Engine();
eng.setReportFile( "file:C:/report/MySample.rpt" );
String[] columns = {"TestTable.ID", "TestTable.Name"};
Object[][] data =
{{new Integer(10), "John"},
{new Integer(20), "Peter"},
{new Integer(23), "Ana"}};
eng.setData( columns, data, true );
eng.execute();
columns - The names of the columns in the report template. This names are case in-sensitiv.data - the report data. Supported datatypes are: all instances of Number, String and byte[].longColumnNames - this flag is obsolete since i-net Crystal-Clear 5.3
ReportException - if Engine is not initialized or finished.ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean),
setSF(String),
setGF(String)
public void setData(java.util.Vector columns,
java.util.Vector data,
boolean longColumnNames)
throws ReportException
setSF(String) and/or
setGF(String).
columns - must include Strings onlydata - can include Vectors or Object[]longColumnNames - this flag is obsolete since i-net Crystal-Clear 5.3
ReportException - If there are problems with the engine not being initialized or
with the data not being validsetData(String[],Object[][],boolean),
ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean),
setSF(String),
setGF(String)
public void setData(java.lang.String[] columns,
java.lang.Object[][] data)
throws ReportException
setSF(String) and/or
setGF(String).
Note that this does not work when using a "query file";
fetching data via a query file takes always precedence even if you call setData().
Engine eng = new Engine();
eng.setReportFile( "file:C:/report/MySample.rpt" );
String[] columns = {"TestTable.ID", "TestTable.Name"};
Object[][] data =
{{new Integer(10), "John"},
{new Integer(20), "Peter"},
{new Integer(23), "Ana"}};
eng.setData( columns, data );
eng.execute();
columns - The names of the columns in the report template. This names are by default case in-sensitiv.data - the report data.
ReportException - if Engine is not initialized or finished.ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean),
setSF(String),
setGF(String)
public void setConnection(java.sql.Connection con)
throws ReportException
Class.forName("com.inet.ora.OraDriver");
Engine eng = new Engine();
eng.setReportFile( "file:C:/report/MySample.rpt" );
Connection con = DriverManager.getConnection("jdbc:inetora:host:port:sid?user=USRName&password=PWD");
eng.setConnection( con );
eng.setCatalog(con.getCatalog());
eng.execute();
con - The database connection object
ReportException - if Engine is not initialized or finished.setConnectionCloseOnFinishing(boolean),
Datasource.setConnection(Connection)public void setConnectionCloseOnFinishing(boolean closeConnectionOnFinishing)
closeConnectionOnFinishing - if set to false, the set connection will not be closed when the
report execution was completed.setConnection(Connection)public void stopAfterPage(int maxPageNo)
maxPageNo - The last page that should be rendered. 0 means "unlimited".stop()public void stop()
stop(String),
stopAfterPage(int),
stopAll()public void stop(java.lang.String message)
message - a message for the debug log.stopAfterPage(int),
stopAll()public boolean isPageLimitExceeded()
public static void stopAll()
stop()
public void setData(java.sql.ResultSet resultSet)
throws java.lang.NullPointerException,
java.sql.SQLException,
ReportException
setSF(String) and/or
setGF(String).
Engine eng = new Engine();
eng.setReportFile("file:C:/report/MySample.rpt" );
eng.setData( resultSet );
eng.execute();
resultSet - The resultset that contains the data for the report.
java.sql.SQLException - If a database access error occurs or the ResultSet is closed
ReportException - If the Engine is not initialized or finished
java.lang.NullPointerException - Rarely, if there are internal problems with the database connection.
Should never occur.Database.getReportData(Engine, String),
ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean),
setSF(String),
setGF(String)public static void setLogStream(java.io.PrintStream stream)
stream - Print Streampublic static void setLogLevel(int level)
level - the log levelsetLogStream(java.io.PrintStream),
getLogLevel(),
LOG_STATUS,
LOG_ERROR,
LOG_WARN,
LOG_INFO,
LOG_DEBUGpublic static java.io.PrintStream getLogStream()
public static int getLogLevel()
setLogLevel(int)
public void setGF(java.lang.String gf)
throws ReportException
engine.setGF("if ({table.row} = 1) then true else
false");
gf - group selection formula
ReportException - if Engine is not initialized or finished.getGF(),
setSF(java.lang.String),
getSF()
public java.lang.String getGF()
throws ReportException
ReportException - if Engine is not initialized or finished.setGF(java.lang.String),
setSF(java.lang.String),
getSF()
public FormulaField getGFField()
throws ReportException
ReportException - if Engine is not initialized or finished.getGF(),
setGF(java.lang.String),
setSF(java.lang.String)
public void setSF(java.lang.String sf)
throws ReportException
engine.setSF("if ({table.row} = 1) then true
else false");
sf - record selection formula to use, null if record selection is to be removed.
ReportException - if Engine is not initialized or finished.getSF(),
setGF(java.lang.String),
getGF()
public java.lang.String getSF()
throws ReportException
ReportException - if Engine is not initialized or finished.setSF(java.lang.String),
setGF(java.lang.String),
getGF()
public FormulaField getSFField()
throws ReportException
ReportException - if Engine is not initialized or finished.getSF(),
setSF(java.lang.String)
public void setPrompt(java.lang.String prompt,
int i)
throws ReportException
engine.setPrompt("Date(2001,01,01)", 0);engine.setPrompt("[Date(2001,01,01),Date(2007,05,15)]", 0);engine.setPrompt("MyStringPrompt","\"\"string-value\"\"");.
prompt - value for parameter field ii - index in the parameter list
ReportException - if Engine is not initialized or finished.
java.lang.IllegalStateException - If no prompt could be found at the given indexsetPrompts(java.util.Vector),
getPrompts(),
getPrompt(int),
getFields(),
Fields.getPromptField(int)
public void setPrompt(java.lang.String name,
java.lang.String prompt)
throws ReportException
engine.setPrompt("MyDatePrompt","Date(2006,01,03)");engine.setPrompt("MyDatePrompt","[Date(2001,01,01),Date(2007,05,15)]");.engine.setPrompt("MyStringPrompt","\"\"string-value\"\"");.#2#TestName would address a prompt called "TestName" in the
second subreport.
name - the name of the parameter fieldprompt - value for parameter field as String
ReportException - if Engine is not initialized or finished.setPrompts(java.util.Vector),
getPrompts(),
getPrompt(int),
getFields(),
Fields.getPromptField(int)
public void setPrompts(java.util.Vector prompts)
throws ReportException
Vector prompts = new Vector();
prompts.add("Date(2006,01,03)");
...
engine.setPrompt(prompts);
prompts - Vector containing parameter field values as String objects, e.g.: "Date(2005,31,12)"
ReportException - if Engine is not initialized or finished.getPrompts(),
getFields(),
Fields.getPromptField(int)
public java.lang.Object getPrompt(int i)
throws ReportException
i - index in the parameter list
ReportException - if Engine is not initialized or finished.
java.lang.IndexOutOfBoundsException - if there is no parameter field at the index i.setPrompts(java.util.Vector)
public java.util.Vector getPrompts()
throws ReportException
ReportException - if Engine is not initialized or finished.setPrompts(java.util.Vector)
public void setSproc(java.lang.String sproc,
int i)
throws ReportException
sproc - stored procedure parametersi - index of the stored procedure parameter
ReportException - if Engine is not initialized or finished.getSprocs()
@Deprecated
public void setSprocs(java.util.Vector sprocs)
throws ReportException
setSproc(String, int)
sprocs - stored procedure parameters
ReportException - if Engine is not initialized or finished.getSprocs()
@Deprecated
public java.lang.String getSproc(int i)
throws ReportException
TableSource.getInputParameters()
i - index of the stored procedure parameter
ReportException - if Engine is not initialized or finished.
java.lang.ArrayIndexOutOfBoundsException - If no stored procedure with the given index existsgetSprocs(),
setSproc(String, int),
setSprocs(Vector)
@Deprecated
public java.util.Vector getSprocs()
throws ReportException
TableSource.getInputParameters()
ReportException - if Engine is not initialized or finished.getSproc(int),
setSproc(String, int),
setSprocs(Vector)
public void setSql(java.lang.String statement)
throws ReportException
setSF(String) and/or
setGF(String).
This will cause a query to the database for the meta data
of the supplied SQL statement. If not all required columns have been
specified in the supplied SQL statement this will throw a ReportException
with error code 1212.setSqlIgnoreMetaData(String) instead which
will not query the meta data for the SQL statement. Please also note that
in this case no ReportException will be thrown if the SQL statement does
not contain all required columns for the report. The error will occur
at execution then. (error code 14)
statement - The SQL statement
ReportException - If not all required columns have been specified
in the supplied SQL statement (error code 1212) or an error
occurred during setting the SQL statement.TableSource.getSql(),
setSF(String sf),
setSqlIgnoreMetaData(String),
ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean)
public void setSqlIgnoreMetaData(java.lang.String statement)
throws ReportException
setSql(String) this call will
not check the supplied sql statement to return all required columns for
the report. This means that no request for meta data information will be
sent to the database.setSF(String) and/or
setGF(String). execute(). You
can check if an error occurred during rendering
by calling getErrorMsg() after execution.
statement - The sql statement which should be executed for this
report.
ReportException - If an error occured during setting the sql
statement.setSql(String),
ReportProperties.setIgnoreFiltering(boolean),
ReportProperties.setIgnoreSorting(boolean),
setSF(String),
setGF(String)
public void setSql(java.lang.String statement,
boolean useColumnIndexFromReportDesign)
throws ReportException
statement - The SQL statementuseColumnIndexFromReportDesign - is obsolete.
ReportException - if Engine is not initialized or finished.TableSource.getSql(),
setSF(String sf)
@Deprecated
public java.lang.String getDefaultSql()
throws ReportException
getDefaultSqlOfAllStatements(boolean)
ReportException - if Engine is not initialized or finished, or if there are not only tables/views in the connection, or ifsetSql(String),
TableSource.getSql()
public java.lang.String[] getDefaultSqlOfAllStatements(boolean leavePrompts)
throws ReportException
leavePrompts - If true, PromptFields used in the statement will be replaced by its placeholder.
ReportException - If creating the statements failed or the engine is finished.
public void setUser(java.lang.String user)
throws ReportException
user - username for all reports (inclusive subreports)
ReportException - if Engine is not initialized or finished.setPassword(String),
getDatabaseTables(),
DataSourceConfiguration.setUser(String)
public void setPassword(java.lang.String password)
throws ReportException
password - password(s)
ReportException - if Engine is not initialized or finished.setUser(String),
getDatabaseTables(),
DataSourceConfiguration.setPassword(String)public void setErrorMsg(java.lang.String msg)
getErrorMsg().
msg - the error message.getErrorMsg()public java.lang.String getErrorMsg()
isFinish().
setErrorMsg(java.lang.String)
public Fields getFields()
throws ReportException
// getting all fields, where eng referenzes your Engine - instance, you want to use
Fields fields = eng.getFields();
// getting count of prompts
int promptsCount = fields.getPromptFieldsCount();
PromptField promptField = null;
// for all prompts in fields
for (int i=0;i<promptsCount;i++){
// getting single PromptField at position i
promptField = (PromptField)getPromptField( i );
// print name and value to stdout
System.out.println(promptField.getName() + " : " + promptField.getPrompValue());
}
Note that PromptField.getPromptValue() returns an Object, so check whether you need to cast or not.
ReportException - if Engine is not initialized or finished.Fields,
PromptField,
FormulaField,
DatabaseField,
SQLField,
SortField,
GroupField,
SummaryField
public Engine getSubReport(int idx)
throws ReportException
idx - The 0-based index of subreport
ReportException - will thrown if no subreport is available, or idx is greater than size of subreport set
or if Engine is not initialized or finished.getSubReportCount()
public Subreport getSubReportElement()
throws ReportException
ReportException - if Engine is not initialized or engine is finished
public int getSubReportCount()
throws ReportException
ReportException - if Engine is not initialized or finished.getSubReport(int idx)
public void setDataSourceConfigurationName(java.lang.String datasourceName)
throws ReportException
datasourceName - Name of the datasource configuration
ReportException - if Engine is not initialized or finished.setCatalog(String),
Datasource.setDataSourceConfigurationName(String),
getDatabaseTables(),
DatabaseTables.getDatasource(int)public static int getMajorVersion()
getMinorVersion(),
getVersion()public static int getMinorVersion()
getMajorVersion(),
getVersion()public static java.lang.String getVersion()
getMajorVersion(),
getMinorVersion()
public java.net.URL getReportFile()
throws ReportException
ReportException - if Engine is not initialized or finished.setReportFile(String),
setReportFile(java.net.URL)
public SummaryInfo getSummaryInfo()
throws ReportException
ReportException - if Engine is not initialized or finished.SummaryInfo
public Translations getTranslations()
throws ReportException
ReportException - if Engine is not initialized or finished.
public java.lang.String getReportTitle()
throws ReportException
ReportException - if Engine is not initialized or finished.setReportTitle(String),
setReportFile(String)
public void setReportTitle(java.lang.String title)
throws ReportException
title - the value of the new title.
ReportException - if Engine is not initialized or finished.getReportTitle()
public java.lang.String getQueryFile()
throws ReportException
ReportException - if Engine is not initialized or finished.setQueryFile(java.net.URL, int)
public void setQueryFile(java.net.URL url,
int i)
throws ReportException
i - the id of the corresponding reporturl - the name of the new query file.
ReportException - if Engine is finished.setQueryFile(java.net.URL url),
getQueryFile()
public void setQueryFile(java.net.URL url)
throws ReportException
url - the name of the new query file.
ReportException - if Engine is finished.setQueryFile(java.net.URL url, int i),
getQueryFile()public void setTime(long time)
time - the time in millis.getTime(),
getCacheSize()public long getTime()
setTime(long),
getCacheSize()public int getCacheSize()
public void setReportFile(java.lang.String url)
throws ReportException
URL does not include a protocol then it will be encoded.
If the URL include a protocol then it must already be encoded, if needed.
Engine engine = new Engine( ... );
engine.setReportFile( ... );
...
url - the url of the report template file.
ReportException - if Engine is not initialized or finished.setReportFile(java.net.URL),
RDC.loadEngine(File),
RDC.loadEngine(File, String),
RDC.loadEngine(URL, java.io.InputStream, String, Properties)
public void setReportFile(java.net.URL url)
throws ReportException
Engine eng = new Engine(...);
eng.setReportFile( ... );
...
url - the url of the report template file.
ReportException - if Engine is not initialized or finished.setReportFile(String),
RDC.loadEngine(File),
RDC.loadEngine(File, String),
RDC.loadEngine(URL, java.io.InputStream, String, Properties)
public byte[] getGroupTree()
throws ReportException
ReportException - If a problem occurs while group tree creation
public java.util.Vector getSections()
throws ReportException
ReportException - if Engine is finished
public Area getArea(int idx)
throws ReportException
null will returned. To get group 1 header use idx=5.
To get group 1 footer use idx=6, to get group 2 header use idx=7 etc. (same as main reports).
idx - The 0-based index of returned Area in set.
ReportException - if Engine is finished
java.lang.IndexOutOfBoundsException - If there is no area specified by the given indexPAGE_FOOTER,
PAGE_HEADER,
DETAILS,
REPORT_HEADER,
REPORT_FOOTER,
Area
public Area getArea(java.lang.String item)
throws ReportException
item - Specifies the returned area (using the AREA_TYPE constants)AREA_TYPE_PAGE_HEADER and AREA_TYPE_PAGE_FOOTER
will not work, since these areas do not exist and null will returned.
ReportException - if Engine is finished
java.lang.IllegalArgumentException - If the given area type is not valid. Valid types are defined by
the AREA_TYPE constantsgetArea(int),
AREA_TYPE_REPORT_HEADER,
AREA_TYPE_PAGE_HEADER,
AREA_TYPE_GROUP_HEADER_PREFIX,
AREA_TYPE_DETAIL,
AREA_TYPE_GROUP_FOOTER_PREFIX,
AREA_TYPE_REPORT_FOOTER,
AREA_TYPE_PAGE_FOOTER
public int getAreaCount()
throws ReportException
ReportException - if Engine is finished or no report is set.
public DatabaseTables getDatabaseTables()
throws ReportException
ReportException - if Engine is finished or no report is set.DatabaseTables
public Group addGroup(Field groupField)
throws ReportException
groupField - Field to group the data in the newly created group by.
ReportException - if the engine is finished, or the report structure is corruptGroup,
addGroup(Field),
getGroup(int),
getGroupCount(),
removeGroup(Group),
removeGroup(int)
public int getGroupCount()
throws ReportException
ReportException - if Engine is not initialized or finished.
java.lang.IllegalStateException - If the Engine has not been initialized correctlyGroup,
addGroup(Field),
getGroup(int),
removeGroup(Group),
removeGroup(int)
public void removeGroup(Group group)
throws ReportException
group - The group which should be removed.
ReportException - Thrown if the group is not in engine or the engine is finished
public void removeGroup(int grNum)
throws ReportException
grNum. The value of the paramter must be
between 1 and count of groups in the report. Otherwise, and if no group
was specified, an exception will be thrown.
grNum - The 1-based number of the group which should be removed. Must be between 1 and
count of groups. At least one group should be defined in the report. Use Group.indexOf() when having the
group object.
ReportException - will be thrown if the value of the parameter is greater than count of groups
defined in the report, if no groups were defined in the report or if the value of the parameter is less than
1. If the Engine is finished.Group,
addGroup(Field),
getGroup(int),
getGroupCount(),
Group.indexOf(),
removeGroup(Group)
public Group getGroup(int grNum)
throws ReportException,
java.lang.IndexOutOfBoundsException
1 or
lesser than count of groupings.
grNum - The 1-based number of the grouping which should be returned. Must be between 1
and count of groupings in report.
grNum specified grouping.
ReportException - if Engine is not initialized or finished.
java.lang.IndexOutOfBoundsException - If the given index does not specify an actual groupGroup,
addGroup(Field),
getGroupCount(),
removeGroup(Group)
public Group getGroupByField(Field field)
throws ReportException
field if exists -
otherwise null is returned.
field - The field the Group is based on.
ReportException - if the engine is finished
public void moveGroup(int source,
int dest)
throws ReportException
source to target.
source - the 1-based number of the group which should moved to target.dest - the 1-based destination of moving.
ReportException - if the engine is finished@Deprecated public boolean isXml()
ReportProperties.isCCFormat().
true if the report comes from i-net Clear Reports file format, else false.
public void setPrintDate(java.util.Date date)
throws ReportException
date - Date object to use as the current point in time
ReportException - if Engine is finished
public java.util.Date getPrintDate()
throws ReportException
setPrintDate(java.util.Date)
ReportException - if Engine is finishedpublic java.lang.Exception[] getLoadExceptions()
Exception[] from engine.
If no errors has occurred null will be returned.
public void setMsgListener(com.inet.report.RDC.MsgListener msgl)
msgl - The object which implements the RDC.MsgListener interface
and should handle the queries from RDC to the user.public com.inet.report.RDC.MsgListener getMsgListener()
public boolean isSubEngine()
throws ReportException
true) or not (false).
ReportException - if the engine has already been executed.public EngineStatus getStatus()
java.lang.IllegalStateException - If this Engine is a sub report EnginegetParent()
public ReportProperties getReportProperties()
throws ReportException
ReportException - if Engine is not initialized or finishedpublic static java.util.List getEmbeddableFontNames()
public void addClippingListener(ClippingListener listener)
listener - Listener to be registered.ClippingListener,
ClippingEventpublic void removeClippingListener(ClippingListener listener)
listener - Listener to be unregistered.ClippingListener,
ClippingEventpublic void addFinishListener(EngineFinishListener listener)
listener - EngineFinishListener to notify when the engine is finished rendering.removeFinishListener(com.inet.report.event.EngineFinishListener),
EngineFinishListenerpublic void removeFinishListener(EngineFinishListener listener)
listener - EngineFinishListener to no longer notify when the engine is done renderingaddFinishListener(com.inet.report.event.EngineFinishListener),
EngineFinishListener
public FormulaField[] getVariableReferences(java.lang.String varName)
throws ReportException
varName - The name of the variable to search for references. Case-insensitive.
ReportException - if Engine is finishedpublic java.util.Properties getMetaProperties()
Properties
public void setMetaProperties(java.util.Properties props)
getMetaProperties() instead and
add your properties to the Properties object.
props - Properties to set. May not be null.
java.lang.IllegalArgumentException - if props is nullpublic int getReportID()
getSubReport(int) since ID and index are different.
public Trigger getTrigger()
|
i-net Clear Reports | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||