Rating Service. Now limited to one rating scheme per user per node.

Without an explicit requirement for multiple rating schemes being applied to a node by a user and in order to simplify
the code and ease maintenance, the RatingService now only supports one rating scheme per node per user.
A rating can be applied, removed and a new rating in another scheme applied. But if the first is not removed, an exception will be thrown by the service.

This change was a simple edit in the model with changes to the service implementation and test code.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21585 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2010-08-04 07:44:07 +00:00
parent f2c0221855
commit 87a95e7e8d
7 changed files with 150 additions and 604 deletions

View File

@@ -26,6 +26,7 @@ import org.alfresco.repo.jscript.ScriptNode;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.rating.Rating;
import org.alfresco.service.cmr.rating.RatingService;
import org.alfresco.service.cmr.rating.RatingServiceException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -92,10 +93,13 @@ public class ScriptRatingService extends BaseScopableProcessorExtension
* Applies the given rating to the specified node using the specified ratingScheme.
* It is the responsibility of the caller to ensure that the rating scheme exists
* and that the rating is within the limits defined for that scheme.
* <p/>Furthermore, only one rating scheme per user per target node is supported. Any attempt
* by one user to apply a second rating in a different scheme will result in a {@link RatingServiceException}.
*
* @param node
* @param rating
* @param ratingSchemeName
* @throws RatingServiceException
* @see ScriptRatingService#getMin(String)
* @see ScriptRatingService#getMax(String)
*/