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
This commit is contained in:
Luca Frosini 2017-10-12 13:49:25 +00:00
parent 9e1f252c13
commit 99f2205b63
2 changed files with 28 additions and 3 deletions

View File

@ -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<Filter> 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<NumberedFilter> getFilterValues(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
String key, int limit) throws Exception;
/**
* Return a JsonObject with value
* e.g.for StorageUsageRecord {"dataVolume":1860328,"operationCount":4115}

View File

@ -277,11 +277,18 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
@Override
public SortedSet<NumberedFilter> getFilterValues(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters, String key) throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().getFilterValues(clz, temporalConstraint, filters,
key);
return getFilterValues(clz, temporalConstraint, filters, key, 100);
}
@Override
public SortedSet<NumberedFilter> getFilterValues(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters, String key, int limit) throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().getFilterValues(clz, temporalConstraint, filters,
key, limit);
}
@Override
public JSONObject getUsageValue(Class<? extends AggregatedRecord<?, ?>> clz, TemporalConstraint temporalConstraint,
Filter applicant) throws Exception {