java.lang.Object
de.hybris.platform.sap.productconfig.runtime.cps.impl.CharonFacadeImpl
All Implemented Interfaces:
CharonFacade

public class CharonFacadeImpl extends Object implements CharonFacade
Default implementation of CharonFacade. This bean has prototype scope
  • Field Details

  • Constructor Details

    • CharonFacadeImpl

      public CharonFacadeImpl()
  • Method Details

    • getPassportService

      protected ProductConfigurationPassportService getPassportService()
      Returns:
      the passportService
    • getApiRegistryClientService

      protected de.hybris.platform.apiregistryservices.services.ApiRegistryClientService getApiRegistryClientService()
    • getCommerceExternalConfigurationStrategy

      protected CommerceExternalConfigurationStrategy getCommerceExternalConfigurationStrategy()
      Returns:
      the commerceExternalConfigurationStrategy
    • createDefaultConfiguration

      public CPSConfiguration createDefaultConfiguration(de.hybris.platform.sap.productconfig.runtime.interf.KBKey kbKey)
      Description copied from interface: CharonFacade
      Create default configuration and handle cookies
      Specified by:
      createDefaultConfiguration in interface CharonFacade
      Parameters:
      kbKey - key of the knowledgebase
      Returns:
      runtime configuration
    • assembleCreateDefaultConfigurationRequest

      protected CPSCreateConfigInput assembleCreateDefaultConfigurationRequest(de.hybris.platform.sap.productconfig.runtime.interf.KBKey kbKey)
    • getExternalConfiguration

      public String getExternalConfiguration(String configId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Description copied from interface: CharonFacade
      Retrieves the external representation for a given runtime configuration
      Specified by:
      getExternalConfiguration in interface CharonFacade
      Parameters:
      configId - id of the runtime configuration
      Returns:
      external representation of the runtime configuration
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException - Service has failed, e.g. because session timed out
    • placeGetExternalConfigurationRequest

      protected CPSExternalConfiguration placeGetExternalConfigurationRequest(String configId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • createConfigurationFromExternal

      public CPSConfiguration createConfigurationFromExternal(String externalConfiguration, String contextProduct)
      Description copied from interface: CharonFacade
      Creates a new runtime configuration from the external representation of the configuration. The KB version will not be re-determined.
      Specified by:
      createConfigurationFromExternal in interface CharonFacade
      Parameters:
      externalConfiguration - external representation of the configuration
      contextProduct - context product
      Returns:
      runtime configuration based on the external representation
    • createConfigurationFromExternalWithDate

      public CPSConfiguration createConfigurationFromExternalWithDate(String externalConfiguration, String contextProduct, Date date)
      Description copied from interface: CharonFacade
      Creates a new runtime configuration from the external representation of the configuration
      Specified by:
      createConfigurationFromExternalWithDate in interface CharonFacade
      Parameters:
      externalConfiguration - external representation of the configuration
      contextProduct - context product
      date - this date will be sent to CPS Service and a KB re-determination happens in order to find the most current KB version Otherwise the result will be exactly the same as calling CharonFacade.createConfigurationFromExternal(CPSExternalConfiguration, String)
      Returns:
      runtime configuration based on the external representation
    • createConfigurationFromExternal

      public CPSConfiguration createConfigurationFromExternal(CPSExternalConfiguration externalConfigStructured, String contextProduct)
      Description copied from interface: CharonFacade
      Creates a new runtime configuration from the external typed representation of the configuration
      Specified by:
      createConfigurationFromExternal in interface CharonFacade
      Parameters:
      externalConfigStructured - structured external configuration
      contextProduct - context product
      Returns:
      Runtime representation
    • getAutoCleanUpFlag

      protected String getAutoCleanUpFlag()
    • convertFromStringToStructured

      protected CPSExternalConfiguration convertFromStringToStructured(String externalConfiguration)
    • releaseSession

      public void releaseSession(String configId, String version)
      Description copied from interface: CharonFacade
      Deletes the session for the specified runtime configuration on the client
      Specified by:
      releaseSession in interface CharonFacade
      Parameters:
      configId - id of the runtime configuration to be deleted
      version - version of the runtime configuration to be deleted
    • updateConfiguration

      public String updateConfiguration(CPSConfiguration configuration) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Description copied from interface: CharonFacade
      Updates configuration, sends cookies along with request. The cookies are handled internally and received from the CPSResponseAttributeStrategy
      Specified by:
      updateConfiguration in interface CharonFacade
      Parameters:
      configuration - runtime configuration that includes only the updates
      Returns:
      version of the updated runtime configuration
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException - when service call fails
    • updateCPSCharacteristic

      protected String updateCPSCharacteristic(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, String cfgId, String currentVersion, String itemId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • handleUpdateSubItems

      protected String handleUpdateSubItems(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, String cfgId, String currentVersion) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • handleUpdateOwnCharacteristics

      protected String handleUpdateOwnCharacteristics(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, String cfgId, String currentVersion, String itemId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • createCharacteristicInput

      protected CPSCharacteristicInput createCharacteristicInput(CPSCharacteristic characteristic)
    • updateConfiguration

      protected String updateConfiguration(String cfgId, String version, String itemId, String csticId, CPSCharacteristicInput changes) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • encode

      protected String encode(String requestParam)
    • getConfiguration

      public CPSConfiguration getConfiguration(String configId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Description copied from interface: CharonFacade
      Gets configuration, sends cookies along with request. The cookies are handled internally and received from the CPSResponseAttributeStrategy
      Specified by:
      getConfiguration in interface CharonFacade
      Parameters:
      configId - configuration id
      Returns:
      current state of the runtime configuration
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException - when service call fails
    • retrieveConfiguration

      protected CPSConfiguration retrieveConfiguration(String configId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • retrieveConfigurationFromClient

      protected CPSConfiguration retrieveConfigurationFromClient(String configId) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
    • getKbKeyComparator

      protected KnowledgebaseKeyComparator getKbKeyComparator()
    • setKbKeyComparator

      public void setKbKeyComparator(KnowledgebaseKeyComparator kbKeyComparator)
    • setCommerceExternalConfigurationStrategy

      public void setCommerceExternalConfigurationStrategy(CommerceExternalConfigurationStrategy commerceExternalConfigurationStrategy)
      Parameters:
      commerceExternalConfigurationStrategy -
    • getRequestErrorHandler

      protected RequestErrorHandler getRequestErrorHandler()
    • setRequestErrorHandler

      public void setRequestErrorHandler(RequestErrorHandler requestErrorHandler)
      Parameters:
      requestErrorHandler - For wrapping the http errors we receive from the REST service call
    • getClient

      protected ConfigurationClientBase getClient()
    • setClient

      public void setClient(ConfigurationClientBase newClient)
      Sets charon client from outside. Only used in test environments
      Parameters:
      newClient - Charon client representing REST calls for product configuration.
    • getObjectMapper

      protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
    • setObjectMapper

      protected void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • getScheduler

      protected rx.Scheduler getScheduler()
    • getContextSupplier

      protected CPSContextSupplier getContextSupplier()
      Returns:
      the contextSupplier
    • setContextSupplier

      public void setContextSupplier(CPSContextSupplier contextSupplier)
      Parameters:
      contextSupplier - the contextSupplier to set
    • getI18NService

      protected de.hybris.platform.servicelayer.i18n.I18NService getI18NService()
    • setI18NService

      public void setI18NService(de.hybris.platform.servicelayer.i18n.I18NService i18nService)
      Parameters:
      i18nService - the i18NService to set
    • getCache

      protected CPSCache getCache()
    • setCache

      public void setCache(CPSCache cache)
    • traceJsonRequestBody

      protected void traceJsonRequestBody(String prefix, Object obj)
    • retrieveConfigurationAndSaveResponseAttributes

      protected CPSConfiguration retrieveConfigurationAndSaveResponseAttributes(rx.Observable<com.hybris.charon.RawResponse<CPSConfiguration>> rawResponse)
    • retrieveItemAndSaveResponseAttributes

      protected CPSItem retrieveItemAndSaveResponseAttributes(rx.Observable<com.hybris.charon.RawResponse<CPSItem>> rawResponse, String configId)
    • getResponseStrategy

      protected CPSResponseAttributeStrategy getResponseStrategy()
    • setResponseStrategy

      public void setResponseStrategy(CPSResponseAttributeStrategy responseStrategy)
    • getConfigurationParentReferenceStrategy

      protected CPSConfigurationParentReferenceStrategy getConfigurationParentReferenceStrategy()
    • setConfigurationParentReferenceStrategy

      public void setConfigurationParentReferenceStrategy(CPSConfigurationParentReferenceStrategy configurationParentReferenceStrategy)
    • setApiRegistryClientService

      public void setApiRegistryClientService(de.hybris.platform.apiregistryservices.services.ApiRegistryClientService apiRegistryClientService)
    • setPassportService

      public void setPassportService(ProductConfigurationPassportService sapPassportService)
    • isReadDomainValuesOnDemand

      public boolean isReadDomainValuesOnDemand()
      Description copied from interface: CharonFacade
      Are domain values ready on demand, on group level?
      Specified by:
      isReadDomainValuesOnDemand in interface CharonFacade
      Returns:
      Domain values read on demand?
    • setReadDomainValuesOnDemand

      public void setReadDomainValuesOnDemand(boolean readDomainValuesOnDemand)
    • getItemWithGroupDetails

      public CPSItem getItemWithGroupDetails(String configId, String instanceId, List<String> groupNames) throws de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException
      Description copied from interface: CharonFacade
      Reads an item within a configuration and returns all details only for the specified groups of this instance
      Specified by:
      getItemWithGroupDetails in interface CharonFacade
      Parameters:
      configId - Configuration ID
      instanceId - Instance Id for which group data are requested
      groupNames - List of requested group names for which we want to read the group details.
      Returns:
      Requested characteristic groups including domain values and all details
      Throws:
      de.hybris.platform.sap.productconfig.runtime.interf.ConfigurationEngineException - Indicates that the CPS call could not be performed
    • compileGroupNamesForRequest

      protected String compileGroupNamesForRequest(List<String> groupNames)
    • handleGeneralGroupId

      protected String handleGeneralGroupId(String groupId)
    • setKeyGenerator

      public void setKeyGenerator(de.hybris.platform.sap.productconfig.runtime.interf.services.UniqueKeyGenerator keyGenerator)
    • getKeyGenerator

      protected de.hybris.platform.sap.productconfig.runtime.interf.services.UniqueKeyGenerator getKeyGenerator()