private void applyStatus(GeolocationQuery query, List<GeolocationInfo> locations) { final Set<Integer> nodeIds = locations.stream().map(l -> l.getNodeInfo().getNodeId()).collect(Collectors.toSet()); if (!nodeIds.isEmpty()) { final Status status = calculateStatus(query, nodeIds); // Appliing the calculated status to each location for(GeolocationInfo info : locations) { OnmsSeverity severity = status.getSeverity(info.getNodeInfo().getNodeId()); // After the status was calculated, it is not guaranteed that status.size() == locations.size() // Therefore for all locations with no status must be set to "NORMAL" in the result if (severity == null) { severity = OnmsSeverity.NORMAL; } info.setSeverityInfo(new SeverityInfo(severity.getId(), severity.getLabel())); info.setAlarmUnackedCount(status.getUnacknowledgedAlarmCount(info.getNodeInfo().getNodeId())); } } }
private static MapNode createMapNode(GeolocationInfo geolocationInfo) { final MapNode node = new MapNode(); // Coordinates if (geolocationInfo.getCoordinates() != null) { node.setLatitude(geolocationInfo.getCoordinates().getLatitude()); node.setLongitude(geolocationInfo.getCoordinates().getLongitude()); } // Node Info final NodeInfo nodeInfo = geolocationInfo.getNodeInfo(); node.setNodeId(String.valueOf(nodeInfo.getNodeId())); node.setNodeLabel(nodeInfo.getNodeLabel()); node.setForeignSource(nodeInfo.getForeignSource()); node.setForeignId(nodeInfo.getForeignId()); node.setIpAddress(nodeInfo.getIpAddress()); node.setDescription(nodeInfo.getDescription()); node.setMaintcontract(nodeInfo.getMaintcontract()); node.setCategories(new ArrayList<>(nodeInfo.getCategories())); // Severity node.setSeverityLabel(geolocationInfo.getSeverityInfo().getLabel()); node.setSeverity(String.valueOf(geolocationInfo.getSeverityInfo().getId())); // Count node.setUnackedCount(geolocationInfo.getAlarmUnackedCount()); return node; } }
NodeInfo nodeInfo = new NodeInfo(); nodeInfo.setNodeId(node.getId()); nodeInfo.setNodeLabel(node.getLabel()); nodeInfo.setNodeLabel(node.getLabel()); nodeInfo.setForeignSource(node.getForeignSource()); nodeInfo.setForeignId(node.getForeignId()); nodeInfo.setLocation(node.getLocation().getLocationName()); if (node.getAssetRecord() != null) { nodeInfo.setDescription(node.getAssetRecord().getDescription()); nodeInfo.setMaintcontract(node.getAssetRecord().getMaintcontract()); nodeInfo.setIpAddress(InetAddressUtils.str(node.getPrimaryInterface().getIpAddress())); nodeInfo.setCategories(node.getCategories() .stream() .map(OnmsCategory::getName)
private static MapNode createMapNode(GeolocationInfo geolocationInfo) { final MapNode node = new MapNode(); // Coordinates if (geolocationInfo.getCoordinates() != null) { node.setLatitude(geolocationInfo.getCoordinates().getLatitude()); node.setLongitude(geolocationInfo.getCoordinates().getLongitude()); } // Node Info final NodeInfo nodeInfo = geolocationInfo.getNodeInfo(); node.setNodeId(String.valueOf(nodeInfo.getNodeId())); node.setNodeLabel(nodeInfo.getNodeLabel()); node.setForeignSource(nodeInfo.getForeignSource()); node.setForeignId(nodeInfo.getForeignId()); node.setIpAddress(nodeInfo.getIpAddress()); node.setDescription(nodeInfo.getDescription()); node.setMaintcontract(nodeInfo.getMaintcontract()); node.setCategories(new ArrayList<>(nodeInfo.getCategories())); // Severity node.setSeverityLabel(geolocationInfo.getSeverityInfo().getLabel()); node.setSeverity(String.valueOf(geolocationInfo.getSeverityInfo().getId())); // Count node.setUnackedCount(geolocationInfo.getAlarmUnackedCount()); return node; } }
NodeInfo nodeInfo = new NodeInfo(); nodeInfo.setNodeId(node.getId()); nodeInfo.setNodeLabel(node.getLabel()); nodeInfo.setNodeLabel(node.getLabel()); nodeInfo.setForeignSource(node.getForeignSource()); nodeInfo.setForeignId(node.getForeignId()); nodeInfo.setLocation(node.getLocation().getLocationName()); if (node.getAssetRecord() != null) { nodeInfo.setDescription(node.getAssetRecord().getDescription()); nodeInfo.setMaintcontract(node.getAssetRecord().getMaintcontract()); nodeInfo.setIpAddress(InetAddressUtils.str(node.getPrimaryInterface().getIpAddress())); nodeInfo.setCategories(node.getCategories() .stream() .map(OnmsCategory::getName)
private void applyStatus(GeolocationQuery query, List<GeolocationInfo> locations) { final Set<Integer> nodeIds = locations.stream().map(l -> l.getNodeInfo().getNodeId()).collect(Collectors.toSet()); if (!nodeIds.isEmpty()) { final Status status = calculateStatus(query, nodeIds); // Appliing the calculated status to each location for(GeolocationInfo info : locations) { OnmsSeverity severity = status.getSeverity(info.getNodeInfo().getNodeId()); // After the status was calculated, it is not guaranteed that status.size() == locations.size() // Therefore for all locations with no status must be set to "NORMAL" in the result if (severity == null) { severity = OnmsSeverity.NORMAL; } info.setSeverityInfo(new SeverityInfo(severity.getId(), severity.getLabel())); info.setAlarmUnackedCount(status.getUnacknowledgedAlarmCount(info.getNodeInfo().getNodeId())); } } }
public void refresh() { List<GeolocationInfo> locations = geolocationService.getLocations(new GeolocationQueryBuilder() .withIncludeAcknowledgedAlarms(false) .withStatusCalculationStrategy(StatusCalculationStrategy.Alarms) .withSeverity(GeolocationSeverity.Normal) .build()); // apply acl filter if enabled if (m_aclsEnabled) { Map<Integer, String> nodes = m_nodeDao.getAllLabelsById(); locations = locations.stream() .filter(l -> nodes.containsKey(l.getNodeInfo().getNodeId())) .collect(Collectors.toList()); } // Convert m_activeNodes = locations.stream() .map(NodeMapComponent::createMapNode) .collect(Collectors.toMap(l -> Integer.valueOf(l.getNodeId()), Function.identity())); showNodes(m_activeNodes); }
public void refresh() { List<GeolocationInfo> locations = geolocationService.getLocations(new GeolocationQueryBuilder() .withIncludeAcknowledgedAlarms(false) .withStatusCalculationStrategy(StatusCalculationStrategy.Alarms) .withSeverity(GeolocationSeverity.Normal) .build()); // apply acl filter if enabled if (m_aclsEnabled) { Map<Integer, String> nodes = m_nodeDao.getAllLabelsById(); locations = locations.stream() .filter(l -> nodes.containsKey(l.getNodeInfo().getNodeId())) .collect(Collectors.toList()); } // Convert m_activeNodes = locations.stream() .map(NodeMapComponent::createMapNode) .collect(Collectors.toMap(l -> Integer.valueOf(l.getNodeId()), Function.identity())); showNodes(m_activeNodes); }
.map(locationInfo -> { final Vertex vertex = vertices.stream() .filter(v -> v.getNodeID() != null && locationInfo.getNodeInfo().getNodeId() == v.getNodeID()) .findFirst() .get();
.map(locationInfo -> { final Vertex vertex = vertices.stream() .filter(v -> v.getNodeID() != null && locationInfo.getNodeInfo().getNodeId() == v.getNodeID()) .findFirst() .get();