Class CustomerReviewManager

All Implemented Interfaces:
ItemLifecycleListener, Serializable

public class CustomerReviewManager extends GeneratedCustomerReviewManager
This is the extension manager of the CustomerReview extension.
See Also:
  • Constructor Details

    • CustomerReviewManager

      public CustomerReviewManager()
  • Method Details

    • getInstance

      public static CustomerReviewManager getInstance()
      Gets the valid instance of this manager.
      Returns:
      the current instance of this manager
    • createEssentialData

      public void createEssentialData(Map params, JspContext jspc)
      Creates the essential data for CustomerReview. The essential data are restrictions on customerReview item, so that they are not selected and shown for customer users.
      Overrides:
      createEssentialData in class Extension
      Parameters:
      params - Ignored
      jspc - Ignored
    • createCustomerReview

      public CustomerReview createCustomerReview(Double rating, String headline, String comment, User user, Product product)
      Creates a new CustomerReview item
      Parameters:
      rating - The rating for this review
      headline - The optional headline for this review
      comment - The optional comment for this review
      user - The user, who created the review
      product - The product for which the review is given
      Returns:
      A new CustomerReview item
    • getAverageRating

      public Double getAverageRating(SessionContext ctx, Product item)
      Calculates the average rating for a product
      Specified by:
      getAverageRating in class GeneratedCustomerReviewManager
      Parameters:
      ctx - The context
      item - The Product for which the average rating shall be calculated
      Returns:
      The average of all ratings for the given product.
    • getNumberOfReviews

      public Integer getNumberOfReviews(SessionContext ctx, Product item)
      Get the number of reviews for the given product
      Specified by:
      getNumberOfReviews in class GeneratedCustomerReviewManager
      Parameters:
      ctx - The context
      item - The Product for which the number of review shall be retrieved
      Returns:
      The number of reviews for the given product.
    • getAllReviews

      public List<CustomerReview> getAllReviews(Product item)
      Get a list of all reviews for the given product using the current session context
      Parameters:
      item - The Product for which the list of review shall be retrieved
      Returns:
      The list of all reviews for the given product.
    • getAllReviews

      public List<CustomerReview> getAllReviews(SessionContext ctx, Product item)
      Get a list of all reviews for the given product
      Parameters:
      ctx - The context
      item - The Product for which the list of review shall be retrieved
      Returns:
      The list of all reviews for the given product.