Search in sources :

Example 1 with BetweenRestriction

use of org.opennms.core.criteria.restrictions.BetweenRestriction in project opennms by OpenNMS.

the class LocationBroadcastProcessor method afterPropertiesSet.

/**
     * <p>afterPropertiesSet</p>
     *
     * @throws java.lang.Exception if any.
     */
@Override
public void afterPropertiesSet() throws Exception {
    BeanUtils.assertAutowiring(this);
    m_task = new TimerTask() {

        private Date m_lastRun = new Date();

        @Override
        public void run() {
            final Date now = new Date();
            final Criteria criteria = new Criteria(OnmsEvent.class).addRestriction(new BetweenRestriction("eventTime", m_lastRun, now)).addRestriction(new InRestriction("eventUei", m_events));
            for (final OnmsEvent e : m_eventDao.findMatching(criteria)) {
                handleLocationEvent(e);
            }
            m_lastRun = now;
        }
    };
//m_timer.schedule(m_task, UPDATE_PERIOD, UPDATE_PERIOD);
}
Also used : OnmsEvent(org.opennms.netmgt.model.OnmsEvent) TimerTask(java.util.TimerTask) BetweenRestriction(org.opennms.core.criteria.restrictions.BetweenRestriction) InRestriction(org.opennms.core.criteria.restrictions.InRestriction) Criteria(org.opennms.core.criteria.Criteria) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 TimerTask (java.util.TimerTask)1 Criteria (org.opennms.core.criteria.Criteria)1 BetweenRestriction (org.opennms.core.criteria.restrictions.BetweenRestriction)1 InRestriction (org.opennms.core.criteria.restrictions.InRestriction)1 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)1