com.groiss.fileimport
Class ImportHandler

java.lang.Object
  extended by com.groiss.fileimport.ImportHandler

public abstract class ImportHandler
extends java.lang.Object

Abstract class for defining a import handler.


Constructor Summary
ImportHandler()
           
 
Method Summary
 void afterImport(java.util.Map<java.lang.String,java.lang.Object> m, Persistent o)
          called after importing a row
 boolean beforeImport(java.util.Map<java.lang.String,java.lang.Object> m, java.util.Map<java.lang.String,java.lang.Object> ext)
          called after reading a row
 boolean beforeInsert(java.util.Map<java.lang.String,java.lang.Object> m, Persistent o)
           
 boolean beforeUpdate(java.util.Map<java.lang.String,java.lang.Object> m, Persistent o)
           
 Persistent getExistingObject(java.lang.Object key, java.util.Map<java.lang.String,java.lang.Object> values, java.util.Map<java.lang.Object,Persistent> cache)
          should return the corresponding Persistent object for the current datarow.
 java.lang.Object getKey(java.util.Map<java.lang.String,java.lang.Object> map)
          will be called if the keyField property isn't set
 java.lang.Object getKey(Persistent o)
          will be called if the keyField property isn't set
 void prepareFile(java.io.File f)
          use this if you want to modify the file first
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportHandler

public ImportHandler()
Method Detail

beforeInsert

public boolean beforeInsert(java.util.Map<java.lang.String,java.lang.Object> m,
                            Persistent o)
Parameters:
m - the map with all the data
o - the object which will be inserted
Returns:
true if object shoul be inserted, false otherwise

beforeUpdate

public boolean beforeUpdate(java.util.Map<java.lang.String,java.lang.Object> m,
                            Persistent o)
Parameters:
m - the map with all the data
o - the object which will be updated
Returns:
true if object shoul be updated, false otherwise

getKey

public java.lang.Object getKey(java.util.Map<java.lang.String,java.lang.Object> map)
will be called if the keyField property isn't set

Parameters:
map - the map with all the data
Returns:
the identifier for the given datarow

getKey

public java.lang.Object getKey(Persistent o)
will be called if the keyField property isn't set

Parameters:
o - the object
Returns:
the key for the given object

beforeImport

public boolean beforeImport(java.util.Map<java.lang.String,java.lang.Object> m,
                            java.util.Map<java.lang.String,java.lang.Object> ext)
called after reading a row

Parameters:
m - the data for this row
ext - the extended data
Returns:
true if import should continue, false otheriwse

afterImport

public void afterImport(java.util.Map<java.lang.String,java.lang.Object> m,
                        Persistent o)
called after importing a row

Parameters:
m - the data map
o - the imported object

prepareFile

public void prepareFile(java.io.File f)
use this if you want to modify the file first

Parameters:
f - the file

getExistingObject

public Persistent getExistingObject(java.lang.Object key,
                                    java.util.Map<java.lang.String,java.lang.Object> values,
                                    java.util.Map<java.lang.Object,Persistent> cache)
should return the corresponding Persistent object for the current datarow.

Parameters:
key - the key for the object either from keyField or getKey(Map)
values - the values of the current row
cache - the cached targetClass-objects
Returns:
the existing object


@enterprise 8.0.22989 Copyright © 2001-2017 Groiss Informatics GmbH. All Rights Reserved.