Package com.narirelays.ems.persistence.orm

Examples of com.narirelays.ems.persistence.orm.LocalhostLog


    {
      InetAddress ia = InetAddress.getLocalHost();
      String hostname = ia.getHostName();//获取本机的hostname
      String logName = "index";
      LocalhostLogId id = new LocalhostLogId(hostname, logName);
      LocalhostLog indexLog = localhostLogDAO.findById(id);
      if(indexLog ==null)//本机还没有作索引,直接创建索引
      {
        creatIndex4MeasurePoints();//创建索引
        indexLog = new LocalhostLog(id);//新建日志的记录
//        indexLog.setChangeTime(new Date());//时间全部设成当前时间
//        indexLog.setLastUpdate(new Date());
//        indexLog.setCurrentUpdate(new Date());
        localhostLogDAO.merge(indexLog);
      }
      else//找到本机的索引日志记录
      {
        Date indexUpdate = indexLog.getCurrentUpdate();//maybe bug!!!
        List<MaintainLog> maintainLogs = maintainLogDAO.findAll();
        for(MaintainLog maintain:maintainLogs)
        {
          if(indexUpdate.getTime()<maintain.getCurrentUpdate().getTime())//这一条maintainLog有跟新
          {
            creatIndex4MeasurePoints();
            indexLog.setChangeTime(maintain.getChangeTime());
            indexLog.setLastUpdate(indexLog.getCurrentUpdate());
//            indexLog.setCurrentUpdate(new Date());
            localhostLogDAO.merge(indexLog);
            break;
          }
          else
View Full Code Here


       * */
      InetAddress ia = InetAddress.getLocalHost();
      String hostname = ia.getHostName();//获取本机的hostname
      String logName = "index";
      LocalhostLogId id = new LocalhostLogId(hostname, logName);
      LocalhostLog indexLog = localhostLogDAO.findById(id);
      if(indexLog ==null)//本机还没有作索引,直接创建索引
      {
        indexLog = new LocalhostLog(id);//新建日志的记录
//        indexLog.setChangeTime(new Date());//时间全部设成当前时间
//        indexLog.setLastUpdate(new Date());
//        indexLog.setCurrentUpdate(new Date());
      }
      else
      {
//        changeTime保持不变??
        indexLog.setLastUpdate(indexLog.getCurrentUpdate());
//        indexLog.setCurrentUpdate(new Date());       
      }
      localhostLogDAO.merge(indexLog);
    }
    catch(Exception e)
View Full Code Here

    {
      InetAddress ia = InetAddress.getLocalHost();
      String hostname = ia.getHostName();//获取本机的hostname
      String logName = "index";
      LocalhostLogId id = new LocalhostLogId(hostname, logName);
      LocalhostLog indexLog = localhostLogDAO.findById(id);
      if(indexLog ==null)//本机还没有作索引,直接创建索引
      {
        creatIndex4MeasurePoints();//创建索引
        indexLog = new LocalhostLog(id);//新建日志的记录
        Timestamp currentTime = new Timestamp(new Date().getTime());
        indexLog.setChangeTime(currentTime);//时间全部设成当前时间
        indexLog.setLastUpdate(currentTime);
        indexLog.setCurrentUpdate(currentTime);
        localhostLogDAO.merge(indexLog);
      }
      else//找到本机的索引日志记录
      {
        Date indexUpdate = indexLog.getCurrentUpdate();//maybe bug!!!
        List<MaintainLog> maintainLogs = maintainLogDAO.findAll();
        for(MaintainLog maintain:maintainLogs)
        {
          if(indexUpdate.getTime()<maintain.getCurrentUpdate().getTime())//这一条maintainLog有更新
          {
            creatIndex4MeasurePoints();
            indexLog.setChangeTime(maintain.getChangeTime());
            indexLog.setLastUpdate(indexLog.getCurrentUpdate());
            indexLog.setCurrentUpdate(new Timestamp(new Date().getTime()));
            localhostLogDAO.merge(indexLog);
            break;
          }
          else
          {
View Full Code Here

       * */
      InetAddress ia = InetAddress.getLocalHost();
      String hostname = ia.getHostName();//获取本机的hostname
      String logName = "index";
      LocalhostLogId id = new LocalhostLogId(hostname, logName);
      LocalhostLog indexLog = localhostLogDAO.findById(id);
      if(indexLog ==null)//本机还没有作索引,直接创建索引
      {
        indexLog = new LocalhostLog(id);//新建日志的记录
        Timestamp currentDate = new Timestamp(new Date().getTime());
        indexLog.setChangeTime(currentDate);//时间全部设成当前时间
        indexLog.setLastUpdate(currentDate);
        indexLog.setCurrentUpdate(currentDate);
      }
      else
      {
//        changeTime保持不变??
        indexLog.setLastUpdate(indexLog.getCurrentUpdate());
        indexLog.setCurrentUpdate(new Timestamp(new Date().getTime()));       
      }
      localhostLogDAO.merge(indexLog);
    }
    catch(Exception e)
    {
View Full Code Here

TOP

Related Classes of com.narirelays.ems.persistence.orm.LocalhostLog

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.