Package cdc.impex.api

Class 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 Detail

      • AbstractBatchImportHandler

        protected AbstractBatchImportHandler()
    • 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. If batchSize <= 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)
      • doImportData

        protected abstract void doImportData​(ImportRow row,
                                             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: ImportHandler
        Invoked to notify the beginning of import.
        Specified by:
        beginImport in interface ImportHandler
        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: ImportHandler
        Invoked to notify the beginning of the import of a sheet.
        Specified by:
        beginSheetImport in interface ImportHandler
        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: ImportHandler
        Invoked to notify the import a row.
        Specified by:
        importRow in interface ImportHandler
        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: ImportHandler
        Invoked to notify the end of the import of a sheet.
        Specified by:
        endSheetImport in interface ImportHandler
        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: ImportHandler
        Invoked to notify the end of import.
        Specified by:
        endImport in interface ImportHandler
        Parameters:
        systemId - The system if of the imported data.
        issuesHandler - The issues handler that should be used by the application to generate new issues.