List<FlightHop> flightHopList = new ArrayList<FlightHop>();
for (Structure hop : hopList) {
// Create flight hop object.
FlightHop flightHop = new FlightHop();
// Add hop number to flight hop if set.
String hopNumber = hop.get("HOP", String.class);
if (hopNumber != null) {
flightHop.setHopNumber(hopNumber);
if (LOG.isDebugEnabled()) {
LOG.debug("Set hop number = '{}' in flight hop", hopNumber);
}
}
// Add airline code to flight hop if set.
String airlineCode = hop.get("AIRLINEID", String.class);
if (airlineCode != null) {
flightHop.setAirlineCode(airlineCode);
if (LOG.isDebugEnabled()) {
LOG.debug("Set airline code = '{}' in flight hop", airlineCode);
}
}
// Add airline name to flight hop if set.
String airlineName = hop.get("AIRLINE", String.class);
if (airlineName != null) {
flightHop.setAirlineName(airlineName);
if (LOG.isDebugEnabled()) {
LOG.debug("Set airline name = '{}' in flight hop", airlineName);
}
}
// Add flight connection number to flight hop if set.
String flightConnectionNumber = hop.get("CONNECTID", String.class);
if (flightConnectionNumber != null) {
flightHop.setFlightConnectionNumber(flightConnectionNumber);
if (LOG.isDebugEnabled()) {
LOG.debug("Set flight connection number = '{}' in flight hop", flightConnectionNumber);
}
}
// Add departure airport to flight hop if set.
String depatureAirport = hop.get("AIRPORTFR", String.class);
if (depatureAirport != null) {
flightHop.setDepatureAirport(depatureAirport);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure airport = '{}' in flight hop", depatureAirport);
}
}
// Add departure city to flight hop if set.
String depatureCity = hop.get("CITYFROM", String.class);
if (depatureCity != null) {
flightHop.setDepatureCity(depatureCity);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure city = '{}' in flight hop", depatureCity);
}
}
// Add departure country to flight hop if set.
String departureCountry = hop.get("CTRYFR", String.class);
if (departureCountry != null) {
flightHop.setDepartureCountry(departureCountry);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure country = '{}' in flight hop", departureCountry);
}
}
// Add departure country code to flight hop if set.
String departureCountryIso = hop.get("CTRYFR_ISO", String.class);
if (departureCountryIso != null) {
flightHop.setDepartureCountryIso(departureCountryIso);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure iso country code = '{}' in flight hop", departureCountryIso);
}
}
// Add arrival airport to flight hop if set.
String arrivalAirport = hop.get("AIRPORTTO", String.class);
if (arrivalAirport != null) {
flightHop.setArrivalAirport(arrivalAirport);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival airport = '{}' in flight hop", arrivalAirport);
}
}
// Add arrival city to flight hop if set.
String arrivalCity = hop.get("CITYTO", String.class);
if (arrivalCity != null) {
flightHop.setArrivalCity(arrivalCity);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival city = '{}' in flight hop", arrivalCity);
}
}
// Add arrival country to flight hop if set.
String arrivalCountry = hop.get("CTRYTO", String.class);
if (arrivalCountry != null) {
flightHop.setArrivalCountry(arrivalCountry);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival country = '{}' in flight hop", arrivalCountry);
}
}
// Add arrival country code to flight hop if set.
String arrivalCountryIso = hop.get("CTRYTO_ISO", String.class);
if (arrivalCountryIso != null) {
flightHop.setArrivalCountryIso(arrivalCountryIso);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival iso country code = '{}' in flight hop", arrivalCountryIso);
}
}
// Add departure date to flight hop if set.
Date departureDate = hop.get("DEPDATE", Date.class);
if (departureDate != null) {
flightHop.setDepatureDate(departureDate);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure date = '{}' in flight hop", departureDate);
}
}
// Add departure time to flight hop if set.
Date departureTime = hop.get("DEPTIME", Date.class);
if (departureTime != null) {
flightHop.setDepatureTime(departureTime);
if (LOG.isDebugEnabled()) {
LOG.debug("Set departure time = '{}' in flight hop", departureTime);
}
}
// Add arrival date to flight hop if set.
Date arrivalDate = hop.get("ARRDATE", Date.class);
if (arrivalDate != null) {
flightHop.setArrivalDate(arrivalDate);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival date = '{}' in flight hop", arrivalDate);
}
}
// Add arrival time to flight hop if set.
Date arrivalTime = hop.get("ARRTIME", Date.class);
if (arrivalTime != null) {
flightHop.setArrivalTime(arrivalTime);
if (LOG.isDebugEnabled()) {
LOG.debug("Set arrival time = '{}' in flight hop", arrivalTime);
}
}
// Add aircraft type to flight hop if set.
String aircraftType = hop.get("PLANETYPE", String.class);
if (aircraftType != null) {
flightHop.setAircraftType(aircraftType);
if (LOG.isDebugEnabled()) {
LOG.debug("Set aircraft type = '{}' in flight hop", aircraftType);
}
}