public abstract class AbstractJdbcWriter
extends org.apache.uima.collection.CasConsumer_ImplBase
Modifier and Type | Class and Description |
---|---|
protected static interface |
AbstractJdbcWriter.FieldInfo |
protected static interface |
AbstractJdbcWriter.TableInfo |
protected static class |
AbstractJdbcWriter.TableSqlInfo |
Modifier and Type | Field and Description |
---|---|
protected Map<String,AbstractJdbcWriter.TableSqlInfo> |
_tableSqlInfoMap |
static String |
PARAM_DB_CONN_RESRC |
Constructor and Description |
---|
AbstractJdbcWriter() |
Modifier and Type | Method and Description |
---|---|
void |
collectionProcessComplete(org.apache.uima.util.ProcessTrace arg0)
closes the PreparedStatements
|
protected static String |
createRowInsertSql(String tableName,
AbstractJdbcWriter.FieldInfo... fieldInfos) |
protected abstract Collection<AbstractJdbcWriter.TableInfo> |
getTableInfos()
Called from initialize()
|
protected Map<String,AbstractJdbcWriter.TableSqlInfo> |
getTableSqlInfoMap() |
void |
initialize() |
void |
processCas(org.apache.uima.cas.CAS aCAS) |
protected static void |
setFieldInfoValue(Map<AbstractJdbcWriter.FieldInfo,Object> fieldInfoMap,
AbstractJdbcWriter.FieldInfo fieldInfo,
Object value)
This is a safety method to set values of fieldInfoMaps instead of doing a direct .put in the map.
|
protected abstract void |
writeJCasInformation(org.apache.uima.jcas.JCas jcas,
int encounterNum,
long patientNum,
String providerId,
Timestamp startDate)
The main "process" method, called from processCas
|
protected static int |
writeTableRow(PreparedStatement preparedStatement,
int batchSize,
Map<? extends AbstractJdbcWriter.FieldInfo,Object> fieldInfoMap)
Adds a new row of values to a batch in the prepared statement.
|
batchProcessComplete, destroy, getProcessingResourceMetaData, initialize, isReadOnly, isStateless, processCas, reconfigure, typeSystemInit
getConfigParameterValue, getConfigParameterValue, setConfigParameterValue, setConfigParameterValue
getCasManager, getLogger, getMetaData, getResourceManager, getUimaContext, getUimaContextAdmin, setLogger, setMetaData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public static final String PARAM_DB_CONN_RESRC
protected final Map<String,AbstractJdbcWriter.TableSqlInfo> _tableSqlInfoMap
public void initialize() throws org.apache.uima.resource.ResourceInitializationException
initialize
in class org.apache.uima.collection.CasConsumer_ImplBase
org.apache.uima.resource.ResourceInitializationException
public void collectionProcessComplete(org.apache.uima.util.ProcessTrace arg0) throws org.apache.uima.resource.ResourceProcessException, IOException
collectionProcessComplete
in interface org.apache.uima.collection.base_cpm.CasProcessor
collectionProcessComplete
in class org.apache.uima.collection.CasConsumer_ImplBase
org.apache.uima.resource.ResourceProcessException
IOException
public void processCas(org.apache.uima.cas.CAS aCAS) throws org.apache.uima.resource.ResourceProcessException
org.apache.uima.resource.ResourceProcessException
protected abstract Collection<AbstractJdbcWriter.TableInfo> getTableInfos()
protected abstract void writeJCasInformation(org.apache.uima.jcas.JCas jcas, int encounterNum, long patientNum, String providerId, Timestamp startDate) throws SQLException
jcas
- -encounterNum
- -patientNum
- -providerId
- -startDate
- -SQLException
- if implementations throw SQLExceptionprotected Map<String,AbstractJdbcWriter.TableSqlInfo> getTableSqlInfoMap()
protected static void setFieldInfoValue(Map<AbstractJdbcWriter.FieldInfo,Object> fieldInfoMap, AbstractJdbcWriter.FieldInfo fieldInfo, Object value)
fieldInfoMap
- map in which to set the valuefieldInfo
- keyvalue
- valueprotected static int writeTableRow(PreparedStatement preparedStatement, int batchSize, Map<? extends AbstractJdbcWriter.FieldInfo,Object> fieldInfoMap) throws SQLException
preparedStatement
- -batchSize
- the current batch row count in the prepared statementfieldInfoMap
- for row value assignmentSQLException
- if a PreparedStatement call throws one or if there is a type, value mismatch in fieldInfoMapprotected static String createRowInsertSql(String tableName, AbstractJdbcWriter.FieldInfo... fieldInfos) throws SQLDataException
tableName
- -fieldInfos
- -SQLDataException
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.