msgLogged = Boolean.FALSE;
if (irmtabRef > 0) {
msgLogged = Boolean.TRUE;
}
HpUfisCalendar ufisCalendar = new HpUfisCalendar();
ufisCalendar.setCustomFormat(HpEKConstants.MACS_TIME_FORMAT); // 2012-12-18
// 00:00:00
EntDbLoadPaxConn edpiod = new EntDbLoadPaxConn();
LoadPaxConnPK paxConnPk = new LoadPaxConnPK();
// To check and set the mandatory fields first
// check as it's a mandatory field
if (inbDetails.getInbId() != null
&& !inbDetails.getInbId().isEmpty()) {
edpiod.setIntId(inbDetails.getInbId());
} else {
LOG.info("Mandatory field INB_ID is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// check as it's a mandatory field
if (inbDetails.getMflId() != null
&& !inbDetails.getMflId().isEmpty()) {
paxConnPk.setInterfaceFltid(inbDetails.getMflId());
// edpiod.setInterfaceFltid(inbDetails.getMflId());
} else {
LOG.info("Mandatory field MFL_ID is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// check as it's a mandatory field
if (inbDetails.getBoardPoint() != null
&& !inbDetails.getBoardPoint().isEmpty()) {
edpiod.setBoardPoint(inbDetails.getBoardPoint());
} else {
LOG.info("Mandatory field BOARD_POINT is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// check as it's a mandatory field
if (inbDetails.getOffPoint() != null
&& !inbDetails.getOffPoint().isEmpty()) {
edpiod.setOffPoint(inbDetails.getOffPoint());
} else {
LOG.info("Mandatory field OFF_POINT is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// // check as it's a mandatory field
// if (inbDetails.getAirlineDesignator() != null &&
// !inbDetails.getAirlineDesignator().isEmpty()){
// edpiod.setAirlineCode(inbDetails.getAirlineDesignator());
// }else{
// LOG.info("Mandatory field AIRLINE_DESIGNATOR is null or empty, Inbound Message is rejected");
// // return null;
// }
// check as it's a mandatory field
if (inbDetails.getAirlineDesignator() == null
|| inbDetails.getAirlineDesignator().isEmpty()) {
LOG.info("Mandatory field AIRLINE_DESIGNATOR is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// // check as it's a mandatory field
// if (inbDetails.getFlightNumber() != null &&
// !inbDetails.getFlightNumber().isEmpty()){
// String strFlightNumber = inbDetails.getFlightNumber();
// strFlightNumber = HpUfisUtils.formatCedaFltn(strFlightNumber);
// // if (strFlightNumber.length() != 3){
// // strFlightNumber =
// Integer.toString(Integer.parseInt(strFlightNumber));
// // if (strFlightNumber.length() < 3){
// // int numAdd = 3 - strFlightNumber.length();
// // for (int i= 0; i < numAdd; i++ ){
// // strFlightNumber = "0"+strFlightNumber;
// // }
// // }
// // }
// edpiod.setFlightNumber(strFlightNumber);
// }else{
// LOG.info("Mandatory field FLIGHT_NUMBER is null or empty, Inbound Message is rejected");
// // return null;
// }
// check as it's a mandatory field
if (inbDetails.getFlightNumber() == null
|| inbDetails.getFlightNumber().isEmpty()) {
LOG.info("Mandatory field FLIGHT_NUMBER is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}
// if(inbDetails.getFlightNumberExp() != null){
// edpiod.setFlightNumberSuffice(inbDetails.getFlightNumberExp());
// }else{
// edpiod.setFlightNumberSuffice(" "); // default value
// }
// check as it's a mandatory field
if (inbDetails.getOperationDate() != null
&& !inbDetails.getOperationDate().isEmpty()) {
ufisCalendar.setTime(inbDetails.getOperationDate(),
ufisCalendar.getCustomFormat());
if (inbDetails.getOperationTime().length() >= 4) {
int hour = 0;
int min = 0;
try {
hour = Integer.parseInt(inbDetails.getOperationTime()
.substring(0, 2));
min = Integer.parseInt(inbDetails.getOperationTime()
.substring(2, 4));
} catch (Exception e) {
LOG.info("Inbound message OperationTime parse erro");
}
ufisCalendar.DateAdd(hour, EnumTimeInterval.Hours);
ufisCalendar.DateAdd(min, EnumTimeInterval.Minutes);
}
edpiod.setConxFltDate(ufisCalendar.getTime());
} else {
LOG.info("Mandatory field OPERATION_DATE is null or empty, Inbound Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND,irmtabRef);
return null;
}