Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface WatchManager

All Superinterfaces:
JiveManager

public interface WatchManager
extends JiveManager

Manages watches on communities, forums, and threads. A watch is a way for a user to track updates to an object. Users add watches on individual objects and can specify whether or not they want to be notified by email each time the object is updated.

Because the number of watches could build up and overload the system over time, watches are automatically deleted after the objects they are attached to are inactive for a certain number of days or if the object expires. Individual watches can be toggled to be undeletable so that it is possible to circumvent this behavior.


Method Summary
 Watch createWatch(User user, JiveObject jiveObject)
          Create a watch on a jive object for the specified user.
 void deleteSettings(User user)
          Delete the watch settings for a user
 void deleteWatch(Watch watch)
          Delete the specified watch.
 void deleteWatches(User user)
          Deletes all watches that a user has.
<A extends JiveObject>
java.lang.Iterable<A>
getAllWatches(User user)
          Returns an iterable for all objects that a user is watching.
<A extends JiveObject>
java.lang.Iterable<A>
getAllWatches(User user, int objectType)
          Returns an iterable 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.
 com.jivesoftware.community.impl.dao.WatchSettingsBean getSettings(User user)
          Retrieve a watch settings for the given user
 int getTotalWatchCount(User user)
          Returns a count of all watches that a user has for all types.
 int getTotalWatchCount(User user, int objectType)
          Returns a count of all watches that a user has of a particular type.
 Watch getWatch(User user, JiveObject jiveObject)
          Returns a watch on a particular JiveObject, or null if there isn't a watch.
 int getWatchCount(User user, Community community)
          Return the count of all forum watches in a particular community for the given user.
 JiveIterator<JiveObject> getWatches(User user, Community community)
          Returns an Iterable for all the Community objects a user is watching in a community.
 java.util.List<Watch> getWatchList(User user, int objectType)
          Returns an array of Watch objects for a particular object type that the given user is watching.
 java.lang.Iterable<User> getWatchUsers(int objectType, long objectID, int watchType)
          Returns all the users watching a specific objectType, objectID, and watchType.
 boolean isWatched(User user, JiveObject jiveObject)
          Returns true if the user is watching the specified jive object.
 void saveSettings(User user, com.jivesoftware.community.impl.dao.WatchSettingsBean settings)
          Save the watch settings for a user
 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 interface com.jivesoftware.community.JiveManager
destroy, initialize
 

Method Detail

getDeleteDays

int getDeleteDays()
Returns the number of days that a watched object can remain inactive before watches on that object are deleted.

Returns:
the number of days a watched object can be inactive before watches on it are deleted.

setDeleteDays

void setDeleteDays(int deleteDays)
                   throws UnauthorizedException
Sets the number of days that a watched object can remain inactive before watches on that object are deleted.

Parameters:
deleteDays - the number days a watch can be inactive before being automatically deleted.
Throws:
UnauthorizedException - if not a system admin.

createWatch

Watch createWatch(User user,
                  JiveObject jiveObject)
                  throws UnauthorizedException
Create a watch on a jive object for the specified user. People watching jive objects will receive notifications when comments are created against them.

Parameters:
user - the user to set the watch for.
jiveObject - the jive object to create a watch on.
Returns:
the created watch.
Throws:
UnauthorizedException - if not an admin or the user.

getWatchCount

int getWatchCount(User user,
                  Community community)
                  throws UnauthorizedException
Return the count of all forum watches in a particular community for the given user.

Parameters:
user - the user to return the watch count for.
community - the community to return the watch count for.
Returns:
the count of forum watches for a user in a given community.
Throws:
UnauthorizedException - if not a system admin or the user.

getTotalWatchCount

int getTotalWatchCount(User user,
                       int objectType)
                       throws UnauthorizedException
Returns a count of all watches that a user has of a particular type. Valid object types are:

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.
Throws:
UnauthorizedException - if not a system admin or the user.

getTotalWatchCount

int getTotalWatchCount(User user)
                       throws UnauthorizedException
Returns a count of all watches that a user has for all types. Valid object types are:

Parameters:
user - the user to get the watch count for.
Returns:
the total number of watches that a user has.
Throws:
UnauthorizedException - if not a system admin or the user.

getWatchList

java.util.List<Watch> getWatchList(User user,
                                   int objectType)
Returns an array of Watch objects for a particular object type that the given user is watching. Valid objectType's are:

Parameters:
user - the user to retrieve watches for
objectType - the object type.
Returns:
the user's watch list corresponding to an object type.

getAllWatches

<A extends JiveObject> java.lang.Iterable<A> getAllWatches(User user,
                                                           int objectType)
                                                       throws UnauthorizedException
Returns an iterable for all objects of a particular type that a user is watching. Valid objecttypes are:

Parameters:
user - the user.
objectType - the object type.
Returns:
an iterable for all objects of type objectType that a user is watching.
Throws:
UnauthorizedException - if not a system admin or the user.

getAllWatches

<A extends JiveObject> java.lang.Iterable<A> getAllWatches(User user)
                                                       throws UnauthorizedException
Returns an iterable for all objects that a user is watching. Possible objecttypes that may be returned are:

Parameters:
user - the user.
Returns:
an iterable for all objects that a user is watching.
Throws:
UnauthorizedException - if not a system admin or the user.

getWatches

JiveIterator<JiveObject> getWatches(User user,
                                    Community community)
                                    throws UnauthorizedException
Returns an Iterable for all the Community objects a user is watching in a community.

Parameters:
user - the user.
community - the community.
Returns:
an iterable for all the forums a user is watching in a community.
Throws:
UnauthorizedException - if not a system admin or the user.

getWatch

Watch getWatch(User user,
               JiveObject jiveObject)
Returns a watch on a particular JiveObject, or null if there isn't a watch.

Parameters:
user - the user with the watch.
jiveObject - the jive object being watched.
Returns:
the Watch or null if the jive object isn't being watched by the user.

getWatchUsers

java.lang.Iterable<User> getWatchUsers(int objectType,
                                       long objectID,
                                       int watchType)
Returns all the users watching a specific objectType, objectID, and watchType.

Parameters:
objectType - the type of object being watched.
objectID - the ID of the object being watched.
watchType - the type of watch.
Returns:
the users who are watching.

isWatched

boolean isWatched(User user,
                  JiveObject jiveObject)
Returns true if the user is watching the specified jive object.

Parameters:
user - the user watching the object.
jiveObject - The jive object to check.
Returns:
true if the jive object is being watched by the user, false otherwise.

deleteWatch

void deleteWatch(Watch watch)
                 throws UnauthorizedException
Delete the specified watch.

Parameters:
watch - the watch to delete.
Throws:
UnauthorizedException - if not a system admin or the user owning the watch.

deleteWatches

void deleteWatches(User user)
                   throws UnauthorizedException
Deletes all watches that a user has.

Parameters:
user - the user.
Throws:
UnauthorizedException - if not a system admin or the user owning the watch.

getSettings

com.jivesoftware.community.impl.dao.WatchSettingsBean getSettings(User user)
Retrieve a watch settings for the given user

Parameters:
user - the user to return a watch settings object for
Returns:
a WatchSettings object for the given user

saveSettings

void saveSettings(User user,
                  com.jivesoftware.community.impl.dao.WatchSettingsBean settings)
Save the watch settings for a user

Parameters:
user - the user to save the watch settings for
settings - the watch settings to save

deleteSettings

void deleteSettings(User user)
Delete the watch settings for a user

Parameters:
user - the user to delete the watch settings for

Clearspace Project Page

Copyright © 1999-2007 Jive Software.