fix if not exist a view name for query top

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics-persistence-couchbase@144474 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Alessandro Pieve 2017-03-01 13:36:22 +00:00
parent 17493d3169
commit f95e5e0576
2 changed files with 13 additions and 4 deletions

View File

@ -66,6 +66,7 @@ import com.couchbase.client.java.query.dsl.Sort;
import com.couchbase.client.java.query.dsl.path.GroupByPath;
import com.couchbase.client.java.query.dsl.path.OffsetPath;
import com.couchbase.client.java.view.OnError;
import com.couchbase.client.java.view.View;
import com.couchbase.client.java.view.ViewQuery;
import com.couchbase.client.java.view.ViewResult;
import com.couchbase.client.java.view.ViewRow;
@ -871,8 +872,16 @@ AccountingPersistenceBackendQuery {
BucketManager bucketManager = connectionMap.get(clz.getSimpleName()).bucketManager();
//logger.debug("----"+bucketManager.getDesignDocument(designDocId));
if (bucketManager.getDesignDocument(designDocId)!=null){
logger.debug("usingNextPossibleValuesWithMap");
logger.debug("usingNextPossibleValuesWithMap designDocId exist");
for (View view :bucketManager.getDesignDocument(designDocId).views()){
if(view.name()==viewName){
logger.debug("usingNextPossibleValuesWithMap viewname exist");
return true;
}
}
}
else{
logger.debug("usingNextPossibleValuesWithQuery");
@ -890,7 +899,7 @@ AccountingPersistenceBackendQuery {
return false;
}
*/
return true;
return false;
}

View File

@ -336,7 +336,7 @@ public class AccountingPersistenceQueryCouchBaseTest {
List<Filter> filters = new ArrayList<Filter>();
//filters.add(new Filter(AggregatedServiceUsageRecord.SERVICE_CLASS, "Common"));
//filters.add(new Filter(AggregatedServiceUsageRecord.SERVICE_NAME, "IS-Registry"));
//filters.add(new Filter(AggregatedServiceUsageRecord.SERVICE_CLASS, "Common"));
TemporalConstraint temporalConstraint =
new TemporalConstraint(startTime.getTimeInMillis(),
@ -348,7 +348,7 @@ public class AccountingPersistenceQueryCouchBaseTest {
SortedMap<NumberedFilter, SortedMap<Calendar, Info>> set =
accountingPersistenceQueryCouchBase.getTopValues(
clz, temporalConstraint, filters,
AggregatedServiceUsageRecord.CALLERQUALIFIER, null);
AggregatedServiceUsageRecord.CALLED_METHOD, null);
logger.debug("Result final{}", set);