|
Clearspace API (2.5.29) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface RatingManager
Provides optional rating of JiveContentObjects. This feature is optional in that other
Jive classes do not call this API. Instead, the UI layer must explicitly
check to see if a JiveContentObject is rated or unrated by any particular user and display
rating options as appropriate.
An example usage to give a rating to a JiveContentObject is as follows:
RatingManager manager = factory.getRatingManager(); Iterableratings = manager.getAvailableRatings(); ... (user chooses via a webpage or another mechanism a specific rating for a JiveContentObject) Rating rating = manager.getRating(3); // the chosen rating of the user with a score of 3 ForumMessage message = factory.getMessage(messageID); manager.addRating(user, message, rating); ...
Rating| Method Summary | |
|---|---|
void |
addRating(User user,
JiveObject contentObject,
Rating rating)
Add a rating to the JiveContentObject. |
boolean |
canRate(User user,
JiveObject contentObject)
Returns whether the user can rate the JiveContentObject or not. |
Rating |
createRating(int score,
String description)
Create a new rating with the specified attributes. |
void |
deleteUserRatings(User user)
Remove all ratings associated with the given user. |
int |
getAvailableRatingCount()
Returns the count of currently available ratings. |
Iterable<Rating> |
getAvailableRatings()
Returns an iterable of Rating objects that list all the available ratings. |
double |
getMeanRating(JiveObject contentObject)
A convenience method which returns a geometric mean average of all the ratings given to the JiveContentObject. |
Rating |
getRating(User user,
JiveObject contentObject)
Returns the rating associated with the user, or null if this user hasn't rated the JiveContentObject. |
int |
getRatingCount(JiveObject contentObject)
Returns the total number of ratings given to the JiveContentObject. |
Rating |
getRatingFromScore(int score)
Retrieve the rating with the specified score. |
Iterable<Rating> |
getRatings(JiveObject contentObject)
Returns an Iterable of all the ratings given to the JiveContentObject. |
boolean |
hasRated(User user,
JiveObject contentObject)
Returns whether the user has rated the JiveContentObject or not. |
boolean |
isRatingsEnabled()
Returns true if the rating feature is turned on. |
void |
removeAllRatings(JiveObject contentObject)
Remove all ratings from the specified content object |
void |
removeRating(Rating rating)
Remove the specified rating from the list of currently available ratings. |
void |
removeRating(User user,
JiveObject contentObject)
Removes a rating to the JiveContentObject. |
void |
setRatingsEnabled(boolean ratingsEnabled)
Enables or disables the ratings feature. |
| Methods inherited from interface com.jivesoftware.community.JiveManager |
|---|
destroy |
| Method Detail |
|---|
boolean isRatingsEnabled()
void setRatingsEnabled(boolean ratingsEnabled)
throws UnauthorizedException
ratingsEnabled - true to enable the rating feature, false to disable
UnauthorizedException - if not a system administratorIterable<Rating> getAvailableRatings()
int getAvailableRatingCount()
Rating getRatingFromScore(int score)
score - the score of the rating to retrieve
Rating createRating(int score,
String description)
throws UnauthorizedException
score - the score or rating level for the new ratingdescription - the description of the new rating
UnauthorizedException - if not a system administrator
void removeRating(Rating rating)
throws UnauthorizedException
rating - the Rating to remove
UnauthorizedException - if not a system administrator
void deleteUserRatings(User user)
throws UnauthorizedException
user - the User associated with the ratings being deleted.
UnauthorizedException - if not a system administrator or user administratorIterable<Rating> getRatings(JiveObject contentObject)
JiveContentObject.
contentObject - the JiveContentObject to return ratings for
JiveContentObjectint getRatingCount(JiveObject contentObject)
JiveContentObject.
contentObject - the JiveContentObject to return a rating count for
JiveContentObject.double getMeanRating(JiveObject contentObject)
JiveContentObject.
contentObject - the JiveContentObject to return a mean rating for
JiveContentObject.
boolean canRate(User user,
JiveObject contentObject)
JiveContentObject or not.
user - the user to checkcontentObject - the JiveContentObject to check
JiveContentObject, false
otherwise.
boolean hasRated(User user,
JiveObject contentObject)
JiveContentObject or not. This method will
always return false if the user is anonymous.
user - the user to checkcontentObject - the JiveContentObject to check
JiveContentObject, false
otherwise. If the user is anonymous (null) this method will always return false.
Rating getRating(User user,
JiveObject contentObject)
JiveContentObject. If the user is null (anonymous) this method will return null.
user - the user to checkcontentObject - the JiveContentObject to check
JiveContentObject, or null if the user has not rated
the JiveContentObject or the user is anonymous.
void addRating(User user,
JiveObject contentObject,
Rating rating)
throws UnauthorizedException
JiveContentObject. If the user has already rated, this rating will replace
the previous rating. If the user is null (anonymous) this rating will be added to
the ratings for the JiveContentObject.
The author of the JiveContentObject cannot rate their own content.
user - the user rating the JiveContentObjectcontentObject - the JiveContentObject to add the rating torating - the rating the user wants to give to the JiveContentObject
UnauthorizedException - if user does not have permissions
void removeRating(User user,
JiveObject contentObject)
throws UnauthorizedException
JiveContentObject.
user - the user rating the JiveContentObjectcontentObject - the JiveContentObject to remove the rating from
UnauthorizedException - if not a system administrator
void removeAllRatings(JiveObject contentObject)
throws UnauthorizedException
contentObject - the JiveContentObject to remove ratings from
UnauthorizedException - if not a system administrator
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||