org.silverpeas.rating
Class ContributionRating

java.lang.Object
  extended by org.silverpeas.rating.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
ContributionRating(ContributionRatingPK pk)
          Default constructor.
 
Method Summary
 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 a RaterRating 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 a RaterRating 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.

getRaterRatings

public Map<String,Integer> getRaterRatings()
Gets all rater ratings associated to the rating.

Returns:
a mapping between user id of raters and their rating.


Copyright © 2016 Silverpeas. All Rights Reserved.