return alerts;
}
@Override
public int triggeredSecondsAgo(String streamId, String conditionId) {
DBObject query = QueryBuilder.start("stream_id").is(streamId)
.and("condition_id").is(conditionId).get();
BasicDBObject sort = new BasicDBObject("triggered_at", -1);
DBObject alert = findOne(AlertImpl.class, query, sort);
if (alert == null) {
return -1;
}
DateTime triggeredAt = new DateTime(alert.get("triggered_at"), DateTimeZone.UTC);
return Seconds.secondsBetween(triggeredAt, Tools.iso8601()).getSeconds();
}