Interface TagsOperations


  • public interface TagsOperations
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Integer addTag​(java.lang.Integer movieId, java.lang.String tag)
      Adds a tag to the specified movie.
      java.util.List<java.lang.String> getAllTags()
      Retrieves a list of all distinct tags present in the system.
      java.util.List<java.lang.Integer> getMovieIdsByTag​(java.lang.String tag)
      Retrieves IDs of all movies that have the specified tag.
      java.util.List<java.lang.String> getTagsForMovie​(java.lang.Integer movieId)
      Retrieves all tags for the specified movie.
      boolean hasTag​(java.lang.Integer movieId, java.lang.String tag)
      Checks whether a specific (movieId, tag) association exists.
      int removeAllTagsForMovie​(java.lang.Integer movieId)
      Removes all tags from the specified movie.
      java.lang.Integer removeTag​(java.lang.Integer movieId, java.lang.String tag)
      Removes a tag from the specified movie.
    • Method Detail

      • addTag

        java.lang.Integer addTag​(java.lang.Integer movieId,
                                 java.lang.String tag)
        Adds a tag to the specified movie.
        Parameters:
        movieId - the ID of the movie
        tag - the tag to add
        Returns:
        the ID of the movie if the tag was added; null if the movie does not exist or the (movieId, tag) pair already exists
      • removeTag

        java.lang.Integer removeTag​(java.lang.Integer movieId,
                                    java.lang.String tag)
        Removes a tag from the specified movie.
        Parameters:
        movieId - the ID of the movie
        tag - the tag to remove
        Returns:
        the ID of the movie if the tag was removed; null if no such (movieId, tag) exists
      • removeAllTagsForMovie

        int removeAllTagsForMovie​(java.lang.Integer movieId)
        Removes all tags from the specified movie.
        Parameters:
        movieId - the ID of the movie
        Returns:
        the number of removed tags (0 if the movie has no tags or does not exist)
      • hasTag

        boolean hasTag​(java.lang.Integer movieId,
                       java.lang.String tag)
        Checks whether a specific (movieId, tag) association exists.
        Parameters:
        movieId - the ID of the movie
        tag - the tag to check
        Returns:
        true if the movie has the specified tag; false otherwise
      • getTagsForMovie

        java.util.List<java.lang.String> getTagsForMovie​(java.lang.Integer movieId)
        Retrieves all tags for the specified movie.
        Parameters:
        movieId - the ID of the movie
        Returns:
        a list of tags for the movie; an empty list if the movie has no tags or does not exist
      • getMovieIdsByTag

        java.util.List<java.lang.Integer> getMovieIdsByTag​(java.lang.String tag)
        Retrieves IDs of all movies that have the specified tag.
        Parameters:
        tag - the tag to filter by
        Returns:
        a list of movie IDs that have the tag; an empty list if none found
      • getAllTags

        java.util.List<java.lang.String> getAllTags()
        Retrieves a list of all distinct tags present in the system.
        Returns:
        a list of unique tags; an empty list if no tags exist