diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java index 2163414941c..2ee99520fca 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProcessService.java @@ -1782,7 +1782,8 @@ private List filterForCorrectionSolutionMessages(List * @return amount as Long */ public Long findNumberOfProcessesWithTitle(String title) throws DataException { - return count(createSimpleQuery(ProcessTypeField.TITLE.getKey(), title, true, Operator.AND)); + return countDocumentsAcrossProjects(createSimpleQuery(ProcessTypeField.TITLE.getKey(), title, true, + Operator.AND)); } /** diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java index 87d2488f514..5392cf687af 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/base/ProjectSearchService.java @@ -106,4 +106,15 @@ public List findByQueryInAllProjects(QueryBuilder query, boolean related) thr public Long countDocuments(QueryBuilder query) throws DataException { return super.countDocuments(queryForProjects(query)); } + + /** + * Execute a count query without filtering + * for projects of the current user. + * @param query + * as QueryBuilder object + * @return amount of objects according to given query or 0 if query is null + */ + public Long countDocumentsAcrossProjects(QueryBuilder query) throws DataException { + return super.countDocuments(query); + } }