示例#1
0
 public void merge(LldpElement element) {
   if (element == null) return;
   setLldpChassisId(element.getLldpChassisId());
   setLldpChassisIdSubType(element.getLldpChassisIdSubType());
   setLldpSysname(element.getLldpSysname());
   setLldpNodeLastPollTime(element.getLldpNodeCreateTime());
 }
  @Override
  @Transactional
  public void store(int nodeId, LldpElement element) {
    if (element == null) return;
    final OnmsNode node = m_nodeDao.get(nodeId);
    if (node == null) return;

    LldpElement dbelement = node.getLldpElement();
    if (dbelement != null) {
      dbelement.merge(element);
      node.setLldpElement(dbelement);
    } else {
      element.setNode(node);
      element.setLldpNodeLastPollTime(element.getLldpNodeCreateTime());
      node.setLldpElement(element);
    }

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