use of com.serotonin.m2m2.web.mvc.rest.v1.model.dataSource.DataSourceStreamCallback in project ma-modules-public by infiniteautomation.
the class DataSourceRestController method queryRQL.
@ApiOperation(value = "Query Data Sources", notes = "Use RQL formatted query", response = AbstractDataSourceModel.class, responseContainer = "List")
@RequestMapping(method = RequestMethod.GET, produces = { "application/json" })
public ResponseEntity<QueryDataPageStream<DataSourceVO<?>>> queryRQL(HttpServletRequest request) {
RestProcessResult<QueryDataPageStream<DataSourceVO<?>>> result = new RestProcessResult<QueryDataPageStream<DataSourceVO<?>>>(HttpStatus.OK);
User user = this.checkUser(request, result);
if (result.isOk()) {
try {
ASTNode node = parseRQLtoAST(request.getQueryString());
DataSourceStreamCallback callback = new DataSourceStreamCallback(this, user);
return result.createResponseEntity(getPageStream(node, callback));
} catch (InvalidRQLRestException e) {
LOG.error(e.getMessage(), e);
result.addRestMessage(getInternalServerErrorMessage(e.getMessage()));
return result.createResponseEntity();
}
}
return result.createResponseEntity();
}
Aggregations