示例#1
0
  public void merge(OspfElement element) {
    if (element == null) return;
    setOspfRouterId(element.getOspfRouterId());
    setOspfRouterIdIfindex(element.getOspfRouterIdIfindex());
    setOspfRouterId(element.getOspfRouterIdNetmask());

    setOspfNodeLastPollTime(element.getOspfNodeCreateTime());
  }
  @Override
  @Transactional
  public void store(int nodeId, OspfElement element) {
    if (element == null) return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null) return;

    OspfElement dbelement = node.getOspfElement();
    if (dbelement != null) {
      dbelement.merge(element);
      node.setOspfElement(dbelement);
    } else {
      element.setNode(node);
      element.setOspfNodeLastPollTime(element.getOspfNodeCreateTime());
      node.setOspfElement(element);
    }

    m_nodeDao.saveOrUpdate(node);
    m_nodeDao.flush();
  }