public class Engine extends java.lang.Object implements java.io.Serializable, NodeParser, ReportGenerator
engine = new Engine(Engine.NO_EXPORT)
.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.
Modifier and Type | Field and Description |
---|---|
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_HTML_ZIP
Engine creates HTML output.
|
static java.lang.String |
EXPORT_JPG
Engine creates JPG output.
|
static java.lang.String |
EXPORT_ODS
Engine creates OpenOffice ODS 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_XLSX
Engine creates XLSX 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 and Description |
---|
Engine(java.lang.String export_fmt)
Constructor creates an Engine for different file output formats.
|
Modifier and Type | Method and Description |
---|---|
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[] |
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.
|
FacturXSettings |
getFacturXSettings()
Get the factur X settings.
|
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.
|
int |
getPromptCount()
Returns the number of prompt fields set for the engine.
|
PromptField |
getPromptField(java.lang.String name)
Returns the prompt field with the given name (note this is case-insensitive) or null if no such prompt exists.
|
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.List<Section> |
getSections()
Returns a list containing all sections the report consists of.
|
EngineStatistics |
getStatistics()
Runtime statistic data of this Engine.
|
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 ). |
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.List<java.lang.String> columns,
java.util.List<?> data,
boolean longColumnNames)
The columns contains the strings with the columns names.
|
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 |
setData(java.lang.String tableAlias,
java.sql.ResultSet rs)
Set the data for one TableSource.
|
void |
setData(java.lang.String tableAlias,
java.lang.String[] columns,
java.lang.Object[][] rows)
Set the data for one TableSource.
|
void |
setDataSourceConfigurationName(java.lang.String datasourceName)
Sets the name of datasource configuration.
|
void |
setDocumentOutput(DocumentOutput pages)
Set the output location for the rendered data.
|
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 value,
int i)
Specifies the value for a parameter field in the report.
|
void |
setPrompt(java.lang.String name,
java.lang.String value)
Specifies the value for a parameter field in the report.
|
void |
setPrompts(java.util.Vector prompts)
Deprecated.
As of i-net Clear Reports 19.0, use
setPrompt(PromptField, String) , setPrompt(String, int) or setPrompt(String, String) |
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 |
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.
|
isDOMParser, parseDOM, parseElement, parseEndElement, parseText
public static final java.lang.String AREA_TYPE_REPORT_HEADER
getArea(String)
: Report Headerpublic static final java.lang.String AREA_TYPE_PAGE_HEADER
getArea(String)
: Page Headerpublic 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 Areapublic 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 Footerpublic static final java.lang.String AREA_TYPE_PAGE_FOOTER
getArea(String)
: Page Footerpublic 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_HTML_ZIP
public static final java.lang.String EXPORT_XLS
public static final java.lang.String EXPORT_XLSX
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 final java.lang.String EXPORT_ODS
public static final int LOG_STATUS
public static final int LOG_ERROR
public static final int LOG_WARN
public static final int LOG_INFO
public static final int LOG_DEBUG
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.RDC.createEmptyEngine(String)
,
NO_EXPORT
,
EXPORT_PDF
,
EXPORT_PS
,
EXPORT_PS2
,
EXPORT_PS3
,
EXPORT_RTF
,
EXPORT_HTML
,
EXPORT_XLS
,
EXPORT_XLSX
,
EXPORT_XML
,
EXPORT_TXT
,
EXPORT_CSV
,
EXPORT_DATA
,
EXPORT_SVG
,
EXPORT_BMP
,
EXPORT_GIF
,
EXPORT_JPEG
,
EXPORT_PNG
public static void shutdown()
public int getRecordCount()
public void setDocumentOutput(DocumentOutput pages)
setDocumentOutput
in interface ReportGenerator
pages
- The location for the data. This can be DocumentOutputStream or CachedOutput.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(@Nonnull java.util.Locale locale) throws ReportException
locale
- The locale to be used by the clientReportException
- if Engine is not initialized or finished.getLocale()
,
setClientLocale(java.util.Locale)
,
setNumeralLanguage(int)
public void setClientLocale(@Nonnull java.util.Locale locale) throws ReportException
setClientLocale
in interface ReportGenerator
locale
- The locale to be used by the clientReportException
- 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)
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_EUROPEAN
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_ARABIC
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_EASTERN_ARABIC
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_DEVANAGARI
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_BENGALI
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_GURMUKHI
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_GUJARATI
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_ORIYA
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_TAMIL
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_TELUGU
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_KANNADA
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_MALAYALAM
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_THAI
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_LAO
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_TIBETAN
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_MYANMAR
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_ETHIOPIC
,
ValuePropertiesConstants.NUMERAL_LANGUAGE_KHMER
,
ValuePropertiesConstants.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
setUserProperties
in interface ReportGenerator
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()
setUserProperties()
, checkProperties()
or in the report URL.set/getUserData(Hashtable data)
which is
probably more useful.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 finished.public void execute() throws ReportException
execute
in interface ReportGenerator
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.getPageData
in interface ReportGenerator
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 fetchnull
if not font is available.java.lang.IllegalArgumentException
- If fontID is less than 1.public int getPageCount() throws ReportException
getPageCount
in interface ReportGenerator
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 catalogReportException
- 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 schemaReportException
- 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( Engine.NO_EXPORT );
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.3ReportException
- if Engine is not initialized or finished.ReportProperties.setIgnoreFiltering(boolean)
,
ReportProperties.setIgnoreSorting(boolean)
,
setSF(String)
,
setGF(String)
public void setData(java.util.List<java.lang.String> columns, java.util.List<?> 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.3ReportException
- 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( Engine.NO_EXPORT );
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( Engine.NO_EXPORT );
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 objectReportException
- 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)
stopAfterPage
in interface ReportGenerator
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)
stop
in interface ReportGenerator
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( Engine.NO_EXPORT );
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 closedReportException
- If the Engine is not initialized or finishedjava.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 void setData(java.lang.String tableAlias, java.sql.ResultSet rs) throws ReportException
tableAlias
- the alias of a TableSourcers
- the dataReportException
- if tableAlias was not found in the reportpublic void setData(java.lang.String tableAlias, java.lang.String[] columns, java.lang.Object[][] rows) throws ReportException
tableAlias
- the alias of a TableSourcecolumns
- the column names of the data without tablenamerows
- the rows of the dataReportException
- if tableAlias was not found in the reportpublic 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_DEBUG
public 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 formulaReportException
- 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 value, 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\"\"");
.setPrompt
in interface ReportGenerator
value
- value for parameter field ii
- index in the parameter listReportException
- if Engine is not initialized or finished.java.lang.IllegalStateException
- If no prompt could be found at the given indexsetPrompts(java.util.Vector)
,
getPrompt(int)
,
getFields()
,
Fields.getPromptField(int)
public void setPrompt(java.lang.String name, java.lang.String value) 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.setPrompt
in interface ReportGenerator
name
- the name of the parameter fieldvalue
- value for parameter field as StringReportException
- if Engine is not initialized or finished.setPrompts(java.util.Vector)
,
getPrompt(int)
,
getFields()
,
Fields.getPromptField(int)
@Deprecated public void setPrompts(java.util.Vector prompts) throws ReportException
setPrompt(PromptField, String)
, setPrompt(String, int)
or setPrompt(String, String)
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.getFields()
,
Fields.getPromptField(int)
public java.lang.Object getPrompt(int i) throws ReportException
i
- index in the parameter listReportException
- 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 PromptField getPromptField(java.lang.String name) throws ReportException
getPromptField
in interface ReportGenerator
name
- name of the prompt to fetchReportException
- if Engine is not initialized or finished.public int getPromptCount()
getPrompt(int)
or getPromptField(String)
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 statementReportException
- 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 occurred 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)
,
getDefaultSqlOfAllStatements(boolean)
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.setSql(String)
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 subreportReportException
- 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 finishedpublic 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 configurationReportException
- 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 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 creationpublic java.util.List<Section> getSections() throws ReportException
ReportException
- if the engine is finishedpublic 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 finishedjava.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 finishedjava.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 finishedpublic 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 finishedpublic 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 finishedpublic void setPrintDate(java.util.Date date) throws ReportException
date
- Date object to use as the current point in timeReportException
- if Engine is finishedpublic 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()
,
getTrigger()
,
getStatistics()
public ReportProperties getReportProperties() throws ReportException
ReportException
- if Engine is not initialized or finishedpublic FacturXSettings getFacturXSettings() 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
,
ClippingEvent
public void removeClippingListener(ClippingListener listener)
listener
- Listener to be unregistered.ClippingListener
,
ClippingEvent
public void addFinishListener(EngineFinishListener listener)
listener
- EngineFinishListener to notify when the engine is finished rendering.removeFinishListener(com.inet.report.event.EngineFinishListener)
,
EngineFinishListener
public 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()
getStatistics()
,
getStatus()
@Nonnull public EngineStatistics getStatistics()
getStatistics
in interface ReportGenerator
getTrigger()
,
getStatus()
Copyright © 1999-2020 by i-net software GmbH