You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by ql...@apache.org on 2016/09/07 09:06:12 UTC
incubator-unomi git commit: UNOMI-32 fix issue with missing save
after event execution.
Repository: incubator-unomi
Updated Branches:
refs/heads/master f40318a99 -> f47e84666
UNOMI-32 fix issue with missing save after event execution.
Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/f47e8466
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/f47e8466
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/f47e8466
Branch: refs/heads/master
Commit: f47e846660cb7c785ee4bff39809848266678230
Parents: f40318a
Author: dgaillard <dg...@jahia.com>
Authored: Wed Sep 7 10:59:59 2016 +0200
Committer: dgaillard <dg...@jahia.com>
Committed: Wed Sep 7 10:59:59 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/unomi/api/services/ProfileService.java | 2 +-
.../java/org/apache/unomi/rest/ProfileServiceEndPoint.java | 8 ++++++--
.../apache/unomi/services/services/ProfileServiceImpl.java | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/f47e8466/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
index a998e5e..3422054 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
@@ -111,7 +111,7 @@ public interface ProfileService {
* @param profile the profile to be saved
* @return the newly saved profile
*/
- boolean saveOrmerge(Profile profile);
+ boolean saveOrMerge(Profile profile);
/**
* Removes the profile (or persona if the {@code persona} parameter is set to {@code true}) identified by the specified identifier.
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/f47e8466/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
----------------------------------------------------------------------
diff --git a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
index 038178d..ace49c0 100644
--- a/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
+++ b/rest/src/main/java/org/apache/unomi/rest/ProfileServiceEndPoint.java
@@ -193,10 +193,14 @@ public class ProfileServiceEndPoint {
@POST
@Path("/")
public Profile save(Profile profile) {
- if (profileService.saveOrmerge(profile)) {
+ if (profileService.saveOrMerge(profile)) {
+ profile = profileService.load(profile.getItemId());
Event profileUpdated = new Event("profileUpdated", null, profile, null, null, profile, new Date());
profileUpdated.setPersistent(false);
- eventService.send(profileUpdated);
+ int changes = eventService.send(profileUpdated);
+ if ((changes & EventService.PROFILE_UPDATED) == EventService.PROFILE_UPDATED) {
+ profileService.save(profile);
+ }
}
return profile;
http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/f47e8466/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
----------------------------------------------------------------------
diff --git a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
index 4e680fc..eaf8d98 100644
--- a/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
+++ b/services/src/main/java/org/apache/unomi/services/services/ProfileServiceImpl.java
@@ -400,7 +400,7 @@ public class ProfileServiceImpl implements ProfileService, SynchronousBundleList
return persistenceService.load(profile.getItemId(), Profile.class);
}
- public boolean saveOrmerge(Profile profile) {
+ public boolean saveOrMerge(Profile profile) {
Profile previousProfile = persistenceService.load(profile.getItemId(), Profile.class);
if (previousProfile == null) {
return persistenceService.save(profile);