Class ProductConfigurationServiceImpl

    • Field Detail

      • NOT_ALLOWED_TO_UPDATE_CONFIGURATION

        public static final java.lang.String NOT_ALLOWED_TO_UPDATE_CONFIGURATION
        See Also:
        Constant Field Values
      • NOT_ALLOWED_TO_READ_CONFIGURATION

        public static final java.lang.String NOT_ALLOWED_TO_READ_CONFIGURATION
        See Also:
        Constant Field Values
      • NOT_ALLOWED_TO_RELEASE_CONFIGURATION

        public static final java.lang.String NOT_ALLOWED_TO_RELEASE_CONFIGURATION
        See Also:
        Constant Field Values
      • DEBUG_CONFIG_WITH_ID

        protected static final java.lang.String DEBUG_CONFIG_WITH_ID
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProductConfigurationServiceImpl

        public ProductConfigurationServiceImpl()
    • Method Detail

      • createDefaultConfiguration

        public ConfigModel createDefaultConfiguration​(KBKey kbKey)
        Description copied from interface: ProductConfigurationService
        Based on the hybris product code, provided via the KBKey.productCode, the configuration engine will provide a default configuration for the requested product.
        Specified by:
        createDefaultConfiguration in interface ProductConfigurationService
        Parameters:
        kbKey - The product code for the configurable product
        Returns:
        The configurable product with default configuration
      • checkUpdateAllowed

        protected void checkUpdateAllowed​(ConfigModel model)
      • checkReadAllowed

        protected void checkReadAllowed​(java.lang.String configId)
      • isRelatedObjectReadOnly

        protected boolean isRelatedObjectReadOnly​(java.lang.String configId,
                                                  ConfigurationRetrievalOptions retrievalOptions)
      • updateKbKeyForVariants

        protected void updateKbKeyForVariants​(ConfigModel configModel,
                                              java.lang.String baseProductCode,
                                              java.lang.String variantCode)
      • isChangeableVariant

        protected boolean isChangeableVariant​(java.lang.String variantCode)
      • updateKbKeyWithProductCode

        protected void updateKbKeyWithProductCode​(ConfigModel configModel,
                                                  java.lang.String productCode)
      • cleanUpAfterEngineError

        protected void cleanUpAfterEngineError​(java.lang.String configId)
      • retrieveExternalConfiguration

        public java.lang.String retrieveExternalConfiguration​(java.lang.String configId)
        Description copied from interface: ProductConfigurationService
        Retrieve the actual configuration model for the requested configId in a XML format.
        Specified by:
        retrieveExternalConfiguration in interface ProductConfigurationService
        Parameters:
        configId - Unique configuration ID
        Returns:
        The actual configuration as XML string
      • setProviderFactory

        public void setProviderFactory​(ProviderFactory providerFactory)
        Parameters:
        providerFactory - inject factory to access the providers
      • setMaxLocksPerMap

        public static void setMaxLocksPerMap​(int maxLocksPerMap)
        A configuration provider lock ensures, that there are no concurrent requests send to the configuration engine for the same configuration session.
        We might not always get informed when a configuration session is released, hence we do not rely on this. Instead we just keep a maximum number of locks and release the oldest locks, when there are to many. The maximum number can be configured by this setter.
        A look can be re-created in case it had already been deleted. The number should be high enough, so that locks do not get deleted while some concurrent threads are still using the lock, as this could cause concurrency issue. The maximum number heavily depends on the number of concurrent threads expected. Default is 1024.
        Parameters:
        maxLocksPerMap - sets the maximum number of Configuration Provider Locks kept.
      • getMaxLocksPerMap

        protected static int getMaxLocksPerMap()
      • getLock

        protected static java.lang.Object getLock​(java.lang.String configId)
      • ensureThatLockMapIsNotTooBig

        protected static void ensureThatLockMapIsNotTooBig()
      • createConfigurationFromExternal

        public ConfigModel createConfigurationFromExternal​(KBKey kbKey,
                                                           java.lang.String externalConfiguration)
        Description copied from interface: ProductConfigurationService
        Creates a configuration from the external string representation (which contains the configuration in XML format)
        Specified by:
        createConfigurationFromExternal in interface ProductConfigurationService
        Parameters:
        kbKey - Key attributes needed to create a model
        externalConfiguration - Configuration as XML string
        Returns:
        Configuration model
      • createConfigurationFromExternal

        public ConfigModel createConfigurationFromExternal​(KBKey kbKey,
                                                           java.lang.String externalConfiguration,
                                                           java.lang.String cartEntryKey)
        Description copied from interface: ProductConfigurationService
        Creates a configuration from the external string representation (which contains the configuration in XML format) and links it immediately with the given cart entry key
        Specified by:
        createConfigurationFromExternal in interface ProductConfigurationService
        Parameters:
        kbKey - Key attributes needed to create a model
        externalConfiguration - Configuration as XML string
        cartEntryKey - cartEntryKey this config belongs to
        Returns:
        Configuration model
      • createConfigurationFromExternal

        public ConfigModel createConfigurationFromExternal​(KBKey kbKey,
                                                           java.lang.String externalConfiguration,
                                                           java.lang.String cartEntryKey,
                                                           ConfigurationRetrievalOptions retrievalOptions)
        Description copied from interface: ProductConfigurationService
        Creates a configuration from the external string representation (which contains the configuration in XML format) and links it immediately with the given cart entry key
        Specified by:
        createConfigurationFromExternal in interface ProductConfigurationService
        Parameters:
        kbKey - Key attributes needed to create a model
        externalConfiguration - Configuration as XML string
        cartEntryKey - cartEntryKey this config belongs to
        retrievalOptions - options to modify behavior
        Returns:
        Configuration model
      • releaseSession

        public void releaseSession​(java.lang.String configId)
        Description copied from interface: ProductConfigurationService
        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 ProductConfigurationService
        Parameters:
        configId - session id
      • releaseSession

        public void releaseSession​(java.lang.String configId,
                                   boolean keepModel)
        Description copied from interface: ProductConfigurationService
        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 ProductConfigurationService
        Parameters:
        configId - session id
        keepModel - signifies whether config model should be kept despite releasing session
      • checkReleaseAllowed

        protected void checkReleaseAllowed​(java.lang.String configId)
      • removeConfigAttributesFromCache

        protected void removeConfigAttributesFromCache​(java.lang.String configId)
      • removeConfigAttributesSessionFromCache

        @Deprecated(since="1811",
                    forRemoval=true)
        protected void removeConfigAttributesSessionFromCache​(java.lang.String configId)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • cacheConfig

        protected void cacheConfig​(ConfigModel config)
      • countNumberOfIncompleteCstics

        protected int countNumberOfIncompleteCstics​(InstanceModel rootInstance)
      • countNumberOfIncompleteVisibleCstics

        protected int countNumberOfIncompleteVisibleCstics​(CsticModel cstic)
      • countNumberOfNotConsistentCstics

        protected int countNumberOfNotConsistentCstics​(InstanceModel instance)
      • countNumberOfSolvableConflicts

        protected int countNumberOfSolvableConflicts​(ConfigModel configModel)
      • createConfigurationForVariant

        public ConfigModel createConfigurationForVariant​(java.lang.String baseProductCode,
                                                         java.lang.String variantProductCode)
        Description copied from interface: ProductConfigurationService
        Based on the hybris product code, the configuration engine will provide a configuration for the requested product variant.
        Specified by:
        createConfigurationForVariant in interface ProductConfigurationService
        Parameters:
        baseProductCode - The product code for the configurable base product
        variantProductCode - The product code for the specific product variant
        Returns:
        The configurable product with default configuration
      • setRecorder

        public void setRecorder​(TrackingRecorder recorder)
        Parameters:
        recorder - inject the CPQ tracking recorder for tracking CPQ events
      • hasKbForDate

        public boolean hasKbForDate​(java.lang.String productCode,
                                    java.util.Date kbDate)
        Description copied from interface: ProductConfigurationService
        Checks whether a kb version exists for a given product and date
        Specified by:
        hasKbForDate in interface ProductConfigurationService
        Parameters:
        productCode - product code
        kbDate - date of the knowledgebase
        Returns:
        true if KB version for the date exists
      • hasKbForVersion

        @Deprecated(since="1808",
                    forRemoval=true)
        public boolean hasKbForVersion​(KBKey kbKey,
                                       java.lang.String externalConfig)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since 18.08
        Description copied from interface: ProductConfigurationService
        Checks whether kb version specified in the external config still exists
        Specified by:
        hasKbForVersion in interface ProductConfigurationService
        Parameters:
        kbKey - knowledgebase key which is used to extract product code
        externalConfig - external configuration
        Returns:
        true if KB version specified in the external config exists
      • setConfigurationPricingOrderIntegrationService

        public void setConfigurationPricingOrderIntegrationService​(ProductConfigurationOrderIntegrationService configurationPricingOrderIntegrationService)
        Parameters:
        configurationPricingOrderIntegrationService - the configurationPricingOrderIntegrationService to set
      • setProductConfigurationPricingStrategy

        public void setProductConfigurationPricingStrategy​(ProductConfigurationPricingStrategy productConfigurationPricingStrategy)
        Parameters:
        productConfigurationPricingStrategy - the productConfigurationPricingStrategy to set
      • extractKbKey

        public KBKey extractKbKey​(java.lang.String productCode,
                                  java.lang.String externalConfig)
        Description copied from interface: ProductConfigurationService
        Extracts the KBKey from the external configuration
        Specified by:
        extractKbKey in interface ProductConfigurationService
        Parameters:
        productCode - product code
        externalConfig - external config
        Returns:
        returns the kBKey of the given external config
      • setProductConfigurationAccessControlService

        public void setProductConfigurationAccessControlService​(ProductConfigurationAccessControlService productConfigurationAccessControlService)
        Parameters:
        productConfigurationAccessControlService -
      • setCpqConfigurableChecker

        public void setCpqConfigurableChecker​(CPQConfigurableChecker cpqConfigurableChecker)
      • setConfigurationProductUtil

        public void setConfigurationProductUtil​(ConfigurationProductUtil configurationProductUtil)