Package com.inet.report
Class EngineBundle
- java.lang.Object
-
- com.inet.report.EngineBundle
-
- All Implemented Interfaces:
ReportGenerator
public class EngineBundle extends java.lang.Object implements ReportGenerator
A bundle of multiple engines you want to render as one document. In the report URL the "reports" parameter can be used to set multiple reports you want to render as one, separated by semi-colon.- Since:
- 15.0
-
-
Constructor Summary
Constructors Constructor Description EngineBundle(java.lang.String format)
Create a new bundle of reports for the specified output format.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Engine
addReportFile(java.lang.String reportUrl)
Add a new report template to this bundle and creates an engine.void
execute()
SeeEngine.execute()
for details.Engine
getEngine0()
Get the first Engine from the bundle list.java.util.List<Engine>
getEngines()
Get all Engines of this bundle.int
getPageCount()
SeeEngine.getPageCount()
for details.byte[]
getPageData(int page)
SeeEngine.getPageData(int)
for details.PromptField
getPromptField(java.lang.String name)
SeeEngine.getPromptField(String)
for details.EngineStatistics
getStatistics()
SeeEngine.getStatistics()
for details.void
setClientLocale(java.util.Locale locale)
SeeEngine.setClientLocale(Locale)
for details.void
setDocumentOutput(DocumentOutput documentOutput)
Set the output location for the rendered data.void
setPrompt(java.lang.String prompt, int i)
NOTE: UnlikeEngine.setPrompt(String, int)
, the number i does not refer to prompt i in any engine, but will count from the first engine onwards.void
setPrompt(java.lang.String name, java.lang.String prompt)
SeeEngine.setPrompt(String, String)
for details.void
setUserProperties(java.util.Properties props)
SeeEngine.setUserProperties(Properties)
for details.void
stop(java.lang.String message)
SeeEngine.stop(String)
for details.void
stopAfterPage(int maxPageNo)
SeeEngine.stopAfterPage(int)
for details.
-
-
-
Constructor Detail
-
EngineBundle
public EngineBundle(java.lang.String format) throws ReportException
Create a new bundle of reports for the specified output format.- Parameters:
format
- One of the constant form Engine.- Throws:
ReportException
- if the format is not supported because it is tabular- Since:
- 15.0
-
-
Method Detail
-
addReportFile
public Engine addReportFile(java.lang.String reportUrl) throws ReportException
Add a new report template to this bundle and creates an engine.- Parameters:
reportUrl
- the report URL or file path to the *.rpt template.- Returns:
- the created engine
- Throws:
ReportException
- if the file can not be loaded or the format is currently not supported- Since:
- 15.0
-
setDocumentOutput
public void setDocumentOutput(DocumentOutput documentOutput)
Set the output location for the rendered data. By default the memory (heap) is used. It is also possible to store the data into the report cache or stream it directly to an OutputStream. This must be set before call of execute().- Specified by:
setDocumentOutput
in interfaceReportGenerator
- Parameters:
documentOutput
- The location for the data. This can be DocumentOutputStream or CachedOutput.
-
execute
public void execute() throws ReportException
SeeEngine.execute()
for details.- Specified by:
execute
in interfaceReportGenerator
- Throws:
ReportException
- if Engine is not initialized or finished.- See Also:
ReportGenerator.getPageData(int)
-
getEngine0
public Engine getEngine0() throws ReportException
Get the first Engine from the bundle list.- Returns:
- the Engine with index 0
- Throws:
ReportException
- if no rpt file was set.- Since:
- 17.0
-
getEngines
public java.util.List<Engine> getEngines()
Get all Engines of this bundle.- Returns:
- the engines
- Since:
- 17.0
-
getPageCount
public int getPageCount() throws ReportException
SeeEngine.getPageCount()
for details.- Specified by:
getPageCount
in interfaceReportGenerator
- Returns:
- number of pages or chunks
- Throws:
ReportException
- If rendering the report encounters a problem
-
getPageData
public byte[] getPageData(int page) throws ReportException
SeeEngine.getPageData(int)
for details.- Specified by:
getPageData
in interfaceReportGenerator
- Parameters:
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.- Returns:
- the binary data for the Java Viewer or the bytes of the exported file (page).
- Throws:
ReportException
- If rendering the page encounters a problem
-
stop
public void stop(java.lang.String message)
SeeEngine.stop(String)
for details.- Specified by:
stop
in interfaceReportGenerator
- Parameters:
message
- a message for the debug log.
-
getStatistics
@Nonnull public EngineStatistics getStatistics()
SeeEngine.getStatistics()
for details.- Specified by:
getStatistics
in interfaceReportGenerator
- Returns:
- the statistic
-
setUserProperties
public void setUserProperties(java.util.Properties props) throws ReportException
SeeEngine.setUserProperties(Properties)
for details.- Specified by:
setUserProperties
in interfaceReportGenerator
- Parameters:
props
- The data to be set in a Properties object.- Throws:
ReportException
- if Engine is not initialized or finished.
-
setClientLocale
public void setClientLocale(@Nonnull java.util.Locale locale) throws ReportException
SeeEngine.setClientLocale(Locale)
for details.- Specified by:
setClientLocale
in interfaceReportGenerator
- Parameters:
locale
- The locale to be used by the client- Throws:
ReportException
- if Engine is not initialized or finished.
-
stopAfterPage
public void stopAfterPage(int maxPageNo)
SeeEngine.stopAfterPage(int)
for details.- Specified by:
stopAfterPage
in interfaceReportGenerator
- Parameters:
maxPageNo
- The last page that should be rendered. 0 means "unlimited".
-
setPrompt
public void setPrompt(java.lang.String name, java.lang.String prompt) throws ReportException
SeeEngine.setPrompt(String, String)
for details.- Specified by:
setPrompt
in interfaceReportGenerator
- Parameters:
name
- the name of the parameter fieldprompt
- value for parameter field as String- Throws:
ReportException
- if Engine is not initialized or finished.
-
getPromptField
public PromptField getPromptField(java.lang.String name) throws ReportException
SeeEngine.getPromptField(String)
for details.- Specified by:
getPromptField
in interfaceReportGenerator
- Parameters:
name
- name of the prompt to fetch- Returns:
- PromptField by the given name in this Report, or null if none exists
- Throws:
ReportException
- if Engine is not initialized or finished.
-
setPrompt
public void setPrompt(java.lang.String prompt, int i) throws ReportException
NOTE: UnlikeEngine.setPrompt(String, int)
, the number i does not refer to prompt i in any engine, but will count from the first engine onwards. So if there are three engines with five prompts each, i=12 will set the third prompt in the third engine. SeeEngine.setPrompt(String, int)
for details.- Specified by:
setPrompt
in interfaceReportGenerator
- Parameters:
prompt
- value for parameter field ii
- index in the parameter list- Throws:
ReportException
- if Engine is not initialized or finished.
-
-