return this;
}
@Override
public Step build() {
PartitionStep step = new PartitionStep();
step.setName(getName());
super.enhance(step);
if (getPartitionHandler() != null) {
step.setPartitionHandler(getPartitionHandler());
}
else {
TaskExecutorPartitionHandler partitionHandler = new TaskExecutorPartitionHandler();
partitionHandler.setStep(getStep());
if (getTaskExecutor() == null) {
taskExecutor(new SyncTaskExecutor());
}
partitionHandler.setGridSize(getGridSize());
partitionHandler.setTaskExecutor(getTaskExecutor());
step.setPartitionHandler(partitionHandler);
}
if (getSplitter() != null) {
step.setStepExecutionSplitter(getSplitter());
}
else {
boolean allowStartIfComplete = isAllowStartIfComplete();
String name = getStepName();
if (getStep() != null) {
try {
allowStartIfComplete = getStep().isAllowStartIfComplete();
name = getStep().getName();
}
catch (Exception e) {
logger.info("Ignored exception from step asking for name and allowStartIfComplete flag. "
+ "Using default from enclosing PartitionStep (" + name + "," + allowStartIfComplete + ").");
}
}
SimpleStepExecutionSplitter splitter = new SimpleStepExecutionSplitter();
splitter.setPartitioner(getPartitioner());
splitter.setJobRepository(getJobRepository());
splitter.setAllowStartIfComplete(allowStartIfComplete);
splitter.setStepName(name);
splitter(splitter);
step.setStepExecutionSplitter(splitter);
}
if (getAggregator() != null) {
step.setStepExecutionAggregator(getAggregator());
}
if(reducer != null) {
step.setPartitionReducer(reducer);
}
try {
step.afterPropertiesSet();
}
catch (Exception e) {
throw new StepBuilderException(e);
}