Add a new method getNextPossibleValuesWithMap

(calculate top with map)

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@141628 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Alessandro Pieve 2017-01-19 10:42:05 +00:00
parent ece86afce3
commit 2e637013b6
5 changed files with 41 additions and 5 deletions

View File

@ -9,7 +9,7 @@
<groupId>org.gcube.accounting</groupId> <groupId>org.gcube.accounting</groupId>
<artifactId>accounting-analytics</artifactId> <artifactId>accounting-analytics</artifactId>
<version>2.3.0-SNAPSHOT</version> <version>2.4.0-SNAPSHOT</version>
<name>accounting-analytics</name> <name>accounting-analytics</name>
<properties> <properties>
@ -26,9 +26,10 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-smartgears-bom</artifactId> <artifactId>gcube-bom</artifactId>
<version>LATEST</version> <version>LATEST</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>

View File

@ -31,6 +31,7 @@ public class TemporalConstraint {
*/ */
public enum AggregationMode { public enum AggregationMode {
YEARLY, MONTHLY, DAILY, HOURLY, MINUTELY, SECONDLY, MILLISECONDLY YEARLY, MONTHLY, DAILY, HOURLY, MINUTELY, SECONDLY, MILLISECONDLY
} }
/** /**
@ -39,6 +40,7 @@ public class TemporalConstraint {
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public enum CalendarEnum { public enum CalendarEnum {
YEAR(Calendar.YEAR), YEAR(Calendar.YEAR),
MONTH(Calendar.MONTH), MONTH(Calendar.MONTH),
DAY(Calendar.DAY_OF_MONTH), DAY(Calendar.DAY_OF_MONTH),

View File

@ -9,15 +9,16 @@ import org.gcube.accounting.datamodel.AggregatedUsageRecord;
* *
*/ */
public abstract class UsageValue { public abstract class UsageValue {
public UsageValue(){}
protected Class<? extends AggregatedUsageRecord<?, ?>> clz; protected Class<? extends AggregatedUsageRecord<?, ?>> clz;
protected TemporalConstraint temporalConstraint; protected TemporalConstraint temporalConstraint;
//protected List<FiltersValue> filtersValue;
protected String identifier; protected String identifier;
protected Double d; protected Double d;
protected String orderingProperty; protected String orderingProperty;
protected String context; protected String context;
public UsageValue(){}
public abstract Class<? extends AggregatedUsageRecord<?, ?>> getClz(); public abstract Class<? extends AggregatedUsageRecord<?, ?>> getClz();
public abstract String getIdentifier(); public abstract String getIdentifier();
public abstract Double getD(); public abstract Double getD();

View File

@ -115,6 +115,23 @@ public interface AccountingPersistenceBackendQuery {
String key, String orderingProperty) throws String key, String orderingProperty) throws
DuplicatedKeyFilterException, KeyException, ValueException, DuplicatedKeyFilterException, KeyException, ValueException,
Exception; Exception;
/**
* Same method but use if possible a map-reduce
* @param clz
* @param temporalConstraint
* @param filters
* @param key
* @param orderingProperty
* @return
* @throws Exception
*/
public SortedSet<NumberedFilter> getNextPossibleValuesWithMap(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
String key, String orderingProperty) throws Exception;
/** /**
* Close the connection to persistence * Close the connection to persistence
@ -252,4 +269,6 @@ public interface AccountingPersistenceBackendQuery {
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts) TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
throws Exception; throws Exception;
} }

View File

@ -247,6 +247,17 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
} }
@Override
public SortedSet<NumberedFilter> getNextPossibleValuesWithMap(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
String key, String orderingProperty) throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance()
.getNextPossibleValuesWithMap(clz, temporalConstraint, filters,
key, orderingProperty);
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -337,6 +348,8 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
} }
return got; return got;
} }