use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectSearchStrategyType in project midpoint by Evolveum.
the class AbstractSearchExpressionEvaluator method executeSearchUsingCache.
private <O extends ObjectType> List<V> executeSearchUsingCache(Class<O> targetTypeClass, final QName targetTypeQName, ObjectQuery query, List<ItemDelta<V, D>> additionalAttributeDeltas, final ExpressionEvaluationContext params, String contextDescription, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
ObjectSearchStrategyType searchStrategy = getSearchStrategy();
AbstractSearchExpressionEvaluatorCache cache = getCache();
if (cache == null) {
return executeSearch(null, targetTypeClass, targetTypeQName, query, searchStrategy, additionalAttributeDeltas, params, contextDescription, task, result);
}
List<V> list = cache.getQueryResult(targetTypeClass, query, searchStrategy, params, prismContext);
if (list != null) {
LOGGER.trace("Cache: HIT {} ({})", query, targetTypeClass.getSimpleName());
return CloneUtil.clone(list);
}
LOGGER.trace("Cache: MISS {} ({})", query, targetTypeClass.getSimpleName());
List<PrismObject> rawResult = new ArrayList<>();
list = executeSearch(rawResult, targetTypeClass, targetTypeQName, query, searchStrategy, additionalAttributeDeltas, params, contextDescription, task, result);
if (list != null && !list.isEmpty()) {
// we don't want to cache negative results (e.g. if used with focal objects it might mean that they would be attempted to create multiple times)
cache.putQueryResult(targetTypeClass, query, searchStrategy, params, list, rawResult, prismContext);
}
return list;
}
Aggregations