@PostConstruct
  public void initializeDiscountRules() {
    List<DiscountRuleEntry> rules = rulesDAO.findAllDiscountRuleEntries();
    if ((rules == null) || (rules.size() == 0)) {
      log.info("Creating initial sample discount rules: ...");
      rulesDAO.save(new DiscountRuleEntry("Small orders", 0, 500, 5));
      rulesDAO.save(new DiscountRuleEntry("Medium orders", 500, 1000, 7));
      rulesDAO.save(new DiscountRuleEntry("Big orders", 1000, 5000, 10));
    }
  }
@PostConstruct
  public void initializeDiscountRules() {
    List<DiscountRuleEntry> rules = rulesDAO.findAllDiscountRuleEntries();
    if ((rules == null) || (rules.size() == 0)) {
      log.info("Creating initial sample discount rules: ...");
      rulesDAO.save(new DiscountRuleEntry("Small orders", 0, 500, 5));
      rulesDAO.save(new DiscountRuleEntry("Medium orders", 500, 1000, 7));
      rulesDAO.save(new DiscountRuleEntry("Big orders", 1000, 5000, 10));
    }
  }
@ PostConstruct public void initializeDiscountRules ( ) { List < DiscountRuleEntry > rules = rulesDAO . findAllDiscountRuleEntries ( ) ; if ( ( rules == null ) || ( rules . size ( ) == 0 ) ) { log . info ( "Creating initial sample discount rules: ..." ) ; rulesDAO . save ( new DiscountRuleEntry ( "Small orders" , 0 , 500 , 5 ) ) ; rulesDAO . save ( new DiscountRuleEntry ( "Medium orders" , 500 , 1000 , 7 ) ) ; rulesDAO . save ( new DiscountRuleEntry ( "Big orders" , 1000 , 5000 , 10 ) ) ; } }
/*
If no discount rules are present in the database, we create some initial ones
/ * If no discount rules are present in the database we create some initial ones