Package com.ufis_as.ek_if.belt.entities

Examples of com.ufis_as.ek_if.belt.entities.EntDbLoadBag


          // List<EntDbLoadBag> entLoadBag = _loadBagUpdate
          // .getBagMoveDetailsByBagTag(idFlight,
          // bagDetails.getBagInfo()
          // .getBagTag());
          if (idFlight != 0) {
            EntDbLoadBag entLoadBag = _loadBagUpdate
                .getValidBagMoveDetailsByBagTag(idFlight,
                    bagDetails.getBagInfo().getBagTag());
            LOG.info(
                "Total Duration on searching LOAD_BAG (idFlight{} and BagTag{}) (in ms): {}",
                idFlight, bagDetails.getBagInfo().getBagTag(),
                new Date().getTime() - startTime);
            if (entLoadBag != null) {
              loadBagMove.setIdLoadBag(entLoadBag.getId());
            }
          }/*
           * else { LOG.error(
           * "No record found in LOAD_BAG table for the Bag Move update details:"
           * + "BagTag = {}, " + "IdFlight = {} ", new Object[] {
View Full Code Here


         odat.add(oserviceRequest.getServiceType());
         odat.add(oserviceRequest.getExtInfo());
         odat.add(oserviceRequest.getIdLoadPax());
       }
    }else if (data instanceof EntDbLoadBag){
      EntDbLoadBag loadBag = (EntDbLoadBag) data;
//      fld.add(Long.toString(loadBag.getIdFlight()));
      tabName = "LOAD_BAG";
      selectStr = "WHERE ID = '"+loadBag.getId()+"'";
      idFlightStr = Long.toString(loadBag.getIdFlight());
      ld.add(loadBag.getId());
      // add fields
//      fld.add("ID");
       fld.add("ARR_FLIGHT_NUMBER");
       fld.add("ARR_FLT_DATE");
       fld.add("ARR_FLT_DEST3");
       fld.add("ARR_FLT_ORIGIN3");
       fld.add("BAG_CLASS");
       fld.add("BAG_CLASSIFY");
       fld.add("BAG_TAG");
       fld.add("BAG_TYPE");
       fld.add("CHANGE_DATE");
       fld.add("DATA_SOURCE");
       fld.add("DEP_FLIGHT_NUMBER");
       fld.add("DEP_FLT_DATE");
       fld.add("DEP_FLT_DEST3");
       fld.add("DEP_FLT_ORIGIN3");
       fld.add("ID_ARR_FLIGHT");
       fld.add("ID_DEP_FLIGHT");
       fld.add("ID_LOAD_PAX");
       fld.add("MSG_SEND_DATE");
       fld.add("PAX_NAME");
       fld.add("PAX_REF_NUM");
       fld.add("REC_STATUS");
       fld.add("BAG_TAG_STR");
       fld.add("BAGWEIGHT");
       // added 2014-01-06
       fld.add("ID_FLIGHT");
       fld.add("ID_CONX_FLIGHT");
      // populate data
//       dat.add(loadBag.getId());
       dat.add(loadBag.getArrFlightNumber());
       dat.add(loadBag.getArrFltDate());
       dat.add(loadBag.getArrFltDest3());
       dat.add(loadBag.getArrFltOrigin3());
       dat.add(loadBag.getBagClass());
       dat.add(loadBag.getBagClassify());
       dat.add(loadBag.getBagTag());
       dat.add(loadBag.getBagType());
       dat.add(loadBag.getChangeDate());
       dat.add(loadBag.getDataSource());
       dat.add(loadBag.getFlightNumber());
       dat.add(loadBag.getFltDate());
       dat.add(loadBag.getFltDest3());
       dat.add(loadBag.getFltOrigin3());
       dat.add(loadBag.getIdArrFlight());
       dat.add(loadBag.getIdFlight());
       dat.add(loadBag.getIdLoadPax());
       dat.add(loadBag.getMsgSendDate());
       dat.add(loadBag.getPaxName());
       dat.add(loadBag.getPaxRefNum());
       dat.add(loadBag.getRecStatus());
       dat.add(loadBag.getBagTagStr());
       dat.add(loadBag.getBagWeight());
       // added 2014-01-06
       dat.add(loadBag.getId_Flight());
       dat.add(loadBag.getIdConxFlight());
       if (oldData != null && oldData instanceof EntDbLoadBag){
         EntDbLoadBag oloadBag = (EntDbLoadBag) oldData;
//         odat.add(oloadBag.getId());
         odat.add(oloadBag.getArrFlightNumber());
         odat.add(oloadBag.getArrFltDate());
         odat.add(oloadBag.getArrFltDest3());
         odat.add(oloadBag.getArrFltOrigin3());
         odat.add(oloadBag.getBagClass());
         odat.add(oloadBag.getBagClassify());
         odat.add(oloadBag.getBagTag());
         odat.add(oloadBag.getBagType());
         odat.add(oloadBag.getChangeDate());
         odat.add(oloadBag.getDataSource());
         odat.add(oloadBag.getFlightNumber());
         odat.add(oloadBag.getFltDate());
         odat.add(oloadBag.getFltDest3());
         odat.add(oloadBag.getFltOrigin3());
         odat.add(oloadBag.getIdArrFlight());
         odat.add(oloadBag.getIdFlight());
         odat.add(oloadBag.getIdLoadPax());
         odat.add(oloadBag.getMsgSendDate());
         odat.add(oloadBag.getPaxName());
         odat.add(oloadBag.getPaxRefNum());
         odat.add(oloadBag.getRecStatus());
         odat.add(oloadBag.getBagTagStr());
         odat.add(oloadBag.getBagWeight());
         // added 2014-01-06
         odat.add(oloadBag.getId_Flight());
         odat.add(oloadBag.getIdConxFlight());
       }
     
    }
   
    header.getIdFlight().add(idFlightStr);
View Full Code Here

  // }
  //

  @Override
  public List<EntDbLoadBag> getBagMoveDetailsByBagTag(long idFlight, String bagTag) {
    EntDbLoadBag result = null;
    Query query = em.createNamedQuery("EntDbLoadBag.findByFlIdBagTag");
    query.setParameter("idFlight", new BigDecimal(idFlight));
    query.setParameter("bagTag", bagTag);
    // query.setParameter("recStatus", "X");
    // LOG.info("Query:" + query.toString());
View Full Code Here

    return results;
  }

  @Override
  public EntDbLoadBag getValidBagMoveDetailsByBagTag(long idFlight, String bagTag) {
    EntDbLoadBag result = null;
    Query query = em.createNamedQuery("EntDbLoadBag.findByValidFlIdBagTag");
    query.setParameter("idFlight", new BigDecimal(idFlight));
    query.setParameter("bagTag", bagTag);
    // query.setParameter("recStatus", "X");
    // LOG.info("Query:" + query.toString());
View Full Code Here

  }

  @Override
  @TransactionAttribute(TransactionAttributeType.REQUIRED)
  public EntDbLoadBag updateLoadedBag(EntDbLoadBag loadBag) {
    EntDbLoadBag loadBagStat = null;
    try {
      loadBagStat = em.merge(loadBag);
      LOG.debug("Merge Successfull");

    } catch (OptimisticLockException Oexc) {
View Full Code Here

    if(!cmd.equalsIgnoreCase(IRT.name()) && !cmd.equalsIgnoreCase(DRT.name()) && !cmd.equalsIgnoreCase(URT.name())) {
      LOG.warn("LoadBag record command is {} but not IRT/DRT/URT. The process won't be continued.", cmd);
      return;
    }
   
    EntDbLoadBag loadBag = formLoadBag(ufisMsgDTO);
    if(loadBag == null) {
      LOG.error("LoadBag cannot be created with provided data. The process will not be performed.");
      return;
    }
   
    LOG.info("ID_FLIGHT : {}, ID_CONX_FLIGHT : {}", loadBag.getId_Flight(), loadBag.getIdConxFlight());
   
    //To process only when both id_flight and id_conx_flight have value.
    if(loadBag.getId_Flight() == null || loadBag.getIdConxFlight() == null ||
        loadBag.getId_Flight().equals(BigDecimal.ZERO) || loadBag.getIdConxFlight().equals(BigDecimal.ZERO) ||
        loadBag.getId_Flight().equals(loadBag.getIdConxFlight())) {
      LOG.error("ID_FLIGHT[{}] and ID_CONX_FLIGHT[{}] must be provided and not be the same. Otherwise the process will not be performed.", loadBag.getId_Flight(), loadBag.getIdConxFlight());
      return;
    }
   
    switch(cmd) {
      case "IRT": processConxStatForIRT(loadBag);
View Full Code Here

    if(fldList.size() != data.size()) {
      LOG.error("Field list size and data list size are not equal. The process will not be performed.");
      return null;
    }
   
    EntDbLoadBag loadBag = new EntDbLoadBag();
   
    int i = 0;
    for (String fld : fldList) {
      Object eachData = data.get(i);
      switch(fld.toUpperCase()){
        case "ID_FLIGHT": loadBag.setId_Flight(eachData == null ? BigDecimal.ZERO : BigDecimal.valueOf(Long.parseLong(eachData.toString()))); break;
        case "ID_CONX_FLIGHT" : loadBag.setIdConxFlight(eachData == null ? BigDecimal.ZERO : BigDecimal.valueOf(Long.parseLong(eachData.toString()))); break;
      }
      i++;
    }
   
    return loadBag;
View Full Code Here

      boolean isTotalBagWeightSet = false;

      for (int i = 0; i < bagTagList.length; i++) {
        if (bagTagList[i] != null && !"".equals(bagTagList[i].trim())) {

          EntDbLoadBag entDbLoadBag = null;
         
          boolean isLastBagRecord = false;
          // int intSize = loadBagList.size();
          for (int j = 0; j < loadBagList.size();) {
            if (loadBagList.size() == 1){
              isLastBagRecord = true;
            }
           
            if (bagTagList[i].equalsIgnoreCase(loadBagList.get(j)
                .getBagTagStr())) {
              entDbLoadBag = loadBagList.get(j);
              loadBagList.remove(j);
              break;
            } else {
              j++;
            }
          }

          // pase bag tag str to bag tag info
          String bagTagStr = bagTagList[i];
          String bagTag = "000";
          // 2013-11-14 updated by JGO - According to Jira: UFIS-3041
          /*boolean isConvertionFoundFromMd = false;
          Map<String, String> airlineCodeConvertMap = entStartupInitSingleton.getAirlineCodeCnvertMap();
          Iterator airlineCodeConvertMapIt = airlineCodeConvertMap.entrySet().iterator();
          if (bagTagStr != null && bagTagStr.length() > 10) {
            bagTagStr = bagTagStr.trim();
            String codeStr = bagTagStr.substring(0, 2);
            LOG.info("airline code from bagTag info : {} , start to searching from master table",
                codeStr);
            while (airlineCodeConvertMapIt.hasNext()) {
              Map.Entry<String, String> pairs = (Entry<String, String>) airlineCodeConvertMapIt
                  .next();
              if (codeStr.equals(pairs.getKey())) {
                bagTag = pairs.getValue()
                    + bagTagStr.substring(2, 8);
                isConvertionFoundFromMd = true;
                LOG.info(
                    "airline code {} found from MD and convert to {}",
                    pairs.getKey(), pairs.getValue());
              }
            }

            if (!isConvertionFoundFromMd) {
              LOG.info(
                  "aline code {} not found in MD cache and set bagTag = 0",
                  codeStr);
            }
            // if ("EK".equalsIgnoreCase(codeStr)){
            // bagTag = "0176" + bagTagStr.substring(2,8);
            // }else{
            // LOG.warn("Attention !, Unknown Bag Tag Info {}",
            // bagTagStr);
            // }
          } else {
            LOG.warn(
                "Attention !, incorrect bag tag information {}",
                bagTagStr);
          }*/
          String airline = null;
          String iataNum = null;
          if (bagTagStr != null && bagTagStr.length() > 10) {
            bagTagStr = bagTagStr.trim();
            airline = bagTagStr.substring(0, 2);
            LOG.info("Airline code from bagTag info : {}", airline);
            // find airline iata number
            if (airlineIataNumber != null) {
              iataNum = airlineIataNumber.get(airline);
            } else {
              LOG.warn("No ALTTAB info found, will manually mapping IATA code for known airline");
              // if ALTTAB master data is empty or null, check airline code from tag
              if ("EK".equalsIgnoreCase(airline)) {
                iataNum = "0176";
              } else {
                LOG.warn("No Setting found for airline: {}", airline);
              }
            }
            LOG.debug("IATA number for airline={} is: {}", airline, iataNum);
          } else {
            LOG.warn("Invalid bag tag information: {}", bagTagStr);
          }
         
          if (iataNum != null) {
            bagTag = iataNum + bagTagStr.substring(2,8);
          } else {
            bagTag += bagTagStr.substring(2,8);
          }

          startTime = new Date().getTime();
          if (entDbLoadBag == null) {
            entDbLoadBag = new EntDbLoadBag();
            entDbLoadBag.setBagTagStr(bagTagStr); //
            entDbLoadBag.setBagTag(bagTag);
            entDbLoadBag.setBagType(bagType);
            entDbLoadBag.setBagClassify("GATE");
            if ("A".equalsIgnoreCase(adid.toString())) {
              entDbLoadBag.setIdArrFlight(idFlight);
              // added by 2013.10.22
              entDbLoadBag.setArrFlightNumber(mainFlightNumber);
              entDbLoadBag.setFlightNumber(connFlightNumber);
              entDbLoadBag.setArrFltDate(mainFlightDate);
              entDbLoadBag.setFltDate(connFLightDate);
              entDbLoadBag.setArrFltOrigin3(mainOrigin3);
              entDbLoadBag.setFltOrigin3(connOrigin3);
              entDbLoadBag.setArrFltDest3(mainDest3);
              entDbLoadBag.setFltDest3(connDest3);
            } else if ("D".equalsIgnoreCase(adid.toString())) {
              entDbLoadBag.setIdFlight(idFlight);
              // added by 2013.10.22
              entDbLoadBag.setArrFlightNumber(connFlightNumber);
              entDbLoadBag.setFlightNumber(mainFlightNumber);
              entDbLoadBag.setArrFltDate(connFLightDate);
              entDbLoadBag.setFltDate(mainFlightDate);
              entDbLoadBag.setArrFltOrigin3(connOrigin3);
              entDbLoadBag.setFltOrigin3(mainOrigin3);
              entDbLoadBag.setArrFltDest3(connDest3);
              entDbLoadBag.setFltDest3(mainDest3);
            }

            // added by 2013.10.22 2:19
            if (entDbLoadPax.getTravelledClass() != null) {
              entDbLoadBag.setBagClass(entDbLoadPax
                  .getTravelledClass());
            } else {
              entDbLoadBag.setBagClass(entDbLoadPax
                  .getBookedClass());
            }

            // added by 2013.10.22
            if (!isTotalBagWeightSet) {
              entDbLoadBag.setBagWeight(entDbLoadPax
                  .getBagWeight());
              isTotalBagWeightSet = true;
            } else {
              entDbLoadBag.setBagWeight(new BigDecimal(0));
            }

            entDbLoadBag.setPaxRefNum(refNum);
            entDbLoadBag.setPaxName(paxName);
            entDbLoadBag.setIdLoadPax(idLoadPax);
            if ("OF".equalsIgnoreCase(entDbLoadPax.getPaxStatus())){
              entDbLoadBag.setRecStatus("X");
            }else{
              entDbLoadBag.setRecStatus(" ");
           
            entDbLoadBag.setId((UUID.randomUUID()).toString());
            dlLoadBagUpdateLocal.saveLoadBagMove(entDbLoadBag);
            entDbLoadBag
                .setCreatedUser(HpEKConstants.MACS_PAX_DATA_SOURCE);
            entDbLoadBag
                .setDataSource(HpEKConstants.MACS_PAX_DATA_SOURCE);
            LOG.info(
                "1.2.6 insert records to loadBag table for paxDetails Msg, takes {} ms",
                (System.currentTimeMillis() - startTime));
           
            if (isLastBagRecord){
              // send notification
              ufisTopicProducer.sendNotification(true, UfisASCommands.IRT,
                  String.valueOf(entDbLoadBag.getIdFlight()), null, entDbLoadBag);
            }else{
              // send notification
              ufisTopicProducer.sendNotification(false, UfisASCommands.IRT,
                  String.valueOf(entDbLoadBag.getIdFlight()), null, entDbLoadBag);
            }
     

          } else if (entDbLoadBag != null) {
           
            EntDbLoadBag oldEntDbLoadBag = (EntDbLoadBag)SerializationUtils.clone(entDbLoadBag);
           
            // EntDbLoadBag entDbLoadBag = loadBagTagList.get(0);
            entDbLoadBag.setBagTagStr(bagTagStr); //
            entDbLoadBag.setBagTag(bagTag);
            // entDbLoadBag.setIdFlight(idFlight);
            entDbLoadBag.setPaxRefNum(refNum);
            entDbLoadBag.setPaxName(paxName);
            // entDbLoadBag.setIdLoadPax(idLoadPax);
            entDbLoadBag.setRecStatus(" ");

            if ("A".equalsIgnoreCase(adid.toString())) {
              entDbLoadBag.setIdArrFlight(idFlight);
              // added by 2013.10.22
              entDbLoadBag.setArrFlightNumber(mainFlightNumber);
              entDbLoadBag.setFlightNumber(connFlightNumber);
              entDbLoadBag.setArrFltDate(mainFlightDate);
              entDbLoadBag.setFltDate(connFLightDate);
              entDbLoadBag.setArrFltOrigin3(mainOrigin3);
              entDbLoadBag.setFltOrigin3(connOrigin3);
              entDbLoadBag.setArrFltDest3(mainDest3);
              entDbLoadBag.setFltDest3(connDest3);
            } else if ("D".equalsIgnoreCase(adid.toString())) {
              entDbLoadBag.setIdFlight(idFlight);
              // added by 2013.10.22
              entDbLoadBag.setArrFlightNumber(connFlightNumber);
              entDbLoadBag.setFlightNumber(mainFlightNumber);
              entDbLoadBag.setArrFltDate(connFLightDate);
              entDbLoadBag.setFltDate(mainFlightDate);
              entDbLoadBag.setArrFltOrigin3(connOrigin3);
              entDbLoadBag.setFltOrigin3(mainOrigin3);
              entDbLoadBag.setArrFltDest3(connDest3);
              entDbLoadBag.setFltDest3(mainDest3);
            }

            // added by 2013.10.22
            if (!isTotalBagWeightSet) {
              entDbLoadBag.setBagWeight(entDbLoadPax
                  .getBagWeight());
              isTotalBagWeightSet = true;
            } else {
              entDbLoadBag.setBagWeight(new BigDecimal(0));
            }

            // dlLoadBagUpdateLocal.updateLoadedBag(entDbLoadBag);
            entDbLoadBag.setUpdatedDate(HpUfisCalendar
                .getCurrentUTCTime());
            entDbLoadBag
                .setUpdatedUser(HpEKConstants.MACS_PAX_DATA_SOURCE);
            entDbLoadBag
                .setDataSource(HpEKConstants.MACS_PAX_DATA_SOURCE);
            entDbLoadBag.setUpdatedDate(HpUfisCalendar
                .getCurrentUTCTime());
            LOG.info(
                "1.2.6 update records to loadBag table for paxDetails Msg, takes {} ms",
                (System.currentTimeMillis() - startTime));
           
            if (isLastBagRecord){
            // send notification
            ufisTopicProducer.sendNotification(true, UfisASCommands.URT,
                String.valueOf(entDbLoadBag.getIdFlight()), oldEntDbLoadBag, entDbLoadBag);
            }else{
              // send notification
              ufisTopicProducer.sendNotification(false, UfisASCommands.URT,
                  String.valueOf(entDbLoadBag.getIdFlight()), oldEntDbLoadBag, entDbLoadBag);
            }
          }

        }
      }

    }
    startTime = System.currentTimeMillis();
    // update those deleted message
    if (loadBagList != null && loadBagList.size() > 0) {
      Iterator<EntDbLoadBag> loadBagIt = loadBagList.iterator();
      while (loadBagIt.hasNext()) {
        EntDbLoadBag loadBag = loadBagIt.next();
       
        loadBag.setRecStatus("X");
        loadBag.setUpdatedDate(new Date());
        // dlLoadBagUpdateLocal.updateLoadedBag(loadBag);
        loadBag.setUpdatedUser(HpEKConstants.MACS_PAX_DATA_SOURCE);
        loadBag.setDataSource(HpEKConstants.MACS_PAX_DATA_SOURCE);
        loadBag.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());


        if (loadBagIt.hasNext()){
          // send notification
          ufisTopicProducer.sendNotification(false, UfisASCommands.DRT,
View Full Code Here

         odat.add(oserviceRequest.getServiceType());
         odat.add(oserviceRequest.getExtInfo());
         odat.add(oserviceRequest.getIdLoadPax());
       }
    }else if (data instanceof EntDbLoadBag){
      EntDbLoadBag loadBag = (EntDbLoadBag) data;
//      fld.add(Long.toString(loadBag.getIdFlight()));
      tabName = "LOAD_BAG";
      selectStr = "WHERE ID = '"+loadBag.getId()+"'";
      idFlightStr = Long.toString(loadBag.getIdFlight());
      ld.add(loadBag.getId());
      // add fields
//      fld.add("ID");
       fld.add("ARR_FLIGHT_NUMBER");
       fld.add("ARR_FLT_DATE");
       fld.add("ARR_FLT_DEST3");
       fld.add("ARR_FLT_ORIGIN3");
       fld.add("BAG_CLASS");
       fld.add("BAG_CLASSIFY");
       fld.add("BAG_TAG");
       fld.add("BAG_TYPE");
       fld.add("CHANGE_DATE");
       fld.add("DATA_SOURCE");
       fld.add("DEP_FLIGHT_NUMBER");
       fld.add("DEP_FLT_DATE");
       fld.add("DEP_FLT_DEST3");
       fld.add("DEP_FLT_ORIGIN3");
       fld.add("ID_ARR_FLIGHT");
       fld.add("ID_DEP_FLIGHT");
       fld.add("ID_LOAD_PAX");
       fld.add("MSG_SEND_DATE");
       fld.add("PAX_NAME");
       fld.add("PAX_REF_NUM");
       fld.add("REC_STATUS");
       fld.add("BAG_TAG_STR");
       fld.add("BAGWEIGHT");
       // added 2014-01-06
       fld.add("ID_FLIGHT");
       fld.add("ID_CONX_FLIGHT");
      // populate data
//       dat.add(loadBag.getId());
       dat.add(loadBag.getArrFlightNumber());
       dat.add(loadBag.getArrFltDate());
       dat.add(loadBag.getArrFltDest3());
       dat.add(loadBag.getArrFltOrigin3());
       dat.add(loadBag.getBagClass());
       dat.add(loadBag.getBagClassify());
       dat.add(loadBag.getBagTag());
       dat.add(loadBag.getBagType());
       dat.add(loadBag.getChangeDate());
       dat.add(loadBag.getDataSource());
       dat.add(loadBag.getFlightNumber());
       dat.add(loadBag.getFltDate());
       dat.add(loadBag.getFltDest3());
       dat.add(loadBag.getFltOrigin3());
       dat.add(loadBag.getIdArrFlight());
       dat.add(loadBag.getIdFlight());
       dat.add(loadBag.getIdLoadPax());
       dat.add(loadBag.getMsgSendDate());
       dat.add(loadBag.getPaxName());
       dat.add(loadBag.getPaxRefNum());
       dat.add(loadBag.getRecStatus());
       dat.add(loadBag.getBagTagStr());
       dat.add(loadBag.getBagWeight());
       // added 2014-01-06
       dat.add(loadBag.getId_Flight());
       dat.add(loadBag.getIdConxFlight());
       if (oldData != null && oldData instanceof EntDbLoadBag){
         EntDbLoadBag oloadBag = (EntDbLoadBag) oldData;
//         odat.add(oloadBag.getId());
         odat.add(oloadBag.getArrFlightNumber());
         odat.add(oloadBag.getArrFltDate());
         odat.add(oloadBag.getArrFltDest3());
         odat.add(oloadBag.getArrFltOrigin3());
         odat.add(oloadBag.getBagClass());
         odat.add(oloadBag.getBagClassify());
         odat.add(oloadBag.getBagTag());
         odat.add(oloadBag.getBagType());
         odat.add(oloadBag.getChangeDate());
         odat.add(oloadBag.getDataSource());
         odat.add(oloadBag.getFlightNumber());
         odat.add(oloadBag.getFltDate());
         odat.add(oloadBag.getFltDest3());
         odat.add(oloadBag.getFltOrigin3());
         odat.add(oloadBag.getIdArrFlight());
         odat.add(oloadBag.getIdFlight());
         odat.add(oloadBag.getIdLoadPax());
         odat.add(oloadBag.getMsgSendDate());
         odat.add(oloadBag.getPaxName());
         odat.add(oloadBag.getPaxRefNum());
         odat.add(oloadBag.getRecStatus());
         odat.add(oloadBag.getBagTagStr());
         odat.add(oloadBag.getBagWeight());
         // added 2014-01-06
         odat.add(oloadBag.getId_Flight());
         odat.add(oloadBag.getIdConxFlight());
       }
     
    }
   
    header.getIdFlight().add(idFlightStr);
View Full Code Here

    logLevel = HpCommonConfig.irmtab;
    // String cmdForBroadcasting = null;
    if (irmtabRef > 0) {
      msgLogged = Boolean.TRUE;
    }
    EntDbLoadBag oldLoadBag = new EntDbLoadBag();
    try {
      EntDbLoadBag loadBagStat = null;
      EntDbLoadBag loadBag = new EntDbLoadBag();

      if (_startupInitSingleton.isMDBagTagListOn()
          && arlnIataMap.isEmpty()) {
        arlnIataMap = _startupInitSingleton.getAirlineCodeCnvertMap();
      }

      if (bagDetails.getFlightInfo() != null) {
        String urno = null;

        String flightNumber = bagDetails.getFlightInfo()
            .getCarrierCode() == null ? " "
            : bagDetails.getFlightInfo().getCarrierCode()
                .substring(0, 2)
                + " "
                + HpUfisUtils.formatCedaFltn(String
                    .valueOf(bagDetails.getFlightInfo()
                        .getFlightNumber()))
                + (bagDetails.getFlightInfo().getFlightSuffix() == null ? ""
                    : bagDetails.getFlightInfo()
                        .getFlightSuffix());

        String fltDate = chgStringToFltDate(bagDetails.getFlightInfo()
            .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());
            LOG.debug(
                "Total Duration on searching inboundFlight in AFTTAB (in ms): {}",
                new Date().getTime() - startTime);
            if (inboundUrno == null
                || String.valueOf(inboundUrno) == null
                || inboundUrno.isEmpty()) {
              inboundUrno = new Long(0).toString();
              LOG.error(
                  "No flight is available in AFTTAB with the Inbound Flight details:"
                      + "BagTag = {}, "
                      + "Arrival flight Number = {}, "
                      + "Arrival Flight Date= {}, ",
                  new Object[] {
                      bagDetails.getBagInfo().getBagTag(),
                      arrFltNumb, arrFltDate });

              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);

              }

              // return false;

            }
            // loadBag.setArrFlightNumber(arrFltNumb);
            // loadBag.setArrFltDate(arrFltDate);
            loadBag.setBagConxFlno(arrFltNumb);
            loadBag.setConxFltDate(arrFltDate);
          }
          if (!HpUfisUtils.isNullOrEmptyStr(inboundUrno)) {
            // loadBag.setIdArrFlight(Long.parseLong(inboundUrno));
            loadBag.setIdConxFlight(new BigDecimal(inboundUrno));
          }

          // loadBag.setArrFltOrigin3(bagDetails.getInboundFlight()
          // .getDepartureAirport());
          // loadBag.setArrFltDest3(bagDetails.getInboundFlight()
          // .getArrivalAirport());
          loadBag.setConxFltOrigin3(bagDetails.getInboundFlight()
              .getDepartureAirport());
          loadBag.setConxFltDes3(bagDetails.getInboundFlight()
              .getArrivalAirport());
        }

        loadBag.setRecStatus(recStatus);
        if (bagDetails.getMeta().getMessageSubtype().value()
            .equalsIgnoreCase(MsgSubType.INS.value())) {
          /*
           * cmdForBroadcasting =
           * HpUfisAppConstants.UfisASCommands.IRT .toString();
View Full Code Here

TOP

Related Classes of com.ufis_as.ek_if.belt.entities.EntDbLoadBag

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.