Interface MoviesOperations


  • public interface MoviesOperations
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Integer addGenreToMovie​(java.lang.Integer movieId, java.lang.Integer genreId)
      Adds a new genre to the specified movie.
      java.lang.Integer addMovie​(java.lang.String title, java.lang.Integer genreId, java.lang.String director)
      Adds a new movie.
      java.util.List<java.lang.Integer> getAllMovieIds()
      Retrieves IDs of all movies.
      java.util.List<java.lang.Integer> getGenreIdsForMovie​(java.lang.Integer movieId)
      Retrieves IDs of genres associated with a given movie.
      java.util.List<java.lang.Integer> getMovieIds​(java.lang.String title, java.lang.String director)
      Retrieves a list of IDs for movies that match the given title and director.
      java.util.List<java.lang.Integer> getMovieIdsByDirector​(java.lang.String director)
      Retrieves a list of IDs for movies directed by the specified director.
      java.util.List<java.lang.Integer> getMovieIdsByGenre​(java.lang.Integer genreId)
      Retrieves IDs of movies that belong to a given genre.
      java.lang.Integer removeGenreFromMovie​(java.lang.Integer movieId, java.lang.Integer genreId)
      Removes a genre from the specified movie.
      java.lang.Integer removeMovie​(java.lang.Integer id)
      Removes a movie by its ID.
      java.lang.Integer updateMovieDirector​(java.lang.Integer id, java.lang.String newDirector)
      Updates the director of a movie.
      java.lang.Integer updateMovieTitle​(java.lang.Integer id, java.lang.String newTitle)
      Updates the title of a movie.
    • Method Detail

      • addMovie

        java.lang.Integer addMovie​(java.lang.String title,
                                   java.lang.Integer genreId,
                                   java.lang.String director)
        Adds a new movie.
        Parameters:
        title - the movie title
        genreId - the ID of the genre (foreign key)
        director - the director's name
        Returns:
        the auto-generated ID of the new movie
      • updateMovieTitle

        java.lang.Integer updateMovieTitle​(java.lang.Integer id,
                                           java.lang.String newTitle)
        Updates the title of a movie.
        Parameters:
        id - the ID of the movie to update
        newTitle - the new title
        Returns:
        the ID of the updated movie, or null if it doesn't exist
      • addGenreToMovie

        java.lang.Integer addGenreToMovie​(java.lang.Integer movieId,
                                          java.lang.Integer genreId)
        Adds a new genre to the specified movie.
        Parameters:
        movieId - the ID of the movie
        genreId - the ID of the genre to add
        Returns:
        the movie ID if the genre was successfully added, or null if the movie or genre does not exist, or if the genre is already linked to the movie
      • removeGenreFromMovie

        java.lang.Integer removeGenreFromMovie​(java.lang.Integer movieId,
                                               java.lang.Integer genreId)
        Removes a genre from the specified movie.
        Parameters:
        movieId - the ID of the movie
        genreId - the ID of the genre to remove
        Returns:
        the movie ID if the genre was successfully removed, or null if the genre is not linked to the movie
      • updateMovieDirector

        java.lang.Integer updateMovieDirector​(java.lang.Integer id,
                                              java.lang.String newDirector)
        Updates the director of a movie.
        Parameters:
        id - the ID of the movie to update
        newDirector - the new director's name
        Returns:
        the ID of the updated movie, or null if it doesn't exist
      • removeMovie

        java.lang.Integer removeMovie​(java.lang.Integer id)
        Removes a movie by its ID.
        Parameters:
        id - the ID of the movie to remove
        Returns:
        the ID of the removed movie, or null if no movie with the given ID exists
      • getMovieIds

        java.util.List<java.lang.Integer> getMovieIds​(java.lang.String title,
                                                      java.lang.String director)
        Retrieves a list of IDs for movies that match the given title and director.
        Parameters:
        title - the title of the movie
        director - the director of the movie
        Returns:
        a list of movie IDs that match the provided title and director; an empty list if no matches are found
      • getAllMovieIds

        java.util.List<java.lang.Integer> getAllMovieIds()
        Retrieves IDs of all movies.
        Returns:
        a list of movie IDs (empty if none)
      • getMovieIdsByGenre

        java.util.List<java.lang.Integer> getMovieIdsByGenre​(java.lang.Integer genreId)
        Retrieves IDs of movies that belong to a given genre.
        Parameters:
        genreId - the genre ID
        Returns:
        a list of movie IDs for the given genre (empty if none)
      • getGenreIdsForMovie

        java.util.List<java.lang.Integer> getGenreIdsForMovie​(java.lang.Integer movieId)
        Retrieves IDs of genres associated with a given movie.
        Parameters:
        movieId - the movie ID
        Returns:
        a list of genre IDs for the given movie (empty if none)
      • getMovieIdsByDirector

        java.util.List<java.lang.Integer> getMovieIdsByDirector​(java.lang.String director)
        Retrieves a list of IDs for movies directed by the specified director.
        Parameters:
        director - the director's name
        Returns:
        a list of movie IDs directed by the specified director; an empty list if no matches are found