Search in sources :

Example 86 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class AlarmStatsRestService method getNewestUnacknowledged.

private OnmsAlarm getNewestUnacknowledged(final OnmsSeverity severity) {
    final CriteriaBuilder builder = getCriteriaBuilder(severity);
    builder.orderBy("lastEventTime").desc();
    builder.orderBy("id").desc();
    builder.limit(1);
    final Criteria criteria = builder.toCriteria();
    LOG.debug("getNewestUnacknowledged({}) criteria = {}", severity, criteria);
    return m_statisticsService.getUnacknowledged(criteria);
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Criteria(org.opennms.core.criteria.Criteria)

Example 87 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class AlarmStatsRestService method getOldestAcknowledged.

protected OnmsAlarm getOldestAcknowledged(final OnmsSeverity severity) {
    final CriteriaBuilder builder = getCriteriaBuilder(severity);
    builder.orderBy("firstEventTime").asc();
    builder.orderBy("id").asc();
    builder.limit(1);
    final Criteria criteria = builder.toCriteria();
    LOG.debug("getOldestAcknowledged({}) criteria = {}", severity, criteria);
    return m_statisticsService.getAcknowledged(criteria);
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Criteria(org.opennms.core.criteria.Criteria)

Example 88 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class AlarmStatsRestService method getOldestUnacknowledged.

private OnmsAlarm getOldestUnacknowledged(final OnmsSeverity severity) {
    final CriteriaBuilder builder = getCriteriaBuilder(severity);
    builder.orderBy("firstEventTime").asc();
    builder.orderBy("id").asc();
    builder.limit(1);
    final Criteria criteria = builder.toCriteria();
    LOG.debug("getOldestUnacknowledged({}) criteria = {}", severity, criteria);
    return m_statisticsService.getUnacknowledged(criteria);
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Criteria(org.opennms.core.criteria.Criteria)

Example 89 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class AlarmRestServiceBase method getCriteria.

protected Criteria getCriteria(final MultivaluedMap<String, String> params, final boolean stripOrdering) {
    final CriteriaBuilder cb = getCriteriaBuilder(params, stripOrdering);
    final Criteria criteria = cb.toCriteria();
    LOG.debug("criteria = {}", criteria);
    return criteria;
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder) Criteria(org.opennms.core.criteria.Criteria)

Example 90 with CriteriaBuilder

use of org.opennms.core.criteria.CriteriaBuilder in project opennms by OpenNMS.

the class EventRestService method getCriteriaBuilder.

private static CriteriaBuilder getCriteriaBuilder(final MultivaluedMap<String, String> params) {
    final CriteriaBuilder builder = new CriteriaBuilder(OnmsEvent.class);
    builder.alias("node", "node", JoinType.LEFT_JOIN);
    builder.alias("node.snmpInterfaces", "snmpInterface", JoinType.LEFT_JOIN);
    builder.alias("node.ipInterfaces", "ipInterface", JoinType.LEFT_JOIN);
    builder.alias("node.location", "location", JoinType.LEFT_JOIN);
    builder.alias("serviceType", "serviceType", JoinType.LEFT_JOIN);
    applyQueryFilters(params, builder);
    return builder;
}
Also used : CriteriaBuilder(org.opennms.core.criteria.CriteriaBuilder)

Aggregations

CriteriaBuilder (org.opennms.core.criteria.CriteriaBuilder)155 Test (org.junit.Test)60 Criteria (org.opennms.core.criteria.Criteria)31 OnmsNode (org.opennms.netmgt.model.OnmsNode)25 Transactional (org.springframework.transaction.annotation.Transactional)23 Date (java.util.Date)20 GET (javax.ws.rs.GET)13 ArrayList (java.util.ArrayList)12 Produces (javax.ws.rs.Produces)12 OnmsAlarm (org.opennms.netmgt.model.OnmsAlarm)11 OnmsEvent (org.opennms.netmgt.model.OnmsEvent)11 InetSocketAddress (java.net.InetSocketAddress)9 OnmsIpInterface (org.opennms.netmgt.model.OnmsIpInterface)7 HibernateDaoFactory (org.opennms.smoketest.utils.HibernateDaoFactory)7 OnmsMinion (org.opennms.netmgt.model.minion.OnmsMinion)6 RateLimiter (com.google.common.util.concurrent.RateLimiter)4 JUnitTemporaryDatabase (org.opennms.core.test.db.annotations.JUnitTemporaryDatabase)4 EventDao (org.opennms.netmgt.dao.api.EventDao)4 OnmsSeverity (org.opennms.netmgt.model.OnmsSeverity)4 OnmsSnmpInterface (org.opennms.netmgt.model.OnmsSnmpInterface)4