Rating Service. Added DELETE webscript and fixed bug.

There is now a rating.delete webscript.
  Plus a bug was fixed where the ratings weren't actually being deleted.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21161 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2010-07-14 13:28:46 +00:00
parent 9dde9b2ab5
commit f41389f6b9
2 changed files with 8 additions and 0 deletions

View File

@@ -268,6 +268,10 @@ public class RatingServiceImpl implements RatingService
{
// There is a rating and the associated data are at the index'th place in each property.
RatingStruct removed = ratingProps.removeRatingAt(index);
// Now apply the properties with one deleted.
Map<QName, Serializable> props = ratingProps.toNodeProperties();
nodeService.setProperties(lastChild.getChildRef(), props);
return new Rating(this.getRatingScheme(removed.getScheme()),
removed.getScore(), user, removed.getDate());

View File

@@ -276,6 +276,10 @@ public class RatingServiceIntegrationTest extends BaseAlfrescoSpringTest
assertEquals("Wrong score for rating", updatedFiveStarScore, deletedStarRating.getScore());
assertEquals("Wrong user for rating", AuthenticationUtil.getFullyAuthenticatedUser(), deletedStarRating.getAppliedBy());
assertEquals("Wrong date for rating", updatedFiveStarRating.getAppliedAt(), deletedStarRating.getAppliedAt());
// And the deleted ratings should be gone.
assertNull("5* rating not null.", ratingService.getRatingByCurrentUser(testDoc_Admin, FIVE_STAR_SCHEME_NAME));
assertNull("likes rating not null", ratingService.getRatingByCurrentUser(testDoc_Admin, LIKES_SCHEME_NAME));
}
/**