if (metadata.isVirtualModel(modelID)){
return false;
}
// Find capabilities
SourceCapabilities caps = getCapabilities(modelID, metadata, capFinder);
// Check particular function
Type func = aggregate.getAggregateFunction();
switch (func) {
case COUNT:
if(aggregate.getExpression() == null) {
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_COUNT_STAR)) {
return false;
}
} else {
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_COUNT)) {
return false;
}
}
break;
case SUM:
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_SUM)) {
return false;
}
break;
case AVG:
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_AVG)) {
return false;
}
break;
case MIN:
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_MIN)) {
return false;
}
break;
case MAX:
if(! caps.supportsCapability(Capability.QUERY_AGGREGATES_MAX)) {
return false;
}
break;
default:
if (aggregate.isEnhancedNumeric()) {
if (!caps.supportsCapability(Capability.QUERY_AGGREGATES_ENHANCED_NUMERIC)) {
return false;
}
} else {
return false;
}
break;
}
// Check DISTINCT if necessary
if(aggregate.isDistinct() && ! caps.supportsCapability(Capability.QUERY_AGGREGATES_DISTINCT)) {
return false;
}
// Passed all the checks!
return true;