data.clear();
// set urno of irmtab
irmtabUrno = irmtabRef;
try {
CrewCheckIn _input = (CrewCheckIn) _um.unmarshal(new StreamSource(new StringReader(message)));
String legNum = String.valueOf(_input.getFlightID().getLegNo());
String depNum = String.valueOf(_input.getFlightID().getDepNo());
//check all madantory fields
if(_input.getMeta().getMessageTime() == null
|| HpUfisUtils.isNullOrEmptyStr(String.valueOf(_input.getMeta().getMessageID()))
|| HpUfisUtils.isNullOrEmptyStr(_input.getMeta().getType())
|| HpUfisUtils.isNullOrEmptyStr(_input.getMeta().getSubtype())
|| HpUfisUtils.isNullOrEmptyStr(_input.getMeta().getSource())){
LOG.error("Input meta mandatory info are missing. Message dropped.");
addExptInfo(EnumExceptionCodes.EMAND.name(), "");
return false;
}
if(!"BMS".equals(_input.getMeta().getSource())){
//clsBlIrmtabFacade.updateIRMStatus("UnknownSrc");
LOG.error("Processing performs only for BMS Source. Message dropped.");
addExptInfo(EnumExceptionCodes.EWSRC.name(), _input.getMeta().getSource());
return false;
}
if(HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getCxCd())
|| HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getFltDate())
|| HpUfisUtils.isNullOrEmptyStr(String.valueOf(_input.getFlightID().getFltNo()))
|| (HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getArrStn())&&
HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getDepStn()))
|| HpUfisUtils.isNullOrEmptyStr(depNum)
|| HpUfisUtils.isNullOrEmptyStr(legNum)){
LOG.error("Input FlightID mandatory info are missing. Message dropped.");
addExptInfo(EnumExceptionCodes.EMAND.name(), "");
return false;
}
if(!_input.getFlightID().getCxCd().contains("EK")){
LOG.error("Processing performs only for EK flight. Message dropped.");
addExptInfo(EnumExceptionCodes.EWALC.name(), _input.getFlightID().getCxCd());
return false;
}
if(HpUfisUtils.isNullOrEmptyStr(_input.getCheckInInfo().getStaffno())
|| HpUfisUtils.isNullOrEmptyStr(_input.getCheckInInfo().getStaffName())
|| HpUfisUtils.isNullOrEmptyStr(_input.getCheckInInfo().getOperatingGrade())
|| HpUfisUtils.isNullOrEmptyStr(_input.getCheckInInfo().getCrewType())
|| _input.getCheckInInfo().getCheckInTime() == null
|| HpUfisUtils.isNullOrEmptyStr(_input.getCheckInInfo().getSelfCheckIn())){
LOG.error("Input Crew Check in info are missing. Message dropped.");
addExptInfo(EnumExceptionCodes.EMAND.name(), "");
return false;
}
if(!"C".equals(_input.getCheckInInfo().getCrewType())
&& !"F".equals(_input.getCheckInInfo().getCrewType())){
LOG.error("Crew type must be F(Flight Crew) or C(Cabin Crew). Message dropped.");
addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCheckInInfo().getCrewType());
return false;
}
if(!"Y".equals(_input.getCheckInInfo().getSelfCheckIn())
&& !"N".equals(_input.getCheckInInfo().getSelfCheckIn())){
LOG.error("Self check in info must be Y(Yes) or N(No). Message dropped.");
addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCheckInInfo().getCrewType());
return false;
}
String fltSuffix = null;
String flNum = null;
Date flDate = null;
BigDecimal urno = null;
EntDbAfttab entFlight = null;
String idFltJobAssign = "0";
Date checkInDate = null;
Date msgInTime = null;
EntDbFltJobAssign entFltJobAssign = null;
String cmd = UfisASCommands.IRT.name();
fltSuffix = _input.getFlightID().getFltSuffix() == null? "": _input.getFlightID().getFltSuffix();
//format ceda flight string
/*flNum = _input.getFlightID().getCxCd() +" "+
HpUfisUtils.formatCedaFltn(String.valueOf(_input.getFlightID().getFltNo())) + fltSuffix;*/
flNum = HpUfisUtils.formatCedaFlno(_input.getFlightID().getCxCd(), String.valueOf(_input.getFlightID().getFltNo()), fltSuffix);
flDate = inputFlDate.parse(_input.getFlightID().getFltDate());
//perform only for deptStn = DXB
if (HpEKConstants.EK_HOPO.equals(_input.getFlightID().getDepStn()))
entFlight = clsAfttabBeanLocal.findFlightByFlda(flNum, dfDate.format(flDate), _input.getFlightID().getArrStn());
else{
LOG.error("Processing performs only for departure station = DXB. Message dropped.");
addExptInfo(EnumExceptionCodes.ENDEP.name(), _input.getFlightID().getDepStn());
return false;
}
if(entFlight == null){
LOG.error("Flight flno <{}> is not found. Message dropped.", flNum);
addExptInfo(EnumExceptionCodes.ENOFL.name(), flNum);
return false;
}
else{
urno = entFlight.getUrno();
//get the flt_job_assign by staff_number and id_flight
entFltJobAssign = clsIDlFltJobAssignLocal.getAssignedCrewIdByFlight(urno, _input.getCheckInInfo().getStaffno(), _input.getCheckInInfo().getCrewType());
idFltJobAssign = (entFltJobAssign == null)? "0" : entFltJobAssign.getId();
}
checkInDate = sf.parse(convertFlDateToUTC(_input.getCheckInInfo().getCheckInTime()));
msgInTime = sf.parse(convertFlDateToUTC(_input.getMeta().getMessageTime()));
EntDbCrewCheckin entity = null, oldEnt = null;
entity = clsDlCrewCheckInBean.getExistingCrewCheckIn(flNum, legNum,
depNum, _input.getCheckInInfo().getStaffno(), flDate);
if(entity == null){
entity = new EntDbCrewCheckin();
entity.setFlightNumber(flNum);
entity.setLegNum(legNum);
entity.setDepNum(depNum);
entity.setStaffNumber(_input.getCheckInInfo().getStaffno());
entity.setFltDate(flDate);
entity.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
entity.setCreatedUser(HpEKConstants.BMS_SOURCE);
}
else{
oldEnt = new EntDbCrewCheckin(entity);
entity.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
entity.setUpdatedUser(HpEKConstants.BMS_SOURCE);
cmd = UfisASCommands.URT.name();
}
entity.setIdFlight(urno);
entity.setIdFltJobAssign(idFltJobAssign);
entity.setMsgSendDate(msgInTime);
entity.setFltOrigin3(_input.getFlightID().getDepStn());
entity.setFltDest3(_input.getFlightID().getArrStn());
entity.setStaffName(_input.getCheckInInfo().getStaffName());
entity.setStaffOpGrade(_input.getCheckInInfo().getOperatingGrade());
entity.setCheckinDate(checkInDate);
entity.setStaffType(_input.getCheckInInfo().getCrewType());
entity.setSelfCheckinFlag(_input.getCheckInInfo().getSelfCheckIn());
entity.setRecStatus(" ");
entity.setDataSource(HpEKConstants.BMS_SOURCE);
EntDbCrewCheckin entCrewCheckIn = clsDlCrewCheckInBean.merge(entity);
if(entCrewCheckIn != null){