Skip to content

Commit

Permalink
SqaleRepositoryService.java: added basic countObjects implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Feb 16, 2021
1 parent 2e2c249 commit 9a85a68
Showing 1 changed file with 21 additions and 2 deletions.
Expand Up @@ -515,8 +515,27 @@ private void logTraceModifications(@NotNull Collection<? extends ItemDelta<?, ?>
public <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options, OperationResult parentResult)
throws SchemaException {
return 0;
// TODO
Objects.requireNonNull(type, "Object type must not be null.");
Objects.requireNonNull(parentResult, "Operation result must not be null.");

OperationResult operationResult = parentResult.subresult(OP_NAME_PREFIX + "countObjects")
.addQualifier(type.getSimpleName())
.addParam("type", type.getName())
.addParam("query", query)
.build();

try {
var queryContext = SqaleQueryContext.from(type, transformerContext, sqlRepoContext);
return sqlQueryExecutor.count(queryContext, query, options);
} catch (QueryException | RuntimeException e) {
handleGeneralException(e, operationResult);
throw new SystemException(e);
} catch (Throwable t) {
operationResult.recordFatalError(t);
throw t;
} finally {
operationResult.computeStatusIfUnknown();
}
}

@Override
Expand Down

0 comments on commit 9a85a68

Please sign in to comment.