You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dr...@apache.org on 2016/07/27 11:53:54 UTC

[3/4] incubator-unomi git commit: DMF-741 : send it also when segments are updated

DMF-741 : send it also when segments are updated


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

Branch: refs/heads/master
Commit: ef104b71b61cb7f619224e3da47a51fc7bce3fe9
Parents: 8fb2883
Author: Abdelkader Midani <am...@jahia.com>
Authored: Mon Jul 25 18:45:43 2016 +0200
Committer: Abdelkader Midani <am...@jahia.com>
Committed: Mon Jul 25 18:45:43 2016 +0200

----------------------------------------------------------------------
 .../unomi/services/services/SegmentServiceImpl.java      | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/ef104b71/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 744bd71..6149f62 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
@@ -638,26 +638,19 @@ public class SegmentServiceImpl implements SegmentService, SynchronousBundleList
             add.removeAll(previousProfiles);
             previousProfiles.removeAll(newProfiles);
 
-            Map<String, Event> updatedProfiles = new HashMap<>();
-
             for (Profile profileToAdd : add) {
                 profileToAdd.getSegments().add(segment.getItemId());
                 persistenceService.update(profileToAdd.getItemId(), null, Profile.class, "segments", profileToAdd.getSegments());
                 Event profileUpdated = new Event("profileUpdated", null, profileToAdd, null, null, profileToAdd, new Date());
                 profileUpdated.setPersistent(false);
-                updatedProfiles.put(profileToAdd.getItemId(), profileUpdated);
+                eventService.send(profileUpdated);
             }
             for (Profile profileToRemove : previousProfiles) {
                 profileToRemove.getSegments().remove(segment.getItemId());
                 persistenceService.update(profileToRemove.getItemId(), null, Profile.class, "segments", profileToRemove.getSegments());
                 Event profileUpdated = new Event("profileUpdated", null, profileToRemove, null, null, profileToRemove, new Date());
                 profileUpdated.setPersistent(false);
-                updatedProfiles.put(profileToRemove.getItemId(), profileUpdated);
-            }
-
-            Iterator<Map.Entry<String, Event>> entries = updatedProfiles.entrySet().iterator();
-            while (entries.hasNext()) {
-                eventService.send(entries.next().getValue());
+                eventService.send(profileUpdated);
             }
 
         } else {