@Override
public Collection<InterestRateChartSlabData> extractData(ResultSet rs) throws SQLException, DataAccessException {
List<InterestRateChartSlabData> chartDataList = new ArrayList<>();
InterestRateChartSlabData chartSlabData = null;
Long interestRateChartSlabId = null;
int ircIndex = 0;// Interest rate chart index
int ircdIndex = 0;// Interest rate chart Slabs index
while (rs.next()) {
Long tempIrcdId = rs.getLong("ircdId");
if (chartSlabData == null || (interestRateChartSlabId != null && !interestRateChartSlabId.equals(tempIrcdId))) {
interestRateChartSlabId = tempIrcdId;
chartSlabData = chartSlabsMapper.mapRow(rs, ircIndex++);
chartDataList.add(chartSlabData);
}
final InterestIncentiveData incentiveData = incentiveMapper.mapRow(rs, ircdIndex++);
if (incentiveData != null) {
chartSlabData.addIncentives(incentiveData);
}
}
return chartDataList;
}