Class DefaultCustomerFacade
java.lang.Object
de.hybris.platform.commercefacades.customer.impl.DefaultCustomerFacade
- All Implemented Interfaces:
CustomerFacade
- Direct Known Subclasses:
DefaultB2BCustomerFacade,DefaultChineseCustomerFacade,ProfileCustomerFacade
Default implementation for the
CustomerFacade.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeGuestToCustomer(String pwd, String orderGUID) Create a regular customer from a guest customer who has just completed the guest checkout.voidchangePassword(String oldPassword, String newPassword) Changes current user password.voidChange the current customer's UID.Close Account for current session user.voidcreateGuestUserForAnonymousCheckout(String email, String name) Creates a new guest customer for anonymousCheckout and sets the email and name.voidSends a forgotten password request for the customer specified.Generates a customer ID during registrationprotected Converter<AddressModel,AddressData> protected Populator<AddressData,AddressModel> protected BaseSiteServiceprotected BaseStoreServiceprotected BusinessProcessServiceprotected CartCleanStrategyprotected CartServiceprotected CommerceCartServiceprotected CommonI18NServiceprotected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> Returns the current session user.Returns the uid of current session user.protected CustomerModelprotected UserModelprotected CustomerAccountServiceprotected Converter<UserModel,CustomerData> protected CustomerNameStrategyprotected Populator<CustomerData,UserModel> protected ModelServiceprotected OrderFacadeprotected PasswordEncoderServiceprotected SessionServiceprotected StoreSessionFacadeprotected Converter<TitleModel,TitleData> protected UserFacadegetUserForUID(String userId) Gets the user for UID.protected UserMatchingServiceprotected UserServiceprotected AbstractCommerceUserEventinitializeCommerceEvent(AbstractCommerceUserEvent event, CustomerModel customerModel) voidupdates the session currency and language to the user settings, assigns the cart to the current user and calculates the cartnextDummyCustomerData(RegisterData registerData) Generate dummy customer data with random customerId to return if user already exists in database.voidpublishes LoginSuccessEvent to the event systemvoidregister(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) voidsetBusinessProcessService(BusinessProcessService businessProcessService) 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(String userId, 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(String token, 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)
-
Constructor Details
-
DefaultCustomerFacade
public DefaultCustomerFacade()
-
-
Method Details
-
getCurrentCustomer
Description copied from interface:CustomerFacadeReturns the current session user.- Specified by:
getCurrentCustomerin interfaceCustomerFacade- Returns:
- current session user data
-
getCurrentUser
-
getCurrentCustomerUid
Description copied from interface:CustomerFacadeReturns the uid of current session user.- Specified by:
getCurrentCustomerUidin interfaceCustomerFacade- Returns:
- current session user uid
-
changePassword
Description 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
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
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
-
createGuestUserForAnonymousCheckout
public void createGuestUserForAnonymousCheckout(String email, String name) throws DuplicateUidException Description 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
Generates a customer ID during registration- Specified by:
generateGUIDin interfaceCustomerFacade- Returns:
- a unique random guid
-
changeGuestToCustomer
Description 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
Initializes a customer with given registerData -
updateProfile
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
-
updateFullProfile
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
Description 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
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:
-
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
-
publishLoginSuccessEvent
public void publishLoginSuccessEvent()Description copied from interface:CustomerFacadepublishes LoginSuccessEvent to the event system- Specified by:
publishLoginSuccessEventin interfaceCustomerFacade
-
changeUid
Description 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
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
-
getUserForUID
Description copied from interface:CustomerFacadeGets the user for UID.- Specified by:
getUserForUIDin interfaceCustomerFacade- Parameters:
userId- the user id- Returns:
- the user for UID
-
closeAccount
Description copied from interface:CustomerFacadeClose Account for current session user.- Specified by:
closeAccountin interfaceCustomerFacade- Returns:
- the customer with updated
UserModel.DEACTIVATIONDATEattribute
-
setPassword
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:
-
initializeCommerceEvent
protected AbstractCommerceUserEvent initializeCommerceEvent(AbstractCommerceUserEvent event, CustomerModel customerModel) -
getUserService
-
setUserService
-
getCustomerAccountService
-
setCustomerAccountService
-
getCommonI18NService
-
setCommonI18NService
-
getModelService
-
setModelService
-
getStoreSessionFacade
-
setStoreSessionFacade
-
getCommerceCartService
-
setCommerceCartService
-
getCartService
-
setCartService
-
getAddressReversePopulator
-
setAddressReversePopulator
-
getAddressConverter
-
setAddressConverter
-
getCreditCardPaymentInfoConverter
protected Converter<CreditCardPaymentInfoModel,CCPaymentInfoData> getCreditCardPaymentInfoConverter() -
setCreditCardPaymentInfoConverter
public void setCreditCardPaymentInfoConverter(Converter<CreditCardPaymentInfoModel, CCPaymentInfoData> creditCardPaymentInfoConverter) -
getCustomerConverter
-
setCustomerConverter
-
getTitleConverter
-
setTitleConverter
-
getCustomerNameStrategy
-
setCustomerNameStrategy
-
getUserFacade
-
setUserFacade
-
getPasswordEncoderService
-
setPasswordEncoderService
-
getCustomerReversePopulator
-
setCustomerReversePopulator
-
getSessionService
-
setSessionService
-
getOrderFacade
-
setOrderFacade
-
getCartCleanStrategy
-
setCartCleanStrategy
-
getEventService
-
setEventService
-
getBaseStoreService
-
setBaseStoreService
-
getBaseSiteService
-
setBaseSiteService
-
getUserMatchingService
-
setUserMatchingService
-
setBusinessProcessService
-
getBusinessProcessService
-