From 164ce4f60da615c172ade7b0f8668fc7ad79c284 Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Wed, 18 Feb 2009 20:48:52 +0000 Subject: [PATCH] Changed SkipCheckingListener to use annotations instead of interface. --- .../batch/sample/common/SkipCheckingListener.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java index 520eff7e3..5c42c9ce5 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/common/SkipCheckingListener.java @@ -2,20 +2,24 @@ package org.springframework.batch.sample.common; import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.StepExecutionListener; +import org.springframework.batch.core.annotation.AfterStep; +import org.springframework.batch.core.annotation.BeforeStep; -public class SkipCheckingListener implements StepExecutionListener { +public class SkipCheckingListener { - public ExitStatus afterStep(StepExecution stepExecution) { + @AfterStep + public ExitStatus checkForSkips(StepExecution stepExecution) { if (!stepExecution.getExitStatus().getExitCode().equals(ExitStatus.FAILED.getExitCode()) && stepExecution.getSkipCount() > 0) { return new ExitStatus("COMPLETED WITH SKIPS"); - } else { + } + else { return null; } } - public void beforeStep(StepExecution stepExecution) { + @BeforeStep + public void saveStepName(StepExecution stepExecution) { stepExecution.getExecutionContext().put("stepName", stepExecution.getStepName()); } }