use of org.opennms.netmgt.model.OnmsAlarmCollection in project opennms by OpenNMS.
the class AlarmRestService method getAlarms.
/**
* <p>
* getAlarms
* </p>
*
* @return a {@link org.opennms.netmgt.model.OnmsAlarmCollection} object.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML })
@Transactional
public OnmsAlarmCollection getAlarms(@Context final SecurityContext securityContext, @Context final UriInfo uriInfo) {
SecurityHelper.assertUserReadCredentials(securityContext);
final CriteriaBuilder builder = getCriteriaBuilder(uriInfo.getQueryParameters(), false);
builder.distinct();
final OnmsAlarmCollection coll = new OnmsAlarmCollection(m_alarmDao.findMatching(builder.toCriteria()));
// For getting totalCount
coll.setTotalCount(m_alarmDao.countMatching(builder.count().toCriteria()));
return coll;
}
Aggregations