public interface CustomerService
| Modifier and Type | Method and Description | 
|---|---|
| void | addPostRegisterListener(PostRegistrationObserver postRegisterListeners) | 
| Customer | changePassword(PasswordChange passwordChange) | 
| GenericResponse | checkPasswordResetToken(String token,
                       Customer customer)Verifies that a customer has a valid token. | 
| Customer | createCustomer() | 
| Customer | createCustomerFromId(Long customerId) | 
| Customer | createCustomerWithNullId()Returns a non-persisted  Customerwith a null id. | 
| Customer | createNewCustomer()Deprecated. 
 use  createCustomer()orcreateCustomerWithNullId()} instead. | 
| void | createRegisteredCustomerRoles(Customer customer)Subclassed implementations can assign unique roles for various customer types | 
| boolean | customerPassesCustomerRule(Customer customer,
                          CustomerRuleHolder customerRuleHolder)Determines if the given customer passes the MVEL customer rule | 
| void | deleteCustomer(Customer customer)Delete the customer entity from the persistent store | 
| void | detachCustomer(Customer customer)Detaches the given Customer instance from the entity manager. | 
| String | encodePassword(String rawPassword)Encodes the clear text parameter, using the salt provided by PasswordEncoder. | 
| Long | findNextCustomerId()Allow customers to call from subclassed service. | 
| List<PasswordUpdatedHandler> | getPasswordChangedHandlers() | 
| List<PasswordUpdatedHandler> | getPasswordResetHandlers() | 
| boolean | isPasswordValid(String rawPassword,
               String encodedPassword)Determines if a password is valid by comparing it to the encoded string, salting is handled internally to the  PasswordEncoder. | 
| List<Customer> | readBatchCustomers(int start,
                  int pageSize) | 
| Customer | readCustomerByEmail(String emailAddress) | 
| Customer | readCustomerByExternalId(String userExternalId) | 
| Customer | readCustomerById(Long userId) | 
| Customer | readCustomerByUsername(String customerName) | 
| Customer | readCustomerByUsername(String username,
                      Boolean cacheable) | 
| Long | readNumberOfCustomers() | 
| Customer | registerCustomer(Customer customer,
                String password,
                String passwordConfirm) | 
| void | removePostRegisterListener(PostRegistrationObserver postRegisterListeners) | 
| Customer | resetPassword(PasswordReset passwordReset) | 
| GenericResponse | resetPasswordUsingToken(String username,
                       String token,
                       String password,
                       String confirmPassword)Updates the password for the passed in customer only if the passed
 in token is valid for that customer. | 
| Customer | saveCustomer(Customer customer) | 
| Customer | saveCustomer(Customer customer,
            boolean register) | 
| GenericResponse | sendForcedPasswordChangeNotification(String userName,
                                    String forgotPasswordUrl)Generates an access token and then emails the user. | 
| GenericResponse | sendForgotPasswordNotification(String userName,
                              String forgotPasswordUrl)Generates an access token and then emails the user. | 
| GenericResponse | sendForgotUsernameNotification(String emailAddress)Looks up the corresponding  Customerand emails the address on file with
 the associated username. | 
| void | setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers) | 
| void | setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers) | 
Customer registerCustomer(Customer customer, String password, String passwordConfirm)
Customer changePassword(PasswordChange passwordChange)
Customer createCustomer()
Customer createCustomerWithNullId()
Customer with a null id. Typically used with registering a new
 customer or creating a new anonymous customer. Creating a customer with null id so that we don't
 need to query the database for the next id everytime an anonymous customer browses the site.void deleteCustomer(Customer customer)
customer - the customer entity to removevoid detachCustomer(Customer customer)
customer - Customer createCustomerFromId(Long customerId)
Customer by first looking in the database, otherwise creating a new non-persisted CustomercustomerId - the id of the customer to lookup@Deprecated Customer createNewCustomer()
createCustomer() or createCustomerWithNullId()} instead.Customer.void createRegisteredCustomerRoles(Customer customer)
customer - Customer to create roles forvoid addPostRegisterListener(PostRegistrationObserver postRegisterListeners)
void removePostRegisterListener(PostRegistrationObserver postRegisterListeners)
Customer resetPassword(PasswordReset passwordReset)
List<PasswordUpdatedHandler> getPasswordResetHandlers()
void setPasswordResetHandlers(List<PasswordUpdatedHandler> passwordResetHandlers)
List<PasswordUpdatedHandler> getPasswordChangedHandlers()
void setPasswordChangedHandlers(List<PasswordUpdatedHandler> passwordChangedHandlers)
GenericResponse sendForgotUsernameNotification(String emailAddress)
Customer and emails the address on file with
 the associated username.emailAddress - user's email addressGenericResponse sendForgotPasswordNotification(String userName, String forgotPasswordUrl)
userName - - the user to send a reset password email to.forgotPasswordUrl - - Base url to include in the email.GenericResponse sendForcedPasswordChangeNotification(String userName, String forgotPasswordUrl)
userName - - the user to send a reset password email to.forgotPasswordUrl - - Base url to include in the email.GenericResponse resetPasswordUsingToken(String username, String token, String password, String confirmPassword)
username - Username of the customertoken - Valid reset tokenpassword - new passwordGenericResponse checkPasswordResetToken(String token, Customer customer)
token - password reset tokencustomer - Customer who owns the tokenLong findNextCustomerId()
String encodePassword(String rawPassword)
 This method can only be called once per password. The salt is randomly generated internally in the PasswordEncoder
 and appended to the hash to provide the resulting encoded password. Once this has been called on a password,
 going forward all checks for authenticity must be done by isPasswordValid(String, String) as encoding the
 same password twice will result in different encoded passwords.
rawPassword - the unencoded passwordboolean isPasswordValid(String rawPassword, String encodedPassword)
PasswordEncoder.
 
 This method must always be called to verify if a password is valid after the original encoded password is generated
 due to PasswordEncoder randomly generating salts internally and appending them to the resulting hash.
rawPassword - the unencoded passwordencodedPassword - the encoded password to compare againstboolean customerPassesCustomerRule(Customer customer, CustomerRuleHolder customerRuleHolder)
customer - customerRuleHolder - an MVEL rule targeting CustomersLong readNumberOfCustomers()
Copyright © 2022. All rights reserved.