public EntDbLoadPaxConnX readStorePax(OnwDetails ownDetails, long irmtabRef, Message message) {
// Store Pax Details for this MAXCS ID
// find record with the maxcs id and
EntDbLoadPaxConnX result = null;
if (ownDetails != null) {
logLevel = entStartupInitSingleton.getIrmLogLev();
msgLogged = Boolean.FALSE;
if (irmtabRef > 0) {
msgLogged = Boolean.TRUE;
}
EntDbLoadPaxConnX edpiod = new EntDbLoadPaxConnX();
// LoadPaxConnPK paxConnPk = new LoadPaxConnPK();
HpUfisCalendar ufisCalendar = new HpUfisCalendar();
ufisCalendar.setCustomFormat(HpEKConstants.MACS_TIME_FORMAT); // 2012-12-18
// 00:00:00
// check as it's a mandatory field
if (ownDetails.getOnwId() != null
&& !ownDetails.getOnwId().isEmpty()) {
edpiod.setIntId(ownDetails.getOnwId());
} else {
LOG.info("Mandatory field ONW_ID is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field ONW_ID is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// check as it's a mandatory field
if (ownDetails.getMflId() != null
&& !ownDetails.getMflId().isEmpty()) {
// edpiod.setInterfaceFltid(ownDetails.getMflId());
edpiod.setInterfaceFltid(ownDetails.getMflId());
} else {
LOG.info("Mandatory field MFL_ID is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field MFL_ID is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// check as it's a mandatory field
if (ownDetails.getBoardPoint() != null
&& !ownDetails.getBoardPoint().isEmpty()) {
edpiod.setBoardPoint(ownDetails.getBoardPoint());
} else {
LOG.info("Mandatory field BOARD_POINT is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field BOARD_POINT is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// check as it's a mandatory field
if (ownDetails.getOffPoint() != null
&& !ownDetails.getOffPoint().isEmpty()) {
edpiod.setOffPoint(ownDetails.getOffPoint());
} else {
LOG.info("Mandatory field OFF_POINT is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field OFF_POINT is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// // check as it's a mandatory field
// if (ownDetails.getAirlineDesignator() != null &&
// !ownDetails.getAirlineDesignator().isEmpty()){
// edpiod.setAirlineCode(ownDetails.getAirlineDesignator());
// }else{
// LOG.info("Mandatory field AIRLINE_DESIGNATOR is null or empty, Onward Message is rejected");
// // return null;
// }
// check as it's a mandatory field
if (ownDetails.getAirlineDesignator() == null
|| ownDetails.getAirlineDesignator().isEmpty()) {
LOG.info("Mandatory field AIRLINE_DESIGNATOR is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field AIRLINE_DESIGNATOR is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// // check as it's a mandatory field
// if (ownDetails.getFlightNumber() != null &&
// !ownDetails.getFlightNumber().isEmpty()){
// String strFlightNumber = ownDetails.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, Onward Message is rejected");
// // return null;
// }
// check as it's a mandatory field
if (ownDetails.getFlightNumber() == null
|| ownDetails.getFlightNumber().isEmpty()) {
LOG.info("Mandatory field FLIGHT_NUMBER is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field FLIGHT_NUMBER is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// if(ownDetails.getFlightNumberExp() != null){
// edpiod.setFlightNumberSuffice(ownDetails.getFlightNumberExp());
// }else{
// edpiod.setFlightNumberSuffice(" "); // default value
// }
// check as it's a mandatory field
if (ownDetails.getOperationDate() != null
&& !ownDetails.getOperationDate().isEmpty()) {
ufisCalendar.setTime(ownDetails.getOperationDate(),
ufisCalendar.getCustomFormat());
if (ownDetails.getOperationTime().length() >= 4) {
int hour = 0;
int min = 0;
try {
hour = Integer.parseInt(ownDetails.getOperationTime()
.substring(0, 2));
min = Integer.parseInt(ownDetails.getOperationTime()
.substring(2, 4));
} catch (Exception e) {
LOG.info("Onward 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, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field OPERATION_DATE is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// // check as it's a mandatory field
// if (ownDetails.getOperationDate() == null
// || ownDetails.getOperationDate().isEmpty()) {
// LOG.info("Mandatory field OPERATION_DATE is null or empty, Onward Message is rejected");
// addExptInfo(EnumExceptionCodes.EMAND.name(),irmtabRef.name(), "OPERATION_DATE");
// // return null;
// }
// check as it's a mandatory field
if (ownDetails.getReferenceNumber() != null
&& !ownDetails.getReferenceNumber().isEmpty()) {
// edpiod.setIntRefNumber(ownDetails.getReferenceNumber());
edpiod.setIntRefNumber(ownDetails.getReferenceNumber());
} else {
LOG.info("Mandatory field REFERENCE_NUMBER is null or empty, Onward Message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND.name(),"Mandatory field REFERENCE_NUMBER is null or empty, Onward Message is rejected",irmtabRef, message);
return null;
}
// edpiod.setPaxConnPK(paxConnPk);
edpiod.setIntSystem(HpEKConstants.MACS_PAX_DATA_SOURCE);
edpiod.setConnType(EnumLoadPaxConnType.O.toString());
edpiod.setBookedClass(ownDetails.getBookedClass());
edpiod.setDownloadDate(ownDetails.getDownloadDate());
edpiod.setConnStatus(ownDetails.getStatus());
edpiod.setMsgTimeStamp(ownDetails.getTimeStamp());
edpiod.setVariableData(ownDetails.getVariableData());
// added by 2013.10.01 according to the new design document
edpiod.setPaxConxFlno(HpUfisUtils.formatCedaFlno(ownDetails
.getAirlineDesignator(), HpUfisUtils.formatCedaFltn(ownDetails.getFlightNumber()),
ownDetails.getFlightNumberExp() == null ? "" : ownDetails
.getFlightNumberExp().trim()));
edpiod.setAirlineCode(ownDetails.getAirlineDesignator()); // added by 2013-12-31
// result = (EntDbLoadPaxConn) SerializationUtils
// .clone(edpiod);
result = edpiod;