public class RatingsServiceImpl extends Object implements RatingsService
| Modifier and Type | Field and Description |
|---|---|
static String |
RESOURCETYPE_RATINGS
The resource type for the rating holder.
|
| Constructor and Description |
|---|
RatingsServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
double |
getRating(org.apache.sling.api.resource.Resource resource)
Get the overall rating for a resource.
|
double |
getRating(org.apache.sling.api.resource.Resource resource,
String userId)
Get the rating of a user for a resource.
|
String |
getRatingsResourcePath(org.apache.sling.api.resource.Resource resource)
Return the path to the ratings resource for a resource.
|
void |
setRating(org.apache.sling.api.resource.Resource resource,
String userId,
double rating)
Set the rating of a user for a resource.
|
public static final String RESOURCETYPE_RATINGS
public String getRatingsResourcePath(org.apache.sling.api.resource.Resource resource)
RatingsServicegetRatingsResourcePath in interface RatingsServiceresource - The content resource, this is usually an entry.null if
the passed in content resource is not part of
Slingshot.RatingsService.getRatingsResourcePath(org.apache.sling.api.resource.Resource)public double getRating(org.apache.sling.api.resource.Resource resource)
RatingsServicegetRating in interface RatingsServiceresource - The content resource, this is usually an entry.0 if
the passed in content resource is not part of
Slingshot.RatingsService.getRating(org.apache.sling.api.resource.Resource)public double getRating(org.apache.sling.api.resource.Resource resource,
String userId)
RatingsServicegetRating in interface RatingsServiceresource - The content resource, this is usually an entry.userId - The user id0 if
the passed in content resource is not part of
Slingshot.RatingsService.getRating(org.apache.sling.api.resource.Resource, java.lang.String)public void setRating(org.apache.sling.api.resource.Resource resource,
String userId,
double rating)
throws org.apache.sling.api.resource.PersistenceException
RatingsServicesetRating in interface RatingsServiceresource - The content resource, this is usually an entry.userId - The user idorg.apache.sling.api.resource.PersistenceExceptionorg.apache.sling.sample.slingshot.ratings.RatingsService#setRating(org.apache.sling.api.resource.Resource, java.lang.String, int)Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.