Package rs.ac.bg.etf.sab.operations
Interface GenresOperations
-
public interface GenresOperations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.IntegeraddGenre(java.lang.String name)Adds a new genre with the given name.booleandoesGenreExist(java.lang.String name)Checks whether a genre with the given name exists.java.util.List<java.lang.Integer>getAllGenreIds()Returns IDs of all genres.java.lang.IntegergetGenreId(java.lang.String name)Retrieves the ID of a genre by its name.java.lang.IntegerremoveGenre(java.lang.Integer id)Removes a genre by its ID.java.lang.IntegerupdateGenre(java.lang.Integer id, java.lang.String newName)Updates the name of an existing genre.
-
-
-
Method Detail
-
addGenre
java.lang.Integer addGenre(java.lang.String name)
Adds a new genre with the given name.- Parameters:
name- the name of the genre to add- Returns:
- the auto-generated ID of the new genre, or null if the genre already exists
-
updateGenre
java.lang.Integer updateGenre(java.lang.Integer id, java.lang.String newName)Updates the name of an existing genre.- Parameters:
id- the ID of the genre to updatenewName- the new name to set- Returns:
- the ID of the updated genre, or null if no genre with the given ID exists
-
removeGenre
java.lang.Integer removeGenre(java.lang.Integer id)
Removes a genre by its ID.- Parameters:
id- the ID of the genre to remove- Returns:
- the ID of the removed genre, or null if no genre with the given ID exists
-
doesGenreExist
boolean doesGenreExist(java.lang.String name)
Checks whether a genre with the given name exists.- Parameters:
name- the genre name to check- Returns:
- true if a genre with the given name exists; false otherwise
-
getGenreId
java.lang.Integer getGenreId(java.lang.String name)
Retrieves the ID of a genre by its name.- Parameters:
name- the name of the genre- Returns:
- the ID of the genre, or null if not found
-
getAllGenreIds
java.util.List<java.lang.Integer> getAllGenreIds()
Returns IDs of all genres.- Returns:
- a list of genre IDs (empty if none)
-
-