UNOMI-47 : 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/3e094f10 Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/3e094f10 Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/3e094f10 Branch: refs/heads/master Commit: 3e094f100263e45b10f7a883cfe2afebb2706682 Parents: 6846933 Author: Abdelkader Midani <[email protected]> Authored: Mon Jul 25 18:45:43 2016 +0200 Committer: Quentin Lamerand <[email protected]> Committed: Thu Aug 4 19:01:57 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/3e094f10/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 {
