Source:
public Map<VertexRef, Status> getStatusForVertices(VertexProvider vertexProvider, Collection<VertexRef> vertices, Criteria[] criteria) { final List<Integer> nodeIds = vertices.stream().map(v -> (CustomVertex)v).map(v -> v.getNodeID()).collect(Collectors.toList()); List<String> paramNames = Lists.newArrayList("nodeIds"); List<Object> paramValues = new ArrayList(); paramValues.add(Lists.newArrayList(nodeIds)); if (nodeIds.isEmpty()) { return new HashedMap(); } final StringBuilder hql = new StringBuilder(); hql.append("SELECT node.id, max(event.eventSeverity) "); hql.append("FROM OnmsOutage as outage "); hql.append("LEFT JOIN outage.monitoredService as ifservice "); hql.append("LEFT JOIN ifservice.ipInterface as ipinterface "); hql.append("LEFT JOIN ipinterface.node as node "); hql.append("LEFT JOIN outage.serviceLostEvent as event "); hql.append("WHERE node.id in (:nodeIds) "); hql.append("AND outage.serviceRegainedEvent is null "); hql.append("GROUP BY node.id"); final List<Object[]> retvals = this.persistenceAccessor.findUsingNamedParameters(hql.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray()); Map<Integer, OnmsSeverity> mappedAlarms = new HashedMap(); for (int i = 0; i < retvals.size(); i++) { mappedAlarms.put((Integer)retvals.get(i)[0], OnmsSeverity.get((Integer)retvals.get(i)[1])); } final Map<VertexRef, Status> status = vertices.stream() .map(v -> (CustomVertex)v) .collect(Collectors.toMap(v -> v, v -> { if (!mappedAlarms.containsKey(v.getNodeID())) { return new DefaultStatus(OnmsSeverity.NORMAL.getLabel(), 0); } else return new DefaultStatus(mappedAlarms.get(v.getNodeID()).getLabel(), 0); })); return status; }

Target:
public Map<VertexRef, Status> getStatusForVertices(VertexProvider vertexProvider, Collection<VertexRef> vertices, Criteria[] criteria) { final List<Integer> nodeIds = vertices.stream().filter(v -> v.getNamespace().equals(getNamespace())) .map(v -> (PathOutageVertex)v) .map(v -> v.getNodeID()) .collect(Collectors.toList()); List<String> paramNames = Lists.newArrayList("nodeIds"); List<Object> paramValues = new ArrayList(); paramValues.add(Lists.newArrayList(nodeIds)); if (nodeIds.isEmpty()) { return new HashMap<>(); } final StringBuilder hql = new StringBuilder(); hql.append("SELECT node.id, max(event.eventSeverity) "); hql.append("FROM OnmsOutage as outage "); hql.append("LEFT JOIN outage.monitoredService as ifservice "); hql.append("LEFT JOIN ifservice.ipInterface as ipinterface "); hql.append("LEFT JOIN ipinterface.node as node "); hql.append("LEFT JOIN outage.serviceLostEvent as event "); hql.append("WHERE node.id in (:nodeIds) "); hql.append("AND outage.serviceRegainedEvent is null "); hql.append("GROUP BY node.id"); final List<Object[]> retvals = this.persistenceAccessor.findUsingNamedParameters(hql.toString(), paramNames.toArray(new String[paramNames.size()]), paramValues.toArray()); Map<Integer, OnmsSeverity> mappedAlarms = new HashedMap(); for (int i = 0; i < retvals.size(); i++) { mappedAlarms.put((Integer)retvals.get(i)[0], OnmsSeverity.get((Integer)retvals.get(i)[1])); } final Map<VertexRef, Status> status = vertices.stream() .map(v -> (PathOutageVertex)v) .collect(Collectors.toMap(v -> v, v -> { if (!mappedAlarms.containsKey(v.getNodeID())) { return new DefaultStatus(OnmsSeverity.NORMAL.getLabel(), 0); } else { return new DefaultStatus(mappedAlarms.get(v.getNodeID()).getLabel(), 0); } })); return status; }