public boolean readStoreLineDeNa(OpsFlashMsg opsFlashMsg) {
if (opsFlashMsg != null) {
logLevel = entStartupInitSingleton.getIrmLogLev();
EntDbAircraftOpsMsg edpiod = new EntDbAircraftOpsMsg();
/* Meta */
if (opsFlashMsg.getMeta() != null) {
// set MsgSendDate
if (opsFlashMsg.getMeta().getMessageTime() != null) {
edpiod.setMsgSendDate(convertXMLGregorianCalendarToDate(opsFlashMsg
.getMeta().getMessageTime()));
} else {
LOG.info("Mandatory field Message Time is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set ID
edpiod.setId((UUID.randomUUID()).toString());
// // set messageId
// edpiod.setMsgId(new
// BigDecimal(opsFlashMsg.getMeta().getMessageID()));
// check Type
if (opsFlashMsg.getMeta().getType() == null) {
LOG.info("Mandatory field Message Type is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
if (!"OpsFlash".equalsIgnoreCase(opsFlashMsg.getMeta()
.getType())) {
LOG.info("Mandatory field Message Type is not OpsFlash, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set subtype
if (opsFlashMsg.getMeta().getSubtype() != null) {
subtype = opsFlashMsg.getMeta().getSubtype();
} else {
LOG.info("Mandatory field subtype is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
if (!("UPD"
.equalsIgnoreCase(opsFlashMsg.getMeta().getSubtype())
|| "INS".equalsIgnoreCase(opsFlashMsg.getMeta()
.getSubtype()) || "DEL"
.equalsIgnoreCase(opsFlashMsg.getMeta()
.getSubtype()))) {
LOG.info("Mandatory field subtype is nither UPD, INS or DEL, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// check source
if (opsFlashMsg.getMeta().getSource() == null) {
LOG.info("Mandatory field Message Source is null, Line DeNA message is rejected");
return false;
}
if (!"DeNA".equalsIgnoreCase(opsFlashMsg.getMeta().getSource())) {
LOG.info("Mandatory field Message Source is not DeNA, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
} else {
LOG.info("Mandatory field Meta is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
/* FlightId */
if (opsFlashMsg.getFlightId() != null) {
if (opsFlashMsg.getFlightId().getCxCd() != null
&& opsFlashMsg.getFlightId().getFltNo() != null
&& !opsFlashMsg.getFlightId().getCxCd().isEmpty()
&& !opsFlashMsg.getFlightId().getFltNo().isEmpty()) {
// set flight number
edpiod.setFlightNumber(opsFlashMsg.getFlightId().getCxCd()
.trim()
+ HpUfisUtils.formatCedaFltn(opsFlashMsg
.getFlightId().getFltNo().trim()));
}
// set flt date, need to convert local time to UTC time
// haven't convert the time to UTC yet !!!!!! later
edpiod.setFltDate(convertXMLGregorianCalendarToDate(opsFlashMsg
.getFlightId().getFltDate()));
// set arr dep flag
if (opsFlashMsg.getFlightId().getArrDepFlag() != null
&& ("A".equals(opsFlashMsg.getFlightId()
.getArrDepFlag()) || "D".equals(opsFlashMsg
.getFlightId().getArrDepFlag()))) {
edpiod.setArrDepFlag(opsFlashMsg.getFlightId()
.getArrDepFlag());
} else {
edpiod.setArrDepFlag("");
}
// set flt regn
if (opsFlashMsg.getFlightId().getACRegNo() != null
&& !opsFlashMsg.getFlightId().getACRegNo().isEmpty()) {
edpiod.setFltRegn(opsFlashMsg.getFlightId().getACRegNo());
} else {
LOG.info("Mandatory field Aircraftreg is null or empty, Line DeNA message opsFlashMsg.getFlightId().getACRegNo() is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
}
/* OpFlashDetails */
if (opsFlashMsg.getOpsFlashDetails() != null) {
// set depaartment
if (opsFlashMsg.getOpsFlashDetails().getDepartment() != null) {
// edpiod.setCreatedUser(opsFlashMsg.getOpsFlashDetails().getDepartment());
// edpiod.setUpdatedUser(opsFlashMsg.getOpsFlashDetails().getDepartment());
edpiod.setDeptName(opsFlashMsg.getOpsFlashDetails()
.getDepartment());
} else {
LOG.info("Mandatory field Department is null or empty, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// // set create/update user
// edpiod.setCreatedUser("DeNA");
// edpiod.setUpdatedUser("DeNA");
// set subject
if (opsFlashMsg.getOpsFlashDetails().getSubject() != null) {
edpiod.setMsgSubject(opsFlashMsg.getOpsFlashDetails()
.getSubject());
} else {
LOG.info("Mandatory field Subject is null or empty, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set reason
if (opsFlashMsg.getOpsFlashDetails().getReason() != null
&& !opsFlashMsg.getOpsFlashDetails().getReason()
.isEmpty()) {
edpiod.setOpsReason(opsFlashMsg.getOpsFlashDetails()
.getReason());
} else {
LOG.info("Mandatory field Reason is null or empty, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set defect details
if (opsFlashMsg.getOpsFlashDetails().getDefectDetails() != null
&& !opsFlashMsg.getOpsFlashDetails().getDefectDetails()
.isEmpty()) {
edpiod.setDefectDetails(opsFlashMsg.getOpsFlashDetails()
.getDefectDetails());
} else {
edpiod.setDefectDetails("");
}
// set add time reqd
if (opsFlashMsg.getOpsFlashDetails().getAddTimeFromStd() != null
&& !opsFlashMsg.getOpsFlashDetails()
.getAddTimeFromStd().isEmpty()) {
edpiod.setAddTimeReqd(opsFlashMsg.getOpsFlashDetails()
.getAddTimeFromStd());
} else {
edpiod.setAddTimeReqd("");
}
// set next upd date
if (opsFlashMsg.getOpsFlashDetails().getNextUpdate() != null) {
edpiod.setNextUpdDate(convertXMLGregorianCalendarToDate(opsFlashMsg
.getOpsFlashDetails().getNextUpdate()));
}
// }else{
// LOG.info("Mandatory field next upd date is null, Line DeNA message is rejected");
// return false;
// }
// set assist reqd
if (opsFlashMsg.getOpsFlashDetails().getAssistRequired() != null) {
edpiod.setAssistReqd(opsFlashMsg.getOpsFlashDetails()
.getAssistRequired());
} else {
edpiod.setAssistReqd("");
}
// set action reqd
if (opsFlashMsg.getOpsFlashDetails().getActionRequired() != null) {
edpiod.setActionReqd(opsFlashMsg.getOpsFlashDetails()
.getActionRequired());
} else {
edpiod.setActionReqd("");
}
// set publishto
if (opsFlashMsg.getOpsFlashDetails().getPublishTo() != null
&& !opsFlashMsg.getOpsFlashDetails().getPublishTo()
.isEmpty()) {
edpiod.setPublishTo(opsFlashMsg.getOpsFlashDetails()
.getPublishTo());
} else {
LOG.info("Mandatory field publish to is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set msg seqn num
if (opsFlashMsg.getOpsFlashDetails().getOpsSeq() != 0) {
edpiod.setMsgSeqnNum(new BigDecimal(opsFlashMsg
.getOpsFlashDetails().getOpsSeq()));
} else {
LOG.info("Mandatory field msg seqn num is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;
}
// set final msg flag
if (opsFlashMsg.getOpsFlashDetails().getCloseMsgSeq() != null) {
edpiod.setCloseMsgFlag(opsFlashMsg.getOpsFlashDetails()
.getCloseMsgSeq());
} else {
edpiod.setCloseMsgFlag("");
}
// set msg post date
// need to convert local to UTC later
if (opsFlashMsg.getOpsFlashDetails().getMsgPostedTime() != null) {
edpiod.setMsgPostDate(convertXMLGregorianCalendarToDate(opsFlashMsg
.getOpsFlashDetails().getMsgPostedTime()));
} else {
LOG.info("Mandatory fieldmsg post date is null, Line DeNA message is rejected");
sendErroNotification(EnumExceptionCodes.EMAND);
return false;