public class StagingItemWriter<T> extends org.springframework.jdbc.core.support.JdbcDaoSupport implements StepExecutionListener, ItemWriter<T>
ItemWriter
implementing the process indicator pattern.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
DONE |
protected static java.lang.String |
NEW |
Constructor and Description |
---|
StagingItemWriter() |
Modifier and Type | Method and Description |
---|---|
ExitStatus |
afterStep(StepExecution stepExecution)
Give a listener a chance to modify the exit status from a step.
|
void |
beforeStep(StepExecution stepExecution)
Initialize the state of the listener with the
StepExecution from
the current scope. |
protected void |
initDao()
Check mandatory properties.
|
void |
setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
Setter for the key generator for the staging table.
|
void |
write(java.util.List<? extends T> items)
Serialize the item to the staging table, and add a NEW processed flag.
|
protected static final java.lang.String NEW
protected static final java.lang.String DONE
protected void initDao() throws java.lang.Exception
initDao
in class org.springframework.dao.support.DaoSupport
java.lang.Exception
DaoSupport.initDao()
public void setIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer incrementer)
incrementer
- the DataFieldMaxValueIncrementer
to setpublic void write(java.util.List<? extends T> items)
write
in interface ItemWriter<T>
items
- items to be writtenItemWriter.write(java.util.List)
public ExitStatus afterStep(StepExecution stepExecution)
StepExecutionListener
ExitStatus.and(ExitStatus)
.
Called after execution of step's processing logic (both successful or
failed). Throwing exception in this method has no effect, it will only be
logged.afterStep
in interface StepExecutionListener
stepExecution
- StepExecution
instance.ExitStatus
to combine with the normal value. Return
null
to leave the old value unchanged.public void beforeStep(StepExecution stepExecution)
StepExecutionListener
StepExecution
from
the current scope.beforeStep
in interface StepExecutionListener
stepExecution
- instance of StepExecution
.