Package cdc.impex.api
Interface ImportHandler
-
- All Known Implementing Classes:
AbstractBatchImportHandler,DefaultImportHandler
public interface ImportHandlerInterface implemented by classes that do something with imported data.Typically, it will consist in executing actions and propagate them to a database.
An implementation can support one one several templates.
AsImporteruses one ImportHandler, usefromDelegates(ImportHandler, Function)orfromDelegates(ImportHandler, Map)to compose several ImportHandlers into one.- Author:
- Damien Carbonne
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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.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.static ImportHandlerfromDelegates(ImportHandler def, Function<String,ImportHandler> function)Creates a delegating handler.static ImportHandlerfromDelegates(ImportHandler def, Map<String,ImportHandler> map)Creates a delegating handler.voidimportRow(ImportRow row, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)Invoked to notify the import a row.
-
-
-
Method Detail
-
beginImport
void beginImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Invoked to notify the beginning of import.- 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
void beginSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Invoked to notify the beginning of the import of a sheet.- 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
void importRow(ImportRow row, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Invoked to notify the import a row.- Parameters:
row- The imported row.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
endSheetImport
void endSheetImport(String systemId, String sheetName, SheetTemplate template, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Invoked to notify the end of the import of a sheet.- 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
void endImport(String systemId, cdc.issues.api.IssuesHandler<ImportIssueType> issuesHandler)
Invoked to notify the end of import.- Parameters:
systemId- The system if of the imported data.issuesHandler- The issues handler that should be used by the application to generate new issues.
-
fromDelegates
static ImportHandler fromDelegates(ImportHandler def, Function<String,ImportHandler> function)
Creates a delegating handler.When the import of a sheet starts, an appropriate handler is selected, if possible, among
delegates. If no appropriate handler is found, a default one is used. The default will usually ignore things.- Parameters:
def- The default import handler.
It can beDefaultImportHandler.QUIET,DefaultImportHandler.VERBOSE, or any other valid ImportHandler.function- The function that maps template names to the associated importers.- Returns:
- A new ImportHandler that delegates import if possible, or use the default handler otherwise.
-
fromDelegates
static ImportHandler fromDelegates(ImportHandler def, Map<String,ImportHandler> map)
Creates a delegating handler.- Parameters:
def- The default import handler.
It can beDefaultImportHandler.QUIET,DefaultImportHandler.VERBOSE, or any other valid ImportHandler.map- The map from template names to the associated importers.- Returns:
- A new ImportHandler that delegates import if possible, or use the default handler otherwise.
-
-