class WorkflowActionBBTasks {

    public void selectBB(DelegateExecution execution) {
        List<ExecuteBuildingBlock> flowsToExecute =
                (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
        execution.setVariable("MacroRollback", false);

        flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
        int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);

        ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);

        execution.setVariable("buildingBlock", ebb);
        currentSequence++;
        execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
        execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
    }

}