mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Rating Service Part 2.
Users can't rate their own content any more. Added a RunAs(System) so that users can rate content they don't own, which is all they can rate! First stab at adding rating totals, means and counts - to be tidied tomorrow. Miscellaneous improvements & doc'ing. Tests for the above. Refactored existing tests to run as different users (all were running as admin previously). git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21013 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -26,7 +26,18 @@ import org.alfresco.service.PublicService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* The Rating service. TODO
|
||||
* Interface for public and internal rating operations.
|
||||
* <p/>
|
||||
* The RatingService can be used to manage ratings on any content node in the repository.
|
||||
* These ratings are defined by {@link RatingScheme rating schemes}
|
||||
* which are injected via spring (see <code>rating-service-context.xml</code>). The rating
|
||||
* schemes define a minimum and a maximum score value for that scheme.
|
||||
* <p/>
|
||||
* Ratings can be {@link RatingService#applyRating(NodeRef, int, String) applied},
|
||||
* {@link RatingService#applyRating(NodeRef, int, String) updated} and
|
||||
* {@link RatingService#removeRatingByCurrentUser(NodeRef, RatingScheme) removed}.
|
||||
*
|
||||
* TODO Get average/total
|
||||
*
|
||||
* @author Neil McErlean
|
||||
* @since 3.4
|
||||
@@ -68,6 +79,24 @@ public interface RatingService
|
||||
@NotAuditable
|
||||
void applyRating(NodeRef targetNode, int rating, String ratingSchemeName) throws RatingServiceException;
|
||||
|
||||
/**
|
||||
* This method gets the number of individual ratings which have been applied to
|
||||
* the specified node in the specified {@link RatingScheme}.
|
||||
*
|
||||
* @param targetNode the node on which the rating is sought.
|
||||
* @param ratingScheme the rating scheme to use.
|
||||
*
|
||||
* @return the number of individual ratings applied to this node.
|
||||
* @see RatingService#getRatingSchemes()
|
||||
* @see RatingScheme
|
||||
*/
|
||||
@NotAuditable
|
||||
int getRatingsCount(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
int getTotalRating(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
float getAverageRating(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
/**
|
||||
* This method gets the {@link Rating} applied by the current user to the specified node in the specified
|
||||
* {@link RatingScheme} - if there is one.
|
||||
@@ -80,10 +109,7 @@ public interface RatingService
|
||||
* @see RatingScheme
|
||||
*/
|
||||
@NotAuditable
|
||||
|
||||
// TODO Get average/total ratings on node
|
||||
|
||||
Rating getRatingByCurrentUser(NodeRef targetNode, RatingScheme ratingScheme);
|
||||
Rating getRatingByCurrentUser(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
/**
|
||||
* This method removes any {@link Rating} applied by the current user to the specified node in the specified
|
||||
@@ -97,5 +123,5 @@ public interface RatingService
|
||||
* @see RatingScheme
|
||||
*/
|
||||
@NotAuditable
|
||||
Rating removeRatingByCurrentUser(NodeRef targetNode, RatingScheme ratingScheme);
|
||||
Rating removeRatingByCurrentUser(NodeRef targetNode, String ratingSchemeName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user