com.sapportals.wcm.repository.service.rating

Interface IRating


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 String KEY_COUNTRATE
          Name of configuration property that represents the range of the rating, e.g. 5.
static String KEY_EMPTY_RATING_GIF
          Name of configuration property that represents the icon used for negative rating.
static String KEY_FULL_RATING_GIF
          Name of configuration property that represents the icon used for positive rating.
static String KEY_ICON_HEIGT
          Name of configuration property that represents the height of the icons.
static String KEY_ICON_WIDTH
          Name of configuration property that represents the width of the icons.
static 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, 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
 HashMap getLocalResourceBundle(IResource res)
          Gets a hashmap that contains the individually set rating texts.
 Properties getProperties()
          Gets all configuration data for this service.
 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.
 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 String KEY_EMPTY_RATING_GIF
Name of configuration property that represents the icon used for negative rating.

See Also:
Constant Field Values

KEY_FULL_RATING_GIF

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

See Also:
Constant Field Values

KEY_ICON_HEIGT

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

See Also:
Constant Field Values

KEY_ICON_WIDTH

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

See Also:
Constant Field Values

KEY_COUNTRATE

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

See Also:
Constant Field Values

KEY_MAXCOMMENT

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

See Also:
Constant Field Values
Method Detail

getRenderProperties

public 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
Throws:
WcmException

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

Returns:
hash map with keys and text

getProperties

public Properties getProperties()
Gets all configuration data for this service.

Returns:
all configuration data as properties

deleteUserVoting

public void deleteUserVoting(IResource resource,
                             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


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. 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.