Added limit for possible values of key function

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@122257 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-01-15 16:48:22 +00:00
parent fa6fe94b52
commit dee00d7d63
1 changed files with 18 additions and 1 deletions

View File

@ -23,6 +23,8 @@ public abstract class AccountingPersistenceBackendQuery {
private static final Logger logger = LoggerFactory.getLogger(AccountingPersistenceBackendQuery.class);
public static final int KEY_VALUES_LIMIT = 25;
protected abstract void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception;
protected abstract Map<Calendar, Info> reallyQuery(@SuppressWarnings("rawtypes") Class<? extends AggregatedRecord> usageRecordType,
@ -59,7 +61,13 @@ public abstract class AccountingPersistenceBackendQuery {
/**
* Return the list of possible values for a key for a certain usage record type
* Return the list of possible values for a key for a certain usage record type.
* The result are limited to {@link #KEY_VALUES_LIMIT} value.
* If you want a different limit please use the
* {@link #getPossibleValuesForKey(Class, String, int)} function.
* Invoking this function has the same effect of invoking
* {@link #getPossibleValuesForKey(Class, String, int)} function passing
* {@link #KEY_VALUES_LIMIT} has third argument.
* @param recordClass the usage record type
* @param key the key
* @return a set containing the list of possible values
@ -67,6 +75,15 @@ public abstract class AccountingPersistenceBackendQuery {
*/
public abstract Set<String> getPossibleValuesForKey(@SuppressWarnings("rawtypes") Class<? extends AggregatedRecord> recordClass, String key) throws Exception;
/**
* Return the list of possible values for a key for a certain usage record type
* @param recordClass the usage record type
* @param key the key
* @return a set containing the list of possible values
* @throws Exception if fails
*/
public abstract Set<String> getPossibleValuesForKey(@SuppressWarnings("rawtypes") Class<? extends AggregatedRecord> recordClass, String key, int limit) throws Exception;
/**
* Close the connection to persistence
* @throws Exception if the close fails