public static InRestriction in(final String attribute, final Collection<?> collection) { return new InRestriction(attribute, collection); }
@Override public String toString() { return "InRestriction [attribute=" + getAttribute() + ", values=" + getValues() + "]"; } }
public Collection<?> getValues() { return (Collection<?>) this.getValue(); }
@Override public String toString() { return "InRestriction [attribute=" + getAttribute() + ", values=" + getValues() + "]"; } }
public static InRestriction in(final String attribute, final Collection<?> collection) { return new InRestriction(attribute, collection); }
public Collection<?> getValues() { return (Collection<?>) this.getValue(); }
@Override public void visitIn(final InRestriction restriction) { if (restriction.getValues() == null || restriction.getValues().size() == 0) { m_criterions.add(org.hibernate.criterion.Restrictions.sqlRestriction("0")); } else { m_criterions.add(org.hibernate.criterion.Restrictions.in(restriction.getAttribute(), restriction.getValues())); } }
private int scheduleServices() { final Criteria criteria = new Criteria(OnmsMonitoredService.class); criteria.addRestriction(new InRestriction("status", Arrays.asList("A", "N"))); return m_transactionTemplate.execute(new TransactionCallback<Integer>() { @Override public Integer doInTransaction(TransactionStatus arg0) { final List<OnmsMonitoredService> services = m_monitoredServiceDao.findMatching(criteria); for (OnmsMonitoredService service : services) { scheduleService(service); } return services.size(); } }); }
@Override public void refresh() { List<OnmsAlarm> alarms = getAlarms(); List<Integer> alarmIds = new LinkedList<>(); if (alarms.size() > 0) { for (OnmsAlarm onmsAlarm : alarms) { alarmIds.add(onmsAlarm.getId()); } } else { alarmIds.add(0); } List<Restriction> restrictions = new LinkedList<>(); restrictions.add(new InRestriction("id", alarmIds)); ((OnmsVaadinContainer<?, ?>) m_alarmTable.getContainerDataSource()).setRestrictions(restrictions); setBoosted(checkBoosted(alarms)); m_alarmTable.markAsDirtyRecursive(); }