LOG.info("Loading EK flights into cahce from afttab...");
List<EntDbAfttab> result = query.getResultList();
if (result != null && result.size() > 0) {
LOG.info("{} EK flight record found", result.size());
FlightEvent flight = null;
FlightId flightId = null;
FltDate fltDate = null;
HpUfisCalendar ufisCalendar = new HpUfisCalendar();
ufisCalendar.setCustomFormat("yyyyMMdd");
for (EntDbAfttab entity : result) {
flight = new FlightEvent();
flightId = new FlightId();
fltDate = new FltDate();
// carrier, boardpoint, destination, flight date, suffix
flightId.setCxCd(entity.getAlc2() == null ? entity.getAlc3() : entity.getAlc2());
flightId.setDepStn(entity.getOrg3());
flightId.setArrStn(entity.getDes3());
if (HpUfisUtils.isNotEmptyStr(entity.getFlda())) {
ufisCalendar.setTime(entity.getFlda(), ufisCalendar.getCustomFormat());
fltDate.setValue(HpUfisUtils.chgDateToXMLGregorianCalendar(ufisCalendar.getTime()));
flightId.setFltDate(fltDate);
}
flightId.setFltNum(entity.getFltn());
if (entity.getFlns() != null
&& !"".equals(String.valueOf(entity.getFlns()).trim())) {
flightId.setFltSuffix(String.valueOf(entity.getFlns()));
}
flight.setFlightId(flightId);
globalFlightEvent.add(flight);
}
}