Class CustomerPersistenceHandler
- java.lang.Object
-
- com.broadleafcommerce.auth.user.listener.AuthDataUpdatePersistenceHandler
-
- com.broadleafcommerce.auth.user.listener.CustomerPersistenceHandler
-
- All Implemented Interfaces:
com.broadleafcommerce.common.messaging.PersistenceHandler
public class CustomerPersistenceHandler extends AuthDataUpdatePersistenceHandler
-
-
Constructor Summary
Constructors Constructor Description CustomerPersistenceHandler(UserService<User> userService, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, UserLockoutService userLockoutService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createNewUser(Customer customer)
protected ApplicationService<Application>
getApplicationService()
protected Instant
getChangeTimestamp(com.fasterxml.jackson.databind.JsonNode persistenceMessage)
protected AuthorizedClientService<AuthorizedClient>
getClientService()
String[]
getSupportedSimpleTypeNames()
protected UserCreationProducer
getUserCreationProducer()
protected String
getUserId(Customer customer)
protected UserLockoutService
getUserLockoutService()
protected UserService<User>
getUserService()
protected @NotNull User
handleUserLockoutIfNecessary(Customer customer, User user)
void
hook(String entityJson)
protected IllegalArgumentException
missingTimestampError()
protected void
notifyNewCustomerUserCreated(User user, Customer customer)
protected Customer
parseCustomer(com.fasterxml.jackson.databind.JsonNode entityJson)
void
processStateChange(com.fasterxml.jackson.databind.JsonNode entityJson)
protected List<Application>
readApplicationsForCustomer(Customer customer)
Finds all applications in the data store for the givenCustomer.getCustomerContextId()
.protected String
readAuthServerId(String applicationId)
protected void
updateExistingUser(Customer customer, Instant timestamp)
protected void
updateOrCreateUser(Customer customer, com.fasterxml.jackson.databind.JsonNode entityJson)
protected boolean
updateUserFields(Customer customer, User user)
Updates user fields that auth is concerned with.protected Supplier<IllegalArgumentException>
userNotFound(Customer customer, String userId)
-
Methods inherited from class com.broadleafcommerce.auth.user.listener.AuthDataUpdatePersistenceHandler
getObjectMapper, handle, isNodeNull, isValidType
-
-
-
-
Constructor Detail
-
CustomerPersistenceHandler
public CustomerPersistenceHandler(UserService<User> userService, AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, UserLockoutService userLockoutService)
-
-
Method Detail
-
hook
@StreamListener("persistenceInputAuthCustomer") public void hook(String entityJson)
-
processStateChange
public void processStateChange(com.fasterxml.jackson.databind.JsonNode entityJson)
-
updateOrCreateUser
protected void updateOrCreateUser(Customer customer, com.fasterxml.jackson.databind.JsonNode entityJson)
-
createNewUser
protected void createNewUser(Customer customer)
-
notifyNewCustomerUserCreated
protected void notifyNewCustomerUserCreated(User user, Customer customer)
-
updateUserFields
protected boolean updateUserFields(Customer customer, User user)
Updates user fields that auth is concerned with.- Parameters:
customer
- The customer fromuser
- The user to set fields on.- Returns:
- true if a value was updated, else false.
-
userNotFound
protected Supplier<IllegalArgumentException> userNotFound(Customer customer, String userId)
-
parseCustomer
protected Customer parseCustomer(com.fasterxml.jackson.databind.JsonNode entityJson)
-
readApplicationsForCustomer
protected List<Application> readApplicationsForCustomer(Customer customer)
Finds all applications in the data store for the givenCustomer.getCustomerContextId()
.- Parameters:
customer
- the customer for which to find applications in the data store- Returns:
- the applications in the data store for the
Customer.getCustomerContextId()
. Never empty. - Throws:
IllegalArgumentException
- if no applications were found
-
getChangeTimestamp
protected Instant getChangeTimestamp(com.fasterxml.jackson.databind.JsonNode persistenceMessage)
-
handleUserLockoutIfNecessary
@NotNull protected @NotNull User handleUserLockoutIfNecessary(Customer customer, User user)
-
missingTimestampError
protected IllegalArgumentException missingTimestampError()
-
getSupportedSimpleTypeNames
public String[] getSupportedSimpleTypeNames()
-
getClientService
protected AuthorizedClientService<AuthorizedClient> getClientService()
-
getApplicationService
protected ApplicationService<Application> getApplicationService()
-
getUserCreationProducer
protected UserCreationProducer getUserCreationProducer()
-
getUserService
protected UserService<User> getUserService()
-
getUserLockoutService
protected UserLockoutService getUserLockoutService()
-
-