@Override public void reconcileCdp(int nodeId, Date now) { CdpElement element = m_cdpElementDao.findByNodeId(nodeId); if (element != null && element.getCdpNodeLastPollTime().getTime() < now.getTime()) { m_cdpElementDao.delete(element); m_cdpElementDao.flush(); } m_cdpLinkDao.deleteByNodeIdOlderThen(nodeId, now); m_cdpLinkDao.flush(); }
@Override @Transactional public void store(int nodeId, CdpElement element) { if (element == null) return; final OnmsNode node = m_nodeDao.get(nodeId); if (node == null) return; CdpElement dbelement = node.getCdpElement(); if (dbelement != null) { dbelement.merge(element); node.setCdpElement(dbelement); } else { element.setNode(node); element.setCdpNodeLastPollTime(element.getCdpNodeCreateTime()); node.setCdpElement(element); } m_nodeDao.saveOrUpdate(node); m_nodeDao.flush(); }