use of com.infiniteautomation.mango.db.tables.EventDetectors in project ma-modules-public by infiniteautomation.
the class EventDetectorsRestController method exportQuery.
@ApiOperation(value = "Export formatted for Configuration Import by supplying an RQL query", notes = "User must have read permission")
@RequestMapping(method = RequestMethod.GET, value = "/export", produces = MediaTypes.SEROTONIN_JSON_VALUE)
public Map<String, JsonStreamedArray> exportQuery(HttpServletRequest request, @AuthenticationPrincipal PermissionHolder user) {
ASTNode rql = RQLUtils.parseRQLtoAST(request.getQueryString());
Map<String, JsonStreamedArray> export = new HashMap<>();
if (permissionService.hasAdminRole(user)) {
export.put("eventDetectors", new StreamedSeroJsonVORqlQuery<>(service, rql, null, fieldMap, null));
} else {
export.put("eventDetectors", new StreamedSeroJsonVORqlQuery<>(service, rql, null, fieldMap, null, vo -> service.hasReadPermission(user, vo)));
}
return export;
}
Aggregations