AbstractOrderService
The AbstractOrderService is the main component for the Order Framework extensibility. It delegates the particular method calls to the dedicated strategies, DAOs, and subservices.
The AbstractOrderService joins all the common functionalities that are applicable for all of the AbstractOrder subtypes in the system (for example, Order or Cart). Here, you can find methods to find order instances, order entries instances, but also to add new entries. Such functionality is common for any type of order or cart. But you can’t find here the methods for order placement or session cart management as AbstractOrder type is not the type those methods belong to.
The following table groups the methods into the corresponding beans that handle them. This would give you the idea which parts of the main and shared functionality belong to which dependent spring bean's responsibilities.
|
AbstractOrderService Methods |
Responsible Spring Bean |
Spring Bean Role |
|---|---|---|
|
addNewEntry(...) |
abstractOrderEntryService abstractOrderEntryTypeService |
Resolve the proper type of the entry for the given order instance. Create the order entry. |
|
clone(...) |
cloneAbstractOrderStrategy for its purpose, you can obtain the set of the functionalities for the order type of your choice. The order framework comes with two type-dedicated services: |
Performs deep cloning of the target AbstractOrder instance. Uses cloning context to preset or skip attributes. |
|
getEntryForNumber(final O order, final int number) getEntriesForNumber(final O order, final int start, final int end) getEntriesForProduct |
orderDao |
Constructs flexible search queries the persistence layer. |
|
saveOrder(...) |
saveAbstractOrderStrategy |
Responsible for persisting order or cart models. |
By extending the AbstractOrderService for a specific type and extending DefaultAbstractOrderServiceOrderService and CartService.
The following code snippet shows the spring configuration of the AbstractOrderService:
for its purpose, you can obtain the set of the functionalities for the order type of your choice. The order framework comes with two<!-- Extend this service for the purpose of extended AbstractOrder types (MyOrder). For Order and Cart there are services available out of the box. --> <bean id="abstractOrderService" class="de.hybris.platform.order.impl.DefaultAbstractOrderService" abstract="true" parent="abstractBusinessService" > <property name="orderDao" ref="orderDao"/> <property name="abstractOrderEntryService" ref="abstractOrderEntryService"/> <property name="abstractOrderEntryTypeService" ref="abstractOrderEntryTypeService"/> <property name="saveAbstractOrderStrategy" ref="saveAbstractOrderStrategy"/> <property name="cloneAbstractOrderStrategy" ref="cloneAbstractOrderStrategy"/> </bean>