use of com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeNode in project streamline by hortonworks.
the class TopologyTestRunResource method getEventTreeOfTestRunTopologyHistory.
@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/tree/{rootEventId}")
public Response getEventTreeOfTestRunTopologyHistory(@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);
EventInformationTreeNode rootEventNode = new EventInformationTreeBuilder(events).constructEventTree(rootEventId);
if (rootEventNode == null) {
throw BadRequestException.message("Can't find provided root event " + rootEventId + " from events.");
}
return WSUtils.respondEntity(rootEventNode, OK);
}
use of com.hortonworks.streamline.streams.common.event.tree.EventInformationTreeNode in project streamline by hortonworks.
the class TopologyTestRunResource method getEventSubTreeOfTestRunTopologyHistory.
@GET
@Path("/topologies/{topologyId}/testhistories/{historyId}/events/tree/{rootEventId}/subtree/{subRootEventId}")
public Response getEventSubTreeOfTestRunTopologyHistory(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @PathParam("rootEventId") String rootEventId, @PathParam("subRootEventId") String subRootEventId, @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);
EventInformationTreeNode subRootEventNode = new EventInformationTreeBuilder(events).constructEventTree(rootEventId, subRootEventId);
if (subRootEventNode == null) {
throw BadRequestException.message("Can't find provided root event " + rootEventId + " from events.");
}
return WSUtils.respondEntity(subRootEventNode, OK);
}
Aggregations