public interface TableHandler
The main purpose of TableHandler is to create some extra rows in the table based on the current table data object. All logic should be implemented in the method createExtraTableDataObjects(). For example, if you use the TableObjectMediator to populate the MBRREL table for a user. To create one row in this table for the user to its parent relation is not enough. It needs to populate all relations from the user to all ancestors. So in the method createExtraTableDataObjects(), you need to create all extra relations and return them as a list of TableDataObject.
The TableObjectMediator will only create one instance of the implementation class if the same implementation class is specified in more than one places in the TableObjectBuilder configuration. So the createExtraTableDataObjects() method creating extra table data objects should only depend on the input parameters, not the position you defined in the configuration file.
When defining the table handler in the configuration, it can associate with a list of parameters which are name-value pairs. These name value pairs will be passed to the createExtraTableDataObject method as a parameter map.
All implementation classes should extend from the AbstractTableHandler class.
AbstractTableHandler
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM Copyright notice field.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the class to release any resources it used, such as JDBC prepared statements.
|
java.util.List<TableDataObject> |
createExtraTableDataObjects(java.util.Map<java.lang.String,java.lang.String> parameterMap,
ExtendedTableDataObject extendedTableDataObject)
Execute the custom logic to handle the table data object.
|
void |
init()
Initializes the instance, such as creating some prepared statements to access the database.
|
void |
preProcess(ExtendedTableDataObject extendedTableDataObject)
It is called in the TableObjectMediaotr for every line in the CSV file.
|
void |
setDeleteFlag(boolean deleteFlag)
Sets the delete flag.
|
static final java.lang.String COPYRIGHT
void init() throws DataLoadException
DataLoadException
- if there are some errors.void preProcess(ExtendedTableDataObject extendedTableDataObject) throws DataLoadException
extendedTableDataObject
- an extended table data object.DataLoadException
- if there are some errors.java.util.List<TableDataObject> createExtraTableDataObjects(java.util.Map<java.lang.String,java.lang.String> parameterMap, ExtendedTableDataObject extendedTableDataObject) throws DataLoadException
parameterMap
- a parameter map which name-value pairs defined in
the configuration.extendedTableDataObject
- an extended table data object.
This object contains all data which will be loaded into the database.
You can base on the data in this object and create a few more table
data objects to be loaded into database. You may also modify the
data in this object.DataLoadException
- if there are some errors to execute
the custom logic.void setDeleteFlag(boolean deleteFlag)
deleteFlag
- a boolean flag.void close()