Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.database
Class DbWatchManager

java.lang.Object
  extended by com.jivesoftware.forum.database.DbWatchManager
All Implemented Interfaces:
JiveManager, WatchManager

public class DbWatchManager
extends java.lang.Object
implements WatchManager, JiveManager

Database implementation of the WatchManager interface.


Constructor Summary
DbWatchManager()
          Creates a new DbWatchManager.
 
Method Summary
 Watch createWatch(User user, Forum forum)
          Create a watch on a forum for the specified user.
 Watch createWatch(User user, ForumCategory category)
          Create a watch on a category for the specified user.
 Watch createWatch(User user, ForumThread thread)
          Create a watch on a thread for the specified user.
 Watch createWatch(User user, User watchedUser)
          Create a watch on a user for the specified user.
 void deleteThreadWatches(long forumID)
          Deletes all thread watches in a specific forum.
 void deleteWatch(Watch watch)
          Delete the specified watch.
 void deleteWatches(int objectType, long objectID)
           
 void deleteWatches(User user)
          Deletes all watches that a user has.
 void demoteBatchWatches()
           
 void destroy()
          Notifies the manager to release any resources that may be holding on too.
 java.util.Iterator getAllWatches(User user, int objectType)
          Returns an iterator for all objects of a particular type that a user is watching.
 int getDeleteDays()
          Returns the number of days that a watched object can remain inactive before watches on that object are deleted.
 int getRecursiveForumWatchCount(User user, ForumCategory category)
          Returns number of Forum objects the user is watching under the category and its subcategories.
 java.util.Iterator getRecursiveForumWatches(User user, ForumCategory category, int startIndex, int numResults)
          Returns all the Forum objects the user is watching under the category and its subcategories.
 int getRecursiveThreadWatchCount(User user, ForumCategory category)
          Returns the number of ForumThread objects the user is watching under the provided ForumCategory.
 java.util.Iterator getRecursiveThreadWatches(User user, ForumCategory category, int startIndex, int numResults)
          Returns the ForumThread objects the user is watching under the provided ForumCategory.
 java.util.Iterator getThreadWatches(User user, ForumCategory category, int startIndex, int numResults)
          Returns the ForumThread objects the user is watching under the provided ForumCategory.
 int getTotalWatchCount(User user, int objectType)
          Returns a count of all watches that a user has of a particular type.
 Watch getWatch(User user, Forum forum)
          Returns a watch on a particular forum, or null if there isn't a watch.
 Watch getWatch(User user, ForumCategory category)
          Returns a watch on a particular category, or null if there isn't a watch.
 Watch getWatch(User user, ForumThread thread)
          Returns a watch on a particular thread, or null if there isn't a watch.
 Watch getWatch(User user, User watchedUser)
          Returns a watch on a particular thread, or null if there isn't a watch.
 int getWatchCount(User user, Forum forum)
          Return the count of all thread watches in a particular forum for the given user.
 int getWatchCount(User user, ForumCategory category)
          Return the count of all forum watches in a particular category for the given user.
 java.util.Iterator getWatchers(int objectType, long objectID)
          Returns an Iterator of User objects who are watching the specified object.
 java.util.Iterator getWatches(User user, Forum forum)
          Returns an Iterator for all the thread objects a user is watching in a forum.
 java.util.Iterator getWatches(User user, ForumCategory category)
          Returns an Iterator for all the forum objects a user is watching in a category.
 java.util.Iterator getWatches(User user, ForumCategory category, int startIndex, int numResults)
          Returns the Forums watched by the User under the given Category.
 java.util.Iterator getWatches(User user, Forum forum, int startIndex, int numResults)
          Returns all the ForumThreads watched by the User under the given Forum.
 Watch[] getWatchList(User user, int objectType)
          Returns the watch list of a particular object type for a user.
 void initialize()
          Initialize the manager.
 boolean isWatched(User user, Forum forum)
          Returns true if the user is watching the specified forum.
 boolean isWatched(User user, ForumCategory category)
          Returns true if the user is watching the specified category.
 boolean isWatched(User user, ForumThread thread)
          Returns true if the user is watching the specified thread.
 boolean isWatched(User user, User watchedUser)
          Returns true if the user is watching the specified user.
 void notifyWatchUpdate(ForumMessage message)
           
static boolean sendWatch(long userID)
           
 void setDeleteDays(int deleteDays)
          Sets the number of days that a watched object can remain inactive before watches on that object are deleted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbWatchManager

public DbWatchManager()
Creates a new DbWatchManager.

Method Detail

initialize

public void initialize()
Description copied from interface: JiveManager
Initialize the manager. It is within this method that it is ok to create, access and/or otherwise use external classes (including caches). Until this method is called implementation should not access any external classes that could possibly either access one of the main Factory classes or any caches since doing so can cause deadlocks and possible clustering issues during startup.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
initialize in interface JiveManager

destroy

public void destroy()
Description copied from interface: JiveManager
Notifies the manager to release any resources that may be holding on too. This could also be used to clear out the managers caches, etc.

This method is used internally by Jive during application startup and should not be called during normal usage of the class.

Specified by:
destroy in interface JiveManager

getDeleteDays

public int getDeleteDays()
Description copied from interface: WatchManager
Returns the number of days that a watched object can remain inactive before watches on that object are deleted.

Specified by:
getDeleteDays in interface WatchManager
Returns:
the number of days a watched object can be inactive before watches on it are deleted.

setDeleteDays

public void setDeleteDays(int deleteDays)
Description copied from interface: WatchManager
Sets the number of days that a watched object can remain inactive before watches on that object are deleted.

Specified by:
setDeleteDays in interface WatchManager
Parameters:
deleteDays - the number days a watch can be inactive before being automatically deleted.

sendWatch

public static boolean sendWatch(long userID)

demoteBatchWatches

public void demoteBatchWatches()

createWatch

public Watch createWatch(User user,
                         User watchedUser)
Description copied from interface: WatchManager
Create a watch on a user for the specified user.

Specified by:
createWatch in interface WatchManager
Parameters:
user - the user to set the watch for.
watchedUser - the user to watch.
Returns:
the created watch.

createWatch

public Watch createWatch(User user,
                         ForumThread thread)
Description copied from interface: WatchManager
Create a watch on a thread for the specified user.

Specified by:
createWatch in interface WatchManager
Parameters:
user - the user to set the watch for.
thread - the thread to watch.
Returns:
the created watch.

createWatch

public Watch createWatch(User user,
                         Forum forum)
Description copied from interface: WatchManager
Create a watch on a forum for the specified user.

Specified by:
createWatch in interface WatchManager
Parameters:
user - the user to set the watch for.
forum - the forum to watch.
Returns:
the created watch.

createWatch

public Watch createWatch(User user,
                         ForumCategory category)
Description copied from interface: WatchManager
Create a watch on a category for the specified user.

Specified by:
createWatch in interface WatchManager
Parameters:
user - the user to set the watch for.
category - the category to watch.
Returns:
the created watch.

getTotalWatchCount

public int getTotalWatchCount(User user,
                              int objectType)
Description copied from interface: WatchManager
Returns a count of all watches that a user has of a particular type. Valid object types are:

Specified by:
getTotalWatchCount in interface WatchManager
Parameters:
user - the user to get the watch count for.
objectType - the object type to get a watch count for.
Returns:
the total number of watches that a user has of type objectType.

getWatchList

public Watch[] getWatchList(User user,
                            int objectType)
Returns the watch list of a particular object type for a user.

Specified by:
getWatchList in interface WatchManager
Parameters:
user - the user.
objectType - the object type.
Returns:
the user's watch list corresponding to an object type.

getAllWatches

public java.util.Iterator getAllWatches(User user,
                                        int objectType)
Description copied from interface: WatchManager
Returns an iterator for all objects of a particular type that a user is watching. Valid objecttypes are:

Specified by:
getAllWatches in interface WatchManager
Parameters:
user - the user.
objectType - the object type.
Returns:
an iterator for all objects of type objectType that a user is watching.

getWatchCount

public int getWatchCount(User user,
                         Forum forum)
Description copied from interface: WatchManager
Return the count of all thread watches in a particular forum for the given user.

Specified by:
getWatchCount in interface WatchManager
Parameters:
user - the user to return the watch count for.
Returns:
the count of thread watches for a user in a given forum.

getWatchCount

public int getWatchCount(User user,
                         ForumCategory category)
Description copied from interface: WatchManager
Return the count of all forum watches in a particular category for the given user.

Specified by:
getWatchCount in interface WatchManager
Parameters:
user - the user to return the watch count for.
category - the category to return the watch count for.
Returns:
the count of forum watches for a user in a given category.

getWatches

public java.util.Iterator getWatches(User user,
                                     ForumCategory category)
                              throws UnauthorizedException
Description copied from interface: WatchManager
Returns an Iterator for all the forum objects a user is watching in a category.

Specified by:
getWatches in interface WatchManager
Parameters:
user - the user.
category - the category.
Returns:
an iterator for all the forums a user is watching in a category.
Throws:
UnauthorizedException - if not a system admin or the user.

getWatches

public java.util.Iterator getWatches(User user,
                                     Forum forum)
Description copied from interface: WatchManager
Returns an Iterator for all the thread objects a user is watching in a forum.

Specified by:
getWatches in interface WatchManager
Parameters:
user - the user.
forum - the forum.
Returns:
an iterator for all the threads a user is watching in a forum.

getWatches

public java.util.Iterator getWatches(User user,
                                     Forum forum,
                                     int startIndex,
                                     int numResults)
Description copied from interface: WatchManager
Returns all the ForumThreads watched by the User under the given Forum.

Specified by:
getWatches in interface WatchManager
Parameters:
user - the user.
forum - the forum to begin looking for watches.
startIndex - the start index.
numResults - the number of results to return.
Returns:
the ForumThread objects watched by the user.

getWatches

public java.util.Iterator getWatches(User user,
                                     ForumCategory category,
                                     int startIndex,
                                     int numResults)
Description copied from interface: WatchManager
Returns the Forums watched by the User under the given Category. This method does not recurse SubCategories. For recursive watches, use getRecursiveForumWatches.

Specified by:
getWatches in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
startIndex - the start index.
numResults - the number of results to return
Returns:
the Forum objects watched by the user.

getRecursiveForumWatches

public java.util.Iterator getRecursiveForumWatches(User user,
                                                   ForumCategory category,
                                                   int startIndex,
                                                   int numResults)
Description copied from interface: WatchManager
Returns all the Forum objects the user is watching under the category and its subcategories. Recurses on subcategories.

Specified by:
getRecursiveForumWatches in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
startIndex - the start index.
numResults - the number of results to return.
Returns:
the Forum objects watched by this user.

getRecursiveForumWatchCount

public int getRecursiveForumWatchCount(User user,
                                       ForumCategory category)
Description copied from interface: WatchManager
Returns number of Forum objects the user is watching under the category and its subcategories. Recurses on subcategories.

Specified by:
getRecursiveForumWatchCount in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
Returns:
the number of Forum objects watched by this user.

getThreadWatches

public java.util.Iterator getThreadWatches(User user,
                                           ForumCategory category,
                                           int startIndex,
                                           int numResults)
Description copied from interface: WatchManager
Returns the ForumThread objects the user is watching under the provided ForumCategory. Does not recurse to subcategories, only the Forums directly in the provided ForumCategory.

Specified by:
getThreadWatches in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
startIndex - the start index.
numResults - the number of results to return.
Returns:
the ForumThread objects watched by this user.

getRecursiveThreadWatches

public java.util.Iterator getRecursiveThreadWatches(User user,
                                                    ForumCategory category,
                                                    int startIndex,
                                                    int numResults)
Description copied from interface: WatchManager
Returns the ForumThread objects the user is watching under the provided ForumCategory. Recurses through Subcategories and Forums.

Specified by:
getRecursiveThreadWatches in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
startIndex - the start index.
numResults - the number of results to return.
Returns:
the ForumThread objects watched by this user.

getRecursiveThreadWatchCount

public int getRecursiveThreadWatchCount(User user,
                                        ForumCategory category)
Description copied from interface: WatchManager
Returns the number of ForumThread objects the user is watching under the provided ForumCategory. Recurses through Subcategories and Forums.

Specified by:
getRecursiveThreadWatchCount in interface WatchManager
Parameters:
user - the user.
category - the category to begin looking for watches.
Returns:
the number of ForumThread objects watched by this user.

getWatch

public Watch getWatch(User user,
                      User watchedUser)
Description copied from interface: WatchManager
Returns a watch on a particular thread, or null if there isn't a watch.

Specified by:
getWatch in interface WatchManager
Parameters:
user - the user with the watch.
watchedUser - the user being watched.
Returns:
the Watch or null if the watchedUser isn't being watched by the user.

getWatch

public Watch getWatch(User user,
                      ForumThread thread)
Description copied from interface: WatchManager
Returns a watch on a particular thread, or null if there isn't a watch.

Specified by:
getWatch in interface WatchManager
Parameters:
user - the user with the watch.
thread - the thread being watched.
Returns:
the Watch or null if the thread isn't being watched by the user.

getWatch

public Watch getWatch(User user,
                      Forum forum)
Description copied from interface: WatchManager
Returns a watch on a particular forum, or null if there isn't a watch.

Specified by:
getWatch in interface WatchManager
Parameters:
user - the user with the watch.
forum - the forum being watched.
Returns:
the Watch or null if the forum isn't being watched by the user..

getWatch

public Watch getWatch(User user,
                      ForumCategory category)
Description copied from interface: WatchManager
Returns a watch on a particular category, or null if there isn't a watch.

Specified by:
getWatch in interface WatchManager
Parameters:
user - the user with the watch.
category - the category being watched.
Returns:
the Watch or null if the category isn't being watched by the user..

isWatched

public boolean isWatched(User user,
                         ForumCategory category)
Description copied from interface: WatchManager
Returns true if the user is watching the specified category.

Specified by:
isWatched in interface WatchManager
Parameters:
user - the User watching the object.
category - the category to check.
Returns:
true if the object is being watched by the user, false otherwise.

isWatched

public boolean isWatched(User user,
                         Forum forum)
Description copied from interface: WatchManager
Returns true if the user is watching the specified forum.

Specified by:
isWatched in interface WatchManager
Parameters:
user - the User watching the object.
forum - the forum to check.
Returns:
true if the object is being watched by the user, false otherwise.

isWatched

public boolean isWatched(User user,
                         ForumThread thread)
Description copied from interface: WatchManager
Returns true if the user is watching the specified thread.

Specified by:
isWatched in interface WatchManager
Parameters:
user - the User watching the object.
thread - the thread to check.
Returns:
true if the object is being watched by the user, false otherwise.

isWatched

public boolean isWatched(User user,
                         User watchedUser)
Description copied from interface: WatchManager
Returns true if the user is watching the specified user.

Specified by:
isWatched in interface WatchManager
Parameters:
user - the User watching the object.
watchedUser - the user to check.
Returns:
true if the object is being watched by the user, false otherwise.

deleteWatch

public void deleteWatch(Watch watch)
Description copied from interface: WatchManager
Delete the specified watch.

Specified by:
deleteWatch in interface WatchManager
Parameters:
watch - the watch to delete.

deleteWatches

public void deleteWatches(int objectType,
                          long objectID)

deleteThreadWatches

public void deleteThreadWatches(long forumID)
Deletes all thread watches in a specific forum.

Parameters:
forumID - the forum.

deleteWatches

public void deleteWatches(User user)
Description copied from interface: WatchManager
Deletes all watches that a user has.

Specified by:
deleteWatches in interface WatchManager
Parameters:
user - the user.

notifyWatchUpdate

public void notifyWatchUpdate(ForumMessage message)

getWatchers

public java.util.Iterator getWatchers(int objectType,
                                      long objectID)
Returns an Iterator of User objects who are watching the specified object.

Specified by:
getWatchers in interface WatchManager
Parameters:
objectType - the object type.
objectID - the object ID.
Returns:
the Iterator of Users watchin the object.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.