}
public boolean routeMessage(Message message,
InterfaceConfig interfaceConfig, Long irmtabRef) {
CrewOnFlight crewOnFlight;
logLevel = HpCommonConfig.irmtab;
msgLogged = Boolean.FALSE;
TextMessage msg = (TextMessage) message;
if (irmtabRef > 0) {
msgLogged = Boolean.TRUE;
}
try {
String inMessage = msg.getText();
if (HpUfisUtils.isNullOrEmptyStr(inMessage)) {
LOG.error("Incoming message is Empty/null.");
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EXSDF, irmtabRef);
}
return false;
}
crewOnFlight = (CrewOnFlight) _um.unmarshal(new StreamSource(
new StringReader(inMessage)));
if (crewOnFlight == null) {
LOG.warn("Message is not valid. Dropping the message :{}",
inMessage);
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EXSDF, irmtabRef);
}
return false;
}
if (crewOnFlight.getFlightId() == null
|| crewOnFlight.getFlightDetails() == null) {
LOG.warn("Dropped Message details(Flight details are not specified): ");
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EXSDF, irmtabRef);
}
return false;
}
if (HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getFlightId()
.getFltNum())
|| crewOnFlight.getFlightId().getFltDate() == null
|| HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getFlightId()
.getCxCd())) {
LOG.warn(
"Dropped Message details(Flight Number or Flight Date or CxCd are not specified): "
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EMAND, irmtabRef);
}
return false;
}
if (!(crewOnFlight.getFlightId().getCxCd().equalsIgnoreCase("EK") || crewOnFlight
.getFlightId().getCxCd().equalsIgnoreCase("QF"))) {
LOG.warn("Dropped Message details(Not EK flight): "
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EWALC, irmtabRef);
}
return false;
}
if (HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getFlightId()
.getDepNum().toString())
|| HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getFlightId()
.getDepStn())
|| HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getFlightId()
.getArrStn())) {
LOG.warn(
"Either Departure Number or Departure Station or Arrival Station is not defined:: "
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EMAND, irmtabRef);
}
return false;
}
if (HpUfisUtils.isNullOrEmptyStr(crewOnFlight.getOriginator())
|| !crewOnFlight.getOriginator()
.equalsIgnoreCase("ACTSODS")) {
LOG.warn("Dropped Message details(Originator is not valid): "
+ "FlightNum = {}, " + "Flight Date = {}, "
+ " Originator= {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate(),
crewOnFlight.getOriginator() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EWSRC, irmtabRef);
}
return false;
}
if (crewOnFlight.getMessageType() == null
|| crewOnFlight.getActionType() == null) {
LOG.warn(
"Dropped Message details(Message Type ,Action Type is not valid): "
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EMAND, irmtabRef);
}
return false;
}
if (crewOnFlight.getCrewFlightAssignment() == null) {
LOG.warn(
"Flight Crew Assignments are not specified. Dropping the message Details:"
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);
msgLogged = Boolean.TRUE;
}
}
if (irmtabRef > 0) {
sendErrInfo(EnumExceptionCodes.EMAND, irmtabRef);
}
return false;
} else if (crewOnFlight.getCrewFlightAssignment()
.getCrewAssignment().isEmpty()
|| crewOnFlight.getCrewFlightAssignment()
.getCrewAssignment() == null) {
LOG.warn(
"Crew Assignments are not specified. Dropping the message Details:"
+ "FlightNum = {}, " + "Flight Date = {}, ",
new Object[] { crewOnFlight.getFlightId().getFltNum(),
crewOnFlight.getFlightId().getFltDate() });
if (logLevel
.equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
.name())) {
if (!msgLogged) {
irmtabRef = _irmfacade.storeRawMsg(message, dtflString);