fixed limit issue on top values

This commit is contained in:
Luca Frosini 2021-11-25 12:27:38 +01:00
parent 38b741dbb1
commit c37b03e969
2 changed files with 6 additions and 6 deletions

View File

@ -102,7 +102,7 @@ public interface AccountingPersistenceBackendQuery {
* @throws Exception
*/
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty) throws Exception;
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty, Integer limit) throws Exception;
/**
* Close the connection to persistence

View File

@ -201,7 +201,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return ret;
}
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty, boolean pad, int limit)
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty, boolean pad, Integer limit)
throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> got;
@ -209,7 +209,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
orderingProperty = getDefaultOrderingProperties(clz);
}
got = accountingPersistenceBackendQuery.getTopValues(topKey, orderingProperty);
got = accountingPersistenceBackendQuery.getTopValues(topKey, orderingProperty, limit);
int count = got.size() > limit ? limit : got.size();
NumberedFilter firstRemovalKey = null;
@ -235,13 +235,13 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
String orderingProperty = AccountingPersistenceQuery.getDefaultOrderingProperties(clz);
return this.getTopValues(topKey, orderingProperty, false, 0);
return this.getTopValues(topKey, orderingProperty, false, null);
}
@Override
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty)
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(String topKey, String orderingProperty, Integer limit)
throws Exception {
return this.getTopValues(topKey, orderingProperty, false, 0);
return this.getTopValues(topKey, orderingProperty, false, limit);
}
@Override