use of org.kie.workbench.common.services.refactoring.backend.server.query.response.ResponseBuilder in project kie-wb-common by kiegroup.
the class ImpactAnalysisJavaFileTest method getQueries.
protected Set<NamedQuery> getQueries() {
return new HashSet<NamedQuery>() {
{
add(new FindResourceReferencesQuery() {
@Override
public ResponseBuilder getResponseBuilder() {
return new DefaultResponseBuilder(ioService());
}
});
add(new FindAllChangeImpactQuery() {
@Override
public ResponseBuilder getResponseBuilder() {
return new DefaultResponseBuilder(ioService());
}
});
}
};
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.response.ResponseBuilder in project kie-wb-common by kiegroup.
the class RefactoringQueryServiceImpl method query.
@Override
public PageResponse<RefactoringPageRow> query(final RefactoringPageRequest request) {
PortablePreconditions.checkNotNull("request", request);
final String queryName = PortablePreconditions.checkNotNull("queryName", request.getQueryName());
final NamedQuery namedQuery = namedQueries.findNamedQuery(queryName);
// Validate provided terms against those required for the named query
namedQuery.validateTerms(request.getQueryTerms());
final Query query = namedQuery.toQuery(request.getQueryTerms());
final Sort sort = namedQuery.getSortOrder();
final int pageSize = request.getPageSize();
final int startIndex = request.getStartRowIndex();
List<KObject> kObjects = search(query, sort, () -> (startIndex), // start index of docs to get
(numHits) -> (numHits - startIndex > pageSize ? pageSize : numHits - startIndex), request.distinctResults());
if (!kObjects.isEmpty()) {
final ResponseBuilder responseBuilder = namedQuery.getResponseBuilder();
return responseBuilder.buildResponse(pageSize, startIndex, new ArrayList<>(kObjects));
} else {
return emptyResponse;
}
}
use of org.kie.workbench.common.services.refactoring.backend.server.query.response.ResponseBuilder in project kie-wb-common by kiegroup.
the class PackageDescrIndexVisitorIndexingTest method getQueries.
protected Set<NamedQuery> getQueries() {
return new HashSet<NamedQuery>() {
{
add(new FindResourceReferencesQuery() {
@Override
public ResponseBuilder getResponseBuilder() {
return new DefaultResponseBuilder(ioService());
}
});
add(new FindAllChangeImpactQuery() {
@Override
public ResponseBuilder getResponseBuilder() {
return new DefaultResponseBuilder(ioService());
}
});
}
};
}
Aggregations