|
|
|
@ -1505,11 +1505,10 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
logger.debug("getUsageValueQuotaTotal init with list:{}",listUsage);
|
|
|
|
|
|
|
|
|
|
//String currentScope = ScopeProvider.instance.get();
|
|
|
|
|
|
|
|
|
|
String keyOrderingProperty = null;
|
|
|
|
|
for (UsageValue totalFilters:listUsage){
|
|
|
|
|
|
|
|
|
|
logger.debug("-----------------/ init for totalFilters");
|
|
|
|
|
String currentScope = totalFilters.getContext();
|
|
|
|
|
|
|
|
|
|
Collection<String> keys= new TreeSet<>();
|
|
|
|
@ -1532,14 +1531,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
new TemporalConstraint(startTime.getTimeInMillis(),
|
|
|
|
|
endTime.getTimeInMillis(), AggregationMode.DAILY);
|
|
|
|
|
if (totalFilters instanceof UsageStorageValue){
|
|
|
|
|
|
|
|
|
|
// if (totalFilters.getClz().getSimpleName().equals(AggregatedStorageStatusRecord.class.getSimpleName())){
|
|
|
|
|
//TODO sarebbe possibile invece con il nome verificare che getClz e' un istanza di AggregatedStorageStatusRecord?
|
|
|
|
|
//designDocId = "QuotaTotal";
|
|
|
|
|
|
|
|
|
|
//TEST
|
|
|
|
|
designDocId="QuotaTotalSeparated";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1558,12 +1550,9 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
aggregationMode, false, false);
|
|
|
|
|
|
|
|
|
|
Double totalQuota=0.00;
|
|
|
|
|
//int i = 0;
|
|
|
|
|
//int countFilters=0;
|
|
|
|
|
|
|
|
|
|
if (totalFilters instanceof UsageServiceValue){
|
|
|
|
|
UsageServiceValue totalFiltersService = (UsageServiceValue)totalFilters;
|
|
|
|
|
//countFilters =totalFiltersService.getFiltersValue().size();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//do {
|
|
|
|
|
String viewNameTmp=null;
|
|
|
|
@ -1578,7 +1567,6 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
viewNameTmp=AggregatedServiceUsageRecord.CONSUMER_ID;
|
|
|
|
|
startKeyTmp.add(totalFilters.getIdentifier());
|
|
|
|
|
endKeyTmp.add(totalFilters.getIdentifier());
|
|
|
|
|
//FiltersValue singleFilter=null;
|
|
|
|
|
if (totalFilters instanceof UsageServiceValue){
|
|
|
|
|
//logger.debug("******UsageServiceValue");
|
|
|
|
|
|
|
|
|
@ -1612,28 +1600,13 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
totalFilters.getClz().getSimpleName(),designDocId, viewNameTmp, groupLevelTmp, startKeyTmp, endKeyTmp,temporalStartKey.toString(), temporalEndKey.toString());
|
|
|
|
|
logger.trace("connectionMap:{}",connectionMap.toString());
|
|
|
|
|
ViewQuery query = ViewQuery.from(designDocId, viewNameTmp);
|
|
|
|
|
//if storage
|
|
|
|
|
query.inclusiveEnd();
|
|
|
|
|
/*
|
|
|
|
|
if (designDocId == "QuotaTotal"){
|
|
|
|
|
|
|
|
|
|
query.startKey(endKeyTmp);
|
|
|
|
|
query.endKey(startKeyTmp);
|
|
|
|
|
query.descending(true);
|
|
|
|
|
query.limit(1);
|
|
|
|
|
query.onError(OnError.STOP);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
*/
|
|
|
|
|
query.groupLevel(groupLevelTmp);
|
|
|
|
|
query.startKey(startKeyTmp);
|
|
|
|
|
query.endKey(endKeyTmp);
|
|
|
|
|
query.descending(false);
|
|
|
|
|
query.onError(OnError.STOP);
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
logger.trace("query row:{}",query.toString());
|
|
|
|
|
query.groupLevel(groupLevelTmp);
|
|
|
|
|
query.startKey(startKeyTmp);
|
|
|
|
|
query.endKey(endKeyTmp);
|
|
|
|
|
query.descending(false);
|
|
|
|
|
query.onError(OnError.STOP);
|
|
|
|
|
logger.trace("query row:{}",query.toString());
|
|
|
|
|
ViewResult viewResult;
|
|
|
|
|
try {
|
|
|
|
|
viewResult = connectionMap.get(totalFilters.getClz().getSimpleName()).query(query);
|
|
|
|
@ -1822,6 +1795,9 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
if (temporalConstraint.getAggregationMode().equals(AggregationMode.MONTHLY)){
|
|
|
|
|
groupLevel= 4;
|
|
|
|
|
}
|
|
|
|
|
if (temporalConstraint.getAggregationMode().equals(AggregationMode.YEARLY)){
|
|
|
|
|
groupLevel= 3;
|
|
|
|
|
}
|
|
|
|
|
viewName= temporalConstraint.getAggregationMode().name().toLowerCase();
|
|
|
|
|
|
|
|
|
|
if (filters != null && filters.size() != 0) {
|
|
|
|
@ -1940,9 +1916,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//logger.trace("return map:{}",map.toString());
|
|
|
|
|
logger.trace("return ret:{}",ret.toString());
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|