Class CampaignRestrictionEvaluator
- java.lang.Object
-
- com.hybris.ymkt.segmentation.evaluators.CampaignRestrictionEvaluator
-
- All Implemented Interfaces:
CMSRestrictionEvaluator<CMSYmktCampaignRestrictionModel>
public class CampaignRestrictionEvaluator extends java.lang.Object implements CMSRestrictionEvaluator<CMSYmktCampaignRestrictionModel>
-
-
Field Summary
Fields Modifier and Type Field Description protected InitiativeServiceinitiativeServiceprotected static java.lang.StringSESSION_PREFIXprotected SessionServicesessionServiceprotected UserContextServiceuserContextService
-
Constructor Summary
Constructors Constructor Description CampaignRestrictionEvaluator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddCampaignsToSession(java.util.List<java.lang.String> campaignsList)booleanevaluate(CMSYmktCampaignRestrictionModel campaignRestriction, RestrictionData context)This evaluator checks if the restriction is applicable.
The restriction is true when the user belongs in a target group associated with the selected campaign
The memberOfCampaign flag can be used to negate the restriction
e.g.
memberOfCampaign=true -> Restriction evaluates to true when user belongs to selected campaign
memberOfCampaign=false -> Restriction evaluates to false when user belongs to selected campaignprotected java.util.List<java.lang.String>getCampaignsFromBackend()Retrieve user's campaigns from back end system and adds them to user sessionprotected java.util.Optional<java.util.List<java.lang.String>>getCampaignsFromSession()voidsetInitiativeService(InitiativeService initiativeService)voidsetSessionService(SessionService sessionService)voidsetUserContextService(UserContextService userContextService)
-
-
-
Field Detail
-
SESSION_PREFIX
protected static final java.lang.String SESSION_PREFIX
- See Also:
- Constant Field Values
-
initiativeService
protected InitiativeService initiativeService
-
sessionService
protected SessionService sessionService
-
userContextService
protected UserContextService userContextService
-
-
Method Detail
-
addCampaignsToSession
protected void addCampaignsToSession(java.util.List<java.lang.String> campaignsList)
-
evaluate
public boolean evaluate(CMSYmktCampaignRestrictionModel campaignRestriction, RestrictionData context)
This evaluator checks if the restriction is applicable.
The restriction is true when the user belongs in a target group associated with the selected campaign
The memberOfCampaign flag can be used to negate the restriction
e.g.
memberOfCampaign=true -> Restriction evaluates to true when user belongs to selected campaign
memberOfCampaign=false -> Restriction evaluates to false when user belongs to selected campaign- Specified by:
evaluatein interfaceCMSRestrictionEvaluator<CMSYmktCampaignRestrictionModel>- Parameters:
campaignRestriction-context-- Returns:
- true if user belongs to campaign
-
getCampaignsFromBackend
protected java.util.List<java.lang.String> getCampaignsFromBackend()
Retrieve user's campaigns from back end system and adds them to user session- Returns:
- A list of campaigns
-
getCampaignsFromSession
protected java.util.Optional<java.util.List<java.lang.String>> getCampaignsFromSession()
-
setInitiativeService
public void setInitiativeService(InitiativeService initiativeService)
-
setSessionService
public void setSessionService(SessionService sessionService)
-
setUserContextService
public void setUserContextService(UserContextService userContextService)
-
-