com.elasticpath.service.rules.impl
Class EpRuleEngineImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.rules.impl.EpRuleEngineImpl
All Implemented Interfaces:
EpService, EpRuleEngine

public class EpRuleEngineImpl
extends AbstractEpServiceImpl
implements EpRuleEngine

Executes rules-engine rules on objects passed as parameters to this class. This rules engine is implemented using Drools Rules 3.0.


Constructor Summary
EpRuleEngineImpl()
          Default Constructor.
 
Method Summary
 void fireCatalogPromotionRules(java.util.Collection products, ShoppingCart shoppingCart)
          Executes promotion rules for the given products.
 void fireCatalogPromotionRules(Product product, ShoppingCart shoppingCart)
          Executes promotion rules for the specified product.
 void fireOrderPromotionRules(ShoppingCart shoppingCart)
          Executes order promotion rules on the specified shopping cart.
 TimeService getTimeService()
          Returns the time service.
 void recompileRuleBase()
          Regenerates the rule base using a new set of rules retrieved from the persistence layer.
 void setPromotionRuleDelegate(PromotionRuleDelegate promotionRuleDelegate)
          Set the promotion rule helper that will be passed into the working memory.
 void setPropertiesDao(PropertiesDao propertiesDao)
          Set the DAO used to load properties.
 void setRuleSetService(RuleSetService ruleSetService)
          Set the rule set service that will provide rules.
 void setTimeService(TimeService timeService)
          Sets the time service.
 void setUtility(Utility utility)
          Set the utility class.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

EpRuleEngineImpl

public EpRuleEngineImpl()
Default Constructor.

Method Detail

fireCatalogPromotionRules

public void fireCatalogPromotionRules(java.util.Collection products,
                                      ShoppingCart shoppingCart)
Executes promotion rules for the given products.

Specified by:
fireCatalogPromotionRules in interface EpRuleEngine
Parameters:
products - the product list whose promotion price is to be computed
shoppingCart - the customer's shopping cart, which can affect the product promotion applied

fireCatalogPromotionRules

public void fireCatalogPromotionRules(Product product,
                                      ShoppingCart shoppingCart)
Executes promotion rules for the specified product.

Specified by:
fireCatalogPromotionRules in interface EpRuleEngine
Parameters:
product - the product whose promotion price is to be computed
shoppingCart - the customer's shopping cart, which can affect the product promotion applied set to null if no cart is available

fireOrderPromotionRules

public void fireOrderPromotionRules(ShoppingCart shoppingCart)
Executes order promotion rules on the specified shopping cart.

Specified by:
fireOrderPromotionRules in interface EpRuleEngine
Parameters:
shoppingCart - the cart to which promotion rules are to be applied.

getTimeService

public TimeService getTimeService()
Returns the time service.

Returns:
the time service.

recompileRuleBase

public void recompileRuleBase()
Regenerates the rule base using a new set of rules retrieved from the persistence layer.

Specified by:
recompileRuleBase in interface EpRuleEngine

setPromotionRuleDelegate

public void setPromotionRuleDelegate(PromotionRuleDelegate promotionRuleDelegate)
Set the promotion rule helper that will be passed into the working memory.

Specified by:
setPromotionRuleDelegate in interface EpRuleEngine
Parameters:
promotionRuleDelegate - the PromotionRuleDelegate

setPropertiesDao

public void setPropertiesDao(PropertiesDao propertiesDao)
Set the DAO used to load properties.

Parameters:
propertiesDao - the DAO used to load properties.

setRuleSetService

public void setRuleSetService(RuleSetService ruleSetService)
Set the rule set service that will provide rules.

Specified by:
setRuleSetService in interface EpRuleEngine
Parameters:
ruleSetService - the RuleSetService

setTimeService

public void setTimeService(TimeService timeService)
Sets the time service.

Parameters:
timeService - the time service

setUtility

public void setUtility(Utility utility)
Set the utility class.

Parameters:
utility - the utility class