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 EngineaddReportFile(java.lang.String reportUrl)Add a new report template to this bundle and creates an engine.voidexecute()SeeEngine.execute()for details.EnginegetEngine0()Get the first Engine from the bundle list.java.util.List<Engine>getEngines()Get all Engines of this bundle.intgetPageCount()SeeEngine.getPageCount()for details.byte[]getPageData(int page)SeeEngine.getPageData(int)for details.PromptFieldgetPromptField(java.lang.String name)SeeEngine.getPromptField(String)for details.EngineStatisticsgetStatistics()SeeEngine.getStatistics()for details.voidsetClientLocale(java.util.Locale locale)SeeEngine.setClientLocale(Locale)for details.voidsetDocumentOutput(DocumentOutput documentOutput)Set the output location for the rendered data.voidsetPrompt(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.voidsetPrompt(java.lang.String name, java.lang.String prompt)SeeEngine.setPrompt(String, String)for details.voidsetUserProperties(java.util.Properties props)SeeEngine.setUserProperties(Properties)for details.voidstop(java.lang.String message)SeeEngine.stop(String)for details.voidstopAfterPage(int maxPageNo)SeeEngine.stopAfterPage(int)for details.
-
-
-
Constructor Detail
-
EngineBundle
public EngineBundle(java.lang.String format) throws ReportExceptionCreate 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:
setDocumentOutputin interfaceReportGenerator- Parameters:
documentOutput- The location for the data. This can be DocumentOutputStream or CachedOutput.
-
execute
public void execute() throws ReportExceptionSeeEngine.execute()for details.- Specified by:
executein 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 ReportExceptionSeeEngine.getPageCount()for details.- Specified by:
getPageCountin interfaceReportGenerator- Returns:
- number of pages or chunks
- Throws:
ReportException- If rendering the report encounters a problem
-
getPageData
public byte[] getPageData(int page) throws ReportExceptionSeeEngine.getPageData(int)for details.- Specified by:
getPageDatain 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:
stopin interfaceReportGenerator- Parameters:
message- a message for the debug log.
-
getStatistics
@Nonnull public EngineStatistics getStatistics()
SeeEngine.getStatistics()for details.- Specified by:
getStatisticsin interfaceReportGenerator- Returns:
- the statistic
-
setUserProperties
public void setUserProperties(java.util.Properties props) throws ReportExceptionSeeEngine.setUserProperties(Properties)for details.- Specified by:
setUserPropertiesin 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 ReportExceptionSeeEngine.setClientLocale(Locale)for details.- Specified by:
setClientLocalein 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:
stopAfterPagein 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 ReportExceptionSeeEngine.setPrompt(String, String)for details.- Specified by:
setPromptin 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:
getPromptFieldin 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 ReportExceptionNOTE: 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:
setPromptin interfaceReportGenerator- Parameters:
prompt- value for parameter field ii- index in the parameter list- Throws:
ReportException- if Engine is not initialized or finished.
-
-