public IpServiceVertex(GraphVertex graphVertex) { this(graphVertex.getIpService(), graphVertex.getLevel()); }
@Override public String transform(GraphVertex vertex) { if (vertex.getBusinessService() != null) { return String.format("BS[%s]", vertex.getBusinessService().getName()); } if (vertex.getIpService() != null) { IpService ipService = vertex.getIpService(); return String.format("IP_SERVICE[%s,%s]", ipService.getId(), ipService.getServiceName()); } if (vertex.getReductionKey() != null) { return String.format("RK[%s]", vertex.getReductionKey()); } return "UNKNOWN"; } });
@Override public Void visit(IpServiceEdge edge) { // There are multiple reductions keys for this edge // Create an intermediary vertex using the Most Critical reduction function vertexForEdge[0] = new GraphVertexImpl(REDUCE_HIGHEST_SEVERITY, edge.getIpService()); addVertex(vertexForEdge[0]); m_verticesByIpServiceId.put(vertexForEdge[0].getIpService().getId(), vertexForEdge[0]); addReductionKeyVerticesToVertex(vertexForEdge[0], edge.getReductionKeys()); return null; }
public static AbstractBusinessServiceVertex createTopologyVertex(GraphVertex graphVertex) { if (graphVertex.getBusinessService() != null) { return new BusinessServiceVertex(graphVertex); } if (graphVertex.getIpService() != null) { return new IpServiceVertex(graphVertex); } if (graphVertex.getReductionKey() != null) { return new ReductionKeyVertex(graphVertex); } if (graphVertex.getApplication() != null) { return new ApplicationVertex(graphVertex); } throw new IllegalArgumentException("Cannot convert GraphVertex to BusinessServiceVertex: " + graphVertex); } }
@Override public Void visit(ApplicationEdge edge) { vertexForEdge[0] = new GraphVertexImpl(REDUCE_HIGHEST_SEVERITY, edge.getApplication()); addVertex(vertexForEdge[0]); m_verticesByApplicationId.put(vertexForEdge[0].getApplication().getId(), vertexForEdge[0]); for (IpService ipService : edge.getApplication().getIpServices()) { final GraphVertex ipServiceVertex = new GraphVertexImpl(REDUCE_HIGHEST_SEVERITY, ipService); final GraphEdgeImpl ipVertexEdgeEdge = new GraphEdgeImpl(MAP_IDENTITY); addVertex(ipServiceVertex); m_verticesByIpServiceId.put(ipServiceVertex.getIpService().getId(), ipServiceVertex); addEdge(ipVertexEdgeEdge, vertexForEdge[0], ipServiceVertex); addReductionKeyVerticesToVertex(ipServiceVertex, ipService.getReductionKeys()); } return null; }