use of org.opennms.web.rest.v2.status.model.BusinessServiceDTO in project opennms by OpenNMS.
the class StatusRestService method getBusinessServices.
@GET
@Path("/business-services")
public Response getBusinessServices(@Context final UriInfo uriInfo) {
final QueryParameters queryParameters = QueryParametersBuilder.buildFrom(uriInfo);
final SeverityFilter severityFilter = getSeverityFilter(uriInfo);
final Query query = new Query(queryParameters, severityFilter);
final List<StatusEntity<BusinessService>> services = businessServiceStatusService.getStatus(query);
final int totalCount = businessServiceStatusService.count(query);
final int offset = queryParameters.getOffset();
final List<BusinessServiceDTO> statusEntities = services.stream().map(bs -> {
BusinessServiceDTO statusDTO = new BusinessServiceDTO();
statusDTO.setId(bs.getEntity().getId().intValue());
statusDTO.setName(bs.getEntity().getName());
statusDTO.setSeverity(bs.getStatus());
return statusDTO;
}).collect(Collectors.toList());
final BusinessServiceDTOList list = new BusinessServiceDTOList(statusEntities);
list.setOffset(queryParameters.getOffset());
list.setTotalCount(totalCount);
return createResponse(list, offset, totalCount);
}
Aggregations