CsvImportExportService

public interface CsvImportExportService

Service for exporting and importing entity data in CSV format. The format is the same for both import and export. Columns are separated by the ‘,’ character. The top row(header row) consists of names of the fields represented by the columns.

Methods

exportCsv

long exportCsv(long entityId, Writer writer)

Exports entity instances to a CSV file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • writer – the writer that will be used for output
Returns:

number of exported instances

exportCsv

long exportCsv(String entityClassName, Writer writer)

Exports entity instances to a CSV file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • writer – the writer that will be used for output
Returns:

number of exported instances

exportCsv

long exportCsv(long entityId, Writer writer, CsvExportCustomizer exportCustomizer)

Exports entity instances to a CSV file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

exportCsv

long exportCsv(String entityClassName, Writer writer, CsvExportCustomizer exportCustomizer)

Exports entity instances to a CSV file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

exportCsv

long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields)

Exports entity instances to a CSV file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportCsv

long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields)

Exports entity instances to a CSV file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportCsv

long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer)

Exports entity instances to a CSV file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportCsv

long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer)

Exports entity instances to a CSV file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • writer – the writer that will be used for output
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

exportPdf

long exportPdf(long entityId, OutputStream outputStream)

Exports entity instances to a PDF file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
Returns:

number of exported instances

exportPdf

long exportPdf(String entityClassName, OutputStream outputStream)

Exports entity instances to a PDF file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
Returns:

number of exported instances

exportPdf

long exportPdf(long entityId, OutputStream outputStream, CsvExportCustomizer exportCustomizer)

Exports entity instances to a PDF file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

exportPdf

long exportPdf(String entityClassName, OutputStream outputStream, CsvExportCustomizer exportCustomizer)

Exports entity instances to a PDF file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • outputStream – the writer that will be used for output
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

exportPdf

long exportPdf(long entityId, OutputStream outputStream, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields)

Exports entity instances to a PDF file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportPdf

long exportPdf(String entityClassName, OutputStream outputStream, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields)

Exports entity instances to a PDF file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportPdf

long exportPdf(long entityId, OutputStream outputStream, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer)

Exports entity instances to a PDF file.

Parameters:
  • entityId – id of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
Returns:

number of exported instances

exportPdf

long exportPdf(String entityClassName, OutputStream outputStream, String lookupName, QueryParams params, List<String> headers, Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer)

Exports entity instances to a PDF file.

Parameters:
  • entityClassName – class name of the entity for which the instances will be exported
  • outputStream – the stream to write the PDF to
  • lookupName – the name of lookup
  • params – query parameters to be used retrieving instances
  • headers – the headers of exported file
  • lookupFields – the lookupFields used in the lookup
  • exportCustomizer – the customizer that will be used during export
Returns:

number of exported instances

importCsv

CsvImportResults importCsv(long entityId, Reader reader, String fileName, boolean continueOnError)

Import instances from a CSV file

Parameters:
  • entityId – id of the entity for which the instances will be imported
  • reader – the reader that will be used for reading the file contents
  • fileName – the name of the CSV file
  • continueOnError – if true, import will continue with next row if exception was encountered, if false, import process will stop and rethrow the exception
Returns:

IDs of instances updated/added during import

importCsv

CsvImportResults importCsv(long entityId, Reader reader, String fileName, CsvImportCustomizer importCustomizer, boolean continueOnError)

Import instances from a CSV file

Parameters:
  • entityId – id of the entity for which the instances will be imported
  • reader – the reader that will be used for reading the file contents
  • fileName – the name of the CSV file
  • importCustomizer – the customizer that will be used during import
  • continueOnError – if true, import will continue with next row if exception was encountered, if false, import process will stop and rethrow the exception
Returns:

IDs of instances updated/added during import

importCsv

CsvImportResults importCsv(String entityClassName, Reader reader, String fileName, boolean continueOnError)

Import instances from a CSV file

Parameters:
  • entityClassName – class name of the entity for which the instances will be imported
  • reader – the reader that will be used for reading the file contents
  • fileName – the name of the CSV file
  • continueOnError – if true, import will continue with next row if exception was encountered, if false, import process will stop and rethrow the exception
Returns:

IDs of instances updated/added during import