org.broadleafcommerce.core.web.order
Class CartStateRefresher
java.lang.Object
org.broadleafcommerce.core.web.order.CartStateRefresher
- All Implemented Interfaces:
- EventListener, org.springframework.context.ApplicationListener<OrderPersistedEvent>
@Component(value="blCartStateRefresher")
public class CartStateRefresher
- extends Object
- implements org.springframework.context.ApplicationListener<OrderPersistedEvent>
ApplicationListener responsible for updating CartState with a new version that was persisted.
- Author:
- Phillip Verheyden (phillipuniverse)
- See Also:
OrderPersistedEntityListener},
OrderPersistedEvent}
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CartStateRefresher
public CartStateRefresher()
onApplicationEvent
public void onApplicationEvent(OrderPersistedEvent event)
Resets CartState with the newly persisted Order. If CartState was empty, this will only update it if
the Order that has been persisted is the OrderStatus.IN_PROCESS Order for the active
Customer (as determined by CustomerState.getCustomer(). If CartState was not empty,
then it will be replaced only if this newly persisted Order has the same id.
This ensures that whatever is returned from CartState.getCart() will always be the most up-to-date
database version (meaning, safe to write to the DB).
- Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<OrderPersistedEvent>
Copyright © 2013. All Rights Reserved.