@Transactional private OnmsIpInterface saveOrUpdate(final OnmsIpInterface iface) { iface.visit(new ServiceTypeFulfiller()); LOG.info("SaveOrUpdating IpInterface {}", iface); m_ipInterfaceDao.saveOrUpdate(iface); m_ipInterfaceDao.flush(); return iface; }
@Transactional private OnmsIpInterface saveOrUpdate(final OnmsIpInterface iface) { iface.visit(new ServiceTypeFulfiller()); LOG.info("SaveOrUpdating IpInterface {}", iface); m_ipInterfaceDao.saveOrUpdate(iface); m_ipInterfaceDao.flush(); return iface; }
@Override protected OnmsIpInterface doInsert() { final OnmsNode dbNode = m_nodeDao.load(nodeId); assertNotNull(dbNode, "no node found with nodeId %d", nodeId); // for performance reasons we don't add the IP interface to the node so we avoid loading all the interfaces // setNode only sets the node in the interface scannedIface.setNode(dbNode); saveOrUpdate(scannedIface); m_ipInterfaceDao.flush(); final AddEventVisitor visitor = new AddEventVisitor(m_eventForwarder); scannedIface.visit(visitor); return scannedIface; } }.execute();
@Override protected OnmsIpInterface doInsert() { final OnmsNode dbNode = m_nodeDao.load(nodeId); assertNotNull(dbNode, "no node found with nodeId %d", nodeId); // for performance reasons we don't add the IP interface to the node so we avoid loading all the interfaces // setNode only sets the node in the interface scannedIface.setNode(dbNode); saveOrUpdate(scannedIface); m_ipInterfaceDao.flush(); final AddEventVisitor visitor = new AddEventVisitor(m_eventForwarder); scannedIface.visit(visitor); return scannedIface; } }.execute();
@Override protected OnmsMonitoredService doInsert() { final OnmsMonitoredService svc = new OnmsMonitoredService(iface, svcType); svc.setStatus("A"); m_ipInterfaceDao.saveOrUpdate(iface); m_ipInterfaceDao.flush(); final AddEventVisitor visitor = new AddEventVisitor(m_eventForwarder); svc.visit(visitor); return svc; }
@Override protected OnmsMonitoredService doInsert() { final OnmsMonitoredService svc = new OnmsMonitoredService(iface, svcType); svc.setStatus("A"); m_ipInterfaceDao.saveOrUpdate(iface); m_ipInterfaceDao.flush(); final AddEventVisitor visitor = new AddEventVisitor(m_eventForwarder); svc.visit(visitor); return svc; }
@Override protected OnmsIpInterface doUpdate(final OnmsIpInterface dbIface) { final EventAccumulator accumulator = new EventAccumulator(m_eventForwarder); if(dbIface.isManaged() && !scannedIface.isManaged()){ final Set<OnmsMonitoredService> monSvcs = dbIface.getMonitoredServices(); for(final OnmsMonitoredService monSvc : monSvcs){ monSvc.visit(new DeleteEventVisitor(accumulator)); } monSvcs.clear(); } dbIface.updateSnmpInterface(scannedIface); dbIface.mergeInterfaceAttributes(scannedIface); LOG.info("Updating IpInterface {}", dbIface); m_ipInterfaceDao.update(dbIface); m_ipInterfaceDao.flush(); accumulator.flush(); return dbIface; }
@Override protected OnmsIpInterface doUpdate(final OnmsIpInterface dbIface) { final EventAccumulator accumulator = new EventAccumulator(m_eventForwarder); if(dbIface.isManaged() && !scannedIface.isManaged()){ final Set<OnmsMonitoredService> monSvcs = dbIface.getMonitoredServices(); for(final OnmsMonitoredService monSvc : monSvcs){ monSvc.visit(new DeleteEventVisitor(accumulator)); } monSvcs.clear(); } dbIface.updateSnmpInterface(scannedIface); dbIface.mergeInterfaceAttributes(scannedIface); LOG.info("Updating IpInterface {}", dbIface); m_ipInterfaceDao.update(dbIface); m_ipInterfaceDao.flush(); accumulator.flush(); return dbIface; }
m_eventDao.flush(); m_snmpInterfaceDao.flush(); m_ipInterfaceDao.flush(); m_nodeDao.flush(); m_serviceTypeDao.flush();