Order Framework Architecture

The Order Framework architecture is designed to provide two level separation in the framework - Separation of Concerns and Separation of AbstractOrder type.

  1. Separation of Concerns: The main areas of the Order/Cart services are defined and encapsulated in the separate spring beans. Developers can exchange one of those beans with their customized implementations. Within those areas, you can find: order/cart cloning, order/carts saving, data fetching (DAO), order placement, entries management. Each of them is represented by a strategy, DAO, or a service.

  2. Separation of AbstractOrder Type: The main interface AbstractOrderService is a template interface.

    interface AbstractOrderService<O extends AbstractOrderModel, E extends AbstractOrderEntryModel>

    By extending it for a specific order type (OrderModel, CartModel) and order entry type (OrderEntryModel, CartEntryModel) you can obtain a set of its contract methods typed for the target order type. This is exactly how the OrderService and CartService are implemented. Apart from their own type dedicated logic, they share common functionality through the common AbstractOrder part. This separation is also reflected by the default implementations. There is:

    • Generic implementation: For AbstractOrder type, there is DefaultAbstractOrderService.

    • More specific implementation: For Carts, there is DefaultCartService. For Orders, there is DefaultOrderService.

As you can see on the component diagram, the framework is based on the main service - DefaultAbstractOrderService - that binds all the related beans into one ecosystem.

OrderService and CartService provide main touch points for several basic business use cases, for example: order placement, obtaining session cart, order, or cart cloning. Those diversified cases involve many separated concerns. With the spring integration, the framework is decomposed into the smaller components, strategies, and data access object. This approach enables you to replace any of the framework components with another one that fits best into your order framework definition.