private List < IWorkflow > splitWorkflowDispatchedSections ( IWorkflow workflow ) throws ExecutionServiceException { ArrayList < StepExecutionItem > dispatchItems = new ArrayList <> ( ) ; ArrayList < IWorkflow > sections = new ArrayList <> ( ) ; for ( final StepExecutionItem item : workflow . getCommands ( ) ) { StepExecutor executor = getFramework ( ) . getStepExecutionService ( ) . getExecutorForItem ( item ) ; if ( executor . isNodeDispatchStep ( item ) ) { dispatchItems . add ( item ) ; } else { if ( dispatchItems . size ( ) > 0 ) { //add workflow section sections . add ( new WorkflowImpl ( dispatchItems , workflow . getThreadcount ( ) , workflow . isKeepgoing ( ) , workflow . getStrategy ( ) ) ) ; dispatchItems = new ArrayList <> ( ) ; } sections . add ( new WorkflowImpl ( Collections . singletonList ( item ) , workflow . getThreadcount ( ) , workflow . isKeepgoing ( ) , workflow . getStrategy ( ) ) ) ; } } if ( null != dispatchItems && dispatchItems . size ( ) > 0 ) { //add workflow section sections . add ( new WorkflowImpl ( dispatchItems , workflow . getThreadcount ( ) , workflow . isKeepgoing ( ) , workflow . getStrategy ( ) ) ) ; } return sections ; }
Splits a workflow into a sequence of sub - workflows separated along boundaries of node - dispatch sets .