Class DefaultPunchOutSessionService
java.lang.Object
de.hybris.platform.b2b.punchout.services.impl.DefaultPunchOutSessionService
- All Implemented Interfaces:
PunchOutSessionService
Default implementation of
PunchOutSessionService based on the use of SessionService.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(PunchOutSession punchoutSession) Activates aPunchOutSessionfor the current user session.protected DatecalculateCutOutTime(Date sessionCreationDate) voidcheckAndActivatePunchOutSession(PunchOutSession punchoutSession) Check whether punchoutSession is expired and activate;protected Stringprotected B2BCustomerService<B2BCustomerModel,B2BUnitModel> protected CartServiceprotected ConfigurationServiceRetrieves the currently loadedPunchOutSession.Gets the currently active punchOut session.protected B2BCustomerModelgetCustomerFromOrganizations(List<Organization> organizationList) protected FlexibleSearchServiceprotected ModelServiceprotected StringgetNonexistingCustomerMessage(List<Organization> organizationList) protected org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactoryprotected DefaultClientDetailsServiceprotected DefaultHybrisOpenIDTokenServicesprotected PunchOutCredentialServiceprotected Populator<CXML,PunchOutSession> org.springframework.security.oauth2.common.OAuth2AccessTokengetPunchOutTokenByUidAndSid(String uid, String sid) Get punchOut user tokenprotected SessionServicevoidinitiates and activates a punchout sessionGet if PunchOut Session Cart is validbooleanisPunchOutSessionExpired(PunchOutSession punchoutSession) Check whether punchoutSession is expiredloadB2BCustomerModel(PunchOutSession punchoutSession) Retrieves the B2BCustomerModel from given Punchout Session.loadPunchOutSession(String punchoutSessionId) Loads and activates aPunchOutSessionby its ID.loadStoredPunchOutSessionModel(String punchoutSessionId) Loads a givenStoredPunchOutSessionModelby sid.retrieveUserId(PunchOutSession punchoutSession) Retrieves the userId from given Punchout Session.voidSaves currentStoredPunchOutSessionModelin the db.voidsetB2bCustomerService(B2BCustomerService<B2BCustomerModel, B2BUnitModel> b2bCustomerService) voidsetCartService(CartService cartService) voidsetConfigurationService(ConfigurationService configurationService) voidsetCurrentCartFromPunchOutSetup(String punchoutSessionId) Set the cart for the current session using the cart saved in a given punch out session.voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) voidsetModelService(ModelService modelService) voidsetoAuth2RequestFactory(org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory oAuth2RequestFactory) voidsetOauthClientDetails(DefaultClientDetailsService oauthClientDetails) voidsetOauthTokenServices(DefaultHybrisOpenIDTokenServices oauthTokenServices) voidsetPunchOutCredentialService(PunchOutCredentialService punchOutCredentialService) voidsetPunchOutSessionCartIsValid(Boolean cartIsValid) Set if PunchOut Session Cart is validvoidsetPunchOutSessionPopulator(DefaultPunchOutSessionPopulator punchOutSessionPoulator) voidsetSessionService(SessionService sessionService)
-
Field Details
-
PUNCHOUT_SESSION_KEY
- See Also:
-
PUNCHOUT_SESSION_ID
- See Also:
-
RANDOM_ALGORITHM
- See Also:
-
MESSAGEDIGEST_ALGORITHM
- See Also:
-
SESSION_ID_BYTES
protected static final int SESSION_ID_BYTES- See Also:
-
IS_PUNCHOUT_SESSION_CART_VAILD
- See Also:
-
PUNCHOUT_OAUTH_CLIENTID
- See Also:
-
PUNCHOUT_OAUTH_ROLE
- See Also:
-
-
Constructor Details
-
DefaultPunchOutSessionService
public DefaultPunchOutSessionService()
-
-
Method Details
-
initAndActivatePunchOutSession
Description copied from interface:PunchOutSessionServiceinitiates and activates a punchout session- Specified by:
initAndActivatePunchOutSessionin interfacePunchOutSessionService- Parameters:
input- the cXML request
-
activate
Description copied from interface:PunchOutSessionServiceActivates aPunchOutSessionfor the current user session.- Specified by:
activatein interfacePunchOutSessionService- Parameters:
punchoutSession- the new punchOut session
-
saveCurrentPunchoutSession
public void saveCurrentPunchoutSession()Description copied from interface:PunchOutSessionServiceSaves currentStoredPunchOutSessionModelin the db.- Specified by:
saveCurrentPunchoutSessionin interfacePunchOutSessionService
-
generatePunchoutSessionId
-
loadStoredPunchOutSessionModel
Description copied from interface:PunchOutSessionServiceLoads a givenStoredPunchOutSessionModelby sid.- Specified by:
loadStoredPunchOutSessionModelin interfacePunchOutSessionService- Parameters:
punchoutSessionId- The sid to search.- Returns:
- The
StoredPunchOutSessionModel, or null if stored session does not exists.
-
loadPunchOutSession
Description copied from interface:PunchOutSessionServiceLoads and activates aPunchOutSessionby its ID.- Specified by:
loadPunchOutSessionin interfacePunchOutSessionService- Parameters:
punchoutSessionId- the punchOut session ID- Returns:
- the newly loaded session
-
checkAndActivatePunchOutSession
Description copied from interface:PunchOutSessionServiceCheck whether punchoutSession is expired and activate;- Specified by:
checkAndActivatePunchOutSessionin interfacePunchOutSessionService- Parameters:
punchoutSession- the punchoutSession to check
-
isPunchOutSessionExpired
Description copied from interface:PunchOutSessionServiceCheck whether punchoutSession is expired- Specified by:
isPunchOutSessionExpiredin interfacePunchOutSessionService- Parameters:
punchoutSession- the punchOut session- Returns:
- true punchoutSession is expired, false otherwise
-
setCurrentCartFromPunchOutSetup
Description copied from interface:PunchOutSessionServiceSet the cart for the current session using the cart saved in a given punch out session. This is necessary as the punchOut provider may use different sessions for sequential calls (e.g.: edit setup request and edit seamless login).
Notice that this should only be called after punch out user is authenticated.- Specified by:
setCurrentCartFromPunchOutSetupin interfacePunchOutSessionService- Parameters:
punchoutSessionId- The punch out session ID.
-
isPunchOutSessionCartValid
Description copied from interface:PunchOutSessionServiceGet if PunchOut Session Cart is valid- Specified by:
isPunchOutSessionCartValidin interfacePunchOutSessionService- Returns:
- punchOut session cart is validated ok or not, by default it is null
-
setPunchOutSessionCartIsValid
Description copied from interface:PunchOutSessionServiceSet if PunchOut Session Cart is valid- Specified by:
setPunchOutSessionCartIsValidin interfacePunchOutSessionService
-
retrieveUserId
Description copied from interface:PunchOutSessionServiceRetrieves the userId from given Punchout Session.- Specified by:
retrieveUserIdin interfacePunchOutSessionService- Parameters:
punchoutSession- The session of the current punchout user.- Returns:
- The userId, if the information contained in the encryptedText passes the security verification (null
- Throws:
PunchOutException- If some of the required arguments are missing or empty.
-
loadB2BCustomerModel
public B2BCustomerModel loadB2BCustomerModel(PunchOutSession punchoutSession) throws PunchOutException Description copied from interface:PunchOutSessionServiceRetrieves the B2BCustomerModel from given Punchout Session.- Specified by:
loadB2BCustomerModelin interfacePunchOutSessionService- Parameters:
punchoutSession- The session of the current punchout user.- Returns:
- B2BCustomerModel by Punchout Session
- Throws:
PunchOutException- If some of the required arguments are missing or empty.
-
getPunchOutTokenByUidAndSid
public org.springframework.security.oauth2.common.OAuth2AccessToken getPunchOutTokenByUidAndSid(String uid, String sid) Description copied from interface:PunchOutSessionServiceGet punchOut user token- Specified by:
getPunchOutTokenByUidAndSidin interfacePunchOutSessionService- Parameters:
uid- the uid of the customersid- the punchOut session ID- Returns:
- the oauth token
-
getCustomerFromOrganizations
-
getNonexistingCustomerMessage
-
calculateCutOutTime
- Parameters:
sessionCreationDate- the creating time of the punchout session- Returns:
- the time the session should have expired
-
getCurrentPunchOutSessionId
Description copied from interface:PunchOutSessionServiceGets the currently active punchOut session.- Specified by:
getCurrentPunchOutSessionIdin interfacePunchOutSessionService- Returns:
- the active punchOut session ID
-
getCurrentPunchOutSession
Description copied from interface:PunchOutSessionServiceRetrieves the currently loadedPunchOutSession.- Specified by:
getCurrentPunchOutSessionin interfacePunchOutSessionService- Returns:
- the punchOut session or
nullif none has been loaded yet
-
getSessionService
-
setSessionService
-
getConfigurationService
-
setConfigurationService
-
getFlexibleSearchService
-
setFlexibleSearchService
-
getCartService
-
setCartService
-
getModelService
-
setModelService
-
getPunchOutSessionPopulator
-
setPunchOutSessionPopulator
-
getPunchOutCredentialService
-
setPunchOutCredentialService
-
getOauthTokenServices
-
setOauthTokenServices
-
getOauthClientDetails
-
setOauthClientDetails
-
getoAuth2RequestFactory
protected org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory getoAuth2RequestFactory() -
setoAuth2RequestFactory
public void setoAuth2RequestFactory(org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory oAuth2RequestFactory) -
getB2bCustomerService
-
setB2bCustomerService
public void setB2bCustomerService(B2BCustomerService<B2BCustomerModel, B2BUnitModel> b2bCustomerService)
-