Class ConfigurationProviderMockImpl

java.lang.Object
de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl
All Implemented Interfaces:
ConfigurationProvider

public class ConfigurationProviderMockImpl extends Object implements ConfigurationProvider
  • Field Details

    • VERSION_NUMBER_INITIAL

      protected static final String VERSION_NUMBER_INITIAL
      See Also:
    • MAX_EXTERNAL_CONFIGS

      public static final int MAX_EXTERNAL_CONFIGS
      See Also:
    • removePricesFromConfiguration

      protected boolean removePricesFromConfiguration
    • STATIC_DELTA_PRICES

      public static final String STATIC_DELTA_PRICES
      prefix for static delta prices
      See Also:
    • extConfigState

      protected Map<String,de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl.ExtConfigState> extConfigState
    • extConfigStateOld

      protected Map<String,de.hybris.platform.sap.productconfig.runtime.mock.provider.impl.ConfigurationProviderMockImpl.ExtConfigState> extConfigStateOld
    • createdConfigs

      protected Map<String,ConfigModel> createdConfigs
    • INVALID_RT_VERSION

      protected static final String INVALID_RT_VERSION
      See Also:
    • SEPARATOR

      protected static final String 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

      protected ProductService getProductService()
    • setProductService

      public void setProductService(ProductService productService)
    • setRemovePricesFromConfiguration

      public void setRemovePricesFromConfiguration(boolean removePricesFromConfiguration)
    • createDefaultConfiguration

      public ConfigModel createDefaultConfiguration(KBKey kbKey)
      Description copied from interface: ConfigurationProvider
      Creates 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:
      createDefaultConfiguration in interface ConfigurationProvider
      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

      protected ProductModel getProductModel(String productCode)
    • removePrices

      protected void removePrices(ConfigModel model)
    • removeDeltaPrices

      protected void removeDeltaPrices(InstanceModel instance)
    • setAuthorSystemForAllCstics

      protected void setAuthorSystemForAllCstics(InstanceModel instance)
    • setAuthorUserForAllChangedCstics

      protected void setAuthorUserForAllChangedCstics(InstanceModel instance)
    • getAllValuePricesForAssignedValues

      protected String getAllValuePricesForAssignedValues(ConfigModel configModel)
    • updateConfiguration

      public boolean updateConfiguration(ConfigModel model)
      Description copied from interface: ConfigurationProvider
      Checks the configuration model for changes since the last update and will send only the changes to the configuration engine, if any.
      Specified by:
      updateConfiguration in interface ConfigurationProvider
      Parameters:
      model - Updated model
      Returns:
      true, only if it was necessary to send an update to the configuration engine
    • retrieveConfigurationModel

      public ConfigModel retrieveConfigurationModel(String configId) throws ConfigurationEngineException
      Description copied from interface: ConfigurationProvider
      Retrieve the current state of the configuration model for the requested configId.
      Specified by:
      retrieveConfigurationModel in interface ConfigurationProvider
      Parameters:
      configId - Unique configuration ID
      Returns:
      The actual configuration
      Throws:
      ConfigurationEngineException - Service has failed, e.g. because session timed out
    • ensureConfigIsKnown

      protected void ensureConfigIsKnown(String configId) throws ConfigurationEngineException
      Throws:
      ConfigurationEngineException
    • retrieveExternalConfiguration

      public String retrieveExternalConfiguration(String configId) throws ConfigurationEngineException
      Description copied from interface: ConfigurationProvider
      Retrieve the current state of the configuration for the requested configId as an XML string containing the configuration in external format.
      Specified by:
      retrieveExternalConfiguration in interface ConfigurationProvider
      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

      public void setI18NService(I18NService notNeededYet)
    • createConfigurationFromExternalSource

      public ConfigModel createConfigurationFromExternalSource(Configuration extConfig)
      Description copied from interface: ConfigurationProvider
      Creates 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:
      createConfigurationFromExternalSource in interface ConfigurationProvider
      Parameters:
      extConfig - External configuration in external format
      Returns:
      Configuration model
    • createConfigurationFromExternalSource

      public ConfigModel createConfigurationFromExternalSource(KBKey kbKey, String extConfig)
      Description copied from interface: ConfigurationProvider
      Creates 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:
      createConfigurationFromExternalSource in interface ConfigurationProvider
      Parameters:
      kbKey - Information needed to create a knowledge base
      extConfig - External configuration as XML string
      Returns:
      Configuration model
    • getStructuredConfigIdFromString

      protected ConfigurationId getStructuredConfigIdFromString(String configId) throws ConfigurationEngineException
      Throws:
      ConfigurationEngineException
    • getConfigIdFromStructured

      protected String getConfigIdFromStructured(ConfigurationId configId)
    • generateConfigId

      protected String generateConfigId(String productId, String variantId, String configIdToBeUsed)
    • extractConfigIdFromExtConfig

      protected String extractConfigIdFromExtConfig(String extConfig)
      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

      protected String parseAttributeValue(String extConfig, String tag, String attribute)
    • getCachedConfig

      public ConfigModel getCachedConfig(String configId)
    • releaseSession

      public void releaseSession(String configId)
      Description copied from interface: ConfigurationProvider
      Releases the configuration sessions identified by the provided ID and all associated resources. Accessing the session afterwards is not possible anymore.
      Specified by:
      releaseSession in interface ConfigurationProvider
      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:
      retrieveConfigurationFromVariant in interface ConfigurationProvider
      Returns:
      The pre-filled configuration model
    • isKbForDateExists

      public boolean isKbForDateExists(String productCode, Date kbDate)
      Specified by:
      isKbForDateExists in interface ConfigurationProvider
      Returns:
      true only if a valid KBVersion exists for the given product and date.
    • getConfigMockFactory

      public ConfigMockFactory getConfigMockFactory()
      Returns:
      the runTimeConfigMockFactory
    • setConfigMockFactory

      public void setConfigMockFactory(ConfigMockFactory configMockFactory)
      Parameters:
      configMockFactory - the runTimeConfigMockFactory to set
    • getProviderFactory

      protected ProviderFactory getProviderFactory()
    • setProviderFactory

      public void setProviderFactory(ProviderFactory providerFactory)
    • changeConfiguration

      public String changeConfiguration(ConfigModel model) throws ConfigurationEngineException
      Description copied from interface: ConfigurationProvider
      Checks 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:
      changeConfiguration in interface ConfigurationProvider
      Parameters:
      model - Updated model
      Returns:
      new configuration runtime version if update successful, otherwise null
      Throws:
      ConfigurationEngineException
    • initVersion

      protected void initVersion(ConfigModel model)
    • incrementVersion

      protected String incrementVersion(ConfigModel model)
    • releaseSession

      public void releaseSession(String configId, String version)
      Description copied from interface: ConfigurationProvider
      Releases the configuration sessions identified by the provided ID and all associated resources. Accessing the session afterwards is not possible anymore.
      Specified by:
      releaseSession in interface ConfigurationProvider
      Parameters:
      configId - session id
      version - version of the runtime configuration
    • extractKbKey

      public KBKey extractKbKey(String productCode, String externalConfig)
      Description copied from interface: ConfigurationProvider
      extracts the KBKey from the external configuration
      Specified by:
      extractKbKey in interface ConfigurationProvider
      Returns:
      returns the kBKey of the given external config
    • isKbVersionExists

      public boolean isKbVersionExists(KBKey kbKey)
      Specified by:
      isKbVersionExists in interface ConfigurationProvider
      Returns:
      returns true only 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:
      isKbVersionValid in interface ConfigurationProvider
      Returns:
      returns true only 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.