Introduction

The module’s integration allows your customer:

  • to create a wishlist,

  • to group their favourite products into one

  • or multiple wishlists of their choice.

Business

Development

Core

Entity Definitions

The definitions in this module have id discriminators in the range 320-330.

WishlistEntityDefinition

The WishlistEntityDefinition extends the AbstractEntityDefinition, as shown below:

asciidoctor diagram WishlistEntityDefinition

Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:

Property Description

name

the name of the customer’s wishlist

description

a description of the content for the particular wishlist

publiclyAccessible

a straight-forward boolean value, identifying if the wishlist is publicly accessible or not

defaultWishlist

a straight-forward boolean value, identifying if the particular wishlist is default or not

WishlistEntryEntityDefinition

The WishlistEntryEntityDefinition also extends the AbstractEntityDefinition:

asciidoctor diagram WishlistEntryEntityDefinition

The WishlistEntryEntityDefinition provides methods to handle the information for each and every user’s entry. Via the respective getter-setter pairs, the following information can be retrieved/stored in the database:

Property Description

comment

the user’s comment for a particular item

product

the respective item’s code

desiredQuantity

the number of items wished to be bought

addedDate

the date the entry was added to the wishlist

wishlist

the name of the wishlist the entry is added to.

WishlistNotificationSettingsEntityDefinition

The WishlistNotificationSettingsEntityDefinition extends the NotificationSettingsEntityDefinition, going further to the AbstractEntityDefinition:

asciidoctor diagram WishlistNotificationSettingsEntityDefinition

The only property defined here - wishlist - keeps a reference to the user’s desire to receive ot not a wishlist’s notification.

Spring Data JPA Repositories

WishlistEntryRepository

The WishlistEntryRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the WishlistEntryEntityDefinition.

asciidoctor diagram WishlistEntryRepository
WishlistRepository

The WishlistRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the WishlistEntityDefinition.

asciidoctor diagram WishlistRepository

Business Services

WishlistService

The WishlistService allows different operations with the WishlistEntityDefinition objects. The defined functionalities let you:

Description Method

add an entry to a wishlist with the given id

addWishlistEntry()

create a wishlist

createWishlist()

obtain a public wishlist by its id

getPublicWishlistByCode()

obtain the wishlist by its id for the provided customer

getWishlistByCode()

find a single entry from a wishlist by a productCode

getWishlistEntryByProductCode(WishlistEntityDefinition

find a wishlist and make it default

setDefaultWishlist()

Facade

MapperFactoryConfigurers

WishlistEntryMapperFactoryConfigurer

The WishlistEntryMapperFactoryConfigurer implements the MapperFactoryConfigurer, converting the WishlistEntryEntityDefinition to WishlistEntryDto.

asciidoctor diagram WishlistEntryMapperFactoryConfigurer

The conversion is done byDefault() - all properties with the same names will be automatically mapped.

WishlistMapperFactoryConfigurer

The WishlistMapperFactoryConfigurer implements the MapperFactoryConfigurer, converting the WishlistEntityDefinition to WishlistDto.

asciidoctor diagram WishlistMapperFactoryConfigurer

The registered here conversions are:

  • from WishlistEntityDefinition to WishlistDto (customized) and

  • from ProductEntityDefinition to WishlistDetailsProductDtoDefinition (via the buDefault() method)

More about the mapping configurations you may read in the respective Orika guide.

Dto definitions

WishlistDto

The WishlistDto implements theSerializable. This is the corresponding Dto object for the Wishlist.

WishlistEntryDto

The WishlistEntryDto also implements the Serializable. This is the corresponding Dto object for the WishlistEntry.

WishlistReminderEmailMessageContextDtoDefinition

The WishlistReminderEmailMessageContextDtoDefinition extends the EmailMessageContextDtoDefinition.

asciidoctor diagram WishlistNotificationSettingsEntityDefinition

Facades

WishlistFacade

Some helper methods, related to wishlists, are defined within the WishlistFacade. Among the functionalities included here, are:

  • to add a new entry to the wishlist with the given code of the current user;

  • to create a new entry in the wishlist with the given code of the customer;

  • to create a wishlist for the current user - by or ignoring the username;

  • to get the default wishlist for the current user;

  • to obtain the customer’s wishlist by the given wishlist code;

  • to collect all the wishlists for the current user;

  • to check if a particular product is in any of the user’s wishlists;

  • to delete a wishlist by a given wishlist code

  • to update some information in a user’s wishlist,

  • to set a wishlist as a default one etc.

Storefront

WishlistEntryController

The WishlistEntryController handles 2 HTTP requests. The respective endpoints render either a view, or a JSON:

  • /wishlist/entry/add or /api/wishlist/entry/add with expected parameters wishlistCode (required), productCode, priority, description and userId

  • /wishlist/entry/remove or /api/wishlist/entry/remove with expected parameters wishlistCode and productCode (required)

For further details on mapping, check the corresponding mapping actuator accessible at /platform/mappings.

Test your REST API

Configuration

Name Type Description

nemesis.wishlist.create-default-wishlist-on-register

java.lang.Boolean

Shall we create a default wishlist on user register?

nemesis.wishlist.wishlist-reminder-active

java.lang.Boolean

Is the wishlist reminder job active?