From 01cb56927577aed184843238f60bb6557599e126 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 1 Oct 2015 15:35:09 +0000 Subject: [PATCH] refs #513: Suggest Values for filter in accounting-analytics https://support.d4science.org/issues/513 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@119327 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../accounting/analytics/ResourceRecordQuery.java | 7 +++++++ .../persistence/AccountingPersistenceQuery.java | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java b/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java index c183975..372b04b 100644 --- a/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/ResourceRecordQuery.java @@ -173,4 +173,11 @@ public class ResourceRecordQuery { return toSort; } + public List getPossibleValuesForKey(@SuppressWarnings("rawtypes") Class usageRecordType, String key) throws Exception { + Set keys = accountingPersistenceQuery.getPossibleValuesForKey(usageRecordType, key); + List toSort = new ArrayList(keys); + Collections.sort(toSort); + return toSort; + } + } 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 08cd31f..5dcfe49 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java @@ -57,9 +57,20 @@ public abstract class AccountingPersistenceQuery { */ public abstract Set getKeys(@SuppressWarnings("rawtypes") Class usageRecordType) throws Exception; + + /** + * Return the list of possible values for a key for a certain usage record type + * @param usageRecordType the usage record type + * @param key the key + * @return a set containing the list of possible values + * @throws Exception if fails + */ + public abstract Set getPossibleValuesForKey(@SuppressWarnings("rawtypes") Class usageRecordType, String key) throws Exception; + /** * Close the connection to persistence * @throws Exception if the close fails */ public abstract void close() throws Exception; + }