Class DefaultCloneComponentContextProvider
java.lang.Object
de.hybris.platform.cmsfacades.cmsitems.impl.DefaultCloneComponentContextProvider
- All Implemented Interfaces:
CloneComponentContextProvider,CMSItemContextProvider<Map.Entry<String,Object>>
public class DefaultCloneComponentContextProvider
extends Object
implements CloneComponentContextProvider
Default implementation of
CloneComponentContextProvider responsible for storing (in a stack-like data
structure) context information per transaction when cloning a component.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFinalizes the latest instance for this transaction.findItemForKey(String key) Read value fromMap.Entrywithout removing it from the stackProvides the current instance for this transaction.protected SessionServiceprotected ObjectgetValueFromSession(boolean shouldThrowException) Get the value stored in the session associated to the keySESSION_CLONE_COMPONENT_CONTEXTgetWrappedStack(Object rawValue) Values stored in the session service must be wrapped in AtomicReference objects to protect them from being altered during serialization.voidinitializeItem(Map.Entry<String, Object> entry) Initializes and stores a new instance for this transaction.booleanVerify that the clone component operation is being executed by checking if some clone component information has been saved in the session.voidsetSessionService(SessionService sessionService)
-
Constructor Details
-
DefaultCloneComponentContextProvider
public DefaultCloneComponentContextProvider()
-
-
Method Details
-
initializeItem
Description copied from interface:CMSItemContextProviderInitializes and stores a new instance for this transaction.- Specified by:
initializeItemin interfaceCMSItemContextProvider<Map.Entry<String,Object>> - Parameters:
entry- the value to store
-
isInitialized
public boolean isInitialized()Description copied from interface:CloneComponentContextProviderVerify that the clone component operation is being executed by checking if some clone component information has been saved in the session.- Specified by:
isInitializedin interfaceCloneComponentContextProvider- Returns:
- TRUE when clone component information was stored in session; FALSE otherwise
-
getCurrentItem
Description copied from interface:CMSItemContextProviderProvides the current instance for this transaction.- Specified by:
getCurrentItemin interfaceCMSItemContextProvider<Map.Entry<String,Object>> - Returns:
- the current item
-
findItemForKey
Description copied from interface:CloneComponentContextProviderRead value fromMap.Entrywithout removing it from the stack- Specified by:
findItemForKeyin interfaceCloneComponentContextProvider- Parameters:
key- the key of theMap.Entry- Returns:
- the value associated to the given key in the
Map.Entry; can be null when the key is not found
-
finalizeItem
public void finalizeItem()Description copied from interface:CMSItemContextProviderFinalizes the latest instance for this transaction.- Specified by:
finalizeItemin interfaceCMSItemContextProvider<Map.Entry<String,Object>>
-
getValueFromSession
Get the value stored in the session associated to the keySESSION_CLONE_COMPONENT_CONTEXT- Parameters:
shouldThrowException- when set to TRUE, anIllegalStateExceptionis thrown if no value is found in the session- Returns:
- the value stored in the session
-
getWrappedStack
Values stored in the session service must be wrapped in AtomicReference objects to protect them from being altered during serialization. When values are read from the session service, they must be unwrapped. Thus, this method is used to retrieve the original value (stack) stored in the AtomicReference wrapper.- Parameters:
rawValue- Object retrieved from the session service. The object must be an AtomicReference. Otherwise, an IllegalStateException is thrown.- Returns:
- stack stored within the AtomicReference.
-
getSessionService
-
setSessionService
-