Author: tmortagne
Date: 2007-10-29 14:54:09 +0100 (Mon, 29 Oct 2007)
New Revision: 5540

Modified:
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/exo/ExoGroupServiceImpl.java
   
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
Log:
XWIKI-1826:
- Remove useless "int nb, int start" parameters from count methods

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
    2007-10-29 13:54:04 UTC (rev 5539)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
    2007-10-29 13:54:09 UTC (rev 5540)
@@ -379,10 +379,10 @@
     {
         if (user) {
             return 
context.getWiki().getGroupService(context).countAllMatchedUsers(matchFields,
-                0, 0, context);
+                context);
         } else {
             return 
context.getWiki().getGroupService(context).countAllMatchedUsers(matchFields,
-                0, 0, context);
+                context);
         }
     }
 

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
    2007-10-29 13:54:04 UTC (rev 5539)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
    2007-10-29 13:54:09 UTC (rev 5540)
@@ -142,15 +142,12 @@
      *            document field</li>
      *            <li>pattern matching : based on HQL "like" command</li>
      *            </ul>.
-     * @param nb the maximum number of result to return.
-     * @param start the index of the first found user to return.
      * @param context the [EMAIL PROTECTED] XWikiContext}.
      * @return the of found users.
      * @throws XWikiException error when getting number of users.
      * @since XWiki Core 1.1.2, XWiki Core 1.2M2
      */
-    int countAllMatchedUsers(Object[][] matchFields, int nb, int start, 
XWikiContext context)
-        throws XWikiException;
+    int countAllMatchedUsers(Object[][] matchFields, XWikiContext context) 
throws XWikiException;
 
     /**
      * Return number of groups with provided constraints.
@@ -162,15 +159,12 @@
      *            document field</li>
      *            <li>pattern matching : based on HQL "like" command</li>
      *            </ul>.
-     * @param nb the maximum number of result to return.
-     * @param start the index of the first found user to return.
      * @param context the [EMAIL PROTECTED] XWikiContext}.
      * @return the of found groups.
      * @throws XWikiException error when getting number of groups.
      * @since XWiki Core 1.1.2, XWiki Core 1.2M2
      */
-    int countAllMatchedGroups(Object[][] matchFields, int nb, int start, 
XWikiContext context)
-        throws XWikiException;
+    int countAllMatchedGroups(Object[][] matchFields, XWikiContext context) 
throws XWikiException;
 
     /**
      * Get all groups containing provided member.

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/exo/ExoGroupServiceImpl.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/exo/ExoGroupServiceImpl.java
     2007-10-29 13:54:04 UTC (rev 5539)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/exo/ExoGroupServiceImpl.java
     2007-10-29 13:54:09 UTC (rev 5540)
@@ -1,306 +1,306 @@
-/*
- * See the NOTICE file distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- *
- */
-
-package com.xpn.xwiki.user.impl.exo;
-
-import com.xpn.xwiki.XWiki;
-import com.xpn.xwiki.XWikiContext;
-import com.xpn.xwiki.XWikiException;
-import com.xpn.xwiki.user.api.XWikiGroupService;
-import com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl;
-
-import org.apache.commons.lang.NotImplementedException;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.services.organization.*;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-public class ExoGroupServiceImpl extends XWikiGroupServiceImpl implements 
XWikiGroupService
-{
-    private static OrganizationService organizationService;
-
-    public void init(XWiki xwiki, XWikiContext context) throws XWikiException
-    {
-        super.init(xwiki, context);
-    }
-
-    protected GroupHandler getGroupHandler()
-    {
-        if (organizationService == null) {
-            organizationService = getOrganizationService();
-        }
-        return organizationService.getGroupHandler();
-    }
-
-    public static OrganizationService getOrganizationService()
-    {
-        if (organizationService == null) {
-            PortalContainer manager = PortalContainer.getInstance();
-            organizationService =
-                (OrganizationService) manager
-                    .getComponentInstanceOfType(OrganizationService.class);
-        }
-        return organizationService;
-    }
-
-    protected UserHandler getUserHandler()
-    {
-        if (organizationService == null) {
-            organizationService = getOrganizationService();
-        }
-        return organizationService.getUserHandler();
-    }
-
-    protected MembershipHandler getMembershipHandler()
-    {
-        if (organizationService == null) {
-            organizationService = getOrganizationService();
-        }
-        return organizationService.getMembershipHandler();
-    }
-
-    protected MembershipTypeHandler getMembershipTypeHandler()
-    {
-        if (organizationService == null) {
-            organizationService = getOrganizationService();
-        }
-        return organizationService.getMembershipTypeHandler();
-    }
-
-    public Collection listGroupsForUser(String username, XWikiContext context)
-        throws XWikiException
-    {
-        GroupHandler groupHandler = getGroupHandler();
-        Collection groups = null;
-        try {
-            if (username.startsWith("XWiki.")) {
-                username = username.substring(6);
-                groups = groupHandler.findGroupsOfUser(username);
-            }
-
-            ArrayList list = new ArrayList();
-            if (groups == null)
-                return list;
-            Iterator it = groups.iterator();
-            while (it.hasNext()) {
-                Group group = (Group) it.next();
-                list.add(group.getGroupName());
-            }
-            return list;
-        } catch (Exception e) {
-            Object[] args = {username};
-            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
-                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_LISTING_USERS,
-                "Exception while listing groups for user {0}",
-                e,
-                args);
-
-        }
-    }
-
-    public void addUserToGroup(String user, String database, String group, 
XWikiContext context)
-        throws XWikiException
-    {
-        // TODO: test this code
-        MembershipHandler membershipHandler = getMembershipHandler();
-        MembershipTypeHandler memberShipTypeHandler = 
getMembershipTypeHandler();
-        boolean broadcast = false;
-        Collection list = null;
-        // check user and group exist membership
-        try {
-            list = membershipHandler.findMembershipsByUserAndGroup(user, 
group);
-            // size = 0 -----> user and group does not exist membership
-            if (list.size() == 0) {
-                broadcast = true;
-            }
-
-            // link membership
-            MembershipType mst = 
memberShipTypeHandler.findMembershipType(group);
-            if (mst == null) {
-                mst = memberShipTypeHandler.createMembershipTypeInstance();
-            }
-            User username = getUserHandler().findUserByName(user);
-            Group groupname = getGroupHandler().findGroupById(group);
-            membershipHandler.linkMembership(username, groupname, mst, 
broadcast);
-            super.addUserToGroup(user, database, group, context);
-        } catch (Exception e) {
-            Object[] args = {user, group};
-            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
-                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_ADDING_USERS,
-                "Exception while adding user {0} to group {1}",
-                e,
-                args);
-        }
-    }
-
-    public List listMemberForGroup(String group, XWikiContext context) throws 
XWikiException
-    {
-        UserHandler userHandler = getUserHandler();
-
-        List usersList = new ArrayList();
-        List exoList = null;
-
-        try {
-            if (group == null) {
-                PageList plist = null;
-                plist = userHandler.getUserPageList(100);
-                exoList = plist.getAll();
-            } else
-                exoList = userHandler.findUsersByGroup(group).getAll();
-
-            if (exoList != null) {
-                for (int i = 0; i < exoList.size(); i++) {
-                    User user = (User) exoList.get(i);
-                    usersList.add(user.getUserName());
-                }
-            }
-            return usersList;
-        } catch (Exception e) {
-            Object[] args = {group};
-            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
-                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_USERS,
-                "Exception while listing users for group {0}",
-                e,
-                args);
-        }
-    }
-
-    public List listAllGroups(XWikiContext context) throws XWikiException
-    {
-        GroupHandler handlerGroup = getGroupHandler();
-        List allGroups = new ArrayList();
-        List exoGroups = null;
-        try {
-            exoGroups = (List) handlerGroup.getAllGroups();
-
-            if (exoGroups != null) {
-                for (int i = 0; i < exoGroups.size(); i++) {
-                    Group group = (Group) exoGroups.get(i);
-                    allGroups.add(group.getId());
-                }
-            }
-            return allGroups;
-        } catch (Exception e) {
-            Object[] args = {};
-            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
-                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_USERS,
-                "Exception while listing groups",
-                e,
-                args);
-        }
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#getAllMatchedUsers(java.lang.Object[][],
-     *      boolean, int, int, java.lang.Object[][], 
com.xpn.xwiki.XWikiContext) TODO: fully
-     *      implements this method.
-     */
-    public List getAllMatchedUsers(Object[][] matchFields, boolean 
withdetails, int nb,
-        int start, Object[][] order, XWikiContext context) throws 
XWikiException
-    {
-        if ((matchFields != null && matchFields.length > 0) || withdetails
-            || (order != null && order.length > 0)) {
-            throw new NotImplementedException();
-        }
-
-        List usersList = listMemberForGroup(null, context);
-
-        if (nb > 0 || start > 0) {
-            int fromIndex = start < 0 ? 0 : start;
-            int toIndex = fromIndex + (nb <= 0 ? usersList.size() - 1 : nb);
-
-            usersList = usersList.subList(fromIndex, toIndex);
-        }
-
-        return usersList;
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#getAllMatchedGroups(java.lang.Object[][],
-     *      boolean, int, int, java.lang.Object[][], 
com.xpn.xwiki.XWikiContext)
-     */
-    public List getAllMatchedGroups(Object[][] matchFields, boolean 
withdetails, int nb,
-        int start, Object[][] order, XWikiContext context) throws 
XWikiException
-    {
-        // TODO : fully implement this methods for eXo platform
-
-        if ((matchFields != null && matchFields.length > 0) || withdetails
-            || (order != null && order.length > 0)) {
-            throw new NotImplementedException();
-        }
-
-        List groupList = listAllGroups(context);
-
-        if (nb > 0 || start > 0) {
-            int fromIndex = start < 0 ? 0 : start;
-            int toIndex = fromIndex + (nb <= 0 ? groupList.size() - 1 : nb);
-
-            groupList = groupList.subList(fromIndex, toIndex);
-        }
-
-        return groupList;
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#countAllMatchedUsers(java.lang.Object[][],
-     *      int, int, com.xpn.xwiki.XWikiContext)
-     */
-    public int countAllMatchedUsers(Object[][] matchFields, int nb, int start,
-        XWikiContext context) throws XWikiException
-    {
-        return getAllMatchedGroups(matchFields, false, nb, start, null, 
context).size();
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#countAllMatchedGroups(java.lang.Object[][],
-     *      int, int, com.xpn.xwiki.XWikiContext)
-     */
-    public int countAllMatchedGroups(Object[][] matchFields, int nb, int start,
-        XWikiContext context) throws XWikiException
-    {
-        return getAllMatchedUsers(matchFields, false, nb, start, null, 
context).size();
-    }
-
-    /**
-     * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#removeUserOrGroupFromAllGroups(java.lang.String,
-     *      java.lang.String, java.lang.String, com.xpn.xwiki.XWikiContext) 
TODO: fully implements
-     *      this method.
-     */
-    public void removeUserOrGroupFromAllGroups(String memberWiki, String 
memberSpace,
-        String memberName, XWikiContext context) throws XWikiException
-    {
-        throw new NotImplementedException();
-    }
-}
+/*
+ * Copyright 2006-2007, XpertNet SARL, and individual contributors as indicated
+ * by the contributors.txt.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+
+package com.xpn.xwiki.user.impl.exo;
+
+import com.xpn.xwiki.XWiki;
+import com.xpn.xwiki.XWikiContext;
+import com.xpn.xwiki.XWikiException;
+import com.xpn.xwiki.user.api.XWikiGroupService;
+import com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.services.organization.*;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+public class ExoGroupServiceImpl extends XWikiGroupServiceImpl implements 
XWikiGroupService
+{
+    private static OrganizationService organizationService;
+
+    public void init(XWiki xwiki, XWikiContext context) throws XWikiException
+    {
+        super.init(xwiki, context);
+    }
+
+    protected GroupHandler getGroupHandler()
+    {
+        if (organizationService == null) {
+            organizationService = getOrganizationService();
+        }
+        return organizationService.getGroupHandler();
+    }
+
+    public static OrganizationService getOrganizationService()
+    {
+        if (organizationService == null) {
+            PortalContainer manager = PortalContainer.getInstance();
+            organizationService =
+                (OrganizationService) manager
+                    .getComponentInstanceOfType(OrganizationService.class);
+        }
+        return organizationService;
+    }
+
+    protected UserHandler getUserHandler()
+    {
+        if (organizationService == null) {
+            organizationService = getOrganizationService();
+        }
+        return organizationService.getUserHandler();
+    }
+
+    protected MembershipHandler getMembershipHandler()
+    {
+        if (organizationService == null) {
+            organizationService = getOrganizationService();
+        }
+        return organizationService.getMembershipHandler();
+    }
+
+    protected MembershipTypeHandler getMembershipTypeHandler()
+    {
+        if (organizationService == null) {
+            organizationService = getOrganizationService();
+        }
+        return organizationService.getMembershipTypeHandler();
+    }
+
+    public Collection listGroupsForUser(String username, XWikiContext context)
+        throws XWikiException
+    {
+        GroupHandler groupHandler = getGroupHandler();
+        Collection groups = null;
+        try {
+            if (username.startsWith("XWiki.")) {
+                username = username.substring(6);
+                groups = groupHandler.findGroupsOfUser(username);
+            }
+
+            ArrayList list = new ArrayList();
+            if (groups == null)
+                return list;
+            Iterator it = groups.iterator();
+            while (it.hasNext()) {
+                Group group = (Group) it.next();
+                list.add(group.getGroupName());
+            }
+            return list;
+        } catch (Exception e) {
+            Object[] args = {username};
+            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
+                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_LISTING_USERS,
+                "Exception while listing groups for user {0}",
+                e,
+                args);
+
+        }
+    }
+
+    public void addUserToGroup(String user, String database, String group, 
XWikiContext context)
+        throws XWikiException
+    {
+        // TODO: test this code
+        MembershipHandler membershipHandler = getMembershipHandler();
+        MembershipTypeHandler memberShipTypeHandler = 
getMembershipTypeHandler();
+        boolean broadcast = false;
+        Collection list = null;
+        // check user and group exist membership
+        try {
+            list = membershipHandler.findMembershipsByUserAndGroup(user, 
group);
+            // size = 0 -----> user and group does not exist membership
+            if (list.size() == 0) {
+                broadcast = true;
+            }
+
+            // link membership
+            MembershipType mst = 
memberShipTypeHandler.findMembershipType(group);
+            if (mst == null) {
+                mst = memberShipTypeHandler.createMembershipTypeInstance();
+            }
+            User username = getUserHandler().findUserByName(user);
+            Group groupname = getGroupHandler().findGroupById(group);
+            membershipHandler.linkMembership(username, groupname, mst, 
broadcast);
+            super.addUserToGroup(user, database, group, context);
+        } catch (Exception e) {
+            Object[] args = {user, group};
+            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
+                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_ADDING_USERS,
+                "Exception while adding user {0} to group {1}",
+                e,
+                args);
+        }
+    }
+
+    public List listMemberForGroup(String group, XWikiContext context) throws 
XWikiException
+    {
+        UserHandler userHandler = getUserHandler();
+
+        List usersList = new ArrayList();
+        List exoList = null;
+
+        try {
+            if (group == null) {
+                PageList plist = null;
+                plist = userHandler.getUserPageList(100);
+                exoList = plist.getAll();
+            } else
+                exoList = userHandler.findUsersByGroup(group).getAll();
+
+            if (exoList != null) {
+                for (int i = 0; i < exoList.size(); i++) {
+                    User user = (User) exoList.get(i);
+                    usersList.add(user.getUserName());
+                }
+            }
+            return usersList;
+        } catch (Exception e) {
+            Object[] args = {group};
+            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
+                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_USERS,
+                "Exception while listing users for group {0}",
+                e,
+                args);
+        }
+    }
+
+    public List listAllGroups(XWikiContext context) throws XWikiException
+    {
+        GroupHandler handlerGroup = getGroupHandler();
+        List allGroups = new ArrayList();
+        List exoGroups = null;
+        try {
+            exoGroups = (List) handlerGroup.getAllGroups();
+
+            if (exoGroups != null) {
+                for (int i = 0; i < exoGroups.size(); i++) {
+                    Group group = (Group) exoGroups.get(i);
+                    allGroups.add(group.getId());
+                }
+            }
+            return allGroups;
+        } catch (Exception e) {
+            Object[] args = {};
+            throw new XWikiException(XWikiException.MODULE_XWIKI_ACCESS,
+                XWikiException.ERROR_XWIKI_ACCESS_EXO_EXCEPTION_USERS,
+                "Exception while listing groups",
+                e,
+                args);
+        }
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#getAllMatchedUsers(java.lang.Object[][],
+     *      boolean, int, int, java.lang.Object[][], 
com.xpn.xwiki.XWikiContext) TODO: fully
+     *      implements this method.
+     */
+    public List getAllMatchedUsers(Object[][] matchFields, boolean 
withdetails, int nb,
+        int start, Object[][] order, XWikiContext context) throws 
XWikiException
+    {
+        if ((matchFields != null && matchFields.length > 0) || withdetails
+            || (order != null && order.length > 0)) {
+            throw new NotImplementedException();
+        }
+
+        List usersList = listMemberForGroup(null, context);
+
+        if (nb > 0 || start > 0) {
+            int fromIndex = start < 0 ? 0 : start;
+            int toIndex = fromIndex + (nb <= 0 ? usersList.size() - 1 : nb);
+
+            usersList = usersList.subList(fromIndex, toIndex);
+        }
+
+        return usersList;
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#getAllMatchedGroups(java.lang.Object[][],
+     *      boolean, int, int, java.lang.Object[][], 
com.xpn.xwiki.XWikiContext)
+     */
+    public List getAllMatchedGroups(Object[][] matchFields, boolean 
withdetails, int nb,
+        int start, Object[][] order, XWikiContext context) throws 
XWikiException
+    {
+        // TODO : fully implement this methods for eXo platform
+
+        if ((matchFields != null && matchFields.length > 0) || withdetails
+            || (order != null && order.length > 0)) {
+            throw new NotImplementedException();
+        }
+
+        List groupList = listAllGroups(context);
+
+        if (nb > 0 || start > 0) {
+            int fromIndex = start < 0 ? 0 : start;
+            int toIndex = fromIndex + (nb <= 0 ? groupList.size() - 1 : nb);
+
+            groupList = groupList.subList(fromIndex, toIndex);
+        }
+
+        return groupList;
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#countAllMatchedUsers(java.lang.Object[][],
+     *      com.xpn.xwiki.XWikiContext)
+     */
+    public int countAllMatchedUsers(Object[][] matchFields, XWikiContext 
context)
+        throws XWikiException
+    {
+        return getAllMatchedGroups(matchFields, false, 0, 0, null, 
context).size();
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#countAllMatchedGroups(java.lang.Object[][],
+     *      com.xpn.xwiki.XWikiContext)
+     */
+    public int countAllMatchedGroups(Object[][] matchFields, XWikiContext 
context)
+        throws XWikiException
+    {
+        return getAllMatchedUsers(matchFields, false, 0, 0, null, 
context).size();
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.impl.xwiki.XWikiGroupServiceImpl#removeUserOrGroupFromAllGroups(java.lang.String,
+     *      java.lang.String, java.lang.String, com.xpn.xwiki.XWikiContext) 
TODO: fully implements
+     *      this method.
+     */
+    public void removeUserOrGroupFromAllGroups(String memberWiki, String 
memberSpace,
+        String memberName, XWikiContext context) throws XWikiException
+    {
+        throw new NotImplementedException();
+    }
+}

Modified: 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
===================================================================
--- 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
 2007-10-29 13:54:04 UTC (rev 5539)
+++ 
xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
 2007-10-29 13:54:09 UTC (rev 5540)
@@ -628,8 +628,8 @@
      * @throws XWikiException error when calling for
      *             [EMAIL PROTECTED] XWikiStoreInterface#search(String, int, 
int, List, XWikiContext)}
      */
-    protected int countAllMatchedUsersOrGroups(boolean user, Object[][] 
matchFields, int nb,
-        int start, XWikiContext context) throws XWikiException
+    protected int countAllMatchedUsersOrGroups(boolean user, Object[][] 
matchFields,
+        XWikiContext context) throws XWikiException
     {
         String documentClass = user ? CLASS_SUFFIX_XWIKIUSERS : 
CLASS_SUFFIX_XWIKIGROUPS;
 
@@ -638,7 +638,7 @@
 
         String sql = "select count(doc) from XWikiDocument doc" + where;
 
-        List list = context.getWiki().getStore().search(sql, nb, start, 
parameterValues, context);
+        List list = context.getWiki().getStore().search(sql, 0, 0, 
parameterValues, context);
 
         if (list == null || list.size() == 0)
             return 0;
@@ -649,25 +649,24 @@
     /**
      * [EMAIL PROTECTED]
      * 
-     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMatchedUsers(java.lang.Object[][],
 int,
-     *      int, com.xpn.xwiki.XWikiContext)
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMatchedUsers(java.lang.Object[][],
+     *      com.xpn.xwiki.XWikiContext)
      */
-    public int countAllMatchedUsers(Object[][] matchFields, int nb, int start,
-        XWikiContext context) throws XWikiException
+    public int countAllMatchedUsers(Object[][] matchFields, XWikiContext 
context)
+        throws XWikiException
     {
-        return countAllMatchedUsersOrGroups(true, matchFields, nb, start, 
context);
+        return countAllMatchedUsersOrGroups(true, matchFields, context);
     }
 
     /**
      * [EMAIL PROTECTED]
-     * 
-     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMatchedGroups(java.lang.Object[][],
-     *      int, int, com.xpn.xwiki.XWikiContext)
+     *
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMatchedGroups(java.lang.Object[][],
 com.xpn.xwiki.XWikiContext)
      */
-    public int countAllMatchedGroups(Object[][] matchFields, int nb, int start,
-        XWikiContext context) throws XWikiException
+    public int countAllMatchedGroups(Object[][] matchFields, XWikiContext 
context)
+        throws XWikiException
     {
-        return countAllMatchedUsersOrGroups(false, matchFields, nb, start, 
context);
+        return countAllMatchedUsersOrGroups(false, matchFields, context);
     }
 
     /**
@@ -679,7 +678,7 @@
     public Collection getAllGroupsNamesForMember(String member, int nb, int 
start,
         XWikiContext context) throws XWikiException
     {
-        //TODO: improve using real request
+        // TODO: improve using real request
         List groupNameList = new ArrayList(listGroupsForUser(member, context));
 
         if (start <= 0 & (nb <= 0 || nb >= groupNameList.size()))
@@ -703,7 +702,7 @@
     public Collection getAllMembersNamesForGroup(String group, int nb, int 
start,
         XWikiContext context) throws XWikiException
     {
-        //TODO: improve using real request
+        // TODO: improve using real request
         List userNameList = listMemberForGroup(group, context);
 
         if (nb == 0 && start == 0)
@@ -714,27 +713,36 @@
         else
             return userNameList.subList(start, start + nb);
     }
-    
+
     /**
      * [EMAIL PROTECTED]
-     *
-     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllGroupsNamesForMember(java.lang.String,
 com.xpn.xwiki.XWikiContext)
-     * TODO: improve using real request
+     * 
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllGroupsNamesForMember(java.lang.String,
+     *      com.xpn.xwiki.XWikiContext)
      */
-    public int countAllGroupsNamesForMember(String member, XWikiContext 
context) throws XWikiException
+    public int countAllGroupsNamesForMember(String member, XWikiContext 
context)
+        throws XWikiException
     {
-        //TODO: improve using real request
+        if (member == null)
+            return countAllMatchedGroups(null, context);
+
+        // TODO: improve using real request
         return getAllGroupsNamesForMember(member, 0, 0, context).size();
     }
-    
+
     /**
      * [EMAIL PROTECTED]
-     *
-     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMembersNamesForGroup(java.lang.String,
 com.xpn.xwiki.XWikiContext)
+     * 
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#countAllMembersNamesForGroup(java.lang.String,
+     *      com.xpn.xwiki.XWikiContext)
      */
-    public int countAllMembersNamesForGroup(String group, XWikiContext 
context) throws XWikiException
+    public int countAllMembersNamesForGroup(String group, XWikiContext context)
+        throws XWikiException
     {
-        //TODO: improve using real request
+        if (group == null)
+            return countAllMatchedUsers(null, context);
+        
+        // TODO: improve using real request
         return getAllMembersNamesForGroup(group, 0, 0, context).size();
     }
 }

_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to