Show last authors
1 {{warning}}
2 This page contains the documentation of the Ratings API before the changes performed in 12.9RC1.
3 {{/warning}}
4
5 {{box cssClass="floatinginfobox"}}
6 {{toc/}}
7 {{/box}}
8
9 = Description =
10
11 {{info}}
12 This component can be used together with the [[Extension.Ratings Application]] version 1.3 or more.
13 {{/info}}
14
15 == Configuration ==
16
17 {{warning}}
18 Since 6.4 the configuration can be made through objects.
19 It is recommended to do so due to the fact that the configuration from xwiki documents takes precedence on the one from xwiki.cfg.
20 Please see the [[Ratings Application>>Extension.Ratings Application]] for more info on how to do that.
21 {{/warning}}
22
23
24 Supported parameters :
25
26 |=##xwiki.cfg## parameter key (old ##XWiki.XWikiPreferences## field name)|=Description|=Accepted values|=Default value
27 |##xwiki.ratings.managerHint##|Name of RatingsManager component to use|default for ##org.xwiki.ratings.internal.DefaultRatingsManager##\\separate for ##org.xwiki.ratings.internal.SeparatePageRatingsManager##
28 |##xwiki.ratings.averagerating.stored## (##ratings_averagerating_stored##)|Is the average rating stored in a XWiki object ?|0 or 1|0
29 |##xwiki.ratings.reputation## (##ratings_reputation##)|Is user reputation feature activated ?|0 or 1|0
30 |##xwiki.ratings.reputation.stored## (##ratings_reputation_stored##)|Is user reputation stored in a XWiki object ?|0 or 1|0
31 |##xwiki.ratings.reputation.defaultmethod## (##ratings_reputation_defaultmethod##)|Name of the methods used for calculating a user reputation. In the user profile, one object per calculation method will be stored, each one referencing the name of the method used.|Coma-separated list of methods|##average##
32 |##xwiki.ratings.reputationAlgorithmHint##|The reputation algorithm component to use|default for ##org.xwiki.ratings.internal.DefaultReputationAlgorithm##, simple for ##org.xwiki.contrib.ratings.internal.SimpleReputationAlgorithm##, name of a page containing a Groovy class for using a custom groovy implementation
33 |##xwiki.ratings.separatepagemanager.spacename## (##ratings_separatepagemanager_spacename##)|The name of the space to use to store ratings documents/objects when using the sepearate-page ratings manager|The name of the space to be used|//None// (uses the same spaces as the page being rated)
34 |##xwiki.ratings.separatepagemanager.ratingsspaceforeachspace## (##ratings_separatepagemanager_ratingsspaceforeachspace##)|Should the separate page ratings manager use a space for each of the rated space?|0 or 1|0
35
36 == API ==
37
38 === @Since 6.4 ===
39
40 ==== Backwards compatibility ===
41
42 The extension's sources have been integrated into a module of the xwiki-platform.
43 This implies that the package name changed thus backwards compatibility was broken.
44
45 The script service basically remains intact. The methods contained by that service maintain the same signatures. Nothing has changed from this point of view.
46 So previous versions of the ratings module (the ones from contrib) can use the service just as before without it breaking things.
47
48 The issue that arises from changing the package name is that any code that uses classes from that package explicitly will be broken.
49
50
51 Example:
52 -----
53 Say you have a java or groovy script in which you want to use a class from the ratings api package or typed variables.
54 That code will be broken due to the fact that packages don't match anymore.
55
56 {{code language="none"}}
57 org.xwiki.contrib.ratings.Rating myRating = new org.xwiki.contrib.ratings.Rating();
58 or
59 org.xwiki.contrib.ratings.RatingAPI myRating = services.ratings.getRating(doc, author);
60 {{/code}}
61
62 on the other hand the following should be ok
63
64 {{code language="none"}}
65 services.ratings.getRating(doc, author).getVote();
66 {{/code}}
67
68
69 ==== Deprecation ====
70
71 Methods which were passed a Document as an argument have been deprecated and replaced with new ones taking DocumentReference
72
73 ==== Code ====
74
75 {{remotecode language="none" source="https://raw.githubusercontent.com/xwiki/xwiki-platform/xwiki-platform-6.4/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/script/RatingsScriptService.java" /}}

Get Connected