Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions rules/src/main/java/ch/maxant/rules/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class Engine {
/** static variable bindings to be used in addition to the input when executing rules */
protected final Map<String, Object> statics;

private List<CompiledRule> rules;
protected List<CompiledRule> rules;
protected final Set<String> uniqueOutcomes = new HashSet<String>();
protected List<Rule> parsedRules;

Expand Down Expand Up @@ -436,12 +436,18 @@ public <Input> List<Rule> getMatchingRules(String nameSpacePattern, Input input)
}

Object o = MVEL.executeExpression(r.getCompiled(), vars);
String msg = r.getRule().getFullyQualifiedName() + "-{" + r.getRule().getExpression() + "}";
if(String.valueOf(o).equals("true")){
matchingRules.add(r.getRule());
if(log.isLoggable(Level.INFO)) log.info("matched: " + msg);
if(log.isLoggable(Level.FINE)) {
String msg = r.getRule().getFullyQualifiedName() + "-{" + r.getRule().getExpression() + "}";
log.fine("matched: " + msg);
}

}else{
if(log.isLoggable(Level.INFO)) log.info("unmatched: " + msg);
if(log.isLoggable(Level.FINE)) {
String msg = r.getRule().getFullyQualifiedName() + "-{" + r.getRule().getExpression() + "}";
log.fine("unmatched: " + msg);
}
}
}

Expand All @@ -451,7 +457,7 @@ public <Input> List<Rule> getMatchingRules(String nameSpacePattern, Input input)
return matchingRules;
}

private static final class CompiledRule {
protected static final class CompiledRule {
private Rule rule;
private Serializable compiled;
private CompiledRule(Rule rule) {
Expand Down