use of com.serotonin.json.type.JsonStreamedArray in project ma-modules-public by infiniteautomation.
the class PublishersRestController 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("publishers", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
} else {
export.put("publishers", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null, vo -> service.hasReadPermission(user, vo)));
}
return export;
}
use of com.serotonin.json.type.JsonStreamedArray in project ma-modules-public by infiniteautomation.
the class PublishersWithoutPointsRestController 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("publishers", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
} else {
export.put("publishers", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null, vo -> service.hasReadPermission(user, vo)));
}
return export;
}
use of com.serotonin.json.type.JsonStreamedArray in project ma-modules-public by infiniteautomation.
the class PublishedPointsRestController 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) {
permissionService.ensureAdminRole(user);
ASTNode rql = RQLUtils.parseRQLtoAST(request.getQueryString());
Map<String, JsonStreamedArray> export = new HashMap<>();
export.put(ConfigurationExportData.PUBLISHED_POINTS, new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
return export;
}
use of com.serotonin.json.type.JsonStreamedArray in project ma-modules-public by infiniteautomation.
the class DataSourcesRestController 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<>();
export.put("dataSources", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
return export;
}
use of com.serotonin.json.type.JsonStreamedArray in project ma-modules-public by infiniteautomation.
the class UserRestController 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)) {
User currentUser = user.getUser();
rql = RQLUtils.addAndRestriction(rql, new ASTNode("eq", "id", currentUser == null ? Common.NEW_ID : currentUser.getId()));
}
export.put("users", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
return export;
}
Aggregations