Class ContributionRating
- java.lang.Object
-
- org.silverpeas.core.contribution.rating.model.ContributionRating
-
- All Implemented Interfaces:
Serializable
public class ContributionRating extends Object implements Serializable
This class represents the global data about a rating on a contribution.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContributionRating(ContributionRatingPK pk)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRaterRating(String raterId, Integer ratingValue)
Adds a rating of a rater.String
getContributionId()
Gets the identifier of the contribution aimed by the rating.String
getContributionType()
Gets the type of the contribution aimed by the rating.String
getInstanceId()
Gets the identifier of the component instance which the contribution aimed by the rating is associated.RaterRating
getRaterRating(UserDetail rater)
Gets an instance of aRaterRating
according to the specified rater.Map<String,Integer>
getRaterRatings()
Gets all rater ratings associated to the rating.float
getRatingAverage()
Gets the average of all rater ratings associated to the contribution aimed by the rating.
-
-
-
Constructor Detail
-
ContributionRating
public ContributionRating(ContributionRatingPK pk)
Default constructor.- Parameters:
pk
- the technical primary key of a rating related to a contribution.
-
-
Method Detail
-
getInstanceId
public String getInstanceId()
Gets the identifier of the component instance which the contribution aimed by the rating is associated.- Returns:
- the identifier of a component instance.
-
getContributionId
public String getContributionId()
Gets the identifier of the contribution aimed by the rating.- Returns:
- the identifier of a contribution.
-
getContributionType
public String getContributionType()
Gets the type of the contribution aimed by the rating.- Returns:
- the type of a contribution.
-
getRatingAverage
public float getRatingAverage()
Gets the average of all rater ratings associated to the contribution aimed by the rating.- Returns:
- the average of all rater ratings.
-
addRaterRating
public void addRaterRating(String raterId, Integer ratingValue)
Adds a rating of a rater.- Parameters:
raterId
- the identifier of the user that is the rater.ratingValue
- the value of the rater rating.
-
getRaterRating
public RaterRating getRaterRating(UserDetail rater)
Gets an instance of aRaterRating
according to the specified rater.- Parameters:
rater
- the user for whom the rating is requested.- Returns:
- the rater rating instance of the specified rater. Null if no rating has been done by the specified user.
-
-