add getContextTimeSeries
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@133948 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c0ca3f0b63
commit
13d9e34a9c
2
pom.xml
2
pom.xml
|
@ -9,7 +9,7 @@
|
|||
|
||||
<groupId>org.gcube.accounting</groupId>
|
||||
<artifactId>accounting-analytics</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<version>2.3.0-SNAPSHOT</version>
|
||||
<name>accounting-analytics</name>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -200,8 +200,17 @@ public interface AccountingPersistenceBackendQuery {
|
|||
throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a SortedMap containing the TimeSeries for each context.
|
||||
* @param clz
|
||||
* @param temporalConstraint
|
||||
* @param filters
|
||||
* @param contexts
|
||||
* @return
|
||||
*/
|
||||
public SortedMap<Filter, SortedMap<Calendar, Info>> getContextTimeSeries(
|
||||
Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
|
||||
throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filter> filters,
|
||||
String key) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getFilterValues(clz, temporalConstraint, filters,
|
||||
key);
|
||||
|
@ -281,7 +281,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
public JSONObject getUsageValue(Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, Filter applicant)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getUsageValue(clz, temporalConstraint, applicant);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
public List<Filters> getUsageValueQuota(Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filters> listUsage)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getUsageValueQuota(clz, temporalConstraint, listUsage);
|
||||
}
|
||||
|
@ -300,10 +300,55 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
public List<TotalFilters> getUsageValueQuotaTotal(Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<TotalFilters> listUsage)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getUsageValueQuotaTotal(clz, temporalConstraint, listUsage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public SortedMap<Filter, SortedMap<Calendar, Info>> getContextTimeSeries(
|
||||
Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
|
||||
throws Exception {
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getContextTimeSeries(clz, temporalConstraint, filters, contexts);
|
||||
}
|
||||
|
||||
|
||||
public SortedMap<Filter, SortedMap<Calendar, Info>> getContextTimeSeries(
|
||||
Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filter> filters,
|
||||
List<String> contexts, boolean pad)
|
||||
throws DuplicatedKeyFilterException,
|
||||
Exception {
|
||||
SortedMap<Filter, SortedMap<Calendar, Info>> got;
|
||||
got = AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getContextTimeSeries(clz, temporalConstraint, filters, contexts);
|
||||
int count = got.size();
|
||||
Filter firstRemovalKey = null;
|
||||
for(Filter nf : got.keySet()){
|
||||
if(--count>=0){
|
||||
if(pad){
|
||||
padMap(got.get(nf), temporalConstraint);
|
||||
|
||||
}
|
||||
}else{
|
||||
if(firstRemovalKey==null){
|
||||
firstRemovalKey = nf;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(firstRemovalKey!=null){
|
||||
return got.subMap(got.firstKey(), firstRemovalKey);
|
||||
}
|
||||
return got;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue