Package com.ufis_as.ek_if.connection

Examples of com.ufis_as.ek_if.connection.FltConnectionDTO


        Query query = _em.createNamedQuery("EntDbFltConnectSummary.findExistingForArrival");
        query.setParameter("idFlight", idFlight);
        List<EntDbFltConnectSummary> summaryList = query.getResultList();
        List<FltConnectionDTO> list = new ArrayList<>();
        for (EntDbFltConnectSummary summary : summaryList) {
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdConxFlight(summary.getIdDepFlight());
        list.add(dto);
      }
        return list;
      } catch(Exception ex){
        LOG.error("Error when retrieving existing flight connected summary : {}", ex);
View Full Code Here


        Query query = _em.createNamedQuery("EntDbFltConnectSummary.findExistingForDeparture");
        query.setParameter("idFlight", idFlight);
        List<EntDbFltConnectSummary> summaryList =  query.getResultList();
        List<FltConnectionDTO> list = new ArrayList<>();
        for (EntDbFltConnectSummary summary : summaryList) {
        FltConnectionDTO dto = new FltConnectionDTO();
        dto.setIdConxFlight(summary.getIdDepFlight());
        list.add(dto);
      }
        return list;
      } catch(Exception ex){
        LOG.error("Error when retrieving existing flight connected summary : {}", ex);
View Full Code Here

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

   * @param dto
   * @return
   */
  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  public FltConnectionDTO handleLoadSummaryMsg(EntUfisMsgDTO dto) {
    FltConnectionDTO fltConx = new FltConnectionDTO();
    try {
      // main flight and connect flight urno(uaft)
      String idFlight = null;
      String idConxFlight = null;
     
      // idFlight is the main flight
      List<String> idFlights = dto.getHead().getIdFlight();
      if (idFlights != null && idFlights.size() > 0) {
        // main flight
        idFlight = idFlights.get(0);
        fltConx.setIdFlight(new BigDecimal(idFlight));
       
        EntUfisMsgACT act = dto.getBody().getActs().get(0);
        String tab = act.getTab();
        List<String> fld = act.getFld();
        List<Object> dat = act.getData();
       
        String status = null;
        String bagPcs = null;
        String uldPcs = null;
        String totalPax = null;
        String infoType = null;
        for (int i = 0; i < fld.size(); i++) {
          String field = fld.get(i).toUpperCase();
          Object value = dat.get(i);
          if (value != null) {
            switch (field) {
            case FLD_ID_ARR_FLIGHT:
              if (!value.toString().equals(idFlight)) {
                idConxFlight = value.toString();
              }
              break;
            case FLD_ID_DEP_FLIGHT:
              if (!value.toString().equals(idFlight)) {
                idConxFlight = value.toString();
              }
              break;
            case FLD_INFO_TYPE:
              infoType = value.toString();
              break;
            case FLD_ID_FLIGHT:
              //idFlight = value.toString();
              break;
            case FLD_ID_CONX_FLIGHT:
              idConxFlight = value.toString();
              break;
            case FLD_BAG_PCS:
              bagPcs = value.toString();
              break;
            case FLD_TOTAL_PAX:
              totalPax = value.toString();
              break;
            case FLD_ULD_PCS:
              uldPcs = value.toString();
              break;
            default:
              break;
            }
          }
        }
       
        // Check info_type: only accepted TXF(transfer)
        if (HpUfisAppConstants.INFO_TYPE_TRANSFER.equalsIgnoreCase(infoType)) {
          boolean isValid = false;
          // arrival and departure flight urno cannot be null, empty or 0
          // arrival and departure flight urno cannot be same
          if ((HpUfisUtils.isNotEmptyStr(idFlight) && !DEF_FLIGHT_ID.equals(idFlight))
              && (HpUfisUtils.isNotEmptyStr(idConxFlight) && !DEF_FLIGHT_ID.equals(idConxFlight))
              && (!idFlight.equals(idConxFlight))) {
            // Transfer pax number should be greater than 0
            if (totalPax != null
                && totalPax.matches(NUMBER_VALUE)
                && Integer.parseInt(totalPax) > 0) {
              isValid = true;
            } else {
              if (HpUfisAppConstants.CON_LOAD_PAX_SUMMARY.equalsIgnoreCase(tab)) {
                LOG.warn("Total Pax number for transfer must be greater than 0. Received value: {}", totalPax);
              }
            }
            // Transfer bag pcs should be greater than 0
            if (bagPcs != null
                && bagPcs.matches(NUMBER_VALUE)
                && Integer.parseInt(bagPcs) > 0) {
              isValid = true;
            } else {
              if (HpUfisAppConstants.CON_LOAD_BAG_SUMMARY.equalsIgnoreCase(tab)) {
                LOG.warn("Total Bag Pieces for transfer must be greater than 0. Received value: {}", bagPcs);
              }
            }
            // Treanfer uld pcs should be greater than 0
            if (uldPcs != null
                && bagPcs.matches(NUMBER_VALUE)
                && Integer.parseInt(uldPcs) > 0) {
              isValid = true;
            } else {
              if (HpUfisAppConstants.CON_LOAD_ULD_SUMMARY.equalsIgnoreCase(tab)) {
                LOG.warn("Total Uld Pieces for transfer must be greater than 0. Received value: {}", uldPcs);
              }
            }
             
             
            if (isValid) { 
              long start = System.currentTimeMillis();
              // find arrival and departure flight from afttab
              EntDbAfttab flight = afttabBean.findFlightForConxByUrno(Long.parseLong(idFlight));
                EntDbAfttab conxFlight = afttabBean.findFlightForConxByUrno(Long.parseLong(idConxFlight));
                LOG.debug("Search Flight from afttab used: {}", (System.currentTimeMillis() - start));
                // Main flight and conx flight must be existing in afttab
                if (flight == null) {
                  LOG.warn("Flight not found for urno: {}", idFlight);
                  return null;
                }
                if (conxFlight == null) {
                  LOG.warn("Conx Flight not found for urno: {}", idConxFlight);
                  return null;
                }
                // Main flight and conx flight must be either arrival or departure flight
                if (ADID_ARRIVAL != flight.getAdid() && ADID_DEPARTURE != flight.getAdid()) {
                  LOG.warn("Main flight must be arrival or departure flight");
                  LOG.warn("ADID={} for main flight={}", flight.getAdid(), flight.getUrno());
                  return null;
                }
                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());
                  return null;
                }
               
                // calculate the time span between main and connect flight
                BigDecimal idArrFlight = null;
                BigDecimal idDepFlight = null;
                HpUfisCalendar tifa = null;
                HpUfisCalendar tifd = null;
                if (ADID_ARRIVAL == flight.getAdid()) {
                  tifa = new HpUfisCalendar(flight.getTifa());
                  tifd = new HpUfisCalendar(conxFlight.getTifd());
                  idArrFlight = flight.getUrno();
                  idDepFlight = conxFlight.getUrno();
                } else {
                  tifa = new HpUfisCalendar(conxFlight.getTifd());
                  tifd = new HpUfisCalendar(flight.getTifa());
                  idArrFlight = conxFlight.getUrno();
                  idDepFlight = flight.getUrno();
                }
               
                int timeDiff = (int) tifa.timeDiff(tifd, EnumTimeInterval.Minutes, false);
                LOG.debug("Time Difference between main flight and conx flight: {} mins", timeDiff);
              if (timeDiff > HpEKConstants.MAX_CONX_TIME_PAX_ALERT) {
                // Normal
                //status = "N";
                status = HpUfisAppConstants.CONX_STAT_NOMRAL;
              } else if (timeDiff > HpEKConstants.MIN_CONX_TIME_PAX_ALERT
                  && timeDiff <= HpEKConstants.MAX_CONX_TIME_PAX_ALERT) {
                // Short
                //status = "S";
                status = HpUfisAppConstants.CONX_STAT_SHORT;
              } else if (timeDiff <= HpEKConstants.MIN_CONX_TIME_PAX_ALERT) {
                // Critical
                //critical = 1;
                //status = "C";
                status = HpUfisAppConstants.CONX_STAT_CRITICAL;
                fltConx.setCriticalCount(1);
              } else {
                // No Connection
                //status = "X";
                status = HpUfisAppConstants.CONX_STAT_NOCONNX;
              }
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(uldSummary.getIdFlight());
     
      List<FltConnectionDTO> list = new ArrayList<>();
      FltConnectionDTO dto = new FltConnectionDTO();
      dto.setIdFlight(uldSummary.getIdFlight());
      dto.setIdConxFlight(uldSummary.getIdConxFlight());
      dto.setUldPcs((int) uldSummary.getUldPcs());
      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((int) uldSummary.getUldPcs()); //FIXME ???
        list.add(dto);
 
        //One pair only
        fltConxProcessBean.process(HpUfisAppConstants.CON_LOAD_ULD_SUMMARY, entAft, list);
      }
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.