SAP NetWeaver '04

com.sapportals.wcm.repository.service.rating
Interface IRating

[contained in: com.sap.km.cm.repository.service.base.par - km.shared.repository.service.rating_api.jar]
public interface IRating

The interface represents a service for handling the rating of resources. A rating is an evaluation of a resource that can be expressed with different values and value ranges. Different evaluations can be assigned icons and a text that can be set individually.
Users with read permission for a resource can give a rating. Each user can give only one rating.

The rating service can be configured. It offers a method that returns the current configuration.


Field Summary
static java.lang.String KEY_COUNTRATE
          Name of configuration property that represents the range of the rating, e.g. 5.
static java.lang.String KEY_EMPTY_RATING_GIF
          Name of configuration property that represents the icon used for negative rating.
static java.lang.String KEY_FULL_RATING_GIF
          Name of configuration property that represents the icon used for positive rating.
static java.lang.String KEY_ICON_HEIGT
          Name of configuration property that represents the height of the icons.
static java.lang.String KEY_ICON_WIDTH
          Name of configuration property that represents the width of the icons.
static java.lang.String KEY_MAXCOMMENT
          Name of configuration property that specifies the maximum number of comments that are initially displayed.
 
Method Summary
 boolean addRating(IResource resource, int iVote)
          Adds a rating to a given resource.
 void deleteUserVoting(IResource resource, java.lang.String userID)
          Delete Voting for one User A UserID may be provided, if userID is null the user is identified by the resource context.
 void deleteVoting(IResource resource)
          Delete Voting for thsi Resource all User Ratings wil be deleted too
 java.util.HashMap getLocalResourceBundle(IResource res)
          Gets a hashmap that contains the individually set rating texts.
 java.util.Properties getProperties()
          Gets all configuration data for this service.
 java.lang.String getRatingAverage(IResource resource)
          Returns the rating average as string formatted as #.##
 int getRatingCount(IResource resource)
          Gets sum of all ratings for a given resource.
 int getRatingUser(IResource resource)
          Gets the number of users that have rated the given resource.
 java.util.Properties getRenderProperties()
          Gets rendering configuration data for this service.
 int getUserVoting(IResource resource)
          Gets the rating of a user for a given resource.
 

Field Detail

KEY_EMPTY_RATING_GIF

public static final java.lang.String KEY_EMPTY_RATING_GIF
Name of configuration property that represents the icon used for negative rating.

KEY_FULL_RATING_GIF

public static final java.lang.String KEY_FULL_RATING_GIF
Name of configuration property that represents the icon used for positive rating.

KEY_ICON_HEIGT

public static final java.lang.String KEY_ICON_HEIGT
Name of configuration property that represents the height of the icons.

KEY_ICON_WIDTH

public static final java.lang.String KEY_ICON_WIDTH
Name of configuration property that represents the width of the icons.

KEY_COUNTRATE

public static final java.lang.String KEY_COUNTRATE
Name of configuration property that represents the range of the rating, e.g. 5.

KEY_MAXCOMMENT

public static final java.lang.String KEY_MAXCOMMENT
Name of configuration property that specifies the maximum number of comments that are initially displayed.
Method Detail

getRenderProperties

public java.util.Properties getRenderProperties()
Gets rendering configuration data for this service.
Returns:
all rendering data as properties

addRating

public boolean addRating(IResource resource,
                         int iVote)
                  throws WcmException
Adds a rating to a given resource. The author of the rating is identified by the resource context. Rating can be overwritten
Parameters:
resource - the resource for which the comment is given
iVote - rating within predefined range
Returns:
Boolean to indicate whether storage of rating was successful or failed

getRatingCount

public int getRatingCount(IResource resource)
Gets sum of all ratings for a given resource.
Parameters:
resource - the resource that was rated
Returns:
the number of ratings that exist for the resource

getRatingUser

public int getRatingUser(IResource resource)
Gets the number of users that have rated the given resource.
Parameters:
resource - the resource for which ratings exist
Returns:
the number of users that rated the resource

getRatingAverage

public java.lang.String getRatingAverage(IResource resource)
Returns the rating average as string formatted as #.##
Parameters:
resource - the resource for which ratings exist
Returns:
average rating as a string (formatted #.##)

getUserVoting

public int getUserVoting(IResource resource)
Gets the rating of a user for a given resource. The user is identified by the resource context.
Parameters:
resource - the resource that was rated
Returns:
rating of the user given in the resource context

getLocalResourceBundle

public java.util.HashMap getLocalResourceBundle(IResource res)
Gets a hashmap that contains the individually set rating texts. Texts are stored in a resource bundle. The language is taken from the resource context.
Parameters:
resource - to be rated
Returns:
hash map with keys and text

getProperties

public java.util.Properties getProperties()
Gets all configuration data for this service.
Returns:
all configuration data as properties

deleteUserVoting

public void deleteUserVoting(IResource resource,
                             java.lang.String userID)
Delete Voting for one User A UserID may be provided, if userID is null the user is identified by the resource context.
Parameters:
resource - the resource that was rated
userID - this Users Rating will be deleted

deleteVoting

public void deleteVoting(IResource resource)
Delete Voting for thsi Resource all User Ratings wil be deleted too
Parameters:
resource - the resource that was rated

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.