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 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())); } } }