Class PersistenceConfigurationLifecycleB2BStrategyImpl
java.lang.Object
de.hybris.platform.sap.productconfig.b2bservices.strategies.lifecycle.impl.PersistenceConfigurationLifecycleB2BStrategyImpl
- All Implemented Interfaces:
ConfigurationLifecycleStrategy
public class PersistenceConfigurationLifecycleB2BStrategyImpl
extends Object
implements ConfigurationLifecycleStrategy
B2B specific implementation of lifecycle handling. Difference to the standard one is that is takes the b2b unit into
account for access checks (users from the same b2b unit are allowed to access their documents)
-
Constructor Summary
ConstructorsConstructorDescriptionPersistenceConfigurationLifecycleB2BStrategyImpl(ConfigurationLifecycleStrategy configurationLifecycleStrategy, UserService userService, ProductConfigurationPersistenceService persistenceService, B2BUnitService<B2BUnitModel, B2BCustomerModel> b2bUnitService) Constructor -
Method Summary
Modifier and TypeMethodDescriptionCreates a configuration from the configuration in external format which can be provided from outside, e.g.createConfigurationFromExternalSource(KBKey kbKey, String extConfig) Creates a configuration from an XML string containing the configuration in external format.createDefaultConfiguration(KBKey kbKey) Creates a default configuration for the required knowledge base.protected B2BUnitService<B2BUnitModel,B2BCustomerModel> protected ConfigurationLifecycleStrategyprotected ProductConfigurationPersistenceServiceprotected UserServicebooleanisConfigForCurrentUser(String configId) Checks whether the given configuration may be accessed by the current userprotected booleanisConfigInB2bUnitForCurrentUser(String configId) booleanisConfigKnown(String configId) Checks whether the given configuration is persisted/known.
In case configuration was created by an external system, it may not be known, but may still be processed within hybris.voidreleaseExpiredSessions(String userSessionId) Releases sessions identified by the provided ID.voidreleaseSession(String configId) Releases the configuration sessions identified by the provided ID and all associated resources.retrieveConfigurationFromVariant(String baseProductCode, String variantProductCode) Get configuration for the base product, initialized with given configuration of the variantretrieveConfigurationModel(String configId) Retrieve the current state of the configuration model for the requestedconfigId.retrieveConfigurationModel(String configId, ConfigurationRetrievalOptions options) Retrieve the current state of the configuration model for the requestedconfigId.retrieveConfigurationModel(String configId, String groupId, boolean overviewOnly, ConfigurationRetrievalOptions options) Retrieve the current state of the configuration model for the requestedconfigId.retrieveExternalConfiguration(String configId) Retrieve the current state of the configuration for the requestedconfigIdas an XML string containing the configuration in external format.booleanupdateConfiguration(ConfigModel model) Checks the configuration model for changes since the last update and will send only the changes to the configuration engine, if any.voidupdateUserLinkToConfiguration(String userSessionId) Updates ProductConfigurationModel, after user loged in.
-
Constructor Details
-
PersistenceConfigurationLifecycleB2BStrategyImpl
public PersistenceConfigurationLifecycleB2BStrategyImpl(ConfigurationLifecycleStrategy configurationLifecycleStrategy, UserService userService, ProductConfigurationPersistenceService persistenceService, B2BUnitService<B2BUnitModel, B2BCustomerModel> b2bUnitService) Constructor- Parameters:
configurationLifecycleStrategy- Default implementation that we delegate most calls touserService-persistenceService-b2bUnitService- Accessing b2b units
-
-
Method Details
-
createDefaultConfiguration
Description copied from interface:ConfigurationLifecycleStrategyCreates a default configuration for the required knowledge base. The knowledge base (KB) can be identified e.g. via the product code or via the KB name, version and logical system.- Specified by:
createDefaultConfigurationin interfaceConfigurationLifecycleStrategy- Parameters:
kbKey- Information needed to identify a knowledge base- Returns:
- The configurable product with default configuration
-
updateConfiguration
Description copied from interface:ConfigurationLifecycleStrategyChecks the configuration model for changes since the last update and will send only the changes to the configuration engine, if any.- Specified by:
updateConfigurationin interfaceConfigurationLifecycleStrategy- Parameters:
model- Updated model- Returns:
true, only if it was necessary to send an updare to the configuration egnine- Throws:
ConfigurationEngineException
-
updateUserLinkToConfiguration
Description copied from interface:ConfigurationLifecycleStrategyUpdates ProductConfigurationModel, after user loged in.- Specified by:
updateUserLinkToConfigurationin interfaceConfigurationLifecycleStrategy- Parameters:
userSessionId- user session Id
-
retrieveConfigurationModel
Description copied from interface:ConfigurationLifecycleStrategyRetrieve the current state of the configuration model for the requestedconfigId.- Specified by:
retrieveConfigurationModelin interfaceConfigurationLifecycleStrategy- Parameters:
configId- Unique configuration ID- Returns:
- The actual configuration
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
retrieveConfigurationModel
public ConfigModel retrieveConfigurationModel(String configId, ConfigurationRetrievalOptions options) throws ConfigurationEngineException Description copied from interface:ConfigurationLifecycleStrategyRetrieve the current state of the configuration model for the requestedconfigId.- Specified by:
retrieveConfigurationModelin interfaceConfigurationLifecycleStrategy- Parameters:
configId- Unique configuration IDoptions- options to consider while reading the configuration, such as additional/updated variant conditions for pricing- Returns:
- The actual configuration
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
retrieveExternalConfiguration
Description copied from interface:ConfigurationLifecycleStrategyRetrieve the current state of the configuration for the requestedconfigIdas an XML string containing the configuration in external format.- Specified by:
retrieveExternalConfigurationin interfaceConfigurationLifecycleStrategy- Parameters:
configId- Unique configuration ID- Returns:
- The actual configuration as XML string
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
createConfigurationFromExternalSource
Description copied from interface:ConfigurationLifecycleStrategyCreates a configuration from the configuration in external format which can be provided from outside, e.g. from the configuration prepared in the back end.
This API does _not_ force the KB related attributes to be existing. In case only the product ID is provided, a matching KB version is determined.- Specified by:
createConfigurationFromExternalSourcein interfaceConfigurationLifecycleStrategy- Parameters:
extConfig- External configuration in external format- Returns:
- Configuration model
-
createConfigurationFromExternalSource
Description copied from interface:ConfigurationLifecycleStrategyCreates a configuration from an XML string containing the configuration in external format.
This API requires the KB related attributes as part of the external configuration to be available, they are directly forwarded to the configuration engine.- Specified by:
createConfigurationFromExternalSourcein interfaceConfigurationLifecycleStrategy- Parameters:
kbKey- Information needed to create a knowledge baseextConfig- External configuration as XML string- Returns:
- Configuration model
-
releaseSession
Description copied from interface:ConfigurationLifecycleStrategyReleases the configuration sessions identified by the provided ID and all associated resources. Accessing the session afterwards is not possible anymore.- Specified by:
releaseSessionin interfaceConfigurationLifecycleStrategy- Parameters:
configId- id of the config session
-
releaseExpiredSessions
Description copied from interface:ConfigurationLifecycleStrategyReleases sessions identified by the provided ID. Accessing the session afterwards is not possible anymore.- Specified by:
releaseExpiredSessionsin interfaceConfigurationLifecycleStrategy- Parameters:
userSessionId- id of the user session
-
retrieveConfigurationFromVariant
public ConfigModel retrieveConfigurationFromVariant(String baseProductCode, String variantProductCode) Description copied from interface:ConfigurationLifecycleStrategyGet configuration for the base product, initialized with given configuration of the variant- Specified by:
retrieveConfigurationFromVariantin interfaceConfigurationLifecycleStrategy- Returns:
- The pre-filled configuration model
-
isConfigForCurrentUser
Description copied from interface:ConfigurationLifecycleStrategyChecks whether the given configuration may be accessed by the current user- Specified by:
isConfigForCurrentUserin interfaceConfigurationLifecycleStrategy- Parameters:
configId- configuration id- Returns:
- true if configuration may be accessed by current user
-
isConfigInB2bUnitForCurrentUser
-
isConfigKnown
Description copied from interface:ConfigurationLifecycleStrategyChecks whether the given configuration is persisted/known.
In case configuration was created by an external system, it may not be known, but may still be processed within hybris.- Specified by:
isConfigKnownin interfaceConfigurationLifecycleStrategy- Parameters:
configId- configuration id- Returns:
- true if configuration is persisted and known by hybris
-
getConfigurationLifecycleStrategy
-
getUserService
-
getPersistenceService
-
getB2bUnitService
-
retrieveConfigurationModel
public ConfigModel retrieveConfigurationModel(String configId, String groupId, boolean overviewOnly, ConfigurationRetrievalOptions options) throws ConfigurationEngineException Description copied from interface:ConfigurationLifecycleStrategyRetrieve the current state of the configuration model for the requestedconfigId.- Specified by:
retrieveConfigurationModelin interfaceConfigurationLifecycleStrategy- Parameters:
configId- Unique configuration IDgroupId- group Id for which detailed information should be retrievedoverviewOnly- only for configuration overview: group detailed information is not requiredoptions- options to consider while reading the configuration, such as additional/updated variant conditions for pricing- Returns:
- The actual configuration
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-