Package cdc.impex.api
Interface ImportHandler
-
- All Known Implementing Classes:
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 voidbeginSheetImport(String systemId, String sheetName, SheetTemplate template)Invoked to notify the beginning of the import of a sheet.voidendSheetImport(String systemId, String sheetName, SheetTemplate template)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.voidimportData(ImportRow data)Invoked to notify the import a a data row.
-
-
-
Method Detail
-
beginSheetImport
void beginSheetImport(String systemId, String sheetName, SheetTemplate template)
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.
-
importData
void importData(ImportRow data)
Invoked to notify the import a a data row.- Parameters:
data- The imported data row.
-
endSheetImport
void endSheetImport(String systemId, String sheetName, SheetTemplate template)
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.
-
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.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.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.
-
-