Skip to content

Commit

Permalink
Changed the control on the maximum number of submitted applications
Browse files Browse the repository at this point in the history
  • Loading branch information
mspasiano committed Jul 12, 2023
1 parent 201bd41 commit 206599d
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,23 @@ public long getTotalNumApplication(Session cmisSession, Folder macroCall, Folder
Criteria criteria = CriteriaFactory.createCriteria(JCONONFolderType.JCONON_APPLICATION.queryName());
criteria.addColumn(PropertyIds.OBJECT_ID);
criteria.addColumn(PropertyIds.NAME);
criteria.addColumn(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value());

criteria.add(Restrictions.inTree(macroCall.getId()));
if (userId != null) {
criteria.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_USER.value(), userId));
}
if (statoDomanda != null) {
criteria.add(Restrictions.eq(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value(), statoDomanda));
}
if (application != null) {
criteria.add(Restrictions.ne(PropertyIds.OBJECT_ID, application.getId()));
}
ItemIterable<QueryResult> iterable = criteria.executeQuery(cmisSession, false, cmisSession.getDefaultContext());
return iterable.getTotalNumItems();
return StreamSupport.stream(iterable.spliterator(), false)
.filter(queryResult -> {
if (statoDomanda != null)
return queryResult.getPropertyValueById(JCONONPropertyIds.APPLICATION_STATO_DOMANDA.value()).equals(statoDomanda);
return Boolean.TRUE;
})
.count();
} else {
return 0;
}
Expand Down

0 comments on commit 206599d

Please sign in to comment.