use of com.evolveum.midpoint.repo.sql.query2.QueryEngine2 in project midpoint by Evolveum.
the class ObjectRetriever method searchObjectsAttempt.
@NotNull
public <T extends ObjectType> SearchResultList<PrismObject<T>> searchObjectsAttempt(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, OperationResult result) throws SchemaException {
LOGGER_PERFORMANCE.debug("> search objects {}", new Object[] { type.getSimpleName() });
Session session = null;
try {
session = baseHelper.beginReadOnlyTransaction();
RQuery rQuery;
QueryEngine2 engine = new QueryEngine2(getConfiguration(), prismContext);
rQuery = engine.interpret(query, type, options, false, session);
List<GetObjectResult> queryResult = rQuery.list();
LOGGER.trace("Found {} objects, translating to JAXB.", queryResult != null ? queryResult.size() : 0);
List<PrismObject<T>> list = queryResultToPrismObjects(queryResult, type, options, session, result);
session.getTransaction().commit();
return new SearchResultList<>(list);
} catch (QueryException | RuntimeException ex) {
baseHelper.handleGeneralException(ex, session, result);
throw new IllegalStateException("shouldn't get here");
} finally {
baseHelper.cleanupSessionAndResult(session, result);
}
}
Aggregations