this.aggregator = aggregator;
return this;
}
public Step build() {
PartitionStep step = new PartitionStep();
step.setName(getName());
super.enhance(step);
if (partitionHandler != null) {
step.setPartitionHandler(partitionHandler);
}
else {
TaskExecutorPartitionHandler partitionHandler = new TaskExecutorPartitionHandler();
partitionHandler.setStep(this.step);
if (taskExecutor == null) {
taskExecutor = new SyncTaskExecutor();
}
partitionHandler.setGridSize(gridSize);
partitionHandler.setTaskExecutor(taskExecutor);
step.setPartitionHandler(partitionHandler);
}
if (splitter != null) {
step.setStepExecutionSplitter(splitter);
}
else {
boolean allowStartIfComplete = isAllowStartIfComplete();
String name = stepName;
if (this.step != null) {
try {
allowStartIfComplete = this.step.isAllowStartIfComplete();
name = this.step.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(partitioner);
splitter.setJobRepository(getJobRepository());
splitter.setAllowStartIfComplete(allowStartIfComplete);
splitter.setStepName(name);
this.splitter = splitter;
step.setStepExecutionSplitter(splitter);
}
if (aggregator != null) {
step.setStepExecutionAggregator(aggregator);
}
try {
step.afterPropertiesSet();
}
catch (Exception e) {
throw new StepBuilderException(e);
}