discount.drl 548 B

123456789101112131415161718192021
  1. package com.redhat.training.rules
  2. rule "Silver Loyalty is 15% Discount"
  3. ruleflow-group "discount"
  4. when
  5. c: Customer(loyaltyLevel == LoyaltyLevel.SILVER)
  6. t: Ticket(customer == c)
  7. then
  8. System.out.println("Setting SILVER discount: 15%");
  9. t.setDiscountPercent(15);
  10. end
  11. rule "Gold Loyalty is 25% Discount"
  12. ruleflow-group "discount"
  13. when
  14. c: Customer(loyaltyLevel == LoyaltyLevel.GOLD)
  15. t: Ticket(customer == c)
  16. then
  17. System.out.println("Setting GOLD discount: 25%");
  18. t.setDiscountPercent(25);
  19. end