Package rs.ac.bg.etf.sab.operations
Interface RatingsOperations
-
public interface RatingsOperations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddRating(java.lang.Integer userId, java.lang.Integer movieId, java.lang.Integer score)Adds a new rating for a movie by a specific user.java.util.List<java.lang.Integer>getRatedMoviesByUser(java.lang.Integer userId)Retrieves all movies rated by a specific user.java.lang.IntegergetRating(java.lang.Integer userId, java.lang.Integer movieId)Retrieves the score of a rating for a specific movie by a specific user.java.util.List<java.lang.Integer>getUsersWhoRatedMovie(java.lang.Integer movieId)Retrieves all users who rated a specific movie.booleanremoveRating(java.lang.Integer userId, java.lang.Integer movieId)Removes a rating for a specific movie given by a specific user.booleanupdateRating(java.lang.Integer userId, java.lang.Integer movieId, java.lang.Integer newScore)Updates the score of an existing rating.
-
-
-
Method Detail
-
addRating
boolean addRating(java.lang.Integer userId, java.lang.Integer movieId, java.lang.Integer score)Adds a new rating for a movie by a specific user.- Parameters:
userId- the unique identifier of the user giving the ratingmovieId- the unique identifier of the movie being ratedscore- the score assigned to the movie by the user- Returns:
- true if the rating was successfully added, false if the rating already exists, false if the user cannot add that rating
-
updateRating
boolean updateRating(java.lang.Integer userId, java.lang.Integer movieId, java.lang.Integer newScore)Updates the score of an existing rating.- Parameters:
userId- the unique identifier of the user who gave the ratingmovieId- the unique identifier of the movie that was ratednewScore- the new score to assign to the rating- Returns:
- true if the rating was successfully updated, false if no rating exists, false if the user cannot update that rating
-
removeRating
boolean removeRating(java.lang.Integer userId, java.lang.Integer movieId)Removes a rating for a specific movie given by a specific user.- Parameters:
userId- the unique identifier of the user who gave the ratingmovieId- the unique identifier of the movie that was rated- Returns:
- true if the rating was successfully removed, false if no rating exists
-
getRating
java.lang.Integer getRating(java.lang.Integer userId, java.lang.Integer movieId)Retrieves the score of a rating for a specific movie by a specific user.- Parameters:
userId- the unique identifier of the user who gave the ratingmovieId- the unique identifier of the movie that was rated- Returns:
- the score of the rating, or null if no rating exists
-
getRatedMoviesByUser
java.util.List<java.lang.Integer> getRatedMoviesByUser(java.lang.Integer userId)
Retrieves all movies rated by a specific user.- Parameters:
userId- the unique identifier of the user- Returns:
- a list of movie IDs that the user has rated, or an empty list if no ratings exist
-
getUsersWhoRatedMovie
java.util.List<java.lang.Integer> getUsersWhoRatedMovie(java.lang.Integer movieId)
Retrieves all users who rated a specific movie.- Parameters:
movieId- the unique identifier of the movie- Returns:
- a list of user IDs who rated the movie, or an empty list if no ratings exist
-
-