Repository: incubator-unomi
Updated Branches:
  refs/heads/master ad73b222e -> 5084951dd


UNOMI-23 : Always set default scope on rules


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

Branch: refs/heads/master
Commit: 5084951ddd9be39617cd1ac2b178f6ba6e14392b
Parents: ad73b22
Author: Thomas Draier <dra...@apache.org>
Authored: Thu Apr 14 18:21:44 2016 +0200
Committer: Thomas Draier <dra...@apache.org>
Committed: Thu Apr 14 18:21:44 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/5084951d/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 722c55c..b1d4d51 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
@@ -147,9 +147,6 @@ public class RulesServiceImpl implements RulesService, 
EventListenerService, Syn
 
             try {
                 Rule rule = 
CustomObjectMapper.getObjectMapper().readValue(predefinedSegmentURL, 
Rule.class);
-                if (rule.getMetadata().getScope() == null) {
-                    rule.getMetadata().setScope("systemscope");
-                }
                 setRule(rule);
             } catch (IOException e) {
                 logger.error("Error while loading segment definition " + 
predefinedSegmentURL, e);
@@ -278,6 +275,9 @@ public class RulesServiceImpl implements RulesService, 
EventListenerService, Syn
     }
 
     public void setRule(Rule rule) {
+        if (rule.getMetadata().getScope() == null) {
+            rule.getMetadata().setScope("systemscope");
+        }
         Condition condition = rule.getCondition();
         if (condition != null) {
             if (rule.getMetadata().isEnabled() && 
!rule.getMetadata().isMissingPlugins()) {

Reply via email to