public static Restriction ne(final String attribute, final Object comparator) { return new NeRestriction(attribute, comparator); }
@Override public String toString() { return "NeRestriction [attribute=" + getAttribute() + ", value=" + getValue() + "]"; } }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void visitNe(final NeRestriction restriction) { final Object o = getProperty(restriction); if (o instanceof Comparable) { try { final Comparable oC = (Comparable)o; final Comparable oV = (Comparable)restriction.getValue(); final int comparison = oC.compareTo(oV); if (comparison != 0) { return; } } catch (final ClassCastException e) {} } else { if (!restriction.getValue().equals(o)) return; } fail(restriction); } @Override public void visitNeComplete(final NeRestriction restriction) {}
@SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void visitNe(final NeRestriction restriction) { final Object o = getProperty(restriction); if (o instanceof Comparable) { try { final Comparable oC = (Comparable)o; final Comparable oV = (Comparable)restriction.getValue(); final int comparison = oC.compareTo(oV); if (comparison != 0) { return; } } catch (final ClassCastException e) {} } else { if (!restriction.getValue().equals(o)) return; } fail(restriction); } @Override public void visitNeComplete(final NeRestriction restriction) {}
public static Restriction ne(final String attribute, final Object comparator) { return new NeRestriction(attribute, comparator); }
@Override public String toString() { return "NeRestriction [attribute=" + getAttribute() + ", value=" + getValue() + "]"; } }
@Override public List<String[]> getNodeServices(int nodeId){ final LinkedList<String[]> servicemap = new LinkedList<>(); Criteria criteria = new Criteria(OnmsMonitoredService.class); criteria.setAliases(Arrays.asList(new Alias[] { new Alias("ipInterface", "ipInterface", JoinType.LEFT_JOIN), new Alias("ipInterface.node", "node", JoinType.LEFT_JOIN) })); criteria.addRestriction(new EqRestriction("node.id", nodeId)); criteria.addRestriction(new NeRestriction("status", "F")); // Ignore forced-unmanaged for (OnmsMonitoredService service : m_monitoredServiceDao.findMatching(criteria)) { servicemap.add(new String[] { service.getIpAddressAsString(), service.getServiceName() }); } return servicemap; }
@Override public void visitNe(final NeRestriction restriction) { m_criterions.add(org.hibernate.criterion.Restrictions.ne(restriction.getAttribute(), restriction.getValue())); }
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); }
})) .addRestriction(new EqRestriction("node.id", nodeID)) .addRestriction(new NeRestriction("isManaged", "M"));
@Override public List<OnmsNode> findByIpAddressAndService(InetAddress ipAddress, String serviceName) { final org.opennms.core.criteria.Criteria criteria = new org.opennms.core.criteria.Criteria(OnmsNode.class) .setAliases(Arrays.asList(new Alias[] { new Alias("ipInterfaces","ipInterfaces", JoinType.LEFT_JOIN), new Alias("ipInterfaces.monitoredServices","monitoredServices", JoinType.LEFT_JOIN), new Alias("monitoredServices.serviceType","serviceType", JoinType.LEFT_JOIN) })) .addRestriction(new EqRestriction("ipInterfaces.ipAddress", ipAddress)) //TODO: Replace D with a constant .addRestriction(new NeRestriction("ipInterfaces.isManaged", "D")) .addRestriction(new EqRestriction("serviceType.name", serviceName)) .setOrders(Arrays.asList(new Order[] { Order.desc("id") })); return findMatching(criteria); }