Search in sources :

Example 1 with AbstractNCSComponentVisitor

use of org.opennms.netmgt.model.ncs.AbstractNCSComponentVisitor in project opennms by OpenNMS.

the class EventMappingRulesIT method findSubcomponentsOnNode.

private Set<String> findSubcomponentsOnNode(NCSComponent svc, String nodeForeignSource, String nodeForeignId) {
    final Set<String> expectedIds = new HashSet<>();
    final NodeIdentification nodeIdent = new NodeIdentification(nodeForeignSource, nodeForeignId);
    NCSComponentVisitor visitor = new AbstractNCSComponentVisitor() {

        @Override
        public void visitComponent(NCSComponent component) {
            if (nodeIdent.equals(component.getNodeIdentification())) {
                expectedIds.add(component.getForeignSource() + ":" + component.getForeignId());
            }
        }
    };
    svc.visit(visitor);
    return expectedIds;
}
Also used : NCSComponentVisitor(org.opennms.netmgt.model.ncs.NCSComponentVisitor) AbstractNCSComponentVisitor(org.opennms.netmgt.model.ncs.AbstractNCSComponentVisitor) NCSComponent(org.opennms.netmgt.model.ncs.NCSComponent) AbstractNCSComponentVisitor(org.opennms.netmgt.model.ncs.AbstractNCSComponentVisitor) NodeIdentification(org.opennms.netmgt.model.ncs.NCSComponent.NodeIdentification) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 AbstractNCSComponentVisitor (org.opennms.netmgt.model.ncs.AbstractNCSComponentVisitor)1 NCSComponent (org.opennms.netmgt.model.ncs.NCSComponent)1 NodeIdentification (org.opennms.netmgt.model.ncs.NCSComponent.NodeIdentification)1 NCSComponentVisitor (org.opennms.netmgt.model.ncs.NCSComponentVisitor)1