public class RatingServiceImpl extends Object implements RatingService, Extensible
Modifier and Type | Field and Description |
---|---|
ExtendedTrait<RatingServiceTrait> |
ratingServiceTrait |
Constructor and Description |
---|
RatingServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
applyRating(org.alfresco.service.cmr.repository.NodeRef targetNode,
float rating,
String ratingSchemeName)
This method applies the given rating to the specified target node.
|
float |
getAverageRating(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingSchemeName)
This method returns the average (mean) rating in the specified scheme for the
specified nodeRef.
|
Rating |
getRatingByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingSchemeName)
This method gets the
Rating applied by the current user to the specified node in the specified
RatingScheme - if there is one. |
Serializable |
getRatingRollup(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingSchemeName,
String ratingRollupName)
This method returns a 'rolled up' property value for the specified targetNode.
|
List<Rating> |
getRatingsByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode)
This method gets the
ratings applied by the current user to the specified node. |
RatingScheme |
getRatingScheme(String ratingSchemeName)
Returns the named
rating scheme if there is one. |
Map<String,RatingScheme> |
getRatingSchemes()
Returns the available
rating schemes keyed by name. |
int |
getRatingsCount(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingSchemeName)
This method gets the number of individual ratings which have been applied to
the specified node in the specified
RatingScheme . |
float |
getTotalRating(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingSchemeName)
This method gets the total accumulated rating score for
the specified node in the specified
RatingScheme . |
<M extends Trait> |
getTrait(Class<? extends M> traitAPI) |
Rating |
removeRatingByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode,
String ratingScheme)
This method removes any
Rating applied by the current user to the specified node in the specified
RatingScheme . |
void |
setBehaviourFilter(BehaviourFilter behaviourFilter) |
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setRatingSchemeRegistry(RatingSchemeRegistry schemeRegistry) |
void |
setRollupNamingConventions(RatingNamingConventionsUtil namingConventions) |
public final ExtendedTrait<RatingServiceTrait> ratingServiceTrait
public void setRatingSchemeRegistry(RatingSchemeRegistry schemeRegistry)
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setBehaviourFilter(BehaviourFilter behaviourFilter)
public void setRollupNamingConventions(RatingNamingConventionsUtil namingConventions)
public Map<String,RatingScheme> getRatingSchemes()
RatingService
rating schemes
keyed by name.getRatingSchemes
in interface RatingService
rating schemes
.public RatingScheme getRatingScheme(String ratingSchemeName)
RatingService
rating scheme
if there is one.getRatingScheme
in interface RatingService
ratingSchemeName
- name of the rating scheme.rating schemes
if one of that name is registered,
else null
.public void applyRating(org.alfresco.service.cmr.repository.NodeRef targetNode, float rating, String ratingSchemeName) throws RatingServiceException
RatingService
applyRating
in interface RatingService
targetNode
- the node to which the rating is to be applied.rating
- the rating which is to be applied.ratingSchemeName
- the name of the rating scheme to use.RatingServiceException
- if the rating is not within the range defined by the named scheme
or if the named scheme is not registered.RatingService.getRatingSchemes()
,
RatingScheme
public Rating getRatingByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingSchemeName)
RatingService
Rating
applied by the current user to the specified node in the specified
RatingScheme
- if there is one.getRatingByCurrentUser
in interface RatingService
targetNode
- the node on which the rating is sought.ratingSchemeName
- the rating scheme name to use.null
.RatingService.getRatingSchemes()
,
RatingScheme
public List<Rating> getRatingsByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode)
RatingService
ratings
applied by the current user to the specified node.getRatingsByCurrentUser
in interface RatingService
targetNode
- the node on which the ratings are sought.Collections.emptyList()
.RatingService.getRatingSchemes()
,
RatingScheme
public Rating removeRatingByCurrentUser(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingScheme)
RatingService
Rating
applied by the current user to the specified node in the specified
RatingScheme
.removeRatingByCurrentUser
in interface RatingService
targetNode
- the node from which the rating is to be removed.ratingScheme
- the rating scheme name to use.null
.RatingService.getRatingSchemes()
,
RatingScheme
public float getTotalRating(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingSchemeName)
RatingService
RatingScheme
.
That is, the rating scores for all users for the specified
node are summed to give the result.getTotalRating
in interface RatingService
targetNode
- the node on which the rating total is sought.ratingSchemeName
- the rating scheme name to use.RatingService.getRatingSchemes()
,
RatingScheme
public float getAverageRating(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingSchemeName)
RatingService
getAverageRating
in interface RatingService
targetNode
- the node for which an average is sought.ratingSchemeName
- the rating scheme name in which the average is defined.public int getRatingsCount(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingSchemeName)
RatingService
RatingScheme
.getRatingsCount
in interface RatingService
targetNode
- the node on which the rating is sought.ratingSchemeName
- the rating scheme name to use.RatingService.getRatingSchemes()
,
RatingScheme
public Serializable getRatingRollup(org.alfresco.service.cmr.repository.NodeRef targetNode, String ratingSchemeName, String ratingRollupName)
RatingService
cm:rating
child nodes.
An example of such a roll up would be 'ratingTotal' which would be the sum of all ratings applied to the
targetNode in the specified rating scheme.
By rolling up property values from the various cm:rating
child nodes and persisting them
as individual properties on the cm:rateable
node itself, we are able to support indexing, searching
and sorting of such properties.getRatingRollup
in interface RatingService
targetNode
- the rated node whose rolled up property we wish to read.ratingSchemeName
- the rating scheme name in which the property is relevant.ratingRollupName
- the name of the rating rollup property, as given in AbstractRatingRollupAlgorithm.getRollupName()
.public <M extends Trait> ExtendedTrait<M> getTrait(Class<? extends M> traitAPI)
getTrait
in interface Extensible
Copyright © 2005–2017 Alfresco Software. All rights reserved.