com.xpn.xwiki.plugin.watchlist
Class WatchListPluginApi

java.lang.Object
  extended by com.xpn.xwiki.api.Api
      extended by com.xpn.xwiki.plugin.PluginApi<WatchListPlugin>
          extended by com.xpn.xwiki.plugin.watchlist.WatchListPluginApi

public class WatchListPluginApi
extends com.xpn.xwiki.plugin.PluginApi<WatchListPlugin>

Plugin that offers WatchList features to XWiki. These feature allow users to build lists of pages and spaces they want to follow. At a frequency choosen by the user XWiki will send an email notification to him with a list of the elements that has been modified since the last notification. This is the wrapper accessible from in-document scripts.

Version:
$Id: WatchListPluginApi.java 24078 2009-09-27 02:37:41Z sdumitriu $

Field Summary
 
Fields inherited from class com.xpn.xwiki.api.Api
context
 
Constructor Summary
WatchListPluginApi(WatchListPlugin plugin, com.xpn.xwiki.XWikiContext context)
          API constructor.
 
Method Summary
 boolean addDocument(java.lang.String wDoc)
          Add the specified document to the current user's WatchList.
 boolean addDocumentForUser(java.lang.String user, java.lang.String wDoc)
          Allows Administrators to add the specified document in the specified user's WatchList.
 boolean addSpace(java.lang.String wSpace)
          Add the current space to the current user's WatchList.
 boolean addSpaceForUser(java.lang.String user, java.lang.String wSpace)
          Allows Administrators to add the specified space to the specified user's WatchList.
 boolean addUser(java.lang.String user)
          Add the specified user to the current user's WatchList.
 boolean addUserForUser(java.lang.String user, java.lang.String userToWatch)
          Allows Administrators to add the specified user in the specified user's WatchList.
 boolean addWiki(java.lang.String wWiki)
          Add the current wiki to the current user's WatchList.
 boolean addWikiForUser(java.lang.String user, java.lang.String wWiki)
          Allows Administrators to add the specified wiki to the specified user's WatchList.
 com.sun.syndication.feed.synd.SyndFeed getFeed(int entryNumber)
           
 com.sun.syndication.feed.synd.SyndFeed getFeed(java.lang.String user, int entryNumber)
           
 java.util.List<java.lang.String> getWatchedDocuments()
          Get the documents watched by the current user.
 java.util.List<java.lang.String> getWatchedElements()
          Get the elements (wikis + spaces + documents + users) watched by the current user.
 java.util.List<java.lang.String> getWatchedSpaces()
          Get the spaces watched by the current user.
 java.util.List<java.lang.String> getWatchedUsers()
          Get the list of users watched by the current user.
 java.util.List<java.lang.String> getWatchedWikis()
          Get the list of wikis watched by the current user.
 boolean isDocInWatchedSpaces()
          Is current document within a space watched by the current user.
 boolean isDocumentWatched()
          Is current document watched by the current user.
 boolean isSpaceWatched()
          Is the current space watched by the current user.
 boolean isUserWatched(java.lang.String user)
          Is the given user watched by the current user.
 boolean isWikiWatched()
          Is the current wiki watched by the current user.
 boolean removeDocument(java.lang.String wDoc)
          Removed the specified document from the current user's WatchList.
 boolean removeDocumentForUser(java.lang.String user, java.lang.String wDoc)
          Allows Adminstrators to remove the specified document from the specified user's WatchList.
 boolean removeSpace(java.lang.String wSpace)
          Remove the specified space from the current user's WatchList.
 boolean removeSpaceForUser(java.lang.String user, java.lang.String wSpace)
          Allows Administrators to remove the specified space from the specified user's WatchList.
 boolean removeUser(java.lang.String user)
          Removed the specified user from the current user's WatchList.
 boolean removeUserForUser(java.lang.String user, java.lang.String userToRemove)
          Allows Administrators to remove the specified user from the specified user's WatchList.
 boolean removeWiki(java.lang.String wWiki)
          Remove the specified wiki from the current user's WatchList.
 boolean removeWikiForUser(java.lang.String user, java.lang.String wWiki)
          Allows Administrators to remove the specified wiki from the specified user's WatchList.
 
Methods inherited from class com.xpn.xwiki.plugin.PluginApi
getInternalPlugin, getPlugin, getProtectedPlugin, setPlugin
 
Methods inherited from class com.xpn.xwiki.api.Api
checkProgrammingRights, convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WatchListPluginApi

public WatchListPluginApi(WatchListPlugin plugin,
                          com.xpn.xwiki.XWikiContext context)
API constructor.

Parameters:
plugin - The wrapped plugin object
context - Context of the request
See Also:
PluginApi.PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface, XWikiContext)
Method Detail

isDocInWatchedSpaces

public boolean isDocInWatchedSpaces()
                             throws com.xpn.xwiki.XWikiException
Is current document within a space watched by the current user.

Returns:
True if the containing space is watched
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

isDocumentWatched

public boolean isDocumentWatched()
                          throws com.xpn.xwiki.XWikiException
Is current document watched by the current user.

Returns:
True if the document is in the current user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addDocument

public boolean addDocument(java.lang.String wDoc)
                    throws com.xpn.xwiki.XWikiException
Add the specified document to the current user's WatchList.

Parameters:
wDoc - Document to add
Returns:
True if the document wasn't already in the WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addDocumentForUser

public boolean addDocumentForUser(java.lang.String user,
                                  java.lang.String wDoc)
                           throws com.xpn.xwiki.XWikiException
Allows Administrators to add the specified document in the specified user's WatchList.

Parameters:
user - XWiki User
wDoc - Document to add
Returns:
True if the document wasn't already in the WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeDocument

public boolean removeDocument(java.lang.String wDoc)
                       throws com.xpn.xwiki.XWikiException
Removed the specified document from the current user's WatchList.

Parameters:
wDoc - Document to remove
Returns:
True if the document was in the WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeDocumentForUser

public boolean removeDocumentForUser(java.lang.String user,
                                     java.lang.String wDoc)
                              throws com.xpn.xwiki.XWikiException
Allows Adminstrators to remove the specified document from the specified user's WatchList.

Parameters:
user - XWiki User
wDoc - Document to remove
Returns:
True if the document was in the WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

isSpaceWatched

public boolean isSpaceWatched()
                       throws com.xpn.xwiki.XWikiException
Is the current space watched by the current user.

Returns:
True if the space is in the current user's watchlist
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addSpace

public boolean addSpace(java.lang.String wSpace)
                 throws com.xpn.xwiki.XWikiException
Add the current space to the current user's WatchList.

Parameters:
wSpace - Space to add
Returns:
True if the space wasn't already in the user's WatchList and has been added
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addSpaceForUser

public boolean addSpaceForUser(java.lang.String user,
                               java.lang.String wSpace)
                        throws com.xpn.xwiki.XWikiException
Allows Administrators to add the specified space to the specified user's WatchList.

Parameters:
user - XWiki User
wSpace - Space to add
Returns:
True if the space wasn't already in the user's WatchList and has been added
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeSpace

public boolean removeSpace(java.lang.String wSpace)
                    throws com.xpn.xwiki.XWikiException
Remove the specified space from the current user's WatchList.

Parameters:
wSpace - Space to remove
Returns:
True if the space was in the user's WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeSpaceForUser

public boolean removeSpaceForUser(java.lang.String user,
                                  java.lang.String wSpace)
                           throws com.xpn.xwiki.XWikiException
Allows Administrators to remove the specified space from the specified user's WatchList.

Parameters:
user - XWiki User
wSpace - Space to remove
Returns:
True if the space was in the user's WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

isWikiWatched

public boolean isWikiWatched()
                      throws com.xpn.xwiki.XWikiException
Is the current wiki watched by the current user.

Returns:
True if the wiki is in the current user's watchlist
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addWiki

public boolean addWiki(java.lang.String wWiki)
                throws com.xpn.xwiki.XWikiException
Add the current wiki to the current user's WatchList.

Parameters:
wWiki - Wiki to add
Returns:
True if the wiki wasn't already in the user's WatchList and has been added
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addWikiForUser

public boolean addWikiForUser(java.lang.String user,
                              java.lang.String wWiki)
                       throws com.xpn.xwiki.XWikiException
Allows Administrators to add the specified wiki to the specified user's WatchList.

Parameters:
user - XWiki User
wWiki - Wiki to add
Returns:
True if the wiki wasn't already in the user's WatchList and has been added
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeWiki

public boolean removeWiki(java.lang.String wWiki)
                   throws com.xpn.xwiki.XWikiException
Remove the specified wiki from the current user's WatchList.

Parameters:
wWiki - Wiki to remove
Returns:
True if the wiki was in the user's WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeWikiForUser

public boolean removeWikiForUser(java.lang.String user,
                                 java.lang.String wWiki)
                          throws com.xpn.xwiki.XWikiException
Allows Administrators to remove the specified wiki from the specified user's WatchList.

Parameters:
user - XWiki User
wWiki - Wiki to remove
Returns:
True if the wiki was in the user's WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

isUserWatched

public boolean isUserWatched(java.lang.String user)
                      throws com.xpn.xwiki.XWikiException
Is the given user watched by the current user.

Parameters:
user - the prefixed fullName of the user to test
Returns:
True if the user is in the current user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addUser

public boolean addUser(java.lang.String user)
                throws com.xpn.xwiki.XWikiException
Add the specified user to the current user's WatchList.

Parameters:
user - User to add
Returns:
True if the user wasn't already in the WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

addUserForUser

public boolean addUserForUser(java.lang.String user,
                              java.lang.String userToWatch)
                       throws com.xpn.xwiki.XWikiException
Allows Administrators to add the specified user in the specified user's WatchList.

Parameters:
user - XWiki User
userToWatch - User to add
Returns:
True if the user wasn't already in the WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeUser

public boolean removeUser(java.lang.String user)
                   throws com.xpn.xwiki.XWikiException
Removed the specified user from the current user's WatchList.

Parameters:
user - User to remove
Returns:
True if the user was in the WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

removeUserForUser

public boolean removeUserForUser(java.lang.String user,
                                 java.lang.String userToRemove)
                          throws com.xpn.xwiki.XWikiException
Allows Administrators to remove the specified user from the specified user's WatchList.

Parameters:
user - XWiki User
userToRemove - User to remove
Returns:
True if the user was in the WatchList and has been removed
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getWatchedDocuments

public java.util.List<java.lang.String> getWatchedDocuments()
                                                     throws com.xpn.xwiki.XWikiException
Get the documents watched by the current user.

Returns:
The list of the documents in the user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getWatchedSpaces

public java.util.List<java.lang.String> getWatchedSpaces()
                                                  throws com.xpn.xwiki.XWikiException
Get the spaces watched by the current user.

Returns:
The list of the spaces in the user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getWatchedWikis

public java.util.List<java.lang.String> getWatchedWikis()
                                                 throws com.xpn.xwiki.XWikiException
Get the list of wikis watched by the current user.

Returns:
The list of the wikis in the user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getWatchedUsers

public java.util.List<java.lang.String> getWatchedUsers()
                                                 throws com.xpn.xwiki.XWikiException
Get the list of users watched by the current user.

Returns:
The list of the users in the user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getWatchedElements

public java.util.List<java.lang.String> getWatchedElements()
                                                    throws com.xpn.xwiki.XWikiException
Get the elements (wikis + spaces + documents + users) watched by the current user.

Returns:
The list of the elements in the user's WatchList
Throws:
com.xpn.xwiki.XWikiException - If the user's WatchList Object cannot be retrieved nor created

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(int entryNumber)
                                               throws com.xpn.xwiki.XWikiException
Parameters:
entryNumber - number of entries to retrieve
Returns:
the watchlist RSS feed for the current user
Throws:
com.xpn.xwiki.XWikiException - if the retrieval of RSS entries fails

getFeed

public com.sun.syndication.feed.synd.SyndFeed getFeed(java.lang.String user,
                                                      int entryNumber)
                                               throws com.xpn.xwiki.XWikiException
Parameters:
user - the user to retreive the RSS for
entryNumber - number of entries to retrieve
Returns:
the watchlist RSS feed for the given user
Throws:
com.xpn.xwiki.XWikiException - if the retrieval of RSS entries fails


Copyright © 2004-2010 XWiki. All Rights Reserved.