use of org.opennms.netmgt.model.OnmsCriteria in project opennms by OpenNMS.
the class NetworkElementFactory method getActiveInterfacesOnNode.
/* (non-Javadoc)
* @see org.opennms.web.element.NetworkElementFactoryInterface#getActiveInterfacesOnNode(int)
*/
@Override
public Interface[] getActiveInterfacesOnNode(int nodeId) {
OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class);
criteria.createAlias("node", "node");
criteria.add(Restrictions.eq("node.id", nodeId));
criteria.add(Restrictions.ne("isManaged", "D"));
return getInterfaceArray(m_ipInterfaceDao.findMatching(criteria));
}
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)
*/
@Override
public Interface getInterface(int ipInterfaceId) {
OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class);
criteria.add(Restrictions.eq("id", ipInterfaceId));
criteria.setFetchMode("snmpInterface", FetchMode.JOIN);
List<OnmsIpInterface> ifaces = m_ipInterfaceDao.findMatching(criteria);
if (ifaces.size() > 0) {
return new Interface(ifaces.get(0));
}
return null;
}
use of org.opennms.netmgt.model.OnmsCriteria in project opennms by OpenNMS.
the class NetworkElementFactory method getServicesOnNode.
/* (non-Javadoc)
* @see org.opennms.web.element.NetworkElementFactoryInterface#getServicesOnNode(int)
*/
@Override
public Service[] getServicesOnNode(int nodeId) {
OnmsCriteria criteria = new OnmsCriteria(OnmsMonitoredService.class);
criteria.createAlias("ipInterface", "ipInterface");
criteria.createAlias("ipInterface.snmpInterface", "snmpIface", OnmsCriteria.LEFT_JOIN);
criteria.createAlias("ipInterface.node", "node");
criteria.createAlias("serviceType", "serviceType");
criteria.add(Restrictions.eq("node.id", nodeId));
return getServiceArray(m_monSvcDao.findMatching(criteria));
}
use of org.opennms.netmgt.model.OnmsCriteria in project opennms by OpenNMS.
the class NetworkElementFactory method getNodesLike.
/* (non-Javadoc)
* @see org.opennms.web.element.NetworkElementFactoryInterface#getNodesLike(java.lang.String, int)
*/
@Override
public List<OnmsNode> getNodesLike(String nodeLabel, int serviceId) {
if (nodeLabel == null) {
throw new IllegalArgumentException("Cannot take null parameters.");
}
OnmsCriteria criteria = new OnmsCriteria(OnmsNode.class);
criteria.createAlias("assetRecord", "assetRecord");
criteria.createAlias("ipInterfaces", "iface");
criteria.createAlias("iface.monitoredServices", "monSvcs");
criteria.createAlias("monSvcs.serviceType", "serviceType");
criteria.add(Restrictions.ilike("label", nodeLabel, MatchMode.ANYWHERE));
criteria.add(Restrictions.eq("serviceType.id", serviceId));
criteria.add(Restrictions.ne("type", "D"));
criteria.addOrder(Order.asc("label"));
return m_nodeDao.findMatching(criteria);
}
use of org.opennms.netmgt.model.OnmsCriteria in project opennms by OpenNMS.
the class NetworkElementFactory method getAllManagedIpInterfaces.
/* (non-Javadoc)
* @see org.opennms.web.element.NetworkElementFactoryInterface#getAllManagedIpInterfaces(boolean)
*/
@Override
public Interface[] getAllManagedIpInterfaces(boolean includeSNMP) {
OnmsCriteria criteria = new OnmsCriteria(OnmsIpInterface.class);
criteria.createAlias("snmpInterface", "snmpInterface", OnmsCriteria.LEFT_JOIN);
criteria.createAlias("node", "node");
criteria.add(Restrictions.ne("isManaged", "D"));
criteria.add(Restrictions.ne("ipAddress", InetAddressUtils.addr("0.0.0.0")));
criteria.add(Restrictions.isNotNull("ipAddress"));
criteria.addOrder(Order.asc("ipHostName"));
criteria.addOrder(Order.asc("node.id"));
criteria.addOrder(Order.asc("ipAddress"));
if (!includeSNMP) {
return getInterfaceArray(m_ipInterfaceDao.findMatching(criteria));
} else {
return getInterfaceArrayWithSnmpData(m_ipInterfaceDao.findMatching(criteria));
}
}
Aggregations