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; + }