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 Details

    • DefaultCloneComponentContextProvider

      public DefaultCloneComponentContextProvider()
  • Method Details

    • initializeItem

      public void initializeItem(Map.Entry<String,Object> entry)
      Description copied from interface: CMSItemContextProvider
      Initializes and stores a new instance for this transaction.
      Specified by:
      initializeItem in interface CMSItemContextProvider<Map.Entry<String,Object>>
      Parameters:
      entry - the value to store
    • isInitialized

      public boolean isInitialized()
      Description copied from interface: CloneComponentContextProvider
      Verify that the clone component operation is being executed by checking if some clone component information has been saved in the session.
      Specified by:
      isInitialized in interface CloneComponentContextProvider
      Returns:
      TRUE when clone component information was stored in session; FALSE otherwise
    • getCurrentItem

      public Map.Entry<String,Object> getCurrentItem()
      Description copied from interface: CMSItemContextProvider
      Provides the current instance for this transaction.
      Specified by:
      getCurrentItem in interface CMSItemContextProvider<Map.Entry<String,Object>>
      Returns:
      the current item
    • findItemForKey

      public Object findItemForKey(String key)
      Description copied from interface: CloneComponentContextProvider
      Read value from Map.Entry without removing it from the stack
      Specified by:
      findItemForKey in interface CloneComponentContextProvider
      Parameters:
      key - the key of the Map.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: CMSItemContextProvider
      Finalizes the latest instance for this transaction.
      Specified by:
      finalizeItem in interface CMSItemContextProvider<Map.Entry<String,Object>>
    • getValueFromSession

      protected Object getValueFromSession(boolean shouldThrowException)
      Get the value stored in the session associated to the key SESSION_CLONE_COMPONENT_CONTEXT
      Parameters:
      shouldThrowException - when set to TRUE, an IllegalStateException is thrown if no value is found in the session
      Returns:
      the value stored in the session
    • getWrappedStack

      protected Deque<Map.Entry<String,Object>> getWrappedStack(Object rawValue)
      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

      protected SessionService getSessionService()
    • setSessionService

      public void setSessionService(SessionService sessionService)