Class DefaultPunchOutSessionService
- java.lang.Object
-
- de.hybris.platform.b2b.punchout.services.impl.DefaultPunchOutSessionService
-
- All Implemented Interfaces:
PunchOutSessionService
public class DefaultPunchOutSessionService extends java.lang.Object implements PunchOutSessionService
Default implementation ofPunchOutSessionServicebased on the use ofSessionService.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringPUNCHOUT_SESSION_IDprotected static java.lang.StringPUNCHOUT_SESSION_KEY
-
Constructor Summary
Constructors Constructor Description DefaultPunchOutSessionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate(PunchOutSession punchoutSession)Activates aPunchOutSessionfor the current user session.protected java.util.DatecalculateCutOutTime(java.util.Date sessionCreationDate)protected java.lang.StringgeneratePunchoutSessionId()CartServicegetCartService()ConfigurationServicegetConfigurationService()PunchOutSessiongetCurrentPunchOutSession()Retrieves the currently loadedPunchOutSession.java.lang.StringgetCurrentPunchOutSessionId()Gets the currently active punchOut session.FlexibleSearchServicegetFlexibleSearchService()ModelServicegetModelService()SessionServicegetSessionService()PunchOutSessionloadPunchOutSession(java.lang.String punchoutSessionId)Loads and activates aPunchOutSessionby its ID.StoredPunchOutSessionModelloadStoredPunchOutSessionModel(java.lang.String punchoutSessionId)Loads a givenStoredPunchOutSessionModelby sid.voidsaveCurrentPunchoutSession()Saves currentStoredPunchOutSessionModelin the db.voidsetCartService(CartService cartService)voidsetConfigurationService(ConfigurationService configurationService)voidsetCurrentCartFromPunchOutSetup(java.lang.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)voidsetSessionService(SessionService sessionService)
-
-
-
Field Detail
-
PUNCHOUT_SESSION_KEY
protected static final java.lang.String PUNCHOUT_SESSION_KEY
- See Also:
- Constant Field Values
-
PUNCHOUT_SESSION_ID
protected static final java.lang.String PUNCHOUT_SESSION_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
activate
public void activate(PunchOutSession punchoutSession)
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
protected java.lang.String generatePunchoutSessionId()
-
loadStoredPunchOutSessionModel
public StoredPunchOutSessionModel loadStoredPunchOutSessionModel(java.lang.String punchoutSessionId)
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
public PunchOutSession loadPunchOutSession(java.lang.String punchoutSessionId)
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
-
setCurrentCartFromPunchOutSetup
public void setCurrentCartFromPunchOutSetup(java.lang.String punchoutSessionId)
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.
-
calculateCutOutTime
protected java.util.Date calculateCutOutTime(java.util.Date sessionCreationDate)
- Parameters:
sessionCreationDate- the creating time of the punchout session- Returns:
- the time the session should have expired
-
getCurrentPunchOutSessionId
public java.lang.String getCurrentPunchOutSessionId()
Description copied from interface:PunchOutSessionServiceGets the currently active punchOut session.- Specified by:
getCurrentPunchOutSessionIdin interfacePunchOutSessionService- Returns:
- the active punchOut session ID
-
getCurrentPunchOutSession
public PunchOutSession 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
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getFlexibleSearchService
public FlexibleSearchService getFlexibleSearchService()
-
setFlexibleSearchService
public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService)
-
getCartService
public CartService getCartService()
-
setCartService
public void setCartService(CartService cartService)
-
getModelService
public ModelService getModelService()
-
setModelService
public void setModelService(ModelService modelService)
-
-