public abstract class JdbcMapInsert extends JdbcService
Modifier and Type | Class and Description |
---|---|
static class |
JdbcMapInsert.BasicType
Handles simple type conversions for the fields in the map that needs to be inserted into the DB.
|
class |
JdbcMapInsert.InsertWrapper |
protected static interface |
JdbcMapInsert.StatementParam |
static interface |
JdbcMapInsert.StatementWrapper |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
JdbcMapInsert() |
Modifier and Type | Method and Description |
---|---|
protected JdbcMapInsert.StatementParam |
buildStatementParam(java.lang.String key,
java.lang.String value) |
protected void |
closeJdbcService()
Close the service.
|
protected java.lang.String |
columnBookend() |
java.lang.Character |
getColumnBookendCharacter() |
KeyValuePairSet |
getFieldMappings() |
java.lang.String |
getTable() |
protected void |
handleInsert(java.lang.String tableName,
java.sql.Connection conn,
java.util.Map<java.lang.String,java.lang.String> obj) |
protected void |
initJdbcService() |
protected void |
prepareService() |
void |
setColumnBookendCharacter(java.lang.Character c)
Set the character used to bookend the column names.
|
void |
setFieldMappings(KeyValuePairSet mappings)
Set the converters for various fields in the map.
|
void |
setTable(java.lang.String s) |
protected void |
startService()
Start the service.
|
protected void |
stopService()
Stop the service.
|
protected java.lang.String |
table(AdaptrisMessage msg) |
JdbcMapInsert |
withColumnBookend(java.lang.Character c) |
JdbcMapInsert |
withMappings(KeyValuePairSet s) |
JdbcMapInsert |
withTable(java.lang.String s) |
applyTimeout, closeService, commit, createStatement, getConnection, getConnection, getStatementTimeout, initService, prepare, prepareStatement, prepareStatement, rollback, setConnection, setStatementTimeout, start, stop
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsConfirmation, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isConfirmation, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, rethrowServiceException, retrieveComponentState, setContinueOnFail, setIsConfirmation, setIsTrackingEndpoint, setLookupName, setUniqueId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, doService, isBranching, setUniqueId
createName, createQualifier, isConfirmation, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init
getLookupName
public java.lang.String getTable()
public void setTable(java.lang.String s)
s
- the table to insert on.protected java.lang.String table(AdaptrisMessage msg)
public JdbcMapInsert withTable(java.lang.String s)
public KeyValuePairSet getFieldMappings()
public void setFieldMappings(KeyValuePairSet mappings)
In the event that the database doesn't auto-convert types (e.g. MySQL will convert 2017-01-01
into a DATE if that is
the column type); you can specify the java type that the string should be converted to; if the type cannot be handled
automagically then it is assumed to be a fully qualified classname with a String constructor.
mappings
- the key is the key in the map (e.g. the JSON fieldname), the value is the JdbcMapInsert.BasicType
that we should
attempt to convert toJdbcMapInsert.BasicType
public JdbcMapInsert withMappings(KeyValuePairSet s)
protected JdbcMapInsert.StatementParam buildStatementParam(java.lang.String key, java.lang.String value)
protected void closeJdbcService()
JdbcService
This is called before the connection is closed
closeJdbcService
in class JdbcService
protected void initJdbcService() throws CoreException
initJdbcService
in class JdbcService
CoreException
protected void prepareService() throws CoreException
prepareService
in class JdbcService
CoreException
protected void startService() throws CoreException
JdbcService
This is called after the connection is started
startService
in class JdbcService
CoreException
protected void stopService()
JdbcService
This is called after before the connection is stopped
stopService
in class JdbcService
protected void handleInsert(java.lang.String tableName, java.sql.Connection conn, java.util.Map<java.lang.String,java.lang.String> obj) throws ServiceException
ServiceException
public java.lang.Character getColumnBookendCharacter()
public void setColumnBookendCharacter(java.lang.Character c)
Sometimes you may need to bookend the column names with something like a `
because the names are in fact reserved
words. Specify this as required.
c
- default is null (or no book-ending).public JdbcMapInsert withColumnBookend(java.lang.Character c)
protected java.lang.String columnBookend()