Search in sources :

Example 1 with RQLFilterJsonNode

use of com.infiniteautomation.mango.db.query.pojo.RQLFilterJsonNode in project ma-modules-public by infiniteautomation.

the class JsonRestController method query.

@RequestMapping(method = RequestMethod.GET, value = "/query/{xid}")
public ArrayWithTotal<Stream<JsonNode>> query(@PathVariable String xid, HttpServletRequest request, ASTNode rql) throws UnsupportedEncodingException {
    String path = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
    String pointer = path.endsWith("/") ? "/" : "";
    ArrayNode items = this.jsonDataService.valuesForDataAtPointer(xid, pointer);
    return new FilteredStreamWithTotal<>(items, new RQLFilterJsonNode(rql));
}
Also used : RQLFilterJsonNode(com.infiniteautomation.mango.db.query.pojo.RQLFilterJsonNode) FilteredStreamWithTotal(com.infiniteautomation.mango.rest.latest.model.FilteredStreamWithTotal) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with RQLFilterJsonNode

use of com.infiniteautomation.mango.db.query.pojo.RQLFilterJsonNode in project ma-modules-public by infiniteautomation.

the class JsonRestController method queryAtPointer.

@RequestMapping(method = RequestMethod.GET, value = "/query/{xid}/**")
public ArrayWithTotal<Stream<JsonNode>> queryAtPointer(@PathVariable String xid, @ApiIgnore @RemainingPath String path, ASTNode rql) throws UnsupportedEncodingException {
    String pointer = "/" + path;
    ArrayNode items = this.jsonDataService.valuesForDataAtPointer(xid, pointer);
    return new FilteredStreamWithTotal<>(items, new RQLFilterJsonNode(rql));
}
Also used : RQLFilterJsonNode(com.infiniteautomation.mango.db.query.pojo.RQLFilterJsonNode) FilteredStreamWithTotal(com.infiniteautomation.mango.rest.latest.model.FilteredStreamWithTotal) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 RQLFilterJsonNode (com.infiniteautomation.mango.db.query.pojo.RQLFilterJsonNode)2 FilteredStreamWithTotal (com.infiniteautomation.mango.rest.latest.model.FilteredStreamWithTotal)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2