Package com.ufis_as.ek_if.lido.entities

Examples of com.ufis_as.ek_if.lido.entities.EntDbAirportWeather


      super(EntDbAirportWeather.class);
    }
   
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    public EntDbAirportWeather merge(EntDbAirportWeather entity){
      EntDbAirportWeather weather = null;
      try{
        weather = em.merge(entity);
        //em.flush();
      } catch (OptimisticLockException Oexc) {
        LOG.error("OptimisticLockException Entity:{} , Error:{}", entity, Oexc);
View Full Code Here


        LOG.error("ERROR to create new airpot weather!!! {}", ex.toString());
      }
    }
   
    public EntDbAirportWeather findExisting(String icao, String iata){
      EntDbAirportWeather result = null;
      Query query = getEntityManager().createNamedQuery("EntDbAirportWeather.findByKey");
      try{
        query.setParameter("iata", iata);
        query.setParameter("icao", icao);
        List<EntDbAirportWeather> resultList = query.getResultList();
        if(resultList.size()>0){
          result = resultList.get(0);
          LOG.debug("Input data will be updated to ID : {}.", result.getId());
        }
        else
          LOG.debug("Input Airpot Weather record will be added as new record.");
    }
    catch(Exception ex){
View Full Code Here

    }
      return result;
    }
   
    public EntDbAirportWeather findExistingByIcaoWeatherIndent(String icao, String weatherIndent){
      EntDbAirportWeather result = null;
      Query query = getEntityManager().createNamedQuery("EntDbAirportWeather.findByIcaoWeatherIndent");
      try{
        query.setParameter("icao", icao);
        query.setParameter("weatherIndent", weatherIndent);
        List<EntDbAirportWeather> resultList = query.getResultList();
        if(resultList.size()>0){
          result = resultList.get(0);
          LOG.debug("Input weather will be updated to ID : {}.", result.getId());
        }
        else
          LOG.debug("Input weather will be added as new record.");
    }
    catch(Exception ex){
View Full Code Here

            LOG.debug("DXB or OMDB is found");
          }
        }
       
        //flagDxbStn = false;
        EntDbAirportWeather entMET = null;
        String createdUser = msg.substring(20, 21).trim();
        String observeTime = msg.substring(11, 17).trim();
        String weatherRemark = msg.substring(17, 20).trim();
        String validStart = msg.substring(21, 27).trim();
        String validEnd = msg.substring(27, 33).trim();
        String weatherText = msg.substring(33, msg.length());
       
        if (HpUfisUtils.isNullOrEmptyStr(observeTime)) {
          LOG.debug("ObserveTime is null or empty, skipped");
          continue;
        }
        if (HpUfisUtils.isNullOrEmptyStr(createdUser)) {
          LOG.debug("CreatedUser is null or empty, skipped");
          continue;
        }
        if (HpUfisUtils.isNullOrEmptyStr(weatherText)) {
          LOG.debug("WeatherText is null or empty, skipped");
          continue;
        }
       
        LOG.info("Create User Code: {}", createdUser);
        switch(createdUser){
        case "A" : createdUser = HpEKConstants.A_INPUT_OFFICE; break;
        case "C" : createdUser = HpEKConstants.C_INPUT_OFFICE; break;
        case "D" : createdUser = HpEKConstants.D_INPUT_OFFICE; break;
        case "I" : createdUser = HpEKConstants.I_INPUT_OFFICE; break;
        case "L" : createdUser = HpEKConstants.L_INPUT_OFFICE; break;
        case "M" : createdUser = HpEKConstants.M_INPUT_OFFICE; break;
        case "S" : createdUser = HpEKConstants.S_INPUT_OFFICE; break;
        case "T" : createdUser = HpEKConstants.T_INPUT_OFFICE; break;
        default : {
              LOG.debug("Input Office for CreatedUser is unknown. Default value LIDO is set.");
              createdUser = HpEKConstants.LIDO_SOURCE; break;
            }
        }
        LOG.info("Create User info: {}", createdUser);
       
        //check icao and iata from Master data table APTTAB
        List<EntDbApttab> aptList = clsEntStartUpInitSingleton.getCacheApt();
        //to decide input icao and iata are correct checking with MD table APTTAB
        boolean flag = false;
        if (aptList != null) {
          for (int i = 0; i < aptList.size(); i++) {
            EntDbApttab entity = aptList.get(i);
            if (icao.equals(entity.getApc4())) {
                flag = true;
                break;
            }
          }
        }
       
        if(!flag){
          LOG.debug("Input ICAO is unknown(Not exist in APTTAB). Skipped input icao <{}>.", icao);
          continue;
        }
       
        //if append = false, insert or update; append = true, only insert
        EntDbAirportWeather weather = null;
        UfisASCommands cmd = UfisASCommands.URT;
        LOG.debug("Append: {}", isAppend);
        if(!isAppend){
          entMET = clsDlAirportWeather.findExistingByIcaoWeatherIndent(icao, weatherIndent);
          if(entMET == null){
             //entMET = new EntDbAirportWeather();
            weather = new EntDbAirportWeather();
            weather.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
            weather.setCreatedUser(createdUser);
            cmd = UfisASCommands.IRT;
          }else {
            weather = EntDbAirportWeather.valueOf(entMET);
            weather.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
            weather.setUpdatedUser(HpEKConstants.LIDO_SOURCE);
          }
        }
        else{
          // no matter data existing or not, directly store in db
          weather = new EntDbAirportWeather();
          weather.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
          weather.setCreatedUser(createdUser);
          cmd = UfisASCommands.IRT;
        }
       
        weather.setMsgSendDate(convertFlDateToUTC(_input.getMeta().getMessageTime()));
        weather.setAirportCodeIata(iata);
        weather.setAirportCodeIcao(icao);
        weather.setWeatherIndent(weatherIndent);
        weather.setObserveTime(observeTime);
        weather.setWeatherRemark(weatherRemark);
        weather.setValidStart(validStart);
        weather.setValidEnd(validEnd);
        weather.setWeatherText(weatherText);
        weather.setDataSource(HpEKConstants.LIDO_SOURCE);
       
        //merge the input airport weather value to db
        EntDbAirportWeather entity = clsDlAirportWeather.merge(weather);
        LOG.info("Airport Weather for icao : <{}> has been processed.", icao);
       
        // notification
        if (HpUfisUtils.isNotEmptyStr(HpCommonConfig.notifyTopic)) {
          // send notification message to topic
View Full Code Here

TOP

Related Classes of com.ufis_as.ek_if.lido.entities.EntDbAirportWeather

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.