use of org.opennms.web.rest.v2.status.model.ApplicationDTOList in project opennms by OpenNMS.
the class StatusRestService method getApplications.
@GET
@Path("/applications")
public Response getApplications(@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<OnmsApplication>> applications = applicationStatusService.getStatus(query);
final int totalCount = applicationStatusService.count(query);
final int offset = queryParameters.getOffset();
final List<ApplicationDTO> statusEntities = applications.stream().map(a -> {
ApplicationDTO dto = new ApplicationDTO();
dto.setId(a.getEntity().getId());
dto.setName(a.getEntity().getName());
dto.setSeverity(a.getStatus());
return dto;
}).collect(Collectors.toList());
final ApplicationDTOList list = new ApplicationDTOList(statusEntities);
list.setOffset(queryParameters.getOffset());
list.setTotalCount(totalCount);
return createResponse(list, offset, totalCount);
}
Aggregations