This documentation is for WSO2 Application Server 5.2.0. View documentation for the latest release.
Page Comparison - Managing Ratings (v.2 vs v.3) - Application Server 5.2.0 - WSO2 Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Table of Contents
maxLevel3
minLevel3
styleborder:1
locationtop
typeflat
separatorpipe


Rating a resource

To rate a resource based on our judgment, you can use the registry instance. Rating a resource can be done using the following line of code:

Code Block
registry.rateResource("c1/c2/r2 " , 4);

Retrieving the average rating of a resource

An average of all ratings of a particular resource can be retrieved. This can be done using the following line of code:

Code Block
registry.getAverageRating("c1/c2/r2");

Retrieving the rating given to the resource by a particular user

When a rating given by a particular user for a resource is needed, it can be done using the following line of code:

Code Block
registry.getRating("c1/c2/r2", "wso2_admin"); // rating given for r2 by wso2 admin