Class CharonFacadeImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.runtime.cps.impl.CharonFacadeImpl
-
- All Implemented Interfaces:
CharonFacade
public class CharonFacadeImpl extends java.lang.Object implements CharonFacade
Default implementation ofCharonFacade. This bean has prototype scope
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringAUTO_CLEAN_UP_FALSEprotected static java.lang.StringETAG_NOT_FOUNDstatic java.lang.StringPASSPORT_CREATE_CONFIGstatic java.lang.StringPASSPORT_CREATE_FROM_EXT_CONFIGstatic java.lang.StringPASSPORT_DELETE_CONFIGstatic java.lang.StringPASSPORT_GET_CONFIGstatic java.lang.StringPASSPORT_GET_EXT_CONFIGstatic java.lang.StringPASSPORT_UPDATE_CONFIG
-
Constructor Summary
Constructors Constructor Description CharonFacadeImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected CPSCreateConfigInputassembleCreateDefaultConfigurationRequest(KBKey kbKey)protected CPSExternalConfigurationconvertFromStringToStructured(java.lang.String externalConfiguration)protected CPSCharacteristicInputcreateCharacteristicInput(CPSCharacteristic characteristic)CPSConfigurationcreateConfigurationFromExternal(CPSExternalConfiguration externalConfigStructured)Deprecated, for removal: This API element is subject to removal in a future version.since 18.11.0 - useCharonFacade.createConfigurationFromExternal(CPSExternalConfiguration, String)insteadCPSConfigurationcreateConfigurationFromExternal(CPSExternalConfiguration externalConfigStructured, java.lang.String contextProduct)Creates a new runtime configuration from the external typed representation of the configurationCPSConfigurationcreateConfigurationFromExternal(java.lang.String externalConfiguration)Deprecated, for removal: This API element is subject to removal in a future version.since 18.11.0 - useCharonFacade.createConfigurationFromExternal(String, String)insteadCPSConfigurationcreateConfigurationFromExternal(java.lang.String externalConfiguration, java.lang.String contextProduct)Creates a new runtime configuration from the external representation of the configurationCPSConfigurationcreateDefaultConfiguration(KBKey kbKey)Create default configuration and handle cookiesprotected java.lang.Stringencode(java.lang.String requestParam)protected ApiRegistryClientServicegetApiRegistryClientService()protected java.lang.StringgetAutoCleanUpFlag()protected CPSCachegetCache()protected ConfigurationClientBasegetClient()protected CommerceExternalConfigurationStrategygetCommerceExternalConfigurationStrategy()CPSConfigurationgetConfiguration(java.lang.String configId)Gets configuration, sends cookies along with request.protected CPSConfigurationParentReferenceStrategygetConfigurationParentReferenceStrategy()protected CPSContextSuppliergetContextSupplier()java.lang.StringgetExternalConfiguration(java.lang.String configId)Retrieves the external representation for a given runtime configurationprotected I18NServicegetI18NService()protected KnowledgebaseKeyComparatorgetKbKeyComparator()protected com.fasterxml.jackson.databind.ObjectMappergetObjectMapper()protected ProductConfigurationPassportServicegetPassportService()protected RequestErrorHandlergetRequestErrorHandler()protected CPSResponseAttributeStrategygetResponseStrategy()protected rx.SchedulergetScheduler()protected java.lang.StringhandleUpdateOwnCharacteristics(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId)protected java.lang.StringhandleUpdateSubItems(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion)protected CPSExternalConfigurationplaceGetExternalConfigurationRequest(java.lang.String configId)voidreleaseSession(java.lang.String configId, java.lang.String version)Deletes the session for the specified runtime configuration on the clientprotected CPSConfigurationretrieveConfiguration(java.lang.String configId)protected CPSConfigurationretrieveConfigurationAndSaveResponseAttributes(rx.Observable<com.hybris.charon.RawResponse<CPSConfiguration>> rawResponse)protected CPSConfigurationretrieveConfigurationFromClient(java.lang.String configId)voidsetApiRegistryClientService(ApiRegistryClientService apiRegistryClientService)voidsetCache(CPSCache cache)voidsetClient(ConfigurationClientBase newClient)Sets charon client from outside.voidsetCommerceExternalConfigurationStrategy(CommerceExternalConfigurationStrategy commerceExternalConfigurationStrategy)voidsetConfigurationParentReferenceStrategy(CPSConfigurationParentReferenceStrategy configurationParentReferenceStrategy)voidsetContextSupplier(CPSContextSupplier contextSupplier)voidsetI18NService(I18NService i18nService)voidsetKbKeyComparator(KnowledgebaseKeyComparator kbKeyComparator)protected voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)voidsetPassportService(ProductConfigurationPassportService sapPassportService)voidsetRequestErrorHandler(RequestErrorHandler requestErrorHandler)voidsetResponseStrategy(CPSResponseAttributeStrategy responseStrategy)protected voidtraceJsonRequestBody(java.lang.String prefix, java.lang.Object obj)java.lang.StringupdateConfiguration(CPSConfiguration configuration)Updates configuration, sends cookies along with request.protected java.lang.StringupdateConfiguration(java.lang.String cfgId, java.lang.String version, java.lang.String itemId, java.lang.String csticId, CPSCharacteristicInput changes)protected java.lang.StringupdateCPSCharacteristic(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId)
-
-
-
Field Detail
-
ETAG_NOT_FOUND
protected static final java.lang.String ETAG_NOT_FOUND
- See Also:
- Constant Field Values
-
AUTO_CLEAN_UP_FALSE
protected static final java.lang.String AUTO_CLEAN_UP_FALSE
- See Also:
- Constant Field Values
-
PASSPORT_CREATE_CONFIG
public static final java.lang.String PASSPORT_CREATE_CONFIG
- See Also:
- Constant Field Values
-
PASSPORT_CREATE_FROM_EXT_CONFIG
public static final java.lang.String PASSPORT_CREATE_FROM_EXT_CONFIG
- See Also:
- Constant Field Values
-
PASSPORT_UPDATE_CONFIG
public static final java.lang.String PASSPORT_UPDATE_CONFIG
- See Also:
- Constant Field Values
-
PASSPORT_GET_CONFIG
public static final java.lang.String PASSPORT_GET_CONFIG
- See Also:
- Constant Field Values
-
PASSPORT_GET_EXT_CONFIG
public static final java.lang.String PASSPORT_GET_EXT_CONFIG
- See Also:
- Constant Field Values
-
PASSPORT_DELETE_CONFIG
public static final java.lang.String PASSPORT_DELETE_CONFIG
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPassportService
protected ProductConfigurationPassportService getPassportService()
- Returns:
- the passportService
-
getApiRegistryClientService
protected ApiRegistryClientService getApiRegistryClientService()
-
getCommerceExternalConfigurationStrategy
protected CommerceExternalConfigurationStrategy getCommerceExternalConfigurationStrategy()
- Returns:
- the commerceExternalConfigurationStrategy
-
createDefaultConfiguration
public CPSConfiguration createDefaultConfiguration(KBKey kbKey)
Description copied from interface:CharonFacadeCreate default configuration and handle cookies- Specified by:
createDefaultConfigurationin interfaceCharonFacade- Parameters:
kbKey- key of the knowledgebase- Returns:
- runtime configuration
-
assembleCreateDefaultConfigurationRequest
protected CPSCreateConfigInput assembleCreateDefaultConfigurationRequest(KBKey kbKey)
-
getExternalConfiguration
public java.lang.String getExternalConfiguration(java.lang.String configId) throws ConfigurationEngineExceptionDescription copied from interface:CharonFacadeRetrieves the external representation for a given runtime configuration- Specified by:
getExternalConfigurationin interfaceCharonFacade- Parameters:
configId- id of the runtime configuration- Returns:
- external representation of the runtime configuration
- Throws:
ConfigurationEngineException- Service has failed, e.g. because session timed out
-
placeGetExternalConfigurationRequest
protected CPSExternalConfiguration placeGetExternalConfigurationRequest(java.lang.String configId) throws ConfigurationEngineException
- Throws:
ConfigurationEngineException
-
createConfigurationFromExternal
@Deprecated(since="1811", forRemoval=true) public CPSConfiguration createConfigurationFromExternal(java.lang.String externalConfiguration)Deprecated, for removal: This API element is subject to removal in a future version.since 18.11.0 - useCharonFacade.createConfigurationFromExternal(String, String)insteadDescription copied from interface:CharonFacadeCreates a new runtime configuration from the external representation of the configuration- Specified by:
createConfigurationFromExternalin interfaceCharonFacade- Parameters:
externalConfiguration- external representation of the configuration- Returns:
- runtime configuration based on the external representation
-
createConfigurationFromExternal
@Deprecated(since="1811", forRemoval=true) public CPSConfiguration createConfigurationFromExternal(CPSExternalConfiguration externalConfigStructured)Deprecated, for removal: This API element is subject to removal in a future version.since 18.11.0 - useCharonFacade.createConfigurationFromExternal(CPSExternalConfiguration, String)insteadDescription copied from interface:CharonFacadeCreates a new runtime configuration from the external typed representation of the configuration- Specified by:
createConfigurationFromExternalin interfaceCharonFacade- Parameters:
externalConfigStructured- The structured external configuration- Returns:
- Runtime representation
-
createConfigurationFromExternal
public CPSConfiguration createConfigurationFromExternal(java.lang.String externalConfiguration, java.lang.String contextProduct)
Description copied from interface:CharonFacadeCreates a new runtime configuration from the external representation of the configuration- Specified by:
createConfigurationFromExternalin interfaceCharonFacade- Parameters:
externalConfiguration- external representation of the configurationcontextProduct- context product- Returns:
- runtime configuration based on the external representation
-
createConfigurationFromExternal
public CPSConfiguration createConfigurationFromExternal(CPSExternalConfiguration externalConfigStructured, java.lang.String contextProduct)
Description copied from interface:CharonFacadeCreates a new runtime configuration from the external typed representation of the configuration- Specified by:
createConfigurationFromExternalin interfaceCharonFacade- Parameters:
externalConfigStructured- structured external configurationcontextProduct- context product- Returns:
- Runtime representation
-
getAutoCleanUpFlag
protected java.lang.String getAutoCleanUpFlag()
-
convertFromStringToStructured
protected CPSExternalConfiguration convertFromStringToStructured(java.lang.String externalConfiguration)
-
releaseSession
public void releaseSession(java.lang.String configId, java.lang.String version)Description copied from interface:CharonFacadeDeletes the session for the specified runtime configuration on the client- Specified by:
releaseSessionin interfaceCharonFacade- Parameters:
configId- id of the runtime configuration to be deletedversion- version of the runtime configuration to be deleted
-
updateConfiguration
public java.lang.String updateConfiguration(CPSConfiguration configuration) throws ConfigurationEngineException
Description copied from interface:CharonFacadeUpdates configuration, sends cookies along with request. The cookies are handled internally and received from theCPSResponseAttributeStrategy- Specified by:
updateConfigurationin interfaceCharonFacade- Parameters:
configuration- runtime configuration that includes only the updates- Returns:
- version of the updated runtime configuration
- Throws:
ConfigurationEngineException- when service call fails
-
updateCPSCharacteristic
protected java.lang.String updateCPSCharacteristic(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId) throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
handleUpdateSubItems
protected java.lang.String handleUpdateSubItems(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion) throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
handleUpdateOwnCharacteristics
protected java.lang.String handleUpdateOwnCharacteristics(org.apache.commons.lang.mutable.MutableBoolean updateWasDone, CPSItem item, java.lang.String cfgId, java.lang.String currentVersion, java.lang.String itemId) throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
createCharacteristicInput
protected CPSCharacteristicInput createCharacteristicInput(CPSCharacteristic characteristic)
-
updateConfiguration
protected java.lang.String updateConfiguration(java.lang.String cfgId, java.lang.String version, java.lang.String itemId, java.lang.String csticId, CPSCharacteristicInput changes) throws ConfigurationEngineException- Throws:
ConfigurationEngineException
-
encode
protected java.lang.String encode(java.lang.String requestParam)
-
getConfiguration
public CPSConfiguration getConfiguration(java.lang.String configId) throws ConfigurationEngineException
Description copied from interface:CharonFacadeGets configuration, sends cookies along with request. The cookies are handled internally and received from theCPSResponseAttributeStrategy- Specified by:
getConfigurationin interfaceCharonFacade- Parameters:
configId- configuration id- Returns:
- current state of the runtime configuration
- Throws:
ConfigurationEngineException- when service call fails
-
retrieveConfiguration
protected CPSConfiguration retrieveConfiguration(java.lang.String configId) throws ConfigurationEngineException
- Throws:
ConfigurationEngineException
-
retrieveConfigurationFromClient
protected CPSConfiguration retrieveConfigurationFromClient(java.lang.String configId) throws ConfigurationEngineException
- Throws:
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 I18NService getI18NService()
-
setI18NService
public void setI18NService(I18NService i18nService)
- Parameters:
i18nService- the i18NService to set
-
getCache
protected CPSCache getCache()
-
setCache
public void setCache(CPSCache cache)
-
traceJsonRequestBody
protected void traceJsonRequestBody(java.lang.String prefix, java.lang.Object obj)
-
retrieveConfigurationAndSaveResponseAttributes
protected CPSConfiguration retrieveConfigurationAndSaveResponseAttributes(rx.Observable<com.hybris.charon.RawResponse<CPSConfiguration>> rawResponse)
-
getResponseStrategy
protected CPSResponseAttributeStrategy getResponseStrategy()
-
setResponseStrategy
public void setResponseStrategy(CPSResponseAttributeStrategy responseStrategy)
-
getConfigurationParentReferenceStrategy
protected CPSConfigurationParentReferenceStrategy getConfigurationParentReferenceStrategy()
-
setConfigurationParentReferenceStrategy
public void setConfigurationParentReferenceStrategy(CPSConfigurationParentReferenceStrategy configurationParentReferenceStrategy)
-
setApiRegistryClientService
public void setApiRegistryClientService(ApiRegistryClientService apiRegistryClientService)
-
setPassportService
public void setPassportService(ProductConfigurationPassportService sapPassportService)
-
-