Search in sources :

Example 1 with OnmsSnmpInterfaceList

use of org.opennms.netmgt.model.OnmsSnmpInterfaceList in project opennms by OpenNMS.

the class OnmsSnmpInterfaceResource method getSnmpInterfaces.

/**
 * <p>getSnmpInterfaces</p>
 *
 * @param nodeCriteria a {@link java.lang.String} object.
 * @return a {@link org.opennms.netmgt.model.OnmsSnmpInterfaceList} object.
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public OnmsSnmpInterfaceList getSnmpInterfaces(@Context final UriInfo uriInfo, @PathParam("nodeCriteria") final String nodeCriteria) {
    final OnmsNode node = m_nodeDao.get(nodeCriteria);
    final MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
    final CriteriaBuilder builder = new CriteriaBuilder(OnmsSnmpInterface.class);
    builder.ne("collect", "D");
    builder.limit(20);
    applyQueryFilters(params, builder);
    builder.eq("node.id", node.getId());
    final OnmsSnmpInterfaceList snmpList = new OnmsSnmpInterfaceList(m_snmpInterfaceDao.findMatching(builder.toCriteria()));
    snmpList.setTotalCount(m_snmpInterfaceDao.countMatching(builder.count().toCriteria()));
    return snmpList;
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) OnmsSnmpInterfaceList(org.opennms.netmgt.model.OnmsSnmpInterfaceList) OnmsNode(org.opennms.netmgt.model.OnmsNode) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 OnmsSnmpInterfaceList (org.opennms.netmgt.model.OnmsSnmpInterfaceList)1