Package com.ufis_as.ufisapp.server.oldflightdata.entities

Examples of com.ufis_as.ufisapp.server.oldflightdata.entities.EntDbAfttab


             return false;
        }
       
        LOG.debug("Formed UFIS Flight Number, Flight Date - {}, {}", flightNumber, flightDate);
       
        EntDbAfttab entDbAfttab = afttabBean.findFlightForUldDept(flightNumber, flightDate);
       
        LOG.debug("Flight Search by Departure is done.");
       
        if(entDbAfttab == null) {
          entDbAfttab = afttabBean.findFlightForUldOrg(flightNumber, flightDate);
        }
       
        LOG.debug("Flight Search by Non-Departure is done as the search by Departure is not found.");
       
        if(entDbAfttab == null) {
          LOG.error("Flight provided cannot be found. Message will be dropped.");
          addExptInfo(EnumExceptionCodes.ENOFL.name(), String.format("%s (%s)", flightNumber, flightDate));
             return false;
        }
          
        LOG.debug("DB - URNO : {}, FLDA : {}, Flight Date Match : {}", entDbAfttab.getUrno(), entDbAfttab.getFlda(), flightDate.equals(entDbAfttab.getFlda()));
       
        boolean isDel = inputMeta.getSubtype().equalsIgnoreCase(OP_TYPE.DEL.name());
        HpUfisAppConstants.UfisASCommands cmdForBroadcasting;
       
        EntDbLoadUld oldLoadUld = null;
        EntDbLoadUld loadUld = (EntDbLoadUld) dLLoadUldBean.getUldNum(entDbAfttab.getUrno(), inputUldDetails.getULDNumber());
       
        //TODO: Log Telex message
       
        if(loadUld == null) {
          if(isDel){
            LOG.error("ULD record does not exist to delete. Message dropped.");
            addExptInfo(EnumExceptionCodes.ENOUD.name(), inputUldDetails.getULDNumber());
            return false;
          }
         
          loadUld = new EntDbLoadUld();
         
          initialize(loadUld, entDbAfttab);
         
          loadUld.setUldCurrFltno(flightNumber);
          loadUld.setUldNumber(inputUldDetails.getULDNumber().trim());
          loadUld.setCreatedUser(HpEKConstants.ULD_SOURCE_SKYCHAIN);
          loadUld.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.IRT;
        } else {
          oldLoadUld = new EntDbLoadUld(loadUld);
          loadUld.setUpdatedUser(HpEKConstants.ULD_SOURCE_SKYCHAIN);
          loadUld.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.URT;
        }
       
        String uldCreatedDate = convertFlDateToUTC(TZ_DF_FORMATTER, inputUldDetails.getCreatedDate().trim());
        loadUld.setUldCreateDate(new HpUfisCalendar(uldCreatedDate).getTime());
        LOG.debug("ULD Created Date : {}, {}", uldCreatedDate, new HpUfisCalendar(uldCreatedDate).getTime());
       
        loadUld.setUldCreateUser(inputUldDetails.getCreatedBy().trim());
 
        if (!isNullOrEmptyStr(inputUldDetails.getModifiedDate())) {
          String uldModifiedDate = convertFlDateToUTC(TZ_DF_FORMATTER, inputUldDetails.getModifiedDate());
          loadUld.setUldUpdateDate(new HpUfisCalendar(uldModifiedDate).getTime());
          LOG.debug("ULD Modified Date : {}, {}", uldModifiedDate, new HpUfisCalendar(uldModifiedDate).getTime());
        }
 
        if (!isNullOrEmptyStr(inputUldDetails.getModifiedBy())) {
          loadUld.setUldUpdateUser(inputUldDetails.getModifiedBy().trim());
        }
 
        loadUld.setIdFlight(entDbAfttab.getUrno());
        loadUld.setDataSource(HpEKConstants.ULD_SOURCE_SKYCHAIN);
       
        String specialHandlingCodes = loadUld.getShcList();
        List<String> specialHandlingCodeList = isNullOrEmptyStr(specialHandlingCodes) ? Collections.EMPTY_LIST : Arrays.asList(specialHandlingCodes.toUpperCase().split("\\.")) ;
        String inputSHC = inputUldDetails.getSpecialHandlingCode().trim();
View Full Code Here


      //ignore if it's not EK flight
      if(_inputUldScanInfo.getFLIGHTNO().contains("EK")){
        String flno = null;
        String flDate = null;
        String idUld = null;
        EntDbAfttab entFlight = null;
        BigDecimal urno = null;
        //convert the string for flight "EK" to ufis ceda flight num format
        flno = _inputUldScanInfo.getFLIGHTNO().substring(0, 2) + " " +
            HpUfisUtils.formatCedaFltn(_inputUldScanInfo.getFLIGHTNO().substring(2, _inputUldScanInfo.getFLIGHTNO().length()));
        flDate = convertFlDateToUTC(_inputUldScanInfo.getFLIGHTDATE());
        //get the flight urno for arrival
        if("A".equals(_inputUldScanInfo.getFLIGHTAD()))
          entFlight = afttabBean.findUrnoForArr(flno, flDate);

        //get the flight urno for dept
        else if("D".equals(_inputUldScanInfo.getFLIGHTAD()))
          entFlight = afttabBean.findUrnoForDept(flno, flDate);
       
        if(entFlight == null){
          LOG.error("Message dropped..");
          addExptInfo(EnumExceptionCodes.ENOFL.name(), flno);
          return false;
        }
        urno = entFlight.getUrno();
        String uldNumber = _inputUldScanInfo.getULDNUMBER().trim();
        EntDbLoadUld entUld = _dlLoadUldBean.getUldNum(urno, uldNumber);
        idUld = (entUld == null) ? "0" : entUld.getId();
       
        boolean flag = false;
View Full Code Here

          }

          // search in AFTTAB for validity of flight
          equipPosIns.setCurrArrFltnum(formatFltNum(teleMsg
              .getState().getCurrFLNInb()));
          EntDbAfttab criteriaParams = new EntDbAfttab();
          // startTime = new Date().getTime();
          if (_startupInitSingleton.isAfttabOn()
              && !HpUfisUtils.isNullOrEmptyStr(equipPosIns
                  .getCurrArrFltnum())) {
            criteriaParams.setFlno(equipPosIns.getCurrArrFltnum());
            /*
             * criteriaParams
             * .setFlno(HpUfisUtils.formatCedaFltn(equipPosIns
             * .getCurrArrFltnum()));
             * LOG.info("Curr Arr Flight Number: {}", HpUfisUtils
             * .formatCedaFltn(equipPosIns.getCurrArrFltnum()));
             */
            // get the configurable time range offset
            short from = 0;
            short to = 0;
            from = HpProveoConfig.getAfttabRangeFromOffset();
            to = HpProveoConfig.getAfttabRangeToOffset();
            LOG.info("FLNO: " + equipPosIns.getCurrArrFltnum()
                + "  from: " + from + "   To:" + to);
            // find flight from afttab
            // BigDecimal uaft =
            // aftBean.getUrnoByCriteriaQuery(criteriaParams, type,
            // adid);
            BigDecimal urno = aftBean.getUrnoByFilterQuery(
                criteriaParams, ADID.A, from, to);

            if (urno == null) {
              // drop message
              LOG.error("PROVEO Inbound(Arrival) Flight not found from afttab. Dropping the message.");
              if (logLevel
                  .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                      .name())) {
                if (!msgLogged) {
                  irmtabRef = _irmfacade.storeRawMsg(
                      inMessage, dtflString);
                  msgLogged = Boolean.TRUE;
                }
              }
              if (irmtabRef > 0) {
                sendErrInfo(
                    EnumExceptionCodes.ENOFL,
                    irmtabRef,
                    "FltNum: "
                        + equipPosIns
                            .getCurrArrFltnum()
                        + (" Date Range: " + from
                            + "  to: " + to
                            + ". Tele Message ID:" + teleMsg
                              .getMessageId()));

              }
              LOG.error("Message Dropped: TeleMSG Message ID:{}",
                  teleMsg.getMessageId());
              // return false;
              continue;
            } else {
              LOG.info("Inbound Flight Found in AFTTAB. URNO:"
                  + urno);
              equipPosIns.setIdArrFlight(urno);
            }
            // LOG.info("Total Duration on searching inBound flight from AFTTAB (in ms): {}",
            // new Date().getTime() - startTime);
          }
          equipPosIns.setCurrDepFltnum(formatFltNum(teleMsg
              .getState().getCurrFLNOutb()));
          if (_startupInitSingleton.isAfttabOn()
              && !HpUfisUtils.isNullOrEmptyStr(equipPosIns
                  .getCurrDepFltnum())) {
            /*
             * LOG.info("Current Dept Flight Number : {}",
             * HpUfisUtils
             * .formatCedaFltn(equipPosIns.getCurrDepFltnum()));
             */
            /*
             * criteriaParams
             * .setFlno(HpUfisUtils.formatCedaFltn(equipPosIns
             * .getCurrDepFltnum()));
             */
            criteriaParams.setFlno(equipPosIns.getCurrDepFltnum());

            // find flight from afttab
            // BigDecimal uaft =
            // aftBean.getUrnoByCriteriaQuery(criteriaParams, type,
            // adid);
View Full Code Here

     
        String flno = null;
        String connectedFlno = "0";
        String flDate = null;
        String connectedFlDate = null;
        EntDbAfttab entFlight = null;
        String act3 = null;
        String act5 = null;
        BigDecimal urno = null;
        BigDecimal connectedUrno = null;
       
        //convert the string for flight "EK" to ufis ceda flight num format
        flno = _inputUldInfo.getFLIGHTNO().substring(0,2) + " " +
            HpUfisUtils.formatCedaFltn(_inputUldInfo.getFLIGHTNO().substring(2, _inputUldInfo.getFLIGHTNO().length()));
        if(HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getCONNFLIGHTNO()))
          connectedFlno = "0";
        else
          connectedFlno = _inputUldInfo.getCONNFLIGHTNO().substring(0,2) + " "+
             HpUfisUtils.formatCedaFltn(_inputUldInfo.getCONNFLIGHTNO().substring(2,_inputUldInfo.getCONNFLIGHTNO().length()));
       
        flDate = convertFlDateToUTC(_inputUldInfo.getFLIGHTDATE());
        if(!HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getCONNFLIGHTDATE()))
          connectedFlDate = convertFlDateToUTC(_inputUldInfo.getCONNFLIGHTDATE());
       
        //get the flight urno for arrival
        if("A".equals(_inputUldInfo.getFLIGHTAD())){
          entFlight = afttabBean.findUrnoForArr(flno, flDate);
          if(connectedFlno != "0"){
            //get the connected flight urno for arr which is not arrival
            if(!HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getCONNFLIGHTNO()))
              connectedUrno = afttabBean.findUrnoForNotArr(connectedFlno, connectedFlDate);
          }
        }
        //get the flight urno for dept
        else if("D".equals(_inputUldInfo.getFLIGHTAD())){
          entFlight = afttabBean.findUrnoForDept(flno, flDate);
          if(connectedFlno != "0"){
            //get the connected flight urno for dept which is not dept
            if(!HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getCONNFLIGHTNO()))
              connectedUrno = afttabBean.findUrnoForNotDept(connectedFlno, connectedFlDate);
          }
        }
        if(entFlight == null){
          LOG.error("Message dropped.");
          addExptInfo(EnumExceptionCodes.ENOFL.name(), flno);
          return false;
        }else{
          urno = entFlight.getUrno();
          act3 = entFlight.getAct3().trim();
          act5 = entFlight.getAct5().trim();
        }
        connectedUrno = (connectedUrno == null) ? new BigDecimal(0) : connectedUrno;
       
        EntDbLoadUld loadUld = null;
        EntDbLoadUld oldLoadUld = null;
View Full Code Here

            .getFlightDate());
        LOG.debug("flightNumber: " + flightNumber + "   FlightDate:"
            + fltDate);

        /* Change */
        EntDbAfttab criteriaParams = new EntDbAfttab();
        criteriaParams.setFlno(flightNumber);
        criteriaParams.setFlda(fltDate);
        // criteriaParams.setAdid('D');
        if (HpUfisUtils.isNullOrEmptyStr(bagDetails.getFlightInfo()
            .getArrivalAirport())) {
          urno = _afttabBean.getUrnoByFldaFlnoAdid(criteriaParams,
              null, bagDetails.getFlightInfo()
                  .getDepartureAirport());
        } else {
          urno = _afttabBean.getUrnoByFldaFlnoAdid(criteriaParams,
              bagDetails.getFlightInfo().getArrivalAirport(),
              bagDetails.getFlightInfo().getDepartureAirport());
        }
        if (urno == null || String.valueOf(urno) == null
            || urno.isEmpty()) {
          // populate ID_FLIGHT as ZERO
          urno = new Long(0).toString();
          LOG.error(
              "No flight is available in AFTTAB with the Flight details:"
                  + "BagTag = {}, " + "flight Number = {}, "
                  + "Flight Date= {}, ", new Object[] {
                  bagDetails.getBagInfo().getBagTag(),
                  flightNumber, fltDate });
          if (!HpUfisUtils.isNullOrEmptyStr(bagDetails
              .getFlightInfo().getArrivalAirport())) {
            if (logLevel
                .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                    .name())) {
              if (!msgLogged) {
                irmtabRef = _irmfacade.storeRawMsg(message,
                    dtflStr);
                msgLogged = Boolean.TRUE;
              }
            }
            if (irmtabRef > 0) {
              sendErrInfo(EnumExceptionCodes.ENOFL,
                  "FLight not found.Bag Tag:"
                      + bagDetails.getBagInfo()
                          .getBagTag()
                      + "  Flight Number:"
                      + bagDetails.getFlightInfo()
                          .getFullFlightNumber()
                      + "  Flight Date:"
                      + bagDetails.getFlightInfo()
                          .getFlightDate(), irmtabRef);
            }
          }

        }
        // long idFlight = (urno != null && (String.valueOf(urno) !=
        // null) && (!urno
        // .isEmpty())) ? Long.parseLong(urno) : 0;
        long idFlight = Long.parseLong(urno);
        List<EntDbLoadBag> loadBagDetailsList = new ArrayList<EntDbLoadBag>();
        String recStatus = " ";
        if (bagDetails.getMeta().getMessageSubtype().value()
            .equalsIgnoreCase(MsgSubType.DEL.value())) {
          // if
          // (!HpUfisUtils.isNullOrEmptyStr(bagDetails.getBagInfo().getPassengerSeqNo()))
          // {
          startTime = new Date().getTime();
          if (idFlight != 0) {
            if (!HpUfisUtils.isNullOrEmptyStr(bagDetails
                .getBagInfo().getPassengerSeqNo())) {
              // loadBagDetailsList =
              // _loadBagUpdate.getBagMoveDetails(
              // bagDetails.getBagInfo().getBagTag(), bagDetails
              // .getBagInfo().getPassengerSeqNo(),
              // flightNumber, fltDate, bagDetails
              // .getFlightInfo().getArrivalAirport());
              loadBagDetailsList = _loadBagUpdate
                  .getBagMoveDetailsByBagtagPax(
                      idFlight,
                      bagDetails.getBagInfo().getBagTag(),
                      bagDetails.getBagInfo()
                          .getPassengerSeqNo());
            } else {
              loadBagDetailsList = _loadBagUpdate
                  .getBagMoveDetailsByBagTag(idFlight,
                      bagDetails.getBagInfo().getBagTag());
            }
          }
          LOG.debug(
              "Total Duration on loading bag details (in ms): {}",
              new Date().getTime() - startTime);
          // }
          if (loadBagDetailsList.size() == 1) {
            if (loadBagDetailsList.get(0).getBagClassify() != null
                && (loadBagDetailsList.get(0).getBagClassify()
                    .equalsIgnoreCase("RUSH"))) {
              oldLoadBag = loadBagDetailsList.get(0).getClone();
              loadBagDetailsList.get(0).setRecStatus("X");
              loadBagDetailsList.get(0).setUpdatedUser(
                  HpEKConstants.BELT_SOURCE);
              loadBagDetailsList.get(0).setUpdatedDate(
                  HpUfisCalendar.getCurrentUTCTime());
              loadBagStat = _loadBagUpdate
                  .updateLoadedBag(loadBagDetailsList.get(0));
              LOG.info(
                  "One Record found and Deleting the record, Marking status as('X'):"
                      + "BagTag = {}, "
                      + "flight Number = {}, "
                      + "Flight Date= {}, ",
                  new Object[] {
                      bagDetails.getBagInfo().getBagTag(),
                      flightNumber, fltDate });
              if (loadBagStat != null) {
                /*
                 * sendLoadBagUpdateToCedaInJson(loadBagStat,
                 * oldLoadBag, UfisASCommands.URT.name(), true);
                 */
                if (HpUfisUtils
                    .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                  // send notification message to topic
                  ufisTopicProducer.sendNotification(true,
                      UfisASCommands.DRT, String
                          .valueOf(loadBagStat
                              .getId_Flight()),
                      oldLoadBag, loadBagStat);
                }
                if (HpUfisUtils
                    .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                  // if topic not defined, send notification
                  // to queue
                  ufisQueueProducer.sendNotification(true,
                      UfisASCommands.DRT, String
                          .valueOf(loadBagStat
                              .getId_Flight()),
                      oldLoadBag, loadBagStat);
                }
                LOG.debug("Bag Record change has beed communicated to Ceda.");
              }
            } else {
              oldLoadBag = loadBagDetailsList.get(0);
              loadBagDetailsList.get(0).setRecStatus("I");
              loadBagDetailsList.get(0).setUpdatedUser(
                  HpEKConstants.BELT_SOURCE);
              loadBagDetailsList.get(0).setUpdatedDate(
                  HpUfisCalendar.getCurrentUTCTime());
              loadBagStat = _loadBagUpdate
                  .updateLoadedBag(loadBagDetailsList.get(0));
              LOG.info(
                  "One Record found but it is not RUSH bag updating the record status('I'):"
                      + "BagTag = {}, "
                      + "flight Number = {}, "
                      + "Flight Date= {}, ",
                  new Object[] {
                      bagDetails.getBagInfo().getBagTag(),
                      flightNumber, fltDate });
              if (loadBagStat != null) {
                /*
                 * sendLoadBagUpdateToCedaInJson(loadBagStat,
                 * oldLoadBag, UfisASCommands.URT.name(), true);
                 */
                if (HpUfisUtils
                    .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                  // send notification message to topic
                  ufisTopicProducer.sendNotification(true,
                      UfisASCommands.URT, String
                          .valueOf(loadBagStat
                              .getId_Flight()),
                      oldLoadBag, loadBagStat);
                }
                if (HpUfisUtils
                    .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                  // if topic not defined, send notification
                  // to queue
                  ufisQueueProducer.sendNotification(true,
                      UfisASCommands.URT, String
                          .valueOf(loadBagStat
                              .getId_Flight()),
                      oldLoadBag, loadBagStat);
                }

                LOG.debug("Bag Record change has beed communicated to Ceda.");
              }
            }
          } else if (loadBagDetailsList.size() > 1) {
            boolean isLast = false;
            for (EntDbLoadBag bagRecs : loadBagDetailsList) {
              if (bagRecs.equals(loadBagDetailsList
                  .get(loadBagDetailsList.size() - 1))) {
                isLast = true;
              }
              oldLoadBag = bagRecs.getClone();
              if (!bagRecs.getRecStatus().equalsIgnoreCase("R")) {
                bagRecs.setRecStatus("R");
                bagRecs.setUpdatedUser(HpEKConstants.BELT_SOURCE);
                bagRecs.setUpdatedDate(HpUfisCalendar
                    .getCurrentUTCTime());
                loadBagStat = _loadBagUpdate
                    .updateLoadedBag(bagRecs);
                if (loadBagStat != null) {
                  /*
                   * sendLoadBagUpdateToCedaInJson(loadBagStat,
                   * oldLoadBag, UfisASCommands.URT.name(),
                   * true);
                   */
                  if (HpUfisUtils
                      .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                    // send notification message to topic
                    ufisTopicProducer.sendNotification(
                        isLast, UfisASCommands.URT,
                        String.valueOf(loadBagStat
                            .getId_Flight()),
                        oldLoadBag, loadBagStat);
                  }
                  if (HpUfisUtils
                      .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                    // if topic not defined, send
                    // notification to queue
                    ufisQueueProducer.sendNotification(
                        isLast, UfisASCommands.URT,
                        String.valueOf(loadBagStat
                            .getId_Flight()),
                        oldLoadBag, loadBagStat);
                  }
                  LOG.debug("Bag Record change has beed communicated to Ceda.");
                }
              }
            }
            LOG.info(
                "Multiple records found related to bagdetails. Updating existing recStatus as 'R'. Ignoring the message."
                    + "BagTag = {}, "
                    + "flight Number = {}, "
                    + "Flight Date= {}, ", new Object[] {
                    bagDetails.getBagInfo().getBagTag(),
                    flightNumber, fltDate });
          } else {
            LOG.info("Record not found .Message Details::"
                + "BagTag = {}, " + "flight Number = {}, "
                + "Flight Date= {}, ", new Object[] {
                bagDetails.getBagInfo().getBagTag(),
                flightNumber, fltDate });
            if (logLevel
                .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                    .name())) {
              if (!msgLogged) {
                irmtabRef = _irmfacade.storeRawMsg(message,
                    dtflStr);
                msgLogged = Boolean.TRUE;
              }
            }
            if (irmtabRef > 0) {
              sendErrInfo(EnumExceptionCodes.ENOBG,
                  "Rec not found in LOAD_BAG.Bag Tag:"
                      + bagDetails.getBagInfo()
                          .getBagTag()
                      + "  Flight Number:"
                      + bagDetails.getFlightInfo()
                          .getFullFlightNumber()
                      + "  Flight Date:"
                      + bagDetails.getFlightInfo()
                          .getFlightDate(), irmtabRef);

            }

            return Boolean.TRUE;
          }
        }
        if (_startupInitSingleton.isMdBagTypeOn()
            && allBagTypes.isEmpty()) {
          allBagTypes = _startupInitSingleton.getMdBagTypeList();
          for (EntDbMdBagType bagTypeRec : allBagTypes) {
            if ((bagTypeRec.getRecStatus() != null)
                && !bagTypeRec.getRecStatus().equalsIgnoreCase(
                    "X")) {
              masterBagTypes.add(bagTypeRec.getBagTypeCode());
            }
          }
        }

        if (_startupInitSingleton.isMdBagTypeOn()
            && (masterBagTypes.isEmpty() || !(masterBagTypes
                .contains(bagDetails.getBagInfo().getBagType()
                    .value())))) {
          LOG.error(
              "Dropping the message .Master Data BagTypes doesn't contain the specified value for the Flight :"
                  + "BagTag = {}, "
                  + "flight Number = {}, "
                  + "Flight Date= {}, ",
              new Object[] {
                  bagDetails.getBagInfo().getBagTag(),
                  bagDetails.getFlightInfo()
                      .getFlightNumber(),
                  bagDetails.getFlightInfo().getFlightDate() });

          if (logLevel
              .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                  .name())) {
            if (!msgLogged) {
              irmtabRef = _irmfacade
                  .storeRawMsg(message, dtflStr);
              msgLogged = Boolean.TRUE;
            }
          }
          if (irmtabRef > 0) {
            sendErrInfo(EnumExceptionCodes.ENOMD,
                "BagType not in MasterData.Bag Type: "
                    + bagDetails.getBagInfo().getBagType()
                        .value()
                    + "  Bag Tag:"
                    + bagDetails.getBagInfo().getBagTag()
                    + "  Flight Number:"
                    + bagDetails.getFlightInfo()
                        .getFullFlightNumber()
                    + "  Flight Date:"
                    + bagDetails.getFlightInfo()
                        .getFlightDate(), irmtabRef);

          }
          return false;

        }
        if (_startupInitSingleton.isMdBagClassifyOn()
            && allBagClassifications.isEmpty()) {
          allBagClassifications = _startupInitSingleton
              .getMdBagClassifyList();
          for (EntDbMdBagClassify bagClassifyRec : allBagClassifications) {
            if ((bagClassifyRec.getRecStatus() != null)
                && !bagClassifyRec.getRecStatus()
                    .equalsIgnoreCase("X")) {
              masterBagClassify.add(bagClassifyRec
                  .getBagClassify());
            }
          }
        }
        if (bagDetails.getBagInfo().getBagClassification() != null
            && (_startupInitSingleton.isMdBagClassifyOn() && (masterBagClassify
                .isEmpty() || (!(masterBagClassify
                .contains(bagDetails.getBagInfo()
                    .getBagClassification())))))) {
          // LOG.error("Dropping the message .Master Data Bag Classify doesn't contain the specified value for the Flight :"
          // + "BagTag = {}, "
          // + "flight Number = {}, " + "Flight Date= {}, ", new
          // Object[]{bagDetails.getBagInfo().getBagTag(),
          // bagDetails.getFlightInfo().getFlightNumber(),
          // bagDetails.getFlightInfo().getFlightDate()});
          LOG.warn(
              "BagClassification is not found in Master Data.Populating the value for the Flight :"
                  + "BagTag = {}, "
                  + "flight Number = {}, "
                  + "Flight Date= {}, ",
              new Object[] {
                  bagDetails.getBagInfo().getBagTag(),
                  bagDetails.getFlightInfo()
                      .getFlightNumber(),
                  bagDetails.getFlightInfo().getFlightDate() });

          if (logLevel
              .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                  .name())) {
            if (!msgLogged) {
              irmtabRef = _irmfacade
                  .storeRawMsg(message, dtflStr);
              msgLogged = Boolean.TRUE;
            }
          }
          if (irmtabRef > 0) {
            sendErrInfo(EnumExceptionCodes.WNOMD,
                "Bag Classification not in MasterData.Bag Classify: "
                    + bagDetails.getBagInfo()
                        .getBagClassification()
                    + "  Bag Tag:"
                    + bagDetails.getBagInfo().getBagTag()
                    + "  Flight Number:"
                    + bagDetails.getFlightInfo()
                        .getFullFlightNumber()
                    + "  Flight Date:"
                    + bagDetails.getFlightInfo()
                        .getFlightDate(), irmtabRef);

          }

          // return false;
        }
        // loadBag.setIdFlight(idFlight);
        loadBag.setId_Flight(new BigDecimal(idFlight));
        // loadBag.setFlightNumber(flightNumber);
        loadBag.setBagFlno(flightNumber);
        // loadBag.setFltDate(fltDate);
        loadBag.setFlt_Date(fltDate);
        loadBag.setMsgSendDate(convertDateToUTC(bagDetails.getMeta()
            .getMessageTime()));
        // loadBag.setFltOrigin3(bagDetails.getFlightInfo()
        // .getDepartureAirport());
        loadBag.setFlt_Origin3(bagDetails.getFlightInfo()
            .getDepartureAirport());
        // loadBag.setFltDest3(bagDetails.getFlightInfo()
        // .getArrivalAirport());
        loadBag.setFlt_Dest3(bagDetails.getFlightInfo()
            .getArrivalAirport());
        loadBag.setBagTag(bagDetails.getBagInfo().getBagTag());
        if (HpUfisUtils.isNotEmptyStr(loadBag.getBagTag())
            && loadBag.getBagTag().length() > 4) {
          airLineCode = getAirLineFromCode(loadBag.getBagTag()
              .substring(1, 4));
          //LOG.info("Airline Code:"+airLineCode);
          if (airLineCode != null
              && bagDetails.getFlightInfo().getArrivalAirport() != null) {
            loadBag.setBagTagStr(airLineCode.concat(
                loadBag.getBagTag().substring(4)).concat(
                bagDetails.getFlightInfo().getArrivalAirport()));
          }
          /*
           * loadBag.setBagTagStr(airLineCode != null ? airLineCode :
           * null);
           */
        }
        if (bagDetails.getBagInfo().getBagType() != null) {
          loadBag.setBagType(bagDetails.getBagInfo().getBagType()
              .value());
        }
        if (bagDetails.getBagInfo().getBagClassification() != null) {
          loadBag.setBagClassify(bagDetails.getBagInfo()
              .getBagClassification());
        }

        if (!HpUfisUtils.isNullOrEmptyStr(bagDetails.getBagInfo()
            .getBagClass())) {
          if (!HpBeltConfig.getBusinessClassBagList().isEmpty()
              && HpBeltConfig.getBusinessClassBagList().contains(
                  bagDetails.getBagInfo().getBagClass())) {
            loadBag.setBagClass("J");
          } else if (!HpBeltConfig.getFirstClassBagList().isEmpty()
              && HpBeltConfig.getFirstClassBagList().contains(
                  bagDetails.getBagInfo().getBagClass())) {
            loadBag.setBagClass("F");
          } else if (!HpBeltConfig.getEconomyClassBagList().isEmpty()
              && HpBeltConfig.getEconomyClassBagList().contains(
                  bagDetails.getBagInfo().getBagClass())) {
            loadBag.setBagClass("Y");
          } else {
            LOG.info(
                "Specified Bag Class is not in configured list for the Flight :"
                    + "BagTag = {}, "
                    + "flight Number = {}, "
                    + "Flight Date= {}, ", new Object[] {
                    bagDetails.getBagInfo().getBagTag(),
                    bagDetails.getFlightInfo()
                        .getFlightNumber(),
                    bagDetails.getFlightInfo()
                        .getFlightDate() });

            if (logLevel
                .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                    .name())) {
              if (!msgLogged) {
                irmtabRef = _irmfacade.storeRawMsg(message,
                    dtflStr);
                msgLogged = Boolean.TRUE;
              }
            }
            if (irmtabRef > 0) {
              sendErrInfo(EnumExceptionCodes.WBGCL,
                  "Bag Class not in config list.Bag Class: "
                      + bagDetails.getBagInfo()
                          .getBagClass()
                      + "  Bag Tag:"
                      + bagDetails.getBagInfo()
                          .getBagTag()
                      + "  Flight Number:"
                      + bagDetails.getFlightInfo()
                          .getFullFlightNumber()
                      + "  Flight Date:"
                      + bagDetails.getFlightInfo()
                          .getFlightDate(), irmtabRef);

            }

            loadBag.setBagClass(bagDetails.getBagInfo()
                .getBagClass());
          }
        }

        loadBag.setPaxName(bagDetails.getBagInfo().getPassengerName());
        loadBag.setPaxRefNum(bagDetails.getBagInfo()
            .getPassengerSeqNo());
        LOG.debug("Pax Seq Num:"
            + bagDetails.getBagInfo().getPassengerSeqNo());
        if (HpUfisUtils.isNullOrEmptyStr(bagDetails.getBagInfo()
            .getPassengerSeqNo())) {
          LOG.warn(
              "Pax (Passenger SeqNO is null) is not available in LOAD_PAX. Flight details:"
                  + "BagTag = {}, " + "PaxRef Number = {}, "
                  + "flight Number = {}, "
                  + "Flight Date= {}, ",
              new Object[] {
                  bagDetails.getBagInfo().getBagTag(),
                  bagDetails.getBagInfo().getPassengerSeqNo(),
                  bagDetails.getFlightInfo()
                      .getFlightNumber(),
                  bagDetails.getFlightInfo().getFlightDate() });

          /*
           * if (logLevel
           * .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
           * .name())) { if (!msgLogged) { irmtabRef = _irmfacade
           * .storeRawMsg(message, dtflStr); msgLogged = Boolean.TRUE;
           * } } if (irmtabRef > 0) {
           * sendErrInfo(EnumExceptionCodes.WNOPX,
           * "Pax num not specified.PaxRefNum: " +
           * bagDetails.getBagInfo() .getPassengerSeqNo() +
           * "  Bag Tag:" + bagDetails.getBagInfo().getBagTag() +
           * "  Flight Number:" + bagDetails.getFlightInfo()
           * .getFullFlightNumber() + "  Flight Date:" +
           * bagDetails.getFlightInfo() .getFlightDate(), irmtabRef);
           *
           * }
           */

        } else {
          startTime = new Date().getTime();
          EntDbLoadPax entLoadPax = _paxBean.getPaxWithPaxRefNum(
              bagDetails.getBagInfo().getPassengerSeqNo(), urno);
          LOG.debug(
              "Total Duration on searching for pax details (in ms): {}",
              new Date().getTime() - startTime);
          if (entLoadPax == null
              || HpUfisUtils.isNullOrEmptyStr(entLoadPax
                  .getUuid())) {
            LOG.warn(
                "Pax details are not available in LOAD_PAX. Flight details:"
                    + "BagTag = {}, "
                    + "PaxRef Number = {}, "
                    + "flight Number = {}, "
                    + "Flight Date= {}, ", new Object[] {
                    bagDetails.getBagInfo().getBagTag(),
                    bagDetails.getBagInfo()
                        .getPassengerSeqNo(),
                    bagDetails.getFlightInfo()
                        .getFlightNumber(),
                    bagDetails.getFlightInfo()
                        .getFlightDate() });

            /*
             * if (logLevel
             * .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev
             * .LOG_ERR .name())) { if (!msgLogged) { irmtabRef =
             * _irmfacade.storeRawMsg(message, dtflStr); msgLogged =
             * Boolean.TRUE; } } if (irmtabRef > 0) {
             * sendErrInfo(EnumExceptionCodes.WNOPX,
             * "Pax not found.PaxRefNum: " + bagDetails.getBagInfo()
             * .getPassengerSeqNo() + "  Bag Tag:" +
             * bagDetails.getBagInfo() .getBagTag() +
             * "  Flight Number:" + bagDetails.getFlightInfo()
             * .getFullFlightNumber() + "  Flight Date:" +
             * bagDetails.getFlightInfo() .getFlightDate(),
             * irmtabRef);
             *
             * }
             */

            // return false;
          } else {
            loadBag.setIdLoadPax(entLoadPax.getUuid());

          }
        }
        loadBag.setChangeDate(chgStringToDate(
            chgStringToFltDate(bagDetails.getBagInfo()
                .getChangeDate()), bagDetails.getBagInfo()
                .getChangeTime()));

        if (bagDetails.getInboundFlight() != null) {
          String inboundUrno = null;
          if (HpUfisUtils.isNullOrEmptyStr(bagDetails
              .getInboundFlight().getCarrierCode())
              || HpUfisUtils.isNullOrEmptyStr(bagDetails
                  .getInboundFlight().getFlightNumber())
              || HpUfisUtils.isNullOrEmptyStr(bagDetails
                  .getInboundFlight().getFlightDate())) {
            LOG.warn(
                "Inbound Flight details are not sufficient to search in AFTTAB. The Inbound Flight details:"
                    + "BagTag = {}, "
                    + "Arrival flight Number = {}, "
                    + "Arrival Flight Date= {}, ",
                new Object[] {
                    bagDetails.getBagInfo().getBagTag(),
                    bagDetails.getInboundFlight()
                        .getFlightNumber(),
                    bagDetails.getInboundFlight()
                        .getFlightDate() });

            String arrFltNumb = bagDetails.getInboundFlight()
                .getCarrierCode() == null ? "  " : bagDetails
                .getInboundFlight().getCarrierCode()
                .substring(0, 2)
                + " "
                + HpUfisUtils.formatCedaFltn(String
                    .valueOf(bagDetails.getInboundFlight()
                        .getFlightNumber()))
                + (bagDetails.getInboundFlight()
                    .getFlightSuffix() == null ? ""
                    : bagDetails.getInboundFlight()
                        .getFlightSuffix());
            String arrFltDate = chgStringToFltDate(bagDetails
                .getInboundFlight().getFlightDate());
            // loadBag.setArrFlightNumber(arrFltNumb);
            loadBag.setBagConxFlno(arrFltNumb);
            // loadBag.setArrFltDate(arrFltDate);
            loadBag.setConxFltDate(arrFltDate);
          } else {

            String arrFltNumb = bagDetails.getInboundFlight()
                .getCarrierCode() == null ? "  " : bagDetails
                .getInboundFlight().getCarrierCode()
                .substring(0, 2)
                + " "
                + HpUfisUtils.formatCedaFltn(String
                    .valueOf(bagDetails.getInboundFlight()
                        .getFlightNumber()))
                + (bagDetails.getInboundFlight()
                    .getFlightSuffix() == null ? ""
                    : bagDetails.getInboundFlight()
                        .getFlightSuffix());
            String arrFltDate = chgStringToFltDate(bagDetails
                .getInboundFlight().getFlightDate());
            LOG.debug("flightNumber: " + arrFltNumb
                + "   FlightDate:" + arrFltDate);
            startTime = new Date().getTime();

            // Change
            EntDbAfttab criteriaParam = new EntDbAfttab();
            // startTime = new Date().getTime();
            criteriaParam.setFlno(arrFltNumb);
            criteriaParam.setFlda(arrFltDate);
            // criteriaParam.setAdid('A');
            inboundUrno = _afttabBean.getUrnoByFldaFlnoAdid(
                criteriaParam, null, bagDetails
                    .getInboundFlight()
                    .getDepartureAirport());
View Full Code Here

        addExptInfo(EWVAL.name(), inputFlightID.getDateOfMonth());
           return false;
      }
     
      LOG.debug("Flight Number, Departure Date - {}, {}", flightNumber, flightDate);
      EntDbAfttab entDbAfttab = afttabBean.findFlightForUws(flightNumber, flightDate);
     
      if(entDbAfttab == null) {
        LOG.error("Flight provided cannot be found. Message will be dropped.");
        addExptInfo(EnumExceptionCodes.ENOFL.name(), String.format("%s (%s)", flightNumber, flightDate));
           return false;
      }

      LOG.debug("URNO from DB - {}", entDbAfttab.getUrno());
      LOG.debug("FLUT : {}, {}", entDbAfttab.getFlut(), flightDate.equals(entDbAfttab.getFlut()));

      EntDbMsgTelex msgTelex = createMessageTelex(message, uwsInfo, entDbAfttab.getUrno());
      if(msgTelex == null) {
        LOG.error("Message Telex persisting encounter error. It won't be persisted.");
      }
     
      List<EntDbLoadUld> existingLoadUlds = dLLoadUldBean.findUldsByFlight(entDbAfttab.getUrno());
      List<EntDbLoadUld> newLoadUlds = new ArrayList<>();
      Map<EntDbLoadUld, EntDbLoadUld> updatedLoadUlds = new HashMap<>();
     
      //TODO: to confirm mei => if no value eg weight status in xml but there is in db, shall update with blank???
      for (UWSULDDetails uwsUld : uwsInfo.getUWSULDDetails()) {
        //TODO: to refactor ummmm
        EntDbLoadUld loadUld = existedLoadUlds(existingLoadUlds, uwsUld.getULDNumber());
        EntDbLoadUld originalUld = null;
        boolean isExisted = true;
        if(loadUld == null) {
          loadUld = new EntDbLoadUld();
          isExisted = false;
          initialize(loadUld, entDbAfttab);
        } else {
          originalUld = new EntDbLoadUld(loadUld);
        }
        loadUld.setIdFlight(entDbAfttab.getUrno());
        loadUld.setUldCurrFltno(flightNumber);
        loadUld.setUldNumber(uwsUld.getULDNumber());
        loadUld.setUldDest3(uwsUld.getDest3());
        loadUld.setUldWeight(uwsUld.getWeight()+"");
        loadUld.setUldWeightStatus(uwsUld.getWeightStatus());
        loadUld.setUldLoadCat1(uwsUld.getLoadCat1());
        loadUld.setUldLoadCat2(uwsUld.getLoadCat2());
        loadUld.setUldContourCode(uwsUld.getLoadContourCode());
        loadUld.setUldContourNum(uwsUld.getLoadContourNumber());
        loadUld.setShcList(uwsUld.getShcList());
        loadUld.setShcRemarks(uwsUld.getShcRemarks());
        loadUld.setDataSource(HpEKConstants.ULD_SOURCE_SKYCHAIN);
        loadUld.setRecFlag(" ");

        if(isExisted) {
          loadUld.setUpdatedUser(HpEKConstants.ULD_SOURCE_SKYCHAIN);
          loadUld.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          updatedLoadUlds.put(loadUld, originalUld);
        } else {
          loadUld.setCreatedUser(HpEKConstants.ULD_SOURCE_SKYCHAIN);
          loadUld.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
          newLoadUlds.add(loadUld);
        }
       
      }
     
      if(!uwsInfo.getBULKULDDetails().isEmpty()) {
        //Delete existing bulk records regarding the provided flight
        dLLoadUldBean.deleteBulkUldsByFlight(entDbAfttab.getUrno());
      }
     
      for (BULKULDDetails bulkUld : uwsInfo.getBULKULDDetails()) {
        //TODO: to refactor ummmm
        EntDbLoadUld loadUld = new EntDbLoadUld();
        initialize(loadUld, entDbAfttab);
        loadUld.setUldNumber(bulkUld.getULDNumber());
        loadUld.setIdFlight(entDbAfttab.getUrno());
        loadUld.setUldCurrFltno(flightNumber);
        loadUld.setUldDest3(bulkUld.getDest3());
        loadUld.setUldWeight(bulkUld.getWeight()+"");
        loadUld.setUldWeightStatus(bulkUld.getWeightStatus());
        loadUld.setUldLoadCat1(bulkUld.getLoadCat1());
        loadUld.setUldLoadCat2(bulkUld.getLoadCat2());
        loadUld.setUldContourCode(bulkUld.getLoadContourCode());
        loadUld.setUldContourNum(bulkUld.getLoadContourNumber());
        loadUld.setShcList(bulkUld.getShcList());
        loadUld.setShcRemarks(bulkUld.getShcRemarks());
        loadUld.setDataSource(HpEKConstants.ULD_SOURCE_SKYCHAIN);
        loadUld.setRecFlag(" ");
        loadUld.setCreatedUser(HpEKConstants.ULD_SOURCE_SKYCHAIN);
        loadUld.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
       
        newLoadUlds.add(loadUld);
      }
     
     
      for (SIULDDetails siUld : uwsInfo.getSIULDDetails()) {
        EntDbLoadUld loadUld = existedLoadUlds(updatedLoadUlds.keySet(), siUld.getULDNumber());
        if(loadUld == null) {
          loadUld = existedLoadUlds(newLoadUlds, siUld.getULDNumber());
        }
        if(loadUld != null) {
          String temp = siUld.getRampTransferFlno();
         
          //TODO: clean code, to reimplement or refactor
          //Reset if there is no QRTX
          if(isNullOrEmptyStr(temp)) {
            loadUld.setRampTransferFlag("");
            loadUld.setRampTransferFlno("");
            loadUld.setIdRampTransferFlight("");
          } else {
            //FIXME: to write API for flight format. This is just temp fix
            loadUld.setRampTransferFlag("Y");
           
            String rampFltNo = formatFlightNo(temp);
           
            LOG.debug("Ramp Transfer Flno - {}", rampFltNo);
            loadUld.setRampTransferFlno(rampFltNo);
           
            HpUfisCalendar startDate = new HpUfisCalendar();
            startDate.setTime(entDbAfttab.getTifd());// eg. 06/19/2013 21:45
            startDate.add(Calendar.HOUR, basicDataSingleton.getRampOffset()); // eg. 06/19/2013 13:45

            HpUfisCalendar endDate = new HpUfisCalendar();
            endDate.setTime(entDbAfttab.getTifd());// eg. 06/19/2013 21:45
           
            LOG.debug("Ramp Tnxfer Flight Criteria : RampTnxferFlno - {}, Startdate - {}, EndDate - {}", loadUld.getRampTransferFlno(), startDate.toString(), endDate.toString());
            EntDbAfttab entDbAfttabTransfer = afttabBean.findRampTransferFlight(loadUld.getRampTransferFlno(), startDate, endDate);
           
            //TODO: to confirm -> if no msg, jz drop whole msg?
            if(entDbAfttabTransfer != null) {
              loadUld.setIdRampTransferFlight(entDbAfttabTransfer.getUrno()+"");
            } else {
              LOG.warn("No flight is found for ramp transfer.");
            }
           
            String transferFltDebugInfo = String.format(", Ramp Tnxfer Flno (PKey) - %s[%s]", loadUld.getRampTransferFlno(), isNullOrEmptyStr(loadUld.getIdRampTransferFlight()) ? "No P-Key found"
View Full Code Here

      }
     
      String flNum = null;
      Date flDate = null;
      BigDecimal urno = null;
      EntDbAfttab entFlight = null;
      String idGateType = "0";
      String idFltJobAssign = "0";
      Date statusChangeDtm = null;
      String crewActivityFlag = "";
      String fltSuffix = null;
      //List<EntDbMdGateType> gateTypeList = new ArrayList<>();
      EntDbFltJobAssign entFltJobAssign = null;
      String cmd = UfisASCommands.IRT.name();
      //sfDate.setTimeZone(HpEKConstants.utcTz);
     
      if(_input.getCrewStatusInfo().getStatus().contains("FAILURE"))
        crewActivityFlag = "F";
      else if(_input.getCrewStatusInfo().getStatus().contains("SUCCESS"))
          crewActivityFlag = "P";
      else{
        LOG.error("Input Crew status Enumeration value is incorrect. Message dropped.");
        addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCrewStatusInfo().getStatus());
        return false;
      }
      fltSuffix = (_input.getFlightID().getFltSfx() == null)? "": _input.getFlightID().getFltSfx();
     
      //format ceda flight string
      /*flNum = _input.getFlightID().getCxCd() +" "+
            HpUfisUtils.formatCedaFltn(_input.getFlightID().getFltNum()) + fltSuffix;*/
      flNum = HpUfisUtils.formatCedaFlno(_input.getFlightID().getCxCd(), _input.getFlightID().getFltNum(), fltSuffix);
     
      //convert to ceda flight time to UTC
      flDate = _input.getFlightID().getFltDate().toGregorianCalendar().getTime();
      /*LOG.info("Flight Date:"+flDate);
      LOG.info("Formatted Flight Date:"+sfDate.format(flDate));*/
      //perform only for deptStn = DXB
      if (HpEKConstants.EK_HOPO.equals(_input.getFlightID().getDepStn()))
        entFlight = clsAfttabBeanLocal.findFlightByFlut(flNum, sfDate.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){
        //urno = new BigDecimal(0);
        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.getCrewDetails().getStaffNo(), _input.getCrewDetails().getCrewType());
        idFltJobAssign = (entFltJobAssign == null)? "0" : entFltJobAssign.getId();
      }
     
View Full Code Here

      sb.append("FLUT: ").append(flut);
      addExptInfo(EnumExceptionCodes.EWVAL.name(), sb.toString());
      return false;
    }
   
    EntDbAfttab deptFlight = clsAfttabBeanLocal.findFlightForDeptByFlnoFlutRegn(flutCeda, flnoCeda, regn);
    if(deptFlight == null){//flight in flt_fuel_status is not existed in AFTTAB
      LOG.warn("Message dropped.");
      sb.append("Flight not found - ");
      sb.append("FLUT: ").append(flutCeda).append(" ");
      sb.append("FLNO: ").append(flnoCeda).append(" ");
      sb.append("REGN: ").append(regn);
      addExptInfo(EnumExceptionCodes.ENOFL.name(), sb.toString());
      return false;
    }
     
    String atot = deptFlight.getAtot();
    int atotNum = 0;
    if(!HpUfisUtils.isNullOrEmptyStr(atot)){
       atotNum = new Integer(atot);
      if(atotNum >= 0){//flight already departed.
        LOG.warn("Dept Flight URNO <{}> has ATOT <{}>. Message dropped.",
            deptFlight.getUrno(), deptFlight.getAtot());
        sb.append("Flight aldy departed - ");
        sb.append("URNO: ").append(deptFlight.getUrno()).append(" ");
        sb.append("ATOT: ").append(deptFlight.getAtot()).append(" ");
        addExptInfo(EnumExceptionCodes.EWVAL.name(), sb.toString());
        return false;
      }
    }
   
    float onBoardFuel = 0;
    EntDbAfttab conxFlight = null;
    BigDecimal idRFlight = new BigDecimal(0);
   
    /***
     * - calculate onBoardFuel by its RKEY(Arr)
     ***/
    //(RKEY != URNO?)
    if(new BigDecimal(deptFlight.getRkey()).compareTo(deptFlight.getUrno()) != 0){
      //get the rotation(ARRIVAL) flight by RKEY
      conxFlight = clsAfttabBeanLocal.findFlightForConxByUrno(deptFlight.getRkey());
      if(conxFlight == null){
        LOG.debug("Rotation flight RKEY <{}> for URNO <{}> is not found in AFTTAB.",
            deptFlight.getRkey(), deptFlight.getUrno());
      }
      else if("A".equals(conxFlight.getAdid().toString().trim())){//rotation flight should be Arrival
        idRFlight = conxFlight.getUrno();
        EntDbFlightFuelStatus conxFltFuel = clsDlFltFuelStatus.findByIdFlight(conxFlight.getUrno());
        if(conxFltFuel != null)
          onBoardFuel = conxFltFuel.getOnboardFuel();
      }
    }
    else//(RKEY == URNO)
View Full Code Here

      }
    }
   
    private EntDbAfttab buildAftCriteria(FlightDetails flightData) {
      // build afttab flight search criteria
        EntDbAfttab entDbAfttab = new EntDbAfttab();
        HpUfisCalendar scheduleDateTime = null;
       
      if (HpUfisUtils.isNotEmptyStr(flightData.getOperationDateGmt())) {
          scheduleDateTime = new HpUfisCalendar(flightData.getOperationDateGmt(),
              HpEKConstants.MACS_TIME_FORMAT);
          // 2013-10-03 updated by JGO - adding FLUT for MACS-FLT
          entDbAfttab.setFlut(scheduleDateTime.getCedaDateString());
          // combine with the time part
          if (HpUfisUtils.isNotEmptyStr(flightData.getOperationTimeGmt())){
                int hour=Integer.parseInt(flightData.getOperationTimeGmt().substring(0, 2));
                int min=Integer.parseInt(flightData.getOperationTimeGmt().substring(2, 4));
                scheduleDateTime.DateAdd(hour, EnumTimeInterval.Hours);
                scheduleDateTime.DateAdd(min, EnumTimeInterval.Minutes);
            }
        }
     
      // flight info
        entDbAfttab.setFltn(HpUfisUtils.formatCedaFltn(flightData.getFlightNumber()));
    if (HpUfisUtils.isNotEmptyStr(flightData.getFlightNumberExp())) {
        entDbAfttab.setFlns(flightData.getFlightNumberExp().charAt(0));
    }
    entDbAfttab.setOrg3(flightData.getBoardPoint());
    // 2013-10-10 udpated by JGO - Add vial into search critiera(boardpoint may be is via)
    entDbAfttab.setVial(flightData.getBoardPoint());
   
    // 2013-10-10 updated by JGO - Remove adid from search criteria
    /*if (HpEKConstants.HOPO.equals(flightData.getBoardPoint())) {
      entDbAfttab.setAdid('D');
    } else {
      entDbAfttab.setAdid('A');
    }*/
   
    // airline codes
    if (HpUfisUtils.isNotEmptyStr(flightData.getAirlineDesignatorExp())) {
        entDbAfttab.setAlc3(flightData.getAirlineDesignator() +
            flightData.getAirlineDesignatorExp());
    } else {
      entDbAfttab.setAlc2(flightData.getAirlineDesignator());
    }
   
    // schedule time
    if (scheduleDateTime != null) {
      if (HpEKConstants.HOPO.equals(flightData.getBoardPoint())) {
        entDbAfttab.setStod(scheduleDateTime.getCedaString());
      } else {
        entDbAfttab.setStoa(scheduleDateTime.getCedaString());
      }
    }
   
    // 2013-10-03 updated by JGO - use flut instead of flda for flight query
    // execution date in local
View Full Code Here

      }
     
      long start = System.currentTimeMillis();
      if (isValid) {
        // according to flight data to search from afttab
          EntDbAfttab queryCriteria = buildAftCriteria(flightData);
            EntDbAfttab result_entDbAfttab = _afttabBeanLocal.findFlight(queryCriteria);
            LOG.debug("Flight Search used: {}ms", (System.currentTimeMillis() - start));
            if (result_entDbAfttab == null) {
              LOG.debug("Flight Record not found in afttab");
            //LOG.debug("Message dropped: \n{}", message);
              StringBuilder sb = new StringBuilder();
              sb.append("Flight Not Found - ");
              sb.append(" FLUT: ").append(queryCriteria.getFlut());
              sb.append(" FLTN: ").append(queryCriteria.getFltn());
              if (queryCriteria.getAlc3() != null) {
                sb.append(" ALC3: ").append(queryCriteria.getAlc3());
              } else {
                sb.append(" ALC2: ").append(queryCriteria.getAlc2());
              }
              sb.append(" Boardpoint: ").append(queryCriteria.getOrg3());
            addExptInfo(EnumExceptionCodes.ENOFL.name(), sb.toString());
            } else {
            // handle the macs-flt and afttab mapping
              start = System.currentTimeMillis();
            handleMapping(flightData, result_entDbAfttab);
            LOG.debug("Handle mapping used: {}ms", (System.currentTimeMillis() - start));
           
            // insert/update class-configuration
            start = System.currentTimeMillis();
            saveOrUpdateLoadInfo(flightData, result_entDbAfttab);
            LOG.debug("Handle class config used: {}ms", (System.currentTimeMillis() - start));
           
            // insert/update fevtab for events
            start = System.currentTimeMillis();
            handleEvent(flightData, result_entDbAfttab);
            LOG.debug("Handle event timing used: {}ms", (System.currentTimeMillis() - start));
           
            if (isMapped) {
            if (actions == null) {
              actions = new ArrayList<>();
            } else {
              actions.clear();
            }
            // set flight urno of afttab
            msgHead.getIdFlight().add(String.valueOf(result_entDbAfttab.getUrno()));
           
            EntUfisMsgACT act = new EntUfisMsgACT();
            // command: MACS ????
            act.setCmd(HpUfisAppConstants.UfisASCommands.IRT.toString());
            // fields: intflid ????
View Full Code Here

TOP

Related Classes of com.ufis_as.ufisapp.server.oldflightdata.entities.EntDbAfttab

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.