Class ConfigCopyCartEntryActionHandler
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.frontend.handler.ConfigCopyCartEntryActionHandler
-
- All Implemented Interfaces:
CartEntryActionHandler
public class ConfigCopyCartEntryActionHandler extends java.lang.Object implements CartEntryActionHandler
Action Handler to Copy a CartItem including configuration
-
-
Constructor Summary
Constructors Constructor Description ConfigCopyCartEntryActionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyAndAddToCart(OrderEntryData entryToCopy, boolean copyDirect)protected ConfigurationDatacopyConfiguration(OrderEntryData entryToCopy)protected ConfigurationAbstractOrderEntryLinkStrategygetAbstractOrderEntryLinkStrategy()protected CartFacadegetCartFacade()protected ConfigurationCartIntegrationFacadegetConfigCartFacade()protected java.lang.StringgetConfigIdByOrderEntry(OrderEntryData entryToCopy)protected ConfigurationCopyStrategygetConfigurationCopyStrategy()protected CPQConfigurableCheckergetCpqConfigurableChecker()protected OrderEntryDatagetEntryByEntryNumber(long entryNumber)java.lang.StringgetErrorMessageKey()Provides the key to the message that should be displayed when a CartEntryActionException is thrown.java.lang.StringgetSuccessMessageKey()Provides the key to the message that should be displayed when an action runs with success.java.util.Optional<java.lang.String>handleAction(java.util.List<java.lang.Long> entryNumbers)This method contains the logic of the action performed by the CartEntryActionHandler implementation.protected booleanisDefaultConfig(java.util.List<ConfigurationInfoData> infos)voidsetAbstractOrderEntryLinkStrategy(ConfigurationAbstractOrderEntryLinkStrategy configurationAbstractOrderEntryLinkStrategy)voidsetCartFacade(CartFacade cartFacade)voidsetConfigCartFacade(ConfigurationCartIntegrationFacade configCartFacade)voidsetConfigurationCopyStrategy(ConfigurationCopyStrategy configurationCopyStrategy)voidsetCpqConfigurableChecker(CPQConfigurableChecker cpqConfigurableChecker)Set helper, to check if the related product is CPQ configurablebooleansupports(CartEntryModel cartEntry)This method determines if the action should show or not in the cart entry tools menu.
-
-
-
Method Detail
-
getCartFacade
protected CartFacade getCartFacade()
-
setCartFacade
public void setCartFacade(CartFacade cartFacade)
- Parameters:
cartFacade-
-
getConfigCartFacade
protected ConfigurationCartIntegrationFacade getConfigCartFacade()
-
setConfigCartFacade
public void setConfigCartFacade(ConfigurationCartIntegrationFacade configCartFacade)
- Parameters:
configCartFacade-
-
getAbstractOrderEntryLinkStrategy
protected ConfigurationAbstractOrderEntryLinkStrategy getAbstractOrderEntryLinkStrategy()
-
setAbstractOrderEntryLinkStrategy
public void setAbstractOrderEntryLinkStrategy(ConfigurationAbstractOrderEntryLinkStrategy configurationAbstractOrderEntryLinkStrategy)
-
handleAction
public java.util.Optional<java.lang.String> handleAction(java.util.List<java.lang.Long> entryNumbers) throws CartEntryActionExceptionDescription copied from interface:CartEntryActionHandlerThis method contains the logic of the action performed by the CartEntryActionHandler implementation. Even though the methodCartEntryActionHandler.supports(CartEntryModel)prevents unsupported actions to be visible in the contextual menu, it is the responsibility of the handleAction method and the processes it calls to perform appropriate validations in case the action is called on a cart entry for which it should not.- Specified by:
handleActionin interfaceCartEntryActionHandler- Parameters:
entryNumbers- the cart entry number for which the action is executed.- Returns:
- An empty optional to signal the controller to apply the default behaviour: redisplay the cart page with a success message. Otherwise return a custom redirect URL to navigate elsewhere upon the action completion. The expected url format is the format used as SpringMVC controller method return values.
- Throws:
CartEntryActionException- when an error occurs.
-
copyAndAddToCart
protected void copyAndAddToCart(OrderEntryData entryToCopy, boolean copyDirect) throws CommerceCartModificationException
-
isDefaultConfig
protected boolean isDefaultConfig(java.util.List<ConfigurationInfoData> infos)
-
copyConfiguration
protected ConfigurationData copyConfiguration(OrderEntryData entryToCopy)
-
getConfigIdByOrderEntry
protected java.lang.String getConfigIdByOrderEntry(OrderEntryData entryToCopy)
-
getEntryByEntryNumber
protected OrderEntryData getEntryByEntryNumber(long entryNumber)
-
getSuccessMessageKey
public java.lang.String getSuccessMessageKey()
Description copied from interface:CartEntryActionHandlerProvides the key to the message that should be displayed when an action runs with success.- Specified by:
getSuccessMessageKeyin interfaceCartEntryActionHandler- Returns:
- the success message key.
-
getErrorMessageKey
public java.lang.String getErrorMessageKey()
Description copied from interface:CartEntryActionHandlerProvides the key to the message that should be displayed when a CartEntryActionException is thrown.- Specified by:
getErrorMessageKeyin interfaceCartEntryActionHandler- Returns:
- the error message key.
-
supports
public boolean supports(CartEntryModel cartEntry)
Description copied from interface:CartEntryActionHandlerThis method determines if the action should show or not in the cart entry tools menu. An action may not be supported by every cart entry and this is the method to override to make this decision. This method is intended to refine the contents of the contextual menu of a cart item. It is the responsibility of the method and the processes it calls to perform appropriate validations in case the action is called on a cart entry for which it should not.- Specified by:
supportsin interfaceCartEntryActionHandler- Parameters:
cartEntry- the cart entry model.- Returns:
- true if the cart entry supports the action, false otherwise.
-
getCpqConfigurableChecker
protected CPQConfigurableChecker getCpqConfigurableChecker()
-
setCpqConfigurableChecker
public void setCpqConfigurableChecker(CPQConfigurableChecker cpqConfigurableChecker)
Set helper, to check if the related product is CPQ configurable- Parameters:
cpqConfigurableChecker- configurator checker
-
getConfigurationCopyStrategy
protected ConfigurationCopyStrategy getConfigurationCopyStrategy()
-
setConfigurationCopyStrategy
public void setConfigurationCopyStrategy(ConfigurationCopyStrategy configurationCopyStrategy)
-
-