Skip to content

Commit

Permalink
MID-6234 added distinct option while counting objects
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Apr 29, 2020
1 parent 25b0c35 commit 902c521
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -457,7 +457,10 @@ public static <T extends ObjectType> int countObjects(Class<T> type, ObjectQuery
OperationResult parentResult = new OperationResult(OPERATION_COUNT_OBJECT);
int count = 0;
try {
count = page.getModelService().countObjects(type, query, null, task, parentResult);
Collection<SelectorOptions<GetOperationOptions>> options = page.getOperationOptionsBuilder()
.distinct(true)
.build();
count = page.getModelService().countObjects(type, query, options, task, parentResult);
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException
| ConfigurationException | CommunicationException | ExpressionEvaluationException ex) {
parentResult.recordFatalError(page.createStringResource("WebModelUtils.couldntCountObjects").getString(), ex);
Expand Down

0 comments on commit 902c521

Please sign in to comment.