Interface Exportable<T extends Fetchable<?>>

Type Parameters:
T - Class implementing the Fetchable interface
All Known Implementing Classes:
ListGrid

public interface Exportable<T extends Fetchable<?>>
This interface is used by classes that implement the 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 Details

  • Method Details

    • exportData

      default T exportData(Parameters params)
      Exports the data using the settings specified in the Parameters 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 the JBStrapParamType.EXPORT_FETCH_SIZE. The maximum number of rows to be exported can be specified using the JBStrapParamType.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 implementation No 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 pattern
      autoSizeColumns boolean false Sets auto column size in the export file
      Returns:
      The component