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: $

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 Adminstrators 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.
 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) 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> getWatchedWikis()
          Get the list of wikis watched by the current user.
 java.util.List<java.lang.String> getWatchListWhatsNew(java.lang.String user)
          Get the list of the elements watched by user ordered by last modification date, descending.
 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 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.
 
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 retreived 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 retreived 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 retreived nor created

addDocumentForUser

public boolean addDocumentForUser(java.lang.String user,
                                  java.lang.String wDoc)
                           throws com.xpn.xwiki.XWikiException
Allows Adminstrators 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 retreived 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 retreived 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 retreived nor created

isSpaceWatched

public boolean isSpaceWatched()
                       throws com.xpn.xwiki.XWikiException
Is the current space 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 retreived 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 retreived 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 retreived 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 retreived 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 retreived 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

getWatchedElements

public java.util.List<java.lang.String> getWatchedElements()
                                                    throws com.xpn.xwiki.XWikiException
Get the elements (wikis + spaces + documents) 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 retreived nor created

getWatchListWhatsNew

public java.util.List<java.lang.String> getWatchListWhatsNew(java.lang.String user)
                                                      throws java.lang.Exception
Get the list of the elements watched by user ordered by last modification date, descending.

Parameters:
user - XWiki User
Returns:
the list of the elements watched by user ordered by last modification date, descending
Throws:
java.lang.Exception - If the search request fails


Copyright © 2004-2009 XWiki. All Rights Reserved.