use of com.infiniteautomation.mango.rest.latest.model.StreamedSeroJsonVORqlQuery 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.infiniteautomation.mango.rest.latest.model.StreamedSeroJsonVORqlQuery 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.infiniteautomation.mango.rest.latest.model.StreamedSeroJsonVORqlQuery 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;
}
use of com.infiniteautomation.mango.rest.latest.model.StreamedSeroJsonVORqlQuery in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsRestController 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.hasPermission(user, dataSourcePermissionDefinition.getPermission())) {
export.put("maintenanceEvents", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null));
} else {
export.put("maintenanceEvents", new StreamedSeroJsonVORqlQuery<>(service, rql, null, null, null, item -> {
if (item.getDataPoints().size() > 0) {
DataPointPermissionsCheckCallback callback = new DataPointPermissionsCheckCallback(user, true, permissionService, dataPointService);
dao.getPoints(item.getId(), callback);
if (!callback.hasPermission())
return false;
}
if (item.getDataSources().size() > 0) {
DataSourcePermissionsCheckCallback callback = new DataSourcePermissionsCheckCallback(user, true, permissionService);
dao.getDataSources(item.getId(), callback);
if (!callback.hasPermission())
return false;
}
return true;
}));
}
return export;
}
Aggregations