@Component(value="blCustomerStateRequestProcessor") public class CustomerStateRequestProcessor extends AbstractBroadleafWebRequestProcessor implements org.springframework.context.ApplicationEventPublisherAware
CustomerStateFilter}| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS_CUSTOMER_ID_SESSION_ATTRIBUTE_NAME |
static String |
ANONYMOUS_CUSTOMER_MERGED_SESSION_ATTRIBUTE_NAME |
static String |
ANONYMOUS_CUSTOMER_SESSION_ATTRIBUTE_NAME |
static String |
BLC_RULE_MAP_PARAM |
protected CustomerMergeExtensionManager |
customerMergeExtensionManager |
protected CustomerService |
customerService |
protected org.springframework.context.ApplicationEventPublisher |
eventPublisher |
protected org.apache.commons.logging.Log |
logger
Logger for this class and subclasses
|
static String |
OVERRIDE_CUSTOMER_SESSION_ATTR_NAME |
| Constructor and Description |
|---|
CustomerStateRequestProcessor() |
| Modifier and Type | Method and Description |
|---|---|
protected Customer |
copyAnonymousCustomerInfoToCustomer(org.springframework.web.context.request.WebRequest request,
Customer anonymous,
Customer customer)
This allows the customer object to be augmented by information that may have been stored on the
anonymous customer or session.
|
Customer |
getAnonymousCustomer(org.springframework.web.context.request.WebRequest request)
Returns the anonymous customer that was saved in session.
|
static String |
getAnonymousCustomerIdSessionAttributeName()
Returns the session attribute to store the anonymous customer ID.
|
static String |
getAnonymousCustomerMergedSessionAttributeName()
This is the name of a session attribute that holds whether or not the anonymous customer has been merged into
the logged in customer.
|
static String |
getAnonymousCustomerSessionAttributeName()
Returns the session attribute to store the anonymous customer.
|
static String |
getCustomerRequestAttributeName()
The request-scoped attribute that should store the
Customer. |
protected Customer |
mergeCustomerIfRequired(org.springframework.web.context.request.WebRequest request,
Customer customer)
Allows the merging of anonymous customer data and / or session data, to the logged in customer, if required.
|
void |
process(org.springframework.web.context.request.WebRequest request) |
Customer |
resolveAnonymousCustomer(org.springframework.web.context.request.WebRequest request)
Implementors can subclass to change how anonymous customers are created.
|
Customer |
resolveAuthenticatedCustomer(org.springframework.security.core.Authentication authentication)
Subclasses can extend to resolve other types of Authentication tokens
|
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher) |
postProcessprotected final org.apache.commons.logging.Log logger
public static final String BLC_RULE_MAP_PARAM
protected CustomerService customerService
protected CustomerMergeExtensionManager customerMergeExtensionManager
protected org.springframework.context.ApplicationEventPublisher eventPublisher
public static final String ANONYMOUS_CUSTOMER_SESSION_ATTRIBUTE_NAME
public static final String ANONYMOUS_CUSTOMER_ID_SESSION_ATTRIBUTE_NAME
public static final String OVERRIDE_CUSTOMER_SESSION_ATTR_NAME
public static final String ANONYMOUS_CUSTOMER_MERGED_SESSION_ATTRIBUTE_NAME
public void process(org.springframework.web.context.request.WebRequest request)
process in interface BroadleafWebRequestProcessorprotected Customer mergeCustomerIfRequired(org.springframework.web.context.request.WebRequest request, Customer customer)
request - customer - protected Customer copyAnonymousCustomerInfoToCustomer(org.springframework.web.context.request.WebRequest request, Customer anonymous, Customer customer)
request - anonymous - customer - public Customer resolveAuthenticatedCustomer(org.springframework.security.core.Authentication authentication)
authentication - public Customer resolveAnonymousCustomer(org.springframework.web.context.request.WebRequest request)
Implementors can subclass to change how anonymous customers are created. Note that this method is intended to actually create the anonymous
customer if one does not exist. If you are looking to just get the current anonymous customer (if it exists) then instead use the
getAnonymousCustomer(WebRequest) method.
The intended behavior of this method is as follows:
Customer on the sessionCustomer)Customer in sessionrequest - #getAnonymousCustomer(WebRequest)},
#getAnonymousCustomerAttributeName()},
#getAnonymousCustomerIdAttributeName()}public Customer getAnonymousCustomer(org.springframework.web.context.request.WebRequest request)
request - the current request#getAnonymousCustomerSessionAttributeName()},
#getAnonymousCustomerIdSessionAttributeName()}public static String getAnonymousCustomerSessionAttributeName()
#getAnonymousCustomerIdAttributeName()
should be used instead.Customer that has not been persisted to the database yetpublic static String getAnonymousCustomerIdSessionAttributeName()
Returns the session attribute to store the anonymous customer ID. This session attribute should be used to track
anonymous customers that have not registered but have state in the database. When users first visit the Broadleaf
site, a new Customer is instantiated but is only saved in session and not persisted to the database. However,
once that user adds something to the cart, that Customer is now saved in the database and it no longer makes
sense to pull back a full Customer object from session, as any session-based Customer will be out of
date in regards to Hibernate (specifically with lists).
So, once Broadleaf detects that the session-based Customer has been persisted, it should remove the session-based
Customer and then utilize just the customer ID from session.
CustomerStateRefresher}public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher eventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic static String getCustomerRequestAttributeName()
Customer.
Customer customer = (Customer) request.getAttribute(CustomerStateRequestProcessor.getCustomerRequestAttributeName()); //this is equivalent to the above invocation Customer customer = CustomerState.getCustomer();
CustomerState}public static String getAnonymousCustomerMergedSessionAttributeName()
Copyright © 2015. All Rights Reserved.