|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.forum.database.DbRewardManager
public class DbRewardManager
Database implementation of the RewardManager interface. A user's point total is stored the jiveUserReward database table. Points values are also maintained in the thread and message tables. Although storing values in all three places isn't ideal in a relational sense, it's necessary to make speed tolerable.
For auditing purposes, points awards are recorded in a special database table which tracks the ID of the user receiving the points, the amount of points awarded, and a timestamp. Optionally, the thread and message IDs are stored. This schema allows us to track normal point awards as well as when administrators assigning arbitrary point values.
To customize the max number of reward points that can be set for a thread, adjust the Jive property rewards.maxPoints.
Constructor Summary | |
---|---|
DbRewardManager()
|
Method Summary | |
---|---|
void |
addBankPoints(int numPoints)
Allows administrators to add or substract an arbitrary number of reward points from all user's point banks. |
void |
addBankPoints(User user,
int numPoints)
Allows administrators to add or substract an arbitrary number of reward points from a user's point bank. |
void |
forumAdded(ForumEvent event)
Fired when a forum has been added to the system. |
void |
forumDeleted(ForumEvent event)
Fired when a forum is about to be deleted from the system. |
void |
forumMerged(ForumEvent event)
Fired when a forum is merged into another forum. |
void |
forumModified(ForumEvent event)
Fired when a forum is modified. |
void |
forumMoved(ForumEvent event)
Fired when a forum has been moved from one category to another. |
int |
getBankPoints(User user)
Returns the current number of reward points a user has. |
int |
getInitialBankPoints()
Returns the number of bank points a user will start with. |
int |
getMaxBankPoints()
Returns the max number of points that can accumulate in a bank account, or -1 if there is no max. |
int |
getMaxMessagePoints()
Returns the maximum number of reward points that can be assigned to a message. |
int |
getMaxThreadPoints()
Returns the maximum number of reward points that can be assigned to a thread. |
java.util.Iterator |
getPendingRewardThreads(User user)
Returns the threads (ordered by modified date) that the user has assigned points to that haven't been fully rewarded out yet. |
int |
getPendingRewardThreadsCount(User user)
Returns a count of the threads that the user has assigned points to that haven't been fully rewarded out yet. |
int |
getPoints(ForumMessage message)
Returns the number of reward points that have been assigned to a message. |
int |
getPoints(ForumThread thread)
Returns the number of reward points in a thread that are left to be distributed. |
int |
getPointsEarned(User user)
Returns the total number of points that a user has earned across the entire system. |
int |
getPointsEarned(User user,
Forum forum)
Returns the total number of points the user has earned in a particular forum. |
int |
getPointsEarned(User user,
ForumCategory category)
Returns the total number of points the user has earned in a particular category. |
int |
getPointsRewarded(ForumThread thread)
Returns the total number of points rewarded to messages in the thread. |
int |
getPointsRewarded(User user)
Returns the total number of points that a user has ever rewarded. |
java.util.Iterator |
getTopUsers(int startIndex,
int numResults)
Returns an iterator for the top point earners in the entire system. |
java.util.Iterator |
getTopUsers(int startIndex,
int numResults,
Forum forum)
Returns an iterator for the top point earners in a forum. |
java.util.Iterator |
getTopUsers(int startIndex,
int numResults,
ForumCategory category)
Returns an iterator for the top point earners in a category. |
boolean |
isBankEnabled()
Returns true if bank points are enabled. |
boolean |
isRewardsEnabled()
Returns true if rewards are enabled, false otherwise. |
void |
messageAdded(MessageEvent event)
Fired when a message has been added to the system. |
void |
messageDeleted(MessageEvent event)
Fired when a message is about to be deleted from the system. |
void |
messageModerationModified(MessageEvent event)
Fired when the moderation value of a message has been changed. |
void |
messageModified(MessageEvent event)
Fired when portions of a message have been modified. |
void |
messageMoved(MessageEvent event)
Fired when a message is moved to another thread. |
void |
messageRated(MessageEvent event)
Fired when a message has been rated. |
void |
rewardPoints(ForumMessage message,
int numPoints)
Rewards a message with points from the thread that the message belongs to. |
void |
setBankEnabled(boolean bankEnabled)
Toggles bank points to enabled or disabled. |
void |
setInitialBankPoints(int initialBankPoints)
Sets the number of bank points a user will start with. |
void |
setMaxBankPoints(int maxBankPoints)
Sets the max number of points that can accumulate in a bank account. |
void |
setMaxMessagePoints(int numPoints)
Sets the maximum number of reward points that can be assigned to a message. |
void |
setMaxThreadPoints(int numPoints)
Sets the maximum number of reward points that can be assigned to a thread. |
void |
setRewardsEnabled(boolean enabled)
Enables or disables the rewards feature. |
void |
threadAdded(ThreadEvent event)
Fired when a thread has been added to the system. |
void |
threadDeleted(ThreadEvent event)
Fired when a thread is about to be deleted from the system. |
void |
threadModerationModified(ThreadEvent event)
Fired when the moderation value of a thread has been changed. |
void |
threadMoved(ThreadEvent event)
Fired when a thread is moved from one foru to another. |
void |
threadRated(ThreadEvent event)
Fired when the thread has been rated. |
void |
transferPoints(ForumThread thread,
int numPoints)
Transfers the specified number of points to the thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbRewardManager()
Method Detail |
---|
public boolean isRewardsEnabled()
RewardManager
isRewardsEnabled
in interface RewardManager
public void setRewardsEnabled(boolean enabled)
RewardManager
setRewardsEnabled
in interface RewardManager
enabled
- true to enable rewards, false otherwise.public int getMaxThreadPoints()
RewardManager
getMaxThreadPoints
in interface RewardManager
public void setMaxThreadPoints(int numPoints)
RewardManager
setMaxThreadPoints
in interface RewardManager
numPoints
- the max number of reward points that can be assigned to
a thread, or -1 if there is no max.public int getMaxMessagePoints()
RewardManager
getMaxMessagePoints
in interface RewardManager
public void setMaxMessagePoints(int numPoints) throws UnauthorizedException
RewardManager
setMaxMessagePoints
in interface RewardManager
numPoints
- the max number of reward points that can be assigned to
a message, or -1 if there is no max.
UnauthorizedException
public void transferPoints(ForumThread thread, int numPoints) throws RewardException
RewardManager
transferPoints
in interface RewardManager
thread
- the thread to transfer points to.numPoints
- the number of points to transfer.
RewardException
public void rewardPoints(ForumMessage message, int numPoints) throws RewardException
RewardManager
rewardPoints
in interface RewardManager
message
- the message receiving the reward.numPoints
- the number of points to reward the message with.
RewardException
- if one of the necessary conditions for this
method to execute is not met.public int getPoints(ForumThread thread)
RewardManager
RewardManager.getMaxThreadPoints()
- RewardManager.getPointsRewarded(ForumThread)
.
getPoints
in interface RewardManager
thread
- the thread.
public int getPointsRewarded(ForumThread thread)
RewardManager
RewardManager.getMaxThreadPoints()
- RewardManager.getPoints(ForumThread)
.
getPointsRewarded
in interface RewardManager
thread
- the thread.
public int getPoints(ForumMessage message)
RewardManager
getPoints
in interface RewardManager
message
- the message.
public boolean isBankEnabled()
RewardManager
isBankEnabled
in interface RewardManager
public void setBankEnabled(boolean bankEnabled) throws UnauthorizedException
RewardManager
setBankEnabled
in interface RewardManager
bankEnabled
- true if bank points should be enabled; false otherwise.
UnauthorizedException
public int getBankPoints(User user)
RewardManager
getBankPoints
in interface RewardManager
user
- the user.
public void addBankPoints(User user, int numPoints)
RewardManager
RewardManager.getMaxBankPoints()
and will never be less than 0.
addBankPoints
in interface RewardManager
user
- the user to give points to.numPoints
- the number of points to put in the user's bank, which can be
negative.public void addBankPoints(int numPoints) throws UnauthorizedException
RewardManager
RewardManager.getMaxBankPoints()
and will never be less than 0.
addBankPoints
in interface RewardManager
numPoints
- the bank points value.
UnauthorizedException
- if not the system administrator.public int getInitialBankPoints()
RewardManager
getInitialBankPoints
in interface RewardManager
public void setInitialBankPoints(int initialBankPoints)
RewardManager
setInitialBankPoints
in interface RewardManager
initialBankPoints
- the initial bank points.public int getMaxBankPoints()
RewardManager
getMaxBankPoints
in interface RewardManager
public void setMaxBankPoints(int maxBankPoints) throws UnauthorizedException
RewardManager
setMaxBankPoints
in interface RewardManager
maxBankPoints
- the max size the bank account can grow to, or -1 if there
is no limit.
UnauthorizedException
- if not the system administrator.public int getPointsRewarded(User user)
RewardManager
Points are not considered rewarded until they are actually transferred from a thread to
getPointsRewarded
in interface RewardManager
user
- the user.
public int getPointsEarned(User user)
RewardManager
getPointsEarned
in interface RewardManager
user
- the user.
public int getPointsEarned(User user, Forum forum)
RewardManager
getPointsEarned
in interface RewardManager
user
- the user.forum
- the forum.
public int getPointsEarned(User user, ForumCategory category)
RewardManager
getPointsEarned
in interface RewardManager
user
- the user.category
- the category.
public java.util.Iterator getTopUsers(int startIndex, int numResults)
RewardManager
getTopUsers
in interface RewardManager
startIndex
- the starting index in the results list (0 to start
at the beginning of the list).numResults
- the number of results to return.
public java.util.Iterator getTopUsers(int startIndex, int numResults, ForumCategory category)
RewardManager
getTopUsers
in interface RewardManager
startIndex
- the starting index in the results list (0 to start
at the beginning of the list).numResults
- the number of results to return.category
- the category.
public java.util.Iterator getTopUsers(int startIndex, int numResults, Forum forum)
RewardManager
getTopUsers
in interface RewardManager
startIndex
- the starting index in the results list (0 to start
at the beginning of the list).numResults
- the number of results to return.forum
- the forum.
public int getPendingRewardThreadsCount(User user)
RewardManager
getPendingRewardThreadsCount
in interface RewardManager
user
- the user.
public java.util.Iterator getPendingRewardThreads(User user)
RewardManager
getPendingRewardThreads
in interface RewardManager
user
- the user.
public void forumAdded(ForumEvent event)
ForumListener
forumAdded
in interface ForumListener
event
- the event object.public void forumDeleted(ForumEvent event)
ForumListener
forumDeleted
in interface ForumListener
event
- the event object.public void forumMoved(ForumEvent event)
ForumListener
forumMoved
in interface ForumListener
event
- the event object.public void forumModified(ForumEvent event)
ForumListener
forumModified
in interface ForumListener
event
- the event object.public void forumMerged(ForumEvent event)
ForumListener
forumMerged
in interface ForumListener
event
- the event object.public void threadAdded(ThreadEvent event)
ThreadListener
threadAdded
in interface ThreadListener
event
- the event object.public void threadDeleted(ThreadEvent event)
ThreadListener
threadDeleted
in interface ThreadListener
event
- the event object.public void threadMoved(ThreadEvent event)
ThreadListener
threadMoved
in interface ThreadListener
event
- the event object.public void threadModerationModified(ThreadEvent event)
ThreadListener
threadModerationModified
in interface ThreadListener
event
- the event object.public void threadRated(ThreadEvent event)
ThreadListener
threadRated
in interface ThreadListener
event
- the event object.public void messageAdded(MessageEvent event)
MessageListener
messageAdded
in interface MessageListener
event
- the event object.public void messageDeleted(MessageEvent event)
MessageListener
messageDeleted
in interface MessageListener
event
- the event object.public void messageModified(MessageEvent event)
MessageListener
messageModified
in interface MessageListener
event
- the event object.public void messageModerationModified(MessageEvent event)
MessageListener
messageModerationModified
in interface MessageListener
event
- the event object.public void messageRated(MessageEvent event)
MessageListener
messageRated
in interface MessageListener
event
- the event object.public void messageMoved(MessageEvent event)
MessageListener
messageMoved
in interface MessageListener
event
- the event object.
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |