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

File AbstractRatingEvent.java

 

Coverage histogram

../../../img/srcFileCovDistChart1.png
82% of files have more coverage

Code metrics

0
9
8
1
119
42
8
0.89
1.12
8
1

Classes

Class Line # Actions
AbstractRatingEvent 31 9 0% 8 16
0.058823535.9%
 

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 org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.observation.event.Event;
24   
25    /**
26    * Event fired before updating a Rating.
27    *
28    * @version $Id: 3afe0f50ad4d3a96ac887de0974549b654cd66a9 $
29    * @since 7.1M1
30    */
 
31    public abstract class AbstractRatingEvent implements Event
32    {
33    private DocumentReference documentRef;
34   
35    private Rating newRating;
36   
37    private int oldRating;
38   
39    /**
40    * Default UpdateRatingEvent constructor.
41    */
 
42  4 toggle public AbstractRatingEvent()
43    {
44    }
45   
46    /**
47    * UpdateRatingEvent constructor.
48    *
49    * @param documentRef the document which is being rated
50    * @param newRating the new rating in the shape of a Rating object
51    * @param oldRating the old rating value
52    */
 
53  0 toggle public AbstractRatingEvent(DocumentReference documentRef, Rating newRating, int oldRating)
54    {
55  0 this.documentRef = documentRef;
56  0 this.newRating = newRating;
57  0 this.oldRating = oldRating;
58    }
59   
60    /**
61    * Gets the document reference of the document being rated.
62    *
63    * @return document reference of the document being rated
64    */
 
65  0 toggle public DocumentReference getDocumentReference()
66    {
67  0 return documentRef;
68    }
69   
70    /**
71    * Sets the document reference of the document being rated.
72    *
73    * @param documentRef the document being rated
74    */
 
75  0 toggle public void setDocumentReference(DocumentReference documentRef)
76    {
77  0 this.documentRef = documentRef;
78    }
79   
80    /**
81    * Gets the new rating set.
82    *
83    * @return Rating object representing the new rating
84    */
 
85  0 toggle public Rating getNewRating()
86    {
87  0 return newRating;
88    }
89   
90    /**
91    * Sets the new rating.
92    *
93    * @param newRating the new rating
94    */
 
95  0 toggle public void setNewRating(Rating newRating)
96    {
97  0 this.newRating = newRating;
98    }
99   
100    /**
101    * Gets the old rating value.
102    *
103    * @return the old rating value
104    */
 
105  0 toggle public int getOldRating()
106    {
107  0 return oldRating;
108    }
109   
110    /**
111    * Sets the old rating value.
112    *
113    * @param oldRating the old rating value
114    */
 
115  0 toggle public void setOldRating(int oldRating)
116    {
117  0 this.oldRating = oldRating;
118    }
119    }