use of com.webank.wedatasphere.qualitis.query.request.RuleQueryRequest in project Qualitis by WeBankFinTech.
the class RuleQueryController method query.
@POST
@Path("query")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public GeneralResponse<?> query(RuleQueryRequest param, @Context HttpServletRequest request) {
if (param == null) {
param = new RuleQueryRequest();
}
// Get login user
param.setUser(HttpUtils.getUserName(request));
try {
PageRequest pageRequest = new PageRequest();
pageRequest.setPage(param.getPage());
pageRequest.setSize(param.getSize());
PageRequest.checkRequest(pageRequest);
DataInfo<RuleQueryDataSource> results = new DataInfo<>();
List<RuleQueryDataSource> ruleQueryDataSources = ruleQueryService.filter(pageRequest, param.getUser(), param.getCluster(), param.getDb(), param.getTable(), false);
results.setContent(ruleQueryDataSources);
List<RuleQueryDataSource> allRuleDataSource = ruleQueryService.filter(null, param.getUser(), param.getCluster(), param.getDb(), param.getTable(), true);
results.setTotalCount(allRuleDataSource == null ? 0 : allRuleDataSource.size());
LOG.info("[My DataSource] Query successfully. The number of results:{}", allRuleDataSource == null ? 0 : allRuleDataSource.size());
return new GeneralResponse<>("200", "{&QUERY_SUCCESSFULLY}", results);
} catch (Exception e) {
LOG.error("[My DataSource] Query failed, internal error.", e);
return new GeneralResponse<>("500", e.getMessage(), null);
}
}
Aggregations