Class ReviewHandler

java.lang.Object
moblima.control.handlers.MovieHandler
moblima.control.handlers.ReviewHandler

public class ReviewHandler extends MovieHandler
The type Review handler.
  • Field Details

    • reviews

      protected List<Review> reviews
      The Reviews.
    • selectedReviewIdx

      protected int selectedReviewIdx
      The Selected review idx.
  • Constructor Details

    • ReviewHandler

      public ReviewHandler()
      Instantiates a new Review handler.
  • Method Details

    • getSelectedReview

      public Review getSelectedReview()
      Gets selected review.
      Returns:
      the selected review
    • setSelectedReviewIdx

      public void setSelectedReviewIdx(int reviewIdx)
      Sets selected review idx.
      Parameters:
      reviewIdx - the review idx
    • getReview

      public Review getReview(int reviewIdx)
      Gets review.
      Parameters:
      reviewIdx - the review idx
      Returns:
      the review
    • getReview

      public Review getReview(String reviewId)
      Gets review.
      Parameters:
      reviewId - the review id
      Returns:
      the review
    • getReviewIdx

      public int getReviewIdx(String reviewId)
      Gets review idx.
      Parameters:
      reviewId - the review id
      Returns:
      the review idx
    • getReviews

      public List<Review> getReviews()
      Gets reviews.
      Returns:
      the reviews
    • updateReview

      public boolean updateReview(int rating, String reviewContent)
      Update review boolean.
      Parameters:
      rating - the rating
      reviewContent - the review content
      Returns:
      the boolean
    • removeReview

      public boolean removeReview(String reviewId)
      Remove review boolean.
      Parameters:
      reviewId - the review id
      Returns:
      the boolean
    • getMovieReviews

      public List<Review> getMovieReviews(int movieId)
      Gets movie reviews.
      Parameters:
      movieId - the movie id
      Returns:
      the movie reviews
    • getUserReviews

      public List<Review> getUserReviews(String authorId)
      Gets user reviews.
      Parameters:
      authorId - the author id
      Returns:
      the user reviews
    • addReview

      public int addReview(int movieId, String review, int rating, String authorName, String authorId)
      Add review int.
      Parameters:
      movieId - the movie id
      review - the review
      rating - the rating
      authorName - the author name
      authorId - the author id
      Returns:
      the int
    • computeMovieRatings

      public double computeMovieRatings(int movieId)
      Compute movie ratings double.
      Parameters:
      movieId - the movie id
      Returns:
      the double
    • checkIfAlreadyReviewed

      public String checkIfAlreadyReviewed(String authorId, int movieId)
      Check if already reviewed string.
      Parameters:
      authorId - the author id
      movieId - the movie id
      Returns:
      the string
    • printMovieDetails

      public String printMovieDetails(int movieIdx, boolean showTruncated)
      Print movie details.
      Parameters:
      movieIdx - the movie idx
      showTruncated - the show truncated
      Returns:
      the string
    • saveReviews

      protected boolean saveReviews()
      Save reviews boolean.
      Returns:
      the boolean