Class ImpressionService
java.lang.Object
com.hybris.ymkt.recommendation.services.ImpressionService
This service is responsible to record/track, aggregate and send recommendations seen/printed to the users.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected static final intprotected de.hybris.platform.servicelayer.model.ModelServiceprotected ODataServiceprotected intprotected RecommendationBufferServiceprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAggregate individual impressions, save the aggregated impressions and delete the individual impressions.protected List<SAPRecoImpressionAggrModel>aggregateImpressionsByScenario(List<SAPRecoImpressionModel> impressionsList) Aggregates impressions by scenario and aggregationTimeStamp
Aggregation timestamp is the midpoint of the time window based on the current time
e.g.
Current time = 1:04:32.512
Time window = 5 minutes
AggregatedTimeStamp = 1:02:30 (midpoint between 1:00 and 1:05)protected longcalcMidTimeStamp(long datetime) booleanpostImpression(SAPRecoImpressionAggrModel aggregatedImpression) Send aggregated impression via oDatavoidsaveImpression(ImpressionContext impressionContext) Save individual impressions when UI component is viewedvoidGet aggregated impressions for sending via oData.
If successfully sent, delete it.voidsetAggregationTimeWindow(long aggregationTimeWindow) voidsetModelService(de.hybris.platform.servicelayer.model.ModelService modelService) voidsetODataService(ODataService oDataService) voidsetReadBatchSize(int readBatchSize) voidsetRecommendationBufferService(RecommendationBufferService recommendationBufferService) voidsetSendBatchSize(int sendBatchSize)
-
Field Details
-
MAX_FAILURE
protected static final int MAX_FAILURE- See Also:
-
aggregationTimeWindow
protected long aggregationTimeWindow -
modelService
protected de.hybris.platform.servicelayer.model.ModelService modelService -
oDataService
-
readBatchSize
protected int readBatchSize -
recommendationBufferService
-
sendBatchSize
protected int sendBatchSize
-
-
Constructor Details
-
ImpressionService
public ImpressionService()
-
-
Method Details
-
aggregateImpressions
public void aggregateImpressions()Aggregate individual impressions, save the aggregated impressions and delete the individual impressions. Exceptions must be handles by the caller. -
aggregateImpressionsByScenario
protected List<SAPRecoImpressionAggrModel> aggregateImpressionsByScenario(List<SAPRecoImpressionModel> impressionsList) Aggregates impressions by scenario and aggregationTimeStamp
Aggregation timestamp is the midpoint of the time window based on the current time
e.g.
Current time = 1:04:32.512
Time window = 5 minutes
AggregatedTimeStamp = 1:02:30 (midpoint between 1:00 and 1:05)- Parameters:
impressionsList-ListofSAPRecoImpressionModel- Returns:
- aggregatedImpressionsList
-
calcMidTimeStamp
protected long calcMidTimeStamp(long datetime) -
postImpression
Send aggregated impression via oData- Parameters:
aggregatedImpression-SAPRecoImpressionAggrModel- Returns:
- true if posting was a success, false otherwise.
-
saveImpression
Save individual impressions when UI component is viewed- Parameters:
impressionContext- the impression data to save
-
sendAggregatedImpressions
public void sendAggregatedImpressions()Get aggregated impressions for sending via oData.
If successfully sent, delete it. If sending failed, keep it for next time -
setAggregationTimeWindow
public void setAggregationTimeWindow(long aggregationTimeWindow) -
setModelService
public void setModelService(de.hybris.platform.servicelayer.model.ModelService modelService) -
setODataService
-
setReadBatchSize
public void setReadBatchSize(int readBatchSize) -
setRecommendationBufferService
-
setSendBatchSize
public void setSendBatchSize(int sendBatchSize)
-