Package com.groiss.fileimport
Interface FileImportHandler<T extends Persistent>
- All Known Implementing Classes:
ImportHandler
public interface FileImportHandler<T extends Persistent>
Abstract class for defining a import handler.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterImport
(Map<String, Object> m, T o) called after importing a rowdefault boolean
called after reading a rowdefault boolean
beforeInsert
(Map<String, Object> m, T o) default boolean
beforeUpdate
(Map<String, Object> m, T o) default Persistent
should return the correspondingPersistent
object for the current data row.default Object
will be called if the keyField property isn't setdefault Object
will be called if the keyField property isn't setdefault String
Called after import is done.default void
init
(ImportContext ctx) called before any work startsdefault void
prepareFile
(File f) use this if you want to modify the file first
-
Method Details
-
init
called before any work starts- Parameters:
ctx
- contains information about the current context
-
beforeInsert
- Parameters:
m
- the map with all the datao
- the object which will be inserted- Returns:
true
if object should be inserted,false
otherwise
-
beforeUpdate
- Parameters:
m
- the map with all the datao
- the object which will be updated- Returns:
true
if object should be updated,false
otherwise
-
getKey
will be called if the keyField property isn't set- Parameters:
map
- the map with all the data- Returns:
- the identifier for the given data row
-
getKey
will be called if the keyField property isn't set- Parameters:
o
- the object- Returns:
- the key for the given object
-
beforeImport
called after reading a row- Parameters:
m
- the data for this rowext
- the extended data- Returns:
true
if import should continue,false
otherwise
-
afterImport
called after importing a row- Parameters:
m
- the data mapo
- the imported object
-
prepareFile
use this if you want to modify the file first- Parameters:
f
- the file
-
getExistingObject
should return the correspondingPersistent
object for the current data row.- Parameters:
key
- the key for the object either fromkeyField
orgetKey(Map)
values
- the values of the current rowcache
- the cachedtargetClass
-objects- Returns:
- the existing object
-
importCompleted
Called after import is done. May do some cleanup, return a message for the page.
-