コード例 #1
0
 /**
  * Promotion test persister constructor.
  *
  * @param beanFactory the bean factory
  */
 public PromotionTestPersister(final BeanFactory beanFactory) {
   this.beanFactory = beanFactory;
   tac = beanFactory.getBean("testApplicationContext");
   ruleService = beanFactory.getBean(ContextIdNames.RULE_SERVICE);
   ruleSetService = beanFactory.getBean(ContextIdNames.RULE_SET_SERVICE);
   storeService = beanFactory.getBean(ContextIdNames.STORE_SERVICE);
   catalogService = beanFactory.getBean(ContextIdNames.CATALOG_SERVICE);
   sellingContextService = beanFactory.getBean(ContextIdNames.SELLING_CONTEXT_SERVICE);
   tagConditionService = beanFactory.getBean(ContextIdNames.TAG_CONDITION_SERVICE);
   ruleEngine = beanFactory.getBean("epRuleEngine");
   ruleEngine.resetRuleBaseCache();
 }
コード例 #2
0
 /**
  * Update a given promotion rule with conditions cleanup.
  *
  * @param promotionRule promotion rule to update
  * @return updated promotion rule
  */
 public Rule updatePromotionRuleWithConditionsCleanup(final Rule promotionRule) {
   if (promotionRule.getSellingContext() != null) {
     SellingContext sellingContext =
         sellingContextService.getByGuid(promotionRule.getSellingContext().getGuid());
     for (ConditionalExpression conditionalExpression : sellingContext.getConditions().values()) {
       tagConditionService.delete(conditionalExpression);
     }
   }
   Rule updatedPromotionRule = ruleService.update(promotionRule);
   ruleEngine.recompileRuleBase();
   return updatedPromotionRule;
 }
コード例 #3
0
 /**
  * Update a given promotion rule.
  *
  * @param promotionRule promotion rule to update
  * @return updated promotion rule
  */
 public Rule updatePromotionRule(final Rule promotionRule) {
   Rule updatedPromotionRule = ruleService.update(promotionRule);
   ruleEngine.recompileRuleBase();
   return updatedPromotionRule;
 }
コード例 #4
0
 /**
  * Save configured rule into a database.
  *
  * @param promotionRule to be saved
  * @return persisted rule
  */
 public Rule persistPromotionRule(final Rule promotionRule) {
   Rule persistedPromotionRule = ruleService.add(promotionRule);
   ruleEngine.recompileRuleBase();
   return persistedPromotionRule;
 }