Example usage for org.springframework.batch.core.step AbstractStep setAllowStartIfComplete

List of usage examples for org.springframework.batch.core.step AbstractStep setAllowStartIfComplete

Introduction

In this page you can find the example usage for org.springframework.batch.core.step AbstractStep setAllowStartIfComplete.

Prototype

public void setAllowStartIfComplete(boolean allowStartIfComplete) 

Source Link

Document

Public setter for flag that determines whether the step should start again if it is already complete.

Usage

From source file:org.springframework.batch.core.configuration.xml.StepParserStepFactoryBean.java

private void configureAbstractStep(AbstractStep ts) {
    if (name != null) {
        ts.setName(name);/* ww w. ja  v  a  2  s. co  m*/
    }
    if (allowStartIfComplete != null) {
        ts.setAllowStartIfComplete(allowStartIfComplete);
    }
    if (jobRepository != null) {
        ts.setJobRepository(jobRepository);
    }
    if (startLimit != null) {
        ts.setStartLimit(startLimit);
    }
    if (listeners != null) {
        List<StepExecutionListener> newListeners = new ArrayList<StepExecutionListener>();
        for (StepListener listener : listeners) {
            if (listener instanceof StepExecutionListener) {
                newListeners.add((StepExecutionListener) listener);
            }
        }
        ts.setStepExecutionListeners(newListeners.toArray(new StepExecutionListener[0]));
    }
}

From source file:org.springframework.batch.core.step.builder.StepBuilderHelper.java

protected void enhance(Step target) {

    if (target instanceof AbstractStep) {

        AbstractStep step = (AbstractStep) target;
        step.setJobRepository(properties.getJobRepository());

        Boolean allowStartIfComplete = properties.allowStartIfComplete;
        if (allowStartIfComplete != null) {
            step.setAllowStartIfComplete(allowStartIfComplete);
        }/*from   ww  w  .java2  s  .com*/

        step.setStartLimit(properties.startLimit);

        List<StepExecutionListener> listeners = properties.stepExecutionListeners;
        if (!listeners.isEmpty()) {
            step.setStepExecutionListeners(listeners.toArray(new StepExecutionListener[0]));
        }

    }

    if (target instanceof TaskletStep) {
        TaskletStep step = (TaskletStep) target;
        step.setTransactionManager(properties.transactionManager);
    }

}