Package com.inet.pdfc.presenter
Class JsonSummaryPresenter
java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.JsonSummaryPresenter
- All Implemented Interfaces:
NamedExtension
This presenter creates a summarized JSON result for single and batch comparisons.
- Since:
- i-net PDFC 24.10
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE
-
Field Summary
Fields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionJsonSummaryPresenter
(@Nonnull com.inet.lib.io.SupplierWithIOException<OutputStream> streamProvider) Creates the presenter with a custom export targetJsonSummaryPresenter
(@Nonnull File rootFolder) Creates the presenter with an export target in the root folder -
Method Summary
Modifier and TypeMethodDescription@Nonnull String
Returns the default export file name, consisting of the input folders and the total number of comparisons@Nonnull String
Returns the UNIQUE name of the extension.@Nonnull String
getJson()
Returns the summary result as Jsonvoid
Called to indicate that a comparison has finished.void
onError
(ExceptionData error, boolean interrupted, BasePresenter.ERROR_SOURCE source) Called in case of an error that occurred either in one of the parser threads or in the compare thread.
NOTE: This method is only called for exceptions which are notified to theResultModel
.void
onFinish()
OPTIONAL: Called in case of batch comparison at the end of all comparisons of the batch run.void
onInit()
Called at the time the document informations have been set.spawn
(boolean spawnWithParent) Creates another presenter of the the same type as the current one.Methods inherited from class com.inet.pdfc.presenter.BasePresenter
canInformUserOnErrors, configure, createExportFilename, detachFromModel, executeImmediately, getDefaultExportName, getLastPresenterException, getModel, getParent, getPresenterExceptions, onClear, onDataUpdate, onFilterChange, onProgressUpdate, setModel, setParent
-
Constructor Details
-
JsonSummaryPresenter
Creates the presenter with an export target in the root folder- Parameters:
rootFolder
- the root folder to store the JSON file to- Since:
- i-net PDFC 24.10
-
JsonSummaryPresenter
public JsonSummaryPresenter(@Nonnull @Nonnull com.inet.lib.io.SupplierWithIOException<OutputStream> streamProvider) Creates the presenter with a custom export target- Parameters:
streamProvider
- the provider to get the stream to write the summary to- Since:
- i-net PDFC 24.10
-
-
Method Details
-
onComparisonDone
Called to indicate that a comparison has finished. This does not imply that any page data or differences are available.- Specified by:
onComparisonDone
in classBasePresenter
- Throws:
Exception
- thrown in case the processing of the finish step fails
-
onFinish
public void onFinish()OPTIONAL: Called in case of batch comparison at the end of all comparisons of the batch run. This method cannot be triggered by an event of any referenced result model. It's sole purpose is to serve as a callback for thePDFComparer.batchCompare(java.io.File, java.io.File)
method.
NOTE: This method only called once per batch compare and only for the root presenter, never for spawned ones.- Overrides:
onFinish
in classBasePresenter
-
getJson
Returns the summary result as Json- Returns:
- the summary result as Json
-
onError
Called in case of an error that occurred either in one of the parser threads or in the compare thread.
NOTE: This method is only called for exceptions which are notified to theResultModel
.- Overrides:
onError
in classBasePresenter
- Parameters:
error
- the exceptioninterrupted
- indicates whether the comparison was interrupted due to this exception. Iftrue
there will be no further calls (e.g. onComparisonDone)source
- the source module of the exception.
-
onInit
Called at the time the document informations have been set.- Overrides:
onInit
in classBasePresenter
- Throws:
Exception
- thrown in case the processing of the init step fails
-
spawn
Creates another presenter of the the same type as the current one. The spawned presenter may either have the same settings as the current one or it may be a child of the current one.- Overrides:
spawn
in classBasePresenter
- Parameters:
spawnWithParent
- if true, the presenter is allowed to keep a reference to it's parent to create a summary on onFinish()- Returns:
- a new presenter for the same batch comparison run as the current one
-
getExtensionName
Returns the UNIQUE name of the extension. With UNIQUE referring to 'unique among all implementations of the same interface'- Returns:
- the UNIQUE name of the extension
-
getExportFileName
Returns the default export file name, consisting of the input folders and the total number of comparisons- Returns:
- the default export file name
-