Klasse EngineRenderData
- Alle implementierten Schnittstellen:
RenderData
RenderData uses a created Engine to provide all render data to the i-net Clear Reports viewer.
When the report viewer requires data, either a new Engine is created if necessary, or an already existing one is used,
and then the data requirement is simply passed on to the Engine.One notable unique characteristic of
EngineRenderData is that it allows you to set your own PropertiesChecker which is used
before rendering to check and handle whichever properties you'd like to create custom behavior for.
See the documentation of the PropertiesChecker interface for more information.
Notes for overriding
- All methods in this class must be thread safe except the methods
getExportChunkCountandgetNextExportChunk. - Each
ReportViewcan have its own instance ofRenderData, so theRenderDatamethods may be called simultaneously for differentReportViews and differentRenderDatainstances.
- Seit:
- 7.0
- Siehe auch:
-
Feldübersicht
FelderVon Schnittstelle geerbte Felder RenderData
CASE_SENSITIVE, REGULAR_EXPRESSION, WHOLE_WORD -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungEngineRenderData(String props) Creates an instance ofEngineRenderData, decoding any properties in theString. -
Methodenübersicht
Modifikator und TypMethodeBeschreibungprotected EnginecheckEngine(Properties props) Constructs a newEngineaccording to the given properties and cache it.
This method does the following: Check if anEnginewith this properties (see props above) already exists. If so, discards it if the call occur fromrefreshPageData(int). If theEnginedoes not exist, it callscreateEngine(exportFormat). It callsengine.execute(). Returns the executedEnginevoidClears the local engine cache of thisEngineRenderData, so that new engines will be created at the next request for report data.protected EnginecreateEngine(Properties props) Creates or load anEngineand set all needed properties.getCopy()"Clones" this RenderData object with all its properties and returns the copy.protected EngineGet theEnginefrom the cache if exists.intgetExportChunkCount(Properties expProps) Returns the total number of export "chunks" for the report for the specified export format.byte[]getFontData(int fontID) Returns the byte array of the embedded font at the specified fontId, which is encoded in the Viewer's protocol.byte[]Returns the group tree which can be sent to the java viewer as a byte array.protected StringgetKey(Properties props) Create a key for the given properties.byte[]Returns the current export chunk.intReturns the number of pages in the report.byte[]getPageData(int page) Returns the binary data of one page for the Java Viewer.Returns the Properties object used by this RenderData object.Returns thePropertiesCheckercurrently set for this render data.Returns the location of the report set by setReportLocation.final StringgetReportProperty(String key) Returns the chosen property value which has been set either via setReportProperty or otherwise.Returns the manually set title of the report if there is one, that is, what would be typically displayed in a title bar, e.g.booleanCheck if the rendering of the report ran into a page limit.booleanReturns the property "promptOnRefresh", that is, whether prompts are to be shown whenever new data is fetched from the server.byte[]refreshPageData(int page) Enforces the whole report to be re-rendered on server side and returns the refreshed binary data of one page for the Java Viewer.voidSince thisRenderDataworks with fully rendered Engines, there is no timeout to reset, therefore the implementation of this method does not need to do anything.byte[]Searches the given phrase in the report, starting at a certain page and using the search options given in the flags.protected EnginesetEngineParams(Engine engine, Properties props) Overrides the properties stored in theEnginewith the properties stored in props.protected EnginesetEngineParams(Engine engine, Properties props, boolean rdc) Overrides the properties stored in theEnginewith the properties stored in props.voidsetPromptOnRefresh(boolean promptOnRefresh) Sets the property "promptOnRefresh", that is, whether prompts are to be shown whenever the report is refreshed, that is, whenever new data is fetched from the server.voidsetPropertiesChecker(PropertiesChecker propChecker) Enables you to set your ownPropertiesCheckerwhich will be used before the rendering process to handle certain properties.voidsetReportLocation(String location) Sets the location of the report which this RenderData is to obtain its data for.voidsetReportProperty(String key, String value) Sets the given property for the report.voidsetReportTitle(String title) Sets the title of the report.voidstop()Stops and cancels the rendering process if one is running.
-
Felddetails
-
isRefresh
protected boolean isRefreshFOR INTERNAL USE ONLY
-
-
Konstruktordetails
-
EngineRenderData
Creates an instance ofEngineRenderData, decoding any properties in theString. An example props string would be: "report=Test.rpt&promptTest=12&promptBlue=Red&promptonrefresh=true"- Parameter:
props- AStringspecifying any properties wanted for the connection, in the form "prop1=value1&prop2=value2&..."- Seit:
- 7.0
-
-
Methodendetails
-
setReportLocation
Sets the location of the report which this RenderData is to obtain its data for. Any properties can be attached to the end using "=" for separating property name and value, and "&" for separating the various properties, e.g. "...&init=pdf&promptABC=test..." The location may not be null.- Angegeben von:
setReportLocationin SchnittstelleRenderData- Parameter:
location- The location at which the report can be found. May not be null. *
-
getReportLocation
Returns the location of the report set by setReportLocation. This will never be null. An uninitialized location will be returned as an empty string.- Angegeben von:
getReportLocationin SchnittstelleRenderData- Gibt zurück:
- Report Location (e.g URL)
- Siehe auch:
-
clearEngineCache
public void clearEngineCache()Clears the local engine cache of thisEngineRenderData, so that new engines will be created at the next request for report data.- Seit:
- 7.0
-
createEngine
Creates or load anEngineand set all needed properties. Do NOT execute theEnginehere!- Parameter:
props- Properties to use for creating the engine.- Gibt zurück:
- the created engine
- Löst aus:
ReportException- if the specified export format is invalid.- Seit:
- 7.0
-
getKey
Create a key for the given properties. The key will be used in aHashTable.- Parameter:
props- Properties to use for creating the engine.- Gibt zurück:
- a key, never null
- Löst aus:
ReportException- If an error occurred during checking the supplied properties with the current PropertiesChecker.- Seit:
- 10.0
-
getEngine
-
checkEngine
Constructs a newEngineaccording to the given properties and cache it.
This method does the following:- Check if an
Enginewith this properties (see props above) already exists. - If so, discards it if the call occur from
refreshPageData(int). - If the
Enginedoes not exist, it callscreateEngine(exportFormat). - It calls
engine.execute(). - Returns the executed
Engine
- Parameter:
props- Properties to use for creating the engine.- Gibt zurück:
- the executed engine
- Löst aus:
ReportException- If:- an error occurred during checking the supplied properties with the current
PropertiesChecker, - if the specified export format is invalid,
- used
Engineis not initialized or finished.
- an error occurred during checking the supplied properties with the current
- Seit:
- 7.0
- Check if an
-
setEngineParams
Overrides the properties stored in theEnginewith the properties stored in props.- Parameter:
engine- The uninitialized reportEngineprops- The stored properties from the request (report=...&prompt<...>=...)- Gibt zurück:
- The initialized
Engine - Löst aus:
RuntimeException- If it could not set the engine properties.- Seit:
- 7.0
-
setEngineParams
Overrides the properties stored in theEnginewith the properties stored in props.- Parameter:
engine- The uninitialized reportEngineprops- The stored properties from the request (report=...&prompt<...>=...)rdc- true if the report should not load because the engine was created with the RDC API.- Gibt zurück:
- The initialized engine
- Löst aus:
RuntimeException- If it could not set the engine properties.- Seit:
- 7.0
-
setPropertiesChecker
Enables you to set your ownPropertiesCheckerwhich will be used before the rendering process to handle certain properties. For example, you could implement the following method in thePropertiesCheckeryou pass here in order to check and handle certain custom properties as you wish:public void checkProperties(Properties reportProperties, Object servletRequest) { String currentReportName; currentReportName = ((String)reportProperties.get("report")).toLowerCase(); // check report name if (currentReportName.indexOf("report1.rpt") != -1) { // change report parameter values // for report1 we change password and the RecordSelectionFormula reportProperties.put("password", "Password"); reportProperties.put("sf", "{List.UserID} = 404"); } else if (currentReportName.indexOf("report2.rpt") != -1) { // change report parameter values // for report2 we set a date in a parameter field reportProperties.put("prompt0", "Date(2000,05,18)"); } else if (currentReportName.indexOf("report3.rpt") != -1) { // change report parameter values // for report3 we change the database // Example: report3 was designed with the ODBC driver // Now we will use this report with the MS SQL Server // To do this we set another Data Source Configuration reportProperties.put("datasource", "SqlServerDataSource"); } }- Parameter:
propChecker- PropertiesChecker to set for this EngineRenderData, may not be null.- Löst aus:
IllegalArgumentException- If propChecker is null- Seit:
- 7.0
- Siehe auch:
-
getPropertiesChecker
Returns thePropertiesCheckercurrently set for this render data. SeesetPropertiesChecker(PropertiesChecker)for more information about properties checkers.- Gibt zurück:
- PropertiesChecker for this RenderData, will never be null.
- Seit:
- 7.0
-
getPageData
Returns the binary data of one page for the Java Viewer. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.- Angegeben von:
getPageDatain SchnittstelleRenderData- Parameter:
page- The number of the page. The first page is 1, the second is 2, ... .
If the page number is not valid (usually meaning the page number is outside the page range), null can be returned.- Gibt zurück:
- The binary data of the page for the Java viewer, or possibly null if page number is not valid.
- Löst aus:
ViewerException- If an exception is returned from the server, it is wrapped in a ViewerException. Often this will be a com.inet.report.ReportException- Siehe auch:
-
getPageCount
Returns the number of pages in the report.
This method is waiting until the rendering process is finished. This is useful if you use i-net Clear Reports with external result sets or connections and you want to know when the rendering process is finished and you can close these external result sets or connections.- Angegeben von:
getPageCountin SchnittstelleRenderData- Gibt zurück:
- number of pages
- Löst aus:
ViewerException- If a problem occurs while rendering the report, the exception is wrapped in a ViewerException- Seit:
- 7.0
- Siehe auch:
-
isPageLimitExceeded
Check if the rendering of the report ran into a page limit. This means does not all possible pages exist.- Angegeben von:
isPageLimitExceededin SchnittstelleRenderData- Gibt zurück:
- true, if there is a limit
- Löst aus:
ViewerException- If there are rendering problems, etc.
-
getNextExportChunk
Returns the current export chunk.
This method returns the current export chunk, with the exception that SVG pages will be changed and a viewer attached.- Angegeben von:
getNextExportChunkin SchnittstelleRenderData- Gibt zurück:
- chunk
- Löst aus:
ViewerException- If an error occurs while rendering the report, the exception is wrapped in a ViewerException- Seit:
- 7.0
- Siehe auch:
-
getExportChunkCount
Returns the total number of export "chunks" for the report for the specified export format.
A "chunk" is a unit of export data which can be retrieved using getNextExportChunk(). This method blocks until the rendering process is finished on the server. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.
In case of gzip compression, the number of chunks can not be determined and "0" is returned. The chunks can be retrieved in a loop until getNextExportChunk() returns NULL.- Angegeben von:
getExportChunkCountin SchnittstelleRenderData- Parameter:
expProps- Properties to be appended to the current report properties for this export. The properties should contain at least the export format with the key "export_fmt". The following formats are valid:
"pdf" - pdf file
"rtf" - rtf file
"xls" - xls file
"csv" - csv file
"ps" - ps file
"xml" -xml file
"htm" - html files, The file name is the base filename, because there are more files with links.
For a complete list of report URL properties see the documentation.- Gibt zurück:
- Total number of export "chunks" (i.e. units) which can be fetched using getNextExportChunk()
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Siehe auch:
-
getGroupTree
Returns the group tree which can be sent to the java viewer as a byte array. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.- Angegeben von:
getGroupTreein SchnittstelleRenderData- Gibt zurück:
- byte[] Group Tree as byte array, encoded by i-net Clear Reports.
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data
-
refreshPageData
Enforces the whole report to be re-rendered on server side and returns the refreshed binary data of one page for the Java Viewer. This page is rendered anew rather than possibly taking a cached version.- Angegeben von:
refreshPageDatain SchnittstelleRenderData- Parameter:
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 the data from the last page will be returned.- Gibt zurück:
- the binary data for the Java Viewer
- Löst aus:
ViewerException- If there are connection problems or other issues while fetching the data- Siehe auch:
-
setReportProperty
Sets the given property for the report. See https://docs.inetsoftware.de/reporting/help/report-url-parameters for a list of possible properties to set here and what they mean.
Setting null as the value will cause the removal of the property. If a prompt property is to be explicitly set to the value "null", simply set the string "formula:null" as the value.- Angegeben von:
setReportPropertyin SchnittstelleRenderData- Parameter:
key- Name of property to set, will be converted to lower casevalue- Value of property to set, null to remove this property
-
getReportProperty
Returns the chosen property value which has been set either via setReportProperty or otherwise.- Angegeben von:
getReportPropertyin SchnittstelleRenderData- Parameter:
key- Name of property to get value for- Gibt zurück:
- Value of property with the given name
-
setPromptOnRefresh
public void setPromptOnRefresh(boolean promptOnRefresh) Sets the property "promptOnRefresh", that is, whether prompts are to be shown whenever the report is refreshed, that is, whenever new data is fetched from the server.- Angegeben von:
setPromptOnRefreshin SchnittstelleRenderData- Parameter:
promptOnRefresh- Value to set for this property
-
isPromptOnRefresh
public boolean isPromptOnRefresh()Returns the property "promptOnRefresh", that is, whether prompts are to be shown whenever new data is fetched from the server.- Angegeben von:
isPromptOnRefreshin SchnittstelleRenderData- Gibt zurück:
- The property "promptOnRefresh"
-
setReportTitle
Sets the title of the report. This title is what would be typically displayed in a title bar, e.g. "Employee Report 2005". Note that if this is not manually set, the title will be whatever the report has set as its title. If a title is set, it overrides the "actual" report title.- Angegeben von:
setReportTitlein SchnittstelleRenderData- Parameter:
title- Title of the report as simple string.
-
getReportTitle
Returns the manually set title of the report if there is one, that is, what would be typically displayed in a title bar, e.g. "Employee Report 2005". This will return null if no title was manually set.- Angegeben von:
getReportTitlein SchnittstelleRenderData- Gibt zurück:
- Title of report
-
getCopy
"Clones" this RenderData object with all its properties and returns the copy. Useful for deriving from existing RenderData objects by copying them and adding or changing properties. This method is called by the viewer for drilling down, for example - the drilldown property is set on the copy while all other properties remain the same, and the copy is used to open a new report view.- Angegeben von:
getCopyin SchnittstelleRenderData- Gibt zurück:
- A cloned copy of this RenderData object with all its properties.
- Siehe auch:
-
getProperties
Returns the Properties object used by this RenderData object. Note this is NOT a clone but rather the exact object used by RenderData - any changes made to this Properties object will influence the RenderData. See https://docs.inetsoftware.de/reporting/help/report-url-parameters for a list of possible properties to set here and what they mean.Note also that any key values should be set in lower case. This Properties object will never be null, at most it will be empty.
- Angegeben von:
getPropertiesin SchnittstelleRenderData- Gibt zurück:
- Properties object used by RenderData, never null
-
stop
public void stop()Stops and cancels the rendering process if one is running. This command ends up being passed through to i-net Clear Reports rendering engine and running Engine.stop.- Angegeben von:
stopin SchnittstelleRenderData
-
search
Searches the given phrase in the report, starting at a certain page and using the search options given in the flags. These flags are:WHOLE_WORD : search only the word in its entirety, not parts of words.
CASE_SENSITIVE : observe upper and lower cases in the search, that is "Search" != "search"
REGULAR_EXPRESSION : The search phrase is to be handled as a regular expression (using Java's Regex methods for the search).Desired flags should be connected by the OR operator "|". So, for example, to search with the flags WHOLE_WORD and CASE_SENSITIVE, simply use WHOLE_WORD | CASE_SENSITIVE as the flags option.
Note that phrases going over more than one page will not be found, nor will text parts with formatting inside the word itself, such as this word. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.
- Angegeben von:
searchin SchnittstelleRenderData- Parameter:
phrase- Word or phrase to search. Should be a regular expression if this flag is set.startPage- Page to start searching on (1-based)flags- Desired search options (see above)- Gibt zurück:
- Search result by the server, encoded in the i-net Clear Reports protocol.
- Siehe auch:
-
getFontData
public byte[] getFontData(int fontID) Returns the byte array of the embedded font at the specified fontId, which is encoded in the Viewer's protocol. You need not and should not call this method yourself - rather the Viewer will call this method on its own when an embedded font needs to be fetched for the report.The fontID is 1-based.
nullwill 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. This method is the mirror method to com.inet.report.Engine.getFontData(int), so implementations can either call that if an engine is available, or a running i-net Clear Reports server also returns the font data with an HTTP request of the form "http://server:9000/?report=report.rpt&export_fmt=font&page=FONTID&cmd=get_pg" where FONTID is replaced with the given font ID. Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other thread-safe methods in RenderData should cause no problems.- Angegeben von:
getFontDatain SchnittstelleRenderData- Parameter:
fontID- ID of font as specified in the i-net Clear Reports protocol- Gibt zurück:
- Partial or whole font with the ID, and with the most current version of this font known to the server.
-
resetServerCacheTimeout
public void resetServerCacheTimeout()Since thisRenderDataworks with fully rendered Engines, there is no timeout to reset, therefore the implementation of this method does not need to do anything.- Angegeben von:
resetServerCacheTimeoutin SchnittstelleRenderData- Löst aus:
ViewerException- always so the viewer only tries once- Seit:
- 7.0
- Siehe auch:
-