Class DefaultRecommendationBufferService
java.lang.Object
com.hybris.ymkt.recommendationbuffer.service.impl.DefaultRecommendationBufferService
- All Implemented Interfaces:
RecommendationBufferService
public class DefaultRecommendationBufferService
extends Object
implements RecommendationBufferService
Buffer service for reading and saving recommendation related entities.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected intprotected de.hybris.platform.servicelayer.model.ModelServiceprotected RecommendationBufferDao -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringTakes a csv string and cuts it to fit in 255 characters.getAggregatedImpressions(int batchSize) Read aListofSAPRecoImpressionAggrModel.getClickthroughs(int readBatchSize) ReadListofSAPRecoClickthroughModel.getGenericRecommendation(String scenarioId, String leadingItems) Get recommendations with scope Gprotected StringgetHashIdsForType(String scenarioId, String recoType) getHashIdsForUser(String userId, String scenarioId) Get all hash ids for usergetImpressions(int readBatchSize) ReadListofSAPRecoImpressionModel.getOfferInteractions(int batchSize) ReadListofSAPOfferInteractionModel.getPersonalizedRecommendation(String userId, String scenarioId, String leadingItems) Get a recommendation.getRestrictedRecommendation(String scenarioId, String leadingItems) Get recommendations with scope RbooleanisRecommendationExpired(SAPRecommendationBufferModel recommendation) Check if a recommendation is expired.protected voidremoveExpiredAny(Function<Date, List<? extends ItemModel>> serviceMethod) voidRemove expired mappings based on the expiry offset.voidRemove expired recommendations based on the expiry offset.voidRemove expired mappings based on the expiry offset.voidsaveRecommendation(String userId, String scenarioId, String hashId, String leadingItems, String recoList, String recoType, Date expiresOn) Add a new recommendation entry.protected voidsaveRecommendationBuffer(String scenarioId, String hashId, String leadingItems, String recoList, Date expiresOn) protected voidsaveRecommendationMapping(String userId, String scenarioId, String hashId, Date expiresOn) protected voidsaveRecommendationTypeMapping(String scenarioId, String hashId, String recoType, Date expiresOn) voidsetEnableRecommendationBuffer(boolean enableRecommendationBuffer) voidsetExpiryOffset(int expiryOffset) voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService) voidsetRecommendationBufferDao(RecommendationBufferDao recommendationBufferDao)
-
Field Details
-
enableRecommendationBuffer
protected boolean enableRecommendationBuffer -
expiryOffset
protected int expiryOffset -
modelService
protected de.hybris.platform.servicelayer.model.ModelService modelService -
recommendationBufferDao
-
-
Constructor Details
-
DefaultRecommendationBufferService
public DefaultRecommendationBufferService()
-
-
Method Details
-
getAggregatedImpressions
Description copied from interface:RecommendationBufferServiceRead aListofSAPRecoImpressionAggrModel.- Specified by:
getAggregatedImpressionsin interfaceRecommendationBufferService- Parameters:
batchSize- Batch size.- Returns:
ListofSAPRecoImpressionAggrModel.
-
getClickthroughs
Description copied from interface:RecommendationBufferServiceReadListofSAPRecoClickthroughModel.- Specified by:
getClickthroughsin interfaceRecommendationBufferService- Parameters:
readBatchSize- Batch size.- Returns:
ListofSAPRecoClickthroughModel
-
getGenericRecommendation
public SAPRecommendationBufferModel getGenericRecommendation(String scenarioId, String leadingItems) Description copied from interface:RecommendationBufferServiceGet recommendations with scope G- Specified by:
getGenericRecommendationin interfaceRecommendationBufferService- Parameters:
scenarioId- Scenario ID.leadingItems- Leading items.- Returns:
SAPRecommendationBufferModel.
-
getRestrictedRecommendation
public SAPRecommendationBufferModel getRestrictedRecommendation(String scenarioId, String leadingItems) Description copied from interface:RecommendationBufferServiceGet recommendations with scope R- Specified by:
getRestrictedRecommendationin interfaceRecommendationBufferService- Parameters:
scenarioId- Scenario ID.leadingItems- Leading items.- Returns:
SAPRecommendationBufferModel.
-
getOfferInteractions
Description copied from interface:RecommendationBufferServiceReadListofSAPOfferInteractionModel.- Specified by:
getOfferInteractionsin interfaceRecommendationBufferService- Parameters:
batchSize- Batch size.- Returns:
ListofSAPOfferInteractionModel.
-
getHashIdsForType
-
getHashIdsForUser
Description copied from interface:RecommendationBufferServiceGet all hash ids for user- Specified by:
getHashIdsForUserin interfaceRecommendationBufferService- Parameters:
userId- User IDscenarioId- Scenario ID- Returns:
- Comma separated list string of hash ids
-
getImpressions
Description copied from interface:RecommendationBufferServiceReadListofSAPRecoImpressionModel.- Specified by:
getImpressionsin interfaceRecommendationBufferService- Parameters:
readBatchSize- Batch size.- Returns:
ListofSAPRecoImpressionModel
-
getPersonalizedRecommendation
public SAPRecommendationBufferModel getPersonalizedRecommendation(String userId, String scenarioId, String leadingItems) Description copied from interface:RecommendationBufferServiceGet a recommendation.- Specified by:
getPersonalizedRecommendationin interfaceRecommendationBufferService- Parameters:
userId- User ID.scenarioId- Scenario ID.leadingItems- Leading items.- Returns:
SAPRecommendationBufferModel.
-
isRecommendationExpired
Description copied from interface:RecommendationBufferServiceCheck if a recommendation is expired.- Specified by:
isRecommendationExpiredin interfaceRecommendationBufferService- Parameters:
recommendation-SAPRecommendationBufferModel.- Returns:
- true if expired, false otherwise.
-
removeExpiredAny
-
removeExpiredMappings
public void removeExpiredMappings()Description copied from interface:RecommendationBufferServiceRemove expired mappings based on the expiry offset.- Specified by:
removeExpiredMappingsin interfaceRecommendationBufferService
-
removeExpiredRecommendations
public void removeExpiredRecommendations()Description copied from interface:RecommendationBufferServiceRemove expired recommendations based on the expiry offset.- Specified by:
removeExpiredRecommendationsin interfaceRecommendationBufferService
-
removeExpiredTypeMappings
public void removeExpiredTypeMappings()Description copied from interface:RecommendationBufferServiceRemove expired mappings based on the expiry offset.- Specified by:
removeExpiredTypeMappingsin interfaceRecommendationBufferService
-
saveRecommendation
public void saveRecommendation(String userId, String scenarioId, String hashId, String leadingItems, String recoList, String recoType, Date expiresOn) Description copied from interface:RecommendationBufferServiceAdd a new recommendation entry.- Specified by:
saveRecommendationin interfaceRecommendationBufferService- Parameters:
userId- User ID.scenarioId- Scenario ID.hashId- Hash ID.leadingItems- Leading items.recoList- Recommendation List.recoType- Recommendation Type.expiresOn- Expire date.
-
cutTo255
Takes a csv string and cuts it to fit in 255 characters. Required to make the recommended product list fit in the column. This makes the number of products that can be buffered dependent on the product id length and the number of products returned by the SAP Marketing recommendation model.- Parameters:
csvString- List of product IDs separated by comma.- Returns:
- List of product IDs separated by comma with maximum size 255.
-
saveRecommendationBuffer
-
saveRecommendationMapping
-
saveRecommendationTypeMapping
-
setEnableRecommendationBuffer
public void setEnableRecommendationBuffer(boolean enableRecommendationBuffer) -
setExpiryOffset
public void setExpiryOffset(int expiryOffset) -
setModelService
public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService) -
setRecommendationBufferDao
-