protected Map < String , Collection < StepExecutionResult > > convertFailures ( final Map < Integer , StepExecutionResult > failedMap ) { final Map < String , Collection < StepExecutionResult > > failures = new HashMap <> ( ) ; for ( final Map . Entry < Integer , StepExecutionResult > entry : failedMap . entrySet ( ) ) { final StepExecutionResult o = entry . getValue ( ) ; if ( NodeDispatchStepExecutor . isWrappedDispatcherResult ( o ) ) { //indicates dispatcher returned node results final DispatcherResult dispatcherResult = NodeDispatchStepExecutor . extractDispatcherResult ( o ) ; for ( final String s : dispatcherResult . getResults ( ) . keySet ( ) ) { final NodeStepResult interpreterResult = dispatcherResult . getResults ( ) . get ( s ) ; if ( ! failures . containsKey ( s ) ) { failures . put ( s , new ArrayList <> ( ) ) ; } failures . get ( s ) . add ( interpreterResult ) ; } } else if ( NodeDispatchStepExecutor . isWrappedDispatcherException ( o ) ) { DispatcherException e = NodeDispatchStepExecutor . extractDispatcherException ( o ) ; final INodeEntry node = e . getNode ( ) ; if ( null != node ) { //dispatch failed for a specific node final String key = node . getNodename ( ) ; if ( ! failures . containsKey ( key ) ) { failures . put ( key , new ArrayList <> ( ) ) ; } NodeStepException nodeStepException = e . getNodeStepException ( ) ; if ( null != nodeStepException ) { failures . get ( key ) . add ( nodeStepResultFromNodeStepException ( node , nodeStepException ) ) ; } } } } return failures ; }
Convert map of step execution results keyed by step number to a collection of step execution results keyed by node name