com.xpn.xwiki.plugin.workspacesmanager
Class WorkspacesManagerApi

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.plugin.PluginApi
          extended by com.xpn.xwiki.plugin.spacemanager.plugin.SpaceManagerPluginApi
              extended by com.xpn.xwiki.plugin.workspacesmanager.WorkspacesManagerApi

public class WorkspacesManagerApi
extends com.xpn.xwiki.plugin.spacemanager.plugin.SpaceManagerPluginApi

API for the workspaces manager plugin. Expose the actual methods offered for velocity scripting from the Wiki.

Version:
$Id: $

Field Summary
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
WorkspacesManagerApi(WorkspacesManager plugin, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 void addReader(java.lang.String spaceName, java.lang.String userName)
          Add a user to the workspace, without allowing role downgrading.
 void addReader(java.lang.String spaceName, java.lang.String userName, boolean allowDowngrade)
          Add a user as a reader to the space, adding to the reader role group.
 void addWriter(java.lang.String spaceName, java.lang.String userName)
           
 void addWriter(java.lang.String spaceName, java.lang.String userName, boolean allowDowngrade)
           
 int countMembers(java.lang.String spaceName)
           
 java.lang.String getApplicationName()
           
 java.lang.String getApplicationName(java.lang.String docFullname)
           
 java.util.Collection getApplicationsNames(java.lang.String spaceName)
           
 java.lang.String getApplicationURL(java.lang.String spaceName, java.lang.String appName)
           
 java.lang.String getApplicationURL(java.lang.String spaceName, java.lang.String appName, java.lang.String docName)
           
 java.lang.String getApplicationURL(java.lang.String spaceName, java.lang.String appName, java.lang.String docName, java.lang.String queryString)
           
 java.util.Collection getDeletedSpaces()
           
 java.util.Collection getLastMembers(java.lang.String spaceName, int howMany)
           
 java.util.Collection getLastSpaces(int howMany)
           
 java.util.Collection getLastSpaces(int howMany, int startAt)
           
 java.util.Collection getMyMemberships()
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getMySpace()
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getOrganizationSpace()
           
 java.util.Collection getPotentialMembers(java.lang.String spaceName)
           
 java.util.Collection getPotentialMembers(java.lang.String spaceName, int howMany, int startAt)
          Lookup the wiki users that are not already members of the asked workspace.
 java.util.Collection getPotentialMembers(java.lang.String spaceName, java.lang.String matching, int howMany, int startAt)
           
 java.util.Collection getPublicSpaces()
           
 java.util.Collection getReaders(java.lang.String spaceName)
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getRootSpace(java.lang.String web)
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getSpace()
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getSpaceForUser(java.lang.String userName)
           
 java.util.List getStories(java.lang.String spaceName)
          Deprecated.  
 java.util.List getStories(java.lang.String spaceName, int howMany)
          Deprecated.  
 java.util.List getStories(java.lang.String spaceName, int howMany, int startAt)
          Deprecated.  
 java.util.Collection getWebsForSpace(java.lang.String spaceName)
           
protected  WorkspacesManager getWorkspacesManager()
           
 java.util.Collection getWriters(java.lang.String spaceName)
           
 boolean hasApplication(java.lang.String spaceName, java.lang.String appName)
           
 boolean isSpace()
           
 boolean makeSpacePrivate(java.lang.String spaceName)
           
 boolean makeSpacePublic(java.lang.String spaceName)
           
 void removeAdmin(java.lang.String spaceName, java.lang.String userName)
          Remove an admin from a workspace, removing him as a member too
 void removeReader(java.lang.String spaceName, java.lang.String userName)
          Remove a reader from a workspace, removing him as a member too
 void removeWriter(java.lang.String spaceName, java.lang.String userName)
          Remove a writer from a workspace, removing him as a member too
 java.util.List searchDocuments(java.lang.String spaceName, java.lang.String applicationName)
           
 java.util.List searchDocuments(java.lang.String spaceName, java.lang.String applicationName, int howMany)
           
 java.util.List searchDocuments(java.lang.String spaceName, java.lang.String applicationName, int howMany, int startAt)
           
 
Methods inherited from class com.xpn.xwiki.plugin.spacemanager.plugin.SpaceManagerPluginApi
addAdmin, addMember, countSpaces, createSpace, createSpaceFromApplication, createSpaceFromRequest, createSpaceFromRequest, createSpaceFromTemplate, deleteSpace, getAdmins, getCurrentSpace, getLastModifiedDocuments, getMembers, getRoles, getRoles, getSpace, getSpaceManager, getSpaceNames, getSpaceNames, getSpaceNames, getSpaces, getSpaces, getSpaces, getSpaceUserProfile, getUsersForRole, getVersion, isAdmin, isMember, joinSpace, removeMember, searchSpaceNames, searchSpaceNames, searchSpaces, searchSpaces, setSpaceRights, setSubSpaceRights, undeleteSpace, updateSpaceFromRequest, updateSpaceRights, validateSpaceData
 
Methods inherited from class com.xpn.xwiki.plugin.PluginApi
getInternalPlugin, getPlugin, getProtectedPlugin, setPlugin
 
Methods inherited from class com.xpn.xwiki.api.Api
checkProgrammingRights, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkspacesManagerApi

public WorkspacesManagerApi(WorkspacesManager plugin,
                            com.xpn.xwiki.XWikiContext context)
Method Detail

getWorkspacesManager

protected WorkspacesManager getWorkspacesManager()
Returns:
the plugin implementation instance

getLastSpaces

public java.util.Collection getLastSpaces(int howMany)
Parameters:
howMany - the number of workspaces to return
Returns:
the latest created workspaces

getLastSpaces

public java.util.Collection getLastSpaces(int howMany,
                                          int startAt)
Parameters:
startAt - the offset to start retrieving the latest workspaces at
See Also:
getLastSpaces(int)

getLastMembers

public java.util.Collection getLastMembers(java.lang.String spaceName,
                                           int howMany)
Parameters:
spaceName - the workspace wiki name to retrieve the latest members for
howMany - the number of members to retrieve
Returns:
the latest added members of the space

getMySpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getMySpace()
Returns:
the user Workspace for the context user

countMembers

public int countMembers(java.lang.String spaceName)
Parameters:
spaceName - the wiki name of the workspace to count the members of
Returns:
the numbers of members of the given workspace, that is the total number of XWiki.XWikiGroups objects in the space members group document of the workspace.

getMyMemberships

public java.util.Collection getMyMemberships()
Returns:
the list of Workspace in which the context user is a member and has a specific role (i.e. admin, reader or writer).

getPotentialMembers

public java.util.Collection getPotentialMembers(java.lang.String spaceName)
See Also:
getPotentialMembers(String, int, int)

getPotentialMembers

public java.util.Collection getPotentialMembers(java.lang.String spaceName,
                                                int howMany,
                                                int startAt)
Lookup the wiki users that are not already members of the asked workspace. This method is intended to be used when offering a UI to add wiki users to the workspace.

Parameters:
spaceName - the wiki name of the workspace to retrieve the users that does not belong to it
howMany - the number of potential members to retrieve
startAt - the offset to start retrieving the potential members at
Returns:
the potential members for the workspace, which are the users of the current wiki that does not belong to the member group of the workspace

getPotentialMembers

public java.util.Collection getPotentialMembers(java.lang.String spaceName,
                                                java.lang.String matching,
                                                int howMany,
                                                int startAt)
Parameters:
matching - the sequence of letters that either the first name or the last name of the potential members to retrieve must contains.
Returns:
the potential members for the workspace, whose first name or last name is matching the passed pattern
See Also:
getPotentialMembers(String, int, int)

getWriters

public java.util.Collection getWriters(java.lang.String spaceName)
Parameters:
spaceName - the wiki name of the workspace to retrieve the writers of
Returns:
the list of wiki name of members of the space with the role writer

getReaders

public java.util.Collection getReaders(java.lang.String spaceName)
Parameters:
spaceName - the wiki name of the workspace to retrieve the readers of
Returns:
the list of wiki name of members of the space with the role reader

getSpaceForUser

public com.xpn.xwiki.plugin.spacemanager.api.Space getSpaceForUser(java.lang.String userName)
Parameters:
userName - the wiki name of the user to find the userspace of
Returns:
if, exists, the unique user workspace for the given user wikiname, null if it does not exists.

getRootSpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getRootSpace(java.lang.String web)
Parameters:
web, - the wiki space (a.k.a. web) to retrieve the root space for
Returns:
the top level space (or web) for the workspace's given web, corresponding to the level the passed web inherits its rights from, through the 'parent' property of its WebPreference. As an example, the web 'Space_SomeSpace_Blog' will have 'Space_SomeSpace' as its workspace root space.

getSpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getSpace()
Returns:
if exists, the workspace that the current document belongs to.

isSpace

public boolean isSpace()
Returns:
if the current document belongs to an actual workspace, false otherwise

addReader

public void addReader(java.lang.String spaceName,
                      java.lang.String userName)
Add a user to the workspace, without allowing role downgrading.

See Also:
addReader(String, String, boolean)

addReader

public void addReader(java.lang.String spaceName,
                      java.lang.String userName,
                      boolean allowDowngrade)
Add a user as a reader to the space, adding to the reader role group. If not already member, adds it to the member group too.

Parameters:
spaceName - the wiki name of the workspace to add the reader to
userName - the wiki name of the user to add to the workspace as a reader
allowDowngrade - allow or not, to downgrade the role of the user within the workspace, if this one already is member with a higher role (writer or admin)

removeAdmin

public void removeAdmin(java.lang.String spaceName,
                        java.lang.String userName)
Remove an admin from a workspace, removing him as a member too

Overrides:
removeAdmin in class com.xpn.xwiki.plugin.spacemanager.plugin.SpaceManagerPluginApi

removeReader

public void removeReader(java.lang.String spaceName,
                         java.lang.String userName)
Remove a reader from a workspace, removing him as a member too


removeWriter

public void removeWriter(java.lang.String spaceName,
                         java.lang.String userName)
Remove a writer from a workspace, removing him as a member too


addWriter

public void addWriter(java.lang.String spaceName,
                      java.lang.String userName,
                      boolean allowDowngrade)

addWriter

public void addWriter(java.lang.String spaceName,
                      java.lang.String userName)

hasApplication

public boolean hasApplication(java.lang.String spaceName,
                              java.lang.String appName)

getApplicationURL

public java.lang.String getApplicationURL(java.lang.String spaceName,
                                          java.lang.String appName,
                                          java.lang.String docName,
                                          java.lang.String queryString)

getStories

public java.util.List getStories(java.lang.String spaceName)
Deprecated. 


getStories

public java.util.List getStories(java.lang.String spaceName,
                                 int howMany)
Deprecated. 


getStories

public java.util.List getStories(java.lang.String spaceName,
                                 int howMany,
                                 int startAt)
Deprecated. 


getApplicationURL

public java.lang.String getApplicationURL(java.lang.String spaceName,
                                          java.lang.String appName,
                                          java.lang.String docName)

getApplicationURL

public java.lang.String getApplicationURL(java.lang.String spaceName,
                                          java.lang.String appName)

getApplicationName

public java.lang.String getApplicationName()

getApplicationName

public java.lang.String getApplicationName(java.lang.String docFullname)

getApplicationsNames

public java.util.Collection getApplicationsNames(java.lang.String spaceName)

getWebsForSpace

public java.util.Collection getWebsForSpace(java.lang.String spaceName)

searchDocuments

public java.util.List searchDocuments(java.lang.String spaceName,
                                      java.lang.String applicationName)

searchDocuments

public java.util.List searchDocuments(java.lang.String spaceName,
                                      java.lang.String applicationName,
                                      int howMany)

searchDocuments

public java.util.List searchDocuments(java.lang.String spaceName,
                                      java.lang.String applicationName,
                                      int howMany,
                                      int startAt)

getPublicSpaces

public java.util.Collection getPublicSpaces()

getDeletedSpaces

public java.util.Collection getDeletedSpaces()

makeSpacePublic

public boolean makeSpacePublic(java.lang.String spaceName)

makeSpacePrivate

public boolean makeSpacePrivate(java.lang.String spaceName)

getOrganizationSpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getOrganizationSpace()


Copyright © 2004-2008 XWiki. All Rights Reserved.