Package com.ufis_as.ufisapp.lib.time

Examples of com.ufis_as.ufisapp.lib.time.HpUfisCalendar


  private Date convertXMLGregorianCalendarToDate(XMLGregorianCalendar calendar) {
    Date result = null;
    if (calendar != null) {

      HpUfisCalendar cal = new HpUfisCalendar(calendar);
      DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
      DateFormat df2 = new SimpleDateFormat("yyyyMMddHHmmss");
      df.setTimeZone(HpEKConstants.utcTz);
      String date = df.format(cal.getTime());
      try {
        result = df2.parse(date);
      } catch (ParseException e) {
        LOG.debug("timezone convertion erro" + e);
      }
View Full Code Here


    header.setHop(HpEKConstants.HOPO);
    header.setUsr(HpEKConstants.LIDO_SOURCE);
    header.setApp(HpEKConstants.LIDO_SOURCE);
    header.setOrig(HpEKConstants.LIDO_SOURCE);
    header.setDest(HpEKConstants.LIDO_SOURCE);
    HpUfisCalendar cur = new HpUfisCalendar(new Date());
    header.setReqt(cur.getCedaString());
   
    return header;
  }
View Full Code Here

            LOG.error("ULD record does not exist to delete. Message dropped.");
            addExptInfo(EnumExceptionCodes.ENOUD.name(), _inputUldInfo.getULDISDELETED());
            return false;
          }
          loadUld = new EntDbLoadUld();
          loadUld.setFltDate(new HpUfisCalendar(flDate).getTime());
          loadUld.setUldCurrFltno(flno);
          loadUld.setUldNumber(_inputUldInfo.getULDNO());
          loadUld.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
          loadUld.setCreatedUser(HpEKConstants.ULD_SOURCE);
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.IRT.name();
        }
        else{
          oldLoadUld = new EntDbLoadUld(loadUld);
          loadUld.setUpdatedUser(HpEKConstants.ULD_SOURCE);
          loadUld.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.URT.name();
        }
         
        loadUld.setIdFlight(urno);
        loadUld.setIdConxFlight(connectedUrno);
       
        // only when the value is exist, check against the md value
        if(!HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getULDPOSITION())){
          //set the ULD Basic Data
          List<EntDbMdUldPos> uldPosList = _BasicDataSingleton.getUldPosList();
          boolean isFound = false;
         
          if(!uldPosList.isEmpty()){
            for(int i = 0; i < uldPosList.size(); i++){
              //get uld pos according to act3, act5 and position name
              if(entFlight != null){
                if(uldPosList.get(i).getAircraftType3().trim().equals(act3) &&
                    uldPosList.get(i).getAircraftType5().trim().equals(act5) &&
                    uldPosList.get(i).getUldPosition().trim().equals(_inputUldInfo.getULDPOSITION())){
                  loadUld.setIdMdUldPos(uldPosList.get(i).getId());
                  isFound = true;
                  break;
                }
              }
            }
          }
          if(!isFound){
            LOG.warn("Master Data Uld Position is not match in MdUldPos.");
            addExptInfo(EnumExceptionCodes.WNOMD.name(), String.format("ULD_POSITION => %s", _inputUldInfo.getULDPOSITION()));
          }
        } else
          LOG.error("Input ULD_POSITION is empty/blank.");
       
        loadUld = checkUldInfoMaterdata(_inputUldInfo, loadUld);//call to check MD
        loadUld.setDataSource(HpEKConstants.ULD_SOURCE);
       
        loadUld.setArrDepFlag(_inputUldInfo.getFLIGHTAD());
        loadUld.setUldPosition(_inputUldInfo.getULDPOSITION());
        loadUld.setUldType(_inputUldInfo.getULDTYPE());
        loadUld.setUldSubtype(_inputUldInfo.getULDSUBTYPE());
        loadUld.setUldItemtype(_inputUldInfo.getULDITEMTYPE());
        loadUld.setUldWeight(_inputUldInfo.getULDWEIGHT());
        loadUld.setUldDispLocCode(_inputUldInfo.getULDDISPATCHTOLOCCODE());
        loadUld.setUldDispLocDesc(_inputUldInfo.getULDDISPATHCTOLOCDESC());
        String status = " ";
        if("Y".equals(_inputUldInfo.getULDISDELETED())){
          status = "X";
          cmdForBroadcasting = HpUfisAppConstants.UfisASCommands.DRT.toString()
        }
       
        loadUld.setRecFlag(status);
        loadUld.setUldConxFlno(connectedFlno);
        if(connectedFlDate != null)
          loadUld.setConxFltDate(new HpUfisCalendar(connectedFlDate).getTime());
        loadUld.setConxToUld(_inputUldInfo.getCONNULDNO());
        if(!HpUfisUtils.isNullOrEmptyStr(_inputUldInfo.getRECORDSENDDATE()))
          loadUld.setUldSentDate(new HpUfisCalendar(convertFlDateToUTC(_inputUldInfo.getRECORDSENDDATE())).getTime());
       
        EntDbLoadUld resultUld = _dlLoadUldBean.merge(loadUld);
       
        if(resultUld != null){
          sendNotifyUldInfoToInJson(resultUld, oldLoadUld, cmdForBroadcasting);
View Full Code Here

  private String convertFlDateToUTC(String flightDate)
      throws ParseException {
    SimpleDateFormat dfm = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    Date flDate =  dfm.parse(flightDate);
    HpUfisCalendar utcDate = new HpUfisCalendar(flDate);
    utcDate.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
    return utcDate.getCedaString();
  }
View Full Code Here

   */
  private String convertFlDateToUTC(String flightDate)
      throws ParseException {
    SimpleDateFormat dfm = new SimpleDateFormat("ddMMMyyyyHHmmss");
    Date flDate =  dfm.parse(flightDate);
    HpUfisCalendar utcDate = new HpUfisCalendar(flDate);
    utcDate.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
    return utcDate.getCedaString();
  }
View Full Code Here

            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()+"");
View Full Code Here

        // if ("FO".equalsIgnoreCase(flightData.getFlightStatus())
        // || "PD".equalsIgnoreCase(flightData.getFlightStatus())) {
        // FEVTAB
        // find mapped flight from afttab
            if (aftFlight != null) {
              HpUfisCalendar nowUtc = new HpUfisCalendar(new Date());
              nowUtc.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
             
              // TODO update event ???
              //EntDbFevtab fevRecord = _fevBean.getFevtab(aftFlight.getUrno(), flightData.getFlightStatus());
              EntDbFevtab fevRecord = _fevBean.getMacsFlightEvent(flightData.getMflId(), flightData.getFlightStatus());
              if (fevRecord == null) {
                fevRecord = new EntDbFevtab();
                // 2013-12-30 updated by JGO - Change urno to uuid
                // get id from jnotab
                //fevRecord.setURNO(new BigDecimal(HpUfisUtils.formatJavaFevUrno(_jnoBean.getNextValueByKey("FEV-URNO", 1))));
                // cdat
                  fevRecord.setCDAT(nowUtc.getCedaString());
                  // usec
                  fevRecord.setUSEC(MSGIF);
                  // intSystem and intFlid
                  fevRecord.setINAM(MSGIF);
                  fevRecord.setIFID(flightData.getMflId());
                 
                  // ------------------------------------------------------
                  fevRecord.setUAFT(aftFlight.getUrno());
                  fevRecord.setSTNM("FLIGHT_STATUS");
                  fevRecord.setSTCO(flightData.getFlightStatus());
                  fevRecord.setSTTM(nowUtc.getCedaString());
                  fevRecord.setSTFL("");
                  //fevRecord.setSTRM("FLIGHT_STATUS");
                  //fevRecord.setUSEU(INTSYSTEM_MACS_FLT);
                 
                  // 2013-12-26 updated by JGO - Changed tag
                  if (HpUfisUtils.isNotEmptyStr(flightData.getChanged())) {
                    HpUfisCalendar cal = new HpUfisCalendar(flightData.getChanged(),
                          HpEKConstants.MACS_TIME_FORMAT);
                    fevRecord.setLSTU(cal.getCedaString());
                  }
                  _fevBean.persist(fevRecord);
              } else {
                fevRecord.setUSEU(MSGIF);
                fevRecord.setSTTM(nowUtc.getCedaString());
                // 2013-12-26 updated by JGO - Changed tag
                  if (HpUfisUtils.isNotEmptyStr(flightData.getChanged())) {
                    HpUfisCalendar cal = new HpUfisCalendar(flightData.getChanged(),
                          HpEKConstants.MACS_TIME_FORMAT);
                    fevRecord.setLSTU(cal.getCedaString());
                  }
                //fevRecord.setLSTU(nowUtc.getCedaString());
                _fevBean.update(fevRecord);
              }
            } else {
              // when afttab record is not found, use intsystem and intflid to insert event
              HpUfisCalendar nowUtc = new HpUfisCalendar(new Date());
              nowUtc.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
              // TODO need to know whether same flight different event got different mflid
              EntDbFevtab fevRecord = _fevBean.getFevtab(MSGIF, flightData.getMflId());
              if (fevRecord == null) {
                fevRecord = new EntDbFevtab();
                // get id from jnotab
                //fevRecord.setURNO(new BigDecimal(HpUfisUtils.formatJavaFevUrno(_jnoBean.getNextValueByKey("FEV-URNO", 1))));
                // cdat
                  fevRecord.setCDAT(nowUtc.getCedaString());
                  // usec
                  fevRecord.setUSEC(MSGIF);
                  // intSystem and intFlid
                  fevRecord.setINAM(MSGIF);
                  fevRecord.setIFID(flightData.getMflId());
                 
                  // ------------------------------------------------------
                  //fevRecord.setUAFT(result_entDbAfttab.getUrno());
                 
                  fevRecord.setSTNM("FLIGHT_STATUS");
                fevRecord.setSTCO(flightData.getFlightStatus());
                fevRecord.setSTTM(nowUtc.getCedaString());
                  fevRecord.setSTFL("");
                  //fevRecord.setSTRM("FLIGHT_STATUS");
                  //fevRecord.setUSEU(INTSYSTEM_MACS_FLT);
                  //fevRecord.setLSTU(nowUtc.getCedaString());
                  _fevBean.persist(fevRecord);
View Full Code Here

      try {
        // ================================================ 
        // LoadSummary update (Class-configuration)
        // ================================================
        // current time
        HpUfisCalendar ufisCal = new HpUfisCalendar(new Date());
        ufisCal.DateAdd(HpUfisAppConstants.OFFSET_LOCAL_UTC, EnumTimeInterval.Hours);
       
        // 2013-07-10 update JGO move load info to new table<LOAD_PAX_SUMMARY>
      // LoadSummaryPK key = new LoadSummaryPK();
      // key.setIntFlId(new BigDecimal(flightData.getMflId()));
      // key.setInfoId(LOAD_INFOID);
      // key.setAirlineCode(" ");
      // key.setFlightNumber(" ");
      // key.setFlightNumberSuffix(" ");
      // key.setScheduledFlightDateTime(ufisCal.getTime());
       
        // EntDbLoadSummary load = _loadSummaryBean.getLoadSummaryByPkey(key);
      // if (load == null) {
      // load = new EntDbLoadSummary();
      // load.setlPk(key);
      // load.setIntSystem(INTSYSTEM_MACS_FLT);
      // load.set_idHopo(HpEKConstants.HOPO);
      // load.set_createdDate(ufisCal.getTime());
      // load.set_createdUser("MACS-FLT");
      // _loadSummaryBean.persist(load);
      // }
       
      EntDbLoadPaxSummary load = _loadPaxSummaryBean
          .getLoadPaxSummaryByMfid(new BigDecimal(flightData.getMflId()), DATA_SOURCE);
      if (load == null) {
        load = new EntDbLoadPaxSummary();
        load.setInterfaceFltId(new BigDecimal(flightData.getMflId()));
        load.setDataSource(DATA_SOURCE);
        load.setCreatedUser(MSGIF);
        load.setRecStatus(" ");
        _loadPaxSummaryBean.create(load);
      }
      // config load
      load.setInfoType(LOAD_INFOID);
     
      // 2014-01-14 updated by JGO - change to id_flight and id_conx_flight
        // update afttab flight urno to load summary table
        /*if (aftFlight != null) {
          if ('A' == aftFlight.getAdid()) {
            //load.setArrFlId(String.valueOf(aftFlight.getUrno()));
            load.setIdArrFlight(aftFlight.getUrno());
          } else if ('D' == aftFlight.getAdid()) {
            //load.setDepFlId(String.valueOf(aftFlight.getUrno()));
            load.setIdDepFlight(aftFlight.getUrno());
          }
        }*/
        load.setIdFlight(aftFlight.getUrno());
        load.setIdConxFlight(BigDecimal.ZERO);
       
        // update class configuration
        String classConfig = flightData.getClassConfiguration();
        if (HpUfisUtils.isNotEmptyStr(classConfig)) {
          int indexF = classConfig.indexOf(CLASS_INDICATOR_FST);
          int indexJ = classConfig.indexOf(CLASS_INDICATOR_BUS);
          int indexY = classConfig.indexOf(CLASS_INDICATOR_ECO);
          String figure = "";
          // first
          if (indexF != -1 && indexJ != -1 && (indexJ - indexF) > 0) {
            figure = classConfig.substring(indexF + 1, indexJ);
            //load.setFirstClass(Integer.parseInt(figure));
            load.setFirstPax(new BigDecimal(figure));
          }
          // business
          if (indexJ != -1 && indexY != -1 && (indexY - indexJ) > 0) {
            figure = classConfig.substring(indexJ + 1, indexY);
            //load.setBusinessClass(Integer.parseInt(figure));
            load.setBusinessPax(new BigDecimal(figure));
          }
          // economy
          if (indexY != -1) {
            figure = classConfig.substring(indexY + 1);
            //load.setEconomyClass(Integer.parseInt(figure));
            load.setEconPax(new BigDecimal(figure));
            // 2014-01-15 updated by JGO - save the value to all_econ_pax field as well
            load.setAllEconPax(load.getEconPax());
          }
         
          // 2013-12-16 updated by JGO - Sum the total_pax for CFG
          load.setTotalPax(load.getFirstPax().add(load.getBusinessPax()).add(load.getEconPax()));
        }
        load.setUpdatedDate(ufisCal.getTime());
        //load.setDataSource(INTSYSTEM_MACS_FLT);
        load.setDataSource(DATA_SOURCE);
        load.setUpdatedUser(MSGIF);
        load.setRecStatus(" ");
        _loadPaxSummaryBean.edit(load);
View Full Code Here

                      // flight info
                      flightIdMapping.setIdFlight(queryResult.getUrno());
                      flightIdMapping.setArrDepFlag(queryResult.getAdid());
                      flightIdMapping.setFltNumber(queryResult.getFlno().trim());
                     
                      HpUfisCalendar scheduleDateTime = null;
                      // 2013-09-13 updated by JGO - all message base on boardpoint
//                      if ('D' == queryResult.getAdid()) {
                      scheduleDateTime = new HpUfisCalendar(queryResult.getStod());
//                      } else {
//                        scheduleDateTime = new HpUfisCalendar(queryResult.getStoa());
//                      }
                      flightIdMapping.setFltDate(scheduleDateTime.getTime());
                     
                    // schedule time in local
                    if (HpUfisUtils.isNotEmptyStr(flightData.getOperationDate())) {
                          scheduleDateTime = new HpUfisCalendar(flightData.getOperationDate(),
                              HpEKConstants.MACS_TIME_FORMAT);
                          if (HpUfisUtils.isNotEmptyStr(flightData.getOperationTime())){
                                int hour=Integer.parseInt(flightData.getOperationTime().substring(0, 2));
                                int min=Integer.parseInt(flightData.getOperationTime().substring(2, 4));
                                scheduleDateTime.DateAdd(hour, EnumTimeInterval.Hours);
                                scheduleDateTime.DateAdd(min, EnumTimeInterval.Minutes);
                            }
                          flightIdMapping.setFltDateLocal(scheduleDateTime.getTime());
                        }
                      flightIdMapping.setDataSource(MSGIF);
                      flightIdMapping.setRecStatus(' ');
                     
                      /*HpUfisCalendar scheduleDateTime = null;
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

TOP

Related Classes of com.ufis_as.ufisapp.lib.time.HpUfisCalendar

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.