Class DefaultRatingService
- java.lang.Object
-
- org.silverpeas.core.contribution.rating.service.DefaultRatingService
-
- All Implemented Interfaces:
ComponentInstanceDeletion
,RatingService
@Singleton @Service public class DefaultRatingService extends Object implements RatingService, ComponentInstanceDeletion
-
-
Constructor Summary
Constructors Constructor Description DefaultRatingService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance.void
deleteComponentRatings(String componentInstanceId)
Remove all resources notations of given appvoid
deleteRaterRating(RaterRatingPK pk)
Remove rater rating of identified resourcevoid
deleteRating(ContributionRatingPK pk)
Remove all notations of identified resourceContributionRating
getRating(SilverpeasContent contribution)
Getting notation about the given contribution.ContributionRating
getRating(ContributionRatingPK pk)
Getting notation about once given resource identified by its PK.Map<String,ContributionRating>
getRatings(SilverpeasContent... contributions)
Getting notation about the given contributions.boolean
hasUserRating(RaterRatingPK pk)
Checking if user has given a rating on this resourcevoid
moveRating(ContributionRatingPK pk, String componentInstanceId)
Remove all notations of identified resource to the specified component instance identifier.void
updateRating(RaterRatingPK pk, int note)
Save user notation.
-
-
-
Method Detail
-
delete
public void delete(String componentInstanceId)
Description copied from interface:ComponentInstanceDeletion
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
updateRating
public void updateRating(RaterRatingPK pk, int note)
Description copied from interface:RatingService
Save user notation. Create it or update it if it already exists.- Specified by:
updateRating
in interfaceRatingService
- Parameters:
pk
- identifying the rated resource and the raternote
- the rate given to this resource by the user
-
moveRating
public void moveRating(ContributionRatingPK pk, String componentInstanceId)
Description copied from interface:RatingService
Remove all notations of identified resource to the specified component instance identifier.- Specified by:
moveRating
in interfaceRatingService
- Parameters:
pk
- identifying the resourcecomponentInstanceId
- the target component identified by its instance id.
-
deleteRating
public void deleteRating(ContributionRatingPK pk)
Description copied from interface:RatingService
Remove all notations of identified resource- Specified by:
deleteRating
in interfaceRatingService
- Parameters:
pk
- identifying the resource
-
deleteRaterRating
public void deleteRaterRating(RaterRatingPK pk)
Description copied from interface:RatingService
Remove rater rating of identified resource- Specified by:
deleteRaterRating
in interfaceRatingService
- Parameters:
pk
- identifying the resource and the rater
-
deleteComponentRatings
public void deleteComponentRatings(String componentInstanceId)
Description copied from interface:RatingService
Remove all resources notations of given app- Specified by:
deleteComponentRatings
in interfaceRatingService
- Parameters:
componentInstanceId
- identitier of the component instance.
-
getRatings
public Map<String,ContributionRating> getRatings(SilverpeasContent... contributions)
Description copied from interface:RatingService
Getting notation about the given contributions. If a contribution has no notation, aContributionRating
instance is returned anyway.- Specified by:
getRatings
in interfaceRatingService
- Parameters:
contributions
- the contributions which returned ratings must be attached.- Returns:
ContributionRating
instances ralated to the given contributions indexed by contribution identifier.
-
getRating
public ContributionRating getRating(SilverpeasContent contribution)
Description copied from interface:RatingService
Getting notation about the given contribution. If the contribution has no notation, aContributionRating
instance is returned anyway.- Specified by:
getRating
in interfaceRatingService
- Parameters:
contribution
- the contribution which returned ratings must be attached.- Returns:
ContributionRating
instance ralated to the given contribution.
-
getRating
public ContributionRating getRating(ContributionRatingPK pk)
Description copied from interface:RatingService
Getting notation about once given resource identified by its PK. If the resource has no notation, a NotationDetail is returned anyway.- Specified by:
getRating
in interfaceRatingService
- Parameters:
pk
- identity of resource- Returns:
- Notation of identified resource
-
hasUserRating
public boolean hasUserRating(RaterRatingPK pk)
Description copied from interface:RatingService
Checking if user has given a rating on this resource- Specified by:
hasUserRating
in interfaceRatingService
- Parameters:
pk
- identity of resource and rater- Returns:
- true if user has already given a rate
-
-