@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/correlated/{rootEventId}")
public Response getGroupedCorrelatedEventsOfTestRunTopologyHistory(@Context UriInfo urlInfo,
@PathParam("topologyId") Long topologyId,
@PathParam("historyId") Long historyId,
@PathParam("rootEventId") String rootEventId,
@Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER,
Topology.NAMESPACE, topologyId, READ);
File eventLogFile = getEventLogFile(topologyId, historyId);
List<EventInformation> events = eventLogFileReader.loadEventLogFile(eventLogFile);
GroupedCorrelationEvents groupedEvents = new CorrelatedEventsGrouper(events).groupByComponent(rootEventId);
if (!groupedEvents.getAllEvents().containsKey(rootEventId)) {
throw BadRequestException.message("Can't find provided root event " + rootEventId + " from events.");
}
return WSUtils.respondEntity(groupedEvents, OK);
}