public QueryResult rank(String userId, Query query, String field, int numResults, boolean asc, String sessionId)
throws CatalogException {
query = ParamUtils.defaultObject(query, Query::new);
ParamUtils.checkObj(field, "field");
ParamUtils.checkObj(userId, "userId");
ParamUtils.checkObj(sessionId, "sessionId");
String userOfQuery = this.catalogManager.getUserManager().getUserId(sessionId);
if (!userOfQuery.equals(userId)) {
throw CatalogAuthorizationException.cantRead(userOfQuery, "Project", -1, userId);
}
boolean count = true;
QueryResult queryResult = null;
if (count) {
queryResult = projectDBAdaptor.rank(query, field, numResults, asc);
}
return ParamUtils.defaultObject(queryResult, QueryResult::new);
}