Class DefaultSAPCDPCustomerService
java.lang.Object
com.sap.sapsegmentationservices.cdp.service.impl.DefaultSAPCDPCustomerService
- All Implemented Interfaces:
SAPCDPCustomerService
Fetches customer segments associated with the user. If cached segments are available, they are returned; otherwise,
segments are fetched from the Customer Data Platform (CDP), updated in the cache, and returned.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSAPCDPCustomerService(de.hybris.platform.integrationservices.cache.IntegrationCache<CDPCustomerSegmentsCacheKey, List<String>> cdpCustomerSegmentsCache) Constructs an instance of DefaultSAPCDPCustomerService with the provided IntegrationCache for storing customer segments. -
Method Summary
Modifier and TypeMethodDescriptionCalls the Customer Data Platform (CDP) to fetch customer segments associated with the user.protected CDPCustomerSegmentsCacheKeyCreates a cache key based on the user and current base site.extractSegmentsFromResponse(String response) Extracts customer segments from the response obtained from the Customer Data Platform (CDP).Fetches customer segments associated with the user.de.hybris.platform.site.BaseSiteServicede.hybris.platform.integrationservices.cache.IntegrationCache<CDPCustomerSegmentsCacheKey,List<String>> de.hybris.platform.personalizationservices.configuration.CxConfigurationServicede.hybris.platform.outboundservices.client.IntegrationRestTemplateFactoryprotected booleanDetermines whether CDP personalization features are enabled or not.voidsetBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) voidsetCxConfigurationService(de.hybris.platform.personalizationservices.configuration.CxConfigurationService cxConfigurationService) voidsetIntegrationRestTemplateFactory(de.hybris.platform.outboundservices.client.IntegrationRestTemplateFactory integrationRestTemplateFactory) voidsetSapPersonalizationConsumedDestinationService(SAPPersonalizationConsumedDestinationService sapPersonalizationConsumedDestinationService)
-
Constructor Details
-
DefaultSAPCDPCustomerService
public DefaultSAPCDPCustomerService(de.hybris.platform.integrationservices.cache.IntegrationCache<CDPCustomerSegmentsCacheKey, List<String>> cdpCustomerSegmentsCache) Constructs an instance of DefaultSAPCDPCustomerService with the provided IntegrationCache for storing customer segments.- Parameters:
cdpCustomerSegmentsCache- An IntegrationCache instance used to store and retrieve customer segments.
-
-
Method Details
-
fetchSegmentsFromCDP
Fetches customer segments associated with the user. If cached segments are available, they are returned; otherwise, segments are fetched from the Customer Data Platform (CDP), updated in the cache, and returned.- Specified by:
fetchSegmentsFromCDPin interfaceSAPCDPCustomerService- Parameters:
user- The UserModel representing the user for whom segments need to be fetched.- Returns:
- A list of strings representing the customer segments associated with the user in CDP.
-
callCDPTofetchSegments
Calls the Customer Data Platform (CDP) to fetch customer segments associated with the user.- Parameters:
user- The UserModel representing the user for whom segments need to be fetched.- Returns:
- A list of strings representing the customer segments associated with the user in CDP.
-
extractSegmentsFromResponse
Extracts customer segments from the response obtained from the Customer Data Platform (CDP).- Parameters:
response- The String representation of the response obtained from the CDP.- Returns:
- A list of strings representing the customer segments extracted from the response.
- Throws:
IOException- If there's an error while processing the response.
-
createKey
Creates a cache key based on the user and current base site.- Parameters:
user- The UserModel for which the cache key needs to be created.- Returns:
- A CDPCustomerSegmentsCacheKey representing the cache key for the user and base site.
-
isPersonalizationEnabled
protected boolean isPersonalizationEnabled()Determines whether CDP personalization features are enabled or not.- Returns:
trueif CDP Segmentation is enabled,falseotherwise.
-
getIntegrationRestTemplateFactory
public de.hybris.platform.outboundservices.client.IntegrationRestTemplateFactory getIntegrationRestTemplateFactory()- Returns:
- the integrationRestTemplateFactory
-
setIntegrationRestTemplateFactory
public void setIntegrationRestTemplateFactory(de.hybris.platform.outboundservices.client.IntegrationRestTemplateFactory integrationRestTemplateFactory) - Parameters:
integrationRestTemplateFactory- the integrationRestTemplateFactory to set
-
getBaseSiteService
public de.hybris.platform.site.BaseSiteService getBaseSiteService()- Returns:
- the baseSiteService
-
setBaseSiteService
public void setBaseSiteService(de.hybris.platform.site.BaseSiteService baseSiteService) - Parameters:
baseSiteService- the baseSiteService to set
-
getSapPersonalizationConsumedDestinationService
public SAPPersonalizationConsumedDestinationService getSapPersonalizationConsumedDestinationService()- Returns:
- the sapPersonalizationConsumedDestinationService
-
setSapPersonalizationConsumedDestinationService
public void setSapPersonalizationConsumedDestinationService(SAPPersonalizationConsumedDestinationService sapPersonalizationConsumedDestinationService) - Parameters:
sapPersonalizationConsumedDestinationService- the sapPersonalizationConsumedDestinationService to set
-
getCdpCustomerSegmentsCache
public de.hybris.platform.integrationservices.cache.IntegrationCache<CDPCustomerSegmentsCacheKey,List<String>> getCdpCustomerSegmentsCache()- Returns:
- the cdpCustomerSegmentsCache
-
getCxConfigurationService
public de.hybris.platform.personalizationservices.configuration.CxConfigurationService getCxConfigurationService()- Returns:
- the cxConfigurationService
-
setCxConfigurationService
public void setCxConfigurationService(de.hybris.platform.personalizationservices.configuration.CxConfigurationService cxConfigurationService) - Parameters:
cxConfigurationService- the cxConfigurationService to set
-