Introduction

The module’s integration allows your customer:

  • to add reviews to chosen products and

  • to add ratings to chosen products

Business

Development

Core

Entity Definitions

The definitions in this module have id discriminators in the range 170-180.

CustomerReviewEntityDefinition

The CustomerReviewEntityDefinition extends the AbstractEntityDefinition and the AbstractUserableEntityDefinition:

asciidoctor diagram CustomerReviewEntityDefinition

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

asciidoctor diagram ReviewedProductEntityDefinition

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

CustomerReviewRepository

The CustomerReviewRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the CustomerReviewEntityDefinition:

asciidoctor diagram CustomerReviewRepository

Business Services

CustomerReviewService

The CustomerReviewService defines a method - createCustomerReview() - that, when invoked, based on the passed parameters, creates the customer review.

Facade

MapperFactoryConfigurers

CustomerReviewMapperFactoryConfigurer

The CustomerReviewMapperFactoryConfigurer implements the MapperFactoryConfigurer, converting the CustomerReviewEntityDefinition to CustomerReviewDto:

asciidoctor diagram CustomerReviewMapperFactoryConfigurer

The conversion is done via the byDeafult() method.

ReviewedProductMapperFactoryConfigurer

The ReviewedProductMapperFactoryConfigurer implements the MapperFactoryConfigurer:

asciidoctor diagram ReviewedProductMapperFactoryConfigurer

The registered conversions, within the configurer, are:

  • from ReviewedProductEntityDefinition to ReviewedProductDtoDefinition,

  • from ReviewedProductEntityDefinition to ReviewedDetailsProductDtoDefinition and

  • from ReviewedProductEntityDefinition to CustomerReviewProductDtoDefinition.

Apart from the customized conversion, the other 2 are done via the byDefault() method.

Dto definitions

CustomerReviewProductDtoDefinition

The CustomerReviewProductDtoDefinition is the corresponding Dto object for the ReviewedProductEntityDefinition:

asciidoctor diagram CustomerReviewProductDtoDefinition
ReviewedProductDtoDefinition

The ReviewedProductDtoDefinition is the corresponding Dto object for the ReviewedProductEntityDefinition.

ReviewedDetailsProductDtoDefinition

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:

asciidoctor diagram ReviewedDetailsProductDtoDefinition

The ReviewedDetailsProductDtoDefinition is the corresponding Dto object for the ReviewedProductEntityDefinition.

ReviewedProductReferenceProductDtoDefinition

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

ReviewedSearchProductDtoDefinition

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

CustomerReviewFacade

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

CustomerReviewController

The CustomerReviewController extends the AbstractViewController:

asciidoctor diagram CustomerReviewController

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.

Integration

The integration with the Nemesis platform is pretty straight-forward - just add the module in your classpath:

<dependency>
    <groupId>io.nemesis.platform.module</groupId>
    <artifactId>nemesis-module-customerreview</artifactId>
</dependency>