Class CPSConfigurationProvider
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.runtime.cps.impl.CPSConfigurationProvider
-
- All Implemented Interfaces:
ConfigurationProvider
public class CPSConfigurationProvider extends java.lang.Object implements ConfigurationProvider
Communication to cloud engine
-
-
Constructor Summary
Constructors Constructor Description CPSConfigurationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringchangeConfiguration(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 ConfigModelconvertToModelRepresentation(CPSConfiguration runtimeConfiguration)ConfigModelcreateConfigurationFromExternalSource(Configuration extConfig)Creates a configuration from the configuration in external format which can be provided from outside, e.g.ConfigModelcreateConfigurationFromExternalSource(KBKey kbKey, java.lang.String extConfig)Creates a configuration from an XML string containing the configuration in external format.ConfigModelcreateDefaultConfiguration(KBKey kbKey)Creates a default configuration for the required knowledge base.KBKeyextractKbKey(java.lang.String productCode, java.lang.String externalConfig)extracts the KBKey from the external configurationprotected java.lang.IntegerfindKbId(KBKey kbKey)This method is only intended for situations where product and date are provided as part of the KB key.protected CharonFacadegetCharonFacade()protected CharonKbDeterminationFacadegetCharonKbDeterminationFacade()protected Converter<CPSConfiguration,ConfigModel>getConfigModelConverter()protected CPSConfigurationChangeAdaptergetConfigurationChangeAdapter()protected ConfigurationModificationHandlergetConfigurationModificationHandler()protected ExternalConfigurationFromVariantStrategygetExternalConfigurationFromVariantStrategy()booleanisKbForDateExists(java.lang.String productCode, java.util.Date kbDate)booleanisKbVersionExists(KBKey kbKey)booleanisKbVersionValid(KBKey kbKey)voidreleaseSession(java.lang.String configId)Releases the configuration sessions identified by the provided ID and all associated resources.voidreleaseSession(java.lang.String configId, java.lang.String version)Releases the configuration sessions identified by the provided ID and all associated resources.ConfigModelretrieveConfigurationFromVariant(java.lang.String baseProductCode, java.lang.String variantProductCode)Get configuration for the base product, initialized with given configuration of the variantConfigModelretrieveConfigurationModel(java.lang.String configId)Retrieve the current state of the configuration model for the requestedconfigId.ConfigModelretrieveConfigurationModel(java.lang.String configId, ConfigurationRetrievalOptions options)Retrieve the current state of the configuration model for the requestedconfigId.java.lang.StringretrieveExternalConfiguration(java.lang.String configId)Retrieve the current state of the configuration for the requestedconfigIdas an XML string containing the configuration in external format.voidsetCharonFacade(CharonFacade charonFacade)voidsetCharonKbDeterminationFacade(CharonKbDeterminationFacade charonKbDeterminationFacade)voidsetConfigModelConverter(Converter<CPSConfiguration,ConfigModel> configModelConverter)Set converter, target: (engine independent) modelsvoidsetConfigurationChangeAdapter(CPSConfigurationChangeAdapter configurationChangeAdapter)voidsetConfigurationModificationHandler(ConfigurationModificationHandler configurationModificationHandler)voidsetExternalConfigurationFromVariantStrategy(ExternalConfigurationFromVariantStrategy externalConfigurationFromVariantStrategy)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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationProvider
isConfigureVariantSupported, isKbVersionExists
-
-
-
-
Method Detail
-
getExternalConfigurationFromVariantStrategy
protected ExternalConfigurationFromVariantStrategy getExternalConfigurationFromVariantStrategy()
-
createDefaultConfiguration
public ConfigModel createDefaultConfiguration(KBKey kbKey)
Description copied from interface:ConfigurationProviderCreates 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 interfaceConfigurationProvider- Parameters:
kbKey- Information needed to identify a knowledge base- Returns:
- The configurable product with default configuration
-
updateConfiguration
public boolean updateConfiguration(ConfigModel model) throws ConfigurationEngineException
Description copied from interface:ConfigurationProviderChecks the configuration model for changes since the last update and will send only the changes to the configuration engine, if any.- Specified by:
updateConfigurationin interfaceConfigurationProvider- Parameters:
model- Updated model- Returns:
true, only if it was necessary to send an update to the configuration engine- Throws:
ConfigurationEngineException
-
retrieveConfigurationModel
public ConfigModel retrieveConfigurationModel(java.lang.String configId) throws ConfigurationEngineException
Description copied from interface:ConfigurationProviderRetrieve the current state of the configuration model for the requestedconfigId.- Specified by:
retrieveConfigurationModelin interfaceConfigurationProvider- Parameters:
configId- Unique configuration ID- Returns:
- The actual configuration
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
retrieveConfigurationModel
public ConfigModel retrieveConfigurationModel(java.lang.String configId, ConfigurationRetrievalOptions options) throws ConfigurationEngineException
Description copied from interface:ConfigurationProviderRetrieve the current state of the configuration model for the requestedconfigId.- Specified by:
retrieveConfigurationModelin interfaceConfigurationProvider- 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
public java.lang.String retrieveExternalConfiguration(java.lang.String configId) throws ConfigurationEngineExceptionDescription copied from interface:ConfigurationProviderRetrieve the current state of the configuration for the requestedconfigIdas an XML string containing the configuration in external format.- Specified by:
retrieveExternalConfigurationin interfaceConfigurationProvider- Parameters:
configId- Unique configuration ID- Returns:
- The actual configuration as XML string
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
createConfigurationFromExternalSource
public ConfigModel createConfigurationFromExternalSource(KBKey kbKey, java.lang.String extConfig)
Description copied from interface:ConfigurationProviderCreates 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 interfaceConfigurationProvider- Parameters:
kbKey- Information needed to create a knowledge baseextConfig- External configuration as XML string- Returns:
- Configuration model
-
releaseSession
public void releaseSession(java.lang.String configId)
Description copied from interface:ConfigurationProviderReleases the configuration sessions identified by the provided ID and all associated resources. Accessing the session afterwards is not possible anymore.- Specified by:
releaseSessionin interfaceConfigurationProvider- Parameters:
configId- session id
-
createConfigurationFromExternalSource
public ConfigModel createConfigurationFromExternalSource(Configuration extConfig)
Description copied from interface:ConfigurationProviderCreates 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 interfaceConfigurationProvider- Parameters:
extConfig- External configuration in external format- Returns:
- Configuration model
-
findKbId
protected java.lang.Integer findKbId(KBKey kbKey)
This method is only intended for situations where product and date are provided as part of the KB key. If this is not the case, an exception is thrown- Parameters:
kbKey-- Returns:
- KB ID
-
setConfigModelConverter
public void setConfigModelConverter(Converter<CPSConfiguration,ConfigModel> configModelConverter)
Set converter, target: (engine independent) models- Parameters:
configModelConverter-
-
getConfigModelConverter
protected Converter<CPSConfiguration,ConfigModel> getConfigModelConverter()
-
getCharonFacade
protected CharonFacade getCharonFacade()
-
setCharonFacade
public void setCharonFacade(CharonFacade charonFacade)
- Parameters:
charonFacade- the charonFacade to set
-
isKbForDateExists
public boolean isKbForDateExists(java.lang.String productCode, java.util.Date kbDate)- Specified by:
isKbForDateExistsin interfaceConfigurationProvider- Returns:
trueonly if a valid KBVersion exists for the given product and date.
-
isKbVersionExists
public boolean isKbVersionExists(KBKey kbKey)
- Specified by:
isKbVersionExistsin interfaceConfigurationProvider- Returns:
- returns
trueonly if the KB version identified by the the given KBKey is known by the underlying configuration engine.
-
isKbVersionValid
public boolean isKbVersionValid(KBKey kbKey)
- Specified by:
isKbVersionValidin interfaceConfigurationProvider- Returns:
- returns
trueonly if the KB version identified by the the given KBKey is known by the underlying configuration engine and if it is still valid on the given date.
-
setCharonKbDeterminationFacade
public void setCharonKbDeterminationFacade(CharonKbDeterminationFacade charonKbDeterminationFacade)
- Parameters:
charonKbDeterminationFacade- the charonKbDeterminationFacade to set
-
getCharonKbDeterminationFacade
protected CharonKbDeterminationFacade getCharonKbDeterminationFacade()
-
setExternalConfigurationFromVariantStrategy
public void setExternalConfigurationFromVariantStrategy(ExternalConfigurationFromVariantStrategy externalConfigurationFromVariantStrategy)
- Parameters:
externalConfigurationFromVariantStrategy-
-
retrieveConfigurationFromVariant
public ConfigModel retrieveConfigurationFromVariant(java.lang.String baseProductCode, java.lang.String variantProductCode)
Description copied from interface:ConfigurationProviderGet configuration for the base product, initialized with given configuration of the variant- Specified by:
retrieveConfigurationFromVariantin interfaceConfigurationProvider- Returns:
- The pre-filled configuration model
-
convertToModelRepresentation
protected ConfigModel convertToModelRepresentation(CPSConfiguration runtimeConfiguration)
-
getConfigurationChangeAdapter
protected CPSConfigurationChangeAdapter getConfigurationChangeAdapter()
-
setConfigurationChangeAdapter
public void setConfigurationChangeAdapter(CPSConfigurationChangeAdapter configurationChangeAdapter)
- Parameters:
configurationChangeAdapter- the configurationChangeAdapter to set
-
changeConfiguration
public java.lang.String changeConfiguration(ConfigModel model) throws ConfigurationEngineException
Description copied from interface:ConfigurationProviderChecks the configuration model for changes since the last update and will send only the changes to the configuration engine, if any. The version of the runtime configuration must be included in the configuration model and the method returns the new version after the update.- Specified by:
changeConfigurationin interfaceConfigurationProvider- Parameters:
model- Updated model- Returns:
- new configuration runtime version if update successful, otherwise null
- Throws:
ConfigurationEngineException
-
releaseSession
public void releaseSession(java.lang.String configId, java.lang.String version)Description copied from interface:ConfigurationProviderReleases the configuration sessions identified by the provided ID and all associated resources. Accessing the session afterwards is not possible anymore.- Specified by:
releaseSessionin interfaceConfigurationProvider- Parameters:
configId- session idversion- version of the runtime configuration
-
extractKbKey
public KBKey extractKbKey(java.lang.String productCode, java.lang.String externalConfig)
Description copied from interface:ConfigurationProviderextracts the KBKey from the external configuration- Specified by:
extractKbKeyin interfaceConfigurationProvider- Returns:
- returns the kBKey of the given external config
-
getConfigurationModificationHandler
protected ConfigurationModificationHandler getConfigurationModificationHandler()
-
setConfigurationModificationHandler
public void setConfigurationModificationHandler(ConfigurationModificationHandler configurationModificationHandler)
- Parameters:
configurationModificationHandler- the configurationModificationHandler to set
-
-