@POST @Path("/") public Response getLocations(GeolocationQueryDTO queryDTO) { final GeolocationService service = getServiceRegistry().findProvider(GeolocationService.class); if (service == null) { return temporarilyNotAvailable(); } try { validate(queryDTO); GeolocationQuery query = toQuery(queryDTO); final List<GeolocationInfo> locations = service.getLocations(query); if (locations.isEmpty()) { return Response.noContent().build(); } return Response.ok(locations).build(); } catch (InvalidQueryException ex) { return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build(); } }
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); }
return Collections.emptyList(); final List<GeolocationInfo> locations = geolocationService.getLocations(new GeolocationQueryBuilder() .withNodeIds(nodeIds) .withStatusCalculationStrategy(StatusCalculationStrategy.None)
return Collections.emptyList(); final List<GeolocationInfo> locations = geolocationService.getLocations(new GeolocationQueryBuilder() .withNodeIds(nodeIds) .withStatusCalculationStrategy(StatusCalculationStrategy.None)