use of org.opennms.netmgt.model.OnmsCriteria in project opennms by OpenNMS.
the class NetworkElementFactory method getInterface.
/* (non-Javadoc)
* @see org.opennms.web.element.NetworkElementFactoryInterface#getInterface(int, java.lang.String)
*/
@Override
public Interface getInterface(int nodeId, String ipAddress) {
OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class);
criteria.createAlias("node", "node");
criteria.add(Restrictions.eq("node.id", nodeId));
criteria.add(Restrictions.eq("ipAddress", InetAddressUtils.addr(ipAddress)));
criteria.setFetchMode("snmpInterface", FetchMode.JOIN);
List<OnmsIpInterface> ifaces = m_ipInterfaceDao.findMatching(criteria);
return ifaces.size() > 0 ? new Interface(ifaces.get(0)) : null;
}
Aggregations