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

      • BatchSheetImporter

        public BatchSheetImporter​(SheetImporter delegate)
    • Method Detail

      • 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. If batchSize <= 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: SheetImporter
        Invoked to notify the beginning of the import of a sheet.
        Specified by:
        beginSheetImport in interface SheetImporter
        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: SheetImporter
        Invoked to notify the import a row.
        Specified by:
        importRow in interface SheetImporter
        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: SheetImporter
        Invoked to notify the end of the import of a sheet.
        Specified by:
        endSheetImport in interface SheetImporter
        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.