Class OfferDiscoveryService
- java.lang.Object
-
- com.hybris.ymkt.recommendation.services.OfferDiscoveryService
-
public class OfferDiscoveryService extends java.lang.Object
This 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.String
ACCEPT
protected CartService
cartService
protected CommonI18NService
commonI18NService
protected static org.apache.olingo.odata2.api.ep.EntityProviderReadProperties
NO_READ_PROPERTIES
protected ODataService
oDataService
protected RecentViewedItemsService
recentViewedItemsService
protected RecommendationBufferService
recommendationBufferService
protected static java.lang.String
RECOMMENDATIONS
protected UserContextService
userContextService
-
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)
OfferRecommendation
createOfferRecommendation(OfferRecommendationScenario.Result result)
Represents one offer recommendation built from odata Resultprotected OfferRecommendationScenario
createOfferRecommendationScenario(OfferRecommendationContext context)
Build ContextParams, BasketObjects and LeadingObjects filtersprotected SAPOfferContentPosition
createSAPOfferContentPosition(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
protected SAPRecommendationItemDataSourceType
createSAPRecommendationItemDataSourceType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
protected java.lang.String
createSAPRecommendationType(org.apache.olingo.odata2.api.ep.entry.ODataEntry entry)
protected void
executeOfferRecommendation(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()
void
setCartService(CartService cartService)
void
setCommonI18NService(CommonI18NService commonI18NService)
void
setODataService(ODataService oDataService)
void
setRecentViewedItemsService(RecentViewedItemsService recentViewedItemsService)
void
setRecommendationBufferService(RecommendationBufferService recommendationBufferService)
void
setUserContextService(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:
List
of OfferRecommendation
-
getOfferRecommendationScenarios
@Nonnull public java.util.List<java.lang.String> getOfferRecommendationScenarios() throws java.io.IOException
- Returns:
List
ofSAPRecommendationType
from 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)
-
-