com.xpn.xwiki.plugin.workspacesmanager
Class WorkspacesManager

java.lang.Object
  extended by com.xpn.xwiki.plugin.XWikiDefaultPlugin
      extended by com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
          extended by com.xpn.xwiki.plugin.workspacesmanager.WorkspacesManager
All Implemented Interfaces:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManager, com.xpn.xwiki.plugin.XWikiPluginInterface

public class WorkspacesManager
extends com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl

Workspaces manager plugin implementation.

Version:
$Id: $

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
com.xpn.xwiki.plugin.spacemanager.api.SpaceManager.SpaceAction
 
Field Summary
static java.lang.String WORKSPACESMANAGER_PLUGIN_NAME
          Plugin name
 
Fields inherited from class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
mailNotification, SPACEMANAGER_DEFAULT_EXTENSION, SPACEMANAGER_DEFAULT_MAIL_NOTIFICATION, SPACEMANAGER_DEFAULT_PROTECTED_SUBSPACES, SPACEMANAGER_EXTENSION_CFG_PROP, SPACEMANAGER_PROTECTED_SUBSPACES_PROP, spaceManagerExtension
 
Fields inherited from interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
DEFAULT_RESOURCE_SPACE, SPACE_CLASS_NAME, SPACE_DEFAULT_TYPE
 
Constructor Summary
WorkspacesManager(java.lang.String name, java.lang.String className, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 void addAdmin(java.lang.String spaceName, java.lang.String username, com.xpn.xwiki.XWikiContext context)
          Since "admin" is considered as a role within XWS, overrides the space manager addAdmin method, to : Remove the user from possible other roles (readers, writers) Add the user to the member group if he is not a space member
 void addReader(java.lang.String spaceName, java.lang.String userName, boolean allowDowngrade, com.xpn.xwiki.XWikiContext context)
           
 void addWriter(java.lang.String spaceName, java.lang.String userName, boolean allowDowngrade, com.xpn.xwiki.XWikiContext context)
           
 int countMembers(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.plugin.spacemanager.api.Space createSpaceFromRequest(java.lang.String templateSpaceName, com.xpn.xwiki.XWikiContext context)
          First, checks if the workspace creation is allowed, by looking over the request data to ensure that : Users can only have one own workspace (a.k.a the "User space") There can only be one "organization" workspace
 java.lang.String getApplicationName(java.lang.String docFullname, com.xpn.xwiki.XWikiContext context)
           
 java.util.Map getApplicationsForSpace(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
 java.lang.String getApplicationURL(java.lang.String spaceName, java.lang.String appName, java.lang.String docName, java.lang.String queryString, com.xpn.xwiki.XWikiContext context)
           
 java.util.List getDeletedSpaces(com.xpn.xwiki.XWikiContext context)
           
 java.util.List getLastSpaces(int howMany, int startAt, com.xpn.xwiki.XWikiContext context)
           
 java.util.Collection getMembers(java.lang.String spaceName, int howMany, int startAt, com.xpn.xwiki.XWikiContext context)
           
 java.lang.String getName()
          
 com.xpn.xwiki.plugin.spacemanager.api.Space getOrganizationSpace(com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.api.Api getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin, com.xpn.xwiki.XWikiContext context)
          
 java.util.Collection getPotentialMembersForSpace(java.lang.String spaceName, int howMany, int startAt, com.xpn.xwiki.XWikiContext context)
           
 java.util.Collection getPotentialMembersForSpace(java.lang.String spaceName, java.lang.String matching, int howMany, int startAt, com.xpn.xwiki.XWikiContext context)
           
 java.util.List getPublicSpaces(com.xpn.xwiki.XWikiContext context)
           
 java.util.Collection getReaders(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getRootSpace(java.lang.String web, com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.plugin.spacemanager.api.Space getSpaceForUser(java.lang.String userName, com.xpn.xwiki.XWikiContext context)
           
 com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerExtension getSpaceManagerExtension(com.xpn.xwiki.XWikiContext context)
          
 java.util.List getStoriesForSpace(java.lang.String spaceName, int startAt, int howMany, com.xpn.xwiki.XWikiContext context)
          Returns, for a workspace, the list of stories.Story associated with the last modified documents.
 java.util.Collection getWebsForSpace(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
protected  java.lang.String getWorkspaceSpaceClassName()
          
 java.util.Collection getWriters(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
 void makeSpacePrivate(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
 void makeSpacePublic(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
           
protected  com.xpn.xwiki.plugin.spacemanager.api.Space newSpace(java.lang.String spaceName, java.lang.String spaceTitle, boolean create, com.xpn.xwiki.XWikiContext context)
           
 void removeAdmin(java.lang.String spaceName, java.lang.String userName, com.xpn.xwiki.XWikiContext context)
           
 void removeReader(java.lang.String spaceName, java.lang.String userName, com.xpn.xwiki.XWikiContext context)
           
 void removeWriter(java.lang.String spaceName, java.lang.String userName, com.xpn.xwiki.XWikiContext context)
           
 java.util.List searchDocuments(java.lang.String spaceName, java.lang.String applicationName, int howMany, int startAt, com.xpn.xwiki.XWikiContext context)
           
 void setReadersRights(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
          Set-up the rights objects for the reader group of a workspace
 void setWritersRights(java.lang.String spaceName, com.xpn.xwiki.XWikiContext context)
          Set-up the rights objects for the writer group of a workspace
 void virtualInit(com.xpn.xwiki.XWikiContext context)
          
 
Methods inherited from class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
addAdmins, addMember, addMembers, addRightToGroup, addUsersToRole, addUsersToRoles, addUserToGroup, addUserToRole, addUserToRoles, countSpaces, createSpace, createSpaceFromApplication, createSpaceFromRequest, createSpaceFromTemplate, deleteSpace, deleteSpace, flushCache, getAdminGroupName, getAdmins, getGroupService, getLastModifiedDocuments, getLastModifiedDocuments, getMemberGroupName, getMembers, getProtectedSubSpaces, getRoleGroupName, getRoles, getRoles, getSpace, getSpaceClass, getSpaceClassName, getSpaceDocumentName, getSpaceManagerExtension, getSpaceNames, getSpaceNames, getSpaceNames, getSpaceObjects, getSpaces, getSpaces, getSpaces, getSpaceTypeName, getSpaceUserProfile, getSpaceUserProfilePageName, getSpaceWikiName, getUsersForRole, hasCustomMapping, init, isAdmin, isMailNotification, isMember, isMemberOfGroup, joinSpace, newUserSpaceProfile, removeMember, removeRightFromGroup, removeUserFromRole, removeUserFromRoles, saveSpace, searchDocuments, searchSpaceNames, searchSpaceNames, searchSpaces, searchSpaces, setMailNotification, setSpaceRights, setSubSpaceRights, undeleteSpace, updateSpaceFromRequest, updateSpaceRights, validateSpaceData
 
Methods inherited from class com.xpn.xwiki.plugin.XWikiDefaultPlugin
beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, getClassName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.xpn.xwiki.plugin.XWikiPluginInterface
beginRendering, commonTagsHandler, downloadAttachment, endRendering, endRenderingHandler, flushCache, getClassName, insidePREHandler, outsidePREHandler, setClassName, setName, startRenderingHandler
 

Field Detail

WORKSPACESMANAGER_PLUGIN_NAME

public static final java.lang.String WORKSPACESMANAGER_PLUGIN_NAME
Plugin name

See Also:
Constant Field Values
Constructor Detail

WorkspacesManager

public WorkspacesManager(java.lang.String name,
                         java.lang.String className,
                         com.xpn.xwiki.XWikiContext context)
Method Detail

getName

public java.lang.String getName()

Specified by:
getName in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
getName in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl

virtualInit

public void virtualInit(com.xpn.xwiki.XWikiContext context)

Specified by:
virtualInit in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
virtualInit in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl

getSpaceManagerExtension

public com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerExtension getSpaceManagerExtension(com.xpn.xwiki.XWikiContext context)
                                                                                     throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException

Specified by:
getSpaceManagerExtension in interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
Overrides:
getSpaceManagerExtension in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException

createSpaceFromRequest

public com.xpn.xwiki.plugin.spacemanager.api.Space createSpaceFromRequest(java.lang.String templateSpaceName,
                                                                          com.xpn.xwiki.XWikiContext context)
                                                                   throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
First, checks if the workspace creation is allowed, by looking over the request data to ensure that :
  1. Users can only have one own workspace (a.k.a the "User space")
  2. There can only be one "organization" workspace

Specified by:
createSpaceFromRequest in interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
Overrides:
createSpaceFromRequest in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException

addAdmin

public void addAdmin(java.lang.String spaceName,
                     java.lang.String username,
                     com.xpn.xwiki.XWikiContext context)
              throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Since "admin" is considered as a role within XWS, overrides the space manager addAdmin method, to :

Specified by:
addAdmin in interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
Overrides:
addAdmin in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
org.xwiki.plugin.spacemanager.impl.SpaceManagerImpl#addAdmin(String, String, XWikiContext)

addReader

public void addReader(java.lang.String spaceName,
                      java.lang.String userName,
                      boolean allowDowngrade,
                      com.xpn.xwiki.XWikiContext context)
               throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.addReader(String, String, boolean)

removeAdmin

public void removeAdmin(java.lang.String spaceName,
                        java.lang.String userName,
                        com.xpn.xwiki.XWikiContext context)
                 throws WorkspacesManagerException
Specified by:
removeAdmin in interface com.xpn.xwiki.plugin.spacemanager.api.SpaceManager
Overrides:
removeAdmin in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.removeAdmin(String, String)

removeReader

public void removeReader(java.lang.String spaceName,
                         java.lang.String userName,
                         com.xpn.xwiki.XWikiContext context)
                  throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.removeReader(String, String)

removeWriter

public void removeWriter(java.lang.String spaceName,
                         java.lang.String userName,
                         com.xpn.xwiki.XWikiContext context)
                  throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.removeWriter(String, String)

setWritersRights

public void setWritersRights(java.lang.String spaceName,
                             com.xpn.xwiki.XWikiContext context)
                      throws WorkspacesManagerException
Set-up the rights objects for the writer group of a workspace

Parameters:
spaceName - the name of the space to set the writer rights of
Throws:
WorkspacesManagerException

setReadersRights

public void setReadersRights(java.lang.String spaceName,
                             com.xpn.xwiki.XWikiContext context)
                      throws WorkspacesManagerException
Set-up the rights objects for the reader group of a workspace

Parameters:
spaceName - the name of the space to set the reader rights of
Throws:
WorkspacesManagerException

addWriter

public void addWriter(java.lang.String spaceName,
                      java.lang.String userName,
                      boolean allowDowngrade,
                      com.xpn.xwiki.XWikiContext context)
               throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.addWriter(String, String, boolean)

getReaders

public java.util.Collection getReaders(java.lang.String spaceName,
                                       com.xpn.xwiki.XWikiContext context)
                                throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getReaders(String)

getWriters

public java.util.Collection getWriters(java.lang.String spaceName,
                                       com.xpn.xwiki.XWikiContext context)
                                throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getWriters(String)

getPotentialMembersForSpace

public java.util.Collection getPotentialMembersForSpace(java.lang.String spaceName,
                                                        int howMany,
                                                        int startAt,
                                                        com.xpn.xwiki.XWikiContext context)
                                                 throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getPotentialMembers(String, int, int)

getPotentialMembersForSpace

public java.util.Collection getPotentialMembersForSpace(java.lang.String spaceName,
                                                        java.lang.String matching,
                                                        int howMany,
                                                        int startAt,
                                                        com.xpn.xwiki.XWikiContext context)
                                                 throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getPotentialMembers(String, String, int, int)

getStoriesForSpace

public java.util.List getStoriesForSpace(java.lang.String spaceName,
                                         int startAt,
                                         int howMany,
                                         com.xpn.xwiki.XWikiContext context)
                                  throws WorkspacesManagerException
Returns, for a workspace, the list of stories.Story associated with the last modified documents. Stories are built by a stories.StoryBuilder chosen for each story according to the application the modified document belong to.

Parameters:
spaceName - the XWiki name of the workspace to return the stories for
startAt - the offset to start retrieving modified documents at in the workspace
howMany - the number of stories to retrieve
Throws:
WorkspacesManagerException

getDeletedSpaces

public java.util.List getDeletedSpaces(com.xpn.xwiki.XWikiContext context)
                                throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getDeletedSpaces()

getOrganizationSpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getOrganizationSpace(com.xpn.xwiki.XWikiContext context)
                                                                 throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
WorkspacesManagerException
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
WorkspacesManagerApi.getOrganizationSpace()

getPublicSpaces

public java.util.List getPublicSpaces(com.xpn.xwiki.XWikiContext context)
                               throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.getPublicSpaces()

makeSpacePrivate

public void makeSpacePrivate(java.lang.String spaceName,
                             com.xpn.xwiki.XWikiContext context)
                      throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.makeSpacePrivate(String)

makeSpacePublic

public void makeSpacePublic(java.lang.String spaceName,
                            com.xpn.xwiki.XWikiContext context)
                     throws WorkspacesManagerException
Throws:
WorkspacesManagerException
See Also:
WorkspacesManagerApi.makeSpacePrivate(String)

getSpaceForUser

public com.xpn.xwiki.plugin.spacemanager.api.Space getSpaceForUser(java.lang.String userName,
                                                                   com.xpn.xwiki.XWikiContext context)
                                                            throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
WorkspacesManagerApi.getSpaceForUser(String)

countMembers

public int countMembers(java.lang.String spaceName,
                        com.xpn.xwiki.XWikiContext context)
                 throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
WorkspacesManagerApi.countMembers(String)

getMembers

public java.util.Collection getMembers(java.lang.String spaceName,
                                       int howMany,
                                       int startAt,
                                       com.xpn.xwiki.XWikiContext context)
                                throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
SpaceManagerPluginApi.getMembers(String)

getLastSpaces

public java.util.List getLastSpaces(int howMany,
                                    int startAt,
                                    com.xpn.xwiki.XWikiContext context)
                             throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
See Also:
WorkspacesManagerApi.getLastSpaces(int, int)

getWorkspaceSpaceClassName

protected java.lang.String getWorkspaceSpaceClassName()


getPluginApi

public com.xpn.xwiki.api.Api getPluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface plugin,
                                          com.xpn.xwiki.XWikiContext context)

Specified by:
getPluginApi in interface com.xpn.xwiki.plugin.XWikiPluginInterface
Overrides:
getPluginApi in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl

getRootSpace

public com.xpn.xwiki.plugin.spacemanager.api.Space getRootSpace(java.lang.String web,
                                                                com.xpn.xwiki.XWikiContext context)
                                                         throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Returns:
the top-level that the passed web belongs to.
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException

searchDocuments

public java.util.List searchDocuments(java.lang.String spaceName,
                                      java.lang.String applicationName,
                                      int howMany,
                                      int startAt,
                                      com.xpn.xwiki.XWikiContext context)
                               throws WorkspacesManagerException
Throws:
WorkspacesManagerException

getApplicationURL

public java.lang.String getApplicationURL(java.lang.String spaceName,
                                          java.lang.String appName,
                                          java.lang.String docName,
                                          java.lang.String queryString,
                                          com.xpn.xwiki.XWikiContext context)
                                   throws WorkspacesManagerException
Throws:
WorkspacesManagerException

getApplicationName

public java.lang.String getApplicationName(java.lang.String docFullname,
                                           com.xpn.xwiki.XWikiContext context)
                                    throws WorkspacesManagerException
Throws:
WorkspacesManagerException

getWebsForSpace

public java.util.Collection getWebsForSpace(java.lang.String spaceName,
                                            com.xpn.xwiki.XWikiContext context)
                                     throws WorkspacesManagerException
Throws:
WorkspacesManagerException

getApplicationsForSpace

public java.util.Map getApplicationsForSpace(java.lang.String spaceName,
                                             com.xpn.xwiki.XWikiContext context)
                                      throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException

newSpace

protected com.xpn.xwiki.plugin.spacemanager.api.Space newSpace(java.lang.String spaceName,
                                                               java.lang.String spaceTitle,
                                                               boolean create,
                                                               com.xpn.xwiki.XWikiContext context)
                                                        throws com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException
Overrides:
newSpace in class com.xpn.xwiki.plugin.spacemanager.impl.SpaceManagerImpl
Throws:
com.xpn.xwiki.plugin.spacemanager.api.SpaceManagerException


Copyright © 2004-2008 XWiki. All Rights Reserved.