Class DefaultCustomerFacade
- java.lang.Object
-
- de.hybris.platform.commercefacades.customer.impl.DefaultCustomerFacade
-
- All Implemented Interfaces:
CustomerFacade
- Direct Known Subclasses:
DefaultB2BCustomerFacade,DefaultChineseCustomerFacade,ProfileCustomerFacade
public class DefaultCustomerFacade extends java.lang.Object implements CustomerFacade
Default implementation for theCustomerFacade.
-
-
Constructor Summary
Constructors Constructor Description DefaultCustomerFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeGuestToCustomer(java.lang.String pwd, java.lang.String orderGUID)Create a regular customer from a guest customer who has just completed the guest checkout.voidchangePassword(java.lang.String oldPassword, java.lang.String newPassword)Changes current user password.voidchangeUid(java.lang.String newUid, java.lang.String currentPassword)Change the current customer's UID.CustomerDatacloseAccount()Close Account for current session user.voidcreateGuestUserForAnonymousCheckout(java.lang.String email, java.lang.String name)Creates a new guest customer for anonymousCheckout and sets the email and name.voidforgottenPassword(java.lang.String id)Sends a forgotten password request for the customer specified.java.lang.StringgenerateGUID()Generates a customer ID during registrationprotected Converter<AddressModel,AddressData>getAddressConverter()protected Populator<AddressData,AddressModel>getAddressReversePopulator()protected BaseSiteServicegetBaseSiteService()protected BaseStoreServicegetBaseStoreService()protected CartCleanStrategygetCartCleanStrategy()protected CartServicegetCartService()protected CommerceCartServicegetCommerceCartService()protected CommonI18NServicegetCommonI18NService()protected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData>getCreditCardPaymentInfoConverter()CustomerDatagetCurrentCustomer()Returns the current session user.java.lang.StringgetCurrentCustomerUid()Returns the uid of current session user.protected CustomerModelgetCurrentSessionCustomer()protected UserModelgetCurrentUser()protected CustomerAccountServicegetCustomerAccountService()protected Converter<UserModel,CustomerData>getCustomerConverter()protected CustomerNameStrategygetCustomerNameStrategy()protected Populator<CustomerData,UserModel>getCustomerReversePopulator()EventServicegetEventService()protected ModelServicegetModelService()protected OrderFacadegetOrderFacade()protected PasswordEncoderServicegetPasswordEncoderService()protected SessionServicegetSessionService()protected StoreSessionFacadegetStoreSessionFacade()protected Converter<TitleModel,TitleData>getTitleConverter()protected UserFacadegetUserFacade()CustomerDatagetUserForUID(java.lang.String userId)Gets the user for UID.protected UserMatchingServicegetUserMatchingService()protected UserServicegetUserService()protected AbstractCommerceUserEventinitializeCommerceEvent(AbstractCommerceUserEvent event, CustomerModel customerModel)voidloginSuccess()updates the session currency and language to the user settings, assigns the cart to the current user and calculates the cartCustomerDatanextDummyCustomerData(RegisterData registerData)Generate dummy customer data with random customerId to return if user already exists in database.voidregister(RegisterData registerData)Register a user with given parametersvoidrememberMeLoginSuccessWithUrlEncoding(boolean languageEncoding, boolean currencyEncoding)This method will be used by rememberMeServices when there is encoding attributes for language and currency.voidsetAddressConverter(Converter<AddressModel,AddressData> addressConverter)voidsetAddressReversePopulator(Populator<AddressData,AddressModel> addressReversePopulator)voidsetBaseSiteService(BaseSiteService siteService)voidsetBaseStoreService(BaseStoreService service)voidsetCartCleanStrategy(CartCleanStrategy cartCleanStrategy)voidsetCartService(CartService cartService)voidsetCommerceCartService(CommerceCartService commerceCartService)voidsetCommonI18NService(CommonI18NService commonI18NService)protected voidsetCommonPropertiesForRegister(RegisterData registerData, CustomerModel customerModel)voidsetCreditCardPaymentInfoConverter(Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> creditCardPaymentInfoConverter)voidsetCustomerAccountService(CustomerAccountService customerAccountService)voidsetCustomerConverter(Converter<UserModel,CustomerData> customerConverter)voidsetCustomerNameStrategy(CustomerNameStrategy customerNameStrategy)voidsetCustomerReversePopulator(Populator<CustomerData,UserModel> customerReversePopulator)voidsetEventService(EventService eventService)voidsetModelService(ModelService modelService)voidsetOrderFacade(OrderFacade orderFacade)voidsetPassword(java.lang.String userId, java.lang.String newPassword)Sets the new password for the user.voidsetPasswordEncoderService(PasswordEncoderService passwordEncoderService)voidsetSessionService(SessionService sessionService)voidsetStoreSessionFacade(StoreSessionFacade storeSessionFacade)voidsetTitleConverter(Converter<TitleModel,TitleData> titleConverter)protected voidsetTitleForRegister(RegisterData registerData, CustomerModel customerModel)protected voidsetUidForRegister(RegisterData registerData, CustomerModel customer)Initializes a customer with given registerDatavoidsetUserFacade(UserFacade userFacade)voidsetUserMatchingService(UserMatchingService userMatchingService)voidsetUserService(UserService userService)voidupdateCartWithGuestForAnonymousCheckout(CustomerData guestCustomerData)Guest customer which is created for anonymous checkout will be the cart user.voidupdateFullProfile(CustomerData customerData)Updates current customer's profile with given parametersvoidupdatePassword(java.lang.String token, java.lang.String newPassword)Update the password for the user by decrypting and validating the token.voidupdateProfile(CustomerData customerData)Updates current customer's profile with given parametersprotected booleanupdateSessionCurrency(CurrencyData preferredCurrency, CurrencyData defaultCurrency)protected booleanupdateSessionLanguage(LanguageData preferredLanguage, LanguageData defaultLanguage)protected voidvalidateDataBeforeUpdate(CustomerData customerData)
-
-
-
Method Detail
-
getCurrentCustomer
public CustomerData getCurrentCustomer()
Description copied from interface:CustomerFacadeReturns the current session user.- Specified by:
getCurrentCustomerin interfaceCustomerFacade- Returns:
- current session user data
-
getCurrentUser
protected UserModel getCurrentUser()
-
getCurrentCustomerUid
public java.lang.String getCurrentCustomerUid()
Description copied from interface:CustomerFacadeReturns the uid of current session user.- Specified by:
getCurrentCustomerUidin interfaceCustomerFacade- Returns:
- current session user uid
-
changePassword
public void changePassword(java.lang.String oldPassword, java.lang.String newPassword) throws PasswordMismatchExceptionDescription copied from interface:CustomerFacadeChanges current user password. If current session user is anonymous nothing happens.- Specified by:
changePasswordin interfaceCustomerFacade- Parameters:
oldPassword- old password to confirmnewPassword- new password to set- Throws:
PasswordMismatchException- if the given old password does not match the one stored in the system
-
register
public void register(RegisterData registerData) throws DuplicateUidException
Description copied from interface:CustomerFacadeRegister a user with given parameters- Specified by:
registerin interfaceCustomerFacade- Parameters:
registerData- the user data the user will be registered with- Throws:
DuplicateUidException- if the login is not unique
-
nextDummyCustomerData
public CustomerData nextDummyCustomerData(RegisterData registerData)
Description copied from interface:CustomerFacadeGenerate dummy customer data with random customerId to return if user already exists in database. * @param registerData data provided by user during registration- Specified by:
nextDummyCustomerDatain interfaceCustomerFacade- Returns:
-
setCommonPropertiesForRegister
protected void setCommonPropertiesForRegister(RegisterData registerData, CustomerModel customerModel)
-
setTitleForRegister
protected void setTitleForRegister(RegisterData registerData, CustomerModel customerModel)
-
createGuestUserForAnonymousCheckout
public void createGuestUserForAnonymousCheckout(java.lang.String email, java.lang.String name) throws DuplicateUidExceptionDescription copied from interface:CustomerFacadeCreates a new guest customer for anonymousCheckout and sets the email and name.- Specified by:
createGuestUserForAnonymousCheckoutin interfaceCustomerFacade- Parameters:
email- the email address of the anonymous customername- the name of the anonymous customer- Throws:
DuplicateUidException
-
generateGUID
public java.lang.String generateGUID()
Generates a customer ID during registration- Specified by:
generateGUIDin interfaceCustomerFacade- Returns:
- a unique random guid
-
changeGuestToCustomer
public void changeGuestToCustomer(java.lang.String pwd, java.lang.String orderGUID) throws DuplicateUidExceptionDescription copied from interface:CustomerFacadeCreate a regular customer from a guest customer who has just completed the guest checkout.- Specified by:
changeGuestToCustomerin interfaceCustomerFacade- Parameters:
pwd- the new password entered by the userorderGUID- the order code- Throws:
DuplicateUidException- if the login is not unique
-
setUidForRegister
protected void setUidForRegister(RegisterData registerData, CustomerModel customer)
Initializes a customer with given registerData
-
updateProfile
public void updateProfile(CustomerData customerData) throws DuplicateUidException
Description copied from interface:CustomerFacadeUpdates current customer's profile with given parameters- Specified by:
updateProfilein interfaceCustomerFacade- Parameters:
customerData- the updated customer data- Throws:
DuplicateUidException- if the login is not unique
-
validateDataBeforeUpdate
protected void validateDataBeforeUpdate(CustomerData customerData)
-
updateFullProfile
public void updateFullProfile(CustomerData customerData) throws DuplicateUidException
Description copied from interface:CustomerFacadeUpdates current customer's profile with given parameters- Specified by:
updateFullProfilein interfaceCustomerFacade- Parameters:
customerData- the updated customer data- Throws:
DuplicateUidException- if the login is not unique
-
updatePassword
public void updatePassword(java.lang.String token, java.lang.String newPassword) throws TokenInvalidatedExceptionDescription copied from interface:CustomerFacadeUpdate the password for the user by decrypting and validating the token.- Specified by:
updatePasswordin interfaceCustomerFacade- Parameters:
token- the token to identify the the customer to reset the password for.newPassword- the new password to set- Throws:
TokenInvalidatedException- if the token was already used or there is a newer token
-
forgottenPassword
public void forgottenPassword(java.lang.String id)
Description copied from interface:CustomerFacadeSends a forgotten password request for the customer specified. The givenidis one of the unique identifiers that is used to recognize the customer in matching strategies.- Specified by:
forgottenPasswordin interfaceCustomerFacade- Parameters:
id- the id of the customer to send the forgotten password mail for.- See Also:
DefaultUserMatchingService
-
loginSuccess
public void loginSuccess()
Description copied from interface:CustomerFacadeupdates the session currency and language to the user settings, assigns the cart to the current user and calculates the cart- Specified by:
loginSuccessin interfaceCustomerFacade
-
changeUid
public void changeUid(java.lang.String newUid, java.lang.String currentPassword) throws DuplicateUidExceptionDescription copied from interface:CustomerFacadeChange the current customer's UID. The current password is required for 2 reasons, firstly to validate that the current visitor is actually the customer, secondly the password hash may be salted with the UID and therefore if the UID is changed then the password needs to be re-hashed.- Specified by:
changeUidin interfaceCustomerFacade- Parameters:
newUid- the new UID for the current customercurrentPassword- current user password to validate user- Throws:
DuplicateUidException- thrown if the newUid is already in use
-
updateCartWithGuestForAnonymousCheckout
public void updateCartWithGuestForAnonymousCheckout(CustomerData guestCustomerData)
Description copied from interface:CustomerFacadeGuest customer which is created for anonymous checkout will be the cart user. The session user will remain anonymous.- Specified by:
updateCartWithGuestForAnonymousCheckoutin interfaceCustomerFacade- Parameters:
guestCustomerData- customer data to update the cart with
-
rememberMeLoginSuccessWithUrlEncoding
public void rememberMeLoginSuccessWithUrlEncoding(boolean languageEncoding, boolean currencyEncoding)Description copied from interface:CustomerFacadeThis method will be used by rememberMeServices when there is encoding attributes for language and currency.- Specified by:
rememberMeLoginSuccessWithUrlEncodingin interfaceCustomerFacade- Parameters:
languageEncoding- enable/disable language encodingcurrencyEncoding- enable/disable currency encoding
-
updateSessionCurrency
protected boolean updateSessionCurrency(CurrencyData preferredCurrency, CurrencyData defaultCurrency)
-
updateSessionLanguage
protected boolean updateSessionLanguage(LanguageData preferredLanguage, LanguageData defaultLanguage)
-
getCurrentSessionCustomer
protected CustomerModel getCurrentSessionCustomer()
-
getUserForUID
public CustomerData getUserForUID(java.lang.String userId)
Description copied from interface:CustomerFacadeGets the user for UID.- Specified by:
getUserForUIDin interfaceCustomerFacade- Parameters:
userId- the user id- Returns:
- the user for UID
-
closeAccount
public CustomerData closeAccount()
Description copied from interface:CustomerFacadeClose Account for current session user.- Specified by:
closeAccountin interfaceCustomerFacade- Returns:
- the customer with updated
UserModel.DEACTIVATIONDATEattribute
-
setPassword
public void setPassword(java.lang.String userId, java.lang.String newPassword)Description copied from interface:CustomerFacadeSets the new password for the user. The givenuserIdis one of the unique identifiers that is used to recognize the user in matching strategies.- Specified by:
setPasswordin interfaceCustomerFacade- Parameters:
userId- id used to identify the user.newPassword- new password for the user- See Also:
DefaultUserMatchingService
-
initializeCommerceEvent
protected AbstractCommerceUserEvent initializeCommerceEvent(AbstractCommerceUserEvent event, CustomerModel customerModel)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getCustomerAccountService
protected CustomerAccountService getCustomerAccountService()
-
setCustomerAccountService
public void setCustomerAccountService(CustomerAccountService customerAccountService)
-
getCommonI18NService
protected CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getModelService
protected ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
getStoreSessionFacade
protected StoreSessionFacade getStoreSessionFacade()
-
setStoreSessionFacade
public void setStoreSessionFacade(StoreSessionFacade storeSessionFacade)
-
getCommerceCartService
protected CommerceCartService getCommerceCartService()
-
setCommerceCartService
public void setCommerceCartService(CommerceCartService commerceCartService)
-
getCartService
protected CartService getCartService()
-
setCartService
public void setCartService(CartService cartService)
-
getAddressReversePopulator
protected Populator<AddressData,AddressModel> getAddressReversePopulator()
-
setAddressReversePopulator
public void setAddressReversePopulator(Populator<AddressData,AddressModel> addressReversePopulator)
-
getAddressConverter
protected Converter<AddressModel,AddressData> getAddressConverter()
-
setAddressConverter
public void setAddressConverter(Converter<AddressModel,AddressData> addressConverter)
-
getCreditCardPaymentInfoConverter
protected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> getCreditCardPaymentInfoConverter()
-
setCreditCardPaymentInfoConverter
public void setCreditCardPaymentInfoConverter(Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> creditCardPaymentInfoConverter)
-
getCustomerConverter
protected Converter<UserModel,CustomerData> getCustomerConverter()
-
setCustomerConverter
public void setCustomerConverter(Converter<UserModel,CustomerData> customerConverter)
-
getTitleConverter
protected Converter<TitleModel,TitleData> getTitleConverter()
-
setTitleConverter
public void setTitleConverter(Converter<TitleModel,TitleData> titleConverter)
-
getCustomerNameStrategy
protected CustomerNameStrategy getCustomerNameStrategy()
-
setCustomerNameStrategy
public void setCustomerNameStrategy(CustomerNameStrategy customerNameStrategy)
-
getUserFacade
protected UserFacade getUserFacade()
-
setUserFacade
public void setUserFacade(UserFacade userFacade)
-
getPasswordEncoderService
protected PasswordEncoderService getPasswordEncoderService()
-
setPasswordEncoderService
public void setPasswordEncoderService(PasswordEncoderService passwordEncoderService)
-
getCustomerReversePopulator
protected Populator<CustomerData,UserModel> getCustomerReversePopulator()
-
setCustomerReversePopulator
public void setCustomerReversePopulator(Populator<CustomerData,UserModel> customerReversePopulator)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getOrderFacade
protected OrderFacade getOrderFacade()
-
setOrderFacade
public void setOrderFacade(OrderFacade orderFacade)
-
getCartCleanStrategy
protected CartCleanStrategy getCartCleanStrategy()
-
setCartCleanStrategy
public void setCartCleanStrategy(CartCleanStrategy cartCleanStrategy)
-
getEventService
public EventService getEventService()
-
setEventService
public void setEventService(EventService eventService)
-
getBaseStoreService
protected BaseStoreService getBaseStoreService()
-
setBaseStoreService
public void setBaseStoreService(BaseStoreService service)
-
getBaseSiteService
protected BaseSiteService getBaseSiteService()
-
setBaseSiteService
public void setBaseSiteService(BaseSiteService siteService)
-
getUserMatchingService
protected UserMatchingService getUserMatchingService()
-
setUserMatchingService
public void setUserMatchingService(UserMatchingService userMatchingService)
-
-