* @throws ParseException
* the parse exception is thrown when any of the values parsed is either not type compatible or
* {@code null}
*/
private Flight parse(final Map<String, Iterator<Object>> dataIteratorsMap) throws ParseException {
final Flight flight = new Flight();
flight.setNumber((String) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.ZERO.getPrimitiveType())).next());
flight.setDepartureLocationCode((String) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.ONE.getPrimitiveType())).next());
flight.setArrivalLocationCode((String) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.TWO.getPrimitiveType())).next());
flight.setValidTill(DateUtils.getInstance().toSQLDate(
(java.util.Date) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.THREE.getPrimitiveType())).next()));
flight.setFlightTime(DateUtils.getInstance().toSQLTime(
GallConstants.DEFAULT_TIME_FORMAT,
(String) dataIteratorsMap.get(CSVFeedConstants.HEADERS.get(IntegerConstants.FOUR.getPrimitiveType()))
.next()));
flight.setFlightDuration((Double) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.FIVE.getPrimitiveType())).next());
flight.setFare(new BigDecimal((Long) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.SIX.getPrimitiveType())).next()));
flight.setSeatAvailability((Boolean) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.SEVEN.getPrimitiveType())).next());
flight.setFlightClass((String) dataIteratorsMap.get(
CSVFeedConstants.HEADERS.get(IntegerConstants.EIGHT.getPrimitiveType())).next());
return flight;
}