Class PersistenceConfigurationLifecycleStrategyImpl
java.lang.Object
de.hybris.platform.sap.productconfig.services.strategies.lifecycle.impl.PersistenceConfigurationLifecycleStrategyImpl
- All Implemented Interfaces:
ConfigurationLifecycleStrategy
public class PersistenceConfigurationLifecycleStrategyImpl
extends Object
implements ConfigurationLifecycleStrategy
-
Field Summary
Fields -
Constructor Summary
Constructors -
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 ConfigurationProviderprotected ModelServiceprotected ProductConfigurationPersistenceServiceprotected Stringprotected ProviderFactoryprotected SessionServiceprotected UserServiceprotected booleanisAdminUser(UserModel currentUser) protected booleanisAnonymousConfigAndAllowedToRead(ProductConfigurationModel productConfiguration) Returns true if the configuration's user is anonymous and the flag "SESSION_NOT_BOUND_TO_CONFIGURATIONS" is set to true.booleanisConfigForCurrentUser(String configId) Checks whether the given configuration may be accessed by the current userbooleanisConfigKnown(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.protected booleanprotected booleanisSameSession(ProductConfigurationModel productConfiguration) protected booleanisSameUser(ProductConfigurationModel productConfiguration, UserModel currentUser) protected booleanisUpdateETagNeeded(String newVersion, String existingVersion) protected voidpersistNewConfiguration(ConfigModel config) protected booleanvoidreleaseExpiredSessions(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.protected voidreleaseSessionSafely(String configId, String currentVersion) protected voidremoveDuplicateProductLink(ProductConfigurationModel actualConfigModel) 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.voidsetModelService(ModelService modelService) voidsetPersistenceService(ProductConfigurationPersistenceService persistenceService) voidsetProviderFactory(ProviderFactory providerFactory) voidsetSessionService(SessionService sessionService) voidsetUserService(UserService userService) 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.protected voidupdateETag(String newVersion, ConfigModel configModel, ProductConfigurationModel persistenceModel) protected voidupdateETagFromModel(ConfigModel configModel) voidupdateUserLinkToConfiguration(String userSessionId) Updates ProductConfigurationModel, after user loged in.
-
Field Details
-
WEAK_ETAG_PREFIX
- See Also:
-
-
Constructor Details
-
PersistenceConfigurationLifecycleStrategyImpl
public PersistenceConfigurationLifecycleStrategyImpl()
-
-
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
-
persistNewConfiguration
-
updateUserLinkToConfiguration
Description copied from interface:ConfigurationLifecycleStrategyUpdates ProductConfigurationModel, after user loged in.- Specified by:
updateUserLinkToConfigurationin interfaceConfigurationLifecycleStrategy- Parameters:
userSessionId- user session Id
-
removeDuplicateProductLink
-
isProductLinkedToProductConfiguration
-
getProductLinkedToProductConfiguration
-
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
-
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
-
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
-
releaseSessionSafely
-
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
-
isAnonymousConfigAndAllowedToRead
Returns true if the configuration's user is anonymous and the flag "SESSION_NOT_BOUND_TO_CONFIGURATIONS" is set to true.- Parameters:
productConfiguration-
-
isSameSession
-
isSameUser
-
isAdminUser
-
updateETagFromModel
-
updateETag
protected void updateETag(String newVersion, ConfigModel configModel, ProductConfigurationModel persistenceModel) -
isUpdateETagNeeded
-
getConfigurationProvider
-
getModelService
-
setModelService
-
getProviderFactory
-
setProviderFactory
-
getUserService
-
setUserService
-
getSessionService
-
setSessionService
-
getPersistenceService
-
setPersistenceService
-
persistSessionId
protected boolean persistSessionId() -
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
-
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
-