Package com.jbstrap.ui.interfaces
Interface Exportable<T extends Fetchable<?>>
- Type Parameters:
T
- Class implementing theFetchable
interface
- All Known Implementing Classes:
ListGrid
public interface Exportable<T extends Fetchable<?>>
This interface is used by classes that implement the
The export process takes place on a separate thread, thus the client can continue working on the main thread. After the successful completion, the exported file is downloaded in the browser. If the connection is lost to the client during the export process, the export process is also interrupted.
The retrieval of records is implemented as a lazy fetch, therefore only chunks of data and not the entire set of records is loaded to the Java side. You can specify the size of these chunks in JBStrap by setting the
You can also specify the maxim number of rows to be exported
Fetchable
interface.
The export function is implemented by applying the Exportable
interface to the specific class. During the export process,
records returned by the method fetch()
are exported
according to the specified parameters. After calling the exportData(Parameters)
method,
the exported file is downloaded to the initiating client. The export process takes place on a separate thread, thus the client can continue working on the main thread. After the successful completion, the exported file is downloaded in the browser. If the connection is lost to the client during the export process, the export process is also interrupted.
The retrieval of records is implemented as a lazy fetch, therefore only chunks of data and not the entire set of records is loaded to the Java side. You can specify the size of these chunks in JBStrap by setting the
JBStrapParamType.EXPORT_FETCH_SIZE
parameter.You can also specify the maxim number of rows to be exported
JBStrapParamType.MAX_EXPORTED_ROW_COUNT
- Since:
- 4.0
- Author:
- JBStrap
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final org.slf4j.Logger
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptiondefault T
exportData
(Parameters params) Exports the data using the settings specified in theParameters
parameter.
-
Field Details
-
LOG
static final org.slf4j.Logger LOG -
CLIENT
- See Also:
-
CRITERIA
- See Also:
-
ORDER
- See Also:
-
COLUMNS
- See Also:
-
EXPORT_TYPE
- See Also:
-
CUSTOM_EXPORTER_CLASS
- See Also:
-
FILENAME
- See Also:
-
ONLY_DISPLAYED_COLUMNS
- See Also:
-
SKIP_UNTITLED_COLUMNS
- See Also:
-
DATE_FORMATS
- See Also:
-
AUTO_SIZE_COLUMNS
- See Also:
-
EXTENSION
- See Also:
-
-
Method Details
-
exportData
Exports the data using the settings specified in theParameters
parameter. This method implements a general file export process by default. A custom export process can be implemented in any class by overwriting this method.
During the export process, data are retrieved using lazy fetch. The number of records in a query can be set by specifying theJBStrapParamType.EXPORT_FETCH_SIZE
. The maximum number of rows to be exported can be specified using theJBStrapParamType.MAX_EXPORTED_ROW_COUNT
parameter.- Parameters:
params
- Parameters to be specified: (asterisk means required):
Parameter name Parameter value Default parameter value Parameter description client* Client
No The client initiating the export process, the exported file is downloaded to this client type ExportTypes
ExportTypes.CSV
Export file type. It is required to specify the type or customExporterClass customExportClass DataExporter
interface implementationNo If this parameter is specified, the type parameter is not processed either. It is required to specify the type or customExporterClass criteria Criteria
No Filter criterion for export data order List< Order
>No Determines the order of data values to be exported; specify multiple order criteria columns* Map<String, String> No Specifies the export fields. Key: field name, value: field label. If this parameter is not specified, the returned query records are used. If the number of records is 0 (no records fulfil the query criteria), an exception is thrown filename String export.unnamed.file message resource by default: Exported file Export file name skipUntitledColumns boolean true
Sets whether unlabeled fields should be included in the export file dateFormats Map<String, String> No In case of date type fields, you can specify the field pattern. Key: field name, value: field pattern. Use the SimpleDateFormat
to process the patternautoSizeColumns boolean false Sets auto column size in the export file - Returns:
- The component
-