mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Added a removeRating method to the RatingService JS API.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21163 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -104,6 +104,17 @@ public class ScriptRatingService extends BaseScopableProcessorExtension
|
||||
ratingService.applyRating(node.getNodeRef(), rating, ratingSchemeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes any rating by the current user in the specified scheme from the specified
|
||||
* noderef.
|
||||
* @param node
|
||||
* @param ratingSchemeName
|
||||
*/
|
||||
public void removeRating(ScriptNode node, String ratingSchemeName)
|
||||
{
|
||||
ratingService.removeRatingByCurrentUser(node.getNodeRef(), ratingSchemeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rating applied to the specified node in the specified scheme by
|
||||
* the currently authenticated user.
|
||||
|
@@ -12,7 +12,7 @@ function testRatingSchemes()
|
||||
test.assertEquals(5, ratingService.getMax('fiveStarRatingScheme'));
|
||||
}
|
||||
|
||||
function testApplyAndGetRatings()
|
||||
function testApplyUpdateDeleteRatings()
|
||||
{
|
||||
// Check the pristine state of the test node.
|
||||
test.assertEquals(0, ratingService.getRatingsCount(testNode, 'fiveStarRatingScheme'));
|
||||
@@ -39,8 +39,13 @@ function testApplyAndGetRatings()
|
||||
test.assertEquals(1, ratingService.getRatingsCount(testNode, 'fiveStarRatingScheme'));
|
||||
test.assertEquals(4.5, ratingService.getTotalRating(testNode, 'fiveStarRatingScheme'));
|
||||
test.assertEquals(4.5, ratingService.getAverageRating(testNode, 'fiveStarRatingScheme'));
|
||||
|
||||
|
||||
// Now delete them.
|
||||
ratingService.removeRating(testNode, 'fiveStarRatingScheme');
|
||||
test.assertEquals(-1, ratingService.getRating(testNode, 'fiveStarRatingScheme'));
|
||||
}
|
||||
|
||||
// Execute tests
|
||||
testRatingSchemes();
|
||||
testApplyAndGetRatings();
|
||||
testApplyUpdateDeleteRatings();
|
||||
|
Reference in New Issue
Block a user