Class ConfigurationProviderMockImpl
java.lang.Object
de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl
- All Implemented Interfaces:
ConfigurationProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,ConfigModel> protected Map<String,de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl.ExtConfigState> protected Map<String,de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl.ExtConfigState> protected static final Stringstatic final intprotected static final intprotected static final intprotected static final intprotected static final intprotected booleanprotected static final Stringstatic final Stringprefix for static delta pricesprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchangeConfiguration(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 ConfigModelcreateConfigMock(String sapProductId, String variantProductCode, String configIdToUse) Creates 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 voidensureConfigIsKnown(String configId) protected voidprotected booleanextConfigBelongsToValidProduct(String configId) protected StringextractConfigIdFromExtConfig(String extConfig) Extracts the config id from an external configuration string.extractKbKey(String productCode, String externalConfig) extracts the KBKey from the external configurationprotected StringgenerateConfigId(String productId, String variantId, String configIdToBeUsed) protected StringgetAllValuePricesForAssignedValues(ConfigModel configModel) getCachedConfig(String configId) protected StringgetConfigIdFromStructured(ConfigurationId configId) protected ProductModelgetProductModel(String productCode) protected ProductServiceprotected ProviderFactoryprotected ConfigurationIdgetStructuredConfigIdFromString(String configId) protected StringincrementVersion(ConfigModel model) protected voidinitVersion(ConfigModel model) booleanisKbForDateExists(String productCode, Date kbDate) booleanisKbVersionExists(KBKey kbKey) booleanisKbVersionValid(KBKey kbKey) protected StringparseAttributeValue(String extConfig, String tag, String attribute) voidreleaseSession(String configId) Releases the configuration sessions identified by the provided ID and all associated resources.voidreleaseSession(String configId, String version) Releases the configuration sessions identified by the provided ID and all associated resources.protected voidremoveDeltaPrices(InstanceModel instance) protected voidremovePrices(ConfigModel model) retrieveConfigurationFromVariant(String baseProductCode, String variantProductCode) Simple returns the default configuration of the base product as a variantretrieveConfigurationModel(String configId) 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.protected voidsetAuthorSystemForAllCstics(InstanceModel instance) protected voidvoidsetConfigMockFactory(ConfigMockFactory configMockFactory) voidsetI18NService(I18NService notNeededYet) voidsetProductService(ProductService productService) voidsetProviderFactory(ProviderFactory providerFactory) voidsetRemovePricesFromConfiguration(boolean removePricesFromConfiguration) 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, waitMethods inherited from interface de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationProvider
retrieveConfigurationModel
-
Field Details
-
VERSION_NUMBER_INITIAL
- See Also:
-
MAX_EXTERNAL_CONFIGS
public static final int MAX_EXTERNAL_CONFIGS- See Also:
-
removePricesFromConfiguration
protected boolean removePricesFromConfiguration -
STATIC_DELTA_PRICES
prefix for static delta prices- See Also:
-
extConfigState
-
extConfigStateOld
-
createdConfigs
-
INVALID_RT_VERSION
- See Also:
-
SEPARATOR
- See Also:
-
PARTS_UUID
protected static final int PARTS_UUID- See Also:
-
PARTS_PRODUCT
protected static final int PARTS_PRODUCT- See Also:
-
PARTS_NUMBER_MINIMUM
protected static final int PARTS_NUMBER_MINIMUM- See Also:
-
PARTS_NUMBER_MAXIMUM
protected static final int PARTS_NUMBER_MAXIMUM- See Also:
-
-
Constructor Details
-
ConfigurationProviderMockImpl
public ConfigurationProviderMockImpl()
-
-
Method Details
-
getProductService
-
setProductService
-
setRemovePricesFromConfiguration
public void setRemovePricesFromConfiguration(boolean removePricesFromConfiguration) -
createDefaultConfiguration
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
-
createConfigMock
protected ConfigModel createConfigMock(String sapProductId, String variantProductCode, String configIdToUse) -
getProductModel
-
removePrices
-
removeDeltaPrices
-
setAuthorSystemForAllCstics
-
setAuthorUserForAllChangedCstics
-
getAllValuePricesForAssignedValues
-
updateConfiguration
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
-
retrieveConfigurationModel
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
-
ensureConfigIsKnown
- Throws:
ConfigurationEngineException
-
retrieveExternalConfiguration
Description 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
-
extConfigBelongsToValidProduct
protected boolean extConfigBelongsToValidProduct(String configId) throws ConfigurationEngineException - Throws:
ConfigurationEngineException
-
ensureNotToManyExtConfigs
protected void ensureNotToManyExtConfigs() -
setI18NService
-
createConfigurationFromExternalSource
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
-
createConfigurationFromExternalSource
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
-
getStructuredConfigIdFromString
protected ConfigurationId getStructuredConfigIdFromString(String configId) throws ConfigurationEngineException - Throws:
ConfigurationEngineException
-
getConfigIdFromStructured
-
generateConfigId
-
extractConfigIdFromExtConfig
Extracts the config id from an external configuration string. The config id is stored as child element of the TEST_PROPERTIES tag. Example:1 - Parameters:
extConfig-- Returns:
- configId
-
parseAttributeValue
-
getCachedConfig
-
releaseSession
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
-
retrieveConfigurationFromVariant
public ConfigModel retrieveConfigurationFromVariant(String baseProductCode, String variantProductCode) Simple returns the default configuration of the base product as a variant- Specified by:
retrieveConfigurationFromVariantin interfaceConfigurationProvider- Returns:
- The pre-filled configuration model
-
isKbForDateExists
- Specified by:
isKbForDateExistsin interfaceConfigurationProvider- Returns:
trueonly if a valid KBVersion exists for the given product and date.
-
getConfigMockFactory
- Returns:
- the runTimeConfigMockFactory
-
setConfigMockFactory
- Parameters:
configMockFactory- the runTimeConfigMockFactory to set
-
getProviderFactory
-
setProviderFactory
-
changeConfiguration
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
-
initVersion
-
incrementVersion
-
releaseSession
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
Description copied from interface:ConfigurationProviderextracts the KBKey from the external configuration- Specified by:
extractKbKeyin interfaceConfigurationProvider- Returns:
- returns the kBKey of the given external config
-
isKbVersionExists
- 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
- 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.
-