DMF-508 DMF-491: Change update with script method signature

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

Branch: refs/heads/master
Commit: c81564a7e501ee557d8618aa7543a90b7d10e1a2
Parents: 6e80b97
Author: Quentin Lamerand <[email protected]>
Authored: Thu Nov 19 15:00:14 2015 +0100
Committer: Quentin Lamerand <[email protected]>
Committed: Thu Nov 19 15:00:14 2015 +0100

----------------------------------------------------------------------
 .../elasticsearch/ElasticSearchPersistenceServiceImpl.java     | 2 +-
 .../org/apache/unomi/persistence/spi/PersistenceService.java   | 2 +-
 .../org/apache/unomi/services/services/SegmentServiceImpl.java | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c81564a7/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
 
b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
index a78cbc2..8d6c5fb 100644
--- 
a/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
+++ 
b/persistence-elasticsearch/core/src/main/java/org/apache/unomi/persistence/elasticsearch/ElasticSearchPersistenceServiceImpl.java
@@ -553,7 +553,7 @@ public class ElasticSearchPersistenceServiceImpl implements 
PersistenceService,
     }
 
     @Override
-    public boolean update(final String itemId, final Date dateHint, final 
Class<?> clazz, final String script, final Map<String, Object> scriptParams) {
+    public boolean updateWithScript(final String itemId, final Date dateHint, 
final Class<?> clazz, final String script, final Map<String, Object> 
scriptParams) {
         return new InClassLoaderExecute<Boolean>() {
             protected Boolean execute(Object... args) {
                 try {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c81564a7/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
----------------------------------------------------------------------
diff --git 
a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
 
b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
index 4a44c63..fc64d55 100644
--- 
a/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
+++ 
b/persistence-spi/src/main/java/org/apache/unomi/persistence/spi/PersistenceService.java
@@ -102,7 +102,7 @@ public interface PersistenceService {
      * @param scriptParams  script params
      * @return {@code true} if the update was successful, {@code false} 
otherwise
      */
-    boolean update(String itemId, Date dateHint, Class<?> clazz, String 
script, Map<String, Object> scriptParams);
+    boolean updateWithScript(String itemId, Date dateHint, Class<?> clazz, 
String script, Map<String, Object> scriptParams);
 
     /**
      * Retrieves the item identified with the specified identifier and with 
the specified Item subclass if it exists.

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/c81564a7/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
 
b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
index 2636daa..e74995b 100644
--- 
a/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
+++ 
b/services/src/main/java/org/apache/unomi/services/services/SegmentServiceImpl.java
@@ -694,14 +694,14 @@ public class SegmentServiceImpl implements 
SegmentService, SynchronousBundleList
         scriptParams.put("scoringId", scoring.getItemId());
 
         for (Profile profileToRemove : previousProfiles) {
-            persistenceService.update(profileToRemove.getItemId(), null, 
Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams);
+            persistenceService.updateWithScript(profileToRemove.getItemId(), 
null, Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams);
         }
         if(scoring.getMetadata().isEnabled()) {
             String script = "if (ctx._source.scores.containsKey(scoringId)) { 
ctx._source.scores[scoringId] += scoringValue } else { 
ctx._source.scores[scoringId] = scoringValue }";
             for (ScoringElement element : scoring.getElements()) {
                 scriptParams.put("scoringValue", element.getValue());
                 for (Profile p : 
persistenceService.query(element.getCondition(), null, Profile.class)) {
-                    persistenceService.update(p.getItemId(), null, 
Profile.class, script, scriptParams);
+                    persistenceService.updateWithScript(p.getItemId(), null, 
Profile.class, script, scriptParams);
                 }
             }
         }
@@ -720,7 +720,7 @@ public class SegmentServiceImpl implements SegmentService, 
SynchronousBundleList
         scriptParams.put("scoringId", scoringId);
 
         for (Profile profileToRemove : previousProfiles) {
-            persistenceService.update(profileToRemove.getItemId(), null, 
Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams);
+            persistenceService.updateWithScript(profileToRemove.getItemId(), 
null, Profile.class, "ctx._source.scores.remove(scoringId)", scriptParams);
         }
         logger.info("Profiles updated in {}", System.currentTimeMillis()-t);
     }

Reply via email to