Update shop tutorial

pull/284/head
Mahmoud Ben Hassine 5 years ago
parent 346e5ff4ce
commit 54cada8901
No known key found for this signature in database
GPG Key ID: 79FCFB0A184E0036

@ -219,6 +219,9 @@
<version>${maven-exec-plugin.version}</version>
<configuration>
<mainClass>org.jeasy.rules.tutorials.shop.Launcher</mainClass>
<arguments>
<argument>${project.basedir}/src/main/java/org/jeasy/rules/tutorials/shop/alcohol-rule.yml</argument>
</arguments>
</configuration>
</plugin>
</plugins>

@ -45,12 +45,13 @@ public class Launcher {
// create rules
MVELRule ageRule = new MVELRule()
.name("age rule")
.description("Check if person's age is > 18 and marks the person as adult")
.description("Check if person's age is > 18 and mark the person as adult")
.priority(1)
.when("person.age > 18")
.then("person.setAdult(true);");
MVELRuleFactory ruleFactory = new MVELRuleFactory(new YamlRuleDefinitionReader());
Rule alcoholRule = ruleFactory.createRule(new FileReader("src/main/java/org/jeasy/rules/tutorials/shop/alcohol-rule.yml"));
String fileName = args.length != 0 ? args[0] : "easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/alcohol-rule.yml";
Rule alcoholRule = ruleFactory.createRule(new FileReader(fileName));
// create a rule set
Rules rules = new Rules();

Loading…
Cancel
Save