@Transactional(readOnly=true) private OnmsNode findNodebyNodeLabel(final String label) { Collection<OnmsNode> nodes = m_nodeDao.findByLabel(label); if (nodes.size() == 1) { return nodes.iterator().next(); } LOG.error("Unable to locate a unique node using label {}: {} nodes found. Ignoring relationship.", label, nodes.size()); return null; }
@Transactional(readOnly=true) private OnmsNode findNodebyNodeLabel(final String label) { Collection<OnmsNode> nodes = m_nodeDao.findByLabel(label); if (nodes.size() == 1) { return nodes.iterator().next(); } LOG.error("Unable to locate a unique node using label {}: {} nodes found. Ignoring relationship.", label, nodes.size()); return null; }
@Override public Node getNodeByLabel(String nodeLabel) { return sessionUtils.withReadOnlyTransaction(() -> ModelMappers.toNode(nodeDao.findByLabel(nodeLabel).stream() .min(Comparator.comparingInt(OnmsNode::getId)) .orElse(null))); }
@Override public CollectionAgent doInTransaction(TransactionStatus status) { final OnmsNode node = Iterables.getFirst(nodeDao.findByLabel(jtiMsg.getSystemId()), null); if (node != null) { final OnmsIpInterface primaryInterface = node.getPrimaryInterface(); return collectionAgentFactory.createCollectionAgent(primaryInterface); } return null; } });
try { LOG.debug("Searching for node by label {}",fqdn); matchingNodes = nodeDao.findByLabel(fqdn); } catch (NullPointerException npe) { LOG.debug("No node located for {}",fqdn); matchingNodes = nodeDao.findByLabel(fqdn.split("\\.")[0]); } catch (NullPointerException npe) { LOG.debug("No node located for {}",fqdn.split("\\.")[0]);
try { LOG.debug("Searching for node by label {}",fqdn); matchingNodes = nodeDao.findByLabel(fqdn); } catch (NullPointerException npe) { LOG.debug("No node located for {}",fqdn); matchingNodes = nodeDao.findByLabel(fqdn.split("\\.")[0]); } catch (NullPointerException npe) { LOG.debug("No node located for {}",fqdn.split("\\.")[0]);
@Before public void setUp() throws Exception { MockLogAppender.setupLogging(); if (m_nodeDao.findByLabel("testnode").size() == 0) { NetworkBuilder builder = new NetworkBuilder(); builder.addNode("testnode"); builder.addInterface(InetAddressUtils.normalize(m_testHostName)).setIsManaged("M").setIsSnmpPrimary("P"); builder.addService(getServiceType("ICMP")); builder.addService(getServiceType("HTTP")); builder.addService(getServiceType("HTTPS")); OnmsNode n = builder.getCurrentNode(); assertNotNull(n); m_nodeDao.save(n); m_nodeDao.flush(); } m_collector = new HttpCollector(); Collection<OnmsIpInterface> ifaces = m_ipInterfaceDao.findByIpAddress(m_testHostName); assertEquals(1, ifaces.size()); OnmsIpInterface iface = ifaces.iterator().next(); Map<String, String> parameters = new HashMap<String, String>(); parameters.put("collection", "default"); m_collector.initialize(); m_collectionSpecification = CollectorTestUtils.createCollectionSpec("HTTP", m_collector, "default"); m_httpsCollectionSpecification = CollectorTestUtils.createCollectionSpec("HTTPS", m_collector, "default"); m_collectionAgent = DefaultCollectionAgent.create(iface.getId(), m_ipInterfaceDao, m_transactionManager); File snmpRrdDirectory = (File)m_context.getAttribute("rrdDirectory"); m_resourceStorageDao.setRrdDirectory(snmpRrdDirectory.getParentFile()); }
Collection<OnmsNode> testNodes = m_nodeDao.findByLabel(TEST_NODE_LABEL); if (testNodes == null || testNodes.size() < 1) { NetworkBuilder builder = new NetworkBuilder();
Collection<OnmsNode> testNodes = m_nodeDao.findByLabel(TEST_NODE_LABEL); if (testNodes == null || testNodes.size() < 1) { NetworkBuilder builder = new NetworkBuilder();
Collection<OnmsNode> testNodes = m_nodeDao.findByLabel(TEST_NODE_LABEL); if (testNodes == null || testNodes.size() < 1) { NetworkBuilder builder = new NetworkBuilder();