Package com.ufis_as.ek_if.connection

Examples of com.ufis_as.ek_if.connection.FltConnectionDTO


    try {
      // Critical and Short count for main flight
      int shortCount = 0;
      int criticalCount = 0;
      for (Object obj : idConxFlights) {
        FltConnectionDTO dto = (FltConnectionDTO) obj;
        LOG.debug("Main Flt : {}, Conx Flt : {}", mainFlt.getUrno(), dto.getIdConxFlight());
        if(mainFlt.getUrno().equals(dto.getIdConxFlight())) {
          LOG.error("ID_FLIGHT[{}] and ID_CONX_FLIGHT[{}] must not be the same. Otherwise the process will not be performed.", mainFlt.getUrno(), dto.getIdConxFlight());
          return;
        }
        if (dto.getIdConxFlight().intValue() != 0) {
          EntDbAfttab conxFlight = afttabBean.findFlightForConx(dto.getIdConxFlight());
          if (conxFlight != null) {
            // Main flight and conx flight must be either arrival or departure flight
              if (ADID_ARRIVAL != mainFlt.getAdid() && ADID_DEPARTURE != mainFlt.getAdid()) {
                LOG.warn("Main flight must be arrival or departure flight");
                LOG.warn("ADID={} for main flight={}", mainFlt.getAdid(), mainFlt.getUrno());
                continue;
              }
              if (ADID_ARRIVAL != conxFlight.getAdid() && ADID_DEPARTURE != conxFlight.getAdid()) {
                LOG.warn("Conx flight must be arrival or departure flight");
                LOG.warn("ADID={} for conx flight={}", conxFlight.getAdid(), conxFlight.getUrno());
                continue;
              }
             
              // Calculate the time span between main and connect flight
              BigDecimal idArrFlight = null;
              BigDecimal idDepFlight = null;
              HpUfisCalendar tifa = null;
              HpUfisCalendar tifd = null;
              char tga1 = ' ';
              char tgd1 = ' ';
              if (ADID_ARRIVAL == mainFlt.getAdid()) {
                tifa = new HpUfisCalendar(mainFlt.getTifa());
                tifd = new HpUfisCalendar(conxFlight.getTifd());
                idArrFlight = mainFlt.getUrno();
                idDepFlight = conxFlight.getUrno();
                tga1 = mainFlt.getTga1();
                tgd1 = conxFlight.getTgd1();
              } else {
                tifa = new HpUfisCalendar(conxFlight.getTifa());
                tifd = new HpUfisCalendar(mainFlt.getTifd());
                idArrFlight = conxFlight.getUrno();
                idDepFlight = mainFlt.getUrno();
                tga1 = conxFlight.getTgd1();
                tgd1 = mainFlt.getTga1();
              }
              int timeDiff = (int) tifa.timeDiff(tifd, EnumTimeInterval.Minutes, false);
              LOG.debug("Time Difference between main flight and conx flight: {} mins", timeDiff);
             
              // check bag/pax/uld number for transfer
              int transferNum = 0;
            switch (tab) {
            case HpUfisAppConstants.CON_LOAD_BAG_SUMMARY:
              transferNum = dto.getBagPcs();
              break;
            case HpUfisAppConstants.CON_LOAD_PAX_SUMMARY:
              transferNum = dto.getTotalPax();
              break;
            case HpUfisAppConstants.CON_LOAD_ULD_SUMMARY:
              transferNum = dto.getUldPcs();
              break;
            default:
              break;
            }
           
            // Connection status (no transfer subject or pax, no connection)
              String status = null;
              if (transferNum > 0 || tab.equals(HpUfisAppConstants.CON_AFTTAB)) {
                long shortTime = 0;
                long criticalTime = 0;
                if (tga1 != ' ' && tga1 == tgd1) {
                  shortTime = HpEKConstants.CONX_ST_SHORT;
                  criticalTime = HpEKConstants.CONX_ST_CRITICAL;
                } else {
                  shortTime = HpEKConstants.CONX_DT_SHORT;
                  criticalTime = HpEKConstants.CONX_DT_CRITICAL;
                }
                LOG.debug("TGA1: {} - TGD1: {}", tga1, tgd1);
                LOG.debug("Short: {}", shortTime);
                LOG.debug("Critical: {}", criticalTime);
               
                if (timeDiff <= criticalTime) {
                // Critical
                status = HpUfisAppConstants.CONX_STAT_CRITICAL;
                criticalCount += 1;
                } else if (timeDiff > criticalTime && timeDiff <= shortTime) {
                  // Short
                status = HpUfisAppConstants.CONX_STAT_SHORT;
                shortCount += 1;
              } else if (timeDiff > shortTime) {
                // Normal
                status = HpUfisAppConstants.CONX_STAT_NOMRAL;
              } else {
                // No Connection
                status = HpUfisAppConstants.CONX_STAT_NOCONNX;
              }
              } else {
                // No Connection
              status = HpUfisAppConstants.CONX_STAT_NOCONNX;
              }
             
             
              // Find FLT_CONNECT_SUMMARY by id_arr_flight and id_dep_flight
              UfisASCommands cmd =  UfisASCommands.URT;
              EntDbFltConnectSummary data = null;
              EntDbFltConnectSummary fltConx = fltConnectSummaryBean.findExisting(idArrFlight, idDepFlight);
              if (fltConx == null) {
                data = new EntDbFltConnectSummary();
                cmd =  UfisASCommands.IRT;
                data = new EntDbFltConnectSummary();
                data.setIdArrFlight(idArrFlight);
                data.setIdDepFlight(idDepFlight);
                data.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
                data.setCreatedUser(HpEKConstants.FLT_CONX_SOURCE);
                // 2013-11-05 added by JGO - Default connection status
                data.setConxStatPax(HpUfisAppConstants.CONX_STAT_NOCONNX);
                data.setConxStatBag(HpUfisAppConstants.CONX_STAT_NOCONNX);
                data.setConxStatUld(HpUfisAppConstants.CONX_STAT_NOCONNX);
              // 2013-11-04 added by JGO - default decision
                data.setConxDecBag(HpUfisAppConstants.CONX_DEC_NODC);
                data.setConxDecPax(HpUfisAppConstants.CONX_DEC_NODC);
                data.setConxDecUld(HpUfisAppConstants.CONX_DEC_NODC);
                data.setRecStatus(" ");
                fltConnectSummaryBean.persist(data);
              } else {
                data = EntDbFltConnectSummary.valueOf(fltConx);
              }
             
              //evaluatePaxJourneyTime
              switch(tab) {
                case HpUfisAppConstants.CON_AFTTAB:
              case HpUfisAppConstants.CON_LOAD_PAX_SUMMARY:
                 evaluatePaxJourneyTime(tab, mainFlt, conxFlight, data, timeDiff);
                break;
              default:
                break;
              }
            
            switch (tab) {
            case HpUfisAppConstants.CON_AFTTAB:
              data.setConxStatBag(status);
              data.setConxStatPax(status);
              data.setConxStatUld(status);
              break;
            case HpUfisAppConstants.CON_LOAD_BAG_SUMMARY:
              data.setConxStatBag(status);
              break;
            case HpUfisAppConstants.CON_LOAD_PAX_SUMMARY:
              data.setConxStatPax(status);
              break;
            case HpUfisAppConstants.CON_LOAD_ULD_SUMMARY:
              data.setConxStatUld(status);
              break;
            default:
              break;
            }
              data.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
              data.setUpdatedUser(HpEKConstants.FLT_CONX_SOURCE);
             
              //set tifa/tifd
              data.setTifa(tifa.getTime());
              data.setTifd(tifd.getTime());
             
              data = fltConnectSummaryBean.merge(data);
            LOG.debug("Flt_Connect_Summary record has been created/update for idArrFlight={} and idDepFlight={}",
                data.getIdArrFlight(),
                data.getIdDepFlight());
           
            // notification for flt_connect_summary
            long start = System.currentTimeMillis();
            if (HpCommonConfig.notifyTopic != null) {
              ufisTopicProducer.sendNotification(
                  true,
                  cmd,
                  String.valueOf(mainFlt.getUrno()),
                  fltConx,
                  data);
            } else {
              ufisQueueProducer.sendNotification(
                  true,
                  cmd,
                  String.valueOf(mainFlt.getUrno()),
                  fltConx,
                  data);
            }
            LOG.debug("Send Notification msg used: {}", (System.currentTimeMillis() - start));
             
          } else {
            LOG.warn("No conx flight found with urno: {} in afttab for flight: {}",
                dto.getIdConxFlight(),
                mainFlt.getUrno());
          }
        } else {
          LOG.warn("Conx flight urno cannot be 0");
        }
View Full Code Here


      query.setParameter("idFlight", id);
      query.setParameter("infoType", HpUfisAppConstants.INFO_TYPE_TRANSFER);
      List<EntDbLoadBagSummary> res = query.getResultList();
      if (res != null) {
        for (EntDbLoadBagSummary entity : res) {
          FltConnectionDTO dto = new FltConnectionDTO();
          dto.setBagPcs(entity.getBagPcs().intValue());
          dto.setIdFlight(entity.getIdFlight());
          dto.setIdConxFlight(entity.getIdConxFlight());
          list.add(dto);
        }
      }
    } catch (Exception e) {
      LOG.error("Exception: {}", e.getMessage());
View Full Code Here

    //Find FLT_CONNECT_SUMMARY with conxflights and record doesn't exist / evaluate Pax connection status
    if(fltConnectSummaryList.isEmpty()) {
      EntDbAfttab entAft = dlAfttabBean.find(idFlight);
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(idFlight);
      dto.setIdConxFlight(idConxFlight);
      dto.setTotalPax(1);
      list.add(dto);
     
      LOG.info("NO FLT CONX SUMMARY => id_flight[{}, {}], id_conx_flight[{}]", idFlight, entAft.getUrno(), idConxFlight);
     
      fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_PAX_SUMMARY, entAft, list);
     
      return;
    }
   
    //Find FLT_CONNECT_SUMMARY with conxflights and record exists.
    //If ‘PAX connection status’ is blank or ‘no connection’, do processing. Otherwise skip
    //Result is at most 2 - idFlight/arr and idConxFlight/dep OR idConxFlight/arr and idFlight/dep
    for (EntDbFltConnectSummary entDbFltConnectSummary : fltConnectSummaryList) {
      if(HpUfisUtils.isNullOrEmptyStr(entDbFltConnectSummary.getConxStatPax().trim()) || entDbFltConnectSummary.getConxStatPax().trim().equalsIgnoreCase("X")) {
        EntDbAfttab entAft = dlAfttabBean.find(entDbFltConnectSummary.getIdArrFlight());
 
        List<FltConnectionDTO> list = new ArrayList<>();
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdFlight(entDbFltConnectSummary.getIdArrFlight());
        dto.setIdConxFlight(entDbFltConnectSummary.getIdDepFlight());
        dto.setTotalPax(1);
        list.add(dto);
       
        LOG.info("FLT CONX SUMMARY => id_flight[{}, {}], id_conx_flight[{}]", entDbFltConnectSummary.getIdArrFlight(), entAft.getUrno(), entDbFltConnectSummary.getIdDepFlight());
 
        //One pair only
View Full Code Here

    //Find FLT_CONNECT_SUMMARY with conxflights and record doesn't exist / evaluate Pax connection status
    if(fltConnectSummaryList.isEmpty()) {
      EntDbAfttab entAft = dlAfttabBean.find(paxSummary.getIdFlight());
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(paxSummary.getIdFlight());
      dto.setIdConxFlight(paxSummary.getIdConxFlight());
      dto.setTotalPax(paxSummary.getTotalPax().intValue());
      list.add(dto);
     
      fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_PAX_SUMMARY, entAft, list);
     
      return;
    }
   
    //Find FLT_CONNECT_SUMMARY with no conxflights (status is 'X' or status = ' ') and Record exists / evaluate and update PAX conn status
    //Result is at most 2 - idFlight/arr and idConxFlight/dep OR idConxFlight/arr and idFlight/dep
    for (EntDbFltConnectSummary entDbFltConnectSummary : fltConnectSummaryList) {
      if(HpUfisUtils.isNullOrEmptyStr(entDbFltConnectSummary.getConxStatPax().trim()) || entDbFltConnectSummary.getConxStatPax().trim().equalsIgnoreCase("X")) {
        EntDbAfttab entAft = dlAfttabBean.find(entDbFltConnectSummary.getIdArrFlight());
 
        List<FltConnectionDTO> list = new ArrayList<>();
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdFlight(entDbFltConnectSummary.getIdArrFlight());
        dto.setIdConxFlight(entDbFltConnectSummary.getIdDepFlight());
        dto.setTotalPax(paxSummary.getTotalPax().intValue()); //FIXME ???
        list.add(dto);
 
        //One pair only
        fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_PAX_SUMMARY, entAft, list);
      }
View Full Code Here

    //Find FLT_CONNECT_SUMMARY with conxflights and record doesn't exist / evaluate Bag connection status
    if(fltConnectSummaryList.isEmpty()) {
      EntDbAfttab entAft = dlAfttabBean.find(bagSummary.getIdFlight());
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(bagSummary.getIdFlight());
      dto.setIdConxFlight(bagSummary.getIdConxFlight());
      dto.setBagPcs(bagSummary.getBagPcs().intValue());
      list.add(dto);
     
      fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_BAG_SUMMARY, entAft, list);
     
      return;
    }
   
    //Find FLT_CONNECT_SUMMARY with conxflights and record exists.
    //If ‘Bag connection status’ is blank or ‘no connection’, do processing. Otherwise skip
    //Result is at most 2 - idFlight/arr and idConxFlight/dep OR idConxFlight/arr and idFlight/dep
    for (EntDbFltConnectSummary entDbFltConnectSummary : fltConnectSummaryList) {
      if(HpUfisUtils.isNullOrEmptyStr(entDbFltConnectSummary.getConxStatBag().trim()) || entDbFltConnectSummary.getConxStatBag().trim().equalsIgnoreCase("X")) {
        EntDbAfttab entAft = dlAfttabBean.find(entDbFltConnectSummary.getIdArrFlight());
 
        List<FltConnectionDTO> list = new ArrayList<>();
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdFlight(entDbFltConnectSummary.getIdArrFlight());
        dto.setIdConxFlight(entDbFltConnectSummary.getIdDepFlight());
        dto.setBagPcs(bagSummary.getBagPcs().intValue()); //FIXME ???
        list.add(dto);
 
        //One pair only
        fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_BAG_SUMMARY, entAft, list);
      }
View Full Code Here

          //String cmd = act.getCmd();
          String tab = act.getTab();
          List<String> fld = act.getFld();
          List<Object> dat = act.getData();

          FltConnectionDTO dto = null;
          if (fld == null || dat == null || fld.size() != dat.size()) {
            LOG.warn("FLD and DAT are required and size should be matched for Alert Processing");
          } else {
            if (tab != null) {
              switch (tab) {
              case HpUfisAppConstants.CON_AFTTAB:
                fltConxBean.processConxStat(ufisMsgDTO);
                break;
              case HpUfisAppConstants.CON_LOAD_PAX_SUMMARY:
              case HpUfisAppConstants.CON_LOAD_BAG_SUMMARY:
              case HpUfisAppConstants.CON_LOAD_ULD_SUMMARY:
                dto = fltConxBean.handleLoadSummaryMsg(ufisMsgDTO);
                break;
              default:
                LOG.warn("Unsupported table={} encountered", tab);
                break;
              }
            } 
          }
         
          // critical notification(main flight only)
          if (dto != null && dto.getCriticalCount() > 0) {
            sendSummaryToCedaInXmlFormat(tab,
                String.valueOf(dto.getIdFlight()),
                dto.getCriticalCount());
          }
        }
      } else {
        LOG.warn("Message and message body cannot be empty or null");
      }
View Full Code Here

    //Find FLT_CONNECT_SUMMARY with conxflights and record doesn't exist / evaluate Bag connection status
    if(fltConnectSummaryList.isEmpty()) {
      EntDbAfttab entAft = dlAfttabBean.find(idFlight);
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(idFlight);
      dto.setIdConxFlight(loadBag.getIdConxFlight());
      dto.setBagPcs(1);
      list.add(dto);
     
      fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_BAG_SUMMARY, entAft, list);
     
      return;
    }
   
    //Find FLT_CONNECT_SUMMARY with conxflights and record exists.
    //If ‘Bag connection status’ is blank or ‘no connection’, do processing. Otherwise skip
    //Result is at most 2 - idFlight/arr and idConxFlight/dep OR idConxFlight/arr and idFlight/dep
    for (EntDbFltConnectSummary entDbFltConnectSummary : fltConnectSummaryList) {
      if(HpUfisUtils.isNullOrEmptyStr(entDbFltConnectSummary.getConxStatBag().trim()) || entDbFltConnectSummary.getConxStatBag().trim().equalsIgnoreCase("X")) {
        EntDbAfttab entAft = dlAfttabBean.find(entDbFltConnectSummary.getIdArrFlight());
 
        List<FltConnectionDTO> list = new ArrayList<>();
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdFlight(entDbFltConnectSummary.getIdArrFlight());
        dto.setIdConxFlight(entDbFltConnectSummary.getIdDepFlight());
        dto.setBagPcs(1); //FIXME ???
        list.add(dto);
 
        //One pair only
        fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_BAG_SUMMARY, entAft, list);
      }
View Full Code Here

    //Find FLT_CONNECT_SUMMARY with conxflights and record doesn't exist / evaluate ULD connection status
    if(fltConnectSummaryList.isEmpty()) {
      EntDbAfttab entAft = dlAfttabBean.find(loadUld.getIdFlight());
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(idFlight);
      dto.setIdConxFlight(loadUld.getIdConxFlight());
      dto.setUldPcs(1);
      list.add(dto);
     
      fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_ULD_SUMMARY, entAft, list);
     
      return;
    }
   
    //Find FLT_CONNECT_SUMMARY with conxflights and record exists.
    //If ‘ULD connection status’ is blank or ‘no connection’, do processing. Otherwise skip
    //Result is at most 2 - idFlight/arr and idConxFlight/dep OR idConxFlight/arr and idFlight/dep
    for (EntDbFltConnectSummary entDbFltConnectSummary : fltConnectSummaryList) {
      if(HpUfisUtils.isNullOrEmptyStr(entDbFltConnectSummary.getConxStatUld().trim()) || entDbFltConnectSummary.getConxStatUld().trim().equalsIgnoreCase("X")) {
        EntDbAfttab entAft = dlAfttabBean.find(entDbFltConnectSummary.getIdArrFlight());
       
        List<FltConnectionDTO> list = new ArrayList<>();
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdFlight(entDbFltConnectSummary.getIdArrFlight());
        dto.setIdConxFlight(entDbFltConnectSummary.getIdDepFlight());
        dto.setUldPcs(1); //FIXME ???
        list.add(dto);
       
        //One pair only
        fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_ULD_SUMMARY, entAft, list);
      }
View Full Code Here

            res = query2.getResultList();// second query to get conx flights on id_flight or id_conx_flight
           
            if (res != null) {
              LOG.debug("<{}> Conx Flights are found by (id_flight or id_conx_flight)", res.size());
              for (EntDbLoadPaxSummary entity : res) {
                FltConnectionDTO dto = new FltConnectionDTO();
                dto.setTotalPax(entity.getTotalPax().intValue());
              dto.setIdFlight(entity.getIdFlight());
              dto.setIdConxFlight(entity.getIdConxFlight());
                list.add(dto);
              }
            }
        } else if (res != null) {
          LOG.debug("<{}> Conx Flights are found by (id_arr_flight or id_dep_flight)", res.size());
          for (EntDbLoadPaxSummary entity : res) {
            FltConnectionDTO dto = new FltConnectionDTO();
            dto.setTotalPax(entity.getTotalPax().intValue());
            if (HpEKConstants.ADID_A == adid) {
              dto.setIdConxFlight(entity.getIdDepFlight());
            } else {
              dto.setIdConxFlight(entity.getIdArrFlight());
            }
            list.add(dto);
          }
        }
         
View Full Code Here

      query.setParameter("idFlight", idFlight);
      query.setParameter("infoType", HpUfisAppConstants.INFO_TYPE_TRANSFER);
        List<EntDbLoadPaxSummary> res = query.getResultList();
        if (res != null) {
          for (EntDbLoadPaxSummary entity : res) {
            FltConnectionDTO dto = new FltConnectionDTO();
            dto.setTotalPax(entity.getTotalPax().intValue());
          dto.setIdConxFlight(entity.getIdArrFlight());
            list.add(dto);
          }
        }
    } catch (Exception e) {
      LOG.error("ERROR when retrieving connected flights: {}", e.getMessage());
View Full Code Here

TOP

Related Classes of com.ufis_as.ek_if.connection.FltConnectionDTO

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.