use of com.serotonin.m2m2.db.dao.EventDetectorDao in project ma-modules-public by infiniteautomation.
the class EventDetectorRestV2Controller method queryRQL.
@ApiOperation(value = "Query Event Detectors", notes = "Use RQL formatted query, filtered by data point permissions", response = AbstractEventDetectorModel.class, responseContainer = "List")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<QueryDataPageStream<AbstractEventDetectorVO<?>>> queryRQL(@AuthenticationPrincipal User user, HttpServletRequest request) {
ASTNode node = parseRQLtoAST(request.getQueryString());
if (user.isAdmin()) {
// admin users don't need to filter the results
return new ResponseEntity<>(getPageStream(node), HttpStatus.OK);
} else {
EventDetectorStreamCallback callback = new EventDetectorStreamCallback(this, user);
FilteredPageQueryStream<AbstractEventDetectorVO<?>, AbstractEventDetectorModel<?>, EventDetectorDao> stream = new FilteredPageQueryStream<AbstractEventDetectorVO<?>, AbstractEventDetectorModel<?>, EventDetectorDao>(EventDetectorDao.instance, this, node, callback);
stream.setupQuery();
return new ResponseEntity<>(stream, HttpStatus.OK);
}
}
Aggregations