Fixed bug on ordering and padding
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@126308 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
effe6b280a
commit
cb956fb1de
|
@ -10,7 +10,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import javax.activity.InvalidActivityException;
|
import javax.activity.InvalidActivityException;
|
||||||
|
@ -168,24 +167,33 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
||||||
}
|
}
|
||||||
|
|
||||||
got = AccountingPersistenceBackendQueryFactory.getInstance()
|
got = AccountingPersistenceBackendQueryFactory.getInstance()
|
||||||
.getTopValues(clz, temporalConstraint,
|
.getTopValues(clz, temporalConstraint, filters, topKey,
|
||||||
filters, topKey, orderingProperty);
|
orderingProperty);
|
||||||
|
|
||||||
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> ret =
|
|
||||||
new TreeMap<NumberedFilter, SortedMap<Calendar,Info>>();
|
|
||||||
|
|
||||||
if(pad){
|
|
||||||
int count = got.size() > limit ? limit : got.size();
|
int count = got.size() > limit ? limit : got.size();
|
||||||
while(--count >= 0){
|
|
||||||
|
NumberedFilter firstRemovalKey = null;
|
||||||
|
|
||||||
for(NumberedFilter nf : got.keySet()){
|
for(NumberedFilter nf : got.keySet()){
|
||||||
SortedMap<Calendar, Info> m =
|
if(--count>=0 || limit<=0){
|
||||||
|
if(pad){
|
||||||
padMap(got.get(nf), temporalConstraint);
|
padMap(got.get(nf), temporalConstraint);
|
||||||
ret.put(nf, m);
|
}
|
||||||
|
}else{
|
||||||
|
if(firstRemovalKey==null){
|
||||||
|
firstRemovalKey = nf;
|
||||||
|
}else{
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
if(firstRemovalKey!=null){
|
||||||
|
return got.subMap(got.firstKey(), firstRemovalKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return got;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(
|
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(
|
||||||
|
|
Loading…
Reference in New Issue