/** * <p>addSnmpInterface</p> * * @param snmpIface a {@link org.opennms.netmgt.model.OnmsSnmpInterface} object. */ public void addSnmpInterface(OnmsSnmpInterface snmpIface) { snmpIface.setNode(this); getSnmpInterfaces().add(snmpIface); }
@Override public OnmsSnmpInterface doInsert() { // add the interface to the node, if it wasn't found final OnmsNode dbNode = m_nodeDao.load(nodeId); assertNotNull(dbNode, "no node found with nodeId %d", nodeId); // for performance reasons we don't add the snmp interface to the node so we avoid loading all the interfaces // setNode only sets the node in the interface snmpInterface.setNode(dbNode); LOG.info("Saving SnmpInterface {}", snmpInterface); m_snmpInterfaceDao.save(snmpInterface); m_snmpInterfaceDao.flush(); return snmpInterface; }
@Override public OnmsSnmpInterface doInsert() { // add the interface to the node, if it wasn't found final OnmsNode dbNode = m_nodeDao.load(nodeId); assertNotNull(dbNode, "no node found with nodeId %d", nodeId); // for performance reasons we don't add the snmp interface to the node so we avoid loading all the interfaces // setNode only sets the node in the interface snmpInterface.setNode(dbNode); LOG.info("Saving SnmpInterface {}", snmpInterface); m_snmpInterfaceDao.save(snmpInterface); m_snmpInterfaceDao.flush(); return snmpInterface; }
private OnmsSnmpInterface createSnmpInterface(int ifIndex, OnmsNode node) { OnmsSnmpInterface onmsSnmpInterface = new OnmsSnmpInterface(); onmsSnmpInterface.setNode(node); onmsSnmpInterface.setIfIndex(ifIndex); onmsSnmpInterface.setIfType(4); onmsSnmpInterface.setIfSpeed(5L); onmsSnmpInterface.setIfAdminStatus(6); onmsSnmpInterface.setIfOperStatus(7); onmsSnmpInterface.setLastCapsdPoll(new Date()); onmsSnmpInterface.setLastSnmpPoll(new Date()); return onmsSnmpInterface; }
private void updateParent(final OnmsSnmpInterface iface) { OnmsNode node = null; if (iface.getNodeId() != null) { node = getNodeDao().get(iface.getNodeId()); } else if (iface.getNode() != null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); } if (node != null && node != iface.getNode()) { LOG.debug("merging node {} into node {}", iface.getNode(), node); node.mergeNode(iface.getNode(), new NullEventForwarder(), false); iface.setNode(node); } if (!iface.getNode().getSnmpInterfaces().contains(iface)) { LOG.debug("adding SNMP interface to node {}: {}", iface.getNode().getId(), iface); iface.getNode().addSnmpInterface(iface); } }
private void updateParent(final OnmsSnmpInterface iface) { OnmsNode node = null; if (iface.getNodeId() != null) { node = getNodeDao().get(iface.getNodeId()); } else if (iface.getNode() != null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); } if (node != null && node != iface.getNode()) { LOG.debug("merging node {} into node {}", iface.getNode(), node); node.mergeNode(iface.getNode(), new NullEventForwarder(), false); iface.setNode(node); } if (!iface.getNode().getSnmpInterfaces().contains(iface)) { LOG.debug("adding SNMP interface to node {}: {}", iface.getNode().getId(), iface); iface.getNode().addSnmpInterface(iface); } }
iface.setNode(node); getSnmpInterfaceDao().saveOrUpdate(iface);
iface.setNode(node); getSnmpInterfaceDao().saveOrUpdate(iface);