@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.OrderPersistedEntityListener},
OrderPersistedEvent}| Constructor and Description |
|---|
CartStateRefresher() |
| Modifier and Type | Method and Description |
|---|---|
void |
onApplicationEvent(OrderPersistedEvent event)
Resets
CartState with the newly persisted Order. |
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).
onApplicationEvent in interface org.springframework.context.ApplicationListener<OrderPersistedEvent>Copyright © 2015. All Rights Reserved.