Package cdc.impex.imports
Class BatchSheetImporter
- java.lang.Object
-
- cdc.impex.imports.BatchSheetImporter
-
- All Implemented Interfaces:
SheetImporter
public class BatchSheetImporter extends Object implements SheetImporter
Utility class that implements SheetImporter, delegating all the work, and adds batch notifications.This class can be used to commit data every batch size rows.
- Author:
- Damien Carbonne
-
-
Field Summary
-
Fields inherited from interface cdc.impex.imports.SheetImporter
QUIET_VOID, VERBOSE_VOID
-
-
Constructor Summary
Constructors Constructor Description BatchSheetImporter(SheetImporter delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbatch()Method that is invoked every batch size data in a sheet, and if necessary when ending the sheet.voidbeginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)Invoked to notify the beginning of the import of a sheet.voidendSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)Invoked to notify the end of the import of a sheet.intgetBatchSize()SheetImportergetDelegate()voidimportRow(ImportRow row, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)Invoked to notify the import a row.BatchSheetImportersetBatchSize(int batchSize)Sets the batch size.
-
-
-
Constructor Detail
-
BatchSheetImporter
public BatchSheetImporter(SheetImporter delegate)
-
-
Method Detail
-
getDelegate
public SheetImporter getDelegate()
-
getBatchSize
public final int getBatchSize()
-
setBatchSize
public BatchSheetImporter setBatchSize(int batchSize)
Sets the batch size.WARNING: MUST not be called during execution.
- Parameters:
batchSize- The batch size. IfbatchSize <= 0, batch is never called.- Returns:
- This object.
- Throws:
AssertionError- If this method is called during execution.
-
batch
public void batch()
Method that is invoked every batch size data in a sheet, and if necessary when ending the sheet.Its default implementation does nothing and should be overridden.
-
beginSheetImport
public final void beginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
Description copied from interface:SheetImporterInvoked to notify the beginning of the import of a sheet.- Specified by:
beginSheetImportin interfaceSheetImporter- Parameters:
systemId- The system if of the imported data.sheetName- The sheet name.template- The sheet template associated to this import.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
importRow
public final void importRow(ImportRow row, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
Description copied from interface:SheetImporterInvoked to notify the import a row.- Specified by:
importRowin interfaceSheetImporter- Parameters:
row- The imported row.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
endSheetImport
public final void endSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.IssuesHandler<cdc.issues.Issue> issuesHandler)
Description copied from interface:SheetImporterInvoked to notify the end of the import of a sheet.- Specified by:
endSheetImportin interfaceSheetImporter- Parameters:
systemId- The system if of the imported data.sheetName- The sheet name.template- The sheet template associated to this import.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
-