Class OfferDiscoveryService
- java.lang.Object
-
- com.hybris.ymkt.recommendation.services.OfferDiscoveryService
-
public class OfferDiscoveryService extends java.lang.ObjectThis service provides offer recommendations and helper values from the CUAN_OFFER_DISCOVERY_SRV oData service
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringACCEPTprotected CartServicecartServiceprotected CommonI18NServicecommonI18NServiceprotected static org.apache.olingo.odata2.api.ep.EntityProviderReadPropertiesNO_READ_PROPERTIESprotected ODataServiceoDataServiceprotected RecentViewedItemsServicerecentViewedItemsServiceprotected RecommendationBufferServicerecommendationBufferServiceprotected static java.lang.StringRECOMMENDATIONSprotected UserContextServiceuserContextService
-
Constructor Summary
Constructors Constructor Description OfferDiscoveryService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.Object>convertMapBasketObject(RecommendationScenario.BasketObject bo)protected java.util.Map<java.lang.String,java.lang.Object>convertMapContextParams(OfferRecommendationScenario.ContextParam cp)protected java.util.Map<java.lang.String,java.lang.Object>convertMapLeadingObject(RecommendationScenario.LeadingObject lo)OfferRecommendationcreateOfferRecommendation(OfferRecommendationScenario.Result result)Represents one offer recommendation built from odata Resultprotected OfferRecommendationScenariocreateOfferRecommendationScenario(OfferRecommendationContext context)Build ContextParams, BasketObjects and LeadingObjects filtersprotected SAPOfferContentPositioncreateSAPOfferContentPosition(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)protected SAPRecommendationItemDataSourceTypecreateSAPRecommendationItemDataSourceType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)protected java.lang.StringcreateSAPRecommendationType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)protected voidexecuteOfferRecommendation(OfferRecommendationScenario offerRecommendationScenario)protected java.util.List<java.lang.String>getCartItemsFromSession()java.util.List<SAPOfferContentPosition>getContentPositionValues()java.util.List<OfferRecommendation>getOfferRecommendations(OfferRecommendationContext context)Main method to trigger offer recommendation retrievaljava.util.List<java.lang.String>getOfferRecommendationScenarios()voidsetCartService(CartService cartService)voidsetCommonI18NService(CommonI18NService commonI18NService)voidsetODataService(ODataService oDataService)voidsetRecentViewedItemsService(RecentViewedItemsService recentViewedItemsService)voidsetRecommendationBufferService(RecommendationBufferService recommendationBufferService)voidsetUserContextService(UserContextService userContextService)
-
-
-
Field Detail
-
ACCEPT
protected static final java.lang.String ACCEPT
- See Also:
- Constant Field Values
-
NO_READ_PROPERTIES
protected static final org.apache.olingo.odata2.api.ep.EntityProviderReadProperties NO_READ_PROPERTIES
-
RECOMMENDATIONS
protected static final java.lang.String RECOMMENDATIONS
- See Also:
- Constant Field Values
-
cartService
protected CartService cartService
-
commonI18NService
protected CommonI18NService commonI18NService
-
oDataService
protected ODataService oDataService
-
recentViewedItemsService
protected RecentViewedItemsService recentViewedItemsService
-
recommendationBufferService
protected RecommendationBufferService recommendationBufferService
-
userContextService
protected UserContextService userContextService
-
-
Method Detail
-
convertMapBasketObject
protected java.util.Map<java.lang.String,java.lang.Object> convertMapBasketObject(RecommendationScenario.BasketObject bo)
-
convertMapContextParams
protected java.util.Map<java.lang.String,java.lang.Object> convertMapContextParams(OfferRecommendationScenario.ContextParam cp)
-
convertMapLeadingObject
protected java.util.Map<java.lang.String,java.lang.Object> convertMapLeadingObject(RecommendationScenario.LeadingObject lo)
-
createOfferRecommendation
public OfferRecommendation createOfferRecommendation(OfferRecommendationScenario.Result result)
Represents one offer recommendation built from odata Result- Parameters:
result-OfferRecommendationScenario.Result- Returns:
OfferRecommendation
-
createOfferRecommendationScenario
protected OfferRecommendationScenario createOfferRecommendationScenario(OfferRecommendationContext context)
Build ContextParams, BasketObjects and LeadingObjects filters- Parameters:
context- Request parameters and filters- Returns:
- OfferRecommendationScenario
-
createSAPOfferContentPosition
protected SAPOfferContentPosition createSAPOfferContentPosition(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
-
createSAPRecommendationItemDataSourceType
protected SAPRecommendationItemDataSourceType createSAPRecommendationItemDataSourceType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
-
createSAPRecommendationType
protected java.lang.String createSAPRecommendationType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
-
executeOfferRecommendation
protected void executeOfferRecommendation(OfferRecommendationScenario offerRecommendationScenario) throws java.io.IOException
- Throws:
java.io.IOException
-
getCartItemsFromSession
protected java.util.List<java.lang.String> getCartItemsFromSession()
-
getContentPositionValues
public java.util.List<SAPOfferContentPosition> getContentPositionValues() throws java.io.IOException
- Throws:
java.io.IOException
-
getOfferRecommendations
public java.util.List<OfferRecommendation> getOfferRecommendations(OfferRecommendationContext context)
Main method to trigger offer recommendation retrieval- Parameters:
context- Request parameters and filters- Returns:
Listof OfferRecommendation
-
getOfferRecommendationScenarios
@Nonnull public java.util.List<java.lang.String> getOfferRecommendationScenarios() throws java.io.IOException- Returns:
ListofSAPRecommendationTypefrom the yMKT system.
The list is sorted bySAPRecommendationType#getId().- Throws:
java.io.IOException
-
setCartService
public void setCartService(CartService cartService)
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
setODataService
public void setODataService(ODataService oDataService)
-
setRecentViewedItemsService
public void setRecentViewedItemsService(RecentViewedItemsService recentViewedItemsService)
-
setRecommendationBufferService
public void setRecommendationBufferService(RecommendationBufferService recommendationBufferService)
-
setUserContextService
public void setUserContextService(UserContextService userContextService)
-
-