Introduction
The module’s integration allows your customer:
-
to add reviews to chosen products and
-
to add ratings to chosen products
Development
Core
Entity Definitions
The definitions in this module have id discriminators in the range 170-180. |
The CustomerReviewEntityDefinition extends the AbstractEntityDefinition and the AbstractUserableEntityDefinition:

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:
Property | Description |
---|---|
locale |
stores the locale in which the customer review was created |
alias |
stores the alias of the user who created the customer review |
content |
stores the customer review itself |
headline |
stores the headline of this customer review |
rating |
stores the rating of the customer review |
product |
stores the product the customer review is for |
The ReviewedProductEntityDefinition extends the ProductEntityDefinition. The ProductEntityDefinition
, in its turn, goes further to the AbstractEntityDefinition, the AbstractActivatableEntityDefinition, the AbstractCatalogableEntityDefinition, the AbstractDescriptionableEntityDefinition and the AbstractNameableEntityDefinition:

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:
Property | Description |
---|---|
rating |
stores the overall rating of the product |
reviews |
stores a set of all customer reviews for the product |
Spring Data JPA Repositories
The CustomerReviewRepository extends the BaseEntityRepository
and is the corresponding Spring Data JPA repository for the CustomerReviewEntityDefinition
:

Business Services
The CustomerReviewService defines a method - createCustomerReview()
- that, when invoked, based on the passed parameters, creates the customer review.
Facade
MapperFactoryConfigurers
The CustomerReviewMapperFactoryConfigurer implements the MapperFactoryConfigurer, converting the CustomerReviewEntityDefinition
to CustomerReviewDto
:

The conversion is done via the byDeafult()
method.
The ReviewedProductMapperFactoryConfigurer implements the MapperFactoryConfigurer:

The registered conversions, within the configurer, are:
-
from
ReviewedProductEntityDefinition
toReviewedProductDtoDefinition
, -
from
ReviewedProductEntityDefinition
toReviewedDetailsProductDtoDefinition
and -
from
ReviewedProductEntityDefinition
toCustomerReviewProductDtoDefinition
.
Apart from the customized conversion, the other 2 are done via the byDefault()
method.
Dto definitions
The CustomerReviewProductDtoDefinition is the corresponding Dto object for the ReviewedProductEntityDefinition
:

The ReviewedProductDtoDefinition is the corresponding Dto object for the ReviewedProductEntityDefinition
.
The ReviewedDetailsProductDtoDefinition inherits the features, defined in the DetailsProductDtoDefinition, in the ReviewedProductDtoDefinition, in the UrlProductDtoDefinition, in the DetailsDtoDefinition, in the AbstractProductDtoDefinition and in the ProductUrlDtoDefinition:

The ReviewedDetailsProductDtoDefinition
is the corresponding Dto object for the ReviewedProductEntityDefinition
.
The ReviewedProductReferenceProductDtoDefinition combines the review attributes, defined in the ReviewedProductDtoDefinition and the reference attributes from the ProductReferenceProductDtoDefinition. The ProductReferenceProductDtoDefinition
, in its turn, combines the basic attributes of the AbstractProductDtoDefinition, the ProductBasicDtoDefinition, the ProductUrlDtoDefinition, the ProductPrimaryImageDtoDefinition, the ProductPriceDtoDefinition, the ProductDiscountDtoDefinition, the ProductDescriptionDtoDefinition, the ProductVariantOptionsDtoDefinition, the ProductGalleryImagesDtoDefinition and the ProductBaseOptionsDtoDefinition
The ReviewedSearchProductDtoDefinition combines the review attributes, defined in the ReviewedProductDtoDefinition and the search attributes from the SearchProductDtoDefinition. The SearchProductDtoDefinition
, in its turn, relies on the defined features in the AbstractProductDtoDefinition, the SearchDtoDefinition, the ProductBasicDtoDefinition, the ProductDescriptionDtoDefinition, the ProductPriceDtoDefinition, the ProductDiscountDtoDefinition, the ProductBreadcrumbMapperFactoryConfigurer, and the AbstractProductImagesDtoDefinition:
Facades
Some helper methods are defined within the CustomerReviewFacade. Among the functionalities included here, are:
-
to post a new review for the specified product and
-
to get all reviews for the specified product
Storefront
The CustomerReviewController extends the AbstractViewController:

The CustomerReviewController
defines 2 HTTP Endpoints:
-
at
/reviews/{productCode}
and -
at
/review/{productCode}
As a result, the controller will return the reviews for a given product as a JSP view, or as JSON (depending on the content-type provided).
For further details on mapping, check the corresponding mapping actuator accessible at /platform/mappings
.