refs #437: Accounting Manager - List of Keys for Filters

https://support.d4science.org/issues/437

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@118930 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-09-08 15:04:56 +00:00
parent c8e986f1ba
commit 62b82a7e59
2 changed files with 32 additions and 0 deletions

View File

@ -159,4 +159,14 @@ public class ResourceRecordQuery {
return getInfo(usageRecordType, temporalConstraint, filters, false);
}
/**
* Return the list of key valid for queries a certain usage record type
* @param usageRecordType the usage record type
* @return a set containing the list of key
* @throws Exception if fails
*/
public Set<String> getFilterKeys(@SuppressWarnings("rawtypes") Class<? extends AggregatedUsageRecord> usageRecordType) throws Exception{
return accountingPersistenceQuery.getKeys(usageRecordType);
}
}

View File

@ -6,6 +6,7 @@ package org.gcube.accounting.analytics.persistence;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gcube.accounting.analytics.Filter;
import org.gcube.accounting.analytics.Info;
@ -27,6 +28,19 @@ public abstract class AccountingPersistenceQuery {
protected abstract Map<Calendar, Info> reallyQuery(@SuppressWarnings("rawtypes") Class<? extends AggregatedUsageRecord> usageRecordType,
TemporalConstraint temporalConstraint, List<Filter> filters) throws Exception;
/**
* Query the persistence obtaining a Map where the date is the key and
* the #Info is the value. The result is relative to an Usage Record Type,
* respect a TemporalConstraint and can be applied one or more filters.
* @param usageRecordType the Usage Record Type of interest
* @param temporalConstraint the TemporalConstraint (interval and aggregation)
* @param filters the filter for the query. If null or empty string get all
* data. The filters are evaluated in the order the are presented and are
* considered in AND
* @return the Map containing for each date in the required interval the
* requested data
* @throws Exception if fails
*/
public Map<Calendar, Info> query(@SuppressWarnings("rawtypes") Class<? extends AggregatedUsageRecord> usageRecordType,
TemporalConstraint temporalConstraint, List<Filter> filters) throws Exception{
logger.trace("Request query: UsageRecordType={}, {}={}, {}s={}", usageRecordType.newInstance().getUsageRecordType(),
@ -35,5 +49,13 @@ public abstract class AccountingPersistenceQuery {
return reallyQuery(usageRecordType, temporalConstraint, filters);
}
/**
* Return the list of key valid for queries a certain usage record type
* @param usageRecordType the usage record type
* @return a set containing the list of key
* @throws Exception if fails
*/
public abstract Set<String> getKeys(@SuppressWarnings("rawtypes") Class<? extends AggregatedUsageRecord> usageRecordType) throws Exception;
public abstract void close() throws Exception;
}