Package com.adaptris.csv.jdbc
Class JdbcUpsertCSV
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.jdbc.JdbcService
-
- com.adaptris.core.services.jdbc.JdbcMapInsert
-
- com.adaptris.core.services.jdbc.JdbcMapUpsert
-
- com.adaptris.csv.jdbc.JdbcUpsertCSV
-
- All Implemented Interfaces:
AdaptrisComponent
,ComponentLifecycle
,ComponentLifecycleExtension
,ConnectedService
,MessageEventGenerator
,Service
,StateManagedComponent
@ComponentProfile(summary="Insert/Update a CSV file into a database", tag="service,csv,jdbc", since="3.6.5") public class JdbcUpsertCSV extends JdbcMapUpsert
Convenience service for inserting/updating records in a database based on a CSV file.firstname, lastname, dob,id alice, smith, 2017-01-01,1234
INSERT INTO table (firstname,lastname,dob,id) VALUES (?,?,?,?)
orUPDATE table SET firstname=?, lastname=?, dob=? WHERE id = ?;
if1234
already exists as a row.Note that no parsing/assertion of the column names will be done, so if they are invalid SQL columns then it's going to be fail.
- Since:
- 3.6.5
In the adapter configuration file this class is aliased as csv-jdbc-batch-insert which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.jdbc.JdbcMapUpsert
JdbcMapUpsert.SelectWrapper, JdbcMapUpsert.UpdateWrapper
-
Nested classes/interfaces inherited from class com.adaptris.core.services.jdbc.JdbcMapInsert
JdbcMapInsert.BasicType, JdbcMapInsert.InsertWrapper, JdbcMapInsert.StatementParam, JdbcMapInsert.StatementWrapper
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.jdbc.JdbcMapUpsert
DEFAULT_ID_FIELD
-
Fields inherited from class com.adaptris.core.ServiceImp
log
-
-
Constructor Summary
Constructors Constructor Description JdbcUpsertCSV()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doService(AdaptrisMessage msg)
PreferenceBuilder
getPreferenceBuilder()
void
setPreferenceBuilder(PreferenceBuilder b)
-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcMapUpsert
getIdField, handleUpsert, idField, setIdField, withId
-
Methods inherited from class com.adaptris.core.services.jdbc.JdbcMapInsert
addUpdatedMetadata, buildStatementParam, closeJdbcService, columnBookend, getColumnBookendCharacter, getFieldMappings, getRowsAffectedMetadataKey, getTable, handleInsert, initJdbcService, prepareService, setColumnBookendCharacter, setFieldMappings, setRowsAffectedMetadataKey, setTable, startService, stopService, table, withColumnBookend, withMappings, withRowsAffectedMetadataKey, withTable
-
Methods inherited from class com.adaptris.core.jdbc.JdbcService
applyTimeout, closeService, createStatement, getConnection, getConnection, getStatementTimeout, initService, prepare, prepareStatement, prepareStatement, setConnection, setStatementTimeout, start, stop
-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
getPreferenceBuilder
public PreferenceBuilder getPreferenceBuilder()
- Returns:
- the PreferenceBuilder
-
setPreferenceBuilder
public void setPreferenceBuilder(PreferenceBuilder b)
- Parameters:
b
- the PreferenceBuilder to set
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
- Throws:
ServiceException
-
-