@Override protected void doInTransactionWithoutResult(TransactionStatus transactionStatus) { final OnmsNode node = nodeDao.get(nodeId.toString()); if (node != null) { populateBodyWithNodeInfo(result, node); } } });
private OnmsNode getNodeEntity(Integer nodeId) { Objects.requireNonNull(nodeId); final OnmsNode entity = nodeDao.get(nodeId); if (entity == null) { throw new NoSuchElementException("OnmsNode with id " + nodeId); } return entity; }
private OnmsNode lookupNode(String nodeCriteria) { final OnmsNode node = nodeDao.get(nodeCriteria); if (node == null) { throw new IllegalArgumentException(String.format("No node found with lookup criteria: %s", nodeCriteria)); } return node; }
@Override public String getForeignSource(long nodeId) { OnmsNode node = nodeDao.get((int)nodeId); if (node != null) { return node.getForeignSource(); } return null; }
/** {@inheritDoc} */ @Override public String getNodeLabel(int nodeId) { final OnmsNode onmsNode = m_nodeDao.get(nodeId); if (onmsNode == null) { return null; } return onmsNode.getLabel(); }
@Override public String getForeignId(long nodeId) { OnmsNode node = nodeDao.get((int)nodeId); return node == null ? null : node.getForeignId(); }
/** {@inheritDoc} */ @Transactional(readOnly=true) @Override public NodeScanSchedule getScheduleForNode(final int nodeId, final boolean force) { return createScheduleForNode(m_nodeDao.get(nodeId), force); }
@Override public String getForeignSource(long nodeId) { OnmsNode node = nodeDao.get((int)nodeId); if (node != null) { return node.getForeignSource(); } return null; }
@Override public void doInTransactionWithoutResult(TransactionStatus arg0) { for (OnmsIpInterface ipInterface : m_nodeDao.get(nodeid).getIpInterfaces()) { records.add(new ReverseDnsRecord(ipInterface,m_level)); } } });
private OnmsNode findNode(String nodeIdString) { final int nodeId; try { nodeId = WebSecurityUtils.safeParseInt(nodeIdString); } catch (final NumberFormatException e) { throw new IllegalArgumentException("parameter 'node' with value '" + nodeIdString + "' could not be parsed as an integer"); } return getNodeDao().get(nodeId); }
@Override public OnmsNode doInTransaction(final TransactionStatus status) { final OnmsNode node = nodeDao.get(theNodeId); // Retrieve the categories in the context of the transaction if (node != null) { for (OnmsCategory cat : node.getCategories()) { categories.add(cat.getName()); } } return node; } });
private OnmsNode findNode(String nodeIdString) { final int nodeId; try { nodeId = WebSecurityUtils.safeParseInt(nodeIdString); } catch (final NumberFormatException e) { throw new IllegalArgumentException("parameter 'node' with value '" + nodeIdString + "' could not be parsed as an integer"); } return getNodeDao().get(nodeId); }
@Override public boolean isNodeReady(AdapterOperation op) { boolean readyState = false; OnmsNode node = m_nodeDao.get(op.getNodeId()); if (node != null && node.getSysObjectId() != null) { readyState = true; } return readyState; }
/** {@inheritDoc} */ @Override public String getNodeLocation(int nodeId) { final OnmsNode onmsNode = m_nodeDao.get(nodeId); if (onmsNode == null) { return null; } return onmsNode.getLocation().getLocationName(); }
@Override public OnmsResource getResourceByName(String nodeLookupCriteria) { // The nodeDao automatically handles both id type, and fs:fid type lookups final OnmsNode node = m_nodeDao.get(nodeLookupCriteria); if (node == null) { throw new ObjectRetrievalFailureException(OnmsNode.class, nodeLookupCriteria, "Top-level resource of resource type node could not be found: " + nodeLookupCriteria, null); } // We don't check the existence of the resource path, since the // resource may exists, even if this directory is empty // i.e. there are response[] type resources but no nodeSnmp[] resources return createResourceForNode(node); }
public static String getNodeLabel(Integer nodeid) { BeanFactoryReference bf = BeanUtils.getBeanFactory("daoContext"); return BeanUtils.getBean(bf,"nodeDao", NodeDao.class) .get(nodeid).getLabel(); }
@Transactional(readOnly=true) private OnmsNode getDbNode(final OnmsNode node) { OnmsNode dbNode; if (node.getId() != null) { dbNode = m_nodeDao.get(node.getId()); } else { dbNode = m_nodeDao.findByForeignId(node.getForeignSource(), node.getForeignId()); } return dbNode; }
/** {@inheritDoc} */ @Transactional @Override public OnmsNode getDbNodeInitCat(final Integer nodeId) { final OnmsNode node = m_nodeDao.get(nodeId); // TODO: Does calling initialize() on an entity do anything? m_nodeDao.initialize(node); m_nodeDao.initialize(node.getCategories()); m_nodeDao.initialize(node.getLocation()); return node; }
protected Event createApStatusEvent(String physAddr, Integer nodeId, String status) { final List<Parm> parms = new ArrayList<Parm>(); OnmsNode node = getNodeDao().get(nodeId); parms.add(buildParm(EventConstants.PARM_PASSIVE_IPADDR, getNodeIpAddress(node).getHostAddress())); parms.add(buildParm(EventConstants.PARM_PASSIVE_NODE_LABEL, node.getLabel())); parms.add(buildParm(EventConstants.PARM_PASSIVE_SERVICE_NAME, getPackage().getEffectiveService().getPassiveServiceName())); parms.add(buildParm(EventConstants.PARM_PASSIVE_SERVICE_STATUS, status)); parms.add(buildParm("physAddr", physAddr)); EventBuilder bldr = new EventBuilder(PASSIVE_STATUS_UEI, "accesspointmonitord"); bldr.setParms(parms); return bldr.getEvent(); }
/** {@inheritDoc} */ @Transactional @Override public OnmsNode getNode(final Integer nodeId) { final OnmsNode node = m_nodeDao.get(nodeId); // TODO: Does calling initialize() on an entity do anything? m_nodeDao.initialize(node); m_nodeDao.initialize(node.getCategories()); m_nodeDao.initialize(node.getIpInterfaces()); m_nodeDao.initialize(node.getLocation()); return node; }