1
|
package eu.dnetlib.api.functionality;
|
2
|
|
3
|
import java.util.List;
|
4
|
|
5
|
import eu.dnetlib.api.DriverService;
|
6
|
import eu.dnetlib.domain.functionality.Rating;
|
7
|
|
8
|
/**
|
9
|
* This interface describes the methods available for a rating service.
|
10
|
* @author thanos@di.uoa.gr
|
11
|
*
|
12
|
*/
|
13
|
public interface RatingService extends DriverService {
|
14
|
/**
|
15
|
* Rate a document by a specifed user.
|
16
|
* @param userId the id of the user
|
17
|
* @param documentId the id of the document
|
18
|
* @param score the rating score
|
19
|
* @throws RatingServiceException if any errors occur
|
20
|
*/
|
21
|
public void rate(String userId, String documentId, float score) throws RatingServiceException;
|
22
|
|
23
|
/**
|
24
|
* Search for existing ratings by user.
|
25
|
* @param userId the id of the user
|
26
|
* @return a list containing all the ratings of the specified user ordered by score
|
27
|
* @throws RatingServiceException if any errors occur
|
28
|
*/
|
29
|
public List<Rating> searchRatingsByUser(String userId) throws RatingServiceException;
|
30
|
|
31
|
/**
|
32
|
* Search for existing ratings by document.
|
33
|
* @param documentId the id of the document
|
34
|
* @return a list containing all the ratings of the soecified document ordered by score
|
35
|
* @throws RatingServiceException if any errors occur
|
36
|
*/
|
37
|
public List<Rating> searchRatingsByDocument(String documentId) throws RatingServiceException;
|
38
|
|
39
|
/**
|
40
|
* Get the top ratings.
|
41
|
* @param limit the maximum number of ratings to retrieve
|
42
|
* @return a list containing the top ratings ordered by score
|
43
|
* @throws RatingServiceException if any errors occur
|
44
|
*/
|
45
|
public List<Rating> getTopRatings(int limit) throws RatingServiceException;
|
46
|
|
47
|
/**
|
48
|
* Get the top documents.
|
49
|
* @param limit the maximum number of ratings to retrieve
|
50
|
* @return a list containing the top document average ratings ordered by score
|
51
|
* @throws RatingServiceException if any errors occur
|
52
|
*/
|
53
|
public List<Rating> getTopDocuments(int limit) throws RatingServiceException;
|
54
|
}
|