i did something like this to update the status of my step. i hope it helps you....
Code:
public class PostProcessingCheckListener extends StepExecutionListenerSupport
implements StepExecutionListener {
public ExitStatus afterStep(StepExecution stepExecution) {
ExitStatus statusAfterStep = super.afterStep(stepExecution);
ExitStatus status = stepExecution.getExitStatus();
//if super() has status, we should take it into consideration.
//else, just use status from stepExecution
if (statusAfterStep != null) {
status = status.and(statusAfterStep);
}
/**
* assert: read count = write count + 1
* - this is b/c the footer is read and skipped.
*/
if (stepExecution.getReadCount() != stepExecution.getWriteCount() + 1) {
status = status.and(new ExitStatus(ExitStatus.FAILED.getExitCode(),"transaction readCount != writeCount + 1. something did not get inserted. check log files."));
}
return status;
}
}