@Unstable
public interface RatingsScriptServiceAPI
RatingsScriptService
.
Those methods are available when using $services.ratings.RatingsManagerName
where RatingsManagerName
should be replaced with the proper name of the RatingsManager
to use. Note that using
$services.ratings
without a specific RatingsManagerName
will automatically rely to the default
RatingsManagerFactory.DEFAULT_APP_HINT
.Modifier and Type | Method and Description |
---|---|
Optional<AverageRating> |
getAverageRating(org.xwiki.model.reference.EntityReference reference)
Retrieve the average rating of a specific reference.
|
RatingsConfiguration |
getConfiguration() |
List<Rating> |
getCurrentUserRatings(int offset,
int limit,
boolean asc)
Retrieve all the ratings of the current user.
|
Optional<Rating> |
getRating(org.xwiki.model.reference.EntityReference reference,
org.xwiki.user.UserReference author)
Retrieve the rating performed by the given author on the given reference.
|
List<Rating> |
getRatings(org.xwiki.model.reference.EntityReference reference,
int offset,
int limit)
Retrieve ratings information for the given reference on the given manager.
|
List<Rating> |
getRatings(org.xwiki.model.reference.EntityReference reference,
int offset,
int limit,
boolean asc)
Retrieve ratings information for the given reference on the given manager.
|
boolean |
isExcludedFromRatings(org.xwiki.model.reference.EntityReference entityReference)
Define if the given reference is excluded from ratings.
|
Optional<Rating> |
setRating(org.xwiki.model.reference.EntityReference reference,
int vote)
Allows to save a rating for the given reference, with the current user reference.
|
Optional<Rating> |
setRating(org.xwiki.model.reference.EntityReference reference,
org.xwiki.user.UserReference userReference,
int vote)
Allows to save a rating for the given reference, with the given user reference.
|
Optional<Rating> setRating(org.xwiki.model.reference.EntityReference reference, int vote)
reference
- the reference for which to save a rating.vote
- the rating to save.Rating
value, or empty in case of problem or if the rating is 0 and
the configuration doesn't allow to save 0 values (see RatingsConfiguration.isZeroStored()
).Optional<Rating> setRating(org.xwiki.model.reference.EntityReference reference, org.xwiki.user.UserReference userReference, int vote)
reference
- the reference for which to save a rating.userReference
- the reference of the user who performs the rating.vote
- the rating to save.Rating
value, or empty in case of problem or if the rating is 0 and
the configuration doesn't allow to save 0 values (see RatingsConfiguration.isZeroStored()
).List<Rating> getRatings(org.xwiki.model.reference.EntityReference reference, int offset, int limit)
reference
- the reference for which to retrieve rating information.offset
- the offset at which to start for retrieving information.limit
- the limit number of information to retrieve.limit
values sorted by
updated date in descending order.List<Rating> getRatings(org.xwiki.model.reference.EntityReference reference, int offset, int limit, boolean asc)
reference
- the reference for which to retrieve rating information.offset
- the offset at which to start for retrieving information.limit
- the limit number of information to retrieve.asc
- if true
return the results sorted by updated date in ascending order, else in descending orderlimit
values.Optional<AverageRating> getAverageRating(org.xwiki.model.reference.EntityReference reference)
reference
- the reference for which to retrieve the average rating information.Optional<Rating> getRating(org.xwiki.model.reference.EntityReference reference, org.xwiki.user.UserReference author)
reference
- the entity being ratedauthor
- the author of the rateList<Rating> getCurrentUserRatings(int offset, int limit, boolean asc)
offset
- offset of ratings to start retrieve.limit
- maximum number of ratings to retrieve.asc
- if the results should be ordered in updated date ascending or descending order.RatingsConfiguration getConfiguration()
boolean isExcludedFromRatings(org.xwiki.model.reference.EntityReference entityReference)
entityReference
- the reference to check.true
only if the given reference is excluded from ratings.Copyright © 2004–2021 XWiki. All rights reserved.