Package cdc.impex.api
Class AbstractBatchImportHandler
- java.lang.Object
-
- cdc.impex.api.AbstractBatchImportHandler
-
- All Implemented Interfaces:
ImportHandler
public abstract class AbstractBatchImportHandler extends Object implements ImportHandler
Utility class that can be used to implement an ImportHandler and adds batch notifications.This class can be used to commit data every batch size rows.
- Author:
- Damien Carbonne
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBatchImportHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbeginImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the beginning of import.voidbeginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the beginning of the import of a sheet.protected abstract voiddoBatch()Method that is invoked every batch size data in a sheet, and if necessary when ending the sheet.protected abstract voiddoBeginImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)protected abstract voiddoBeginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)protected abstract voiddoEndImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)protected abstract voiddoEndSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)protected abstract voiddoImportData(ImportRow row, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)voidendImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the end of import.voidendSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the end of the import of a sheet.intgetBatchSize()voidimportRow(ImportRow row, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the import a row.voidsetBatchSize(int batchSize)Sets the batch size.
-
-
-
Method Detail
-
getBatchSize
public final int getBatchSize()
-
setBatchSize
public final void 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.- Throws:
AssertionError- If this method is called during execution.
-
doBeginImport
protected abstract void doBeginImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
-
doBeginSheetImport
protected abstract void doBeginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
-
doImportData
protected abstract void doImportData(ImportRow row, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
-
doEndSheetImport
protected abstract void doEndSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
-
doEndImport
protected abstract void doEndImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
-
doBatch
protected abstract void doBatch()
Method that is invoked every batch size data in a sheet, and if necessary when ending the sheet.
-
beginImport
public final void beginImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Description copied from interface:ImportHandlerInvoked to notify the beginning of import.- Specified by:
beginImportin interfaceImportHandler- Parameters:
systemId- The system if of the imported data.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
beginSheetImport
public final void beginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Description copied from interface:ImportHandlerInvoked to notify the beginning of the import of a sheet.- Specified by:
beginSheetImportin interfaceImportHandler- 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.api.IssuesHandler<ImportIssueType> issuesHandler)
Description copied from interface:ImportHandlerInvoked to notify the import a row.- Specified by:
importRowin interfaceImportHandler- 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.api.IssuesHandler<ImportIssueType> issuesHandler)
Description copied from interface:ImportHandlerInvoked to notify the end of the import of a sheet.- Specified by:
endSheetImportin interfaceImportHandler- 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.
-
endImport
public final void endImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Description copied from interface:ImportHandlerInvoked to notify the end of import.- Specified by:
endImportin interfaceImportHandler- Parameters:
systemId- The system if of the imported data.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
-