public void run() {
// Can't use iterator in loop because it may cause
// ConcurrentModificationException
List<Step> list = batch.getSteps();
Step step = null;
StepBlock currentBlock = null;
// DBA.
// we need to enable the action button before executing the stp
// otherthise the stop button doesn't be enabled
StateMachine.getInstance()
.transitionTo(modelExecutor.getSuccessState()); // need
// to
// be
// validating
for (int i = 0; i < list.size(); i++) {
step = list.get(i);
try {
// if stop is requested : we stop execution of batch
if (!isStopRequested()) {
if (step.getBlockId() == 0) {
executeStep(step);
} else {
if (currentBlock == null) {
currentBlock = new StepBlock(step
.getBlockIterationCount());
}
currentBlock.addStep(step);
if ((i == list.size() - 1)
|| (step.getBlockId() != list.get(i + 1)
.getBlockId())) {
executeBlock(currentBlock);