List<SeatAvailibility> seatAvailiblityList = new ArrayList<SeatAvailibility>();
for (Structure availibility : availibilityList) {
// Create seat availability object.
SeatAvailibility seatAvailiblity = new SeatAvailibility();
// Add hop number to availability if set.
String hopNumber = availibility.get("HOP", String.class);
if (hopNumber != null) {
seatAvailiblity.setHopNumber(hopNumber);
if (LOG.isDebugEnabled()) {
LOG.debug("Set hop number = '{}' in seat availibility", hopNumber);
}
}
// Add economy class seat capacity to availability if set.
Integer economyClassSeatCapacity = availibility.get("ECONOMAX", Integer.class);
if (economyClassSeatCapacity != null) {
seatAvailiblity.setEconomyClassSeatCapacity(economyClassSeatCapacity.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set economy class seat capacity = '{}' in seat availibility", economyClassSeatCapacity);
}
}
// Add economy class free seats to availability if set.
Integer economyClassFreeSeats = availibility.get("ECONOFREE", Integer.class);
if (economyClassFreeSeats != null) {
seatAvailiblity.setEconomyClassFreeSeats(economyClassFreeSeats.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set economy class free seats = '{}' in seat availibility", economyClassFreeSeats);
}
}
// Add business class seat capacity to availability if set.
Integer businessClassSeatCapacity = availibility.get("BUSINMAX", Integer.class);
if (businessClassSeatCapacity != null) {
seatAvailiblity.setBusinessClassSeatCapacity(businessClassSeatCapacity.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set business class seat capacity = '{}' in seat availibility", businessClassSeatCapacity);
}
}
// Add business class free seats to availability if set.
Integer businessClassFreeSeats = availibility.get("BUSINFREE", Integer.class);
if (businessClassFreeSeats != null) {
seatAvailiblity.setBusinessClassFreeSeats(businessClassFreeSeats.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set business class free seats = '{}' in seat availibility", businessClassFreeSeats);
}
}
// Add first class seat capacity to availability if set.
Integer firstClassClassSeatCapacity = availibility.get("FIRSTMAX", Integer.class);
if (firstClassClassSeatCapacity != null) {
seatAvailiblity.setFirstClassClassSeatCapacity(firstClassClassSeatCapacity.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set first class seat capacity = '{}' in seat availibility", firstClassClassSeatCapacity);
}
}
// Add first class free seats to availability if set.
Integer firstClassFreeSeats = availibility.get("FIRSTFREE", Integer.class);
if (firstClassFreeSeats != null) {
seatAvailiblity.setFirstClassFreeSeats(firstClassFreeSeats.toString());
if (LOG.isDebugEnabled()) {
LOG.debug("Set first class free seats = '{}' in seat availibility", firstClassFreeSeats);
}
}