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 <[email protected]> Authored: Mon Jul 25 18:45:43 2016 +0200 Committer: Abdelkader Midani <[email protected]> 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 {
