use of com.serotonin.m2m2.web.mvc.rest.v1.model.PageQueryStream in project ma-modules-public by infiniteautomation.
the class AuditRestController method queryRQL.
@ApiOperation(value = "Query Audit Events", notes = "Admin access only", response = AuditEventInstanceModel.class, responseContainer = "Array")
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<PageQueryStream<AuditEventInstanceVO, AuditEventInstanceModel, AuditEventDao>> queryRQL(HttpServletRequest request) {
RestProcessResult<PageQueryStream<AuditEventInstanceVO, AuditEventInstanceModel, AuditEventDao>> result = new RestProcessResult<PageQueryStream<AuditEventInstanceVO, AuditEventInstanceModel, AuditEventDao>>(HttpStatus.OK);
User user = this.checkUser(request, result);
if (result.isOk()) {
try {
if (!user.isAdmin()) {
result.addRestMessage(getUnauthorizedMessage());
return result.createResponseEntity();
} else {
// Limit our results based on the fact that our permissions should be in the permissions strings
ASTNode root = parseRQLtoAST(request.getQueryString());
return result.createResponseEntity(getPageStream(root));
}
} catch (InvalidRQLRestException e) {
result.addRestMessage(getInternalServerErrorMessage(e.getMessage()));
return result.createResponseEntity();
}
}
return result.createResponseEntity();
}
Aggregations