Class RatingSummary

java.lang.Object
com.broadleafcommerce.ratings.domain.RatingSummary
All Implemented Interfaces:
Serializable

public class RatingSummary extends Object implements Serializable
See Also:
  • Constructor Details

    • RatingSummary

      public RatingSummary()
  • Method Details

    • getAverageRating

      public Double getAverageRating()
      Return the overall average rating
      Returns:
      The average rating or null if there are no approved ratings.
    • getId

      public String getId()
      The ID of this rating summary
    • getParentRatingSummary

      @Nullable public RatingSummary getParentRatingSummary()
      The parent rating summary. For example, if this is a variant, this points to the RatingSummary of the parent product. Nullable.
    • getRatingTargetType

      public String getRatingTargetType()
      The rating target type, such as PRODUCT or VARIANT. See RatingTargetType
    • getRatingTargetId

      public String getRatingTargetId()
      The id of the rating target. For example the product or variant ID.
    • getParentTargetId

      @Nullable public String getParentTargetId()
      The parent target ID. For example, if the target type is a Variant, this would be the product's ID. Optional.
    • getNumberOfRatings

      public int getNumberOfRatings()
      The total number of ratings for this target. This includes both approved and pending ratings.
    • getNumberOfApprovedRatings

      public int getNumberOfApprovedRatings()
      The total number of approved ratings for this target. Used to calculate the average rating. Includes ratings with APPROVED or NOT_NEEDED status.
      See Also:
    • getRatingTotal

      public long getRatingTotal()
      The total numerical value of all approved ratings for this summary. This is the sum of all approved ratings and is used to calculate the average rating. Includes ratings with APPROVED or NOT_NEEDED status.
      See Also:
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
    • getAttributes

      public Map<String,String> getAttributes()
      Map to capture any additional data
    • setId

      public void setId(String id)
      The ID of this rating summary
    • setParentRatingSummary

      public void setParentRatingSummary(@Nullable RatingSummary parentRatingSummary)
      The parent rating summary. For example, if this is a variant, this points to the RatingSummary of the parent product. Nullable.
    • setRatingTargetType

      public void setRatingTargetType(String ratingTargetType)
      The rating target type, such as PRODUCT or VARIANT. See RatingTargetType
    • setRatingTargetId

      public void setRatingTargetId(String ratingTargetId)
      The id of the rating target. For example the product or variant ID.
    • setParentTargetId

      public void setParentTargetId(@Nullable String parentTargetId)
      The parent target ID. For example, if the target type is a Variant, this would be the product's ID. Optional.
    • setNumberOfRatings

      public void setNumberOfRatings(int numberOfRatings)
      The total number of ratings for this target. This includes both approved and pending ratings.
    • setNumberOfApprovedRatings

      public void setNumberOfApprovedRatings(int numberOfApprovedRatings)
      The total number of approved ratings for this target. Used to calculate the average rating. Includes ratings with APPROVED or NOT_NEEDED status.
      See Also:
    • setRatingTotal

      public void setRatingTotal(long ratingTotal)
      The total numerical value of all approved ratings for this summary. This is the sum of all approved ratings and is used to calculate the average rating. Includes ratings with APPROVED or NOT_NEEDED status.
      See Also:
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      Map to capture any additional data
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object