Search in sources :

Example 41 with Criteria

use of org.opennms.features.topology.api.topo.Criteria in project opennms by OpenNMS.

the class VEProviderGraphContainer method getSemanticZoomLevelCriteriaForContainer.

public static SemanticZoomLevelCriteria getSemanticZoomLevelCriteriaForContainer(GraphContainer graphContainer) {
    Criteria[] criteria = graphContainer.getCriteria();
    if (criteria != null) {
        for (Criteria criterium : criteria) {
            try {
                return (SemanticZoomLevelCriteria) criterium;
            } catch (ClassCastException e) {
            }
        }
    }
    SemanticZoomLevelCriteria hopCriteria = new SemanticZoomLevelCriteria(graphContainer.getSemanticZoomLevel());
    graphContainer.addCriteria(hopCriteria);
    return hopCriteria;
}
Also used : CollapsibleCriteria(org.opennms.features.topology.api.topo.CollapsibleCriteria) SemanticZoomLevelCriteria(org.opennms.features.topology.api.support.SemanticZoomLevelCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) SemanticZoomLevelCriteria(org.opennms.features.topology.api.support.SemanticZoomLevelCriteria)

Example 42 with Criteria

use of org.opennms.features.topology.api.topo.Criteria in project opennms by OpenNMS.

the class VEProviderGraphContainer method findCriteria.

@Override
public <T extends Criteria> Set<T> findCriteria(Class<T> criteriaType) {
    Objects.requireNonNull(criteriaType);
    final Set<T> criteriaSet = new HashSet<>();
    for (Criteria eachCriteria : getCriteria()) {
        if (criteriaType.isAssignableFrom(eachCriteria.getClass())) {
            criteriaSet.add((T) eachCriteria);
        }
    }
    return criteriaSet;
}
Also used : CollapsibleCriteria(org.opennms.features.topology.api.topo.CollapsibleCriteria) SemanticZoomLevelCriteria(org.opennms.features.topology.api.support.SemanticZoomLevelCriteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 43 with Criteria

use of org.opennms.features.topology.api.topo.Criteria in project opennms by OpenNMS.

the class LinkdEdgeStatusProvider method getLinkdEdgeDownAlarms.

protected List<OnmsAlarm> getLinkdEdgeDownAlarms() {
    org.opennms.core.criteria.Criteria criteria = new org.opennms.core.criteria.Criteria(OnmsAlarm.class);
    criteria.addRestriction(new EqRestriction("uei", EventConstants.TOPOLOGY_LINK_DOWN_EVENT_UEI));
    criteria.addRestriction(new NeRestriction("severity", OnmsSeverity.CLEARED));
    return getAlarmDao().findMatching(criteria);
}
Also used : EqRestriction(org.opennms.core.criteria.restrictions.EqRestriction) NeRestriction(org.opennms.core.criteria.restrictions.NeRestriction) Criteria(org.opennms.features.topology.api.topo.Criteria)

Example 44 with Criteria

use of org.opennms.features.topology.api.topo.Criteria in project opennms by OpenNMS.

the class GraphPainter method visitGraph.

@Override
public void visitGraph(Graph graph) throws PaintException {
    m_focusVertices.clear();
    Criteria[] criterias = m_graphContainer.getCriteria();
    for (Criteria criteria : criterias) {
        try {
            VertexHopCriteria c = (VertexHopCriteria) criteria;
            m_focusVertices.addAll(c.getVertices());
        } catch (ClassCastException e) {
        }
    }
    m_statusMap.clear();
    m_statusMap.putAll(graph.getVertexStatus());
    m_edgeStatusMap.clear();
    m_edgeStatusMap.putAll(graph.getEdgeStatus());
}
Also used : VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)

Example 45 with Criteria

use of org.opennms.features.topology.api.topo.Criteria in project opennms by OpenNMS.

the class NCSSearchProvider method removeVertexHopCriteria.

@Override
public void removeVertexHopCriteria(SearchResult searchResult, GraphContainer container) {
    Criteria criteria = NCSEdgeProvider.createCriteria(Collections.singletonList(Long.parseLong(searchResult.getId())));
    container.removeCriteria(new NCSHopCriteria(searchResult.getId(), new HashSet<VertexRef>(getVertexRefsForEdges(m_ncsEdgeProvider, criteria)), searchResult.getLabel()));
    if (m_serviceManager.isCriteriaRegistered(NAMESPACE, container.getSessionId())) {
        m_serviceManager.unregisterCriteria(NAMESPACE, container.getSessionId());
    }
}
Also used : VertexHopCriteria(org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria) Criteria(org.opennms.features.topology.api.topo.Criteria) HashSet(java.util.HashSet)

Aggregations

Criteria (org.opennms.features.topology.api.topo.Criteria)46 VertexRef (org.opennms.features.topology.api.topo.VertexRef)21 Map (java.util.Map)15 VertexHopCriteria (org.opennms.features.topology.api.support.VertexHopGraphProvider.VertexHopCriteria)15 CollapsibleCriteria (org.opennms.features.topology.api.topo.CollapsibleCriteria)15 List (java.util.List)14 Collectors (java.util.stream.Collectors)14 Status (org.opennms.features.topology.api.topo.Status)14 Lists (com.google.common.collect.Lists)11 ArrayList (java.util.ArrayList)9 Collection (java.util.Collection)9 StatusProvider (org.opennms.features.topology.api.topo.StatusProvider)9 Objects (java.util.Objects)8 Test (org.junit.Test)8 AlarmSummary (org.opennms.netmgt.model.alarm.AlarmSummary)8 HashSet (java.util.HashSet)7 Set (java.util.Set)7 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)7 DefaultVertexRef (org.opennms.features.topology.api.topo.DefaultVertexRef)7 VertexProvider (org.opennms.features.topology.api.topo.VertexProvider)7