You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2017/07/13 08:59:21 UTC

incubator-unomi git commit: UNOMI-114 Disabled rules are still executed - Make sure that we don't use disabled rules.

Repository: incubator-unomi
Updated Branches:
  refs/heads/master f0f871da4 -> 1e605ac9c


UNOMI-114 Disabled rules are still executed
- Make sure that we don't use disabled rules.

Signed-off-by: Serge Huber <sh...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/1e605ac9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/1e605ac9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/1e605ac9

Branch: refs/heads/master
Commit: 1e605ac9ca45a721ce65a3b3a99184533582642e
Parents: f0f871d
Author: Serge Huber <sh...@apache.org>
Authored: Thu Jul 13 10:59:02 2017 +0200
Committer: Serge Huber <sh...@apache.org>
Committed: Thu Jul 13 10:59:12 2017 +0200

----------------------------------------------------------------------
 .../org/apache/unomi/services/services/RulesServiceImpl.java   | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/1e605ac9/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
index b3062c1..973a4a1 100644
--- a/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/RulesServiceImpl.java
@@ -168,6 +168,9 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
         List<Rule> allItems = allRules;
 
         for (Rule rule : allItems) {
+            if (!rule.getMetadata().isEnabled()) {
+                continue;
+            }
             RuleStatistics ruleStatistics = getLocalRuleStatistics(rule);
             long ruleConditionStartTime = System.currentTimeMillis();
             String scope = rule.getMetadata().getScope();
@@ -336,6 +339,9 @@ public class RulesServiceImpl implements RulesService, EventListenerService, Syn
     public Set<Condition> getTrackedConditions(Item source){
         Set<Condition> trackedConditions = new HashSet<>();
         for (Rule r : allRules) {
+            if (!r.getMetadata().isEnabled()) {
+                continue;
+            }
             Condition trackedCondition = definitionsService.extractConditionByTag(r.getCondition(), "trackedCondition");
             if(trackedCondition != null){
                 Condition sourceEventPropertyCondition = definitionsService.extractConditionByTag(r.getCondition(), "sourceEventCondition");