org.broadleafcommerce.profile.web.core
Class CustomerStateRefresher
java.lang.Object
org.broadleafcommerce.profile.web.core.CustomerStateRefresher
- All Implemented Interfaces:
- EventListener, org.springframework.context.ApplicationListener<CustomerPersistedEvent>
@Component(value="blCustomerStateRefresher")
public class CustomerStateRefresher
- extends Object
- implements org.springframework.context.ApplicationListener<CustomerPersistedEvent>
ApplicationListener responsible for updating CustomerState as well as invalidating the session-based
customer, if one existed previously. For instance, when originally browsing the catalog a Customer is created but only
stored in session and retrieved from session on subsequent requests. However, once the Customer has been persisted
(like when they add something to the cart) then this component is responsible for updating CustomerState as well
as invalidating the session-based customer.
- Author:
- Phillip Verheyden (phillipuniverse)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CustomerStateRefresher
public CustomerStateRefresher()
onApplicationEvent
public void onApplicationEvent(CustomerPersistedEvent event)
- Removes the complete
Customer stored in session and adds a new session variable for just the customer ID. This
should occur once the session-based Customer (all anonymous Customers start out this way) has been persisted.
Also updates CustomerState with the persisted Customer so that it will always represent the most
up-to-date version that is in the database
- Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<CustomerPersistedEvent>
- Parameters:
request - databaseCustomer -
Copyright © 2013. All Rights Reserved.