@Override public String getNamespace() { return vertexRef.getNamespace(); }
@Override public String getNamespace() { return vertexRef.getNamespace(); }
@Override public String getNamespace() { return vertexRef.getNamespace(); }
private static List<VertexRef> getOtherVertexRefs(Collection<VertexRef> vertices) { List<VertexRef> returnList = new ArrayList<>(); for (VertexRef eachRef : vertices) { if (!"nodes".equals(eachRef.getNamespace())) { returnList.add(eachRef); // we do not need to check for groups, because a group would have a namespace "nodes" } } return returnList; }
private List<VertexRef> getVertexRefsForNamespace(Collection<VertexRef> vertices) { List<VertexRef> returnList = new ArrayList<>(); for (VertexRef eachRef : vertices) { if (contributesTo(eachRef.getNamespace())) { if (!returnList.contains(eachRef)) { returnList.add(eachRef); } } } return returnList; }
protected static String calculateHash(Collection<VertexRef> vertices) { final String vertexKey = vertices.stream() .sorted(Comparator.comparing(VertexRef::getNamespace).thenComparing(VertexRef::getId)) .map(v -> String.format("%s:%s", v.getNamespace(), v.getId())) .collect(Collectors.joining(",")); return Hashing.sha256().hashString(vertexKey, StandardCharsets.UTF_8).toString(); }
private static List<VertexRef> getOppositeVertices(GraphContainer graphContainer, String targetNamespace, VertexRef sourceVertex) { // Find the vertices in other graphs that this vertex links to final Collection<VertexRef> oppositeVertices = graphContainer.getTopologyServiceClient().getOppositeVertices(sourceVertex); // Filter the vertices for those matching the target namespace final List<VertexRef> targetVertices = oppositeVertices.stream() .filter(v -> v.getNamespace().matches(targetNamespace)) .collect(Collectors.toList()); return targetVertices; }
protected WrappedVertex(VertexRef vertex) { if (vertex.getId() == null) { throw new IllegalArgumentException("Vertex has null ID: " + vertex); } else if (vertex.getNamespace() == null) { throw new IllegalArgumentException("Vertex has null namespace: " + vertex); } id = vertex.getId(); label = vertex.getLabel(); namespace = vertex.getNamespace(); }
private Vertex getSimpleVertex(VertexRef reference) { if (reference != null && getNamespace().equals(reference.getNamespace())) { return m_vertexMap.get(reference.getId()); } return null; }
public List<Breadcrumb> toBreadcrumbs() { final List<Breadcrumb> breadcrumbList = Lists.newArrayList(); // Build from bottom to top (including root) List<Node> work = getLeafs(); while (!work.isEmpty() && !work.get(0).isRoot()) { // All working nodes must be on the same layer (resulting in the same namespace) String targetNamespace = work.get(0).getVertexRef().getNamespace(); Set<Node> parentNodes = work.stream().map(Node::getParent).filter(Objects::nonNull).collect(Collectors.toSet()); breadcrumbList.add(0, new Breadcrumb(targetNamespace, parentNodes.stream().map(Node::getVertexRef).filter(Objects::nonNull).collect(Collectors.toList()))); work = Lists.newArrayList(parentNodes); } return breadcrumbList; } }
private Vertex getSimpleVertex(VertexRef reference) { if (reference != null && getVertexNamespace().equals(reference.getNamespace())) { return m_vertexMap.get(reference.getId()); } return null; }
private Vertex getSimpleVertex(VertexRef reference) { if (reference != null && getNamespace().equals(reference.getNamespace())) { return m_vertexMap.get(reference.getId()); } return null; }
@Override public Map<VertexRef, Status> getStatusForVertices(VertexProvider vertexProvider, Collection<VertexRef> vertices, Criteria[] criteria) { final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory.createStateMachine(businessServiceManager, criteria); return vertices.stream() .filter(v -> contributesTo(v.getNamespace()) && v instanceof AbstractBusinessServiceVertex) .map(v -> (AbstractBusinessServiceVertex) v) .collect(Collectors.toMap(v -> v, v -> { org.opennms.netmgt.bsm.service.model.Status status = getStatus(stateMachine, v); // Status can be null return status != null ? new DefaultStatus(status.getLabel(), 0) : null; })); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof VertexRef)) return false; VertexRef ref = (VertexRef)obj; return getNamespace().equals(ref.getNamespace()) && getId().equals(ref.getId()); }
public static VertexRefEntity toVertexRefEntity(VertexRef vertexRef) { Objects.requireNonNull(vertexRef); VertexRefEntity vertexRefEntity = new VertexRefEntity(); vertexRefEntity.setId(vertexRef.getId()); vertexRefEntity.setNamespace(vertexRef.getNamespace()); return vertexRefEntity; }
@Override public VertexRefJaxbEntry marshal(VertexRef input) throws Exception { if(input == null) { return null; } final VertexRefJaxbEntry entry = new VertexRefJaxbEntry(); entry.namespace = input.getNamespace(); entry.id = input.getId(); entry.label = input.getLabel(); return entry; }
@Override public VertexRefJaxbEntry marshal(VertexRef input) throws Exception { if(input == null) { return null; } final VertexRefJaxbEntry entry = new VertexRefJaxbEntry(); entry.namespace = input.getNamespace(); entry.id = input.getId(); entry.label = input.getLabel(); return entry; }
public static VertexRefEntity toVertexRefEntity(VertexRef vertexRef) { Objects.requireNonNull(vertexRef); VertexRefEntity vertexRefEntity = new VertexRefEntity(); vertexRefEntity.setId(vertexRef.getId()); vertexRefEntity.setNamespace(vertexRef.getNamespace()); return vertexRefEntity; }
protected static Vertex getVertexItem(final OperationContext operationContext, final VertexRef target) { Vertex vertex = operationContext.getGraphContainer().getBaseTopology().getVertex(target, operationContext.getGraphContainer().getCriteria()); if (vertex == null) { LoggerFactory.getLogger(AbstractOperation.class).debug("Null vertex found for vertex reference: {}:{}", target.getNamespace(), target.getId()); return null; } else { return vertex; } }
protected static Vertex getVertexItem(final OperationContext operationContext, final VertexRef target) { Vertex vertex = operationContext.getGraphContainer().getTopologyServiceClient().getVertex(target, operationContext.getGraphContainer().getCriteria()); if (vertex == null) { LoggerFactory.getLogger(AbstractOperation.class).debug("Null vertex found for vertex reference: {}:{}", target.getNamespace(), target.getId()); return null; } else { return vertex; } }