Class CustomerPersistenceUtil
java.lang.Object
com.broadleafcommerce.auth.user.messaging.util.CustomerPersistenceUtil
An utility class that helps with the persistence of
Customer entities.- Author:
- Sunny Yu
-
Constructor Summary
ConstructorsConstructorDescriptionCustomerPersistenceUtil(AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, UserService<User> userService, UserMappingPropertiesService<UserMappingProperties.FieldMapping> userMappingPropertiesService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionbuildUserFromCustomer(@NonNull Customer customer) createUserAndNotify(@NonNull User user, @NonNull Customer customer) Persists the givenUserand sends anUserCreationEvent.createUserAndNotify(@NonNull Customer customer) protected ApplicationService<Application>protected AuthorizedClientService<AuthorizedClient>protected com.fasterxml.jackson.databind.ObjectMapperprotected com.broadleafcommerce.common.extension.TypeFactoryprotected UserCreationProducerprotected UserService<User>booleanmapAdditionalAttributes(@NonNull Customer customer, @NonNull User user) protected voidnotifyNewCustomerUserCreated(@NonNull User user, @NonNull Customer customer) Sends theUserCreationEventfor the givenUser.readApplicationsForCustomer(@NonNull Customer customer) Finds all applications in the data store for the givenCustomer.getCustomerContextId().protected StringreadAuthServerId(@NonNull String applicationId)
-
Constructor Details
-
CustomerPersistenceUtil
public CustomerPersistenceUtil(AuthorizedClientService<AuthorizedClient> clientService, ApplicationService<Application> applicationService, UserCreationProducer userCreationProducer, UserService<User> userService, UserMappingPropertiesService<UserMappingProperties.FieldMapping> userMappingPropertiesService, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
createUserAndNotify
- Parameters:
customer- the customer to create a user for- Returns:
- the created
User
-
buildUserFromCustomer
- Parameters:
customer- the customer to build a user from- Returns:
- the built
User
-
createUserAndNotify
Persists the givenUserand sends anUserCreationEvent.- Parameters:
user- the user to persistcustomer- the customer that the user was created for- Returns:
- the persisted
User
-
readApplicationsForCustomer
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
-
mapAdditionalAttributes
public boolean mapAdditionalAttributes(@NonNull @NonNull Customer customer, @NonNull @NonNull User user) - Parameters:
customer- The customer spawning the event.user- The user to update.- Returns:
- Whether any updates occurred.
- See Also:
-
notifyNewCustomerUserCreated
protected void notifyNewCustomerUserCreated(@NonNull @NonNull User user, @NonNull @NonNull Customer customer) Sends theUserCreationEventfor the givenUser. -
readAuthServerId
-
getClientService
-
getApplicationService
-
getUserCreationProducer
-
getUserService
-
getUserMappingPropertiesService
protected UserMappingPropertiesService<UserMappingProperties.FieldMapping> getUserMappingPropertiesService() -
getObjectMapper
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper() -
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-