Class RaterRatingEntity
- java.lang.Object
-
- org.silverpeas.core.webapi.rating.RaterRatingEntity
-
- All Implemented Interfaces:
Serializable
,WebEntity
public class RaterRatingEntity extends Object implements WebEntity
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RaterRatingEntity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RaterRatingEntity
fromRateable(Rateable rateableContribution)
Creates a new rater rating entity from the specified parameter.protected static RaterRatingEntity
fromRaterRating(RaterRating raterRating)
Creates a new rater rating entity from the specified parameter.String
getAsJSonString()
String
getComponentId()
Gets the identifier of the Silverpeas component instance to which the rated content belongs.String
getContributionId()
Gets the identifier of the resource that is rated by this.String
getContributionType()
Gets the type of the resource that is rated by this.int
getNumberOfRaterRatings()
Gets the number of rater ratings on the contribution.int
getRaterRatingValue()
Gets the rating of the current user.float
getRatingAverage()
Gets the average rating on the contribution.URI
getURI()
Gets the URI at which this web entity is published and can be accessed.boolean
isRatingDone()
Indicates if the current user made a rating on the contribution.protected void
setComponentId(String componentId)
protected void
setContributionId(String contributionId)
protected void
setContributionType(String contributionType)
protected void
setNumberOfRaterRatings(int numberOfRaterRatings)
protected void
setRaterRatingValue(int raterRatingValue)
protected void
setRatingAverage(float ratingAverage)
protected void
setRatingDone(boolean isRatingDone)
protected void
setUri(URI uri)
String
toJSonScript(String jsVariableName)
-
-
-
Method Detail
-
fromRateable
public static RaterRatingEntity fromRateable(Rateable rateableContribution)
Creates a new rater rating entity from the specified parameter. The rater of the returned entity is the user that requests the current treatment.- Parameters:
rateableContribution
- a contribution that implements theRateable
behaviour.- Returns:
- the entity representing the rater rating from the specified parameter.
- See Also:
UserDetail.getCurrentRequester()
-
fromRaterRating
protected static RaterRatingEntity fromRaterRating(RaterRating raterRating)
Creates a new rater rating entity from the specified parameter.- Parameters:
raterRating
- the rater rating to entitify.- Returns:
- the entity representing the specified rater rating.
-
getURI
public URI getURI()
Description copied from interface:WebEntity
Gets the URI at which this web entity is published and can be accessed.
-
getComponentId
public String getComponentId()
Gets the identifier of the Silverpeas component instance to which the rated content belongs.- Returns:
- the silverpeas component instance identifier.
-
getContributionType
public String getContributionType()
Gets the type of the resource that is rated by this.- Returns:
- the rated resource type.
-
getContributionId
public String getContributionId()
Gets the identifier of the resource that is rated by this.- Returns:
- the rated resource identifier.
-
getNumberOfRaterRatings
public int getNumberOfRaterRatings()
Gets the number of rater ratings on the contribution.- Returns:
- a positive integer between 0 and 5 (included).
-
getRatingAverage
public float getRatingAverage()
Gets the average rating on the contribution.- Returns:
- a float value between 0 and 5 (included)
-
getRaterRatingValue
public int getRaterRatingValue()
Gets the rating of the current user.- Returns:
- a positive integer between 0 and 5 (included)
-
isRatingDone
public boolean isRatingDone()
Indicates if the current user made a rating on the contribution.- Returns:
- true if the user made a rating, false otherwise.
-
getAsJSonString
public String getAsJSonString()
-
setUri
protected void setUri(URI uri)
-
setComponentId
protected void setComponentId(String componentId)
-
setContributionType
protected void setContributionType(String contributionType)
-
setContributionId
protected void setContributionId(String contributionId)
-
setNumberOfRaterRatings
protected void setNumberOfRaterRatings(int numberOfRaterRatings)
-
setRatingAverage
protected void setRatingAverage(float ratingAverage)
-
setRaterRatingValue
protected void setRaterRatingValue(int raterRatingValue)
-
setRatingDone
protected void setRatingDone(boolean isRatingDone)
-
-