use of org.infinispan.query.remote.json.JsonQueryResult in project infinispan by infinispan.
the class JsonQuerySerializer method createQueryResponse.
@Override
public JsonQueryResponse createQueryResponse(RemoteQueryResult remoteQueryResult) {
long totalResults = remoteQueryResult.getTotalResults();
String[] projections = remoteQueryResult.getProjections();
JsonQueryResponse response;
if (projections == null) {
List<Object> results = remoteQueryResult.getResults().stream().map(o -> transcoderFromStorage.transcode(o, storageMediaTye, APPLICATION_JSON)).collect(toList());
List<Hit> hits = results.stream().map(Hit::new).collect(Collectors.toList());
response = new JsonQueryResult(hits, totalResults);
} else {
response = new ProjectedJsonResult(totalResults, projections, remoteQueryResult.getResults());
}
return response;
}
Aggregations