@ Override protected DataSet getNextDataSetImpl ( final String dataSetKey ) { for ( ExcelFile excelFile : getExcelFiles ( ) ) { Map < String , List < Map < String , String > > > data = excelFile . getData ( ) ; List < Map < String , String > > dataList = data . get ( dataSetKey ) ; if ( dataList != null ) { MutableInt counter = dataSetIndices . get ( dataSetKey ) ; if ( counter == null ) { counter = new MutableInt ( 0 ) ; dataSetIndices . put ( dataSetKey , counter ) ; } if ( counter . getValue ( ) >= dataList . size ( ) ) { // no more data available return null ; } // turn data map into a data set Map < String , String > dataMap = dataList . get ( counter . getValue ( ) ) ; DataSet dataSet = new DefaultDataSet ( dataMap ) ; // advance the counter for the next dataset counter . increment ( ) ; return dataSet ; } } return null ; }
Goes through all configured Excel files until data for the specified key is found . All sheets of a file a check before the next file is considered .