Author: tmortagne
Date: 2007-10-26 14:41:32 +0200 (Fri, 26 Oct 2007)
New Revision: 5516

Modified:
   
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
   
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManagerPluginApi.java
   
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
   
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
Log:
XWIKI-1826: Rename getAllGroupsForUsers and getAllUsersFormGroups in 
getAllGroupsNamesForMembers and getAllMembersNamesForGroups more correct. Also 
add "int nb, int start" parameters to theses methods

Modified: 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
===================================================================
--- 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
     2007-10-26 12:41:28 UTC (rev 5515)
+++ 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManager.java
     2007-10-26 12:41:32 UTC (rev 5516)
@@ -565,29 +565,35 @@
     /**
      * Get all groups containing provided user.
      * 
-     * @param user the name of the user.
+     * @param member the name of the member (user or group).
+     * @param nb the maximum number of result to return.
+     * @param start the index of the first found member to return.
      * @param context the XWiki context.
      * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing group name.
      * @throws XWikiException error when browsing groups.
      */
-    public Collection getAllGroupsForUser(String user, XWikiContext context)
-        throws XWikiException
+    public Collection getAllGroupsNamesForMember(String member, int nb, int 
start,
+        XWikiContext context) throws XWikiException
     {
-        return 
context.getWiki().getGroupService(context).listGroupsForUser(user, context);
+        return 
context.getWiki().getGroupService(context).getAllGroupsNamesForMember(member, 
nb,
+            start, context);
     }
 
     /**
      * Get all users provided group contains.
      * 
      * @param group the name of the group.
+     * @param nb the maximum number of result to return.
+     * @param start the index of the first found user to return.
      * @param context the XWiki context.
      * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing user name.
      * @throws XWikiException error when browsing groups.
      */
-    public Collection getAllUsersForGroup(String group, XWikiContext context)
-        throws XWikiException
+    public Collection getAllMembersNamesForGroup(String group, int nb, int 
start,
+        XWikiContext context) throws XWikiException
     {
-        return 
context.getWiki().getGroupService(context).listMemberForGroup(group, context);
+        return 
context.getWiki().getGroupService(context).getAllMembersNamesForGroup(group, nb,
+            start, context);
     }
 
     // Rights management

Modified: 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManagerPluginApi.java
===================================================================
--- 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManagerPluginApi.java
    2007-10-26 12:41:28 UTC (rev 5515)
+++ 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/rightsmanager/RightsManagerPluginApi.java
    2007-10-26 12:41:32 UTC (rev 5516)
@@ -67,7 +67,7 @@
      * API for managing rights and inheritance.
      */
     private RightsManageRightsApi rightsApi;
-    
+
     /**
      * Create an instance of the Rights Manager plugin user api.
      * 
@@ -77,10 +77,10 @@
     public RightsManagerPluginApi(RightsManagerPlugin plugin, XWikiContext 
context)
     {
         super(plugin, context);
-        
+
         rightsApi = new RightsManageRightsApi(context);
     }
-    
+
     /**
      * @return the API for managing rights and inheritance.
      */
@@ -512,10 +512,10 @@
      * @param nb the maximum number of result to return.
      * @param start the index of the first found group to return.
      * @param order the fields to order from. It is a List containing :
-     *             <ul>
-     *             <li>"field name" for document fields</li>
-     *             <li>or ["filed name", "field type"] for object fields</li>
-     *             </ul>
+     *            <ul>
+     *            <li>"field name" for document fields</li>
+     *            <li>or ["filed name", "field type"] for object fields</li>
+     *            </ul>
      * @return a [EMAIL PROTECTED] List} of [EMAIL PROTECTED] String} 
containing group names.
      * @throws XWikiException error when searching for groups.
      */
@@ -1883,18 +1883,19 @@
     /**
      * Get all groups containing provided user.
      * 
-     * @param user the name of the user.
+     * @param member the name of the member (user or group).
      * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing group name.
      * @throws XWikiException error when browsing groups.
      */
-    public Collection getAllGroupsForUser(String user) throws XWikiException
+    public Collection getAllGroupsNamesForMember(String member) throws 
XWikiException
     {
         Collection userList = Collections.EMPTY_LIST;
 
         try {
-            userList = RightsManager.getInstance().getAllGroupsForUser(user, 
this.context);
+            userList =
+                RightsManager.getInstance().getAllGroupsNamesForMember(member, 
0, 0, this.context);
         } catch (RightsManagerException e) {
-            logError("Try to get all groups containing user " + QUOTE + user + 
QUOTE
+            logError("Try to get all groups containing user " + QUOTE + member 
+ QUOTE
                 + ") users from local wiki", e);
         }
 
@@ -1902,18 +1903,35 @@
     }
 
     /**
-     * Get all users provided group contains.
+     * Get all members (users or groups) provided group contains.
      * 
      * @param group the name of the group.
-     * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing user name.
+     * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing member (user or group) name.
      * @throws XWikiException error when browsing groups.
      */
-    public Collection getAllUsersForGroup(String group) throws XWikiException
+    public Collection getAllMembersNamesForGroup(String group) throws 
XWikiException
     {
+        return getAllMembersNamesForGroup(group, 0, 0);
+    }
+
+    /**
+     * Get all members (users or groups) provided group contains.
+     * 
+     * @param group the name of the group.
+     * @param nb the maximum number of result to return.
+     * @param start the index of the first found user to return.
+     * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing member (user or group) name.
+     * @throws XWikiException error when browsing groups.
+     */
+    public Collection getAllMembersNamesForGroup(String group, int nb, int 
start)
+        throws XWikiException
+    {
         Collection userList = Collections.EMPTY_LIST;
 
         try {
-            userList = RightsManager.getInstance().getAllUsersForGroup(group, 
this.context);
+            userList =
+                RightsManager.getInstance().getAllMembersNamesForGroup(group, 
nb, start,
+                    this.context);
         } catch (RightsManagerException e) {
             logError("Try to get all user group " + QUOTE + group + QUOTE + ") 
contains", e);
         }

Modified: 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
===================================================================
--- 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
     2007-10-26 12:41:28 UTC (rev 5515)
+++ 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/api/XWikiGroupService.java
     2007-10-26 12:41:32 UTC (rev 5516)
@@ -156,4 +156,30 @@
      */
     int countAllMatchedGroups(Object[][] matchFields, int nb, int start, 
XWikiContext context)
         throws XWikiException;
+    
+    /**
+     * Get all groups containing provided user.
+     * 
+     * @param member the name of the member (user or group).
+     * @param nb the maximum number of result to return.
+     * @param start the index of the first found member to return.
+     * @param context the XWiki context.
+     * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing group name.
+     * @throws XWikiException error when browsing groups.
+     */
+    public Collection getAllGroupsNamesForMember(String member, int nb, int 
start,
+        XWikiContext context) throws XWikiException;
+    
+    /**
+     * Get all users provided group contains.
+     * 
+     * @param group the name of the group.
+     * @param nb the maximum number of result to return.
+     * @param start the index of the first found user to return.
+     * @param context the XWiki context.
+     * @return the [EMAIL PROTECTED] Collection} of [EMAIL PROTECTED] String} 
containing user name.
+     * @throws XWikiException error when browsing groups.
+     */
+    public Collection getAllMembersNamesForGroup(String group, int nb, int 
start,
+        XWikiContext context) throws XWikiException;
 }

Modified: 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
===================================================================
--- 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
  2007-10-26 12:41:28 UTC (rev 5515)
+++ 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
  2007-10-26 12:41:32 UTC (rev 5516)
@@ -669,4 +669,32 @@
     {
         return countAllMatchedUsersOrGroups(false, matchFields, nb, start, 
context);
     }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#getAllGroupsNamesForMember(java.lang.String,
+     *      int, int, com.xpn.xwiki.XWikiContext)
+     */
+    public Collection getAllGroupsNamesForMember(String member, int nb, int 
start,
+        XWikiContext context) throws XWikiException
+    {
+        List groupNameList = new ArrayList(listGroupsForUser(member, context));
+
+        return groupNameList.subList(start, start + nb);
+    }
+
+    /**
+     * [EMAIL PROTECTED]
+     * 
+     * @see 
com.xpn.xwiki.user.api.XWikiGroupService#getAllMembersNamesForGroup(java.lang.String,
+     *      int, int, com.xpn.xwiki.XWikiContext)
+     */
+    public Collection getAllMembersNamesForGroup(String group, int nb, int 
start,
+        XWikiContext context) throws XWikiException
+    {
+        List userNameList = listMemberForGroup(group, context);
+
+        return userNameList.subList(start, start + nb);
+    }
 }

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

Reply via email to