Package com.inet.report.cache.store
Class CachedOutput
java.lang.Object
com.inet.report.cache.store.CachedOutput
- All Implemented Interfaces:
DocumentOutput
,Comparable<CachedOutput>
Implementation of DocumentOutput that saves in the report cache.
- Since:
- 16.2
-
Constructor Summary
ConstructorDescriptionCachedOutput
(ReportCacheKey key, ReportGenerator engine) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFontData
(byte[] fontData) Add the data for an embedded font.void
addPage
(byte[] page) Add a page/chunk.void
clear()
Reset this output in the initial state.int
Get the Engine/EngineBundle that produce the data for this output.int
Get the count of added fonts.byte[]
getFontData
(int idx) Get the font data from the given index.byte[]
Get the data of the group tree.getKey()
Get the key of this DocumentOutput.int
Get the current count of pages.byte[]
getPageData
(int idx) Get the binary data of a page/chunk.boolean
Check if the rendering of the report ran into a page limit.void
setErrorData
(byte[] error) Set error data.void
setFontData
(byte[] fontData, int idx) Override the font data with a new version.void
setGroupTree
(byte[] data) Set the group tree.void
setPageData
(byte[] page, int idx) Override/patched an existing page/chunk.void
Set that a PageLimitException exception occur.void
Set that a total page is used in the report.void
The rendering was stopped.
-
Constructor Details
-
CachedOutput
Create a new instance.- Parameters:
key
- the report keyengine
- the related Engine- Since:
- 16.2
-
-
Method Details
-
getPageCount
public int getPageCount()Get the current count of pages.- Specified by:
getPageCount
in interfaceDocumentOutput
- Returns:
- the page count
-
clear
public void clear()Reset this output in the initial state. So getPageCount() == 0 and getFontCount() == 0.- Specified by:
clear
in interfaceDocumentOutput
-
getPageData
Get the binary data of a page/chunk.- Specified by:
getPageData
in interfaceDocumentOutput
- Parameters:
idx
- the index, starts with 1- Returns:
- the data, never null
- Throws:
ArrayIndexOutOfBoundsException
- if index is out of range
-
getGroupTree
public byte[] getGroupTree()Get the data of the group tree.- Specified by:
getGroupTree
in interfaceDocumentOutput
- Returns:
- Can be null, if not set.
-
addPage
Add a page/chunk. IncrementDocumentOutput.getPageCount()
- Specified by:
addPage
in interfaceDocumentOutput
- Parameters:
page
- the binary data, never null- Throws:
IllegalStateException
- if this output is finish or stopped.
-
setPageData
Override/patched an existing page/chunk.- Specified by:
setPageData
in interfaceDocumentOutput
- Parameters:
page
- die binary data, never nullidx
- the index, starts with 1- Throws:
IllegalStateException
- if this output is finish or stopped.
-
setGroupTree
Set the group tree. After this call this output is finish and any try to change this object should throw an exception. This call does not changeDocumentOutput.getPageCount()
.- Specified by:
setGroupTree
in interfaceDocumentOutput
- Parameters:
data
- the binary data, never null, but can be an empty array- Throws:
IllegalStateException
- if this output is finish or stopped.
-
setErrorData
Set error data. After this call this output is finish and any try to change this object should throw an exception.- Specified by:
setErrorData
in interfaceDocumentOutput
- Parameters:
error
- serialized Exception- Throws:
IllegalStateException
- if this output is finish or stopped.
-
stop
The rendering was stopped. This is called from Engine.stop(). After this call any try to change this object should throw an exception.- Specified by:
stop
in interfaceDocumentOutput
- Parameters:
cause
- an optional message
-
addFontData
Add the data for an embedded font. IncrementDocumentOutput.getFontCount()
. This method is only used from the Java/C# output format.- Specified by:
addFontData
in interfaceDocumentOutput
- Parameters:
fontData
- binary data in the current protocol format.- Throws:
IllegalStateException
- if this output is finish or stopped.
-
setFontData
Override the font data with a new version.- Specified by:
setFontData
in interfaceDocumentOutput
- Parameters:
fontData
- binary data in the current protocol format.idx
- the index, starts with 0- Throws:
IllegalStateException
- if this output is finish or stopped.
-
getFontData
Get the font data from the given index.- Specified by:
getFontData
in interfaceDocumentOutput
- Parameters:
idx
- the index, starts with 0- Returns:
- the font data, never null
- Throws:
ArrayIndexOutOfBoundsException
- if index is out of range
-
getFontCount
public int getFontCount()Get the count of added fonts.- Specified by:
getFontCount
in interfaceDocumentOutput
- Returns:
- the font count
-
setPageLimitExceeded
public void setPageLimitExceeded()Set that a PageLimitException exception occur.- Specified by:
setPageLimitExceeded
in interfaceDocumentOutput
-
isPageLimitExceeded
public boolean isPageLimitExceeded()Check if the rendering of the report ran into a page limit. This means does not all possible pages exist.- Specified by:
isPageLimitExceeded
in interfaceDocumentOutput
- Returns:
- true, if PageLimitException was occur
-
setUsingTotalPage
public void setUsingTotalPage()Set that a total page is used in the report.- Specified by:
setUsingTotalPage
in interfaceDocumentOutput
-
getKey
Get the key of this DocumentOutput.- Returns:
- the key
- Since:
- 16.3
-
getEngine
Get the Engine/EngineBundle that produce the data for this output.- Returns:
- the engine
- Since:
- 16.2
-
compareTo
- Specified by:
compareTo
in interfaceComparable<CachedOutput>
-