|
|
|
@ -23,9 +23,7 @@ import java.util.SortedSet;
|
|
|
|
|
import java.util.TreeMap;
|
|
|
|
|
import java.util.TreeSet;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.gcube.accounting.analytics.Filter;
|
|
|
|
|
import org.gcube.accounting.analytics.FiltersValue;
|
|
|
|
|
import org.gcube.accounting.analytics.Info;
|
|
|
|
|
import org.gcube.accounting.analytics.NumberedFilter;
|
|
|
|
|
import org.gcube.accounting.analytics.TemporalConstraint;
|
|
|
|
@ -1458,7 +1456,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
String keyOrderingProperty = null;
|
|
|
|
|
for (UsageValue totalFilters:listUsage){
|
|
|
|
|
|
|
|
|
|
logger.debug("----------------- init for totalFilters");
|
|
|
|
|
logger.debug("-----------------/ init for totalFilters");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -1514,7 +1512,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
//int i = 0;
|
|
|
|
|
//int countFilters=0;
|
|
|
|
|
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
if (totalFilters instanceof UsageServiceValue){
|
|
|
|
|
UsageServiceValue totalFiltersService = (UsageServiceValue)totalFilters;
|
|
|
|
|
//countFilters =totalFiltersService.getFiltersValue().size();
|
|
|
|
|
}
|
|
|
|
@ -1532,7 +1530,9 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
startKeyTmp.add(totalFilters.getIdentifier());
|
|
|
|
|
endKeyTmp.add(totalFilters.getIdentifier());
|
|
|
|
|
//FiltersValue singleFilter=null;
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
if (totalFilters instanceof UsageServiceValue){
|
|
|
|
|
//logger.debug("******UsageServiceValue");
|
|
|
|
|
|
|
|
|
|
UsageServiceValue totalFiltersService = (UsageServiceValue)totalFilters;
|
|
|
|
|
//singleFilter=totalFiltersService.getFiltersValue().get(i);
|
|
|
|
|
for (Filter filter:totalFiltersService.getFilters()){
|
|
|
|
@ -1598,23 +1598,15 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
map.put(key, valuetmp + map.get(key));
|
|
|
|
|
|
|
|
|
|
// TODO verify a better method
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageStorageValue.class.getSimpleName())){
|
|
|
|
|
if (totalFilters instanceof UsageStorageValue){
|
|
|
|
|
logger.debug("storageUsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
if (key.equals("dataVolume")){
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
totalFilters.setOrderingProperty(key);
|
|
|
|
|
totalFilters.setD(totalFilters.getD()+valuetmp.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
if (key.equals("dataVolume")){
|
|
|
|
|
keyOrderingProperty=key;
|
|
|
|
|
totalQuota+=totalFilters.getD()+valuetmp.doubleValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
logger.debug("?UsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
totalFilters.setOrderingProperty(key);
|
|
|
|
|
totalFilters.setD(totalFilters.getD()+valuetmp.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
logger.debug("?UsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
keyOrderingProperty=key;
|
|
|
|
|
totalQuota+=totalFilters.getD()+valuetmp.doubleValue();
|
|
|
|
|
}
|
|
|
|
@ -1624,24 +1616,18 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
map.put(key, valuetmp);
|
|
|
|
|
|
|
|
|
|
// TODO verify a better method
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageStorageValue.class.getSimpleName())){
|
|
|
|
|
if (totalFilters instanceof UsageStorageValue){
|
|
|
|
|
logger.debug("storageUsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
if (key.equals("dataVolume")){
|
|
|
|
|
keyOrderingProperty=key;
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
totalFilters.setOrderingProperty(key);
|
|
|
|
|
totalFilters.setD(valuetmp.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalQuota+=valuetmp.doubleValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
logger.debug("UsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
logger.debug("?UsageRecord -designDocId:{}",designDocId);
|
|
|
|
|
keyOrderingProperty=key;
|
|
|
|
|
if (totalFilters.getClass().getSimpleName().equals(UsageServiceValue.class.getSimpleName())){
|
|
|
|
|
totalFilters.setOrderingProperty(key);
|
|
|
|
|
totalFilters.setD(valuetmp.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalQuota+=valuetmp.doubleValue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1650,7 +1636,15 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
}
|
|
|
|
|
//i++;
|
|
|
|
|
//} while (i <countFilters );
|
|
|
|
|
//convert usage from byte to Mb
|
|
|
|
|
if (totalFilters instanceof UsageStorageValue){
|
|
|
|
|
totalQuota=totalQuota/1024/1024;
|
|
|
|
|
totalQuota=Math.round(totalQuota * 100.0) / 100.0;
|
|
|
|
|
}
|
|
|
|
|
totalFilters.setOrderingProperty(keyOrderingProperty);
|
|
|
|
|
if (totalQuota.isNaN()){
|
|
|
|
|
totalQuota=0.0;
|
|
|
|
|
}
|
|
|
|
|
totalFilters.setD(totalQuota);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|