@Override public Status getOperationalStatus(Edge edge) { m_rwLock.readLock().lock(); try { GraphVertex vertex = m_g.getVertexByEdgeId(edge.getId()); if (vertex != null) { return vertex.getStatus(); } return null; } finally { m_rwLock.readLock().unlock(); } }
@Override public ThresholdResultExplanation explain(BusinessService businessService, Threshold threshold) { final GraphVertex vertex = getGraph().getVertexByBusinessServiceId(businessService.getId()); // Calculate the weighed statuses from the child edges List<StatusWithIndex> statusesWithIndices = weighEdges(getGraph().getOutEdges(vertex)); List<Status> statuses = statusesWithIndices.stream() .map(StatusWithIndex::getStatus) .collect(Collectors.toList()); // Reduce Status reducedStatus = threshold.reduce(statusesWithIndices) .orElse(new StatusWithIndices(MIN_SEVERITY, Collections.emptyList())) .getStatus(); ThresholdResultExplanation explanation = new ThresholdResultExplanation(); explanation.setStatus(reducedStatus); explanation.setHitsByStatus(threshold.getHitsByStatus(statuses)); explanation.setGraphEdges(getGraph().getOutEdges(vertex)); explanation.setWeightStatuses(statuses); explanation.setFunction(threshold); Map<GraphEdge, GraphVertex> graphEdgeToGraphVertex = new HashMap<>(); for (Edge eachEdge : businessService.getEdges()) { GraphVertex vertexForEdge = getGraph().getVertexByEdgeId(eachEdge.getId()); GraphEdge graphEdge = getGraph().getGraphEdgeByEdgeId(eachEdge.getId()); if (vertexForEdge != null && graphEdge != null) { graphEdgeToGraphVertex.put(graphEdge, vertexForEdge); } } explanation.setGraphEdgeToGraphVertexMapping(graphEdgeToGraphVertex); return explanation; }
edgeStatus.getLabel(), edge.getWeight(), impactingVertices.contains(graph.getVertexByEdgeId(edge.getId())) ? "glyphicon-flash" : "")));