Class DefaultAssistedServiceFacade
- java.lang.Object
-
- de.hybris.platform.assistedservicefacades.impl.DefaultAssistedServiceFacade
-
- All Implemented Interfaces:
AssistedServiceFacade
public class DefaultAssistedServiceFacade extends java.lang.Object implements AssistedServiceFacade
Default implementation of theAssistedServiceFacadeinterface.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringAGENT_TIMER_KEYprotected static java.lang.StringASM_AGENT_STOREstatic java.lang.StringASM_CUSTOMER_PROFILE_REFERENCESprotected static java.lang.StringASM_ERROR_MESSAGE_ARGS_KEYprotected static java.lang.StringASM_ERROR_MESSAGE_KEYprotected static java.lang.StringCREATE_DISABLED_KEYprotected static intDEFAULT_SESSION_TIMERprotected static java.lang.StringEMULATE_BY_ORDER_KEYstatic java.lang.StringERROR_NO_CUSTOMER_OR_CART_ID_PROVIDEDprotected static java.lang.StringSESSION_CART_KEY
-
Constructor Summary
Constructors Constructor Description DefaultAssistedServiceFacade()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected UserModelattachCartToSession(java.lang.String cartId, UserModel customer)protected voidattachLatestSessionCart(UserModel customer)voidbindCustomerToCart(java.lang.String customerId, java.lang.String cartId)Binds customer with provided id to cart if it's anonymous cart.protected voidcleanAsmSession()CustomerDatacreateCustomer(java.lang.String customerId, java.lang.String customerName)Creates a new customer by it email and name.protected voidcreateSessionEvent(UserModel agent, UserModel customer, EventType type)Creates session event for provided customer and agent.protected voiddetachSessionCart()Detaches current cart from session and attaches newly created empty one.voidemulateAfterLogin()Personify customer based on customer stored on login step and current session cart.voidemulateCustomer(java.lang.String customerId, java.lang.String cartId)Adds a customer and/or cart to the current session.voidemulateCustomer(java.lang.String customerId, java.lang.String cartId, java.lang.String orderId)Adds provided customer, cart or an order to the current session.AssistedServiceSessiongetAsmSession()Returns ASM session object with all information about current asm session.protected java.lang.StringgetAssistedServiceAgentStore(UserModel agent)protected AssistedServiceServicegetAssistedServiceService()java.util.Map<java.lang.String,java.lang.Object>getAssistedServiceSessionAttributes()Returns assisted service attributes map for page model.intgetAssistedServiceSessionTimeout()Returns timeout for assisted service agent session in seconds.intgetAssistedServiceSessionTimerValue()Returns timer value (in seconds) for assisted service agent session, that displays inside widget.protected Converter<CartModel,CartData>getCartConverter()java.util.Collection<CartData>getCartListForCustomer(CustomerModel customer)Returns collection of a customer's cartsprotected CartServicegetCartService()protected CommerceCommonI18NServicegetCommerceCommonI18NService()CustomerDatagetCustomerByOrder(java.lang.String orderId)Get the order's customer using orderFacade.getOrderDetailsForCodeprotected Converter<UserModel,CustomerData>getCustomerConverter()java.util.List<CustomerData>getCustomers(java.lang.String searchTerm, PageableData pageableData)Get list of customers which username or email starts with provided value.protected EventServicegetEventService()protected ModelServicegetModelService()protected PasswordEncoderServicegetPasswordEncoderService()protected SessionServicegetSessionService()java.util.List<CustomerData>getSuggestedCustomerList(java.lang.String username)Validate session and get list of customers which username or email starts with provided value.protected UserServicegetUserService()protected booleanisAssistedServiceAgent(UserModel asmAgent)Verify that provided user participate in a parent AS agent group.booleanisAssistedServiceAgentLoggedIn()Checks if there is ASM information in the current session or no, this will be used by Session Restriction mainlybooleanisAssistedServiceModeLaunched()Whether or not Assisted Service module is launched.protected booleanisBruteForce(UserModel asmAgent)protected java.lang.BooleanisCustomerAccountActive(UserModel customer)voidlaunchAssistedServiceMode()Starts the Assisted Service Mode.protected voidloginAssistedServiceAgent(UserModel agent)voidloginAssistedServiceAgent(java.lang.String username, java.lang.String password)Logs in Assisted Service agent using provided credentials.protected voidloginAssistedServiceAgent(java.lang.String username, java.lang.String password, boolean isTokenBasedLogin)voidloginAssistedServiceAgentSAML(java.lang.String username, java.lang.String password)Logs in Assisted Service agent using provided SAML credentials.voidlogoutAssistedServiceAgent()Logs out Assisted Service agent by removing session attribute.protected voidquitAsmSession()voidquitAssistedServiceMode()Ends the Assisted Service Mode.protected voidresetBruteForceCounter(UserModel asmAgent)protected voidsanityCheckForAgent(UserModel agent)voidsetAssistedServiceService(AssistedServiceService assistedServiceService)voidsetCartConverter(Converter<CartModel,CartData> cartConverter)voidsetCartService(CartService cartService)voidsetCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)voidsetCustomerConverter(Converter<UserModel,CustomerData> customerConverter)voidsetEventService(EventService eventService)voidsetModelService(ModelService modelService)voidsetPasswordEncoderService(PasswordEncoderService passwordEncoderService)voidsetSessionService(SessionService sessionService)voidsetUserService(UserService userService)voidstopEmulateCustomer()Remove customer and/or cart from the current session.protected voidvalidateSession()Checks current session for ASM requirementsprotected voidverifyAssistedServiceAgent(UserModel asmAgent)Verify that provided user participate in a parent AS agent group.protected voidverifyAssistedServiceMode()Checks current session for ASM mode launched.protected voidverifyFormLoginAbility()Verify whether AS agent can be logged in via https login form.
-
-
-
Field Detail
-
ASM_CUSTOMER_PROFILE_REFERENCES
public static final java.lang.String ASM_CUSTOMER_PROFILE_REFERENCES
- See Also:
- Constant Field Values
-
ERROR_NO_CUSTOMER_OR_CART_ID_PROVIDED
public static final java.lang.String ERROR_NO_CUSTOMER_OR_CART_ID_PROVIDED
- See Also:
- Constant Field Values
-
DEFAULT_SESSION_TIMER
protected static final int DEFAULT_SESSION_TIMER
- See Also:
- Constant Field Values
-
SESSION_CART_KEY
protected static final java.lang.String SESSION_CART_KEY
- See Also:
- Constant Field Values
-
AGENT_TIMER_KEY
protected static final java.lang.String AGENT_TIMER_KEY
- See Also:
- Constant Field Values
-
CREATE_DISABLED_KEY
protected static final java.lang.String CREATE_DISABLED_KEY
- See Also:
- Constant Field Values
-
EMULATE_BY_ORDER_KEY
protected static final java.lang.String EMULATE_BY_ORDER_KEY
- See Also:
- Constant Field Values
-
ASM_ERROR_MESSAGE_KEY
protected static final java.lang.String ASM_ERROR_MESSAGE_KEY
- See Also:
- Constant Field Values
-
ASM_ERROR_MESSAGE_ARGS_KEY
protected static final java.lang.String ASM_ERROR_MESSAGE_ARGS_KEY
- See Also:
- Constant Field Values
-
ASM_AGENT_STORE
protected static final java.lang.String ASM_AGENT_STORE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAssistedServiceSessionAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAssistedServiceSessionAttributes()
Description copied from interface:AssistedServiceFacadeReturns assisted service attributes map for page model.- Specified by:
getAssistedServiceSessionAttributesin interfaceAssistedServiceFacade- Returns:
- String->Object map for page model.
-
isAssistedServiceModeLaunched
public boolean isAssistedServiceModeLaunched()
Description copied from interface:AssistedServiceFacadeWhether or not Assisted Service module is launched.- Specified by:
isAssistedServiceModeLaunchedin interfaceAssistedServiceFacade- Returns:
- true when assisted service mode has been launched
-
emulateCustomer
public void emulateCustomer(java.lang.String customerId, java.lang.String cartId, java.lang.String orderId) throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeAdds provided customer, cart or an order to the current session.- Specified by:
emulateCustomerin interfaceAssistedServiceFacade- Parameters:
customerId- id to identify the customer by (usually email address)cartId- the id of the customer cart to pick uporderId- the id of the customer order to pick up- Throws:
AssistedServiceException- In case of: 1) both customerId and cartId parameters blank 2) bad credentials, 3) AS agent isn't logged in yet 4) AS agent trying to emulate himself
-
isCustomerAccountActive
protected java.lang.Boolean isCustomerAccountActive(UserModel customer)
-
attachCartToSession
protected UserModel attachCartToSession(java.lang.String cartId, UserModel customer) throws AssistedServiceWrongCartIdException
-
emulateCustomer
public void emulateCustomer(java.lang.String customerId, java.lang.String cartId) throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeAdds a customer and/or cart to the current session.- Specified by:
emulateCustomerin interfaceAssistedServiceFacade- Parameters:
customerId- id to identify the customer by (usually email address)cartId- the id of the customer cart to pick up- Throws:
AssistedServiceException- In case of: 1) blank parameters 2) bad credentials, 3) AS agent isn't logged in yet 4) AS agent trying to emulate himself
-
stopEmulateCustomer
public void stopEmulateCustomer()
Description copied from interface:AssistedServiceFacadeRemove customer and/or cart from the current session.- Specified by:
stopEmulateCustomerin interfaceAssistedServiceFacade
-
detachSessionCart
protected void detachSessionCart()
Detaches current cart from session and attaches newly created empty one.
-
attachLatestSessionCart
protected void attachLatestSessionCart(UserModel customer)
-
launchAssistedServiceMode
public void launchAssistedServiceMode()
Description copied from interface:AssistedServiceFacadeStarts the Assisted Service Mode.- Specified by:
launchAssistedServiceModein interfaceAssistedServiceFacade
-
quitAssistedServiceMode
public void quitAssistedServiceMode()
Description copied from interface:AssistedServiceFacadeEnds the Assisted Service Mode.- Specified by:
quitAssistedServiceModein interfaceAssistedServiceFacade
-
loginAssistedServiceAgent
public void loginAssistedServiceAgent(java.lang.String username, java.lang.String password) throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeLogs in Assisted Service agent using provided credentials.- Specified by:
loginAssistedServiceAgentin interfaceAssistedServiceFacade- Parameters:
username- uidpassword- password- Throws:
AssistedServiceException- In case of bad credentials
-
loginAssistedServiceAgentSAML
public void loginAssistedServiceAgentSAML(java.lang.String username, java.lang.String password) throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeLogs in Assisted Service agent using provided SAML credentials.- Specified by:
loginAssistedServiceAgentSAMLin interfaceAssistedServiceFacade- Parameters:
username- uidpassword- password- Throws:
AssistedServiceException- In case of bad credentials
-
loginAssistedServiceAgent
protected void loginAssistedServiceAgent(java.lang.String username, java.lang.String password, boolean isTokenBasedLogin) throws AssistedServiceException- Throws:
AssistedServiceException
-
sanityCheckForAgent
protected void sanityCheckForAgent(UserModel agent) throws AssistedServiceException
- Throws:
AssistedServiceException
-
loginAssistedServiceAgent
protected void loginAssistedServiceAgent(UserModel agent) throws AssistedServiceException
- Throws:
AssistedServiceException
-
logoutAssistedServiceAgent
public void logoutAssistedServiceAgent() throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeLogs out Assisted Service agent by removing session attribute.- Specified by:
logoutAssistedServiceAgentin interfaceAssistedServiceFacade- Throws:
AssistedServiceException- In case there is no AS agent session
-
getAssistedServiceSessionTimeout
public int getAssistedServiceSessionTimeout()
Description copied from interface:AssistedServiceFacadeReturns timeout for assisted service agent session in seconds.- Specified by:
getAssistedServiceSessionTimeoutin interfaceAssistedServiceFacade- Returns:
- session in seconds
-
getAssistedServiceSessionTimerValue
public int getAssistedServiceSessionTimerValue()
Description copied from interface:AssistedServiceFacadeReturns timer value (in seconds) for assisted service agent session, that displays inside widget.- Specified by:
getAssistedServiceSessionTimerValuein interfaceAssistedServiceFacade- Returns:
- value in seconds
-
getCustomerByOrder
public CustomerData getCustomerByOrder(java.lang.String orderId)
Description copied from interface:AssistedServiceFacadeGet the order's customer using orderFacade.getOrderDetailsForCode- Specified by:
getCustomerByOrderin interfaceAssistedServiceFacade- Parameters:
orderId- the id of the customer order to get customer- Returns:
- customerData
-
getSuggestedCustomerList
public java.util.List<CustomerData> getSuggestedCustomerList(java.lang.String username) throws AssistedServiceException
Description copied from interface:AssistedServiceFacadeValidate session and get list of customers which username or email starts with provided value.- Specified by:
getSuggestedCustomerListin interfaceAssistedServiceFacade- Parameters:
username- uid or customer's name- Returns:
- suggested customers
- Throws:
AssistedServiceException- In case Assisted Service Agent is not logged in or Assisted Service mode inactive
-
getCustomers
public java.util.List<CustomerData> getCustomers(java.lang.String searchTerm, PageableData pageableData)
Description copied from interface:AssistedServiceFacadeGet list of customers which username or email starts with provided value.- Specified by:
getCustomersin interfaceAssistedServiceFacade- Parameters:
searchTerm- part of uid or customer's namepageableData- the pageable data- Returns:
- list of customers
-
emulateAfterLogin
public void emulateAfterLogin() throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadePersonify customer based on customer stored on login step and current session cart.- Specified by:
emulateAfterLoginin interfaceAssistedServiceFacade- Throws:
AssistedServiceException- In case of: 1) AS agent isn't logged in yet 2) AS agent trying to emulate himself
-
bindCustomerToCart
public void bindCustomerToCart(java.lang.String customerId, java.lang.String cartId) throws AssistedServiceExceptionDescription copied from interface:AssistedServiceFacadeBinds customer with provided id to cart if it's anonymous cart.- Specified by:
bindCustomerToCartin interfaceAssistedServiceFacade- Parameters:
customerId- email of to be newly created customer that is used as uidcartId- the id of the customer cart to pick up- Throws:
AssistedServiceException- In cas of missing cart with given cardId
-
createSessionEvent
protected void createSessionEvent(UserModel agent, UserModel customer, EventType type)
Creates session event for provided customer and agent.- Parameters:
agent-customer-type-
-
validateSession
protected void validateSession() throws AssistedServiceExceptionChecks current session for ASM requirements- Throws:
AssistedServiceException- in case ASM not launched or AS agent isn't logged in
-
verifyAssistedServiceMode
protected void verifyAssistedServiceMode() throws AssistedServiceExceptionChecks current session for ASM mode launched.- Throws:
AssistedServiceException- in case it's not
-
verifyFormLoginAbility
protected void verifyFormLoginAbility() throws AssistedServiceExceptionVerify whether AS agent can be logged in via https login form.- Throws:
AssistedServiceException- in case it can't
-
verifyAssistedServiceAgent
protected void verifyAssistedServiceAgent(UserModel asmAgent) throws AssistedServiceException
Verify that provided user participate in a parent AS agent group.- Parameters:
asmAgent-- Throws:
AssistedServiceException- in case he's not
-
isAssistedServiceAgent
protected boolean isAssistedServiceAgent(UserModel asmAgent)
Verify that provided user participate in a parent AS agent group.- Parameters:
asmAgent-- Returns:
- true when he is
-
isAssistedServiceAgentLoggedIn
public boolean isAssistedServiceAgentLoggedIn()
Description copied from interface:AssistedServiceFacadeChecks if there is ASM information in the current session or no, this will be used by Session Restriction mainly- Specified by:
isAssistedServiceAgentLoggedInin interfaceAssistedServiceFacade- Returns:
- boolean value to indicates if there are a valid assisted service info in the session or no.
-
createCustomer
public CustomerData createCustomer(java.lang.String customerId, java.lang.String customerName) throws AssistedServiceException
Description copied from interface:AssistedServiceFacadeCreates a new customer by it email and name.- Specified by:
createCustomerin interfaceAssistedServiceFacade- Parameters:
customerId- email of to be newly created customer that is used as uidcustomerName- name of to be newly created customer (firstname and surname separated by space symbol)- Returns:
- CustomerModel
- Throws:
AssistedServiceException- In case of: 1) trying to create already existing customer with given customerId 2) disabled customer creation
-
getAsmSession
public AssistedServiceSession getAsmSession()
Description copied from interface:AssistedServiceFacadeReturns ASM session object with all information about current asm session.- Specified by:
getAsmSessionin interfaceAssistedServiceFacade- Returns:
- asm session object
-
cleanAsmSession
protected void cleanAsmSession()
-
quitAsmSession
protected void quitAsmSession()
-
isBruteForce
protected boolean isBruteForce(UserModel asmAgent)
-
resetBruteForceCounter
protected void resetBruteForceCounter(UserModel asmAgent)
-
getAssistedServiceAgentStore
protected java.lang.String getAssistedServiceAgentStore(UserModel agent)
-
getCartListForCustomer
public java.util.Collection<CartData> getCartListForCustomer(CustomerModel customer)
Description copied from interface:AssistedServiceFacadeReturns collection of a customer's carts- Specified by:
getCartListForCustomerin interfaceAssistedServiceFacade- Parameters:
customer- customer model whose carts to be returned- Returns:
- collection of the customer's cart models
-
getAssistedServiceService
protected AssistedServiceService getAssistedServiceService()
-
setAssistedServiceService
public void setAssistedServiceService(AssistedServiceService assistedServiceService)
-
getCartService
protected CartService getCartService()
-
setCartService
public void setCartService(CartService cartService)
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getCommerceCommonI18NService
protected CommerceCommonI18NService getCommerceCommonI18NService()
-
setCommerceCommonI18NService
public void setCommerceCommonI18NService(CommerceCommonI18NService commerceCommonI18NService)
-
getUserService
protected UserService getUserService()
-
setUserService
public void setUserService(UserService userService)
-
getPasswordEncoderService
protected PasswordEncoderService getPasswordEncoderService()
-
setPasswordEncoderService
public void setPasswordEncoderService(PasswordEncoderService passwordEncoderService)
-
getModelService
protected ModelService getModelService()
- Returns:
- the modelService
-
setModelService
public void setModelService(ModelService modelService)
- Parameters:
modelService- the modelService to set
-
getEventService
protected EventService getEventService()
-
setEventService
public void setEventService(EventService eventService)
-
getCustomerConverter
protected Converter<UserModel,CustomerData> getCustomerConverter()
-
setCustomerConverter
public void setCustomerConverter(Converter<UserModel,CustomerData> customerConverter)
-
-