From 99f2205b63c4f23ce211e7cff757ffe3d8602d26 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 12 Oct 2017 13:49:25 +0000 Subject: [PATCH] Allow to specify a limit when querying values for suggestion. refs #9943 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@155176 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../AccountingPersistenceBackendQuery.java | 18 ++++++++++++++++++ .../AccountingPersistenceQuery.java | 13 ++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) 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 1df7aad..7cebca8 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java @@ -167,6 +167,8 @@ public interface AccountingPersistenceBackendQuery { */ public void close() throws Exception; + + /** * Return a sortedSet filter value * @@ -187,6 +189,22 @@ public interface AccountingPersistenceBackendQuery { TemporalConstraint temporalConstraint, List filters, String key) throws Exception; + /** + * Return a sortedSet filter value + * + * @param clz + * @param temporalConstraint + * @param filters + * @param key + * @param limit + * @return + * @throws Exception + */ + public SortedSet getFilterValues( + Class> clz, + TemporalConstraint temporalConstraint, List filters, + String key, int limit) throws Exception; + /** * Return a JsonObject with value * e.g.for StorageUsageRecord {"dataVolume":1860328,"operationCount":4115} 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 5d857c3..43ffad2 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java @@ -277,11 +277,18 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ @Override public SortedSet getFilterValues(Class> clz, TemporalConstraint temporalConstraint, List filters, String key) throws Exception { - - return AccountingPersistenceBackendQueryFactory.getInstance().getFilterValues(clz, temporalConstraint, filters, - key); + return getFilterValues(clz, temporalConstraint, filters, key, 100); } + @Override + public SortedSet getFilterValues(Class> clz, + TemporalConstraint temporalConstraint, List filters, String key, int limit) throws Exception { + + return AccountingPersistenceBackendQueryFactory.getInstance().getFilterValues(clz, temporalConstraint, filters, + key, limit); + } + + @Override public JSONObject getUsageValue(Class> clz, TemporalConstraint temporalConstraint, Filter applicant) throws Exception {