|
|
|
@ -387,11 +387,13 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
protected SortedMap<Calendar, Info> mapReduceQuery(
|
|
|
|
|
Class<? extends AggregatedRecord<?, ?>> clz,
|
|
|
|
|
TemporalConstraint temporalConstraint, List<Filter> filters)
|
|
|
|
|
TemporalConstraint temporalConstraint, List<Filter> filters,String context)
|
|
|
|
|
throws Exception {
|
|
|
|
|
|
|
|
|
|
String currentScope = ScopeProvider.instance.get();
|
|
|
|
|
|
|
|
|
|
String currentScope=null;
|
|
|
|
|
if (context==null)
|
|
|
|
|
currentScope = ScopeProvider.instance.get();
|
|
|
|
|
else
|
|
|
|
|
currentScope = context;
|
|
|
|
|
JsonArray startKey = JsonArray.create();
|
|
|
|
|
startKey.add(currentScope);
|
|
|
|
|
JsonArray endKey = JsonArray.create();
|
|
|
|
@ -463,8 +465,9 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String designDocId = getDesignDocId(clz);
|
|
|
|
|
//ADD A SPECIFY DESIGN DOC FAMILY
|
|
|
|
|
String designDocIdNew = getDesignDocIdSpecific(clz,keys);
|
|
|
|
|
|
|
|
|
|
logger.trace("designDocIdNew :{}",designDocIdNew);
|
|
|
|
|
for (Object temporal: temporalStartKey.toList()){
|
|
|
|
|
if (!temporal.toString().isEmpty())
|
|
|
|
|
startKey.add(temporal);
|
|
|
|
@ -553,16 +556,21 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
return infos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SortedMap<Calendar, Info> getTimeSeries(
|
|
|
|
|
Class<? extends AggregatedRecord<?, ?>> clz,
|
|
|
|
|
TemporalConstraint temporalConstraint, List<Filter> filters)
|
|
|
|
|
throws Exception {
|
|
|
|
|
|
|
|
|
|
SortedMap<Calendar, Info> map = mapReduceQuery(clz, temporalConstraint, filters);
|
|
|
|
|
SortedMap<Calendar, Info> map = mapReduceQuery(clz, temporalConstraint, filters,null);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(
|
|
|
|
|
Class<? extends AggregatedRecord<?, ?>> clz,
|
|
|
|
@ -590,7 +598,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
for(NumberedFilter nf : top){
|
|
|
|
|
filters.add(nf);
|
|
|
|
|
SortedMap<Calendar, Info> map =
|
|
|
|
|
mapReduceQuery(clz, temporalConstraint, filters);
|
|
|
|
|
mapReduceQuery(clz, temporalConstraint, filters,null);
|
|
|
|
|
ret.put(nf, map);
|
|
|
|
|
|
|
|
|
|
filters.remove(nf);
|
|
|
|
@ -599,6 +607,30 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SortedMap<Filter, SortedMap<Calendar, Info>> getContextTimeSeries(
|
|
|
|
|
Class<? extends AggregatedRecord<?, ?>> clz,
|
|
|
|
|
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
|
|
|
|
|
throws Exception {
|
|
|
|
|
logger.trace("getContextTimeSeries");
|
|
|
|
|
SortedSet<Filter> listContexts = new TreeSet();
|
|
|
|
|
for (String context:contexts){
|
|
|
|
|
Filter contextLabel= new Filter("context",context);
|
|
|
|
|
listContexts.add(contextLabel);
|
|
|
|
|
}
|
|
|
|
|
SortedMap<Filter, SortedMap<Calendar, Info>> ret = new TreeMap<>();
|
|
|
|
|
|
|
|
|
|
for(Filter nf : listContexts){
|
|
|
|
|
//filters.add(nf);
|
|
|
|
|
logger.debug("detail time series :{}",nf.toString());
|
|
|
|
|
SortedMap<Calendar, Info> map =
|
|
|
|
|
mapReduceQuery(clz, temporalConstraint, filters,nf.getValue());
|
|
|
|
|
ret.put(nf, map);
|
|
|
|
|
filters.remove(nf);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getQualifiedProperty(String property){
|
|
|
|
|
//DEVELOPING
|
|
|
|
@ -769,9 +801,9 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
int scopeDateGroupLevel = 2;
|
|
|
|
|
int groupLevel = scopeDateGroupLevel;
|
|
|
|
|
|
|
|
|
|
//NO ADD A SPECIFIY DESIGN DOC ID FAMILY
|
|
|
|
|
String designDocId = getDesignDocId(clz)+"Value";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String viewName = key;
|
|
|
|
|
logger.trace("designDocId:{} view:{} ",designDocId,key);
|
|
|
|
|
logger.trace("startKey:{}",startKey);
|
|
|
|
@ -875,7 +907,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
int groupLevel = scopeDateGroupLevel;
|
|
|
|
|
|
|
|
|
|
String designDocId = getDesignDocId(clz);
|
|
|
|
|
|
|
|
|
|
//ADD A SPECIFIY DESIGN DOC ID FAMILY
|
|
|
|
|
String viewName = applicant.getKey();
|
|
|
|
|
|
|
|
|
|
ViewQuery query = ViewQuery.from(designDocId, viewName);
|
|
|
|
@ -946,7 +978,7 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
aggregationMode, false, false);
|
|
|
|
|
|
|
|
|
|
String designDocId = getDesignDocId(clz);
|
|
|
|
|
|
|
|
|
|
//ADD A SPECIFIY DESIGN DOC ID FAMILY
|
|
|
|
|
for (Filters singleFilter:filterPackageQuota){
|
|
|
|
|
String viewNameTmp=null;
|
|
|
|
|
|
|
|
|
@ -1084,6 +1116,8 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
aggregationMode, false, false);
|
|
|
|
|
|
|
|
|
|
String designDocId = getDesignDocId(clz);
|
|
|
|
|
//ADD A SPECIFIC DESIGN DOC ID FAMILY
|
|
|
|
|
|
|
|
|
|
for (TotalFilters totalfilters:listUsage){
|
|
|
|
|
|
|
|
|
|
Double totalQuota=0.00;
|
|
|
|
@ -1214,4 +1248,6 @@ AccountingPersistenceBackendQuery {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|