diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java index 86be94f..ba26722 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java @@ -102,7 +102,7 @@ public interface AccountingPersistenceBackendQuery { * @throws Exception */ - public SortedMap> getTopValues(String topKey, String orderingProperty) throws Exception; + public SortedMap> getTopValues(String topKey, String orderingProperty, Integer limit) throws Exception; /** * Close the connection to persistence diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java index 0b13d33..907bcf2 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java @@ -201,7 +201,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return ret; } - public SortedMap> getTopValues(String topKey, String orderingProperty, boolean pad, int limit) + public SortedMap> getTopValues(String topKey, String orderingProperty, boolean pad, Integer limit) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { SortedMap> 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> 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> getTopValues(String topKey, String orderingProperty) + public SortedMap> getTopValues(String topKey, String orderingProperty, Integer limit) throws Exception { - return this.getTopValues(topKey, orderingProperty, false, 0); + return this.getTopValues(topKey, orderingProperty, false, limit); } @Override