use of org.opennms.features.geolocation.api.SeverityInfo in project opennms by OpenNMS.
the class DefaultGeolocationService method applyStatus.
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 StatusCalculator calculator = getStatusCalculator(query.getStatusCalculationStrategy());
final Status status = calculator.calculateStatus(query, nodeIds);
// Appliing the calculated status to each location
for (GeolocationInfo info : locations) {
OnmsSeverity severity = status.getSeverity(info.getNodeInfo().getNodeId());
// 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()));
}
}
}
Aggregations