This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git

commit b2f6ab121a13689b038d4fea64e281934ccf873c
Author: Maxim Solodovnik <solomax...@gmail.com>
AuthorDate: Thu Apr 12 23:46:03 2018 +0700

    [OPENMEETINGS-1864] admin users count is fixed
---
 .../apache/openmeetings/db/dao/user/UserDao.java    | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java
index fea0529..fe8cd60 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/user/UserDao.java
@@ -194,6 +194,14 @@ public class UserDao implements 
IGroupAdminDataProviderDao<User> {
                return q.getResultList();
        }
 
+       private long count(String search, boolean filterContacts, Long 
currentUserId, boolean filterDeleted) {
+               Map<String, Object> params = new HashMap<>();
+               TypedQuery<Long> q = 
em.createQuery(DaoHelper.getSearchQuery("User", "u", 
getAdditionalJoin(filterContacts), search, true, filterDeleted, true
+                               , getAdditionalWhere(filterContacts, 
currentUserId, params), null, searchFields), Long.class);
+               setAdditionalParams(q, params);
+               return q.getSingleResult();
+       }
+
        @Override
        public long count() {
                // get all users
@@ -211,16 +219,17 @@ public class UserDao implements 
IGroupAdminDataProviderDao<User> {
        }
 
        public long count(String search, boolean filterContacts, Long 
currentUserId) {
-               Map<String, Object> params = new HashMap<>();
-               TypedQuery<Long> q = 
em.createQuery(DaoHelper.getSearchQuery("User", "u", 
getAdditionalJoin(filterContacts), search, true, true, true
-                               , getAdditionalWhere(filterContacts, 
currentUserId, params), null, searchFields), Long.class);
-               setAdditionalParams(q, params);
-               return q.getSingleResult();
+               return count(search, filterContacts, currentUserId, true);
+       }
+
+       @Override
+       public long adminCount(String search) {
+               return count(search, false, Long.valueOf(-1), false);
        }
 
        @Override
        public long adminCount(String search, Long adminId) {
-               TypedQuery<Long> q = 
em.createQuery(DaoHelper.getSearchQuery("GroupUser gu, IN(gu.user)", "u", null, 
search, true, true, true
+               TypedQuery<Long> q = 
em.createQuery(DaoHelper.getSearchQuery("GroupUser gu, IN(gu.user)", "u", null, 
search, true, false, true
                                , "gu.group.id IN (SELECT gu1.group.id FROM 
GroupUser gu1 WHERE gu1.moderator = true AND gu1.user.id = :adminId)", null, 
searchFields), Long.class);
                q.setParameter("adminId", adminId);
                return q.getSingleResult();

-- 
To stop receiving notification emails like this one, please contact
solo...@apache.org.

Reply via email to