1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.ratings

File Rating.java

 

Code metrics

0
0
0
1
147
23
0
-
-
0
-

Classes

Class Line # Actions
Rating 35 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.ratings;
21   
22    import java.util.Date;
23   
24    import org.xwiki.model.reference.DocumentReference;
25   
26    import com.xpn.xwiki.objects.BaseObject;
27   
28    /**
29    * Represent a rating : a note given by a user to a container. A container can be: A Wiki Document A section of a wiki
30    * document A sentence in a wiki document A comment A sentence in a comment etc...
31    *
32    * @version $Id: 4a42c257b343f9232951c87362d42c4b345c3b8c $
33    * @since 6.4M3
34    */
 
35    public interface Rating
36    {
37    /**
38    * Gets the document reference to which the rating is associated to.
39    *
40    * @return the document reference for which this rating applies.
41    */
42    DocumentReference getDocumentReference();
43   
44    /**
45    * Retrieves the current rating as a BaseObject This method is used for compatibility.
46    *
47    * @return BaseObject rating object
48    * @throws RatingsException when an error occurs while fetching this average rating.
49    */
50    BaseObject getAsObject() throws RatingsException;
51   
52    /**
53    * Retrieves the rating unique ID allowing to distinguish it from other ratings of the same container.
54    *
55    * @return String rating ID
56    */
57    String getRatingId();
58   
59    /**
60    * Retrieves the rating unique ID allowing to find the rating.
61    *
62    * @return String rating ID
63    */
64    String getGlobalRatingId();
65   
66    /**
67    * Retrieves the current rating author.
68    *
69    * @return String author of the rating
70    */
71    DocumentReference getAuthor();
72   
73    /**
74    * Retrieves the date of the rating.
75    *
76    * @return Date date of the rating
77    */
78    Date getDate();
79   
80    /**
81    * Retrieves the rating value.
82    *
83    * @return integer value of rating
84    */
85    int getVote();
86   
87    /**
88    * Retrieves additional properties.
89    *
90    * @param propertyName the name of the property for which to retrieve the value
91    * @return Object property value
92    */
93    Object get(String propertyName);
94   
95    /**
96    * Retrieves additional properties.
97    *
98    * @param propertyName the name of the property for which to retrieve the value
99    * @param mode the mode in which to display the value
100    * @return Object property value
101    */
102    String display(String propertyName, String mode);
103   
104    /**
105    * Set the author to which the rating belongs to.
106    *
107    * @param author to which the rating belongs to
108    */
109    void setAuthor(DocumentReference author);
110   
111    /**
112    * Set the date when the rating occurred.
113    *
114    * @param date when the rating occurred
115    */
116    void setDate(Date date);
117   
118    /**
119    * Set the vote that the user gave.
120    *
121    * @param vote the number of selected stars ranging from 1 to 5
122    */
123    void setVote(int vote);
124   
125    /**
126    * Store the rating information.
127    *
128    * @throws RatingsException when an error occurs while saving this average rating.
129    */
130    void save() throws RatingsException;
131   
132    /**
133    * Remove the rating.
134    *
135    * @return the status of the action
136    * @throws RatingsException when an error occurs while removing this average rating
137    */
138    boolean remove() throws RatingsException;
139   
140    /**
141    * The string representation of the vote.
142    *
143    * @return the string representation of the vote
144    */
145    @Override
146    String toString();
147    }